- All Known Subinterfaces:
PcapStatEx
- All Known Implementing Classes:
PcapStatExRecord
,PcapStatRecord
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 withpcap_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()
anddrop()
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:
-
Method Summary
Modifier and TypeMethodDescriptionlong
capt()
Gets the number of packets captured.long
drop()
Gets the 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.long
ifdrop()
Gets the number of packets dropped by the network interface or its driver.long
netdrop()
Gets the number of packets dropped by the network.long
recv()
Gets the number of packets received.long
sent()
Gets the number of packets sent.
-
Method Details
-
capt
long capt()Gets the number of packets captured.- Returns:
- the number of packets captured
-
drop
long drop()Gets the 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.- Returns:
- the number of packets dropped
-
ifdrop
long ifdrop()Gets the number of packets dropped by the network interface or its driver.- Returns:
- the number of packets dropped by the network interface or its driver
-
netdrop
long netdrop()Gets the number of packets dropped by the network.- Returns:
- the number of packets dropped by the network
-
recv
long recv()Gets the number of packets received.- Returns:
- the number of packets received
-
sent
long sent()Gets the number of packets sent.- Returns:
- the number of packets sent
-