/// <summary> /// Constructs an SOA record by reading bytes from a return message /// </summary> /// <param name="pointer">A logical pointer to the bytes holding the record</param> public Soa(Pointer pointer) { // read all fields RFC1035 3.3.13 primaryNameServer = pointer.ReadDomain(); responsibleMailAddress = pointer.ReadDomain(); serial = pointer.ReadInt(); refresh = pointer.ReadInt(); retry = pointer.ReadInt(); expire = pointer.ReadInt(); defaultTtl = pointer.ReadInt(); }
/// <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(); }
/// <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> public Ptr(Pointer pointer) { hostname = pointer.ReadDomain(); }
/// <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; } } }
/// <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(); }
/// <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> public MD(Pointer pointer) { madname = pointer.ReadDomain(); }
/// <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(); }
/// <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 Rp(Pointer pointer) { this.mailboxHostname = pointer.ReadDomain(); this.textHostname = pointer.ReadDomain(); }