public abstract class KrakenBaseProtocol extends Object implements BaseProtocol
BaseProtocol.bind(BaseProtocol)
}
specification which relies on reflection to provide a convenient way for subclasses to provide multiple bindings:
While it is possible for subclasses to override this mechanism, subclasses should instead define several bind-method
signatures directly, i.e. it should advertise possible bindings directly via the available bind-methods.
In order to rely on this feature is is mandatory for implementing classes to:
Alternatively, a subclass may disregard this feature and implement a suitable bind(BaseProtocol)
method
on its own.
Modifier and Type | Field and Description |
---|---|
static String |
BINDING_METHOD_NAME |
protected org.slf4j.Logger |
log |
protected PropertyChangeSupport |
propertyChangeSupport |
protected KrakenProtocolConfiguration |
protocolSetting |
Constructor and Description |
---|
KrakenBaseProtocol() |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener l)
Adds a listener instance to this object, notifications and property names are subject to the individual
subclass implementations.
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener l)
Adds a listener instance to this object, notifications and property names are subject to the individual
subclass implementations.
|
void |
bind(BaseProtocol baseProtocol)
A protocol decoder should be able to pass its decoded data to another parser.
|
static Method |
findProtocolBindingMethod(BaseProtocol bindFrom,
BaseProtocol bindTo,
String bindingMethodName)
Tries to find a suitable bind-method for two concrete implementations of
BaseProtocol using reflection tools. |
PcapActivity |
getCurrentPcapActivity() |
protected PcapHandler<PcapActivityListener> |
getPcapHandler() |
KrakenProtocolConfiguration |
getProtocolConfiguration() |
void |
initialize(KrakenProtocolConfiguration krakenProtocolConfigurationImpl)
Initializes this protocol decoder with the information provided by the user.
|
void |
removePropertyChangeListener(PropertyChangeListener l)
Remove a property change listener instance from this objects, i.e.
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener l)
Remove a property change listener instance from this objects, i.e.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProtocolId
public static final String BINDING_METHOD_NAME
protected final org.slf4j.Logger log
protected final PropertyChangeSupport propertyChangeSupport
protected KrakenProtocolConfiguration protocolSetting
public static Method findProtocolBindingMethod(BaseProtocol bindFrom, BaseProtocol bindTo, String bindingMethodName) throws NoSuchMethodException
BaseProtocol
using reflection tools.
Both classes must share a common naming convention for bind methods, usually 'bind'.bindFrom
- bind from one concrete protocol decoder ...bindTo
- ... to another protocol decoderbindingMethodName
- the name that indicates the binding methodNoSuchMethodException
- if no such method was discovered or definedpublic void initialize(KrakenProtocolConfiguration krakenProtocolConfigurationImpl)
KrakenProtocolConfigurationBuilderImpl
before the bindings are processed.
This method should be called exactly once, multiple calls will result in an exception being thrown.krakenProtocolConfigurationImpl
- the protocol configuration provided by the userpublic KrakenProtocolConfiguration getProtocolConfiguration()
public PcapActivity getCurrentPcapActivity()
protected PcapHandler<PcapActivityListener> getPcapHandler()
public void bind(BaseProtocol baseProtocol)
BaseProtocol
bind
in interface BaseProtocol
baseProtocol
- the protocol decoder to bind this decoder to, e.g. if base protocol refers to a decoder
capable of parsing IPv4 data and this class is able to decode Ethernet, and the user
specified a binding from Ethernet to IPv4, then Ethernet-decoder.bind(IPv4.decoder) will be
called once. All necessary steps must be taken by the caller and callee to ensure
successful data exchange. Currently the data exchange should be kept one way only,
i.e. data will flow from a lower layer to an upper layer only and not vice versa (unless
the user specified a binding from Ipv4 to Ethernet).public void addPropertyChangeListener(PropertyChangeListener l)
l
- the listener to addpublic void addPropertyChangeListener(String propertyName, PropertyChangeListener l)
propertyName
- the name of the property to listen for eventsl
- the listener to addpublic void removePropertyChangeListener(PropertyChangeListener l)
l
- the listener to removepublic void removePropertyChangeListener(String propertyName, PropertyChangeListener l)
propertyName
- the name of the property that was used to register this listener in the first placel
- the listener to removeCopyright © 2013–2015 Institute of networks and security. All rights reserved.