com.slytechs.jnetstream.protocol
Interface ProtocolBinding

All Known Implementing Classes:
NPLProtocolBinding

public interface ProtocolBinding

Protocol binding is a link/binding between two different protocols. A source protocol binds to a sink protocol. Then the sink protocol, when the time comes, evaluates the expression within this binding to determine if the source protocol is a candidate for the next protocol in the sequence of protocol headers being decoded/dissected.

Use the getSourceName() to get the name of the protocol to which this binding was definined. Use the getSinkName() to get the name of the protocol which will evaluate the binding expression to determine if source protocol is applicable as the next protocol in the sequence of headers.

You can also use the isLinked() method to determine if this binding has actually been linked into the runtime environment and is ready to be applied. Bindings may not neccessarily be linked as the Sink or the Source protocols may not have been loaded yet. Most protocols are loaded ondemand, that is only when they are needed. The bindings are applied when the protocol itself is loaded, not before.

Use the Protocol.getSourceBindings() or Protocol.getSinkBindings() to get a complete list of bindings for any given protocol. Of you can use ProtocolRegistry.getBindings() to get a list of all the bindings currrently loaded.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
static interface ProtocolBinding.BindingBuilder
          Private factory method for building bindings.
 
Method Summary
 java.util.List getDependancies()
          Returns the list of protocol dependencies.
 java.lang.String getExpression()
          Returns the original NPL expression as a String.
 java.lang.String getSinkName()
          Get the sink protocol.
 java.lang.String getSourceName()
          Get the source protocol.
 boolean isLinked()
          Checks if this binding has been linked into the runtime environment for the sink packet.
 

Method Detail

getSourceName

java.lang.String getSourceName()
Get the source protocol. The protocol for which this binding was defined.

Returns:
name of the source protocol.

getSinkName

java.lang.String getSinkName()
Get the sink protocol. The protocol which will evaluate this binding's expression to determine if the source protocol is applicable.

Returns:
name of the sink protocol

getExpression

java.lang.String getExpression()
Returns the original NPL expression as a String. This expression is compiled and linked into the runtime environment for the sink protocol.

Returns:
String expression that will be evaluated.

getDependancies

java.util.List getDependancies()
Returns the list of protocol dependencies. That is the list of all the protocols referenced by this binding's expression. The sink protocol is always 1 dependency, but there could be others. This is the list that is used during evaluation to load any additional protocols that the expression will depend on. Care must be taken when using other dependencies in the Binding expressions, to ensure that the other referenced protocols really do exist in the packet beind dissected, otherwise a runtime exception may be thrown.

Returns:
List of names of protocols which binding depends on. Will always have atleast 1, the sink protocol name.

isLinked

boolean isLinked()
Checks if this binding has been linked into the runtime environment for the sink packet. If the sink packet has not been loaded and linked, this binding will also not be linked. Linking of bindings happens when the protocol is loaded, not before.

Returns:
true if this binding is linked into the sink protocol's runtime environment, otherwise false.