Package org.jnetpcap.protocol.network

Examples of org.jnetpcap.protocol.network.Ip4$Timestamp$Entry


   * starting offset of payload for IP header is 0x22 (34) bytes into the packet.
   */
  public void testJPayloadAccessorGetPayload() {
    JPacket packet = TestUtils.getPcapPacket(HTTP, 5);

    JPayloadAccessor ip = packet.getHeader(new Ip4());
    assertNotNull(ip);

    byte[] buffer = ip.getPayload();
    assertEquals(0x00, buffer[0]);
    assertEquals(0x50, buffer[1]);
View Full Code Here


   * starting offset of payload for IP header is 0x22 (34) bytes into the packet.
   */
  public void testJPayloadAccessorTransferPayloadToByteArray() {
    JPacket packet = TestUtils.getPcapPacket(HTTP, 5);

    JPayloadAccessor ip = packet.getHeader(new Ip4());
    assertNotNull(ip);

    byte[] buffer = ip.transferPayloadTo(new byte[489 - 34]);
    assertEquals(0x00, buffer[0]);
    assertEquals(0x50, buffer[1]);
View Full Code Here

   * starting offset of payload for IP header is 0x22 (34) bytes into the packet.
   */
  public void testJPayloadAccessorPeerPayloadToJBuffer() {
    JPacket packet = TestUtils.getPcapPacket(HTTP, 5);

    JPayloadAccessor ip = packet.getHeader(new Ip4());
    assertNotNull(ip);

    JBuffer buffer = ip.peerPayloadTo(new JBuffer(JMemory.Type.POINTER));
    assertEquals(0x00, buffer.getUByte(0));
    assertEquals(0x50, buffer.getUByte(1));
View Full Code Here

   * starting offset of payload for IP header is 0x22 (34) bytes into the packet.
   */
  public void testJPayloadAccessorTransferPayloadToJBuffer() {
    JPacket packet = TestUtils.getPcapPacket(HTTP, 5);

    JPayloadAccessor ip = packet.getHeader(new Ip4());
    assertNotNull(ip);

    JBuffer buffer = ip.transferPayloadTo(new JBuffer(489 - 34));
    assertEquals(0x00, buffer.getUByte(0));
    assertEquals(0x50, buffer.getUByte(1));
View Full Code Here

                + "2000d94300000204 05b4010303020101 " + "0402");

    InetAddress dst = InetAddress.getByName("201.1.1.1");
    InetAddress src = InetAddress.getByName("192.168.1.1");

    Ip4 ip = packet.getHeader(new Ip4());
    Tcp tcp = packet.getHeader(new Tcp());

    ip.destination(dst.getAddress());
    ip.source(src.getAddress());

    ip.checksum(ip.calculateChecksum());
    tcp.checksum(tcp.calculateChecksum());
    packet.scan(Ethernet.ID);

    System.out.println(packet);
    List<PcapIf> alldevs = new ArrayList<PcapIf>(); // Will be filled with NICs
View Full Code Here

TOP

Related Classes of org.jnetpcap.protocol.network.Ip4$Timestamp$Entry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.