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
18 device, 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 and -1 on failure. If -1 is
30 returned, pcap_geterr() or pcap_perror() may be called with p as an
31 argument to fetch or display the error text.
32
34 pcap(3PCAP), pcap_geterr(3PCAP)
35
36
37
38 5 April 2008 PCAP_SETDIRECTION(3PCAP)