예제 #1
0
파일: Srv.cs 프로젝트: hdeshev/cs-netdns
 /// <summary>
 /// Constructs an MX record by reading bytes from a return message
 /// </summary>
 /// <param name="pointer">A logical pointer to the bytes holding the record</param>
 public Srv(Pointer pointer)
 {
     this.priority = pointer.ReadShort();
     this.weight = pointer.ReadShort();
     this.port = pointer.ReadShort();
     this.hostname = pointer.ReadDomain();
 }
예제 #2
0
        /// <summary>
        /// Construct a resource record from a pointer to a byte array
        /// </summary>
        /// <param name="pointer">the position in the byte array of the record</param>
        internal ResourceRecord(Pointer pointer)
        {
            // extract the domain, question type, question class and Ttl
            domain = pointer.ReadDomain();
            dnsType = (DnsType)pointer.ReadShort();
            dnsClass = (DnsClass)pointer.ReadShort();
            ttl = pointer.ReadInt();

            // the next short is the record length
            length = pointer.ReadShort();

            // and create the appropriate RDATA record based on the dnsType
            switch (dnsType)
            {
                case DnsType.A:		record = new A(pointer);	break;
                case DnsType.AAAA:	record = new Aaaa(pointer);	break;
                case DnsType.Cname:	record = new Cname(pointer); break;
                case DnsType.HINFO:	record = new HInfo(pointer); break;
                case DnsType.LOC:	record = new Loc(pointer);	break;
                case DnsType.MX:	record = new MX(pointer);	break;
                case DnsType.NS:	record = new NS(pointer);	break;
                case DnsType.PTR:	record = new Ptr(pointer); break;
                case DnsType.SOA:	record = new Soa(pointer);	break;
                case DnsType.SRV:	record = new Srv(pointer); break;
                case DnsType.SSHFP:	record = new SshFP(pointer); break;
                case DnsType.TXT:	record = new Txt(pointer, length); break;
                case DnsType.NULL:	record = new Null(pointer, length); break;

                //mail related RR types
                case DnsType.MB:	record = new MB(pointer); break;
                case DnsType.MD:	record = new MD(pointer); break;
                case DnsType.MF:	record = new MF(pointer); break;
                case DnsType.MG:	record = new MG(pointer); break;
                case DnsType.MINFO:	record = new MInfo(pointer); break;

                //RFC 1183 RR types
                case DnsType.AFSDB: record = new Afsdb(pointer); break;
                case DnsType.RP:    record = new Rp(pointer); break;
                default:
                {
                    // move the pointer over this unrecognised record
                    pointer += length;
                    break;
                }
            }
        }
예제 #3
0
파일: MX.cs 프로젝트: hdeshev/cs-netdns
 /// <summary>
 /// Constructs an MX record by reading bytes from a return message
 /// </summary>
 /// <param name="pointer">A logical pointer to the bytes holding the record</param>
 public MX(Pointer pointer)
 {
     preference = pointer.ReadShort();
     hostname = pointer.ReadDomain();
 }
예제 #4
0
파일: Afsdb.cs 프로젝트: hdeshev/cs-netdns
 /// <summary>
 /// Constructs a NS record by reading bytes from a return message
 /// </summary>
 /// <param name="pointer">A logical pointer to the bytes holding the record</param>
 internal Afsdb(Pointer pointer)
 {
     pref = pointer.ReadShort();
     hostname = pointer.ReadDomain();
 }