[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


pcap_stats Subroutine

Purpose

Obtains packet capture statistics.

Library

pcap Library (libpcap.a)

Syntax


#include <pcap.h>


int pcap_stats(pcap_t *p (Return Values), struct pcap_stat *ps (Related Information));

Description

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.

Parameters


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.

Return Values

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.

Related Information

The pcap_geterr (pcap_geterr Subroutine) subroutine, pcap_open_live (pcap_open_live Subroutine) subroutine, pcap_perror (pcap_perror Subroutine) subroutine.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]