/**
* Test ip4 fragment flag directly.
*/
public void testIp4FragmentFlagDirectly() {
JPacket packet = TestUtils.getPcapPacket(TestUtils.REASEMBLY, 1 - 1);
Ethernet eth = new Ethernet();
if (packet.hasHeader(eth)) {
// System.out.println(eth);
// System.out.printf("flags=%x\n", eth.getState().getFlags());
assertNotSame(JHeader.State.FLAG_HEADER_FRAGMENTED, (eth.getState()
.getFlags() & JHeader.State.FLAG_HEADER_FRAGMENTED));
}
Ip4 ip = new Ip4();
if (packet.hasHeader(ip)) {
// System.out.println(ip);
// System.out.printf("flags=%x\n", ip.getState().getFlags());
assertEquals(JHeader.State.FLAG_HEADER_FRAGMENTED, (ip.getState()
.getFlags() & JHeader.State.FLAG_HEADER_FRAGMENTED));
}
Icmp icmp = new Icmp();
if (packet.hasHeader(icmp)) {
// System.out.println(icmp);
// System.out.printf("flags=%x\n", icmp.getState().getFlags());
assertEquals(JHeader.State.FLAG_HEADER_FRAGMENTED, (icmp.getState()
.getFlags() & JHeader.State.FLAG_HEADER_FRAGMENTED));
}