org.jnetstream.capture.file
Interface HeaderReader

All Superinterfaces:
com.slytechs.utils.memory.LengthReader, TypeReader

public interface HeaderReader
extends com.slytechs.utils.memory.LengthReader, TypeReader

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 Filter<RecordFilterTarget> asRecordFilter(Filter<ProtocolFilterTarget> filter, ProtocolFilterTarget protocol)
           Method adapts a "protocol" filter to a "record" filter.
 int getBlockRecordHeaderLength()
          Length of the block record's header (file header).
 int getHeaderLength(java.nio.ByteBuffer buffer)
           
 int getLengthFieldOffset()
           
 int getPacketRecordHeaderLength()
          Length of the packet record's header.
 RecordFilterTarget readRecordFilterTarget(java.nio.ByteBuffer buffer)
           
 RecordType readType(java.nio.ByteBuffer buffer)
           
 
Methods inherited from interface com.slytechs.utils.memory.LengthReader
getMinLength, getOffset, readLength
 

Method Detail

getHeaderLength

int getHeaderLength(java.nio.ByteBuffer buffer)
Parameters:
buffer - TODO
Returns:

readType

RecordType readType(java.nio.ByteBuffer buffer)
Specified by:
readType in interface TypeReader
Parameters:
buffer - TODO
Returns:

readRecordFilterTarget

RecordFilterTarget readRecordFilterTarget(java.nio.ByteBuffer buffer)
Parameters:
buffer -
Returns:

asRecordFilter

Filter<RecordFilterTarget> asRecordFilter(Filter<ProtocolFilterTarget> filter,
                                          ProtocolFilterTarget protocol)

Method adapts a "protocol" filter to a "record" filter. Protocol filter is one that filters the contents of a packet. It only works with a ProtocolFilterTarget which are things such as ProtocolConst or DLT of the first protocol within the packet. While the "record" filter works with file records which may or may not have packet contents at all.

The adaptor adapts a record filter to a packet filter by first making sure its a PacketRecord. Only packet records can be adapted, then offets the position within the buffer passed to accept and execute filter methods by the length of the record's header. Anotherwords, positions the buffer to point at the packet data, skipping past the record's header. This allows a protocol filter to be applied to records, since the record's buffer is shifted so that in reality the packet filter can be applied.

Parameters:
filter - the protocol filter to adapt to a record filter
protocol - the protocol or the DLT of the first protocol within the packet's data
Returns:

getBlockRecordHeaderLength

int getBlockRecordHeaderLength()
Length of the block record's header (file header).

Returns:
length in bytes

getPacketRecordHeaderLength

int getPacketRecordHeaderLength()
Length of the packet record's header.

Returns:
length in bytes

getLengthFieldOffset

int getLengthFieldOffset()