Module org.jnetpcap
Package org.jnetpcap

Interface PcapStat

All Known Subinterfaces:
PcapStatEx
All Known Implementing Classes:
PcapStatExRecord, PcapStatRecord

public sealed interface PcapStat permits PcapStatRecord, PcapStatEx
Provides packet statistics from the start of the pcap run to the time of the call.

The PcapStat interface models the packet statistics similar to the struct pcap_stat in the libpcap library. The statistics include:

recv()
Number of packets received.
drop()
Number of packets dropped because there was no room in the operating system's buffer when they arrived, or because packets weren't being read fast enough.
ifdrop()
Number of packets dropped by the network interface or its driver.
netdrop()
Number of packets dropped by the network.
capt()
Number of packets captured.
sent()
Number of packets sent.

Note that the behavior of these statistics may vary across different platforms:

  • recv() might count all packets, whether they pass any filter set with pcap_setfilter(3PCAP) or not, or only those that pass the filter. It might also include packets dropped because there was no room in the operating system's buffer.
  • drop() is not available on all platforms and may return zero on platforms where it is not available. It might count packets that don't pass the filter if packet filtering is done in libpcap rather than the operating system.
  • Both recv() and drop() might include packets not yet read from the operating system and thus not yet seen by the application.
  • ifdrop() might not be implemented on all platforms; if it returns zero, it might indicate either that no packets were dropped by the interface or that the statistic is unavailable.

Implementations of this interface are provided by PcapStatRecord and PcapStatEx.

Since:
1.0
See Also: