AF_PACKET equivalent under Mac OS X (Darwin)

自闭症网瘾萝莉.ら 提交于 2019-12-23 07:31:07

问题


I am trying to compile a C program on Mac OS X that uses AF_PACKET sockets and libpcap, what is the equivalent in OS X?


回答1:


The closest equivalent to AF_PACKET sockets in Mac OS X (and in other BSD-flavored OSes, such as FreeBSD, NetBSD, OpenBSD, Dragonfly BSD, and so on) is BPF, but it doesn't work very much like AF_PACKET sockets; see "man bpf".

The exact equivalent to libpcap in Mac OS X (and in other BSD-flavored UN*Xes) is, well, libpcap. (libpcap is also the exact equivalent to libpcap in many other UN*Xes, but it doesn't ship as a standard part of all of those UN*Xes, whereas it does ship as a standard part of Mac OS X and the other BSD-flavored UN*Xes.)



来源:https://stackoverflow.com/questions/7284853/af-packet-equivalent-under-mac-os-x-darwin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!