5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "wireshark_application.h"
25 #include "main_window.h"
34 # include "wsutil/wsgetopt.h"
39 #include <wsutil/crash_info.h>
40 #include <wsutil/u3.h>
41 #include <wsutil/file_util.h>
43 #include <wiretap/merge.h>
45 #include <epan/epan.h>
46 #include <epan/filesystem.h>
47 #include <wsutil/privileges.h>
48 #include <epan/epan_dissect.h>
49 #include <epan/timestamp.h>
50 #include <epan/packet.h>
51 #include <epan/plugins.h>
52 #include <epan/dfilter/dfilter.h>
53 #include <epan/strutil.h>
54 #include <epan/addr_resolv.h>
55 #include <epan/emem.h>
56 #include <epan/ex-opt.h>
57 #include <epan/funnel.h>
58 #include <epan/expert.h>
59 #include <epan/frequency-utils.h>
60 #include <epan/prefs.h>
61 #include <epan/prefs-int.h>
63 #include <epan/stat_cmd_args.h>
65 #include <epan/column.h>
66 #include <epan/disabled_protos.h>
67 #include <epan/print.h>
69 /* general (not Qt specific) */
73 #include "color_filters.h"
75 #include "ringbuffer.h"
77 #include "clopts_common.h"
78 #include "cmdarg_err.h"
79 #include "version_info.h"
82 #include "ui/alert_box.h"
83 #include "ui/capture_globals.h"
84 #include "ui/iface_lists.h"
85 #include "ui/main_statusbar.h"
86 #include "ui/recent.h"
87 #include "ui/simple_dialog.h"
88 #include "ui/ui_util.h"
91 # include "capture_ui_utils.h"
92 # include "capture-pcap-util.h"
93 # include "capture_ifinfo.h"
95 # include "capture_sync.h"
99 # include "capture-wpcap.h"
100 # include "capture_wpcap_packet.h"
101 # include <tchar.h> /* Needed for Unicode */
102 # include <wsutil/unicode-utils.h>
103 # include <commctrl.h>
104 # include <shellapi.h>
106 # include "ui/win32/console_win32.h"
110 # include <airpcap.h>
111 # include "airpcap_loader.h"
112 //# include "airpcap_dlg.h"
113 //# include "airpcap_gui_utils.h"
116 #include <epan/crypt/airpdcap_ws.h>
120 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
121 #include <QTextCodec>
123 #include <qtranslator.h>
125 #include <qlibraryinfo.h>
128 capture_options global_capture_opts
;
129 capture_session global_capture_session
;
135 int airpcap_dll_ret_val
= -1;
138 GString
*comp_info_str
, *runtime_info_str
;
140 //static gboolean have_capture_file = FALSE; /* XXX - is there an equivalent in cfile? */
142 //static guint tap_update_timer_id;
144 static void console_log_handler(const char *log_domain
,
145 GLogLevelFlags log_level
, const char *message
, gpointer user_data
);
149 extern capture_options global_capture_opts
;
152 main_capture_callback(gint event
, capture_session
*cap_session
, gpointer user_data
)
155 wsApp
->captureCallback(event
, cap_session
);
157 #endif // HAVE_LIBPCAP
160 main_cf_callback(gint event
, gpointer data
, gpointer user_data
)
163 wsApp
->captureFileCallback(event
, data
);
166 /* update the main window */
167 void main_window_update(void)
169 WiresharkApplication::processEvents();
174 /* quit a nested main window */
175 void main_window_nested_quit(void)
177 // if (gtk_main_level() > 0)
181 /* quit the main window */
182 void main_window_quit(void)
187 #endif /* HAVE_LIBPCAP */
190 // xxx copied from ../gtk/main.c
192 print_usage(gboolean print_ver
) {
201 fprintf(output
, "Wireshark " VERSION
"%s\n"
202 "Interactively dump and analyze network traffic.\n"
203 "See http://www.wireshark.org for more information.\n"
206 wireshark_svnversion
, get_copyright_info());
210 fprintf(output
, "\n");
211 fprintf(output
, "Usage: wireshark [options] ... [ <infile> ]\n");
212 fprintf(output
, "\n");
215 fprintf(output
, "Capture interface:\n");
216 fprintf(output
, " -i <interface> name or idx of interface (def: first non-loopback)\n");
217 fprintf(output
, " -f <capture filter> packet filter in libpcap filter syntax\n");
218 fprintf(output
, " -s <snaplen> packet snapshot length (def: 65535)\n");
219 fprintf(output
, " -p don't capture in promiscuous mode\n");
220 fprintf(output
, " -k start capturing immediately (def: do nothing)\n");
221 fprintf(output
, " -Q quit Wireshark after capturing\n");
222 fprintf(output
, " -S update packet display when new packets are captured\n");
223 fprintf(output
, " -l turn on automatic scrolling while -S is in use\n");
224 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
225 fprintf(output
, " -B <buffer size> size of kernel buffer (def: %dMB)\n", DEFAULT_CAPTURE_BUFFER_SIZE
);
227 fprintf(output
, " -y <link type> link layer type (def: first appropriate)\n");
228 fprintf(output
, " -D print list of interfaces and exit\n");
229 fprintf(output
, " -L print list of link-layer types of iface and exit\n");
230 fprintf(output
, "\n");
231 fprintf(output
, "Capture stop conditions:\n");
232 fprintf(output
, " -c <packet count> stop after n packets (def: infinite)\n");
233 fprintf(output
, " -a <autostop cond.> ... duration:NUM - stop after NUM seconds\n");
234 fprintf(output
, " filesize:NUM - stop this file after NUM KB\n");
235 fprintf(output
, " files:NUM - stop after NUM files\n");
236 /*fprintf(output, "\n");*/
237 fprintf(output
, "Capture output:\n");
238 fprintf(output
, " -b <ringbuffer opt.> ... duration:NUM - switch to next file after NUM secs\n");
239 fprintf(output
, " filesize:NUM - switch to next file after NUM KB\n");
240 fprintf(output
, " files:NUM - ringbuffer: replace after NUM files\n");
241 #endif /* HAVE_LIBPCAP */
243 /*fprintf(output, "\n");*/
244 fprintf(output
, "Input file:\n");
245 fprintf(output
, " -r <infile> set the filename to read from (no pipes or stdin!)\n");
247 fprintf(output
, "\n");
248 fprintf(output
, "Processing:\n");
249 fprintf(output
, " -R <read filter> packet filter in Wireshark display filter syntax\n");
250 fprintf(output
, " -n disable all name resolutions (def: all enabled)\n");
251 fprintf(output
, " -N <name resolve flags> enable specific name resolution(s): \"mntC\"\n");
253 fprintf(output
, "\n");
254 fprintf(output
, "User interface:\n");
255 fprintf(output
, " -C <config profile> start with specified configuration profile\n");
256 fprintf(output
, " -g <packet number> go to specified packet number after \"-r\"\n");
257 fprintf(output
, " -J <jump filter> jump to the first packet matching the (display)\n");
258 fprintf(output
, " filter\n");
259 fprintf(output
, " -j search backwards for a matching packet after \"-J\"\n");
260 fprintf(output
, " -m <font> set the font name used for most text\n");
261 fprintf(output
, " -t ad|a|r|d|dd|e output format of time stamps (def: r: rel. to first)\n");
262 fprintf(output
, " -u s|hms output format of seconds (def: s: seconds)\n");
263 fprintf(output
, " -X <key>:<value> eXtension options, see man page for details\n");
264 fprintf(output
, " -z <statistics> show various statistics, see man page for details\n");
266 fprintf(output
, "\n");
267 fprintf(output
, "Output:\n");
268 fprintf(output
, " -w <outfile|-> set the output filename (or '-' for stdout)\n");
270 fprintf(output
, "\n");
271 fprintf(output
, "Miscellaneous:\n");
272 fprintf(output
, " -h display this help and exit\n");
273 fprintf(output
, " -v display version info and exit\n");
274 fprintf(output
, " -P <key>:<path> persconf:path - personal configuration files\n");
275 fprintf(output
, " persdata:path - personal data files\n");
276 fprintf(output
, " -o <name>:<value> ... override preference or recent setting\n");
277 fprintf(output
, " -K <keytab> keytab file to use for kerberos decryption\n");
279 fprintf(output
, " --display=DISPLAY X display to use\n");
287 // xxx copied from ../gtk/main.c
291 printf(PACKAGE
" " VERSION
"%s\n"
298 wireshark_svnversion
, get_copyright_info(), comp_info_str
->str
,
299 runtime_info_str
->str
);
303 * Report an error in command-line arguments.
304 * Creates a console on Windows.
306 // xxx copied from ../gtk/main.c
308 cmdarg_err(const char *fmt
, ...)
315 fprintf(stderr
, "wireshark: ");
317 vfprintf(stderr
, fmt
, ap
);
319 fprintf(stderr
, "\n");
323 * Report additional information for an error in command-line arguments.
324 * Creates a console on Windows.
325 * XXX - pop this up in a window of some sort on UNIX+X11 if the controlling
326 * terminal isn't the standard error?
328 // xxx copied from ../gtk/main.c
330 cmdarg_err_cont(const char *fmt
, ...)
338 vfprintf(stderr
, fmt
, ap
);
339 fprintf(stderr
, "\n");
344 console_log_handler(const char *log_domain
, GLogLevelFlags log_level
,
345 const char *message
, gpointer user_data
)
349 QString hmsz
= QDateTime::currentDateTime().toString("hh:mm:ss.zzz");
351 // xxx qtshark: We want all of the messages for now.
352 // /* ignore log message, if log_level isn't interesting based
353 // upon the console log preferences.
354 // If the preferences haven't been loaded loaded yet, display the
357 // The default console_log_level preference value is such that only
358 // ERROR, CRITICAL and WARNING level messages are processed;
359 // MESSAGE, INFO and DEBUG level messages are ignored. */
360 // if((log_level & G_LOG_LEVEL_MASK & prefs.console_log_level) == 0 &&
361 // prefs.console_log_level != 0) {
364 switch(log_level
& G_LOG_LEVEL_MASK
) {
365 case G_LOG_LEVEL_ERROR
:
368 case G_LOG_LEVEL_CRITICAL
:
371 case G_LOG_LEVEL_WARNING
:
374 case G_LOG_LEVEL_MESSAGE
:
377 case G_LOG_LEVEL_INFO
:
380 case G_LOG_LEVEL_DEBUG
:
384 qDebug("%s unknown log_level %u", hmsz
.toUtf8().constData(), log_level
);
385 g_assert_not_reached();
388 qDebug("%s %s %s %s", hmsz
.toUtf8().constData(), log_domain
, level
.toUtf8().constData(), message
);
391 // xxx based from ../gtk/main.c:get_gtk_compiled_info
393 get_qt_compiled_info(GString
*str
)
395 g_string_append(str
, "with ");
396 g_string_append_printf(str
,
398 "Qt %s ", QT_VERSION_STR
);
400 "Qt (version unknown) ");
404 // xxx copied from ../gtk/main.c
406 get_gui_compiled_info(GString
*str
)
408 epan_get_compiled_version_info(str
);
410 g_string_append(str
, ", ");
411 g_string_append(str
, "without PortAudio");
413 g_string_append(str
, ", ");
415 get_compiled_airpcap_version(str
);
417 g_string_append(str
, "without AirPcap");
421 // xxx copied from ../gtk/main.c
423 get_gui_runtime_info(GString
*str
)
425 epan_get_runtime_version_info(str
);
428 g_string_append(str
, ", ");
429 get_runtime_airpcap_version(str
);
434 g_string_append(str
, ", ");
435 u3_runtime_info(str
);
440 /* And now our feature presentation... [ fade to music ] */
441 int main(int argc
, char *argv
[])
443 WiresharkApplication
ws_app(argc
, argv
);
447 gboolean arg_error
= FALSE
;
455 char *gdp_path
, *dp_path
;
458 gboolean start_capture
= FALSE
;
459 // gboolean list_link_layer_types = FALSE;
463 gboolean capture_option_specified
= FALSE
;
471 GLogLevelFlags log_flags
;
475 create_app_running_mutex();
479 QString
*cf_name
= NULL
;
481 // In Qt 5, C strings are treated always as UTF-8 when converted to
482 // QStrings; in Qt 4, the codec must be set to make that happen
483 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
484 // Hopefully we won't have to use QString::fromUtf8() in as many places.
485 QTextCodec
*utf8codec
= QTextCodec::codecForName("UTF-8");
486 QTextCodec::setCodecForCStrings(utf8codec
);
487 // XXX - QObject doesn't *have* a tr method in 5.0, as far as I can see...
488 QTextCodec::setCodecForTr(utf8codec
);
491 // Init the main window (and splash)
492 main_w
= new(MainWindow
);
494 // We may not need a queued connection here but it would seem to make sense
495 // to force the issue.
496 main_w
->connect(&ws_app
, SIGNAL(openCaptureFile(QString
&)),
497 main_w
, SLOT(openCaptureFile(QString
&)));
499 // XXX Should the remaining code be in WiresharkApplcation::WiresharkApplication?
501 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
502 #define OPTSTRING_B "B:"
504 #define OPTSTRING_B ""
505 #endif /* _WIN32 or HAVE_PCAP_CREATE */
506 #else /* HAVE_LIBPCAP */
507 #define OPTSTRING_B ""
508 #endif /* HAVE_LIBPCAP */
510 #ifdef HAVE_PCAP_CREATE
511 #define OPTSTRING_I "I"
513 #define OPTSTRING_I ""
516 #define OPTSTRING "a:b:" OPTSTRING_B "c:C:Df:g:Hhi:" OPTSTRING_I "jJ:kK:lLm:nN:o:P:pQr:R:Ss:t:u:vw:X:y:z:"
518 struct option long_options
[] = {
519 {(char *)"read-file", required_argument
, NULL
, (int)'r' },
523 static const char optstring
[] = OPTSTRING
;
525 /* Assemble the compile-time version information string */
526 comp_info_str
= g_string_new("Compiled ");
529 get_compiled_version_info(comp_info_str
, get_qt_compiled_info
, get_gui_compiled_info
);
531 /* Assemble the run-time version information string */
532 runtime_info_str
= g_string_new("Running ");
534 get_runtime_version_info(runtime_info_str
, get_gui_runtime_info
);
536 ws_add_crash_info(PACKAGE
" " VERSION
"%s\n"
541 wireshark_svnversion
, comp_info_str
->str
, runtime_info_str
->str
);
544 * Get credential information for later use, and drop privileges
545 * before doing anything else.
546 * Let the user know if anything happened.
548 init_process_policies();
549 relinquish_special_privs_perm();
552 * Attempt to get the pathname of the executable file.
554 /* init_progfile_dir_error = */ init_progfile_dir(QCoreApplication::applicationFilePath().toUtf8().constData(), NULL
);
555 g_log(NULL
, G_LOG_LEVEL_DEBUG
, "progfile_dir: %s", get_progfile_dir());
557 /* initialize the funnel mini-api */
559 //initialize_funnel_ops();
561 AirPDcapInitContext(&airpdcap_ctx
);
565 /* Load wpcap if possible. Do this before collecting the run-time version information */
568 /* ... and also load the packet.dll from wpcap */
572 /* Load the airpcap.dll. This must also be done before collecting
573 * run-time version information. */
574 airpcap_dll_ret_val
= load_airpcap();
576 switch (airpcap_dll_ret_val
) {
578 /* load the airpcap interfaces */
579 airpcap_if_list
= get_airpcap_interface_list(&err
, &err_str
);
581 if (airpcap_if_list
== NULL
|| g_list_length(airpcap_if_list
) == 0){
582 if (err
== CANT_GET_AIRPCAP_INTERFACE_LIST
&& err_str
!= NULL
) {
583 simple_dialog(ESD_TYPE_ERROR
, ESD_BTN_OK
, "%s", "Failed to open Airpcap Adapters!");
586 airpcap_if_active
= NULL
;
590 /* select the first ad default (THIS SHOULD BE CHANGED) */
591 airpcap_if_active
= airpcap_get_default_if(airpcap_if_list
);
596 * XXX - Maybe we need to warn the user if one of the following happens???
598 case AIRPCAP_DLL_OLD
:
599 simple_dialog(ESD_TYPE_ERROR
, ESD_BTN_OK
, "%s","AIRPCAP_DLL_OLD\n");
602 case AIRPCAP_DLL_ERROR
:
603 simple_dialog(ESD_TYPE_ERROR
, ESD_BTN_OK
, "%s","AIRPCAP_DLL_ERROR\n");
606 case AIRPCAP_DLL_NOT_FOUND
:
607 simple_dialog(ESD_TYPE_ERROR
, ESD_BTN_OK
, "%s","AIRPCAP_DDL_NOT_FOUND\n");
611 #endif /* HAVE_AIRPCAP */
613 /* Start windows sockets */
614 WSAStartup( MAKEWORD( 1, 1 ), &wsaData
);
617 profile_store_persconffiles (TRUE
);
619 /* Read the profile independent recent file. We have to do this here so we can */
620 /* set the profile before it can be set from the command line parameterts */
621 recent_read_static(&rf_path
, &rf_open_errno
);
622 if (rf_path
!= NULL
&& rf_open_errno
!= 0) {
623 simple_dialog(ESD_TYPE_WARN
, ESD_BTN_OK
,
624 "Could not open common recent file\n\"%s\": %s.",
625 rf_path
, strerror(rf_open_errno
));
627 wsApp
->emitAppSignal(WiresharkApplication::StaticRecentFilesRead
);
629 while ((opt
= getopt_long(argc
, argv
, optstring
, long_options
, NULL
)) != -1) {
631 case 'C': /* Configuration Profile */
632 if (profile_exists (optarg
, FALSE
)) {
633 set_profile_name (optarg
);
635 cmdarg_err("Configuration Profile \"%s\" does not exist", optarg
);
639 case 'D': /* Print a list of capture devices and exit */
641 if_list
= capture_interface_list(&err
, &err_str
, main_window_update
);
642 if (if_list
== NULL
) {
644 case CANT_GET_INTERFACE_LIST
:
645 cmdarg_err("%s", err_str
);
649 case NO_INTERFACES_FOUND
:
650 cmdarg_err("There are no interfaces on which a capture can be done");
658 capture_opts_print_interfaces(if_list
);
659 free_interface_list(if_list
);
664 #else /* HAVE_LIBPCAP */
665 capture_option_specified
= TRUE
;
667 #endif /* HAVE_LIBPCAP */
669 case 'h': /* Print help and exit */
675 if (strcmp(optarg
, "-") == 0)
676 set_stdin_capture(TRUE
);
679 case 'P': /* Path settings - change these before the Preferences and alike are processed */
680 status
= filesystem_opt(opt
, optarg
);
682 cmdarg_err("-P flag \"%s\" failed (hint: is it quoted and existing?)", optarg
);
686 case 'v': /* Show version and exit */
697 cf_name
= new QString(optarg
);
701 * Extension command line options have to be processed before
702 * we call epan_init() as they are supposed to be used by dissectors
703 * or taps very early in the registration process.
718 if (cf_name
!= NULL
) {
720 * Input file name specified with "-r" *and* specified as a regular
721 * command-line argument.
723 cmdarg_err("File name specified both with -r and regular argument");
727 * Input file name not specified with "-r", and a command-line argument
728 * was specified; treat it as the input file name.
730 * Yes, this is different from tshark, where non-flag command-line
731 * arguments are a filter, but this works better on GUI desktops
732 * where a command can be specified to be run to open a particular
733 * file - yes, you could have "-r" as the last part of the command,
734 * but that's a bit ugly.
736 cf_name
= new QString(g_strdup(argv
[0]));
745 * Extra command line arguments were specified; complain.
747 cmdarg_err("Invalid argument: %s", argv
[0]);
753 if (capture_option_specified
) {
754 cmdarg_err("This version of Wireshark was not built with support for capturing packets.");
761 /* Init the "Open file" dialog directory */
762 /* (do this after the path settings are processed) */
764 /* Read the profile dependent (static part) of the recent file. */
765 /* Only the static part of it will be read, as we don't have the gui now to fill the */
766 /* recent lists which is done in the dynamic part. */
767 /* We have to do this already here, so command line parameters can overwrite these values. */
768 recent_read_profile_static(&rf_path
, &rf_open_errno
);
769 if (rf_path
!= NULL
&& rf_open_errno
!= 0) {
770 simple_dialog(ESD_TYPE_WARN
, ESD_BTN_OK
,
771 "Could not open recent file\n\"%s\": %s.",
772 rf_path
, g_strerror(rf_open_errno
));
775 if (recent
.gui_fileopen_remembered_dir
&&
776 test_for_directory(recent
.gui_fileopen_remembered_dir
) == EISDIR
) {
777 wsApp
->setLastOpenDir(recent
.gui_fileopen_remembered_dir
);
779 wsApp
->setLastOpenDir(get_persdatafile_dir());
783 capture_callback_add(main_capture_callback
, NULL
);
785 cf_callback_add(main_cf_callback
, NULL
);
787 /* Arrange that if we have no console window, and a GLib message logging
788 routine is called to log a message, we pop up a console window.
790 We do that by inserting our own handler for all messages logged
791 to the default domain; that handler pops up a console if necessary,
792 and then calls the default handler. */
794 /* We might want to have component specific log levels later ... */
796 log_flags
= (GLogLevelFlags
) (
798 G_LOG_LEVEL_CRITICAL
|
803 G_LOG_FLAG_FATAL
|G_LOG_FLAG_RECURSION
);
805 g_log_set_handler(NULL
,
807 console_log_handler
, NULL
/* user_data */);
808 g_log_set_handler(LOG_DOMAIN_MAIN
,
810 console_log_handler
, NULL
/* user_data */);
813 g_log_set_handler(LOG_DOMAIN_CAPTURE
,
815 console_log_handler
, NULL
/* user_data */);
816 g_log_set_handler(LOG_DOMAIN_CAPTURE_CHILD
,
818 console_log_handler
, NULL
/* user_data */);
820 /* Set the initial values in the capture options. This might be overwritten
821 by preference settings and then again by the command line parameters. */
822 capture_opts_init(&global_capture_opts
);
824 capture_session_init(&global_capture_session
, (void *)&cfile
);
827 /* Register all dissectors; we must do this before checking for the
828 "-G" flag, as the "-G" flag dumps information registered by the
829 dissectors, and we must do it before we read the preferences, in
830 case any dissectors register preferences. */
831 epan_init(register_all_protocols
,register_all_protocol_handoffs
,
833 failure_alert_box
,open_failure_alert_box
,read_failure_alert_box
,
834 write_failure_alert_box
837 splash_update(RA_PREFERENCES
, NULL
, NULL
);
838 prefs_p
= ws_app
.readConfigurationFiles (&gdp_path
, &dp_path
);
840 //initialize language !
842 /*TODO: Enhance... may be get the locale from the enum gui_qt_language */
843 switch(prefs_p
->gui_qt_language
){
844 case 1: /* English */
853 case 4: /* Chinese */
856 default: /* Auto-Detect */
857 locale
= QLocale::system().name();
860 g_log(LOG_DOMAIN_MAIN
, G_LOG_LEVEL_DEBUG
, "Translator %s", locale
.toStdString().c_str());
861 QTranslator translator
;
862 translator
.load(QString(":/i18n/qtshark_") + locale
);
863 wsApp
->installTranslator(&translator
);
865 QTranslator qtTranslator
;
866 qtTranslator
.load("qt_" + locale
, QLibraryInfo::location(QLibraryInfo::TranslationsPath
));
867 wsApp
->installTranslator(&qtTranslator
);
869 splash_update(RA_LISTENERS
, NULL
, NULL
);
871 /* Register all tap listeners; we do this before we parse the arguments,
872 as the "-z" argument can specify a registered tap. */
874 /* we register the plugin taps before the other taps because
875 stats_tree taps plugins will be registered as tap listeners
876 by stats_tree_stat.c and need to registered before that */
878 g_log(NULL
, G_LOG_LEVEL_DEBUG
, "plugin_dir: %s", get_plugin_dir());
880 register_all_plugin_tap_listeners();
883 // register_all_tap_listeners();
885 /* Removed thread code:
886 * http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=35027
889 g_log(NULL
, G_LOG_LEVEL_DEBUG
, "FIX: timestamp types should be set elsewhere");
890 timestamp_set_type(TS_RELATIVE
);
891 timestamp_set_precision(TS_PREC_AUTO_USEC
);
892 timestamp_set_seconds_type(TS_SECONDS_DEFAULT
);
895 fill_in_local_interfaces(main_window_update
);
897 capture_opts_trim_snaplen(&global_capture_opts
, MIN_PACKET_SIZE
);
898 capture_opts_trim_ring_num_files(&global_capture_opts
);
899 #endif /* HAVE_LIBPCAP */
901 /* Notify all registered modules that have had any of their preferences
902 changed either from one of the preferences file or from the command
903 line that their preferences have changed. */
905 wsApp
->emitAppSignal(WiresharkApplication::PreferencesChanged
);
908 if ((global_capture_opts
.num_selected
== 0) &&
909 (prefs
.capture_device
!= NULL
)) {
912 for (i
= 0; i
< global_capture_opts
.all_ifaces
->len
; i
++) {
913 device
= g_array_index(global_capture_opts
.all_ifaces
, interface_t
, i
);
914 if (!device
.hidden
&& strcmp(device
.display_name
, prefs
.capture_device
) == 0) {
915 device
.selected
= TRUE
;
916 global_capture_opts
.num_selected
++;
917 global_capture_opts
.all_ifaces
= g_array_remove_index(global_capture_opts
.all_ifaces
, i
);
918 g_array_insert_val(global_capture_opts
.all_ifaces
, i
, device
);
925 /* disabled protocols as per configuration file */
926 if (gdp_path
== NULL
&& dp_path
== NULL
) {
927 set_disabled_protos_list();
930 build_column_format_array(&cfile
.cinfo
, prefs_p
->num_cols
, TRUE
);
932 wsApp
->setMonospaceFont(prefs
.gui_qt_font_name
);
936 /* Read the dynamic part of the recent file, as we have the gui now ready for
938 recent_read_dynamic(&rf_path
, &rf_open_errno
);
939 if (rf_path
!= NULL
&& rf_open_errno
!= 0) {
940 simple_dialog(ESD_TYPE_WARN
, ESD_BTN_OK
,
941 "Could not open recent file\n\"%s\": %s.",
942 rf_path
, g_strerror(rf_open_errno
));
945 color_filters_enable(recent
.packet_list_colorize
);
947 g_log(NULL
, G_LOG_LEVEL_DEBUG
, "FIX: fetch recent color settings");
948 color_filters_enable(TRUE
);
954 color_filters_init();
959 /* if the user didn't supply a capture filter, use the one to filter out remote connections like SSH */
960 if (!start_capture
&& !global_capture_opts
.default_options
.cfilter
) {
961 global_capture_opts
.default_options
.cfilter
= g_strdup(get_conn_cfilter());
963 #else /* HAVE_LIBPCAP */
965 #endif /* HAVE_LIBPCAP */
967 // w->setEnabled(true);
968 wsApp
->allSystemsGo();
969 g_log(LOG_DOMAIN_MAIN
, G_LOG_LEVEL_INFO
, "Wireshark is up and ready to go");
971 if (cf_name
!= NULL
) {
972 main_w
->openCaptureFile(*cf_name
);
975 g_main_loop_new(NULL
, FALSE
);
976 return wsApp
->exec();
985 * indent-tabs-mode: nil
988 * ex: set shiftwidth=4 tabstop=8 expandtab:
989 * :indentSize=4:tabSize=8:noTabs=true: