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
ARP
          Address Resolution Protocol.
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.
RTP
          Realtime Transfer Protocol.
SDP
          Session Data Protocol.
SIP
          Session Intiation Protocol.
SLL
          Linux cooked sockets.
TCP
          TCP/IP header.
UDP
          UDP/IP header.
WEB_IMAGE
          An Image header transmitted via http.
 
Field Summary
static int ARP_ID
          The Constant ARP_ID.
static int ETHERNET_ID
          The Constant ETHERNET_ID.
static int HTML_ID
          The Constant HTML_ID.
static int HTTP_ID
          The Constant HTTP_ID.
static int ICMP_ID
          The Constant ICMP_ID.
static int IEEE_802DOT1Q_ID
          The Constant IEEE_802DOT1Q_ID.
static int IEEE_802DOT2_ID
          The Constant IEEE_802DOT2_ID.
static int IEEE_802DOT3_ID
          The Constant IEEE_802DOT3_ID.
static int IEEE_SNAP_ID
          The Constant IEEE_SNAP_ID.
static int IP4_ID
          The Constant IP4_ID.
static int IP6_ID
          The Constant IP6_ID.
static int L2TP_ID
          The Constant L2TP_ID.
static int LAST_ID
          The Constant LAST_ID.
static int PAYLOAD_ID
          The Constant PAYLOAD_ID.
static int PPP_ID
          The Constant PPP_ID.
static int RTP_ID
          The Constant RTP_ID.
static int SDP_ID
          The Constant SDP_ID.
static int SIP_ID
          The Constant SIP_ID.
static int SLL_ID
          The Constant SLL_ID.
static int TCP_ID
          The Constant TCP_ID.
static int UDP_ID
          The Constant UDP_ID.
static int WEB_IMAGE_ID
          The Constant WEB_IMAGE_ID.
 
Method Summary
 java.lang.Class<? extends JHeader> getClazz()
          Gets the main class for the network header of this protocol.
 PcapDLT[] getDlt()
          Gets the corresponding Pcap defined Data Link Type.
 java.lang.Class<? extends JHeader> getHeaderClass()
          Gets the header class.
 java.lang.String getHeaderClassName()
          Gets the header class name.
 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 are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
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.


WEB_IMAGE

public static final JProtocol WEB_IMAGE
An Image header transmitted via http.


ARP

public static final JProtocol ARP
Address Resolution Protocol.


SIP

public static final JProtocol SIP
Session Intiation Protocol.


SDP

public static final JProtocol SDP
Session Data Protocol.


RTP

public static final JProtocol RTP
Realtime Transfer Protocol.


SLL

public static final JProtocol SLL
Linux cooked sockets.

Field Detail

PAYLOAD_ID

public static final int PAYLOAD_ID
The Constant PAYLOAD_ID.

See Also:
Constant Field Values

ETHERNET_ID

public static final int ETHERNET_ID
The Constant ETHERNET_ID.

See Also:
Constant Field Values

IP4_ID

public static final int IP4_ID
The Constant IP4_ID.

See Also:
Constant Field Values

IP6_ID

public static final int IP6_ID
The Constant IP6_ID.

See Also:
Constant Field Values

TCP_ID

public static final int TCP_ID
The Constant TCP_ID.

See Also:
Constant Field Values

UDP_ID

public static final int UDP_ID
The Constant UDP_ID.

See Also:
Constant Field Values

IEEE_802DOT3_ID

public static final int IEEE_802DOT3_ID
The Constant IEEE_802DOT3_ID.

See Also:
Constant Field Values

IEEE_802DOT2_ID

public static final int IEEE_802DOT2_ID
The Constant IEEE_802DOT2_ID.

See Also:
Constant Field Values

IEEE_SNAP_ID

public static final int IEEE_SNAP_ID
The Constant IEEE_SNAP_ID.

See Also:
Constant Field Values

IEEE_802DOT1Q_ID

public static final int IEEE_802DOT1Q_ID
The Constant IEEE_802DOT1Q_ID.

See Also:
Constant Field Values

L2TP_ID

public static final int L2TP_ID
The Constant L2TP_ID.

See Also:
Constant Field Values

PPP_ID

public static final int PPP_ID
The Constant PPP_ID.

See Also:
Constant Field Values

ICMP_ID

public static final int ICMP_ID
The Constant ICMP_ID.

See Also:
Constant Field Values

HTTP_ID

public static final int HTTP_ID
The Constant HTTP_ID.

See Also:
Constant Field Values

HTML_ID

public static final int HTML_ID
The Constant HTML_ID.

See Also:
Constant Field Values

WEB_IMAGE_ID

public static final int WEB_IMAGE_ID
The Constant WEB_IMAGE_ID.

See Also:
Constant Field Values

ARP_ID

public static final int ARP_ID
The Constant ARP_ID.

See Also:
Constant Field Values

SIP_ID

public static final int SIP_ID
The Constant SIP_ID.

See Also:
Constant Field Values

SDP_ID

public static final int SDP_ID
The Constant SDP_ID.

See Also:
Constant Field Values

RTP_ID

public static final int RTP_ID
The Constant RTP_ID.

See Also:
Constant Field Values

SLL_ID

public static final int SLL_ID
The Constant SLL_ID.

See Also:
Constant Field Values

LAST_ID

public static final int LAST_ID
The Constant LAST_ID.

Method Detail

values

public static JProtocol[] values()
Returns an array containing the constants of this enum type, in the order they are 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 are 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
java.lang.NullPointerException - if the argument is null

getHeaderClass

public java.lang.Class<? extends JHeader> getHeaderClass()
Gets the header class.

Returns:
the header class

getHeaderClassName

public java.lang.String getHeaderClassName()
Gets the header class name.

Returns:
the header class name

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

getClazz

public final java.lang.Class<? extends JHeader> getClazz()
Gets the main class for the network header of this protocol.

Returns:
the main class for the network header of this protocol