1PCAP_SETDIRECTION(3PCAP) PCAP_SETDIRECTION(3PCAP)
2
3
4
6 pcap_setdirection - set the direction for which packets will be cap‐
7 tured
8
10 #include <pcap/pcap.h>
11
12 int pcap_setdirection(pcap_t *p, pcap_direction_t d);
13
15 pcap_setdirection() is used to specify a direction that packets will be
16 captured. d is one of the constants PCAP_D_IN, PCAP_D_OUT or
17 PCAP_D_INOUT. PCAP_D_IN will only capture packets received by the de‐
18 vice, PCAP_D_OUT will only capture packets sent by the device and
19 PCAP_D_INOUT will capture packets received by or sent by the device.
20 PCAP_D_INOUT is the default setting if this function is not called.
21
22 pcap_setdirection() isn't necessarily fully supported on all platforms;
23 some platforms might return an error for all values, and some other
24 platforms might not support PCAP_D_OUT.
25
26 This operation is not supported if a ``savefile'' is being read.
27
29 pcap_setdirection() returns 0 on success, PCAP_ERROR_NOT_ACTIVATED if
30 called on a capture handle that has been created but not activated, or
31 PCAP_ERROR on other errors. If PCAP_ERROR is returned,
32 pcap_geterr(3PCAP) or pcap_perror(3PCAP) may be called with p as an ar‐
33 gument to fetch or display the error text.
34
36 pcap(3PCAP)
37
38
39
40 5 March 2022 PCAP_SETDIRECTION(3PCAP)