com.voytechs.jnetstream.codec.event
Class DecoderFlowEvent

java.lang.Object
  extended by com.voytechs.jnetstream.codec.event.DecoderEvent
      extended by com.voytechs.jnetstream.codec.event.DecoderFlowEvent

public class DecoderFlowEvent
extends DecoderEvent

As flows are created, updated and eventually expired, the DecoderFlowListener are notified. A DecoderFlowEvent is created to describe the event and pass along some useful information about the flow, packets and the decoder. You can retrieve the following information from this event.

Use the getSubType() to get exact event code of this notification. Typical usage is to put getSubType() into a switch() or if() statements.

        public void processDecoderEvent(DecoderEvent event) throws AssertFailure {
                if ( (event instanceof DecoderFlowEvent) == false) {
                        return false;
                }
                DecodeFlowEvent flowEvent = (DecoderFlowEvent) event;
                switch (flowEvent.getSubType()) {
                        case DecoderFlowEvent.NEW_FLOW:
                                break;
                        case DecoderFlowEvent.RIGHT_PACKET:
                                break;
                        case DecoderFlowEvent.LEFT_PACKET:
                                break;
                        case DecoderFlowEvent.EXPIRED_FLOW:
                                break;
                }
        }
 
 

Since:
0.2.3
Author:
Mark Bednarczyk

Field Summary
static int EXPIRED_FLOW
          Event type.
static int LEFT_PACKET
          Event type.
static java.lang.String NAME
          Name of this event.
static int NEW_FLOW
          Event type.
static int RIGHT_PACKET
          Event type.
static java.lang.String TYPE
          Event type identifier.
 
Constructor Summary
DecoderFlowEvent(int subType, Flow flow, Packet packet)
          New Packet has been created event.
DecoderFlowEvent(int subType, Flow flow, Packet packet, FlowDecoder decoder)
          New Packet has been created event.
 
Method Summary
 Flow getFlow()
           Returns the Flow object reference which generated this event.
 FlowDecoder getFlowDecoder()
          Returns the flow decoder that through this event and is responsible for management of the flow being thrown about.
 Packet getPacket()
          Returns the Packet object reference which generated this event.
 int getSubType()
          Returns the sub type of this event.
 void setSubType(int subType)
          Sets the sub type for this event.
 
Methods inherited from class com.voytechs.jnetstream.codec.event.DecoderEvent
getType, main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final java.lang.String TYPE
Event type identifier. This identifier can be used to identify this event type.

See Also:
Constant Field Values

NEW_FLOW

public static final int NEW_FLOW
Event type. New flow has been created

See Also:
Constant Field Values

LEFT_PACKET

public static final int LEFT_PACKET
Event type. A flow has been updated with a packet going in the LEFT direction.

See Also:
Constant Field Values

RIGHT_PACKET

public static final int RIGHT_PACKET
Event type. A flow has been updated with a packet going in the RIGHT direction.

See Also:
Constant Field Values

EXPIRED_FLOW

public static final int EXPIRED_FLOW
Event type. A flow has been expired by the decoder. It is placed on the expired queue and ready to be returned to the user. No more packets will be added to it.

See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
Name of this event. This is a longer name and more descriptive name for this event.

See Also:
Constant Field Values
Constructor Detail

DecoderFlowEvent

public DecoderFlowEvent(int subType,
                        Flow flow,
                        Packet packet)
New Packet has been created event. The event is initialized with a number of internal structures of the Decoder to aid in handling and allowing advanced processing to occur.

Parameters:
subType - The subType of this event.
packet - The Packet that was constructed that caused the dispatch.
flow - The flow which created this event structures.

DecoderFlowEvent

public DecoderFlowEvent(int subType,
                        Flow flow,
                        Packet packet,
                        FlowDecoder decoder)
New Packet has been created event. The event is initialized with a number of internal structures of the Decoder to aid in handling and allowing advanced processing to occur.

Parameters:
subType - The subType of this event.
packet - The Packet that was constructed that caused the dispatch.
flow - The flow which created this event structures.
decoder - flow decoder responsible for management of the flow
Method Detail

getSubType

public int getSubType()
Returns the sub type of this event.

Overrides:
getSubType in class DecoderEvent
Returns:
sub type of this event.

setSubType

public void setSubType(int subType)
Sets the sub type for this event.

Parameters:
subType - The new subtype for this event.

getPacket

public Packet getPacket()
Returns the Packet object reference which generated this event.

Returns:
A reference to Packet object.

getFlow

public Flow getFlow()

Returns the Flow object reference which generated this event. This decoder was the one used to decode and generate the packet.

This is sometimes needed as multiple decoders can be used in unisome and allows tracking of which decoder the packets are comming from.

Returns:
A reference to Flow object.

getFlowDecoder

public FlowDecoder getFlowDecoder()
Returns the flow decoder that through this event and is responsible for management of the flow being thrown about.

Returns:
flow decoder that through this event. Could be null if not set.