#include <signal.h>
#endif
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include <wsutil/plugins.h>
#endif
#include <wsutil/report_err.h>
-#include <wsutil/u3.h>
#include <wsutil/unicode-utils.h>
-#include <wsutil/ws_diag_control.h>
#include <wsutil/ws_version_info.h>
#include <epan/addr_resolv.h>
#include <codecs/codecs.h>
#endif
+#ifdef HAVE_EXTCAP
+#include <extcap.h>
+#endif
+
/* general (not Qt specific) */
#include "file.h"
-#include "color.h"
-#include "color_filters.h"
+#include "epan/color_filters.h"
#include "log.h"
#include "epan/rtd_table.h"
#include "ui/util.h"
#include "ui/qt/conversation_dialog.h"
+#include "ui/qt/color_utils.h"
+#include "ui/qt/coloring_rules_dialog.h"
#include "ui/qt/endpoint_dialog.h"
#include "ui/qt/main_window.h"
#include "ui/qt/response_time_delay_dialog.h"
output = stdout;
fprintf(output, "Wireshark %s\n"
"Interactively dump and analyze network traffic.\n"
- "See http://www.wireshark.org for more information.\n",
+ "See https://www.wireshark.org for more information.\n",
get_ws_vcs_version_info());
} else {
output = stderr;
fprintf(output, "Processing:\n");
fprintf(output, " -R <read filter> packet filter in Wireshark display filter syntax\n");
fprintf(output, " -n disable all name resolutions (def: all enabled)\n");
- fprintf(output, " -N <name resolve flags> enable specific name resolution(s): \"mntC\"\n");
+ fprintf(output, " -N <name resolve flags> enable specific name resolution(s): \"mnNtd\"\n");
fprintf(output, " --disable-protocol <proto_name>\n");
fprintf(output, " disable dissection of proto_name\n");
fprintf(output, " --enable-heuristic <short_name>\n");
/* Capture libraries */
g_string_append(str, ", ");
get_compiled_caplibs_version(str);
-
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
}
// xxx copied from ../gtk/main.c
epan_get_compiled_version_info(str);
g_string_append(str, ", ");
- g_string_append(str, "without PortAudio");
+#ifdef QT_MULTIMEDIA_LIB
+ g_string_append(str, "with QtMultimedia");
+#else
+ g_string_append(str, "without QtMultimedia");
+#endif
g_string_append(str, ", ");
#ifdef HAVE_AIRPCAP
get_runtime_caplibs_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);
g_string_append(str, ", ");
get_runtime_airpcap_version(str);
#endif
-
- if(u3_active()) {
- g_string_append(str, ", ");
- u3_runtime_info(str);
- }
}
#ifdef HAVE_LIBPCAP
* Attempt to get the pathname of the executable file.
*/
/* init_progfile_dir_error = */ init_progfile_dir(ws_argv[0],
- (void *) get_gui_compiled_info);
+ (int (*)(int, char **)) get_gui_compiled_info);
g_log(NULL, G_LOG_LEVEL_DEBUG, "progfile_dir: %s", get_progfile_dir());
#ifdef _WIN32
*/
// XXX Should the remaining code be in WiresharkApplcation::WiresharkApplication?
#define OPTSTRING OPTSTRING_CAPTURE_COMMON "C:g:Hh" "jJ:kK:lm:nN:o:P:r:R:St:u:vw:X:Y:z:"
-DIAG_OFF(cast-qual)
static const struct option long_options[] = {
- {(char *)"help", no_argument, NULL, 'h'},
- {(char *)"read-file", required_argument, NULL, 'r' },
- {(char *)"read-filter", required_argument, NULL, 'R' },
- {(char *)"display-filter", required_argument, NULL, 'Y' },
- {(char *)"version", no_argument, NULL, 'v'},
+ {"help", no_argument, NULL, 'h'},
+ {"read-file", required_argument, NULL, 'r' },
+ {"read-filter", required_argument, NULL, 'R' },
+ {"display-filter", required_argument, NULL, 'Y' },
+ {"version", no_argument, NULL, 'v'},
LONGOPT_CAPTURE_COMMON
{0, 0, 0, 0 }
};
-DIAG_ON(cast-qual)
static const char optstring[] = OPTSTRING;
opterr = 0;
/* Read the profile independent recent file. We have to do this here so we can */
/* set the profile before it can be set from the command line parameter */
- recent_read_static(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_static(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open common recent file\n\"%s\": %s.",
rf_path, strerror(rf_open_errno));
+ g_free(rf_path);
}
- /* Init the "Open file" dialog directory */
- /* (do this after the path settings are processed) */
-
/* Read the profile dependent (static part) of the recent file. */
/* Only the static part of it will be read, as we don't have the gui now to fill the */
/* recent lists which is done in the dynamic part. */
/* We have to do this already here, so command line parameters can overwrite these values. */
- recent_read_profile_static(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.",
rf_path, g_strerror(rf_open_errno));
+ g_free(rf_path);
}
+ wsApp->applyCustomColorsFromRecent();
// Initialize our language
read_language_prefs();
main_w->show();
// We may not need a queued connection here but it would seem to make sense
// to force the issue.
- main_w->connect(&ws_app, SIGNAL(openCaptureFile(QString&,QString&,unsigned int)),
- main_w, SLOT(openCaptureFile(QString&,QString&,unsigned int)));
+ main_w->connect(&ws_app, SIGNAL(openCaptureFile(QString,QString,unsigned int)),
+ main_w, SLOT(openCaptureFile(QString,QString,unsigned int)));
/* Init the "Open file" dialog directory */
/* (do this after the path settings are processed) */
-
- /* Read the profile dependent (static part) of the recent file. */
- /* Only the static part of it will be read, as we don't have the gui now to fill the */
- /* recent lists which is done in the dynamic part. */
- /* We have to do this already here, so command line parameters can overwrite these values. */
- recent_read_profile_static(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "Could not open recent file\n\"%s\": %s.",
- rf_path, g_strerror(rf_open_errno));
- }
-
if (recent.gui_fileopen_remembered_dir &&
test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
wsApp->setLastOpenDir(recent.gui_fileopen_remembered_dir);
capture_opts_init(&global_capture_opts);
#endif
- init_report_err(failure_alert_box, open_failure_alert_box,
+ init_report_err(vfailure_alert_box, open_failure_alert_box,
read_failure_alert_box, write_failure_alert_box);
init_open_routines();
/* Register all the plugin types we have. */
epan_register_plugin_types(); /* Types known to libwireshark */
wtap_register_plugin_types(); /* Types known to libwiretap */
- codec_register_plugin_types(); /* Types known to libcodec */
+ codec_register_plugin_types(); /* Types known to libwscodecs */
/* Scan for plugins. This does *not* call their registration routines;
that's done later. */
"-G" flag, as the "-G" flag dumps information registered by the
dissectors, and we must do it before we read the preferences, in
case any dissectors register preferences. */
- epan_init(register_all_protocols,register_all_protocol_handoffs,
- splash_update, NULL);
+ if (!epan_init(register_all_protocols,register_all_protocol_handoffs,
+ splash_update, NULL)) {
+ SimpleDialog::displayQueuedMessages(main_w);
+ return 2;
+ }
splash_update(RA_LISTENERS, NULL, NULL);
register_all_plugin_tap_listeners();
#endif
+#ifdef HAVE_EXTCAP
+ extcap_register_preferences();
+#endif
+
register_all_tap_listeners();
conversation_table_set_gui_info(init_conversation_table);
hostlist_table_set_gui_info(init_endpoint_table);
splash_update(RA_PREFERENCES, NULL, NULL);
- prefs_p = ws_app.readConfigurationFiles(&gdp_path, &dp_path);
+ prefs_p = ws_app.readConfigurationFiles(&gdp_path, &dp_path, false);
/*
* To reset the options parser, set optreset to 1 on platforms that
/* Not supported yet */
break;
case 'n': /* No name resolution */
- gbl_resolv_flags.mac_name = FALSE;
- gbl_resolv_flags.network_name = FALSE;
- gbl_resolv_flags.transport_name = FALSE;
- gbl_resolv_flags.concurrent_dns = FALSE;
+ disable_name_resolution();
break;
case 'N': /* Select what types of addresses/port #s to resolve */
badopt = string_to_name_resolve(optarg, &gbl_resolv_flags);
if (badopt != '\0') {
- cmdarg_err("-N specifies unknown resolving option '%c'; valid options are 'm', 'n', and 't'",
+ cmdarg_err("-N specifies unknown resolving option '%c'; valid options are 'd', m', 'n', 'N', and 't'",
badopt);
exit(1);
}
// XXX Is there a better place to set the timestamp format & precision?
timestamp_set_type(recent.gui_time_format);
timestamp_set_precision(recent.gui_time_precision);
- timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
+ timestamp_set_seconds_type (recent.gui_seconds_format);
#ifdef HAVE_LIBPCAP
fill_in_local_interfaces(main_window_update);
wsApp->setMonospaceFont(prefs.gui_qt_font_name);
+ /* For update of WindowTitle (When use gui.window_title preference) */
+ main_w->setWSWindowTitle();
////////
/* Read the dynamic part of the recent file, as we have the gui now ready for
it. */
- recent_read_dynamic(&rf_path, &rf_open_errno);
- if (rf_path != NULL && rf_open_errno != 0) {
+ if (!recent_read_dynamic(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.",
rf_path, g_strerror(rf_open_errno));
+ g_free(rf_path);
}
- color_filters_enable(recent.packet_list_colorize);
+ packet_list_enable_color(recent.packet_list_colorize);
g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: fetch recent color settings");
- color_filters_enable(TRUE);
+ packet_list_enable_color(TRUE);
////////
////////
- color_filters_init();
+ gchar* err_msg = NULL;
+ if (!color_filters_init(&err_msg, color_filter_add_cb)) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg);
+ g_free(err_msg);
+ }
////////
SimpleDialog::displayQueuedMessages(main_w);
/* User could specify filename, or display filter, or both */
+ if (!dfilter.isEmpty())
+ main_w->filterPackets(dfilter, false);
if (!cf_name.isEmpty()) {
if (main_w->openCaptureFile(cf_name, read_filter, in_file_type)) {
- if (!dfilter.isEmpty())
- main_w->filterPackets(dfilter, false);
/* Open stat windows; we do so after creating the main window,
to avoid Qt warnings, and after successfully opening the
if (global_capture_opts.save_file != NULL) {
/* Save the directory name for future file dialogs. */
/* (get_dirname overwrites filename) */
- gchar *s = get_dirname(g_strdup(global_capture_opts.save_file));
- set_last_open_dir(s);
+ gchar *s = g_strdup(global_capture_opts.save_file);
+ set_last_open_dir(get_dirname(s));
g_free(s);
}
/* "-k" was specified; start a capture. */
if (global_capture_opts.ifaces->len == 0)
collect_ifaces(&global_capture_opts);
CaptureFile::globalCapFile()->window = main_w;
- if (capture_start(&global_capture_opts, main_w->captureSession(), main_window_update)) {
+ if (capture_start(&global_capture_opts, main_w->captureSession(), main_w->captureInfoData(), main_window_update)) {
/* The capture started. Open stat windows; we do so after creating
the main window, to avoid GTK warnings, and after successfully
opening the capture file, so we know we have something to compute