diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-06-23 14:55:56 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-06-23 21:56:42 +0000 |
commit | 1d92195de847a30e570ca690ab0a2034cb3a51d3 (patch) | |
tree | 95b000735679f0b957b8c9eecc9ad4d700ea4efc | |
parent | dd7134d907350ccc574cdec596f4162860912bb9 (diff) | |
download | wireshark-1d92195de847a30e570ca690ab0a2034cb3a51d3.tar.gz |
Have individual programs get libpcap and libz version info.
That way, the code that constructs the runtime version string doesn't
itself have to call libpcap and libz, and could be usable in programs
that don't call them.
While we're at it, add "with" to the run-time version information for
GnuTLS and libgcrypt, to match the compile-time version information, and
add the version information from libwireshark to TShark.
Change-Id: I3726a027d032270b032292da9314c1cec535dcd2
Reviewed-on: https://code.wireshark.org/review/2587
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | capture-pcap-util.h | 16 | ||||
-rw-r--r-- | dumpcap.c | 19 | ||||
-rw-r--r-- | epan/epan.c | 4 | ||||
-rw-r--r-- | tshark.c | 24 | ||||
-rw-r--r-- | ui/gtk/main.c | 20 | ||||
-rw-r--r-- | ui/qt/main.cpp | 22 | ||||
-rw-r--r-- | version_info.c | 9 |
7 files changed, 86 insertions, 28 deletions
diff --git a/capture-pcap-util.h b/capture-pcap-util.h index 49ebe52c40..2dde7b89db 100644 --- a/capture-pcap-util.h +++ b/capture-pcap-util.h @@ -23,14 +23,14 @@ #ifndef __CAPTURE_PCAP_UTIL_H__ #define __CAPTURE_PCAP_UTIL_H__ -#ifdef HAVE_LIBPCAP - -#include <pcap.h> - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +#ifdef HAVE_LIBPCAP + +#include <pcap.h> + /* * A snapshot length of 0 is useless - and libpcap/WinPcap don't guarantee * that a snapshot length of 0 will work, and, on some platforms, it won't @@ -50,10 +50,6 @@ GList *get_remote_interface_list(const char *hostname, const char *port, const char *linktype_val_to_name(int dlt); int linktype_name_to_val(const char *linktype); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - #endif /* HAVE_LIBPCAP */ /* @@ -71,4 +67,8 @@ extern void get_compiled_pcap_version(GString *str); */ extern void get_runtime_pcap_version(GString *str); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __CAPTURE_PCAP_UTIL_H__ */ @@ -67,6 +67,10 @@ #include <signal.h> #include <errno.h> +#ifdef HAVE_LIBZ +#include <zlib.h> /* to get the libz version number */ +#endif + #include <wsutil/crash_info.h> #include <wsutil/copyright_info.h> #include <wsutil/ws_version_info.h> @@ -4172,6 +4176,19 @@ out: return ret; } +static void +get_dumpcap_runtime_info(GString *str) +{ + /* Libpcap */ + g_string_append(str, ", "); + get_runtime_pcap_version(str); + + /* zlib */ +#if defined(HAVE_LIBZ) && !defined(_WIN32) + g_string_append_printf(str, ", with libz %s", zlibVersion()); +#endif +} + /* And now our feature presentation... [ fade to music ] */ int main(int argc, char *argv[]) @@ -4221,7 +4238,7 @@ main(int argc, char *argv[]) /* Assemble the run-time version information string */ runtime_info_str = g_string_new("Running "); - get_runtime_version_info(runtime_info_str, NULL); + get_runtime_version_info(runtime_info_str, get_dumpcap_runtime_info); /* Add it to the information to be reported on a crash. */ ws_add_crash_info("Dumpcap %s\n" diff --git a/epan/epan.c b/epan/epan.c index eef9880f3e..2d5ebfe21d 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -549,12 +549,12 @@ _U_ { /* GnuTLS */ #ifdef HAVE_LIBGNUTLS - g_string_append_printf(str, ", GnuTLS %s", gnutls_check_version(NULL)); + g_string_append_printf(str, ", with GnuTLS %s", gnutls_check_version(NULL)); #endif /* HAVE_LIBGNUTLS */ /* Gcrypt */ #ifdef HAVE_LIBGCRYPT - g_string_append_printf(str, ", Gcrypt %s", gcry_check_version(NULL)); + g_string_append_printf(str, ", with Gcrypt %s", gcry_check_version(NULL)); #endif /* HAVE_LIBGCRYPT */ } @@ -51,6 +51,10 @@ # include <sys/stat.h> #endif +#ifdef HAVE_LIBZ +#include <zlib.h> /* to get the libz version number */ +#endif + #ifndef HAVE_GETOPT #include "wsutil/wsgetopt.h" #endif @@ -918,6 +922,24 @@ show_version(GString *comp_info_str, GString *runtime_info_str) runtime_info_str->str); } +static void +get_tshark_runtime_info(GString *str) +{ +#ifdef HAVE_LIBPCAP + /* Libpcap */ + g_string_append(str, ", "); + get_runtime_pcap_version(str); +#endif + + /* zlib */ +#if defined(HAVE_LIBZ) && !defined(_WIN32) + g_string_append_printf(str, ", with libz %s", zlibVersion()); +#endif + + /* stuff used by libwireshark */ + epan_get_runtime_version_info(str); +} + int main(int argc, char *argv[]) { @@ -989,7 +1011,7 @@ main(int argc, char *argv[]) /* Assemble the run-time version information string */ runtime_info_str = g_string_new("Running "); - get_runtime_version_info(runtime_info_str, NULL); + get_runtime_version_info(runtime_info_str, get_tshark_runtime_info); /* Add it to the information to be reported on a crash. */ ws_add_crash_info("TShark %s\n" diff --git a/ui/gtk/main.c b/ui/gtk/main.c index a1caf1acfa..5848ea15ef 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -45,6 +45,10 @@ #include "wsutil/wsgetopt.h" #endif +#ifdef HAVE_LIBZ +#include <zlib.h> /* to get the libz version number */ +#endif + #ifdef _WIN32 /* Needed for console I/O */ #include <fcntl.h> @@ -1949,8 +1953,20 @@ get_gui_compiled_info(GString *str) } static void -get_gui_runtime_info(GString *str) +get_wireshark_runtime_info(GString *str) { +#ifdef HAVE_LIBPCAP + /* Libpcap */ + g_string_append(str, ", "); + get_runtime_pcap_version(str); +#endif + + /* zlib */ +#if defined(HAVE_LIBZ) && !defined(_WIN32) + g_string_append_printf(str, ", with libz %s", zlibVersion()); +#endif + + /* stuff used by libwireshark */ epan_get_runtime_version_info(str); #ifdef HAVE_AIRPCAP @@ -2251,7 +2267,7 @@ main(int argc, char *argv[]) /* Assemble the run-time version information string */ runtime_info_str = g_string_new("Running "); - get_runtime_version_info(runtime_info_str, get_gui_runtime_info); + get_runtime_version_info(runtime_info_str, get_wireshark_runtime_info); #ifdef _WIN32 ws_add_crash_info(PACKAGE " %s\n" diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index 19087c5789..52bbb7ffb9 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -31,6 +31,10 @@ #include <signal.h> +#ifdef HAVE_LIBZ +#include <zlib.h> /* to get the libz version number */ +#endif + #ifndef HAVE_GETOPT # include "wsutil/wsgetopt.h" #else @@ -419,7 +423,7 @@ get_gui_compiled_info(GString *str) g_string_append(str, ", "); g_string_append(str, "without PortAudio"); - g_string_append(str, ", "); + g_string_append(str, ", "); #ifdef HAVE_AIRPCAP get_compiled_airpcap_version(str); #else @@ -429,8 +433,18 @@ get_gui_compiled_info(GString *str) // xxx copied from ../gtk/main.c static void -get_gui_runtime_info(GString *str) +get_wireshark_runtime_info(GString *str) { + /* Libpcap */ + g_string_append(str, ", "); + get_runtime_pcap_version(str); + + /* zlib */ +#if defined(HAVE_LIBZ) && !defined(_WIN32) + g_string_append_printf(str, ", with libz %s", zlibVersion()); +#endif + + /* stuff used by libwireshark */ epan_get_runtime_version_info(str); #ifdef HAVE_AIRPCAP @@ -438,12 +452,10 @@ get_gui_runtime_info(GString *str) get_runtime_airpcap_version(str); #endif - if(u3_active()) { g_string_append(str, ", "); u3_runtime_info(str); } - } /* And now our feature presentation... [ fade to music ] */ @@ -520,7 +532,7 @@ int main(int argc, char *argv[]) /* Assemble the run-time version information string */ runtime_info_str = g_string_new("Running "); // xxx qtshark - get_runtime_version_info(runtime_info_str, get_gui_runtime_info); + get_runtime_version_info(runtime_info_str, get_wireshark_runtime_info); ws_add_crash_info(PACKAGE " %s\n" "\n" diff --git a/version_info.c b/version_info.c index 63adc39991..888d7ea4c5 100644 --- a/version_info.c +++ b/version_info.c @@ -180,15 +180,6 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *)) g_string_append(str, ", without locale"); #endif - /* Libpcap */ - g_string_append(str, ", "); - get_runtime_pcap_version(str); - - /* zlib */ -#if defined(HAVE_LIBZ) && !defined(_WIN32) - g_string_append_printf(str, ", with libz %s", zlibVersion()); -#endif - /* Additional application-dependent information */ if (additional_info) (*additional_info)(str); |