pcap_create(3pcap)

pcap_create3pcap

Create a live capture handle

Usage

#include <pcap/pcap.h>
char errbuf[PCAP_ERRBUF_SIZE];

pcap_t *pcap_create(const char *source, char *errbuf);

Overview

pcap_create() is used to create a packet capture handle to look at packets on the network. source is a string that specifies the network device to open; on Linux systems with 2.2 or later kernels, a source argument of "any" or NULL can be used to capture packets from all interfaces.

The returned handle must be activated with pcap_activate(3PCAP) before packets can be captured with it; options for the capture, such as promiscuous mode, can be set on the handle before activating it.

Return value

pcap_create() returns a pcap_t * on success and NULL on failure. If NULL is returned, errbuf is filled in with an appropriate error message. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.

Releases

90 releases since Mac OS X 10.6; the text changed 6 times.

  1. 10.6–10.6.8
  2. 10.7–10.8.5
  3. 10.9–10.11.6
  4. 10.12–10.14.6
  5. 10.15–10.15.1
  6. 10.15.2–12.5
  7. 13.0–26.5

From libpcap 146 in macOS 26.5. Parsed by carta from the page's man source.