org.jnetstream.protocol.codec
Interface Scanner

All Superinterfaces:
com.slytechs.utils.memory.MetaBuffer.MetaBufferListener<Header>

public interface Scanner
extends com.slytechs.utils.memory.MetaBuffer.MetaBufferListener<Header>

Packet scanner which allows lightweight and heavyweight packet decoding. The scanner interface provides to distinctly different ways of decoding packet content.

The lightweight calls do not create any objects or use heavy amount storage and provide a quick way to determine which headers exists within a packet. The lightweight methods are invoked using a call to #quickScan() which relies on Scanner.Scandec interface to provide lightweight, in possibly non-java way. Scandecs can be implemented using native or BPF byte code librariers which do nor rely on need for creating and accessing java objects.

The heavyweight class produce header objects and if fully decoded sub header and field objects as well. This is much heavier way of accessing packet content but is required by the general jNetStream public API. For example invoking the method call Packet.format() forces entire packet contents to be fully decoded so that information about each piece of the packet nicely formatted and displayed to the user.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
static interface Scanner.Scandec
           Scanner's Decoder or Scandec for short.
 
Method Summary
 boolean fullScan(PacketRuntime packet)
          Performs a full scan of the raw packet buffer, using object based API to determine to build and decode headers.
 com.slytechs.utils.memory.MetaBuffer<Header> init(com.slytechs.utils.memory.BitBuffer buffer, com.slytechs.utils.memory.MetaBuffer<Header> cache)
           
 boolean quickScan(PacketRuntime packetRT)
          Performs a quick scan of the raw packet buffer, using non object based API to determine which headers exist and their lengths.
 
Methods inherited from interface com.slytechs.utils.memory.MetaBuffer.MetaBufferListener
getMetaBufferData
 

Method Detail

fullScan

boolean fullScan(PacketRuntime packet)
                 throws java.io.IOException
Performs a full scan of the raw packet buffer, using object based API to determine to build and decode headers.

Returns:
TODO
Throws:
java.io.IOException

quickScan

boolean quickScan(PacketRuntime packetRT)
                  throws java.io.IOException
Performs a quick scan of the raw packet buffer, using non object based API to determine which headers exist and their lengths.

Parameters:
packetRT -
Returns:
TODO
Throws:
CodecCreateException
java.io.IOException

init

com.slytechs.utils.memory.MetaBuffer<Header> init(com.slytechs.utils.memory.BitBuffer buffer,
                                                  com.slytechs.utils.memory.MetaBuffer<Header> cache)
Parameters:
buffer -
cache -
Returns: