org.jnetstream.capture.file.pcap
Interface PcapModifier

All Superinterfaces:
FileModifier<java.nio.ByteBuffer,PcapPacket>, com.slytechs.utils.collection.IOAddable<java.nio.ByteBuffer>, com.slytechs.utils.collection.IORemovable

public interface PcapModifier
extends FileModifier<java.nio.ByteBuffer,PcapPacket>

Extends the more generic FileModifier that only has capability to remove records from a capture file, and supplied methods to create and add new records to existing file.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 void addPacketRecord(java.nio.ByteBuffer b, long s, int n, int o)
          Adds a new packet record to the Pcap file.
 
Methods inherited from interface org.jnetstream.capture.file.FileModifier
abortChanges, add, addAll, addAll, remove, removeAll, removeAll, removeAll, removeAll, replace, retainAll, retainAll, swap
 

Method Detail

addPacketRecord

void addPacketRecord(java.nio.ByteBuffer b,
                     long s,
                     int n,
                     int o)
                     throws java.io.IOException
Adds a new packet record to the Pcap file. The included packet length is calculated based on the size of data in the buffer. The formula uses ByteBuffer's position and limit properties to calculate this value.

Parameters:
b - buffer containing the packet content
s - capture timestamp in seconds
n - capture timestamp in nanosecond fraction of a second with value value of 0 to 999,999,999
o - original packet length in octets as it was seen on the network wire included packet length
Throws:
java.io.IOException