net.sourceforge.jpcap.net
Class IPEncoding

java.lang.Object
  |
  +--net.sourceforge.jpcap.net.IPEncoding
All Implemented Interfaces:
IPFields

public class IPEncoding
extends java.lang.Object
implements IPFields

IP protocol encoding information.


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
IPEncoding()
           
 
Method Summary
static int extractProtocol(int lLen, byte[] packetBytes)
          Extract the protocol code from packet data.
static byte[] generateRandomHeader()
          Generate a random IP header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IPEncoding

public IPEncoding()
Method Detail

generateRandomHeader

public static byte[] generateRandomHeader()
Generate a random IP header.

extractProtocol

public static int extractProtocol(int lLen,
                                  byte[] packetBytes)
Extract the protocol code from packet data. The packet data must contain an IP datagram. The protocol code specifies what kind of information is contained in the data block of the ip datagram.
Parameters:
llen - the length of the link-level header.
packetBytes - packet bytes, including the link-layer header.
Returns:
the IP protocol code. i.e. 0x06 signifies TCP protocol.