PCAP_SETDIRECTION(3PCAP)
π NAME π
okay so this is pcap_setdirection β the libpcap 3 section bestie that sets the direction for which packets will be captured. that's it, that's the whole vibe. no cap.
β¨ SYNOPSIS β¨
#include <pcap/pcap.h>
int pcap_setdirection(pcap_t *p, pcap_direction_t d);
π¦ DESCRIPTION π¦
so like, pcap_setdirection() is the function you call when you want to be picky about which way packets are going, bestie. it's used to specify a direction that packets will be captured. d is one of the constants PCAP_D_IN, PCAP_D_OUT or PCAP_D_INOUT. let me break those down for you, periodt:
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 π
PCAP_D_INOUT is the default setting if this function is not called. so if you just... don't call it? congrats, you already have the both-ways icon behavior. main character default energy. π
β οΈ okay so here's the tea: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 supportPCAP_D_OUT. so like... vibe check your platform first, ngl.
π and one more thing β this operation is not supported if a ``savefile'' is being read. literally do not even try it, it's giving undefined territory.
π 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 (bestie you gotta activate it first, it's like turning the key before you drive π), or PCAP_ERROR on other errors.
if PCAP_ERROR is returned, pcap_geterr(3PCAP) or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text. so you can actually find out what went wrong instead of just screaming into the void π«Ά
π₯ SEE ALSO π₯
pcap(3PCAP)β the mothership, go read it, iykwim π
that's a wrap, bestie!! β¨ this lil page came from the pcap_setdirection manual, 3PCAP section, dated 5 March 2022 β slay, iconic, no notes π ππ¦
π¦ where this page comes from
- alpine 3.22: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- alpine 3.23: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- alpine 3.24: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- centos-stream 10: libpcap-devel 14:1.10.4-8.el10 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- debian bookworm: libpcap0.8-dev 1.10.3-1
- debian trixie: libpcap0.8-dev 1.10.5-2
- fedora 43: libpcap-devel 14:1.10.5-3.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.5-3.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.7-1.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.7-1.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.6-2.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.6-2.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.7-1.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.7-1.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- nixos 26.05: libpcap 1.10.7
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- ubuntu noble: libpcap0.8-dev 1.10.4-4.1ubuntu3
- ubuntu noble: libpcap0.8-dev 1.10.4-4.1ubuntu3.1
- ubuntu questing: libpcap0.8-dev 1.10.5-2ubuntu2
- ubuntu resolute: libpcap0.8-dev 1.10.6-1ubuntu1 Β· BSD-3-clause-var3
- ubuntu resolute: libpcap0.8-dev 1.10.6-1ubuntu1.1 Β· BSD-3-clause-var3
- ubuntu stonking: libpcap0.8-dev 1.10.7-1ubuntu1 Β· BSD-3-clause-var3
- 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