org.jnetpcap.packet.structure
Class AnnotatedBinding

java.lang.Object
  extended by org.jnetpcap.packet.structure.AnnotatedBinding
All Implemented Interfaces:
JBinding, JDependency

public class AnnotatedBinding
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
protected  int[] dependencies
           
 
Fields inherited from interface org.jnetpcap.packet.JBinding
NULL_ID
 
Method Summary
static void clearCache()
           
 int getSourceId()
          Protocol header ID for this binding.
 java.lang.Class<? extends JHeader> getTargetClass()
           
 int getTargetId()
          Protocol header ID to which this binding is bound to.
static JBinding[] inspectClass(java.lang.Class<?> c, java.util.List<HeaderDefinitionError> errors)
           
static JBinding[] inspectClass(java.lang.Object bindingSuite, java.util.List<HeaderDefinitionError> errors)
           
static
<T extends JHeader>
JBinding[]
inspectJHeaderClass(java.lang.Class<T> c, java.util.List<HeaderDefinitionError> errors)
           
static JBinding[] inspectObject(java.lang.Object object, java.util.List<HeaderDefinitionError> errors)
           
 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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dependencies

protected final int[] dependencies
Method Detail

clearCache

public static void clearCache()

inspectClass

public static JBinding[] inspectClass(java.lang.Class<?> c,
                                      java.util.List<HeaderDefinitionError> errors)

inspectJHeaderClass

public static <T extends JHeader> JBinding[] inspectJHeaderClass(java.lang.Class<T> c,
                                                                 java.util.List<HeaderDefinitionError> errors)

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

getTargetClass

public java.lang.Class<? extends JHeader> getTargetClass()

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

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

inspectClass

public static JBinding[] inspectClass(java.lang.Object bindingSuite,
                                      java.util.List<HeaderDefinitionError> errors)
Parameters:
bindingSuite -
errors -
Returns:

inspectObject

public static JBinding[] inspectObject(java.lang.Object object,
                                       java.util.List<HeaderDefinitionError> errors)
Parameters:
object -
errors -
Returns: