aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-util-unix.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 /pcap-util-unix.c
parentde7bbaf8dae341e1263873e23db42f4d738961b0 (diff)
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 'pcap-util-unix.c')
-rw-r--r--pcap-util-unix.c56
1 files changed, 53 insertions, 3 deletions
diff --git a/pcap-util-unix.c b/pcap-util-unix.c
index 6e3e8676a9..29015769b6 100644
--- a/pcap-util-unix.c
+++ b/pcap-util-unix.c
@@ -1,7 +1,7 @@
/* pcap-util-unix.c
* UN*X-specific utility routines for packet capture
*
- * $Id: pcap-util-unix.c,v 1.1 2003/10/10 03:00:10 guy Exp $
+ * $Id: pcap-util-unix.c,v 1.2 2003/10/10 06:05:48 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -26,10 +26,10 @@
# include "config.h"
#endif
-#ifdef HAVE_LIBPCAP
-
#include <glib.h>
+#ifdef HAVE_LIBPCAP
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -270,4 +270,54 @@ search_for_if_cb(gpointer data, gpointer user_data)
}
#endif /* HAVE_PCAP_FINDALLDEVS */
+/*
+ * Append the version of libpcap with which we were compiled to a GString.
+ */
+void
+get_compiled_pcap_version(GString *str)
+{
+#ifdef HAVE_PCAP_VERSION
+ extern char pcap_version[];
+
+ g_string_sprintfa(str, "with libpcap %s", pcap_version);
+#else
+ g_string_append(str, "with libpcap (version unknown)");
+#endif
+}
+
+/*
+ * Append the version of libpcap with which we we're running to a GString.
+ */
+void
+get_runtime_pcap_version(GString *str)
+{
+ g_string_sprintfa(str, "with ");
+#ifdef HAVE_PCAP_LIB_VERSION
+ g_string_sprintfa(str, pcap_lib_version());
+#else
+ g_string_append(str, "libpcap (version unknown)");
+#endif
+ g_string_append(str, " ");
+}
+
+#else /* HAVE_LIBPCAP */
+
+/*
+ * Append an indication that we were not compiled with libpcap
+ * to a GString.
+ */
+void
+get_compiled_pcap_version(GString *str)
+{
+ g_string_append(str, "without libpcap");
+}
+
+/*
+ * Don't append anything, as we weren't even compiled to use WinPcap.
+ */
+void
+get_runtime_pcap_version(GString *str _U_)
+{
+}
+
#endif /* HAVE_LIBPCAP */