|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CapturePacket
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.
| Method Summary | |
|---|---|
java.nio.ByteBuffer |
allocatePacketBuffer(int length)
Allocates a packet buffer that is implementation optimized. |
CaptureInterface |
getCaptureInterface()
Returns information about the device that captured this packet. |
int |
getIncludedPacketLength()
Gets the number of octets that were included as packet data after the packet was captured. |
int |
getOriginalPacketLength()
Gets the number of octets of the actual packet as it was originally seen at the time of the capture or on the wire. |
java.nio.ByteBuffer |
getPacketBuffer()
Gets a buffer that contains the packet's data. |
java.sql.Timestamp |
getTimestamp()
Convenience method which converts the getTimestampSeconds() and getTimestampNanos()
to a Timestamp object. |
long |
getTimestampNanos()
Gets the timestamp as recorded at the time of the packet capture in fraction of a second, in nanoseconds. |
long |
getTimestampSeconds()
Gets the timestamp as recorded at the time of the packet capture in number of seconds since 1.1.1970. |
void |
setCaptureInterface(CaptureInterface device)
Sets the device that captured this packet. |
void |
setOriginalPacketLength(int length)
Sets the original length of the packet in octets. |
void |
setPacketBuffer(java.nio.ByteBuffer buffer)
Set the packets data buffer. |
void |
setTimestamp(long seconds,
long nanos)
Sets the timestamp when the packet was captured by a CaptureInterface, i.e. |
void |
setTimestamp(java.sql.Timestamp time)
Convenience method which sets the capture timestamp using a Timestamp object. |
| Method Detail |
|---|
CaptureInterface getCaptureInterface()
void setCaptureInterface(CaptureInterface device)
device - device to set as the device that captured this packetjava.nio.ByteBuffer getPacketBuffer()
getIncludedPacketLength() method. This is because
if the packet came from a packet record stored in a file, the
record's data length may have been bigger then the actual data.
This extra buffer size is unused and can be used to expand that packet.
Lastly the position and limit of the buffer will be set to the start and
length of the actual packet data, respectively.
void setPacketBuffer(java.nio.ByteBuffer buffer)
getPacketBuffer() method after each commit or write
to a storage device such as using the MutableFileCapture.flush()
method.
buffer - buffer to set as this packets data bufferjava.nio.ByteBuffer allocatePacketBuffer(int length)
Allocates a packet buffer that is implementation optimized. This may be more efficient then user allocated buffer as buffers are cached and reused; also the buffer may be part of much larger native memory allocation that is used for storing packet buffer information.
length - length of the buffer to allocateint getIncludedPacketLength()
int getOriginalPacketLength()
getIncludedPacketLength() method since sometimes packets
are "sliced", "truncated", "snapped" etc to preserve storage space.
void setOriginalPacketLength(int length)
length - length in octets of the packet data bufferlong getTimestampSeconds()
long getTimestampNanos()
getCaptureInterface() and then
CaptureInterface.getTimestampResolution() which will return an enum constant
which describes if the resulution is in nanoseconds or microseconds. In either case
this information should only be required in rare circuimstances as the timestamp is
always converted and reported in nanoseconds, no matter what the resolution actually is.
java.sql.Timestamp getTimestamp()
getTimestampSeconds() and getTimestampNanos()
to a Timestamp object. The timestamp object is cached.
void setTimestamp(java.sql.Timestamp time)
time - timestamp for when the packet was captured off of a live network
void setTimestamp(long seconds,
long nanos)
throws java.lang.IllegalArgumentException
CaptureInterface.getTimestampResolution() is not checked and all values in the range
of 0 to 999,999,999 are allowed even if the clock's resolution is only in microseconds. It is upto
the user to convert the timestamp into nanoseconds when the actual resolution is in microseconds
by multiplying the microsecond value by one thousand (nanoseconds = microseconds * 1000).
seconds - number of seconds since 1.1.1970nanos - fraction of a second in range of 0 to 999,999,999
java.lang.IllegalArgumentException - if nanos is less then 0 or greater then 999,999,999 nanoseconds
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||