org.jnetstream.protocol
Interface ProtocolInfo.Binding

All Superinterfaces:
Scanner.Scandec
Enclosing interface:
ProtocolInfo<T extends Header>

public static interface ProtocolInfo.Binding
extends Scanner.Scandec

Binding between protocols. Describes the conditions of how one protocol is bound to another. Typically in a packet, each protocol provides a header to describe its state. The headers are stacked one after the other. The previous protocol usually, but not neccessarily carries informaton about what next protocol should follow it. This information, sometimes in a form of a complex expression, is evaluated against a runtime version of a packet.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 int getHitCounter()
          Hit counter for this binding.
 java.util.Set<ProtocolInfo<? extends Header>> getProtocolReferences()
          List of protocols that this binding references and therefore is dependent on.
 ProtocolInfo<? extends Header> getSink()
          Returns the sink protocol of this binding.
 ProtocolInfo<? extends Header> getSource()
          Returns the source protocol of this binding.
 
Methods inherited from interface org.jnetstream.protocol.codec.Scanner.Scandec
getLength
 

Method Detail

getProtocolReferences

java.util.Set<ProtocolInfo<? extends Header>> getProtocolReferences()
List of protocols that this binding references and therefore is dependent on.

Returns:
list of dependent protocols

getSink

ProtocolInfo<? extends Header> getSink()
Returns the sink protocol of this binding.

Returns:
the sink protocol

getSource

ProtocolInfo<? extends Header> getSource()
Returns the source protocol of this binding. Source protocol is the protocol to which this binding is attached to.

Returns:
the source protocol

getHitCounter

int getHitCounter()
Hit counter for this binding. Every time the binding resolves to a protocol match, the hit counter is incremented. Then every time the resolution fails, the hit counter is decremented, unless the counter is at zero, at which point its not decremented any further.

The hit counter is used to prioritize protocol bindings. The bindings are ordered according to their hit counter. This ensures that a binding that is used more often is at the top of the binding list and has a chance to be matched before any other.

Returns:
current hit counter which is never a negative value