On Jan 1, 2016, at 6:11 AM, Yang Luo <hsluoyb@xxxxxxxxx> wrote:
> So I think a suitable modification would be adding check_function_exists( "pcap_create" HAVE_PCAP_CREATE ) to Win32 too, as below:
> if( WIN32 )
> #
> # This is always the case with WinPcap.
> #
> check_function_exists( "pcap_create" HAVE_PCAP_CREATE ) <----------------- add this
> set(CAN_SET_CAPTURE_BUFFER_SIZE TRUE)
> else()
> check_function_exists( "pcap_create" HAVE_PCAP_CREATE )
> if ( HAVE_PCAP_CREATE )
> #
> # For libpcap, we can set the buffer size if we have pcap_create().
> #
> set( CAN_SET_CAPTURE_BUFFER_SIZE TRUE )
> endif()
> endif()
No, just move
check_function_exists( "pcap_create" HAVE_PCAP_CREATE )
above the if (WIN32) - and combine the two tests:
check_function_exists( "pcap_create" HAVE_PCAP_CREATE )
if( HAVE_PCAP_CREATE OR WIN32 )
#
# If we have pcap_create(), we have pcap_set_buffer_size(), and
# can set the capture buffer size.
#
# Otherwise, if this is Windows, we have pcap_setbuff(), and can
# set the capture buffer size.
#
set( CAN_SET_CAPTURE_BUFFER_SIZE TRUE )
endif()
> As WinPcap always has pcap_create function,
Versions of prior to 4.1 WinPcap don't have it, so if somebody has an earlier version's developer kit installed, that test won't find pcap_create().
> In Wireshark the monitor UI elements like buttons will always show up. I think this is inevitable as this is a compile-time option instead of a run-time option.
Well, we *could*, on Windows, have the code check, at run time, whether we have pcap_create() or not, allowing code built with a newer version of WinPcap to work with older versions. That would make dumpcap more complicated, though.