|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.nio.JMemory
org.jnetpcap.nio.JBuffer
org.jnetpcap.packet.JPacket
org.jnetpcap.packet.JMemoryPacket
public class JMemoryPacket
A heap based packet. This is a heap (native memory) based packet that can be instantiated without having to supply PcapHeader.
| Nested Class Summary | |
|---|---|
static class |
JMemoryPacket.JMemoryHeader
A capture header that stores information about the creation of the packet. |
| Nested classes/interfaces inherited from class org.jnetpcap.packet.JPacket |
|---|
JPacket.State |
| Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory |
|---|
JMemory.Type |
| Field Summary |
|---|
| Fields inherited from class org.jnetpcap.packet.JPacket |
|---|
DEFAULT_STATE_HEADER_COUNT, defaultScanner, memory, pool, state |
| Fields inherited from class org.jnetpcap.nio.JMemory |
|---|
JNETPCAP_LIBRARY_NAME, MAX_DIRECT_MEMORY_DEFAULT, POINTER |
| Constructor Summary | |
|---|---|
JMemoryPacket(byte[] buffer)
Initializes the packet's state and data by doing a deep copy of the contents of the buffer. |
|
JMemoryPacket(java.nio.ByteBuffer buffer)
Initializes the packet's state and data by doing a deep copy of the contents of the buffer. |
|
JMemoryPacket(int size)
Preallocates a packet with internal buffer of the supplied size. |
|
JMemoryPacket(int id,
byte[] buffer)
Creates a new fully decoded packet from data provides in the buffer. |
|
JMemoryPacket(int id,
java.nio.ByteBuffer buffer)
Initializes the packet's state and data by doing a deep copy of the contents of the buffer. |
|
JMemoryPacket(int id,
JBuffer buffer)
Creates a new fully decoded packet from data provides in the buffer. |
|
JMemoryPacket(int id,
java.lang.String hexdump)
Creates a new fully decoded packet from the hexdump data provided. |
|
JMemoryPacket(JBuffer buffer)
Initializes the packet's state and data by doing a deep copy of the contents of the buffer. |
|
JMemoryPacket(JMemory.Type type)
Creates a potentially uninitialized packet with the specified memory type. |
|
JMemoryPacket(JMemoryPacket packet)
Copies both state and data from supplied packet to this packet by performing a deep copy of the contents of the buffer into packet's internal memory buffer if that buffer is large enough, otherwise a new buffer is allocated. |
|
JMemoryPacket(JPacket packet)
Copies both state and data from supplied packet to this packet by performing a deep copy of the contents of the buffer into packet's internal memory buffer if that buffer is large enough, otherwise a new buffer is allocated. |
|
| Method Summary | |
|---|---|
JMemoryPacket.JMemoryHeader |
getCaptureHeader()
Retrieves this packets capture header. |
int |
getTotalSize()
Calculates the total size of this packet which includes the size of the state structures and packet data. |
int |
peerStateAndData(java.nio.ByteBuffer buffer)
Peers the contents of the buffer directly with this packet. |
int |
peerStateAndData(JBuffer buffer)
Peers the contents of the buffer directly with this packet. |
int |
peerStateAndData(JBuffer buffer,
int offset)
Peers the contents of the buffer directly with this packet. |
void |
setWirelen(int wirelen)
Changes the wirelen of this packet. |
int |
transferStateAndDataFrom(byte[] buffer)
Performs a deep copy of the contents of the buffer into packet's internal memory buffer if that buffer is large enough, otherwise a new buffer is allocated. |
int |
transferStateAndDataFrom(java.nio.ByteBuffer buffer)
Performs a deep copy of the contents of the buffer into packet's internal memory buffer if that buffer is large enough, otherwise a new buffer is allocated. |
int |
transferStateAndDataFrom(JBuffer buffer)
Performs a deep copy of the contents of the buffer into packet's internal memory buffer if that buffer is large enough, otherwise a new buffer is allocated. |
int |
transferStateAndDataFrom(JMemoryPacket packet)
Copies both state and data from supplied packet to this packet by performing a deep copy of the contents of the buffer into packet's internal memory buffer if that buffer is large enough, otherwise a new buffer is allocated. |
int |
transferStateAndDataFrom(JPacket packet)
Copies both state and data from supplied packet to this packet by performing a deep copy of the contents of the buffer into packet's internal memory buffer if that buffer is large enough, otherwise a new buffer is allocated. |
int |
transferStateAndDataTo(JBuffer buffer,
int offset)
Copies contents of this packet to buffer. |
int |
transferStateAndDataTo(JMemoryPacket packet)
Copies both state and data to the supplied packet from this packet by performing a deep copy of the contents of the buffer into packet's internal memory buffer if that buffer is large enough, otherwise a new buffer is allocated. |
| Methods inherited from class org.jnetpcap.packet.JPacket |
|---|
allocate, getAllocatedMemorySize, getDefaultScanner, getFormatter, getFrameNumber, getHeader, getHeader, getHeaderByIndex, getHeaderCount, getHeaderIdByIndex, getHeaderInstanceCount, getMemoryBuffer, getMemoryBuffer, getMemoryBuffer, getMemoryBuffer, getMemoryPool, getPacketWirelen, getScanner, getState, hasHeader, hasHeader, hasHeader, hasHeader, remaining, remaining, scan, setFormatter, setMemoryPool, shutdown, toHexdump, toString |
| Methods inherited from class org.jnetpcap.nio.JBuffer |
|---|
findUTF8String, getByte, getByteArray, getByteArray, getByteArray, getDouble, getFloat, getInt, getLong, getShort, getUByte, getUInt, getUShort, getUTF8Char, getUTF8String, getUTF8String, getUTF8String, getUTF8String, isReadonly, order, order, peer, peer, peer, peer, setByte, setByteArray, setByteBuffer, setDouble, setFloat, setInt, setLong, setShort, setShort0, setUByte, setUInt, setUShort, transferFrom, transferFrom, transferFrom, transferTo, transferTo, transferTo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JMemoryPacket(byte[] buffer)
buffer - buffer containing both state and data in the form
+--------------+-------------+ | packet state | packet data | +--------------+-------------+
public JMemoryPacket(java.nio.ByteBuffer buffer)
throws PeeringException
buffer - buffer containing both state and data in the form
+--------------+-------------+ | packet state | packet data | +--------------+-------------+
PeeringException - if there is a problem peering with the bufferpublic JMemoryPacket(int size)
size - number of bytes to pre allocate
public JMemoryPacket(int id,
byte[] buffer)
id - numerical id of first protocol (DLT)buffer - buffer containing raw packet data
public JMemoryPacket(int id,
java.nio.ByteBuffer buffer)
throws PeeringException
id - ID of the DLT protocolbuffer - buffer containing both state and data in the form
+--------------+-------------+ | packet state | packet data | +--------------+-------------+
PeeringException - the peering exception
public JMemoryPacket(int id,
JBuffer buffer)
id - numerical id of first protocol (DLT)buffer - buffer containing raw packet data
public JMemoryPacket(int id,
java.lang.String hexdump)
id - numerical id of first protocol (DLT)hexdump - hexdump of the packet contents which will loaded into the raw data
bufferpublic JMemoryPacket(JBuffer buffer)
buffer - buffer containing both state and data in the form
+--------------+-------------+ | packet state | packet data | +--------------+-------------+
public JMemoryPacket(JMemoryPacket packet)
packet - source packetpublic JMemoryPacket(JPacket packet)
packet - source packetpublic JMemoryPacket(JMemory.Type type)
type - type of memory model to use| Method Detail |
|---|
public JMemoryPacket.JMemoryHeader getCaptureHeader()
getCaptureHeader in class JPacketJPacket.getCaptureHeader()public int getTotalSize()
getTotalSize in class JPacketJPacket.getTotalSize()
public int peerStateAndData(java.nio.ByteBuffer buffer)
throws PeeringException
Supplied buffer layout expected:
+-----+----+ |State|Data| +-----+----+
buffer - Buffer containing packet header, state and data. Position property
specifies that start within the buffer where to peer the first
byte.
PeeringException - thrown if ByteBuffer is not direct byte buffer typepublic int peerStateAndData(JBuffer buffer)
Supplied buffer layout expected:
+-----+----+ |State|Data| +-----+----+
buffer - buffer containing packet header, state and data
public int peerStateAndData(JBuffer buffer,
int offset)
Supplied buffer layout expected:
+-----+----+ |State|Data| +-----+----+
buffer - buffer containing packet header, state and dataoffset - starting offset into the buffer
public void setWirelen(int wirelen)
wirelen - new wirelen for this packetpublic int transferStateAndDataFrom(byte[] buffer)
buffer - buffer containing both state and data in the form
+--------------+-------------+
| packet state | packet data |
+--------------+-------------+
public int transferStateAndDataFrom(java.nio.ByteBuffer buffer)
buffer - buffer containing both state and data in the form
+--------------+-------------+
| packet state | packet data |
+--------------+-------------+
public int transferStateAndDataFrom(JBuffer buffer)
buffer - buffer containing both state and data in the form
+--------------+-------------+
| packet state | packet data |
+--------------+-------------+
public int transferStateAndDataFrom(JMemoryPacket packet)
packet - source packet
public int transferStateAndDataFrom(JPacket packet)
packet - source packet
public int transferStateAndDataTo(JBuffer buffer,
int offset)
buffer - buffer containing both state and data in the form
+--------------+-------------+ | packet state | packet data | +--------------+-------------+
offset - the offset
getTotalSize(). If the buffer is
too small and a runtime exception may be thrown.
The buffer layout will look like the following:
+-----+----+ |State|Data| +-----+----+
public int transferStateAndDataTo(JMemoryPacket packet)
packet - destination packet
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||