net.sourceforge.jpcap.net
Class IPProtocol

java.lang.Object
  extended bynet.sourceforge.jpcap.net.IPProtocol
All Implemented Interfaces:
IPProtocols

public class IPProtocol
extends java.lang.Object
implements IPProtocols

IPProtocol utility class.


Field Summary
 
Fields inherited from interface net.sourceforge.jpcap.net.IPProtocols
AH, COMP, DSTOPTS, EGP, ENCAP, ESP, FRAGMENT, GRE, HOPOPTS, ICMP, ICMPV6, IDP, IGMP, INVALID, IP, IPIP, IPV6, MASK, MTP, NONE, PIM, PUP, RAW, ROUTING, RSVP, TCP, TP, UDP
 
Constructor Summary
IPProtocol()
           
 
Method Summary
static int extractProtocol(int lLen, byte[] packetBytes)
          Extract the protocol code from packet data.
static java.lang.String getDescription(int code)
          Fetch a protocol description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IPProtocol

public IPProtocol()
Method Detail

getDescription

public static java.lang.String getDescription(int code)
Fetch a protocol description.

Parameters:
code - the code associated with the message.
Returns:
a message describing the significance of the IP protocol.

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.