/// <summary> /// Create data record for AFSDB type from data buffer /// </summary> /// <param name="buffer"></param> public AfsdbRecord(DataBuffer buffer) { subType = buffer.ReadShortInt(); domain = buffer.ReadDomainName(); }
/// <summary> /// Common class for all record types that contain a preference and a domain name /// </summary> /// <param name="buffer"></param> public PrefAndDomain(DataBuffer buffer) { preference = buffer.ReadBEShortInt(); domain = buffer.ReadDomainName(); }
/// <summary> /// Create a Question record for Dns Answer /// </summary> /// <param name="buffer"></param> public Question(DataBuffer buffer) { domain = buffer.ReadDomainName(); recType = (RecordType)buffer.ReadBEShortInt(); classType = buffer.ReadBEShortInt(); }
/// <summary> /// Implementation Reference RFC 1183 /// </summary> /// <param name="buffer"></param> public RTRecord(DataBuffer buffer) : base(buffer) { }
/// <summary> /// Given a byte array interpret them as a DnsEntry /// </summary> /// <param name="response"></param> public DnsAnswer(byte[] response) { questions = new List <Question>(); answers = new List <Answer>(); servers = new List <Server>(); additional = new List <Record>(); exceptions = new List <Exception>(); DataBuffer buffer = new DataBuffer(response, 2); byte bits1 = buffer.ReadByte(); byte bits2 = buffer.ReadByte(); //Mask off return code int returnCode = bits2 & 15; if (returnCode > 6) { returnCode = 6; } this.returnCode = (ReturnCode)returnCode; //Get Additional Flags authoritative = TestBit(bits1, 2); recursive = TestBit(bits2, 8); truncated = TestBit(bits1, 1); int nQuestions = buffer.ReadBEShortInt(); int nAnswers = buffer.ReadBEShortInt(); int nServers = buffer.ReadBEShortInt(); int nAdditional = buffer.ReadBEShortInt(); //read in questions for (int i = 0; i < nQuestions; i++) { try { questions.Add(new Question(buffer)); } catch (Exception ex) { exceptions.Add(ex); } } //read in answers for (int i = 0; i < nAnswers; i++) { try { answers.Add(new Answer(buffer)); } catch (Exception ex) { exceptions.Add(ex); } } //read in servers for (int i = 0; i < nServers; i++) { try { servers.Add(new Server(buffer)); } catch (Exception ex) { exceptions.Add(ex); } } //read in additional records for (int i = 0; i < nAdditional; i++) { try { additional.Add(new Record(buffer)); } catch (Exception ex) { exceptions.Add(ex); } } }
/// <summary> /// Implementation Reference RFC 1035 /// </summary> /// <param name="buffer"></param> /// <param name="?"></param> public NullRecord(DataBuffer buffer, int length) : base(buffer, length) { }
public PtrRecord(DataBuffer buffer) : base(buffer) { }
/// <summary> /// Implementation Reference RFC 2672 /// </summary> /// <param name="buffer"></param> public DNameRecord(DataBuffer buffer) : base(buffer) { }