-/* main.cpp
+/* wireshark-qt.cpp
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
#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 "ui/util.h"
+#include "epan/color_filters.h"
#include "log.h"
+#include "epan/rtd_table.h"
+#include "epan/srt_table.h"
+
#include "ui/alert_box.h"
#include "ui/console.h"
#include "ui/iface_lists.h"
#include "ui/persfilepath_opt.h"
#include "ui/recent.h"
#include "ui/simple_dialog.h"
+#include "ui/util.h"
-#include "ui/qt/simple_dialog.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"
+#include "ui/qt/service_response_time_dialog.h"
+#include "ui/qt/simple_dialog.h"
+#include "ui/qt/simple_statistics_dialog.h"
+#include "ui/qt/splash_overlay.h"
#include "ui/qt/wireshark_application.h"
#include "caputils/capture-pcap-util.h"
#include <QTextCodec>
#endif
-#include "ui/qt/conversation_dialog.h"
-#include "ui/qt/endpoint_dialog.h"
-
-#ifdef HAVE_LIBPCAP
+#if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP)
capture_options global_capture_opts;
#endif
-#ifdef HAVE_AIRPCAP
-int airpcap_dll_ret_val = -1;
-#endif
-
GString *comp_info_str, *runtime_info_str;
/* update the main window */
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;
#ifdef HAVE_PCAP_CREATE
fprintf(output, " -I capture in monitor mode, if available\n");
#endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
fprintf(output, " -B <buffer size> size of kernel buffer (def: %dMB)\n", DEFAULT_CAPTURE_BUFFER_SIZE);
#endif
fprintf(output, " -y <link type> link layer type (def: first appropriate)\n");
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): \"mnNtCd\"\n");
+ fprintf(output, " --disable-protocol <proto_name>\n");
+ fprintf(output, " disable dissection of proto_name\n");
+ fprintf(output, " --enable-heuristic <short_name>\n");
+ fprintf(output, " enable dissection of heuristic protocol\n");
+ fprintf(output, " --disable-heuristic <short_name>\n");
+ fprintf(output, " disable dissection of heuristic protocol\n");
fprintf(output, "\n");
fprintf(output, "User interface:\n");
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
"This could be dangerous.\n\n"
"If you're running Wireshark this way in order to perform live capture, "
"you may want to be aware that there is a better way documented at\n"
- "http://wiki.wireshark.org/CaptureSetup/CapturePrivileges", cur_user, cur_group);
+ "https://wiki.wireshark.org/CaptureSetup/CapturePrivileges", cur_user, cur_group);
g_free(cur_user);
g_free(cur_group);
}
int opt;
gboolean arg_error = FALSE;
+ char **ws_argv = argv;
#ifdef _WIN32
- WSADATA wsaData;
+ WSADATA wsaData;
#endif /* _WIN32 */
char *rf_path;
guint go_to_packet = 0;
QString dfilter, read_filter;
+ GSList *disable_protocol_slist = NULL;
+ GSList *enable_heur_slist = NULL;
+ GSList *disable_heur_slist = NULL;
cmdarg_err_init(wireshark_cmdarg_err, wireshark_cmdarg_err_cont);
+ // In Qt 5, C strings are treated always as UTF-8 when converted to
+ // QStrings; in Qt 4, the codec must be set to make that happen
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+ // Hopefully we won't have to use QString::fromUtf8() in as many places.
+ QTextCodec *utf8codec = QTextCodec::codecForName("UTF-8");
+ QTextCodec::setCodecForCStrings(utf8codec);
+ // XXX - QObject doesn't *have* a tr method in 5.0, as far as I can see...
+ QTextCodec::setCodecForTr(utf8codec);
+#endif
+
+ /* Set the C-language locale to the native environment. */
+ // The GTK+ UI calls this. Should we as well?
+ //setlocale(LC_ALL, "");
#ifdef _WIN32
+ // QCoreApplication clobbers argv. Let's have a local copy.
+ ws_argv = (char **) g_malloc(sizeof(char *) * argc);
+ for (opt = 0; opt < argc; opt++) {
+ ws_argv[opt] = argv[opt];
+ }
+ arg_list_utf_16to8(argc, ws_argv);
create_app_running_mutex();
-#endif
+#endif /* _WIN32 */
/*
* Get credential information for later use, and drop privileges
/*
* Attempt to get the pathname of the executable file.
*/
- /* init_progfile_dir_error = */ init_progfile_dir(argv[0], main);
+ /* init_progfile_dir_error = */ init_progfile_dir(ws_argv[0],
+ (int (*)(int, char **)) get_gui_compiled_info);
g_log(NULL, G_LOG_LEVEL_DEBUG, "progfile_dir: %s", get_progfile_dir());
+#ifdef _WIN32
+ /* Load wpcap if possible. Do this before collecting the run-time version information */
+ load_wpcap();
+
+ /* ... and also load the packet.dll from wpcap */
+ wpcap_packet_load();
+
+#ifdef HAVE_AIRPCAP
+ /* Load the airpcap.dll. This must also be done before collecting
+ * run-time version information. */
+ load_airpcap();
+#if 0
+ airpcap_dll_ret_val = load_airpcap();
+
+ switch (airpcap_dll_ret_val) {
+ case AIRPCAP_DLL_OK:
+ /* load the airpcap interfaces */
+ g_airpcap_if_list = get_airpcap_interface_list(&err, &err_str);
+
+ if (g_airpcap_if_list == NULL || g_list_length(g_airpcap_if_list) == 0){
+ if (err == CANT_GET_AIRPCAP_INTERFACE_LIST && err_str != NULL) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", "Failed to open Airpcap Adapters.");
+ g_free(err_str);
+ }
+ airpcap_if_active = NULL;
+
+ } else {
+
+ /* select the first ad default (THIS SHOULD BE CHANGED) */
+ airpcap_if_active = airpcap_get_default_if(airpcap_if_list);
+ }
+ break;
+ /*
+ * XXX - Maybe we need to warn the user if one of the following happens???
+ */
+ case AIRPCAP_DLL_OLD:
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_OLD\n");
+ break;
+
+ case AIRPCAP_DLL_ERROR:
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_ERROR\n");
+ break;
+
+ case AIRPCAP_DLL_NOT_FOUND:
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DDL_NOT_FOUND\n");
+ break;
+ }
+#endif
+#endif /* HAVE_AIRPCAP */
+#endif /* _WIN32 */
+
/* Get the compile-time version information string */
// XXX qtshark
comp_info_str = get_compiled_version_info(get_wireshark_qt_compiled_info,
// 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:"
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 }
};
opterr = 0;
- while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, ws_argv, optstring, long_options, NULL)) != -1) {
switch (opt) {
case 'C': /* Configuration Profile */
if (profile_exists (optarg, FALSE)) {
AirPDcapInitContext(&airpdcap_ctx);
-// xxx qtshark
-#ifdef _WIN32
- /* Load wpcap if possible. Do this before collecting the run-time version information */
- load_wpcap();
-
- /* ... and also load the packet.dll from wpcap */
- wpcap_packet_load();
-
-#ifdef HAVE_AIRPCAP
- /* Load the airpcap.dll. This must also be done before collecting
- * run-time version information. */
- airpcap_dll_ret_val = load_airpcap();
-
- switch (airpcap_dll_ret_val) {
- case AIRPCAP_DLL_OK:
- /* load the airpcap interfaces */
- airpcap_if_list = get_airpcap_interface_list(&err, &err_str);
-
- if (airpcap_if_list == NULL || g_list_length(airpcap_if_list) == 0){
- if (err == CANT_GET_AIRPCAP_INTERFACE_LIST && err_str != NULL) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", "Failed to open Airpcap Adapters.");
- g_free(err_str);
- }
- airpcap_if_active = NULL;
-
- } else {
-
- /* select the first ad default (THIS SHOULD BE CHANGED) */
- airpcap_if_active = airpcap_get_default_if(airpcap_if_list);
- }
- break;
-#if 0
- /*
- * XXX - Maybe we need to warn the user if one of the following happens???
- */
- case AIRPCAP_DLL_OLD:
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_OLD\n");
- break;
-
- case AIRPCAP_DLL_ERROR:
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_ERROR\n");
- break;
-
- case AIRPCAP_DLL_NOT_FOUND:
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DDL_NOT_FOUND\n");
- break;
-#endif
- }
-#endif /* HAVE_AIRPCAP */
-#endif /* _WIN32 */
-
QString locale;
QString cf_name;
unsigned int in_file_type = WTAP_TYPE_AUTO;
- // In Qt 5, C strings are treated always as UTF-8 when converted to
- // QStrings; in Qt 4, the codec must be set to make that happen
-#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
- // Hopefully we won't have to use QString::fromUtf8() in as many places.
- QTextCodec *utf8codec = QTextCodec::codecForName("UTF-8");
- QTextCodec::setCodecForCStrings(utf8codec);
- // XXX - QObject doesn't *have* a tr method in 5.0, as far as I can see...
- QTextCodec::setCodecForTr(utf8codec);
-#endif
-
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Wireshark %s\n"
"\n"
/* 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);
}
- wsApp->emitAppSignal(WiresharkApplication::StaticRecentFilesRead);
-
- /* 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));
- }
- wsApp->emitAppSignal(WiresharkApplication::StaticRecentFilesRead);
-
if (recent.gui_fileopen_remembered_dir &&
test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
wsApp->setLastOpenDir(recent.gui_fileopen_remembered_dir);
/* 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);
/* we register the plugin taps before the other taps because
stats_tree taps plugins will be registered as tap listeners
by stats_tree_stat.c and need to registered before that */
-
- g_log(NULL, G_LOG_LEVEL_DEBUG, "plugin_dir: %s", get_plugin_dir());
#ifdef HAVE_PLUGINS
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);
+ srt_table_iterate_tables(register_service_response_tables, NULL);
+ rtd_table_iterate_tables(register_response_time_delay_tables, NULL);
+ new_stat_tap_iterate_tables(register_simple_stat_tables, NULL);
if (ex_opt_count("read_format") > 0) {
in_file_type = open_info_name_to_type(ex_opt_get_next("read_format"));
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
opterr = 1;
/* Now get our args */
- while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, ws_argv, optstring, long_options, NULL)) != -1) {
switch (opt) {
/*** capture option specific ***/
case 'a': /* autostop criteria */
case 'S': /* "Sync" mode: used for following file ala tail -f */
case 'w': /* Write to capture file xxx */
case 'y': /* Set the pcap data link type */
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
case 'B': /* Buffer size */
-#endif /* _WIN32 or HAVE_PCAP_CREATE */
+#endif
#ifdef HAVE_LIBPCAP
status = capture_opts_add_opt(&global_capture_opts, opt, optarg,
&start_capture);
/* 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 'C', 'd', m', 'n', 'N', and 't'",
badopt);
exit(1);
}
exit(1);
}
break;
+ case LONGOPT_DISABLE_PROTOCOL: /* disable dissection of protocol */
+ disable_protocol_slist = g_slist_append(disable_protocol_slist, optarg);
+ break;
+ case LONGOPT_ENABLE_HEURISTIC: /* enable heuristic dissection of protocol */
+ enable_heur_slist = g_slist_append(enable_heur_slist, optarg);
+ break;
+ case LONGOPT_DISABLE_HEURISTIC: /* disable heuristic dissection of protocol */
+ disable_heur_slist = g_slist_append(disable_heur_slist, optarg);
+ break;
+
default:
case '?': /* Bad flag - print usage message */
print_usage(FALSE);
if (!arg_error) {
argc -= optind;
- argv += optind;
+ ws_argv += optind;
if (argc >= 1) {
if (!cf_name.isEmpty()) {
/*
* file - yes, you could have "-r" as the last part of the command,
* but that's a bit ugly.
*/
- cf_name = argv[0];
+ cf_name = ws_argv[0];
}
argc--;
- argv++;
+ ws_argv++;
}
if (argc != 0) {
/*
* Extra command line arguments were specified; complain.
*/
- cmdarg_err("Invalid argument: %s", argv[0]);
+ cmdarg_err("Invalid argument: %s", ws_argv[0]);
arg_error = TRUE;
}
}
// 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);
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if (device.selected) {
#if defined(HAVE_PCAP_CREATE)
- caps = capture_get_if_capabilities(device.name, device.monitor_mode_supported, &err_str, main_window_update);
+ caps = capture_get_if_capabilities(device.name, device.monitor_mode_supported, NULL, &err_str, main_window_update);
#else
- caps = capture_get_if_capabilities(device.name, FALSE, &err_str,main_window_update);
+ caps = capture_get_if_capabilities(device.name, FALSE, NULL, &err_str,main_window_update);
#endif
if (caps == NULL) {
cmdarg_err("%s", err_str);
/* disabled protocols as per configuration file */
if (gdp_path == NULL && dp_path == NULL) {
set_disabled_protos_list();
+ set_disabled_heur_dissector_list();
+ }
+
+ if(disable_protocol_slist) {
+ GSList *proto_disable;
+ for (proto_disable = disable_protocol_slist; proto_disable != NULL; proto_disable = g_slist_next(proto_disable))
+ {
+ proto_disable_proto_by_name((char*)proto_disable->data);
+ }
+ }
+
+ if(enable_heur_slist) {
+ GSList *heur_enable;
+ for (heur_enable = enable_heur_slist; heur_enable != NULL; heur_enable = g_slist_next(heur_enable))
+ {
+ proto_enable_heuristic_by_name((char*)heur_enable->data, TRUE);
+ }
+ }
+
+ if(disable_heur_slist) {
+ GSList *heur_disable;
+ for (heur_disable = disable_heur_slist; heur_disable != NULL; heur_disable = g_slist_next(heur_disable))
+ {
+ proto_enable_heuristic_by_name((char*)heur_disable->data, FALSE);
+ }
}
build_column_format_array(&CaptureFile::globalCapFile()->cinfo, prefs_p->num_cols, TRUE);
+ wsApp->emitAppSignal(WiresharkApplication::ColumnsChanged); // We read "recent" widths above.
+ wsApp->emitAppSignal(WiresharkApplication::RecentFilesRead); // Must be emitted after PreferencesChanged.
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);
+ }
////////
////////
#endif /* HAVE_LIBPCAP */
-// w->setEnabled(true);
wsApp->allSystemsGo();
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_INFO, "Wireshark is up and ready to go");
SimpleDialog::displayQueuedMessages(main_w);
- /* user could specify filename, or display filter, or both */
+ /* User could specify filename, or display filter, or both */
+ if (!dfilter.isEmpty())
+ main_w->filterPackets(dfilter, false);
if (!cf_name.isEmpty()) {
-
- /* Open stat windows; we do so after creating the main window,
- to avoid Qt warnings, and after successfully opening the
- capture file, so we know we have something to compute stats
- on, and after registering all dissectors, so that MATE will
- have registered its field array and we can have a tap filter
- with one of MATE's late-registered fields as part of the
- filter. */
- start_requested_stats();
-
- // XXX The GTK+ UI does error checking here.
- main_w->openCaptureFile(cf_name, read_filter, in_file_type);
- if (!dfilter.isEmpty())
- main_w->filterPackets(dfilter, false);
- if(go_to_packet != 0) {
- /* Jump to the specified frame number, kept for backward
- compatibility. */
- cf_goto_frame(CaptureFile::globalCapFile(), go_to_packet);
+ if (main_w->openCaptureFile(cf_name, read_filter, in_file_type)) {
+
+ /* Open stat windows; we do so after creating the main window,
+ to avoid Qt warnings, and after successfully opening the
+ capture file, so we know we have something to compute stats
+ on, and after registering all dissectors, so that MATE will
+ have registered its field array and we can have a tap filter
+ with one of MATE's late-registered fields as part of the
+ filter. */
+ start_requested_stats();
+
+ if(go_to_packet != 0) {
+ /* Jump to the specified frame number, kept for backward
+ compatibility. */
+ cf_goto_frame(CaptureFile::globalCapFile(), go_to_packet);
+ }
}
}
#ifdef HAVE_LIBPCAP
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
}
#endif /* HAVE_LIBPCAP */
- g_main_loop_new(NULL, FALSE);
return wsApp->exec();
}