NetworkPackets.Dns.DnsPacket.BuildFailedReplyPacket C# (CSharp) Method

BuildFailedReplyPacket() public static method

Given a DnsPacket, it will generate a failure message so that the local resolver can move on to the next nameserver without timeouting on the this one.
public static BuildFailedReplyPacket ( DnsPacket Packet, bool refused_implemented ) : MemBlock
Packet DnsPacket The base packet to translate into a failed response
refused_implemented bool
return MemBlock
    public static MemBlock BuildFailedReplyPacket(DnsPacket Packet,
        bool refused_implemented)
    {
      byte[] res = new byte[Packet.Packet.Length];
      Packet.Packet.CopyTo(res, 0);
      if(refused_implemented) {
        res[3] |= 5;
      } else {
        res[3] |= 4;
      }
      res[2] |= 0x80;
      return MemBlock.Reference(res);
    }