예제 #1
0
        ///<summary>
        ///</summary>
        ///<returns></returns>
        public string ReadDomainName()
        {
            var name = new StringBuilder();
            int length;

            // get  the length of the first label
            while ((length = ReadByte()) != 0)
            {
                // top 2 bits set denotes domain name compression and to reference elsewhere
                if ((length & 0xc0) == 0xc0)
                {
                    // work out the existing domain name, copy this pointer
                    var newRecordReader = new RecordReader(_mData, (length & 0x3f) << 8 | ReadByte());

                    name.Append(newRecordReader.ReadDomainName());
                    return(name.ToString());
                }

                // if not using compression, copy a char at a time to the domain name
                while (length > 0)
                {
                    name.Append(ReadChar());
                    length--;
                }
                name.Append('.');
            }
            return(name.Length == 0 ? "." : name.ToString());
        }
예제 #2
0
파일: RR.cs 프로젝트: zhouDongXing/xmpp
 ///<summary>
 ///</summary>
 ///<param name="rr"></param>
 public RR(RecordReader rr)
 {
     TimeLived = 0;
     Name      = rr.ReadDomainName();
     Type      = (Type)rr.ReadUInt16();
     Class     = (Class)rr.ReadUInt16();
     TTL       = rr.ReadUInt32();
     RDLENGTH  = rr.ReadUInt16();
     Record    = rr.ReadRecord(Type);
     Record.RR = this;
 }
예제 #3
0
 ///<summary>
 ///</summary>
 ///<param name="rr"></param>
 public Question(RecordReader rr)
 {
     QName  = rr.ReadDomainName();
     QType  = (QType)rr.ReadUInt16();
     QClass = (QClass)rr.ReadUInt16();
 }
예제 #4
0
파일: Question.cs 프로젝트: sstraus/xmpp
 ///<summary>
 ///</summary>
 ///<param name="rr"></param>
 public Question(RecordReader rr)
 {
     QName = rr.ReadDomainName();
     QType = (QType) rr.ReadUInt16();
     QClass = (QClass) rr.ReadUInt16();
 }
예제 #5
0
        ///<summary>
        ///</summary>
        ///<returns></returns>
        public string ReadDomainName()
        {
            var name = new StringBuilder();
            int length;

            // get  the length of the first label
            while ((length = ReadByte()) != 0)
            {
                // top 2 bits set denotes domain name compression and to reference elsewhere
                if ((length & 0xc0) == 0xc0)
                {
                    // work out the existing domain name, copy this pointer
                    var newRecordReader = new RecordReader(_mData, (length & 0x3f) << 8 | ReadByte());

                    name.Append(newRecordReader.ReadDomainName());
                    return name.ToString();
                }

                // if not using compression, copy a char at a time to the domain name
                while (length > 0)
                {
                    name.Append(ReadChar());
                    length--;
                }
                name.Append('.');
            }
            return name.Length == 0 ? "." : name.ToString();
        }
예제 #6
0
파일: RR.cs 프로젝트: sstraus/xmpp
 ///<summary>
 ///</summary>
 ///<param name="rr"></param>
 public RR(RecordReader rr)
 {
     TimeLived = 0;
     Name = rr.ReadDomainName();
     Type = (Type) rr.ReadUInt16();
     Class = (Class) rr.ReadUInt16();
     TTL = rr.ReadUInt32();
     RDLENGTH = rr.ReadUInt16();
     Record = rr.ReadRecord(Type);
     Record.RR = this;
 }