com.voytechs.jnetstream.codec
Interface Flow

All Known Implementing Classes:
FlowImpl

public interface Flow

A flow is defined as a channel or connection between two or multiple endpoints. A flow is determined by addresses at OSI layer 2, 3 and layer 4.

A flow contains a flow key and a list of packets. A flow is a neat and natural way of organizing network traffic. Many different packets seen on the network can be grouped into Flows by the decoder. This makes it easy to sort through massive amount of data comming from the network.

Since packets on the network are usually not Flow sequential, that is many different flows exist with packets being sent at unpredictable and seemingly random times, the decoder builds many different flows all at the same time. Only when either a flow is complete or maximum number of packets allowed by the decoder has been added to the flow is the flow expired from active queue onto the expired queue. The user can drain the expired queue using the FlowDecoder.nextFlow() method. When no more flows are available a null is returned by that method.

Alternatively you can implement DecoderListener interface and let the decoder notify you in real time when new flow is created, when a packet has been added to it or when it has expired or completed.

Since:
0.2.3
Author:
Mark Bednarczyk

Field Summary
static int LEFT
          CONSTANT defines the arbitrary direction within the flow.
static int MAX_PACKETS
          MAX packets per flow allowed by the FlowDecoder
static int RIGHT
          CONSTANT defines the arbitrary direction within the flow.
 
Method Summary
 void addLeftPacket(Packet packet)
          Adds a new packet to the flow and labels it as going in the LEFT direction.
 void addRightPacket(Packet packet)
          Adds a new packet to the flow and labels it as going in the RIGHT direction.
 FlowKey getFlowKey()
          Returns the Flow key for this flow.
 java.util.List getLeftPackets()
          Returns a list of packets only in the LEFT direction.
 int getPacketCount()
          Total number of packets within this flow.
 java.util.List getPackets()
          Returns a list of all the packets within the flow.
 java.util.List getRightPackets()
          Returns a list of packets only in the RIGHT direction.
 java.lang.String getSummaryLine()
          Returns a terse summary string of this flow.
 java.lang.String toString()
          Turns into printable output.
 

Field Detail

LEFT

static final int LEFT
CONSTANT defines the arbitrary direction within the flow.

See Also:
Constant Field Values

RIGHT

static final int RIGHT
CONSTANT defines the arbitrary direction within the flow.

See Also:
Constant Field Values

MAX_PACKETS

static final int MAX_PACKETS
MAX packets per flow allowed by the FlowDecoder

See Also:
Constant Field Values
Method Detail

getFlowKey

FlowKey getFlowKey()
Returns the Flow key for this flow. A flow key uniquely identifies a particular flow.

Returns:
the flow key for this flow.

addLeftPacket

void addLeftPacket(Packet packet)
Adds a new packet to the flow and labels it as going in the LEFT direction.

Parameters:
packet - packet to add to the flow.

addRightPacket

void addRightPacket(Packet packet)
Adds a new packet to the flow and labels it as going in the RIGHT direction.

Parameters:
packet - packet to add to the flow.

toString

java.lang.String toString()
Turns into printable output. Summary of all packets are added as well. Packets summaries are grouped by the packet direction.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the flow.

getPacketCount

int getPacketCount()
Total number of packets within this flow.


getPackets

java.util.List getPackets()
Returns a list of all the packets within the flow.

Returns:
list of packets.

getRightPackets

java.util.List getRightPackets()
Returns a list of packets only in the RIGHT direction.

Returns:
list of packets.

getLeftPackets

java.util.List getLeftPackets()
Returns a list of packets only in the LEFT direction.

Returns:
list of packets.

getSummaryLine

java.lang.String getSummaryLine()
Returns a terse summary string of this flow.

Returns:
String with summary information about this flow.