/* capture-wpcap.c
* WinPcap-specific interfaces for capturing. We load WinPcap at run
- * time, so that we only need one Ethereal binary and one Tethereal binary
+ * time, so that we only need one Wireshark binary and one TShark binary
* for Windows, regardless of whether WinPcap is installed or not.
*
* $Id$
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 2001 Gerald Combs
*
* This program is free software; you can redistribute it and/or
#ifdef HAVE_LIBPCAP
+/*
+ * XXX - should we require at least WinPcap 3.1 both for building an
+ * for using Wireshark?
+ */
+
static char* (*p_pcap_lookupdev) (char *);
static void (*p_pcap_close) (pcap_t *);
static int (*p_pcap_stats) (pcap_t *, struct pcap_stat *);
#ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME
static const char *(*p_pcap_datalink_val_to_name) (int);
#endif
+#ifdef HAVE_PCAP_BREAKLOOP
+static void (*p_pcap_breakloop) (pcap_t *);
+#endif
static const char *(*p_pcap_lib_version) (void);
static int (*p_pcap_setbuff) (pcap_t *, int dim);
static int (*p_pcap_next_ex) (pcap_t *, struct pcap_pkthdr **pkt_header, const u_char **pkt_data);
#endif
#ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME
SYM(pcap_datalink_val_to_name, TRUE),
+#endif
+#ifdef HAVE_PCAP_BREAKLOOP
+ /*
+ * We don't try to work around the lack of this at
+ * run time; it's present in WinPcap 3.1, which is
+ * the version we build with and ship with.
+ */
+ SYM(pcap_breakloop, FALSE),
#endif
SYM(pcap_lib_version, TRUE),
SYM(pcap_setbuff, TRUE),
#ifdef DLT_LINUX_IRDA
DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"),
#endif
+#ifdef DLT_LINUX_LAPD
+ DLT_CHOICE(DLT_LINUX_LAPD, "Linux vISDN LAPD"),
+#endif
#ifdef DLT_LANE8023
DLT_CHOICE(DLT_LANE8023, "Linux 802.3 LANE"),
#endif
}
#endif
+#ifdef HAVE_PCAP_BREAKLOOP
+void pcap_breakloop(pcap_t *a)
+{
+ p_pcap_breakloop(a);
+}
+#endif
+
/* setbuff is win32 specific! */
int pcap_setbuff(pcap_t *a, int b)
{
* fall back on "pcap_lookupdev()".
*/
GList *
-get_interface_list(int *err, char *err_str)
+get_interface_list(int *err, char **err_str)
{
GList *il = NULL;
wchar_t *names;
char ascii_name[MAX_WIN_IF_NAME_LEN + 1];
char ascii_desc[MAX_WIN_IF_NAME_LEN + 1];
int i, j;
+ char errbuf[PCAP_ERRBUF_SIZE];
#ifdef HAVE_PCAP_FINDALLDEVS
if (p_pcap_findalldevs != NULL)
* description of the Nth adapter.
*/
- names = (wchar_t *)pcap_lookupdev(err_str);
+ names = (wchar_t *)pcap_lookupdev(errbuf);
i = 0;
if (names) {
* No interfaces found.
*/
*err = NO_INTERFACES_FOUND;
+ if (err_str != NULL)
+ *err_str = NULL;
}
return il;
}
} else
g_string_append(str, "without WinPcap");
- g_string_append(str, " ");
}
#else /* HAVE_LIBPCAP */