pcap_setdirection(3PCAP) man page
#include <pcap/pcap.h> int pcap_setdirection(pcap_t *p, pcap_direction_t d);
PCAP_D_INwill only capture packets received by the device,
PCAP_D_OUTwill only capture packets sent by the device and
PCAP_D_INOUTwill capture packets received by or sent by the device.
PCAP_D_INOUTis the default setting if this function is not called.
isn't necessarily fully supported on all platforms; some platforms might
return an error for all values, and some other platforms might not
This operation is not supported if a ``savefile'' is being read.
PCAP_ERROR_NOT_ACTIVATEDif called on a capture handle that has been created but not activated, or
PCAP_ERRORon other errors. If
PCAP_ERRORis returned, pcap_geterr(3PCAP) or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.