- template<>
- template<>
- void testobject::test<2>()
- {
- srand(time(NULL));
- for (size_t i = 0; i < ITERATIONS; ++i) {
- RAW_PACKET_OLD p1;
- RAW_PACKET p2;
- RAW_PACKET p3;
-
- uint8_t buf[68];
- genVector(buf);
-
- memcpy(p1.pckt, buf, 68);
- memcpy(p2.pckt, buf, 68);
- memcpy(p3.pckt, buf, 68);
-
- ensure_equals("IP versions", p1.GetIPVersion(), p2.GetIPVersion());
- ensure_equals("IP headers length", p1.GetHeaderLen(), p2.GetHeaderLen());
- ensure_equals("Protocols", p1.GetProto(), p2.GetProto());
- ensure_equals("Source IPs", p1.GetSrcIP(), p2.GetSrcIP());
- ensure_equals("Destination IPs", p1.GetDstIP(), p2.GetDstIP());
- ensure_equals("Source ports", p1.GetSrcPort(), p2.GetSrcPort());
- ensure_equals("Destination ports", p1.GetDstPort(), p2.GetDstPort());
-
- ensure_equals("Self equallity", p2, p3);
- ensure_equals("Reverse self equallity", p3, p2);
- }
- }