org.jnetpcap.protocol
Enum JProtocol

java.lang.Object
  extended by java.lang.Enum<JProtocol>
      extended by org.jnetpcap.protocol.JProtocol
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<JProtocol>

public enum JProtocol
extends java.lang.Enum<JProtocol>

Enum table of core protocols supported by the scanner.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
static interface JProtocol.Suite
          A protocol suite.
 
Enum Constant Summary
ETHERNET
          DIX Ethernet2 header
HTML
          Hyper Text Markup Language header
HTTP
          Hyper Text Transmission Protocol header
ICMP
          Internet Control Message Protocol header
IEEE_802DOT1Q
          IEEE VLAN tag header
IEEE_802DOT2
          IEEE LLC2 header
IEEE_802DOT3
          IEEE 802.3 header type
IEEE_SNAP
          IEEE SNAP header
IP4
          Ip version 4 header
IP6
          Ip version 6 header
L2TP
          Layer 2 tunneling protocol header
PAYLOAD
          Builtin header type that encapsulates the portion of the packet buffer not matched by any protocol header
PPP
          Point to Point Protocol header
TCP
          TCP/IP header
UDP
          UDP/IP header
 
Field Summary
static int ETHERNET_ID
           
static int HTML_ID
           
static int HTTP_ID
           
static int ICMP_ID
           
static int IEEE_802DOT1Q_ID
           
static int IEEE_802DOT2_ID
           
static int IEEE_802DOT3_ID
           
static int IEEE_SNAP_ID
           
static int IP4_ID
           
static int IP6_ID
           
static int L2TP_ID
           
static int PAYLOAD_ID
           
static int PPP_ID
           
static int TCP_ID
           
static int UDP_ID
           
 
Method Summary
 PcapDLT[] getDlt()
          Gets the corresponding Pcap defined Data Link Type.
 java.lang.Class<? extends JHeader> getHeaderClass()
           
 java.lang.String getHeaderClassName()
           
 int getId()
          Gets a unique runtime numerica ID of this protocol assigned by jNetStream.
static boolean isCoreProtocol(java.lang.Class<? extends JHeader> c)
          Checks the supplied header by class if its is one of jNetPcap's core protocol set
static boolean isCoreProtocol(int id)
          Checks the supplied ID if its is one of jNetPcap's core protocol set
static JProtocol valueOf(java.lang.Class<? extends JHeader> c)
          Converts a protocol header to a JPRotocol constant
static JProtocol valueOf(int id)
          Converts a protocol header to a JPRotocol constant
static JProtocol valueOf(Pcap pcap)
          Gets the numerical ID of the data link header for the open pcap handle.
static JProtocol valueOf(PcapDLT dlt)
          Gets the numerical ID of the data link header for supplied pcap dlt constant.
static JProtocol valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static JProtocol[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

PAYLOAD

public static final JProtocol PAYLOAD
Builtin header type that encapsulates the portion of the packet buffer not matched by any protocol header


ETHERNET

public static final JProtocol ETHERNET
DIX Ethernet2 header


IP4

public static final JProtocol IP4
Ip version 4 header


IP6

public static final JProtocol IP6
Ip version 6 header


TCP

public static final JProtocol TCP
TCP/IP header


UDP

public static final JProtocol UDP
UDP/IP header


IEEE_802DOT3

public static final JProtocol IEEE_802DOT3
IEEE 802.3 header type


IEEE_802DOT2

public static final JProtocol IEEE_802DOT2
IEEE LLC2 header


IEEE_SNAP

public static final JProtocol IEEE_SNAP
IEEE SNAP header


IEEE_802DOT1Q

public static final JProtocol IEEE_802DOT1Q
IEEE VLAN tag header


L2TP

public static final JProtocol L2TP
Layer 2 tunneling protocol header


PPP

public static final JProtocol PPP
Point to Point Protocol header


ICMP

public static final JProtocol ICMP
Internet Control Message Protocol header


HTTP

public static final JProtocol HTTP
Hyper Text Transmission Protocol header


HTML

public static final JProtocol HTML
Hyper Text Markup Language header

Field Detail

PAYLOAD_ID

public static final int PAYLOAD_ID
See Also:
Constant Field Values

ETHERNET_ID

public static final int ETHERNET_ID
See Also:
Constant Field Values

IP4_ID

public static final int IP4_ID
See Also:
Constant Field Values

IP6_ID

public static final int IP6_ID
See Also:
Constant Field Values

TCP_ID

public static final int TCP_ID
See Also:
Constant Field Values

UDP_ID

public static final int UDP_ID
See Also:
Constant Field Values

IEEE_802DOT3_ID

public static final int IEEE_802DOT3_ID
See Also:
Constant Field Values

IEEE_802DOT2_ID

public static final int IEEE_802DOT2_ID
See Also:
Constant Field Values

IEEE_SNAP_ID

public static final int IEEE_SNAP_ID
See Also:
Constant Field Values

IEEE_802DOT1Q_ID

public static final int IEEE_802DOT1Q_ID
See Also:
Constant Field Values

L2TP_ID

public static final int L2TP_ID
See Also:
Constant Field Values

PPP_ID

public static final int PPP_ID
See Also:
Constant Field Values

ICMP_ID

public static final int ICMP_ID
See Also:
Constant Field Values

HTTP_ID

public static final int HTTP_ID
See Also:
Constant Field Values

HTML_ID

public static final int HTML_ID
See Also:
Constant Field Values
Method Detail

values

public static final JProtocol[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(JProtocol c : JProtocol.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static JProtocol valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

getHeaderClass

public java.lang.Class<? extends JHeader> getHeaderClass()

getHeaderClassName

public java.lang.String getHeaderClassName()

isCoreProtocol

public static boolean isCoreProtocol(int id)
Checks the supplied ID if its is one of jNetPcap's core protocol set

Parameters:
id - numerical ID of the header as assigned by JRegistry
Returns:
true if header is part of the core protocol set otherwise false

isCoreProtocol

public static boolean isCoreProtocol(java.lang.Class<? extends JHeader> c)
Checks the supplied header by class if its is one of jNetPcap's core protocol set

Parameters:
c - class name of the header to check
Returns:
true if header is part of the core protocol set otherwise false

valueOf

public static JProtocol valueOf(java.lang.Class<? extends JHeader> c)
Converts a protocol header to a JPRotocol constant

Parameters:
c - header class to convert
Returns:
an enum constant or null if class is not part of the core protocol set

valueOf

public static JProtocol valueOf(int id)
Converts a protocol header to a JPRotocol constant

Parameters:
id - numerical ID of the header assigned by JRegistry
Returns:
an enum constant or null if class is not part of the core protocol set

valueOf

public static JProtocol valueOf(Pcap pcap)
Gets the numerical ID of the data link header for the open pcap handle. A call to Pcap.datalink() is made and the value translated to an appropriate jNetPcap protocol header ID.

Parameters:
pcap - open Pcap handle
Returns:
enum constant or the Payload header as the catch all if no headers are matched

valueOf

public static JProtocol valueOf(PcapDLT dlt)
Gets the numerical ID of the data link header for supplied pcap dlt constant. A call to Pcap.datalink() is made and the value translated to an appropriate jNetPcap protocol header ID.

Parameters:
dlt - pcap dlt constant
Returns:
enum constant or the Payload header as the catch all if no headers are matched

getDlt

public PcapDLT[] getDlt()
Gets the corresponding Pcap defined Data Link Type.

Returns:
the dlt dlt for this protocol

getId

public int getId()
Gets a unique runtime numerica ID of this protocol assigned by jNetStream.

Returns:
the protocol id