pcap_findalldevs() 定义在哪个文件和行号中?
pcap_findalldevs() 定义在哪个文件和行号中?我正在 libpcap 源代码中查找定义 pcap_findalldevs() 的位置。我在 pcap.h 中找到了原型,但是完整的功能在哪里定义的?
What file and line number is pcap_findalldevs() defined in?. I am looking in the libpcap source for the place where pcap_findalldevs() is defined. I found the prototype in pcap.h but where is the complete functionality defined?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
让我们看看:
看来我的幸运日!
这里是这个函数的完整源代码:
那么,你的问题的答案是:fad-sita.c!
Let's see:
Seems my lucky day !
Here complete source code of this function:
Then, the answer of your question is: fad-sita.c !
它在多个地方定义,因为它的完成方式取决于您运行的操作系统。在装有 WinPcap 的 Windows 上,它在
fad-win32.c
中定义;在具有getifaddrs()
的 UN*Xes 上,它在fad-getad.c
中定义;在 Solaris 8 或更高版本上,它在fad-glfc.c
中定义;在其他支持本地接口数据包捕获的 UN*Xes 上,它在 fad-gifc.c 中定义;在根本不支持数据包捕获的 UN*Xes 上,它在fad-null.c
中定义(不返回任何接口);并且,如果配置和构建 libpcap 的人碰巧配置了支持从 SITA 提供的远程设备捕获,则它被定义在fad-sita.c
中。(是的,另一个答案是错误的;他们不应该假设我们这些在 libpcap 中编写代码的人都喜欢将函数的左大括号与函数名称放在同一行 - 我不这样做,并且不会,那就这么做吧。)
It's defined in several places, because the way it's done depends on the OS on which you're running. On Windows with WinPcap, it's defined in
fad-win32.c
; on UN*Xes that havegetifaddrs()
, it's defined infad-getad.c
; on Solaris 8 or later, it's defined infad-glifc.c
; on other UN*Xes that support packet capture on local interfaces, it's defined infad-gifc.c
; on UN*Xes that don't support packet capture at all, it's defined (to return no interfaces) infad-null.c
; and, if whoever configured and built libpcap happened to configure in support for capturing from remote devices provided by SITA, it's defined infad-sita.c
.(Yes, the other answer is wrong; they should not have assumed that those of us who write code in libpcap all like putting the opening curly brace of a function on the same line as the name of the function - I don't, and won't, do that.)