1PCAP_ACTIVATE(3PCAP) PCAP_ACTIVATE(3PCAP)
2
3
4
6 pcap_activate - activate a capture handle
7
9 #include <pcap/pcap.h>
10
11 int pcap_activate(pcap_t *p);
12
14 pcap_activate() is used to activate a packet capture handle to look at
15 packets on the network, with the options that were set on the handle
16 being in effect.
17
19 pcap_activate() returns 0 on success without warnings, a non-zero posi‐
20 tive value on success with warnings, and a negative value on error. A
21 non-zero return value indicates what warning or error condition
22 occurred.
23
24 The possible warning values are:
25
26 PCAP_WARNING_PROMISC_NOTSUP
27 Promiscuous mode was requested, but the capture source doesn't
28 support promiscuous mode.
29
30 PCAP_WARNING_TSTAMP_TYPE_NOTSUP
31 The time stamp type specified in a previous
32 pcap_set_tstamp_type(3PCAP) call isn't supported by the capture
33 source (the time stamp type is left as the default),
34
35 PCAP_WARNING
36 Another warning condition occurred; pcap_geterr(3PCAP) or
37 pcap_perror(3PCAP) may be called with p as an argument to fetch
38 or display a message describing the warning condition.
39
40 The possible error values are:
41
42 PCAP_ERROR_ACTIVATED
43 The handle has already been activated.
44
45 PCAP_ERROR_NO_SUCH_DEVICE
46 The capture source specified when the handle was created doesn't
47 exist.
48
49 PCAP_ERROR_PERM_DENIED
50 The process doesn't have permission to open the capture source.
51
52 PCAP_ERROR_PROMISC_PERM_DENIED
53 The process has permission to open the capture source but
54 doesn't have permission to put it into promiscuous mode.
55
56 PCAP_ERROR_RFMON_NOTSUP
57 Monitor mode was specified but the capture source doesn't sup‐
58 port monitor mode.
59
60 PCAP_ERROR_IFACE_NOT_UP
61 The capture source device is not up.
62
63 PCAP_ERROR
64 Another error occurred. pcap_geterr() or pcap_perror() may be
65 called with p as an argument to fetch or display a message
66 describing the error.
67
68 If PCAP_WARNING_PROMISC_NOTSUP, PCAP_ERROR_NO_SUCH_DEVICE, or
69 PCAP_ERROR_PERM_DENIED is returned, pcap_geterr() or pcap_perror() may
70 be called with p as an argument to fetch or display an message giving
71 additional details about the problem that might be useful for debugging
72 the problem if it's unexpected.
73
74 Additional warning and error codes may be added in the future; a pro‐
75 gram should check for positive, negative, and zero return codes, and
76 treat all positive return codes as warnings and all negative return
77 codes as errors. pcap_statustostr(3PCAP) can be called, with a warning
78 or error code as an argument, to fetch a message describing the warning
79 or error code.
80
81 If pcap_activate() fails, the pcap_t * is not closed and freed; it
82 should be closed using pcap_close().
83
85 pcap(3PCAP)
86
87
88
89 24 November 2019 PCAP_ACTIVATE(3PCAP)