org.jnetstream.capture
Interface PacketIndexer<I extends CapturePacket>

Type Parameters:
I - type returned from interator methods such as IOIterator.next().
All Superinterfaces:
java.io.Closeable, FileIndexer<I,Packet,I>, java.io.Flushable, IndexedFileModifier<Packet,I>, java.lang.Iterable<I>

public interface PacketIndexer<I extends CapturePacket>
extends FileIndexer<I,Packet,I>

All getter methods, that return a packet return subclass of CapturePacket while all mutable methods, methods that take packets, simply require any type of packet.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 void add(long index, java.nio.ByteBuffer data)
           Adds a new packet to the capture file at current cursor position.
 void add(long index, java.nio.ByteBuffer data, int dlt, long original, long seconds, long nanos)
           Adds a new packet to the capture file at current cursor position.
 void add(long index, java.nio.ByteBuffer data, Protocol dlt)
           Adds a new packet to the capture file at current cursor position.
 void add(long index, java.nio.ByteBuffer data, Protocol dlt, long original)
           Adds a new packet to the capture file at current cursor position.
 void add(long index, java.nio.ByteBuffer data, Protocol dlt, long original, long seconds, long nanos)
           Adds a new packet to the capture file at current cursor position.
 
Methods inherited from interface org.jnetstream.capture.file.FileIndexer
get, keepInMemory, mapIndexToPosition, setAutoflush, size
 
Methods inherited from interface org.jnetstream.capture.file.IndexedFileModifier
abortChanges, add, add, addAll, remove, removeAll, removeAll, removeAll, removeAll, replace, retainAll, retainAll, set, swap
 
Methods inherited from interface java.io.Closeable
close
 
Methods inherited from interface java.io.Flushable
flush
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

add

void add(long index,
         java.nio.ByteBuffer data,
         Protocol dlt,
         long original,
         long seconds,
         long nanos)
         throws java.io.IOException

Adds a new packet to the capture file at current cursor position. The packet data is contained within the supplied data buffer where current position and limit properties define which section of the buffer will be copied to the capture file. The dlt (data link type) is used to specify the protocol of the first header within the data buffer.

If the underlying file type supports other properties within the packet header, those properties will be initialized to some default initial value as determined by the format itself. If you need to specify additional properties you must use one of the more format specific methods found within the format package.

Parameters:
data - buffer containing the packet's data
dlt - protocol of the first header within the packet
original - length of the original packet before any truncations if any took place
seconds - capture timestamp in seconds
nanos - Capture timestamp in nano seconds as a fraction of a second. The valid value is between 0 and 999,999,999.
Throws:
java.io.IOException - any IO errors

add

void add(long index,
         java.nio.ByteBuffer data,
         int dlt,
         long original,
         long seconds,
         long nanos)
         throws java.io.IOException

Adds a new packet to the capture file at current cursor position. The packet data is contained within the supplied data buffer where current position and limit properties define which section of the buffer will be copied to the capture file. This verion allows one to specify the raw DLT type. The dlt (data link type) is used to specify the protocol of the first header within the data buffer. This raw DLT type will not have any transformations done on it and will be written into the packet record header as is.

If the underlying file type supports other properties within the packet header, those properties will be initialized to some default initial value as determined by the format itself. If you need to specify additional properties you must use one of the more format specific methods found within the format package.

Parameters:
data - buffer containing the packet's data
dlt - protocol of the first header within the packet
original - length of the original packet before any truncations if any took place
Throws:
java.io.IOException - any IO errors

add

void add(long index,
         java.nio.ByteBuffer data,
         Protocol dlt,
         long original)
         throws java.io.IOException

Adds a new packet to the capture file at current cursor position. The packet data is contained within the supplied data buffer where current position and limit properties define which section of the buffer will be copied to the capture file. The dlt (data link type) is used to specify the protocol of the first header within the data buffer.

The capture timestamp is initialized to the current timestamp.

If the underlying file type supports other properties within the packet header, those properties will be initialized to some default initial value as determined by the format itself. If you need to specify additional properties you must use one of the more format specific methods found within the format package.

Parameters:
data - buffer containing the packet's data
dlt - protocol of the first header within the packet
original - length of the original packet before any truncations if any took place
Throws:
java.io.IOException - any IO errors

add

void add(long index,
         java.nio.ByteBuffer data,
         Protocol dlt)
         throws java.io.IOException

Adds a new packet to the capture file at current cursor position. The packet data is contained within the supplied data buffer where current position and limit properties define which section of the buffer will be copied to the capture file. The dlt (data link type) is used to specify the protocol of the first header within the data buffer.

The capture timestamp is initialized to the current timestamp. The original packet length is initialized to be equal to the included length.

If the underlying file type supports other properties within the packet header, those properties will be initialized to some default initial value as determined by the format itself. If you need to specify additional properties you must use one of the more format specific methods found within the format package.

Parameters:
data - buffer containing the packet's data
dlt - protocol of the first header within the packet
original - length of the original packet before any truncations if any took place
Throws:
java.io.IOException - any IO errors

add

void add(long index,
         java.nio.ByteBuffer data)
         throws java.io.IOException

Adds a new packet to the capture file at current cursor position. The packet data is contained within the supplied data buffer where current position and limit properties define which section of the buffer will be copied to the capture file.

The capture timestamp is initialized to the current timestamp. The original packet length is initialized to be equal to the included length. The DLT is intialized to org.jnetstream.protocol.Protocol#Ethernet constant.

If the underlying file type supports other properties within the packet header, those properties will be initialized to some default initial value as determined by the format itself. If you need to specify additional properties you must use one of the more format specific methods found within the format package.

Parameters:
data - buffer containing the packet's data
dlt - protocol of the first header within the packet
original - length of the original packet before any truncations if any took place
Throws:
java.io.IOException - any IO errors