ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] HAVE_PCAP symbols by build type

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sat, 6 Aug 2011 14:41:13 -0700
On Aug 6, 2011, at 1:50 PM, Joerg Mayer wrote:

> On Sat, Aug 06, 2011 at 02:37:48AM -0700, Guy Harris wrote:
> 
>> The only calls to pcap_findalldevs_ex() are protected by HAVE_PCAP_REMOTE.  This may have to be redone when remote capture support is added to libpcap.
> 
> Yes, and that's why it is set on my system, I just didn't add it to
> cmakeconfig.h.in
> 
>> HAVE_PCAP_OPEN is equivalent to "have WinPcap" which is equivalent to "is running on Windows".  The same is true of HAVE_PCAP_SETSAMPLING.
> 
> HAVE_PCAP_OPEN also exists on my system, due to the pcap-remote patches.
> Again it was not added to cmakeconfig.h.in

In the future, there will be:

	1) libpcap/WinPcap with the new remote-capture support; that will probably be defined as (has pcap_create() and has one of the new APIs for that);

	2) libpcap (patched)/WinPcap with the old remote-capture support; that will be defined as (has pcap_open() and has pcap_findalldevs_ex(), unless there are no versions that have pcap_open() and pcap_findalldevs_ex(), in which case "has pcap_open()" should suffice) and with pcap_create();

	3) libpcap (patched)/WinPcap with the old remote-capture support; that will be defined as (has pcap_open() and has pcap_findalldevs_ex(), unless there are no versions that have pcap_open() and pcap_findalldevs_ex(), in which case "has pcap_open()" should suffice) and without pcap_create();

	4) libpcap with pcap_create() but no remote-capture support;

	5) libpcap with neither.

1) will use the new remote-capture support, i.e. pcap_create() and the new APIs (which will be a bit complicated, as they should support authentication models other than the "send the user name and password over the wire when you open the device" model of rpcap, e.g. the models available for "run tcpdump with ssh", "run dumpcap with ssh", perhaps "rpcap over SSL", etc.).

2) will use pcap_open() for remote capture and pcap_create()/pcap_activate() for local capture.

3) will use pcap_open() for everything.

4) will use pcap_create()/pcap_activate().

5) will use pcap_open_live().

> I will do this on my system now and see what breaks:
> 
> dumpcap.c:
> /home/jmayer/work/wireshark/svn/trunk/dumpcap.c: In function ‘get_if_capabilities’:
> /home/jmayer/work/wireshark/svn/trunk/dumpcap.c:1015:9: error: unused variable ‘status’
> /home/jmayer/work/wireshark/svn/trunk/dumpcap.c:1005:51: error: unused parameter ‘monitor_mode’
> 
> I've attached the patch that was used to create the problem ;-)
> As I really don't know whether it makes sense to set all these variables I'd like
> to leave this to you

I'll look at that.

> - btw, do you have a time plan for rpcap support in the official libpcap sources?

"As soon as possible".  There's a lot going on right now outside of software, but a bit more free time may open up starting next week.  Of the significant changes to libpcap on my list, it's currently at the top of the list.