jnetpcap.capture.file.nap
Interface NAPBlock

All Superinterfaces:
BlockRecord, Record, RecordIterator<DataRecord>

public interface NAPBlock
extends RecordIterator<DataRecord>, BlockRecord

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
static class NAPBlock.Flag
           
 
Nested classes/interfaces inherited from interface jnetpcap.capture.file.Record
Record.Capability, Record.RecordType
 
Field Summary
static int HDR_BLOCK_ID
           
static int HDR_FLAGS
           
static int HDR_MAGIC_NUMBER
           
static int HDR_MAJOR_VERSION
           
static int HDR_MINOR_VERSION
           
static int HDR_NEXT_BLOCK_ID
           
static int HDR_PACKET_COUNT
           
 
Method Summary
 long getBlockId()
           
 java.util.Set<NAPBlock.Flag> getFlags()
          Mutable set of flags.
 long getNextBlockId()
           
 long getPacketCount()
          Returns the number of packets within the file.
<E extends DataRecord>
RecordIterator<E>
getRecords(java.lang.Class<E> c)
           
 Version getVersion()
          Returns the first file version found.
 void setBlockId(long blockId)
           
 void setNextBlockId(long id)
           
 void setPacketCount(int count)
           
 void setVersion(Version version)
           
 boolean validateMagicNumber()
           
 
Methods inherited from interface jnetpcap.capture.file.BlockRecord
getByteOrder, getMagicPattern, getPacketCount, setVersion
 
Methods inherited from interface jnetpcap.capture.file.Record
getCaptureFile, getFilePosition, getHeaderBuffer, getHeaderLength, getRecordLength, getRecordType, isModified, isWritten, read, readHeader, setFilePosition, setModified, setWritten, validateRecord, write, writeHeader
 

Field Detail

HDR_MAGIC_NUMBER

static final int HDR_MAGIC_NUMBER
See Also:
Constant Field Values

HDR_MAJOR_VERSION

static final int HDR_MAJOR_VERSION
See Also:
Constant Field Values

HDR_MINOR_VERSION

static final int HDR_MINOR_VERSION
See Also:
Constant Field Values

HDR_FLAGS

static final int HDR_FLAGS
See Also:
Constant Field Values

HDR_BLOCK_ID

static final int HDR_BLOCK_ID
See Also:
Constant Field Values

HDR_NEXT_BLOCK_ID

static final int HDR_NEXT_BLOCK_ID
See Also:
Constant Field Values

HDR_PACKET_COUNT

static final int HDR_PACKET_COUNT
See Also:
Constant Field Values
Method Detail

getBlockId

long getBlockId()

setBlockId

void setBlockId(long blockId)

getNextBlockId

long getNextBlockId()

setNextBlockId

void setNextBlockId(long id)

getVersion

Version getVersion()
Description copied from interface: BlockRecord
Returns the first file version found. There may be multiple blocks within the file at different versions.

Specified by:
getVersion in interface BlockRecord
Returns:
version of the file

setVersion

void setVersion(Version version)
Specified by:
setVersion in interface BlockRecord

validateMagicNumber

boolean validateMagicNumber()

getFlags

java.util.Set<NAPBlock.Flag> getFlags()
Mutable set of flags. By modifying the flags in this set you enable/disable certain features for the entire block.

Returns:
mutable set of block flags

getPacketCount

long getPacketCount()
Description copied from interface: BlockRecord

Returns the number of packets within the file. This only includes records that hold packet data and not any additional meta data records. The method uses the default PacketCounter. If estimated packet counter is acceptable you can use one of of several other PacketCounterModels to calculate estimated packet count using the BlockRecord.getPacketCount(PacketCounterModel) method.

The default PacketCounterModel is file type specific. The model at minimum returns an accurate count of packet records within the capture file, but no guarrantees about performance can be made and the performance will vary from format to format. You can use the more explicit BlockRecord.getPacketCount(PacketCounterModel) method to counter packets.

Specified by:
getPacketCount in interface BlockRecord
Returns:
total number of packets within the file using the default model

setPacketCount

void setPacketCount(int count)

getRecords

<E extends DataRecord> RecordIterator<E> getRecords(java.lang.Class<E> c)
                                                throws java.io.IOException
Specified by:
getRecords in interface BlockRecord
Throws:
java.io.IOException