org.jnetpcap.protocol.tcpip
Enum Tcp.Flag

java.lang.Object
  extended by java.lang.Enum<Tcp.Flag>
      extended by org.jnetpcap.protocol.tcpip.Tcp.Flag
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Tcp.Flag>
Enclosing class:
Tcp

public static enum Tcp.Flag
extends java.lang.Enum<Tcp.Flag>

Flags (8 bits) (aka Control bits) - contains 8 1-bit flags

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Enum Constant Summary
ACK
          ACK (1 bit) - indicates that the Acknowledgment field is significant.
CWR
          CWR (1 bit) - Congestion Window Reduced (CWR) flag is set by the sending host to indicate that it received a TCP segment with the ECE flag set and had responded in congestion control mechanism (added to header by RFC 3168).
ECE
          ECE (1 bit) - ECN-Echo indicates If the SYN flag is set, that the TCP peer is ECN capable.
FIN
          FIN (1 bit) - No more data from sender.
PSH
          PSH (1 bit) - Push function.
RST
          RST (1 bit) - Reset the connection.
SYN
          SYN (1 bit) - Synchronize sequence numbers.
URG
          URG (1 bit) - indicates that the Urgent pointer field is significant.
 
Method Summary
static java.util.Set<Tcp.Flag> asSet(int flags)
          Converts 8 contigeous bits of an inteteger to a set collection of enum constants, each representing if a flag is set in the original integer.
static java.lang.String toCompactString(int flags)
          Returns a compact string representation of the bit flags that are set within the integer.
static java.lang.String toCompactString(java.util.Set<Tcp.Flag> flags)
          Returns a compact string representation of the flags contained with the collection's set.
static Tcp.Flag valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Tcp.Flag[] 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

ACK

public static final Tcp.Flag ACK
ACK (1 bit) - indicates that the Acknowledgment field is significant. All packets after the initial SYN packet sent by the client should have this flag set.


CWR

public static final Tcp.Flag CWR
CWR (1 bit) - Congestion Window Reduced (CWR) flag is set by the sending host to indicate that it received a TCP segment with the ECE flag set and had responded in congestion control mechanism (added to header by RFC 3168).


ECE

public static final Tcp.Flag ECE
ECE (1 bit) - ECN-Echo indicates If the SYN flag is set, that the TCP peer is ECN capable. If the SYN flag is clear, that a packet with Congestion Experienced flag in IP header set is received during normal transmission (added to header by RFC 3168).


FIN

public static final Tcp.Flag FIN
FIN (1 bit) - No more data from sender.


PSH

public static final Tcp.Flag PSH
PSH (1 bit) - Push function. Asks to push the buffered data to the receiving application.


RST

public static final Tcp.Flag RST
RST (1 bit) - Reset the connection.


SYN

public static final Tcp.Flag SYN
SYN (1 bit) - Synchronize sequence numbers. Only the first packet sent from each end should have this flag set. Some other flags change meaning based on this flag, and some are only valid for when it is set, and others when it is clear.


URG

public static final Tcp.Flag URG
URG (1 bit) - indicates that the Urgent pointer field is significant.

Method Detail

values

public static Tcp.Flag[] 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 (Tcp.Flag c : Tcp.Flag.values())
    System.out.println(c);

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

valueOf

public static Tcp.Flag 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

asSet

public static java.util.Set<Tcp.Flag> asSet(int flags)
Converts 8 contigeous bits of an inteteger to a set collection of enum constants, each representing if a flag is set in the original integer.

Parameters:
flags - integer containing the flags (8-bits)
Returns:
a collection set with constants for each bit set within the integer

toCompactString

public static java.lang.String toCompactString(int flags)
Returns a compact string representation of the bit flags that are set within the integer.

Parameters:
flags - integer containing the flags (8-bit)
Returns:
a terse representation of the flags

toCompactString

public static java.lang.String toCompactString(java.util.Set<Tcp.Flag> flags)
Returns a compact string representation of the flags contained with the collection's set.

Parameters:
flags - a collection's set of flags
Returns:
a terse representation of the flags