org.jnetpcap.protocol.tcpip
Class TcpStream

java.lang.Object
  extended by org.jnetpcap.nio.JMemory
      extended by org.jnetpcap.nio.JBuffer
          extended by org.jnetpcap.nio.JObjectBuffer
              extended by org.jnetpcap.nio.JStructBuffer
                  extended by org.jnetpcap.packet.analysis.AbstractAnalysis<TcpStream,TcpStreamEvent>
                      extended by org.jnetpcap.protocol.tcpip.TcpStream
All Implemented Interfaces:
java.lang.Iterable<JAnalysis>, JByteBuffer, JAnalysis

public class TcpStream
extends AbstractAnalysis<TcpStream,TcpStreamEvent>

A stream in a single direction of a bi-directional stream. The parent of this stream is a TcpDuplexStream, a stream consisting of 2 TcpStreams, one for each direction.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jnetpcap.nio.JStructBuffer
JStructBuffer.JStructField
 
Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory
JMemory.Type
 
Field Summary
static int FLAG_HAS_ERRORS
           
static int FLAG_HAS_MSS
           
static int FLAG_HAS_WARNINGS
           
static int FLAG_SACK_PERMITTED
           
static int FLAG_WINDOW_SCALING
           
 
Fields inherited from class org.jnetpcap.nio.JObjectBuffer
REF
 
Fields inherited from class org.jnetpcap.nio.JMemory
JNETPCAP_LIBRARY_NAME
 
Constructor Summary
TcpStream()
           
TcpStream(int hash, TcpDuplexStream.Direction direction, TcpDuplexStream duplex, TcpAnalyzer analyzer)
           
 
Method Summary
 void addToSequenceQueue(JPacket packet)
           
 int compareTo(Timeout o)
           
<T extends JAnalysis>
T
getAnalysis(T analysis)
           
 int getDestinationPort()
           
 long getRcvWIN()
           
 java.util.Queue<JPacket> getSequenceQueue()
           
 long getSndNXT()
           
 long getSndNXTNormal()
           
 long getSndStart()
           
 long getSndUNA()
           
 long getSndUNANormal()
           
<T extends JAnalysis>
boolean
hasAnalysis(java.lang.Class<T> analysis)
           
<T extends JAnalysis>
boolean
hasAnalysis(T analysis)
           
 int hashCode()
           
 boolean hasSndStart()
           
 boolean isTimedout(long timeInMillis)
           
 boolean removeFromSequenceQueue(long sequence, JAnalysis analysis)
          Removes from queue segments that have lower sequence numbers then the one supplied.
 void setDestinationPort(int value)
           
 void setRcvWIN(long rcvWIN)
           
 void setSndNXT(long sndNXT)
           
 void setSndNXT(long sndNXT, JPacket packet)
           
 void setSndStart(long sequence)
           
 void setSndUNA(long sndUNA, JPacket packet)
           
 void setSndUNANormal(long sndUNA)
           
 void timeout()
           
 
Methods inherited from class org.jnetpcap.packet.analysis.AbstractAnalysis
addListener, getAnalyzer, getSupport, getText, getTitle, getType, hasAnalysis, iterator, peer, removeListener, setAnalyzer, setText
 
Methods inherited from class org.jnetpcap.nio.JStructBuffer
calcSize
 
Methods inherited from class org.jnetpcap.nio.JObjectBuffer
getObject, getObject, setObject, setObject, sizeofJObject
 
Methods inherited from class org.jnetpcap.nio.JBuffer
findUTF8String, getByte, getByteArray, getByteArray, getDouble, getFloat, getInt, getLong, getShort, getUByte, getUInt, getUShort, getUTF8Char, getUTF8String, getUTF8String, getUTF8String, getUTF8String, isReadonly, order, order, peer, peer, peer, peer, setByte, setByteArray, setByteBuffer, setDouble, setFloat, setInt, setLong, setShort, setUByte, setUInt, setUShort, transferFrom, transferFrom, transferFrom, transferTo, transferTo, transferTo
 
Methods inherited from class org.jnetpcap.nio.JMemory
check, cleanup, finalize, isInitialized, isJMemoryBasedOwner, isOwner, peer, setSize, size, toDebugString, toHexdump, toHexdump, totalActiveAllocated, totalAllocateCalls, totalAllocated, totalAllocatedSegments0To255Bytes, totalAllocatedSegments256OrAbove, totalDeAllocateCalls, totalDeAllocated, transferFrom, transferFrom, transferFromDirect, transferOwnership, transferTo, transferTo, transferTo, transferTo, transferTo
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jnetpcap.nio.JByteBuffer
size
 

Field Detail

FLAG_HAS_ERRORS

public static final int FLAG_HAS_ERRORS
See Also:
Constant Field Values

FLAG_HAS_MSS

public static final int FLAG_HAS_MSS
See Also:
Constant Field Values

FLAG_HAS_WARNINGS

public static final int FLAG_HAS_WARNINGS
See Also:
Constant Field Values

FLAG_SACK_PERMITTED

public static final int FLAG_SACK_PERMITTED
See Also:
Constant Field Values

FLAG_WINDOW_SCALING

public static final int FLAG_WINDOW_SCALING
See Also:
Constant Field Values
Constructor Detail

TcpStream

public TcpStream()
Parameters:
type -
size -

TcpStream

public TcpStream(int hash,
                 TcpDuplexStream.Direction direction,
                 TcpDuplexStream duplex,
                 TcpAnalyzer analyzer)
Parameters:
duplex - TODO
size -
name -
Method Detail

compareTo

public int compareTo(Timeout o)

getAnalysis

public <T extends JAnalysis> T getAnalysis(T analysis)
Specified by:
getAnalysis in interface JAnalysis
Overrides:
getAnalysis in class AbstractAnalysis<TcpStream,TcpStreamEvent>

getDestinationPort

public int getDestinationPort()
Returns:

getRcvWIN

public final long getRcvWIN()
Returns:
the rcvWIN

getSndNXT

public final long getSndNXT()
Returns:
the sndNXT

getSndNXTNormal

public final long getSndNXTNormal()
Returns:
the sndNXT

getSndStart

public long getSndStart()

getSndUNA

public final long getSndUNA()
Returns:
the sndUNA

getSndUNANormal

public final long getSndUNANormal()
Returns:
the sndUNA

hasAnalysis

public <T extends JAnalysis> boolean hasAnalysis(java.lang.Class<T> analysis)
Specified by:
hasAnalysis in interface JAnalysis
Overrides:
hasAnalysis in class AbstractAnalysis<TcpStream,TcpStreamEvent>

hasAnalysis

public <T extends JAnalysis> boolean hasAnalysis(T analysis)
Specified by:
hasAnalysis in interface JAnalysis
Overrides:
hasAnalysis in class AbstractAnalysis<TcpStream,TcpStreamEvent>

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

hasSndStart

public boolean hasSndStart()

isTimedout

public boolean isTimedout(long timeInMillis)

setDestinationPort

public void setDestinationPort(int value)

setRcvWIN

public final void setRcvWIN(long rcvWIN)
Parameters:
rcvWIN - the rcvWIN to set

setSndNXT

public final void setSndNXT(long sndNXT)
Parameters:
sndNXT - the sndNXT to set

setSndNXT

public final void setSndNXT(long sndNXT,
                            JPacket packet)
Parameters:
sndNXT - the sndNXT to set

setSndStart

public void setSndStart(long sequence)
Parameters:
seq -

setSndUNA

public final void setSndUNA(long sndUNA,
                            JPacket packet)
Parameters:
sndUNA - the sndUNA to set

setSndUNANormal

public final void setSndUNANormal(long sndUNA)
Parameters:
sndUNA - the sndUNA to set

timeout

public void timeout()

addToSequenceQueue

public void addToSequenceQueue(JPacket packet)

removeFromSequenceQueue

public boolean removeFromSequenceQueue(long sequence,
                                       JAnalysis analysis)
Removes from queue segments that have lower sequence numbers then the one supplied. If analysis is not null, it is also applied to all the segments that are being removed from the queue at the same time.

Parameters:
sequence - timeout lower sequenced numbered segments
analysis - apply analysis to each removed/timedout segment, if null ignored
Returns:
returns true if segments were removed from the queue otherwise false

getSequenceQueue

public java.util.Queue<JPacket> getSequenceQueue()