Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] [Patch] HAVE_PCAP_DATALINK_NAME_TO_VAL

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Gisle Vanem" <giva@xxxxxxxxx>
Date: Thu, 23 Sep 2004 19:11:51 +0200
Building with this define requires this patch to capture-wpcap.c. Attached.

And I get this error with MingW:
  gtk/sctp_assoc_analyse.c:221: error: dereferencing pointer to incomplete type
  gtk/sctp_assoc_analyse.c:280: error: dereferencing pointer to incomplete type
....
  gtk/sctp_stat.c:369: error: invalid application of `sizeof' to incomplete type `sockaddr_in6'
  gtk/sctp_stat.c:370: error: invalid application of `sizeof' to incomplete type `sockaddr_in6'
...

<ws2tcpip.h> is needed for these definitions. Patch:

--- ethereal-2004-09-23/gtk/sctp_assoc_analyse.c        Tue Sep 07 22:07:08 2004
+++ gtk/sctp_assoc_analyse.c    Thu Sep 23 18:22:59 2004
@@ -41,6 +41,9 @@

 #include "sctp_stat.h"

+#if defined(_WIN32)
+# include <ws2tcpip.h>
+#endif

 void
 decrease_childcount(struct sctp_analyse *parent)

--- ethereal-2004-09-23/gtk/sctp_stat.c Sun Sep 12 00:53:17 2004
+++ gtk/sctp_stat.c     Thu Sep 23 18:24:53 2004
@@ -40,6 +40,9 @@
 #include "sctp_stat.h"
 #include <math.h>

+#if defined(_WIN32)
+# include <ws2tcpip.h>
+#endif

 #define SCTP_HEARTBEAT_CHUNK_ID          4
 #define SCTP_HEARTBEAT_ACK_CHUNK_ID      5

-------------

--gv
--- ethereal-2004-09-23/capture-wpcap.c	Tue Aug 10 07:27:50 2004
+++ capture-wpcap.c	Thu Sep 23 18:14:42 2004
@@ -69,6 +69,9 @@
 static int     (*p_pcap_findalldevs) (pcap_if_t **, char *);
 static void    (*p_pcap_freealldevs) (pcap_if_t *);
 #endif
+#ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME
+static const char *(*p_pcap_datalink_val_to_name) (int);
+#endif
 static const char *(*p_pcap_lib_version) (void);
 static int     (*p_pcap_setbuff) (pcap_t *, int dim);

@@ -102,6 +105,9 @@
 		SYM(pcap_findalldevs, TRUE),
 		SYM(pcap_freealldevs, TRUE),
 #endif
+#ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME
+		SYM(pcap_datalink_val_to_name, TRUE),
+#endif
 		SYM(pcap_lib_version, TRUE),
 		SYM(pcap_setbuff, TRUE),
 		{ NULL, NULL, FALSE }
@@ -110,7 +116,7 @@
 	GModule		*wh; /* wpcap handle */
 	const symbol_table_t	*sym;

-	wh = g_module_open("wpcap", 0);
+	wh = g_module_open("wpcap2", 0);

 	if (!wh) {
 		return;
@@ -247,6 +253,15 @@
 {
 	g_assert(has_wpcap && p_pcap_freealldevs != NULL);
 	p_pcap_freealldevs(a);
+}
+#endif
+
+#ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME
+const char *
+pcap_datalink_val_to_name(int dlt)
+{
+	g_assert(has_wpcap && p_pcap_datalink_val_to_name != NULL);
+	return p_pcap_datalink_val_to_name(dlt);
 }
 #endif