1PCAP_SET_PROTOCOL_LINUX(3PCAP)                  PCAP_SET_PROTOCOL_LINUX(3PCAP)
2
3
4

NAME

6       pcap_set_protocol_linux  - set capture protocol for a not-yet-activated
7       capture handle
8

SYNOPSIS

10       #include <pcap/pcap.h>
11
12       int pcap_set_protocol_linux(pcap_t *p, int protocol);
13

DESCRIPTION

15       On network interface devices on Linux,  pcap_set_protocol_linux()  sets
16       the  protocol  to  be  used  in  the socket(2) call to create a capture
17       socket when the handle is activated.  The argument is a link-layer pro‐
18       tocol  value, such as the values in the <linux/if_ether.h> header file,
19       specified in host byte order.  If protocol is non-zero, packets of that
20       protocol  will be captured when the handle is activated, otherwise, all
21       packets will be captured.  This function is  only  provided  on  Linux,
22       and,  if  it  is  used on any device other than a network interface, it
23       will have no effect.
24
25       It should not be used in portable code; instead,  a  filter  should  be
26       specified with pcap_setfilter(3PCAP).
27
28       If  a  given  network  interface provides a standard link-layer header,
29       with a standard packet type, but provides some packet types with a dif‐
30       ferent  socket-layer  protocol  type  from  the  one  in the link-layer
31       header, that packet type cannot be filtered  with  a  filter  specified
32       with  pcap_setfilter()  but  can  be filtered by specifying the socket-
33       layer protocol type using pcap_set_protocol_linux().
34

RETURN VALUE

36       pcap_set_protocol_linux() returns 0 on success or  PCAP_ERROR_ACTIVATED
37       if called on a capture handle that has been activated.
38

BACKWARD COMPATIBILITY

40       This function became available in libpcap release 1.9.0.
41

SEE ALSO

43       pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP)
44
45
46
47                                22 August 2018  PCAP_SET_PROTOCOL_LINUX(3PCAP)
Impressum