PCAP_SETDIRECTION(3)
π pcap_setdirection(3) π
okay bestie, welcome to this page from the Library Functions Manual β weβre talking about pcap_setdirection, and yes, itβs lowkey iconic for telling libpcap which way packets should be flowing. π¦
πΈ NAME πΈ
pcap_setdirection β set the direction for which packets will be captured β¨
β¨ SYNOPSIS β¨
#include <pcap/pcap.h>
int pcap_setdirection(pcap_t *p, pcap_direction_t d);
π DESCRIPTION π
pcap_setdirection() is the function you call when you wanna specify a direction that packets will be captured. The d argument is one of these constants, and they are literally the whole vibe check for packet direction:
PCAP_D_INβ will only capture packets received by the device π«ΆPCAP_D_OUTβ will only capture packets sent by the device πPCAP_D_INOUTβ will capture packets received by or sent by the device π
And bestie, PCAP_D_INOUT is the default setting if this function is not called. no cap. π
Now, fair warning: pcap_setdirection() isnβt necessarily fully supported on all platforms. Some platforms might return an error for all values, and some other platforms might not support PCAP_D_OUT. itβs giving βplatform-dependent situationβ fr fr. π
Also, this operation is not supported if a ``savefile'' is being read. so donβt try it there, okay? π
π«Ά RETURN VALUE π«Ά
pcap_setdirection() returns 0 on success, PCAP_ERROR_NOT_ACTIVATED if called on a capture handle that has been created but not activated, or PCAP_ERROR on other errors. If PCAP_ERROR is returned, pcap_geterr(3) or pcap_perror(3) may be called with p as an argument to fetch or display the error text. π
π¦ SEE ALSO π¦
and thatβs the whole page, bestie β this cutie came from the Library Functions Manual, dated 5 March 2022, under PCAP_SETDIRECTION(3). slay. π
β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1994, 1996, 1997 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms