NetworkPackets.Dns.DnsPacketTest.TestPtrRPacketWithCompression C# (CSharp) Method

TestPtrRPacketWithCompression() private method

private TestPtrRPacketWithCompression ( ) : void
return void
    public void TestPtrRPacketWithCompression() {
      int id = 55885;
      short ID = (short) id;
      bool Query = false;
      byte Opcode = 0;
      bool AA = false;

      String QName = "64.233.169.104";
      DnsPacket.Types QType = DnsPacket.Types.Ptr;
      DnsPacket.Classes QClass = DnsPacket.Classes.IN;
    //  Question qp = new Question(QName, QType, QClass);

      String Name = "64.233.169.104";
      DnsPacket.Types Type = DnsPacket.Types.Ptr;
      DnsPacket.Classes Class = DnsPacket.Classes.IN;
      int Ttl = 30;
      String RData = "yo-in-f104.google.com";
  //    Response rp = new Response(Name, Type, Class, Ttl, RData);

      MemBlock ptrm = MemBlock.Reference(new byte[] {0xda, 0x4d, 0x81, 0x80,
        0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x31, 0x30, 0x34,
        0x03, 0x31, 0x36, 0x39, 0x03, 0x32, 0x33, 0x33, 0x02, 0x36, 0x34, 0x07,
        0x69, 0x6e, 0x2d, 0x61, 0x64, 0x64, 0x72, 0x04, 0x61, 0x72, 0x70, 0x61,
        0x00, 0x00, 0x0c, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x0c, 0x00, 0x01, 0x00,
        0x00, 0x00, 0x1e, 0x00, 0x17, 0x0a, 0x79, 0x6f, 0x2d, 0x69, 0x6e, 0x2d,
        0x66, 0x31, 0x30, 0x34, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03,
        0x63, 0x6f, 0x6d, 0x00});

      DnsPacket dm = new DnsPacket(ptrm);
      DnsPacket dp = new DnsPacket(ID, Query, Opcode, AA, dm.RD, dm.RA,
                                   dm.Questions, dm.Answers, null, null);

      Assert.AreEqual(dm.ID, ID, "ID");
      Assert.AreEqual(dm.Query, Query, "Query");
      Assert.AreEqual(dm.Opcode, Opcode, "Opcode");
      Assert.AreEqual(dm.AA, AA, "AA");
      Assert.AreEqual(dm.Questions.Length, 1, "Questions");
      Assert.AreEqual(dm.Answers.Length, 1, "Answers");
      Assert.AreEqual(dm.Packet, ptrm, "MemBlock");

      Response rm = dm.Answers[0];
      Assert.AreEqual(rm.Name, Name, "Name");
      Assert.AreEqual(rm.Type, Type, "Type");
      Assert.AreEqual(rm.Class, Class, "Class");
      Assert.AreEqual(rm.Ttl, Ttl, "Ttl");
      Assert.AreEqual(rm.RData, RData, "RData");

      Question qm = dm.Questions[0];
      Assert.AreEqual(qm.QName, QName, "QName");
      Assert.AreEqual(qm.QType, QType, "QType");
      Assert.AreEqual(qm.QClass, QClass, "QClass");

      /// @todo add compression when creating dns packets... then we can
      /// build dp.Packet without using blobs and compare it to ptrm and it
      /// should pass!
      Assert.AreEqual(dp.Packet, ptrm, "Packet");
    }