org.jnetpcap.packet
Class AbstractBinding<H extends JHeader>

java.lang.Object
  extended by org.jnetpcap.packet.AbstractBinding<H>
All Implemented Interfaces:
JBinding, JDependency

public abstract class AbstractBinding<H extends JHeader>
extends java.lang.Object
implements JBinding

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jnetpcap.packet.JBinding
JBinding.DefaultJBinding
 
Field Summary
 
Fields inherited from interface org.jnetpcap.packet.JBinding
NULL_ID
 
Constructor Summary
AbstractBinding(java.lang.Class<? extends JHeader> sourceClass, java.lang.Class<H> targetClass)
           
 
Method Summary
 int getSourceId()
          Protocol header ID for this binding.
 int getTargetId()
          Protocol header ID to which this binding is bound to.
abstract  boolean isBound(JPacket packet, H header)
           
 boolean isBound(JPacket packet, int offset)
          Checks the length of the header that has not been bound yet.
 int[] listDependencies()
          A list of dependencies that a binding has.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBinding

public AbstractBinding(java.lang.Class<? extends JHeader> sourceClass,
                       java.lang.Class<H> targetClass)
Method Detail

getSourceId

public int getSourceId()
Description copied from interface: JBinding
Protocol header ID for this binding.

Specified by:
getSourceId in interface JBinding
Returns:
numerical ID of the header as assigned by JRegistry

getTargetId

public int getTargetId()
Description copied from interface: JBinding
Protocol header ID to which this binding is bound to.

Specified by:
getTargetId in interface JBinding
Returns:
numerical protocol ID as assigned by JRegistry

isBound

public boolean isBound(JPacket packet,
                       int offset)
Description copied from interface: JBinding
Checks the length of the header that has not been bound yet. The returned length value provides 2 pieces of information. 1st, length of 0 indicates that the header is not bound. 2nd, length of non zero indicates that the header is bound and either the entire or trucated length of the header.

Specified by:
isBound in interface JBinding
Parameters:
packet - packet and its data buffer
offset - offset into the packet data buffer where the end of the previous header is
Returns:
either full or truncated length of the header or 0 if header is not bound at all

isBound

public abstract boolean isBound(JPacket packet,
                                H header)

listDependencies

public int[] listDependencies()
Description copied from interface: JBinding
A list of dependencies that a binding has.

Specified by:
listDependencies in interface JBinding
Returns:
list of depdencies