summaryrefslogtreecommitdiff
path: root/capture-wpcap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-10-10 06:05:48 +0000
committerGuy Harris <guy@alum.mit.edu>2003-10-10 06:05:48 +0000
commit8e51328bc2b613cefffac72eafda0c45a142568d (patch)
tree9d8c73e487d0b6ed3c33462e855e6d48ef11c977 /capture-wpcap.c
parentde7bbaf8dae341e1263873e23db42f4d738961b0 (diff)
downloadwireshark-8e51328bc2b613cefffac72eafda0c45a142568d.tar.gz
Get the version number of the libpcap/WinPcap with which we're running
with "pcap_lib_version()", if available. svn path=/trunk/; revision=8656
Diffstat (limited to 'capture-wpcap.c')
-rw-r--r--capture-wpcap.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/capture-wpcap.c b/capture-wpcap.c
index 88f6cbfd15..36f232f277 100644
--- a/capture-wpcap.c
+++ b/capture-wpcap.c
@@ -3,7 +3,7 @@
* time, so that we only need one Ethereal binary and one Tethereal binary
* for Windows, regardless of whether WinPcap is installed or not.
*
- * $Id: capture-wpcap.c,v 1.4 2003/10/10 03:00:09 guy Exp $
+ * $Id: capture-wpcap.c,v 1.5 2003/10/10 06:05:48 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -59,6 +59,8 @@ static int (*p_pcap_lookupnet) (char *, bpf_u_int32 *, bpf_u_int32 *,
char *);
static pcap_t* (*p_pcap_open_live) (char *, int, int, int, char *);
static int (*p_pcap_loop) (pcap_t *, int, pcap_handler, guchar *);
+static int (*p_pcap_findalldevs) (pcap_if_t **, char *);
+static const char *(*p_pcap_lib_version) (void);
typedef struct {
const char *name;
@@ -87,6 +89,7 @@ load_wpcap(void)
SYM(pcap_open_live, FALSE),
SYM(pcap_loop, FALSE),
SYM(pcap_findalldevs, TRUE),
+ SYM(pcap_lib_version, TRUE),
{ NULL, NULL, FALSE }
};
@@ -372,6 +375,38 @@ get_interface_list(int *err, char *err_str)
return il;
}
+/*
+ * Append the version of WinPcap with which we were compiled to a GString.
+ */
+void
+get_compiled_pcap_version(GString *str)
+{
+ g_string_append(str, "with WinPcap (version unknown)");
+}
+
+/*
+ * Append the version of WinPcap with which we we're running to a GString.
+ */
+void
+get_runtime_pcap_version(GString *str)
+{
+ /*
+ * On Windows, we might have been compiled with WinPcap but
+ * might not have it loaded; indicate whether we have it or
+ * not and, if we have it and we have "pcap_lib_version()",
+ * what version we have.
+ */
+ if (has_wpcap) {
+ g_string_sprintfa(str, "with ");
+ if (p_pcap_lib_version != NULL)
+ g_string_sprintfa(str, p_pcap_lib_version());
+ else
+ g_string_append(str, "WinPcap (version unknown)");
+ } else
+ g_string_append(str, "without WinPcap");
+ g_string_append(str, " ");
+}
+
#else /* HAVE_LIBPCAP */
void
@@ -380,4 +415,22 @@ load_wpcap(void)
return;
}
+/*
+ * Append an indication that we were not compiled with WinPcap
+ * to a GString.
+ */
+void
+get_compiled_pcap_version(GString *str)
+{
+ g_string_append(str, "without WinPcap");
+}
+
+/*
+ * Don't append anything, as we weren't even compiled to use WinPcap.
+ */
+void
+get_runtime_pcap_version(GString *str _U_)
+{
+}
+
#endif /* HAVE_LIBPCAP */