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: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Sat, 6 Aug 2011 22:50:04 +0200
Hello Guy,

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

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 - btw, do you have a time plan for rpcap support in the
official libpcap sources?

Thanks!
    Joerg
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
Index: cmake/modules/FindPCAP.cmake
===================================================================
--- cmake/modules/FindPCAP.cmake	(revision 38382)
+++ cmake/modules/FindPCAP.cmake	(working copy)
@@ -122,10 +122,10 @@
 CHECK_FUNCTION_EXISTS("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS)
 CHECK_FUNCTION_EXISTS("pcap_set_datalink" HAVE_PCAP_SET_DATALINK)
 # Remote pcap checks
-CHECK_FUNCTION_EXISTS("pcap_open" H_PCAP_OPEN)
-CHECK_FUNCTION_EXISTS("pcap_findalldevs_ex" H_FINDALLDEVS_EX)
-CHECK_FUNCTION_EXISTS("pcap_createsrcstr" H_CREATESRCSTR)
-if(H_PCAP_OPEN AND H_FINDALLDEVS_EX AND H_CREATESRCSTR)
+CHECK_FUNCTION_EXISTS("pcap_open" HAVE_PCAP_OPEN)
+CHECK_FUNCTION_EXISTS("pcap_findalldevs_ex" HAVE_PCAP_FINDALLDEVS_EX)
+CHECK_FUNCTION_EXISTS("pcap_createsrcstr" HAVE_PCAP_CREATESRCSTR)
+if(HAVE_PCAP_OPEN AND HAVE_PCAP_FINDALLDEVS_EX AND HAVE_PCAP_CREATESRCSTR)
   SET(HAVE_PCAP_REMOTE 1)
   SET(HAVE_REMOTE 1)
 endif()
Index: cmakeconfig.h.in
===================================================================
--- cmakeconfig.h.in	(revision 38382)
+++ cmakeconfig.h.in	(working copy)
@@ -190,6 +190,9 @@
 /* Define to 1 if you have the `pcap_create' function. */
 #cmakedefine HAVE_PCAP_CREATE 1
 
+/* Define to 1 if you have the `pcap_creatercstr' function. */
+#cmakedefine HAVE_PCAP_CREATERCSTR 1
+
 /* Define to 1 if you have the `pcap_datalink_name_to_val' function. */
 #cmakedefine HAVE_PCAP_DATALINK_NAME_TO_VAL 1
 
@@ -203,6 +206,9 @@
    declares pcap_if_t. */
 #cmakedefine HAVE_PCAP_FINDALLDEVS 1
 
+/* Define to 1 if you have the `pcap_findalldevs_ex' function. */
+#cmakedefine HAVE_PCAP_FINDALLDEVS_EX 1
+
 /* Define to 1 if you have the `pcap_freecode' function. */
 #cmakedefine HAVE_PCAP_FREECODE 1
 
@@ -218,9 +224,16 @@
 /* Define to 1 if you have the `pcap_list_datalinks' function. */
 #cmakedefine HAVE_PCAP_LIST_DATALINKS 1
 
+/* Define to 1 if you have the `pcap_open' function. */
+#cmakedefine HAVE_PCAP_OPEN 1
+
 /* Define to 1 if you have the `pcap_open_dead' function. */
 #cmakedefine HAVE_PCAP_OPEN_DEAD 1
 
+/* Define if rpcap:// type remote capture is supported */
+#cmakedefine HAVE_PCAP_REMOTE 1
+#cmakedefine HAVE_REMOTE 1
+
 /* Define to 1 if you have the `pcap_set_datalink' function. */
 #cmakedefine HAVE_PCAP_SET_DATALINK 1
 
@@ -230,10 +243,6 @@
 /* Define if plugins are enabled */
 #cmakedefine HAVE_PLUGINS 1
 
-/* Define if rpcap:// type remote capture is supported */
-#cmakedefine HAVE_PCAP_REMOTE 1
-#cmakedefine HAVE_REMOTE 1
-
 /* Define to 1 if you have the <portaudio.h> header file. */
 #cmakedefine HAVE_PORTAUDIO_H 1