org.jnetstream.capture
Interface CapturePacket

All Superinterfaces:
java.lang.Iterable<Header>, Packet
All Known Subinterfaces:
DeserializedPacket, FilePacket, LivePacket, NAPPacket, PcapPacket, SnoopPacket

public interface CapturePacket
extends Packet

A captured network packet. The actual packet data may have been captured live from a network interface or device or came from a file, streamed . That is this interface does not neccessarily represent a 1-to-1 relationship with any record contained within the capture file.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jnetstream.packet.Packet
Packet.Property
 
Method Summary
 CaptureDevice getCaptureDevice()
          A reference to the capture device that the packet was captured on.
 long getIncludedLength()
          Gets the number of octets that were included as packet data after the packet was captured.
 long getOriginalLength()
          Gets the number of octets of the actual packet as it was originally seen at the time of the capture or on the wire.
 
Methods inherited from interface org.jnetstream.packet.Packet
format, getAllHeaders, getBuffer, getData, getHeader, getHeader, getHeaderCount, getProperty, getTimestampNanos, getTimestampSeconds, hasCompleteHeader, hasCompleteHeader, hasHeader, hasHeader, isTruncated, iterator
 

Method Detail

getIncludedLength

long getIncludedLength()
                       throws java.io.IOException
Gets the number of octets that were included as packet data after the packet was captured. This number may be less then the actual length of the packet as it was seen on the wire. This is sometimes also called the "snaplength" or "slice" of a packet. Truncating packet data in such a way allows greater storage efficiency when only the beginning of a packet data is needed. The beginning of a packet data contains the important protocol headers which can be used to determine the packet type and other important information. This is typically enough of accounting type application or monitoring applications.

Specified by:
getIncludedLength in interface Packet
Returns:
number of octets that were captured and stored in the packet data buffer
Throws:
java.io.IOException

getOriginalLength

long getOriginalLength()
                       throws java.io.IOException
Gets the number of octets of the actual packet as it was originally seen at the time of the capture or on the wire. This number may not neccessarily correspond with getIncludedLength() method since sometimes packets are "sliced", "truncated", "snapped" etc to preserve storage space.

Specified by:
getOriginalLength in interface Packet
Returns:
number of octets of the original packet before any truncation of its data buffer
Throws:
java.io.IOException

getCaptureDevice

CaptureDevice getCaptureDevice()
A reference to the capture device that the packet was captured on.

Returns:
device the packet was captured on