Obtains packet capture statistics.
pcap Library (libpcap.a)
#include<pcap.h> int pcap_stats (pcap_t *p, struct pcap_stat *ps);
The pcap_stats subroutine fills in a pcap_stat struct. The values represent packet statistics from the start of the run to the time of the call. Statistics for both packets that are received by the filter and packets that are dropped are stored inside a pcap_stat struct. This subroutine is for use when a packet capture device is opened using the pcap_open_live subroutine.
Item | Description |
---|---|
p | Points to a packet capture descriptor as returned by the pcap_open_live subroutine. |
ps | Points to the pcap_stat struct that will be filled in with the packet capture statistics. |
On successful completion, the pcap_stats subroutine fills in ps and returns 0. If the pcap_stats subroutine is unsuccessful, -1 is returned. In this case, the error text can be obtained with the pcap_perror subroutine or the pcap_geterr subroutine.