net.sourceforge.jpcap.simulator
Class PacketGenerator

java.lang.Object
  extended bynet.sourceforge.jpcap.simulator.PacketGenerator
All Implemented Interfaces:
EthernetFields, IPFields

public class PacketGenerator
extends java.lang.Object
implements EthernetFields, IPFields

This class produces data fabricated to look like it originated from a network device.


Field Summary
 
Fields inherited from interface net.sourceforge.jpcap.net.EthernetFields
ETH_CODE_LEN, ETH_CODE_POS, ETH_DST_POS, ETH_HEADER_LEN, ETH_SRC_POS
 
Fields inherited from interface net.sourceforge.jpcap.net.IPFields
IP_CODE_LEN, IP_CODE_POS, IP_CSUM_LEN, IP_CSUM_POS, IP_DST_POS, IP_FRAG_LEN, IP_FRAG_POS, IP_HEADER_LEN, IP_ID_LEN, IP_ID_POS, IP_LEN_LEN, IP_LEN_POS, IP_SRC_POS, IP_TOS_LEN, IP_TOS_POS, IP_TTL_LEN, IP_TTL_POS, IP_VER_LEN, IP_VER_POS
 
Constructor Summary
PacketGenerator()
           
 
Method Summary
static byte[] generate()
          Generate a pseudo-random network packet.
static void main(java.lang.String[] args)
          Unit test.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PacketGenerator

public PacketGenerator()
Method Detail

generate

public static byte[] generate()
Generate a pseudo-random network packet.

Returns:
an array of bytes containing a randomly generated ethernet network packet. Packet can encapsulate any known protocol.

main

public static void main(java.lang.String[] args)
Unit test.