internal SoaRecord(SmartPointer pointer) { _primaryNameServer = pointer.ReadDomain(); _responsibleMailAddress = pointer.ReadDomain(); _serial = pointer.ReadInt(); _refresh = pointer.ReadInt(); _retry = pointer.ReadInt(); _expire = pointer.ReadInt(); _defaultTTL = pointer.ReadInt(); }
internal ResourceRecord(SmartPointer pointer) { _domain = pointer.ReadDomain(); _dnsType = (DnsType)pointer.ReadShort(); _dnsClass = (DnsClass)pointer.ReadShort(); _ttl = pointer.ReadInt(); int recordLength = pointer.ReadShort(); switch (_dnsType) { case DnsType.ANAME: _record = new ANameRecord(pointer); break; case DnsType.MX: _record = new MxRecord(pointer); break; case DnsType.NS: _record = new NsRecord(pointer); break; case DnsType.SOA: _record = new NsRecord(pointer); break; case DnsType.CNAME: _record = new CNameRecord(pointer); break; case DnsType.PTR: _record = new CNameRecord(pointer); break; default: pointer += recordLength; break; } }
/// <summary> /// reads an entire string of format xx.yy.zz /// </summary> /// <returns></returns> public string ReadDomain() { StringBuilder domain = new StringBuilder(); int len = 0; while ((len = ReadByte()) != 0) { if ((len & 0xc0) == 0xc0) { SmartPointer newPointer = Copy(); newPointer.SetPosition((len & 0x3f) << 8 | ReadByte()); domain.Append(newPointer.ReadDomain()); return(domain.ToString()); } while (len > 0) { domain.Append(ReadChar()); len--; } if (Peek() != 0) { domain.Append('.'); } } return(domain.ToString()); }
internal Query(SmartPointer pointer) { _domain = pointer.ReadDomain(); _dnsType = (DnsType)pointer.ReadShort(); _dnsClass = (DnsClass)pointer.ReadShort(); }
internal MxRecord(SmartPointer pointer) { _preference = pointer.ReadShort(); _domainName = pointer.ReadDomain(); }
internal CNameRecord(SmartPointer pointer) { _domain = pointer.ReadDomain(); }
internal NsRecord(SmartPointer pointer) { _domainName = pointer.ReadDomain(); }
internal RouteThroughRecord(SmartPointer pointer) { _preference = pointer.ReadShort(); _intermediateHost = pointer.ReadDomain(); }