forked from osmocom/wireshark
Move more version-info-related stuff to version_info.c.
Have a ws_init_version_info() routine that, given an application name string: constructs the app-name-and-version-information string, and saves it; adds the initial crash information on platforms that support it, and saves it. Have show_version() use the saved information and take no arguments. Add a show_help_header() routine to print the header for --help command-line options, given a description of the application; it prints the application name and version information, the description, and the "See {wireshark.org URL}" line. Use those routines in various places, including providing the "application name" string in pcapng SHBs. Change-Id: I0042a8fcc91aa919ad5c381a8b8674a007ce66df Reviewed-on: https://code.wireshark.org/review/31029 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>thomas/dect
parent
a34cc98b2a
commit
43dfd45faa
31
capinfos.c
31
capinfos.c
|
@ -60,7 +60,6 @@
|
|||
#include <wiretap/wtap.h>
|
||||
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/privileges.h>
|
||||
#include <cli_main.h>
|
||||
|
@ -1403,8 +1402,6 @@ hash_to_str(const unsigned char *hash, size_t length, char *str) {
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *init_progfile_dir_error;
|
||||
wtap *wth;
|
||||
int err;
|
||||
|
@ -1431,21 +1428,8 @@ real_main(int argc, char *argv[])
|
|||
/* Get the decimal point. */
|
||||
decimal_point = g_strdup(localeconv()->decimal_point);
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Capinfos (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Capinfos (Wireshark)", NULL, NULL, NULL);
|
||||
|
||||
#ifdef _WIN32
|
||||
create_app_running_mutex();
|
||||
|
@ -1629,20 +1613,13 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'h':
|
||||
printf("Capinfos (Wireshark) %s\n"
|
||||
"Print various information (infos) about capture files.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Print various information (infos) about capture files.");
|
||||
print_usage(stdout);
|
||||
goto exit;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
show_version("Capinfos (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
goto exit;
|
||||
break;
|
||||
|
||||
|
|
31
captype.c
31
captype.c
|
@ -29,7 +29,6 @@
|
|||
#include <wiretap/wtap.h>
|
||||
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/privileges.h>
|
||||
|
@ -81,8 +80,6 @@ failure_message_cont(const char *msg_format, va_list ap)
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *init_progfile_dir_error;
|
||||
wtap *wth;
|
||||
int err;
|
||||
|
@ -101,21 +98,8 @@ real_main(int argc, char *argv[])
|
|||
|
||||
cmdarg_err_init(failure_warning_message, failure_message_cont);
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Captype (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Captype (Wireshark)", NULL, NULL, NULL);
|
||||
|
||||
#ifdef _WIN32
|
||||
create_app_running_mutex();
|
||||
|
@ -149,20 +133,13 @@ real_main(int argc, char *argv[])
|
|||
switch (opt) {
|
||||
|
||||
case 'h':
|
||||
printf("Captype (Wireshark) %s\n"
|
||||
"Print the file types of capture files.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Print the file types of capture files.");
|
||||
print_usage(stdout);
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
show_version("Captype (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
|
|
36
dumpcap.c
36
dumpcap.c
|
@ -41,7 +41,6 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/strtoi.h>
|
||||
#include <cli_main.h>
|
||||
#include <version_info.h>
|
||||
|
@ -3028,18 +3027,16 @@ capture_loop_init_pcapng_output(capture_options *capture_opts, loop_data *ld)
|
|||
GString *cpu_info_str = g_string_new("");
|
||||
get_cpu_info(cpu_info_str);
|
||||
|
||||
char *appname = g_strdup_printf("Dumpcap (Wireshark) %s", get_ws_vcs_version_info());
|
||||
successful = pcapng_write_session_header_block(ld->pdh,
|
||||
(const char *)capture_opts->capture_comment, /* Comment */
|
||||
cpu_info_str->str, /* HW */
|
||||
os_info_str->str, /* OS */
|
||||
appname,
|
||||
get_appname_and_version(),
|
||||
-1, /* section_length */
|
||||
&ld->bytes_written,
|
||||
&err);
|
||||
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "%s: wrote dumpcap SHB %d", G_STRFUNC, successful);
|
||||
g_string_free(cpu_info_str, TRUE);
|
||||
g_free(appname);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; successful && (i < ld->saved_idbs->len); i++) {
|
||||
|
@ -4613,8 +4610,6 @@ get_dumpcap_runtime_info(GString *str)
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
int opt;
|
||||
static const struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
|
@ -4655,21 +4650,9 @@ real_main(int argc, char *argv[])
|
|||
|
||||
cmdarg_err_init(dumpcap_cmdarg_err, dumpcap_cmdarg_err_cont);
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_dumpcap_compiled_info);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_dumpcap_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Dumpcap (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Dumpcap (Wireshark)", NULL, get_dumpcap_compiled_info,
|
||||
get_dumpcap_runtime_info);
|
||||
|
||||
#ifdef _WIN32
|
||||
create_app_running_mutex();
|
||||
|
@ -4961,19 +4944,12 @@ real_main(int argc, char *argv[])
|
|||
while ((opt = getopt_long(argc, argv, OPTSTRING, long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'h': /* Print help and exit */
|
||||
printf("Dumpcap (Wireshark) %s\n"
|
||||
"Capture network packets and dump them into a pcapng or pcap file.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Capture network packets and dump them into a pcapng or pcap file.");
|
||||
print_usage(stdout);
|
||||
exit_main(0);
|
||||
break;
|
||||
case 'v': /* Show version and exit */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_dumpcap_compiled_info);
|
||||
runtime_info_str = get_runtime_version_info(get_dumpcap_runtime_info);
|
||||
show_version("Dumpcap (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
exit_main(0);
|
||||
break;
|
||||
/*** capture option specific ***/
|
||||
|
|
37
editcap.c
37
editcap.c
|
@ -62,7 +62,6 @@
|
|||
# include "wsutil/strptime.h"
|
||||
#endif
|
||||
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/clopts_common.h>
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
|
@ -985,9 +984,6 @@ editcap_dump_open(const char *filename, const wtap_dump_params *params,
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *appname;
|
||||
char *init_progfile_dir_error;
|
||||
wtap *wth = NULL;
|
||||
int i, j, read_err, write_err;
|
||||
|
@ -1043,24 +1039,8 @@ real_main(int argc, char *argv[])
|
|||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
/* Get the application name with version info */
|
||||
appname = g_strdup_printf("Editcap (Wireshark) %s", get_ws_vcs_version_info());
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("%s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
appname, comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Editcap (Wireshark)", NULL, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Get credential information for later use.
|
||||
|
@ -1282,10 +1262,7 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'h':
|
||||
printf("Editcap (Wireshark) %s\n"
|
||||
"Edit and/or translate the format of capture files.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Edit and/or translate the format of capture files.");
|
||||
print_usage(stdout);
|
||||
goto clean_exit;
|
||||
break;
|
||||
|
@ -1345,11 +1322,7 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
show_version("Editcap (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
goto clean_exit;
|
||||
break;
|
||||
|
||||
|
@ -1566,7 +1539,7 @@ real_main(int argc, char *argv[])
|
|||
|
||||
/* If we don't have an application name add one */
|
||||
if (wtap_block_get_string_option_value(g_array_index(params.shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, &shb_user_appl) != WTAP_OPTTYPE_SUCCESS) {
|
||||
wtap_block_add_string_option_format(g_array_index(params.shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, "%s", appname);
|
||||
wtap_block_add_string_option_format(g_array_index(params.shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, "%s", get_appname_and_version());
|
||||
}
|
||||
|
||||
pdh = editcap_dump_open(filename, ¶ms, &write_err);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <epan/epan.h>
|
||||
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/privileges.h>
|
||||
#include <wsutil/report_message.h>
|
||||
|
@ -180,8 +179,6 @@ fuzz_prefs_apply(void)
|
|||
static int
|
||||
fuzz_init(int argc _U_, char **argv)
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *init_progfile_dir_error;
|
||||
|
||||
char *err_msg = NULL;
|
||||
|
@ -238,23 +235,9 @@ fuzz_init(int argc _U_, char **argv)
|
|||
if (init_progfile_dir_error != NULL)
|
||||
fprintf(stderr, "fuzzshark: Can't get pathname of oss-fuzzshark program: %s.\n", init_progfile_dir_error);
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(epan_get_runtime_version_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("OSS Fuzzshark (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(),
|
||||
comp_info_str->str,
|
||||
runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("OSS Fuzzshark (Wireshark)", NULL,
|
||||
epan_get_compiled_version_info, epan_get_runtime_version_info);
|
||||
|
||||
init_report_message(failure_warning_message, failure_warning_message,
|
||||
open_failure_message, read_failure_message, write_failure_message);
|
||||
|
|
41
mergecap.c
41
mergecap.c
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include <wsutil/clopts_common.h>
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/privileges.h>
|
||||
|
@ -230,9 +229,6 @@ merge_callback(merge_event event, int num,
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *appname;
|
||||
char *init_progfile_dir_error;
|
||||
int opt;
|
||||
static const struct option long_options[] = {
|
||||
|
@ -264,24 +260,8 @@ real_main(int argc, char *argv[])
|
|||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
/* Get the application name with version info */
|
||||
appname = g_strdup_printf("mergecap (Wireshark) %s", get_ws_vcs_version_info());
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("%s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
appname, comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Mergecap (Wireshark)", NULL, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Get credential information for later use.
|
||||
|
@ -325,10 +305,7 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'h':
|
||||
printf("Mergecap (Wireshark) %s\n"
|
||||
"Merge two or more capture files into one.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Merge two or more capture files into one.");
|
||||
print_usage(stdout);
|
||||
goto clean_exit;
|
||||
break;
|
||||
|
@ -353,11 +330,7 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'V':
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
show_version("Mergecap (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
goto clean_exit;
|
||||
break;
|
||||
|
||||
|
@ -418,13 +391,15 @@ real_main(int argc, char *argv[])
|
|||
status = merge_files_to_stdout(file_type,
|
||||
(const char *const *) &argv[optind],
|
||||
in_file_count, do_append, mode, snaplen,
|
||||
appname, verbose ? &cb : NULL,
|
||||
get_appname_and_version(),
|
||||
verbose ? &cb : NULL,
|
||||
&err, &err_info, &err_fileno, &err_framenum);
|
||||
} else {
|
||||
/* merge the files to the outfile */
|
||||
status = merge_files(out_filename, file_type,
|
||||
(const char *const *) &argv[optind], in_file_count,
|
||||
do_append, mode, snaplen, appname, verbose ? &cb : NULL,
|
||||
do_append, mode, snaplen, get_appname_and_version(),
|
||||
verbose ? &cb : NULL,
|
||||
&err, &err_info, &err_fileno, &err_framenum);
|
||||
}
|
||||
|
||||
|
|
29
rawshark.c
29
rawshark.c
|
@ -47,7 +47,6 @@
|
|||
#include <epan/epan.h>
|
||||
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/plugins.h>
|
||||
|
@ -406,8 +405,6 @@ set_link_type(const char *lt_arg) {
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *init_progfile_dir_error;
|
||||
int opt, i;
|
||||
|
||||
|
@ -442,19 +439,10 @@ real_main(int argc, char *argv[])
|
|||
|
||||
cmdarg_err_init(rawshark_cmdarg_err, rawshark_cmdarg_err_cont);
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Rawshark (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Rawshark (Wireshark)", NULL,
|
||||
epan_get_compiled_version_info,
|
||||
NULL);
|
||||
|
||||
#ifdef _WIN32
|
||||
create_app_running_mutex();
|
||||
|
@ -553,10 +541,7 @@ real_main(int argc, char *argv[])
|
|||
g_ptr_array_add(disp_fields, g_strdup(optarg));
|
||||
break;
|
||||
case 'h': /* Print help and exit */
|
||||
printf("Rawshark (Wireshark) %s\n"
|
||||
"Dump and analyze network traffic.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Dump and analyze network traffic.");
|
||||
print_usage(stdout);
|
||||
goto clean_exit;
|
||||
break;
|
||||
|
@ -691,7 +676,7 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
case 'v': /* Show version and exit */
|
||||
{
|
||||
show_version("Rawshark (Wireshark)", comp_info_str, runtime_info_str);
|
||||
show_version();
|
||||
goto clean_exit;
|
||||
}
|
||||
default:
|
||||
|
@ -819,8 +804,6 @@ real_main(int argc, char *argv[])
|
|||
|
||||
clean_exit:
|
||||
g_free(pipe_name);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
epan_free(cfile.epan);
|
||||
epan_cleanup();
|
||||
extcap_cleanup();
|
||||
|
|
31
reordercap.c
31
reordercap.c
|
@ -26,7 +26,6 @@
|
|||
#endif
|
||||
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/privileges.h>
|
||||
|
@ -164,8 +163,6 @@ failure_message_cont(const char *msg_format, va_list ap)
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *init_progfile_dir_error;
|
||||
wtap *wth = NULL;
|
||||
wtap_dumper *pdh = NULL;
|
||||
|
@ -196,21 +193,8 @@ real_main(int argc, char *argv[])
|
|||
|
||||
cmdarg_err_init(failure_warning_message, failure_message_cont);
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Reordercap (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Reordercap (Wireshark)", NULL, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Get credential information for later use.
|
||||
|
@ -241,18 +225,11 @@ real_main(int argc, char *argv[])
|
|||
write_output_regardless = FALSE;
|
||||
break;
|
||||
case 'h':
|
||||
printf("Reordercap (Wireshark) %s\n"
|
||||
"Reorder timestamps of input file frames into output file.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Reorder timestamps of input file frames into output file.");
|
||||
print_usage(stdout);
|
||||
goto clean_exit;
|
||||
case 'v':
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
show_version("Reordercap (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
goto clean_exit;
|
||||
case '?':
|
||||
print_usage(stderr);
|
||||
|
|
22
sharkd.c
22
sharkd.c
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <wsutil/clopts_common.h>
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/privileges.h>
|
||||
|
@ -103,8 +102,6 @@ print_current_user(void) {
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *init_progfile_dir_error;
|
||||
|
||||
char *err_msg = NULL;
|
||||
|
@ -131,21 +128,10 @@ main(int argc, char *argv[])
|
|||
init_progfile_dir_error);
|
||||
}
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(epan_get_runtime_version_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Sharkd (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Sharkd (Wireshark)", NULL,
|
||||
epan_get_compiled_version_info,
|
||||
epan_get_runtime_version_info);
|
||||
|
||||
if (sharkd_init(argc, argv) < 0)
|
||||
{
|
||||
|
|
36
text2pcap.c
36
text2pcap.c
|
@ -100,7 +100,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <cli_main.h>
|
||||
#include <version_info.h>
|
||||
#include <wsutil/inet_addr.h>
|
||||
|
@ -872,20 +871,17 @@ write_file_header (void)
|
|||
gboolean success;
|
||||
|
||||
if (use_pcapng) {
|
||||
char *appname;
|
||||
char *comment;
|
||||
|
||||
appname = g_strdup_printf("text2pcap (Wireshark) %s", get_ws_vcs_version_info());
|
||||
comment = g_strdup_printf("Generated from input file %s.", input_filename);
|
||||
success = pcapng_write_session_header_block(output_file,
|
||||
comment,
|
||||
NULL, /* HW */
|
||||
NULL, /* OS */
|
||||
appname,
|
||||
get_appname_and_version(),
|
||||
-1, /* section_length */
|
||||
&bytes_written,
|
||||
&err);
|
||||
g_free(appname);
|
||||
g_free(comment);
|
||||
if (success) {
|
||||
success = pcapng_write_interface_description_block(output_file,
|
||||
|
@ -1441,8 +1437,6 @@ print_usage (FILE *output)
|
|||
static int
|
||||
parse_options (int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
int c;
|
||||
char *p;
|
||||
static const struct option long_options[] = {
|
||||
|
@ -1452,30 +1446,14 @@ parse_options (int argc, char *argv[])
|
|||
};
|
||||
struct tm *now_tm;
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
|
||||
/* get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Text2pcap (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("Text2pcap (Wireshark)", NULL, NULL, NULL);
|
||||
|
||||
/* Scan CLI parameters */
|
||||
while ((c = getopt_long(argc, argv, "aDdhqe:i:l:m:no:u:s:S:t:T:v4:6:", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'h':
|
||||
printf("Text2pcap (Wireshark) %s\n"
|
||||
"Generate a capture file from an ASCII hexdump of packets.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Generate a capture file from an ASCII hexdump of packets.");
|
||||
print_usage(stdout);
|
||||
exit(0);
|
||||
break;
|
||||
|
@ -1665,11 +1643,7 @@ parse_options (int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'v':
|
||||
comp_info_str = get_compiled_version_info(NULL, NULL);
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
show_version("Text2pcap (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
|
|
35
tfshark.c
35
tfshark.c
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include <wsutil/clopts_common.h>
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/privileges.h>
|
||||
|
@ -228,7 +227,7 @@ glossary_option_help(void)
|
|||
|
||||
output = stdout;
|
||||
|
||||
fprintf(output, "TFShark (Wireshark) %s\n", get_ws_vcs_version_info());
|
||||
fprintf(output, "%s\n", get_appname_and_version());
|
||||
|
||||
fprintf(output, "\n");
|
||||
fprintf(output, "Usage: tfshark -G [report]\n");
|
||||
|
@ -303,8 +302,6 @@ get_tfshark_runtime_version_info(GString *str)
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *init_progfile_dir_error;
|
||||
int opt;
|
||||
static const struct option long_options[] = {
|
||||
|
@ -383,21 +380,10 @@ real_main(int argc, char *argv[])
|
|||
|
||||
initialize_funnel_ops();
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_tfshark_runtime_version_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("TFShark (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("TFShark (Wireshark)", NULL,
|
||||
epan_get_compiled_version_info,
|
||||
get_tfshark_runtime_version_info);
|
||||
|
||||
/*
|
||||
* In order to have the -X opts assigned before the wslua machine starts
|
||||
|
@ -620,10 +606,7 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'h': /* Print help and exit */
|
||||
printf("TFShark (Wireshark) %s\n"
|
||||
"Dump and analyze network traffic.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Analyze file structure.");
|
||||
print_usage(stdout);
|
||||
goto clean_exit;
|
||||
break;
|
||||
|
@ -736,11 +719,7 @@ real_main(int argc, char *argv[])
|
|||
}
|
||||
break;
|
||||
case 'v': /* Show version and exit */
|
||||
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
|
||||
runtime_info_str = get_runtime_version_info(get_tfshark_runtime_version_info);
|
||||
show_version("TFShark (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
goto clean_exit;
|
||||
case 'O': /* Only output these protocols */
|
||||
/* already processed; just ignore it now */
|
||||
|
|
39
tshark.c
39
tshark.c
|
@ -47,7 +47,6 @@
|
|||
|
||||
#include <wsutil/clopts_common.h>
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/privileges.h>
|
||||
|
@ -475,7 +474,7 @@ glossary_option_help(void)
|
|||
|
||||
output = stdout;
|
||||
|
||||
fprintf(output, "TShark (Wireshark) %s\n", get_ws_vcs_version_info());
|
||||
fprintf(output, "%s\n", get_appname_and_version());
|
||||
|
||||
fprintf(output, "\n");
|
||||
fprintf(output, "Usage: tshark -G [report]\n");
|
||||
|
@ -673,8 +672,6 @@ must_do_dissection(dfilter_t *rfcode, dfilter_t *dfcode,
|
|||
int
|
||||
real_main(int argc, char *argv[])
|
||||
{
|
||||
GString *comp_info_str;
|
||||
GString *runtime_info_str;
|
||||
char *init_progfile_dir_error;
|
||||
int opt;
|
||||
static const struct option long_options[] = {
|
||||
|
@ -799,22 +796,10 @@ real_main(int argc, char *argv[])
|
|||
#endif /* HAVE_LIBPCAP */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(get_tshark_compiled_version_info,
|
||||
epan_get_compiled_version_info);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_tshark_runtime_version_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("TShark (Wireshark) %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
/* Initialize the version information. */
|
||||
ws_init_version_info("TShark (Wireshark)", get_tshark_compiled_version_info,
|
||||
epan_get_compiled_version_info,
|
||||
get_tshark_runtime_version_info);
|
||||
|
||||
/* Fail sometimes. Useful for testing fuzz scripts. */
|
||||
/* if (g_random_int_range(0, 100) < 5) abort(); */
|
||||
|
@ -1188,10 +1173,7 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'h': /* Print help and exit */
|
||||
printf("TShark (Wireshark) %s\n"
|
||||
"Dump and analyze network traffic.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
show_help_header("Dump and analyze network traffic.");
|
||||
print_usage(stdout);
|
||||
exit_status = EXIT_SUCCESS;
|
||||
goto clean_exit;
|
||||
|
@ -1370,12 +1352,7 @@ real_main(int argc, char *argv[])
|
|||
break;
|
||||
}
|
||||
case 'v': /* Show version and exit */
|
||||
comp_info_str = get_compiled_version_info(get_tshark_compiled_version_info,
|
||||
epan_get_compiled_version_info);
|
||||
runtime_info_str = get_runtime_version_info(get_tshark_runtime_version_info);
|
||||
show_version("TShark (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
show_version();
|
||||
/* We don't really have to cleanup here, but it's a convenient way to test
|
||||
* start-up and shut-down of the epan library without any UI-specific
|
||||
* cruft getting in the way. Makes the results of running
|
||||
|
@ -3089,7 +3066,7 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
/* If we don't have an application name add Tshark */
|
||||
if (wtap_block_get_string_option_value(g_array_index(params.shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, &shb_user_appl) != WTAP_OPTTYPE_SUCCESS) {
|
||||
/* this is free'd by wtap_block_free() later */
|
||||
wtap_block_add_string_option_format(g_array_index(params.shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, "TShark (Wireshark) %s", get_ws_vcs_version_info());
|
||||
wtap_block_add_string_option_format(g_array_index(params.shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, "%s", get_appname_and_version());
|
||||
}
|
||||
|
||||
tshark_debug("tshark: writing format type %d, to %s", out_file_type, save_file);
|
||||
|
|
|
@ -63,11 +63,8 @@ commandline_print_usage(gboolean for_help_option) {
|
|||
#endif
|
||||
|
||||
if (for_help_option) {
|
||||
show_help_header("Interactively dump and analyze network traffic.");
|
||||
output = stdout;
|
||||
fprintf(output, "Wireshark %s\n"
|
||||
"Interactively dump and analyze network traffic.\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
} else {
|
||||
output = stderr;
|
||||
}
|
||||
|
@ -204,8 +201,7 @@ static void print_no_capture_support_error(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
void commandline_early_options(int argc, char *argv[],
|
||||
GString *comp_info_str, GString *runtime_info_str)
|
||||
void commandline_early_options(int argc, char *argv[])
|
||||
{
|
||||
int opt;
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
@ -305,7 +301,7 @@ void commandline_early_options(int argc, char *argv[],
|
|||
#ifdef _WIN32
|
||||
create_console();
|
||||
#endif
|
||||
show_version("Wireshark", comp_info_str, runtime_info_str);
|
||||
show_version();
|
||||
#ifdef _WIN32
|
||||
destroy_console();
|
||||
#endif
|
||||
|
|
|
@ -17,8 +17,7 @@ extern "C" {
|
|||
|
||||
extern void commandline_print_usage(gboolean for_help_option);
|
||||
|
||||
extern void commandline_early_options(int argc, char *argv[],
|
||||
GString *comp_info_str, GString *runtime_info_str);
|
||||
extern void commandline_early_options(int argc, char *argv[]);
|
||||
|
||||
/* Command-line options that don't have direct API calls to handle the data */
|
||||
typedef struct commandline_param_info
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include <wsutil/clopts_common.h>
|
||||
#include <wsutil/cmdarg_err.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/privileges.h>
|
||||
#ifdef HAVE_PLUGINS
|
||||
|
@ -380,8 +379,6 @@ int main(int argc, char *qt_argv[])
|
|||
#endif
|
||||
#endif
|
||||
gchar *err_msg = NULL;
|
||||
GString *comp_info_str = NULL;
|
||||
GString *runtime_info_str = NULL;
|
||||
|
||||
QString dfilter, read_filter;
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
@ -496,11 +493,8 @@ int main(int argc, char *qt_argv[])
|
|||
#endif /* _WIN32 */
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(get_wireshark_qt_compiled_info,
|
||||
get_gui_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_wireshark_runtime_info);
|
||||
ws_init_version_info("Wireshark", get_wireshark_qt_compiled_info,
|
||||
get_gui_compiled_info, get_wireshark_runtime_info);
|
||||
|
||||
/* Create the user profiles directory */
|
||||
if (create_profiles_dir(&rf_path) == -1) {
|
||||
|
@ -522,7 +516,7 @@ int main(int argc, char *qt_argv[])
|
|||
g_free(rf_path);
|
||||
}
|
||||
|
||||
commandline_early_options(argc, argv, comp_info_str, runtime_info_str);
|
||||
commandline_early_options(argc, argv);
|
||||
|
||||
#ifdef _WIN32
|
||||
reset_library_path();
|
||||
|
@ -554,16 +548,6 @@ int main(int argc, char *qt_argv[])
|
|||
QString cf_name;
|
||||
unsigned int in_file_type = WTAP_TYPE_AUTO;
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Wireshark %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Start windows sockets */
|
||||
result = WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
|
||||
|
|
|
@ -119,7 +119,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
|
|||
* UTF-8 string containing the name of the application used to create
|
||||
* this section.
|
||||
*/
|
||||
wtap_block_add_string_option_format(shb_hdr, OPT_SHB_USERAPPL, "Wireshark %s", get_ws_vcs_version_info());
|
||||
wtap_block_add_string_option_format(shb_hdr, OPT_SHB_USERAPPL, "%s", get_appname_and_version());
|
||||
|
||||
/* Create fake IDB info */
|
||||
exp_pdu_tap_data->idb_inf = g_new(wtapng_iface_descriptions_t,1);
|
||||
|
|
|
@ -37,9 +37,54 @@
|
|||
#include <wsutil/cpu_info.h>
|
||||
#include <wsutil/copyright_info.h>
|
||||
#include <wsutil/os_version_info.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <wsutil/plugins.h>
|
||||
|
||||
static char *appname_with_version;
|
||||
static char *comp_info;
|
||||
static char *runtime_info;
|
||||
|
||||
void
|
||||
ws_init_version_info(const char *appname,
|
||||
void (*prepend_compile_time_info)(GString *),
|
||||
void (*append_compile_time_info)(GString *),
|
||||
void (*additional_run_time_info)(GString *))
|
||||
{
|
||||
GString *comp_info_str, *runtime_info_str;
|
||||
|
||||
/*
|
||||
* Combine the supplied application name string with the
|
||||
* version - including the VCS version, for a build from
|
||||
* a checkout.
|
||||
*/
|
||||
appname_with_version = g_strdup_printf("%s %s",
|
||||
appname, get_ws_vcs_version_info());
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(prepend_compile_time_info,
|
||||
append_compile_time_info);
|
||||
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(additional_run_time_info);
|
||||
|
||||
comp_info = g_string_free(comp_info_str, FALSE);
|
||||
runtime_info = g_string_free(runtime_info_str, FALSE);
|
||||
|
||||
/* Add this information to the information to be reported on a crash. */
|
||||
ws_add_crash_info("%s\n"
|
||||
"\n"
|
||||
"%s\n"
|
||||
"%s",
|
||||
appname_with_version, comp_info, runtime_info);
|
||||
}
|
||||
|
||||
const char *
|
||||
get_appname_and_version(void)
|
||||
{
|
||||
return appname_with_version;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the string doesn't end with a newline, append one.
|
||||
* Then word-wrap it to 80 columns.
|
||||
|
@ -413,21 +458,6 @@ get_runtime_version_info(void (*additional_info)(GString *))
|
|||
return str;
|
||||
}
|
||||
|
||||
void
|
||||
show_version(const gchar *prog_name_str, GString *comp_info_str,
|
||||
GString *runtime_info_str)
|
||||
{
|
||||
ws_debug_printf("%s %s\n"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
"%s",
|
||||
prog_name_str, get_ws_vcs_version_info(), get_copyright_info(),
|
||||
comp_info_str->str, runtime_info_str->str);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a version number string for Wireshark, including, for builds
|
||||
* from a tree checked out from Wireshark's version control system,
|
||||
|
@ -454,6 +484,27 @@ get_ws_version_number(int *major, int *minor, int *micro)
|
|||
*micro = VERSION_MICRO;
|
||||
}
|
||||
|
||||
void
|
||||
show_version(void)
|
||||
{
|
||||
ws_debug_printf("%s\n"
|
||||
"\n"
|
||||
"%s\n"
|
||||
"%s\n"
|
||||
"%s",
|
||||
appname_with_version, get_copyright_info(),
|
||||
comp_info, runtime_info);
|
||||
}
|
||||
|
||||
void
|
||||
show_help_header(const char *description)
|
||||
{
|
||||
ws_debug_printf("%s\n"
|
||||
"%s\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
appname_with_version, description);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -18,6 +18,42 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Initialize information about the program for various purposes, including
|
||||
* reporting the version and build information for the program, putting
|
||||
* that information into crash dumps if possible, and giving the program
|
||||
* name and version information into capture files written by the program
|
||||
* if possible.
|
||||
*
|
||||
* "appname" is a string that appears at the beginning of the information;
|
||||
* it should include the application name, followed by "(Wireshark)" if
|
||||
* the program isn't Wireshark.
|
||||
*
|
||||
* "prepend_compile_time_info" is called at the start to prepend any
|
||||
* additional build information before the standard library information.
|
||||
*
|
||||
* "append_compile_time_info" is called at the end to append any additional
|
||||
* build information after the standard library information. This is
|
||||
* required in order to, for example, put Qt information at the
|
||||
* end of the string, as we don't use Qt in TShark.
|
||||
*
|
||||
* "additional_info" is called at the end to append any additional
|
||||
* run-time information; this is required in order to, for example,
|
||||
* put the libcap information at the end of the string, as we currently
|
||||
* don't use libcap in TShark.
|
||||
*/
|
||||
void ws_init_version_info(const char *appname,
|
||||
void (*prepend_compile_time_info)(GString *),
|
||||
void (*append_compile_time_info)(GString *),
|
||||
void (*additional_run_time_info)(GString *));
|
||||
|
||||
/*
|
||||
* Get a string giving the application name, as provided to
|
||||
* ws_init_version_info(), followed by a string giving the
|
||||
* application version.
|
||||
*/
|
||||
const char *get_appname_and_version(void);
|
||||
|
||||
/*
|
||||
* Get various library compile-time versions, put them in a GString,
|
||||
* and return the GString.
|
||||
|
@ -44,8 +80,6 @@ GString *get_compiled_version_info(void (*prepend_info)(GString *),
|
|||
*/
|
||||
GString *get_runtime_version_info(void (*additional_info)(GString *));
|
||||
|
||||
void show_version(const gchar *prog_name, GString *comp_info_str, GString *runtime_info_str);
|
||||
|
||||
/*
|
||||
* Return a version number string for Wireshark, including, for builds
|
||||
* from a tree checked out from Wireshark's version control system,
|
||||
|
@ -58,6 +92,19 @@ const char *get_ws_vcs_version_info(void);
|
|||
*/
|
||||
void get_ws_version_number(int *major, int *minor, int *micro);
|
||||
|
||||
/*
|
||||
* Show the program name and version number information on the standard
|
||||
* output; this is used for command-line "show the version" options.
|
||||
*/
|
||||
void show_version(void);
|
||||
|
||||
/*
|
||||
* Show the program name and version number information, a supplied
|
||||
* description string, and a "See {URL} for more information" message.
|
||||
* This is used for command-line "help" options.
|
||||
*/
|
||||
void show_help_header(const char *description);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -858,7 +858,7 @@ create_temp_pcapng_file(wtap *wth, int *err, gchar **err_info, nettrace_3gpp_32_
|
|||
* UTF-8 string containing the name of the application used to create
|
||||
* this section.
|
||||
*/
|
||||
wtap_block_add_string_option_format(shb_hdr, OPT_SHB_USERAPPL, "Wireshark %s", get_ws_vcs_version_info());
|
||||
wtap_block_add_string_option_format(shb_hdr, OPT_SHB_USERAPPL, "%s", get_appname_and_version());
|
||||
|
||||
/* Add header to the array */
|
||||
g_array_append_val(shb_hdrs, shb_hdr);
|
||||
|
|
Loading…
Reference in New Issue