protected override void WriteRecordData(Stream s, List <DnsDomainOffset> domainEntries)
 {
     DnsDatagram.WriteUInt16NetworkOrder(_priority, s);
     DnsDatagram.WriteUInt16NetworkOrder(_weight, s);
     DnsDatagram.WriteUInt16NetworkOrder(_port, s);
     DnsDatagram.SerializeDomainName(_target, s, null); //no compression for domain name as per RFC
 }
        public void WriteTo(Stream s, List <DnsDomainOffset> domainEntries)
        {
            DnsDatagram.SerializeDomainName(_name, s, domainEntries);
            DnsDatagram.WriteUInt16NetworkOrder((ushort)_type, s);
            DnsDatagram.WriteUInt16NetworkOrder((ushort)_class, s);
            DnsDatagram.WriteUInt32NetworkOrder(TtlValue, s);

            _data.WriteTo(s, domainEntries);
        }
        public void WriteTo(Stream s, List <DnsDomainOffset> domainEntries)
        {
            DnsDatagram.ConvertDomainToLabel(_name, s, domainEntries);
            DnsDatagram.WriteUInt16NetworkOrder((ushort)_type, s);
            DnsDatagram.WriteUInt16NetworkOrder((ushort)_class, s);
            DnsDatagram.WriteUInt32NetworkOrder(TTLValue, s);

            _data.WriteTo(s, domainEntries);
        }
Example #4
0
 public void WriteTo(Stream s)
 {
     DnsDatagram.WriteUInt16NetworkOrder(_ID, s);
     s.WriteByte(Convert.ToByte((_QR << 7) | ((byte)_OPCODE << 3) | (_AA << 2) | (_TC << 1) | _RD));
     s.WriteByte(Convert.ToByte((_RA << 7) | (_Z << 6) | (_AD << 5) | (_CD << 4) | (byte)_RCODE));
     DnsDatagram.WriteUInt16NetworkOrder(_QDCOUNT, s);
     DnsDatagram.WriteUInt16NetworkOrder(_ANCOUNT, s);
     DnsDatagram.WriteUInt16NetworkOrder(_NSCOUNT, s);
     DnsDatagram.WriteUInt16NetworkOrder(_ARCOUNT, s);
 }
 public void WriteTo(Stream s, List <DnsDomainOffset> domainEntries)
 {
     if (_minimizedName == null)
     {
         DnsDatagram.SerializeDomainName(_name, s, domainEntries);
         DnsDatagram.WriteUInt16NetworkOrder((ushort)_type, s);
         DnsDatagram.WriteUInt16NetworkOrder((ushort)_class, s);
     }
     else
     {
         DnsDatagram.SerializeDomainName(_minimizedName, s, domainEntries);
         DnsDatagram.WriteUInt16NetworkOrder((ushort)MinimizedType, s);
         DnsDatagram.WriteUInt16NetworkOrder((ushort)_class, s);
     }
 }
        public void WriteTo(Stream s, List <DnsDomainOffset> domainEntries)
        {
            long originalPosition = s.Position;

            //write dummy RDLENGTH
            s.Position += 2;

            //write RDATA
            WriteRecordData(s, domainEntries);

            long finalPosition = s.Position;

            //write actual RDLENGTH
            ushort length = Convert.ToUInt16(finalPosition - originalPosition - 2);

            s.Position = originalPosition;
            DnsDatagram.WriteUInt16NetworkOrder(length, s);

            s.Position = finalPosition;
        }
 protected override void WriteRecordData(Stream s, List <DnsDomainOffset> domainEntries)
 {
     DnsDatagram.WriteUInt16NetworkOrder(_preference, s);
     DnsDatagram.SerializeDomainName(_exchange, s, domainEntries);
 }
 protected override void WriteRecordData(Stream s, List <DnsDomainOffset> domainEntries)
 {
     DnsDatagram.WriteUInt16NetworkOrder(_preference, s);
     DnsDatagram.ConvertDomainToLabel(_exchange, s, domainEntries);
 }