Package org.jnetpcap.packet

Examples of org.jnetpcap.packet.JMemoryPacket.scan()


   
    JMemoryPacket mem = new JMemoryPacket(data);

    assertNotNull(mem);

    mem.scan(JProtocol.ETHERNET_ID);
  }

  /**
   * Test scanner exception with i byte array.
   */
 
View Full Code Here


    JBuffer buf = new JBuffer(data);
    JMemoryPacket mem = new JMemoryPacket(buf);

    assertNotNull(mem);

    mem.scan(JProtocol.ETHERNET_ID);
  }

  /**
   * Test scanner exception with ij buffer.
   */
 
View Full Code Here

    JMemoryPacket mem = new JMemoryPacket(buf);

    assertNotNull(mem);
   
    mem.scan(JProtocol.ETHERNET_ID);
  }

  /**
   * Test scanner exception with i byte buffer.
   *
 
View Full Code Here

    packet.setUShort(0 + 12, 0x800);
    packet.setUByte(14 + 0, 0x45);
    System.out.println(packet.toHexdump());
    packet.setUByte(14 + 9, 0x11); //UDP
    System.out.println(packet.toHexdump());
    packet.scan(JProtocol.ETHERNET_ID);
    Ethernet eth = packet.getHeader(new Ethernet());
    Ip4 ip = packet.getHeader(new Ip4());
    Udp udp = packet.getHeader(new Udp());
//    udp.transferFrom(getFakeData(1460)); //Generate Random bytes
    eth.destination(new byte[] {(byte) 0xaa, 0x0c, 0x08, 11, 22, 33});
View Full Code Here

   * Test peer to j buffer.
   */
  public void testPeerToJBuffer() {
    assertNotNull(VariousInMemoryPackets.PACKET_1);
    JPacket packet = new JMemoryPacket(VariousInMemoryPackets.PACKET_1);
    packet.scan(Ethernet.ID);
   
    System.out.println(packet);
  }

}
View Full Code Here

    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
    StringBuilder errbuf = new StringBuilder(); // For any error msgs
    /***************************************************************************
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.