7172737475767778798081
JPacket packet = TestUtils.getPcapPacket("tests/test-icmp-recordroute-opt.pcap", 0); JFormatter out = new TextFormatter(); out.format(packet); assertNotNull(packet); assertTrue(packet.hasHeader(ip)); assertTrue(ip.hasSubHeaders()); assertFalse(ip.hasSubHeader(lsroute));
279280281282283284285286287288
JPacket packet = TestUtils.getPcapPacket("tests/test-afs.pcap", 0); if (packet.hasHeader(JProtocol.IP4_ID)) { ip = packet.getHeader(ip); JFormatter out = new TextFormatter(System.out); out.format(ip, Detail.MULTI_LINE_FULL_DETAIL); } } }
93949596979899100101102103
PcapPacket packet = TestUtils.getPcapPacket("tests/test-http-jpeg.pcap", 5); Ip4 ip = new Ip4(); Ethernet eth = new Ethernet(); if (packet.hasHeader(eth)) { out.format(eth); } if (packet.hasHeader(ip)) { out.format(ip); out.format(ip); }
96979899100101102103104105106
Ethernet eth = new Ethernet(); if (packet.hasHeader(eth)) { out.format(eth); } if (packet.hasHeader(ip)) { out.format(ip); out.format(ip); } out.format(packet);
979899100101102103104105106107
if (packet.hasHeader(eth)) { out.format(eth); } if (packet.hasHeader(ip)) { out.format(ip); out.format(ip); } out.format(packet); Html html = new Html();
100101102103104105106107108109110
if (packet.hasHeader(ip)) { out.format(ip); out.format(ip); } out.format(packet); Html html = new Html(); assertTrue("html header not found", packet.hasHeader(html)); System.out.printf("link related tags=%s\n", Arrays.asList(html.links()) .toString());
134135136137138139140141142143144
PcapPacket packet = TestUtils.getPcapPacket("tests/test-http-jpeg.pcap", 5); Ip4 ip = new Ip4(); Ethernet eth = new Ethernet(); if (packet.hasHeader(eth)) { out.format(eth); } if (packet.hasHeader(ip)) { // out.format(ip); out.format(ip); System.out.println();
138139140141142143144145146147148
if (packet.hasHeader(eth)) { out.format(eth); } if (packet.hasHeader(ip)) { // out.format(ip); out.format(ip); System.out.println(); } // out.format(packet);
6768697071727374757677
public void testTextFormatter() throws IOException { JFormatter out = new TextFormatter(OUT); JPacket packet = TestUtils.getPcapPacket("tests/test-vlan.pcap", 0); try { out.format(packet); } catch (Exception e) { e.printStackTrace(); } }
8586878889909192939495
public void testXmlFormatter() throws IOException { JFormatter out = new XmlFormatter(OUT); JPacket packet = TestUtils.getPcapPacket("tests/test-afs.pcap", 0); out.format(packet); } /** * Test xml ip4 record route opt. *