- All Implemented Interfaces:
AutoCloseable
PcapSendQueue
relies on preview features of the Java platform:
PcapSendQueue
refers to one or more preview APIs:MemorySegment
.
transmit
on Microsoft Windows platforms.- Author:
- Sly Technologies Inc, repos@slytechs.com, mark
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close and destroy the send queue.int
len()
The value of the {code pcap_sendqueue_t.len} structure field.int
maxlen()
The value of the {code pcap_sendqueue_t.maxlen} structure field.int
queue
(MemorySegmentPREVIEW header, MemorySegmentPREVIEW packet) Add a packet to a send queue.int
queue
(PcapHeader header, byte[] packet, int offset) Add a packet to a send queue.
-
Constructor Details
-
PcapSendQueue
public PcapSendQueue(int capacity) Instantiates a new pcap send queue.- Parameters:
capacity
- Maximum size of the queue, in bytes
-
-
Method Details
-
close
public void close()Close and destroy the send queue.- Specified by:
close
in interfaceAutoCloseable
- See Also:
-
queue
Add a packet to a send queue.pcap_sendqueue_queue() adds a packet at the end of the send queue pointed by the queue parameter. pkt_header points to a pcap_pkthdr structure with the timestamp and the length of the packet, pkt_data points to a buffer with the data of the packet.
The pcap_pkthdr structure is the same used by WinPcap and libpcap to store the packets in a file, therefore sending a capture file is straightforward. 'Raw packet' means that the sending application will have to include the protocol headers, since every packet is sent to the network 'as is'. The CRC of the packets needs not to be calculated, because it will be transparently added by the network interface.
- Parameters:
header
- the headerpacket
- the packet- Returns:
- the int
-
queue
Add a packet to a send queue.pcap_sendqueue_queue() adds a packet at the end of the send queue pointed by the queue parameter. pkt_header points to a pcap_pkthdr structure with the timestamp and the length of the packet, pkt_data points to a buffer with the data of the packet.
The pcap_pkthdr structure is the same used by WinPcap and libpcap to store the packets in a file, therefore sending a capture file is straightforward. 'Raw packet' means that the sending application will have to include the protocol headers, since every packet is sent to the network 'as is'. The CRC of the packets needs not to be calculated, because it will be transparently added by the network interface.
- Parameters:
header
- the headerpacket
- the packetoffset
- the offset- Returns:
- the int
-
maxlen
public int maxlen()The value of the {code pcap_sendqueue_t.maxlen} structure field.- Returns:
- the maxlen or capacity, in bytes, of this send queue
-
len
public int len()The value of the {code pcap_sendqueue_t.len} structure field.- Returns:
- the length or current size, in bytes, of this send queue
-
PcapSendQueue
when preview features are enabled.