仅包括来自 libpcap 的必要函数
Include only the necessary functions from libpcap
我有一个使用 libpcap 功能的 C++ JNI 库(不是我自己编写的)。 libpcap 中实际使用的函数只有几个,但是当库被编译时,每个函数都会被包含进来。也许这是一面旗帜?我进行了搜索,但似乎找不到问题的答案。
老开发人员使用 BJAM 进行编译,我最近接到任务将其转换为 GNU Make。
这里是我编译的所有pcap符号:
00000000000197f0 T _pcap_activate
0000000000019d00 T _pcap_breakloop
0000000000019070 T _pcap_can_set_rfmon
0000000000019bb0 T _pcap_close
000000000001b560 T _pcap_compile
000000000001c180 T _pcap_compile_nopcap
00000000000192c0 T _pcap_create
0000000000019d10 T _pcap_datalink
0000000000019d30 T _pcap_datalink_ext
0000000000019ff0 T _pcap_datalink_name_to_val
000000000001a080 T _pcap_datalink_val_to_description
0000000000019f70 T _pcap_datalink_val_to_name
00000000000191c0 T _pcap_dispatch
000000000003b660 T _pcap_dump
000000000003bde0 T _pcap_dump_close
000000000003bda0 T _pcap_dump_file
000000000003bdc0 T _pcap_dump_flush
000000000003b8d0 T _pcap_dump_fopen
000000000003bdb0 T _pcap_dump_ftell
000000000003b6d0 T _pcap_dump_open
000000000003b940 T _pcap_dump_open_append
000000000003a650 T _pcap_ether_aton
000000000003a780 T _pcap_ether_hostton
000000000001a240 T _pcap_file
000000000001a250 T _pcap_fileno
0000000000019220 T _pcap_findalldevs
000000000003acd0 T _pcap_fopen_offline
000000000003a910 T _pcap_fopen_offline_with_tstamp_precision
0000000000019e20 T _pcap_free_datalinks
0000000000019140 T _pcap_free_tstamp_types
000000000001af60 T _pcap_freealldevs
000000000001c1f0 T _pcap_freecode
000000000001a260 T _pcap_get_selectable_fd
00000000000197e0 T _pcap_get_tstamp_precision
000000000001a2a0 T _pcap_geterr
000000000001a2b0 T _pcap_getnonblock
000000000001a760 T _pcap_inject
000000000001a1e0 T _pcap_is_swapped
000000000001a7a0 T _pcap_lib_version
0000000000019d50 T _pcap_list_datalinks
0000000000019080 T _pcap_list_tstamp_types
000000000001b010 T _pcap_lookupdev
000000000001b0a0 T _pcap_lookupnet
0000000000019c80 T _pcap_loop
000000000001a200 T _pcap_major_version
000000000001a220 T _pcap_minor_version
000000000003a150 T _pcap_nametoaddr
000000000003a1a0 T _pcap_nametoaddrinfo
000000000003a4c0 T _pcap_nametoeproto
000000000003a520 T _pcap_nametollc
000000000003a1f0 T _pcap_nametonetaddr
000000000003a210 T _pcap_nametoport
000000000003a2c0 T _pcap_nametoportrange
000000000003a4a0 T _pcap_nametoproto
0000000000019180 T _pcap_next
00000000000191d0 T _pcap_next_ex
000000000001a770 T _pcap_offline_filter
000000000001a6c0 T _pcap_open_dead
000000000001a5f0 T _pcap_open_dead_with_tstamp_precision
00000000000199a0 T _pcap_open_live
000000000003ab20 T _pcap_open_offline
000000000003a840 T _pcap_open_offline_with_tstamp_precision
000000000001a270 T _pcap_perror
000000000001a740 T _pcap_sendpacket
0000000000019720 T _pcap_set_buffer_size
0000000000019e30 T _pcap_set_datalink
00000000000196e0 T _pcap_set_immediate_mode
00000000000195a0 T _pcap_set_promisc
00000000000195e0 T _pcap_set_rfmon
0000000000019560 T _pcap_set_snaplen
0000000000019620 T _pcap_set_timeout
0000000000019760 T _pcap_set_tstamp_precision
0000000000019660 T _pcap_set_tstamp_type
000000000001a490 T _pcap_setdirection
000000000001a480 T _pcap_setfilter
000000000001a370 T _pcap_setnonblock
000000000001a1c0 T _pcap_snapshot
000000000001a4d0 T _pcap_stats
0000000000019940 T _pcap_statustostr
0000000000019130 T _pcap_strerror
000000000001a0c0 T _pcap_tstamp_type_name_to_val
000000000001a180 T _pcap_tstamp_type_val_to_description
000000000001a140 T _pcap_tstamp_type_val_to_name
这些是唯一应该包含的函数(BJAM 编译):
U _pcap_close
U _pcap_findalldevs
U _pcap_freealldevs
U _pcap_geterr
U _pcap_next
U _pcap_open_live
U _pcap_sendpacket
U _pcap_stats
编辑
我现在才注意到这些符号是未定义的...现在我很困惑。他们使用的是共享版本的 libpcap 吗?
编辑 2
file
在 make
库上的输出:
custompcap-1.2-r8581.jnilib: Mach-O universal binary with 2 architectures
custompcap-1.2-r8581.jnilib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
custompcap-1.2-r8581.jnilib (for architecture i386): Mach-O dynamically linked shared library i386
BJAM 库的输出:
target/x86_64-apple-darwin14.1.0/lib/custompcap.jnilib: Mach-O 64-bit dynamically linked shared library x86_64
编辑 3
这是链接器
c++ -stdlib=libstdc++ -lstdc++ -Wl,-single_module -install_name custompcap.jnilib -dynamiclib -o target/x86_64-apple-darwin14.1.0/lib/custompcap.jnilib target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNICapture.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNINetworkInterface.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNIcustomcap.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/HexDump.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/Timer.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/DataStream.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/frag/IPDefrag.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/frag/IPFrag.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/pcap/PcapInput.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/pcap/PcapOutput.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/IPPacket.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketBundle.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketDispatch.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Headers.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketRule.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/CIDR.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/BoyerMoore.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Piranha.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Packetcustomcap.o -L/Users/vdawn/src/3rdparty/pcap/libpcap/1.8.0-PRE-GIT/ -lpcap -lpcre -headerpad_max_install_names -Wl,-dead_strip -no_dead_strip_inits_and_terms -arch x86_64
谢谢
没有说明是什么命令构建了 BJAM 版本,如果您想像 BJAM 那样构建 Makefile,我可以提供的建议有严格的限制,因为我不知道 BJAM 做了什么。
但是,如果我们查看用于 Make 的命令,它并没有链接到 libpcap 的系统版本,而是链接到 tcpdump.org 的 master 分支的快照:
c++ ... -L/Users/vdawn/src/3rdparty/pcap/libpcap/1.8.0-PRE-GIT/ -lpcap ...
如果链接的是 libpcap 的静态版本,那么它将包含静态库中包含 JNI 库引用的符号的每个目标文件。
这意味着如果您使用,例如,pcap_open_live()
,它将包含定义它的目标文件。即pcap.o
,pcap.o
定义了以下符号:
U ___bzero
U ___error
U ___snprintf_chk
U ___stderrp
U ___strlcpy_chk
U _atexit
U _bpf_filter
U _calloc
000000000000c160 S _capture_source_types
0000000000008ed0 s _charmap
U _close
000000000000c18a b _did_atexit
0000000000009000 s _dlt_choices
U _fcntl
U _fprintf
U _free
U _malloc
U _memcpy
00000000000007e0 T _pcap_activate
00000000000017e0 T _pcap_add_to_pcaps_to_close
0000000000000440 t _pcap_alloc_pcap_t
0000000000000cd0 T _pcap_breakloop
0000000000000000 T _pcap_can_set_rfmon
00000000000004e0 t _pcap_cant_set_rfmon
0000000000000530 T _pcap_check_activated
00000000000019d0 t _pcap_cleanup_dead
0000000000001850 T _pcap_cleanup_live_common
0000000000000b80 T _pcap_close
0000000000001790 t _pcap_close_all
0000000000000250 T _pcap_create
00000000000002d0 T _pcap_create_common
U _pcap_create_interface
0000000000000ce0 T _pcap_datalink
0000000000000d00 T _pcap_datalink_ext
0000000000001000 T _pcap_datalink_name_to_val
0000000000001070 T _pcap_datalink_val_to_description
0000000000000f60 T _pcap_datalink_val_to_name
U _pcap_debug
0000000000000150 T _pcap_dispatch
0000000000001730 T _pcap_do_addexit
0000000000001490 T _pcap_file
00000000000014a0 T _pcap_fileno
00000000000001b0 T _pcap_findalldevs
U _pcap_findalldevs_interfaces
0000000000000df0 T _pcap_free_datalinks
00000000000000d0 T _pcap_free_tstamp_types
U _pcap_freealldevs
U _pcap_freecode
00000000000014b0 T _pcap_get_selectable_fd
00000000000007d0 T _pcap_get_tstamp_precision
00000000000014f0 T _pcap_geterr
0000000000001500 T _pcap_getnonblock
0000000000001550 T _pcap_getnonblock_fd
0000000000001a80 T _pcap_inject
0000000000001430 T _pcap_is_swapped
0000000000001ac0 T _pcap_lib_version
0000000000000d20 T _pcap_list_datalinks
0000000000000010 T _pcap_list_tstamp_types
0000000000000c50 T _pcap_loop
0000000000001450 T _pcap_major_version
0000000000001470 T _pcap_minor_version
0000000000000110 T _pcap_next
0000000000000160 T _pcap_next_ex
0000000000001af0 t _pcap_not_initialized
0000000000001a90 T _pcap_offline_filter
U _pcap_offline_read
00000000000000e0 T _pcap_oneshot
00000000000019e0 T _pcap_open_dead
0000000000001910 T _pcap_open_dead_with_tstamp_precision
0000000000000990 T _pcap_open_live
0000000000000bc0 T _pcap_open_offline_common
U _pcap_optimizer_debug
00000000000014c0 T _pcap_perror
U _pcap_platform_finddevs
0000000000001800 T _pcap_remove_from_pcaps_to_close
0000000000001a60 T _pcap_sendpacket
0000000000000700 T _pcap_set_buffer_size
0000000000000e00 T _pcap_set_datalink
00000000000006c0 T _pcap_set_immediate_mode
0000000000001ae0 T _pcap_set_optimizer_debug
0000000000001ad0 T _pcap_set_parser_debug
0000000000000570 T _pcap_set_promisc
00000000000005b0 T _pcap_set_rfmon
00000000000004f0 T _pcap_set_snaplen
00000000000005f0 T _pcap_set_timeout
0000000000000740 T _pcap_set_tstamp_precision
0000000000000630 T _pcap_set_tstamp_type
00000000000016e0 T _pcap_setdirection
00000000000016d0 T _pcap_setfilter
00000000000015c0 T _pcap_setnonblock
0000000000001610 T _pcap_setnonblock_fd
0000000000001410 T _pcap_snapshot
0000000000001720 T _pcap_stats
00000000000019a0 t _pcap_stats_dead
0000000000000930 T _pcap_statustostr
000000000000c170 b _pcap_statustostr.ebuf
0000000000000fc0 T _pcap_strcasecmp
00000000000000c0 T _pcap_strerror
00000000000010c0 T _pcap_tstamp_type_name_to_val
00000000000013c0 T _pcap_tstamp_type_val_to_description
0000000000001370 T _pcap_tstamp_type_val_to_name
0000000000008fd0 s _pcap_version_string
000000000000c190 b _pcaps_to_close
U _strdup
U _strerror
U _strncpy
0000000000009ba0 s _tstamp_type_choices
0000000000009c30 s l_switch.table
所以您将在您的库中获取该列表中的所有 "T" 符号,除了显着破解 libpcap 源代码以将不同的符号放入不同的文件之外,您无能为力.
现在,如果您针对 shared 版本的 libpcap 进行构建,您将不会获得这些符号中的 any - 您将获取一个动态链接的 JNI 库,该库将在加载时附加到 libpcap 的共享版本并从那里获取符号。
那 可能是旧版 BJAM 所做的。如果您不需要自 1.5.3 版本以来添加到 libpcap 的任何 API(Apple 目前停留在 1.5.3;我希望,一旦我向标准版本添加更多 pcapng 支持和 PKTAP 支持,我可以让他们选择更新的版本),你最好链接 libpcap 的系统版本而不是来自 tcpdump.org 的快照(请注意名称中带有 "PRE-GIT" 的任何内容都是发布时如有更改,恕不另行通知 - 它仍然与 1.7.x 兼容,但不 保证与早期的 1.8.0-PRE 兼容-GIT 个版本)。
(您还在 Make 构建中获得了 JNI 库的 "fat" 版本,同时包含 IA-32 和 x86-64 代码,这也使其比 BJAM 版本更大。)
我有一个使用 libpcap 功能的 C++ JNI 库(不是我自己编写的)。 libpcap 中实际使用的函数只有几个,但是当库被编译时,每个函数都会被包含进来。也许这是一面旗帜?我进行了搜索,但似乎找不到问题的答案。
老开发人员使用 BJAM 进行编译,我最近接到任务将其转换为 GNU Make。
这里是我编译的所有pcap符号:
00000000000197f0 T _pcap_activate
0000000000019d00 T _pcap_breakloop
0000000000019070 T _pcap_can_set_rfmon
0000000000019bb0 T _pcap_close
000000000001b560 T _pcap_compile
000000000001c180 T _pcap_compile_nopcap
00000000000192c0 T _pcap_create
0000000000019d10 T _pcap_datalink
0000000000019d30 T _pcap_datalink_ext
0000000000019ff0 T _pcap_datalink_name_to_val
000000000001a080 T _pcap_datalink_val_to_description
0000000000019f70 T _pcap_datalink_val_to_name
00000000000191c0 T _pcap_dispatch
000000000003b660 T _pcap_dump
000000000003bde0 T _pcap_dump_close
000000000003bda0 T _pcap_dump_file
000000000003bdc0 T _pcap_dump_flush
000000000003b8d0 T _pcap_dump_fopen
000000000003bdb0 T _pcap_dump_ftell
000000000003b6d0 T _pcap_dump_open
000000000003b940 T _pcap_dump_open_append
000000000003a650 T _pcap_ether_aton
000000000003a780 T _pcap_ether_hostton
000000000001a240 T _pcap_file
000000000001a250 T _pcap_fileno
0000000000019220 T _pcap_findalldevs
000000000003acd0 T _pcap_fopen_offline
000000000003a910 T _pcap_fopen_offline_with_tstamp_precision
0000000000019e20 T _pcap_free_datalinks
0000000000019140 T _pcap_free_tstamp_types
000000000001af60 T _pcap_freealldevs
000000000001c1f0 T _pcap_freecode
000000000001a260 T _pcap_get_selectable_fd
00000000000197e0 T _pcap_get_tstamp_precision
000000000001a2a0 T _pcap_geterr
000000000001a2b0 T _pcap_getnonblock
000000000001a760 T _pcap_inject
000000000001a1e0 T _pcap_is_swapped
000000000001a7a0 T _pcap_lib_version
0000000000019d50 T _pcap_list_datalinks
0000000000019080 T _pcap_list_tstamp_types
000000000001b010 T _pcap_lookupdev
000000000001b0a0 T _pcap_lookupnet
0000000000019c80 T _pcap_loop
000000000001a200 T _pcap_major_version
000000000001a220 T _pcap_minor_version
000000000003a150 T _pcap_nametoaddr
000000000003a1a0 T _pcap_nametoaddrinfo
000000000003a4c0 T _pcap_nametoeproto
000000000003a520 T _pcap_nametollc
000000000003a1f0 T _pcap_nametonetaddr
000000000003a210 T _pcap_nametoport
000000000003a2c0 T _pcap_nametoportrange
000000000003a4a0 T _pcap_nametoproto
0000000000019180 T _pcap_next
00000000000191d0 T _pcap_next_ex
000000000001a770 T _pcap_offline_filter
000000000001a6c0 T _pcap_open_dead
000000000001a5f0 T _pcap_open_dead_with_tstamp_precision
00000000000199a0 T _pcap_open_live
000000000003ab20 T _pcap_open_offline
000000000003a840 T _pcap_open_offline_with_tstamp_precision
000000000001a270 T _pcap_perror
000000000001a740 T _pcap_sendpacket
0000000000019720 T _pcap_set_buffer_size
0000000000019e30 T _pcap_set_datalink
00000000000196e0 T _pcap_set_immediate_mode
00000000000195a0 T _pcap_set_promisc
00000000000195e0 T _pcap_set_rfmon
0000000000019560 T _pcap_set_snaplen
0000000000019620 T _pcap_set_timeout
0000000000019760 T _pcap_set_tstamp_precision
0000000000019660 T _pcap_set_tstamp_type
000000000001a490 T _pcap_setdirection
000000000001a480 T _pcap_setfilter
000000000001a370 T _pcap_setnonblock
000000000001a1c0 T _pcap_snapshot
000000000001a4d0 T _pcap_stats
0000000000019940 T _pcap_statustostr
0000000000019130 T _pcap_strerror
000000000001a0c0 T _pcap_tstamp_type_name_to_val
000000000001a180 T _pcap_tstamp_type_val_to_description
000000000001a140 T _pcap_tstamp_type_val_to_name
这些是唯一应该包含的函数(BJAM 编译):
U _pcap_close
U _pcap_findalldevs
U _pcap_freealldevs
U _pcap_geterr
U _pcap_next
U _pcap_open_live
U _pcap_sendpacket
U _pcap_stats
编辑
我现在才注意到这些符号是未定义的...现在我很困惑。他们使用的是共享版本的 libpcap 吗?
编辑 2
file
在 make
库上的输出:
custompcap-1.2-r8581.jnilib: Mach-O universal binary with 2 architectures
custompcap-1.2-r8581.jnilib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
custompcap-1.2-r8581.jnilib (for architecture i386): Mach-O dynamically linked shared library i386
BJAM 库的输出:
target/x86_64-apple-darwin14.1.0/lib/custompcap.jnilib: Mach-O 64-bit dynamically linked shared library x86_64
编辑 3
这是链接器
c++ -stdlib=libstdc++ -lstdc++ -Wl,-single_module -install_name custompcap.jnilib -dynamiclib -o target/x86_64-apple-darwin14.1.0/lib/custompcap.jnilib target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNICapture.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNINetworkInterface.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNIcustomcap.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/HexDump.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/Timer.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/DataStream.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/frag/IPDefrag.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/frag/IPFrag.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/pcap/PcapInput.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/pcap/PcapOutput.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/IPPacket.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketBundle.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketDispatch.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Headers.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketRule.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/CIDR.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/BoyerMoore.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Piranha.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Packetcustomcap.o -L/Users/vdawn/src/3rdparty/pcap/libpcap/1.8.0-PRE-GIT/ -lpcap -lpcre -headerpad_max_install_names -Wl,-dead_strip -no_dead_strip_inits_and_terms -arch x86_64
谢谢
没有说明是什么命令构建了 BJAM 版本,如果您想像 BJAM 那样构建 Makefile,我可以提供的建议有严格的限制,因为我不知道 BJAM 做了什么。
但是,如果我们查看用于 Make 的命令,它并没有链接到 libpcap 的系统版本,而是链接到 tcpdump.org 的 master 分支的快照:
c++ ... -L/Users/vdawn/src/3rdparty/pcap/libpcap/1.8.0-PRE-GIT/ -lpcap ...
如果链接的是 libpcap 的静态版本,那么它将包含静态库中包含 JNI 库引用的符号的每个目标文件。
这意味着如果您使用,例如,pcap_open_live()
,它将包含定义它的目标文件。即pcap.o
,pcap.o
定义了以下符号:
U ___bzero
U ___error
U ___snprintf_chk
U ___stderrp
U ___strlcpy_chk
U _atexit
U _bpf_filter
U _calloc
000000000000c160 S _capture_source_types
0000000000008ed0 s _charmap
U _close
000000000000c18a b _did_atexit
0000000000009000 s _dlt_choices
U _fcntl
U _fprintf
U _free
U _malloc
U _memcpy
00000000000007e0 T _pcap_activate
00000000000017e0 T _pcap_add_to_pcaps_to_close
0000000000000440 t _pcap_alloc_pcap_t
0000000000000cd0 T _pcap_breakloop
0000000000000000 T _pcap_can_set_rfmon
00000000000004e0 t _pcap_cant_set_rfmon
0000000000000530 T _pcap_check_activated
00000000000019d0 t _pcap_cleanup_dead
0000000000001850 T _pcap_cleanup_live_common
0000000000000b80 T _pcap_close
0000000000001790 t _pcap_close_all
0000000000000250 T _pcap_create
00000000000002d0 T _pcap_create_common
U _pcap_create_interface
0000000000000ce0 T _pcap_datalink
0000000000000d00 T _pcap_datalink_ext
0000000000001000 T _pcap_datalink_name_to_val
0000000000001070 T _pcap_datalink_val_to_description
0000000000000f60 T _pcap_datalink_val_to_name
U _pcap_debug
0000000000000150 T _pcap_dispatch
0000000000001730 T _pcap_do_addexit
0000000000001490 T _pcap_file
00000000000014a0 T _pcap_fileno
00000000000001b0 T _pcap_findalldevs
U _pcap_findalldevs_interfaces
0000000000000df0 T _pcap_free_datalinks
00000000000000d0 T _pcap_free_tstamp_types
U _pcap_freealldevs
U _pcap_freecode
00000000000014b0 T _pcap_get_selectable_fd
00000000000007d0 T _pcap_get_tstamp_precision
00000000000014f0 T _pcap_geterr
0000000000001500 T _pcap_getnonblock
0000000000001550 T _pcap_getnonblock_fd
0000000000001a80 T _pcap_inject
0000000000001430 T _pcap_is_swapped
0000000000001ac0 T _pcap_lib_version
0000000000000d20 T _pcap_list_datalinks
0000000000000010 T _pcap_list_tstamp_types
0000000000000c50 T _pcap_loop
0000000000001450 T _pcap_major_version
0000000000001470 T _pcap_minor_version
0000000000000110 T _pcap_next
0000000000000160 T _pcap_next_ex
0000000000001af0 t _pcap_not_initialized
0000000000001a90 T _pcap_offline_filter
U _pcap_offline_read
00000000000000e0 T _pcap_oneshot
00000000000019e0 T _pcap_open_dead
0000000000001910 T _pcap_open_dead_with_tstamp_precision
0000000000000990 T _pcap_open_live
0000000000000bc0 T _pcap_open_offline_common
U _pcap_optimizer_debug
00000000000014c0 T _pcap_perror
U _pcap_platform_finddevs
0000000000001800 T _pcap_remove_from_pcaps_to_close
0000000000001a60 T _pcap_sendpacket
0000000000000700 T _pcap_set_buffer_size
0000000000000e00 T _pcap_set_datalink
00000000000006c0 T _pcap_set_immediate_mode
0000000000001ae0 T _pcap_set_optimizer_debug
0000000000001ad0 T _pcap_set_parser_debug
0000000000000570 T _pcap_set_promisc
00000000000005b0 T _pcap_set_rfmon
00000000000004f0 T _pcap_set_snaplen
00000000000005f0 T _pcap_set_timeout
0000000000000740 T _pcap_set_tstamp_precision
0000000000000630 T _pcap_set_tstamp_type
00000000000016e0 T _pcap_setdirection
00000000000016d0 T _pcap_setfilter
00000000000015c0 T _pcap_setnonblock
0000000000001610 T _pcap_setnonblock_fd
0000000000001410 T _pcap_snapshot
0000000000001720 T _pcap_stats
00000000000019a0 t _pcap_stats_dead
0000000000000930 T _pcap_statustostr
000000000000c170 b _pcap_statustostr.ebuf
0000000000000fc0 T _pcap_strcasecmp
00000000000000c0 T _pcap_strerror
00000000000010c0 T _pcap_tstamp_type_name_to_val
00000000000013c0 T _pcap_tstamp_type_val_to_description
0000000000001370 T _pcap_tstamp_type_val_to_name
0000000000008fd0 s _pcap_version_string
000000000000c190 b _pcaps_to_close
U _strdup
U _strerror
U _strncpy
0000000000009ba0 s _tstamp_type_choices
0000000000009c30 s l_switch.table
所以您将在您的库中获取该列表中的所有 "T" 符号,除了显着破解 libpcap 源代码以将不同的符号放入不同的文件之外,您无能为力.
现在,如果您针对 shared 版本的 libpcap 进行构建,您将不会获得这些符号中的 any - 您将获取一个动态链接的 JNI 库,该库将在加载时附加到 libpcap 的共享版本并从那里获取符号。
那 可能是旧版 BJAM 所做的。如果您不需要自 1.5.3 版本以来添加到 libpcap 的任何 API(Apple 目前停留在 1.5.3;我希望,一旦我向标准版本添加更多 pcapng 支持和 PKTAP 支持,我可以让他们选择更新的版本),你最好链接 libpcap 的系统版本而不是来自 tcpdump.org 的快照(请注意名称中带有 "PRE-GIT" 的任何内容都是发布时如有更改,恕不另行通知 - 它仍然与 1.7.x 兼容,但不 保证与早期的 1.8.0-PRE 兼容-GIT 个版本)。
(您还在 Make 构建中获得了 JNI 库的 "fat" 版本,同时包含 IA-32 和 x86-64 代码,这也使其比 BJAM 版本更大。)