forked from osmocom/wireshark
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>
This commit is contained in:
parent
dd7134d907
commit
1d92195de8
|
@ -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__ */
|
||||
|
|
19
dumpcap.c
19
dumpcap.c
|
@ -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"
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
24
tshark.c
24
tshark.c
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue