///<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()); }
///<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; }
///<summary> ///</summary> ///<param name="rr"></param> public Question(RecordReader rr) { QName = rr.ReadDomainName(); QType = (QType)rr.ReadUInt16(); QClass = (QClass)rr.ReadUInt16(); }
///<summary> ///</summary> ///<param name="rr"></param> public Question(RecordReader rr) { QName = rr.ReadDomainName(); QType = (QType) rr.ReadUInt16(); QClass = (QClass) rr.ReadUInt16(); }
///<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(); }
///<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; }