aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capchild/capture_sync.c2
-rw-r--r--capinfos.c10
-rw-r--r--captype.c10
-rw-r--r--dftest.c14
-rw-r--r--editcap.c12
-rw-r--r--epan/addr_resolv.c2
-rw-r--r--epan/disabled_protos.c231
-rw-r--r--epan/disabled_protos.h81
-rw-r--r--epan/dissectors/packet-diameter.c2
-rw-r--r--epan/dissectors/packet-etch.c2
-rw-r--r--epan/dissectors/packet-giop.c2
-rw-r--r--epan/dissectors/packet-radius.c2
-rw-r--r--epan/dissectors/packet-smb-sidsnooping.c2
-rw-r--r--epan/dissectors/packet-snort.c2
-rw-r--r--epan/dissectors/packet-ssl-utils.c2
-rw-r--r--epan/dissectors/packet-tpncp.c2
-rw-r--r--epan/dissectors/packet-uasip.c2
-rw-r--r--epan/dissectors/packet-uaudp.c2
-rw-r--r--epan/dissectors/packet-xml.c2
-rw-r--r--epan/epan.c4
-rw-r--r--epan/geoip_db.c2
-rw-r--r--epan/oids.c2
-rw-r--r--epan/proto.c2
-rw-r--r--epan/proto.h9
-rw-r--r--epan/uat.c2
-rw-r--r--epan/wslua/wslua.h2
-rw-r--r--mergecap.c10
-rw-r--r--plugins/mate/mate.h2
-rw-r--r--plugins/transum/packet-transum.c2
-rw-r--r--plugins/wimaxasncp/packet-wimaxasncp.c2
-rw-r--r--randpkt.c12
-rw-r--r--rawshark.c84
-rw-r--r--reordercap.c10
-rw-r--r--sharkd.c87
-rw-r--r--tfshark.c82
-rw-r--r--tshark.c107
-rw-r--r--ui/alert_box.c6
-rw-r--r--ui/alert_box.h5
-rw-r--r--ui/cli/tap-stats_tree.c2
-rw-r--r--ui/dissect_opts.c44
-rw-r--r--ui/dissect_opts.h10
-rw-r--r--ui/gtk/compare_stat.c2
-rw-r--r--ui/gtk/main.c119
-rw-r--r--ui/gtk/rtp_player.c2
-rw-r--r--ui/gtk/simple_dialog.c9
-rw-r--r--ui/gtk/stats_tree_stat.c2
-rw-r--r--ui/gtk/uat_gui.c2
-rw-r--r--ui/qt/main_window.cpp16
-rw-r--r--ui/qt/main_window_slots.cpp3
-rw-r--r--ui/qt/uat_dialog.cpp2
-rw-r--r--ui/qt/wireshark_application.cpp62
-rw-r--r--ui/qt/wireshark_application.h2
-rw-r--r--ui/simple_dialog.h5
-rw-r--r--wireshark-qt.cpp55
-rw-r--r--wsutil/CMakeLists.txt2
-rw-r--r--wsutil/Makefile.am4
-rw-r--r--wsutil/filesystem.c2
-rw-r--r--wsutil/plugins.c2
-rw-r--r--wsutil/report_err.c108
-rw-r--r--wsutil/report_message.c125
-rw-r--r--wsutil/report_message.h (renamed from wsutil/report_err.h)25
61 files changed, 654 insertions, 767 deletions
diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c
index a0ba3f5bd3..57c2c86b8e 100644
--- a/capchild/capture_sync.c
+++ b/capchild/capture_sync.c
@@ -91,7 +91,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#ifdef HAVE_EXTCAP
#include "extcap.h"
#endif
diff --git a/capinfos.c b/capinfos.c
index 967a1847e5..507ff05e30 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -81,7 +81,7 @@
#include <wsutil/plugins.h>
#endif
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/str_util.h>
#include <wsutil/file_util.h>
@@ -1378,10 +1378,11 @@ print_usage(FILE *output)
#ifdef HAVE_PLUGINS
/*
- * General errors are reported with an console message in capinfos.
+ * General errors and warnings are reported with an console message
+ * in capinfos.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "capinfos: ");
vfprintf(stderr, msg_format, ap);
@@ -1468,7 +1469,8 @@ main(int argc, char *argv[])
wtap_init();
#ifdef HAVE_PLUGINS
- init_report_err(failure_message, NULL, NULL, NULL);
+ init_report_message(failure_warning_message, failure_warning_message,
+ NULL, NULL, NULL);
/* Scan for plugins. This does *not* call their registration routines;
that's done later.
diff --git a/captype.c b/captype.c
index 8bff6f01b5..a61ba4bc81 100644
--- a/captype.c
+++ b/captype.c
@@ -50,7 +50,7 @@
#include <wsutil/plugins.h>
#endif
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/str_util.h>
#ifdef _WIN32
@@ -70,10 +70,11 @@ print_usage(FILE *output)
#ifdef HAVE_PLUGINS
/*
- * General errors are reported with an console message in captype.
+ * General errors and warnings are reported with an console message
+ * in captype.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "captype: ");
vfprintf(stderr, msg_format, ap);
@@ -143,7 +144,8 @@ main(int argc, char *argv[])
wtap_init();
#ifdef HAVE_PLUGINS
- init_report_err(failure_message,NULL,NULL,NULL);
+ init_report_message(failure_warning_message, failure_warning_message,
+ NULL, NULL, NULL);
/* Scan for plugins. This does *not* call their registration routines;
that's done later.
diff --git a/dftest.c b/dftest.c
index 30be24d3d5..7d7c868e9c 100644
--- a/dftest.c
+++ b/dftest.c
@@ -40,14 +40,14 @@
#endif
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wiretap/wtap.h>
#include "ui/util.h"
#include "register.h"
-static void failure_message(const char *msg_format, va_list ap);
+static void failure_warning_message(const char *msg_format, va_list ap);
static void open_failure_message(const char *filename, int err,
gboolean for_writing);
static void read_failure_message(const char *filename, int err);
@@ -80,8 +80,9 @@ main(int argc, char **argv)
g_free(init_progfile_dir_error);
}
- init_report_err(failure_message, open_failure_message,
- read_failure_message, write_failure_message);
+ init_report_message(failure_warning_message, failure_warning_message,
+ open_failure_message, read_failure_message,
+ write_failure_message);
timestamp_set_type(TS_RELATIVE);
timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
@@ -172,10 +173,11 @@ main(int argc, char **argv)
}
/*
- * General errors are reported with an console message in "dftest".
+ * General errors and warnings are reported with an console message
+ * in "dftest".
*/
static void
-failure_message(const char *msg_format, va_list ap)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "dftest: ");
vfprintf(stderr, msg_format, ap);
diff --git a/editcap.c b/editcap.c
index adca86c037..4716ec3087 100644
--- a/editcap.c
+++ b/editcap.c
@@ -83,7 +83,7 @@
#include <wsutil/wsgcrypt.h>
#include <wsutil/plugins.h>
#include <wsutil/privileges.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/strnatcmp.h>
#include <wsutil/str_util.h>
#include <ws_version_info.h>
@@ -910,10 +910,11 @@ framenum_compare(gconstpointer a, gconstpointer b, gpointer user_data _U_)
}
/*
- * General errors are reported with an console message in editcap.
+ * General errors and warnings are reported with an console message
+ * in editcap.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "editcap: ");
vfprintf(stderr, msg_format, ap);
@@ -998,7 +999,7 @@ main(int argc, char *argv[])
char *shb_user_appl;
int ret = EXIT_SUCCESS;
- cmdarg_err_init(failure_message, failure_message_cont);
+ cmdarg_err_init(failure_warning_message, failure_message_cont);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
@@ -1042,7 +1043,8 @@ main(int argc, char *argv[])
#ifdef HAVE_PLUGINS
/* Register wiretap plugins */
- init_report_err(failure_message,NULL,NULL,NULL);
+ init_report_message(failure_warning_message, failure_warning_message,
+ NULL, NULL, NULL);
/* Scan for plugins. This does *not* call their registration routines;
that's done later.
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index d174944154..96e2dc4c12 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -100,7 +100,7 @@
#include "addr_resolv.h"
#include "wsutil/filesystem.h"
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/file_util.h>
#include <wsutil/pint.h>
#include "wsutil/inet_aton.h"
diff --git a/epan/disabled_protos.c b/epan/disabled_protos.c
index b38ad425a0..b6e57cbd9f 100644
--- a/epan/disabled_protos.c
+++ b/epan/disabled_protos.c
@@ -36,6 +36,7 @@
#include "disabled_protos.h"
#include <wsutil/file_util.h>
#include <wsutil/ws_printf.h> /* ws_g_warning */
+#include <wsutil/report_message.h>
#define ENABLED_PROTOCOLS_FILE_NAME "enabled_protos"
#define DISABLED_PROTOCOLS_FILE_NAME "disabled_protos"
@@ -268,8 +269,7 @@ save_protos_list(char **pref_path_return, int *errno_return, const char* filenam
}
static int
-read_protos_list_file(const char *ff_path, FILE *ff,
- GList **flp)
+read_protos_list_file(const char *ff_path, FILE *ff, GList **flp)
{
protocol_def *prot;
int c;
@@ -285,8 +285,8 @@ read_protos_list_file(const char *ff_path, FILE *ff,
prot_name = (char *)g_malloc(prot_name_len + 1);
for (line = 1; ; line++) {
- /* Lines in a disabled protocol file contain the "filter name" of
- a protocol to be disabled. */
+ /* Lines in a protocol file contain the "filter name" of a protocol
+ to be enabled or disabled. */
/* Skip over leading white space, if any. */
while ((c = ws_getc_unlocked(ff)) != EOF && g_ascii_isspace(c)) {
@@ -381,20 +381,27 @@ error:
}
/*
- * Read in a list of protocols.
+ * Read in global and personal versions of a list of protocols.
*
- * On success, "*pref_path_return" is set to NULL.
- * On error, "*pref_path_return" is set to point to the pathname of
- * the file we tried to read - it should be freed by our caller -
- * and "*open_errno_return" is set to the error if an open failed
- * or "*read_errno_return" is set to the error if a read failed.
+ * If we can open and read the global version, *gpath_return is set to
+ * NULL. Otherwise, *gpath_return is set to point to the pathname of
+ * the file we tried to read - it should be freed by our caller - and
+ * *gopen_errno_return is set to the error if an open failed or
+ * *gread_errno_return is set to the error if a read failed.
+ *
+ * If we can open and read the personal version, *path_return is set to
+ * NULL. Otherwise, *path_return is set to point to the pathname of
+ * the file we tried to read - it should be freed by our caller - and
+ * *open_errno_return is set to the error if an open failed or
+ * *read_errno_return is set to the error if a read failed.
*/
static void
read_protos_list(char **gpath_return, int *gopen_errno_return,
- int *gread_errno_return,
- char **path_return, int *open_errno_return,
- int *read_errno_return, const char* filename,
- GList **protos_list, GList **global_protos_list)
+ int *gread_errno_return,
+ char **path_return, int *open_errno_return,
+ int *read_errno_return,
+ const char* filename,
+ GList **global_protos_list, GList **protos_list)
{
int err;
char *gff_path, *ff_path;
@@ -410,8 +417,7 @@ read_protos_list(char **gpath_return, int *gopen_errno_return,
*gpath_return = NULL;
if ((ff = ws_fopen(gff_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */
- err = read_protos_list_file(gff_path, ff,
- global_protos_list);
+ err = read_protos_list_file(gff_path, ff, global_protos_list);
if (err != 0) {
/* We had an error reading the file; return the errno and the
pathname, so our caller can report the error. */
@@ -471,29 +477,6 @@ read_protos_list(char **gpath_return, int *gopen_errno_return,
************************************************************************/
/*
- * Read in a list of disabled protocols.
- */
-void
-read_disabled_protos_list(char **gpath_return, int *gopen_errno_return,
- int *gread_errno_return,
- char **path_return, int *open_errno_return,
- int *read_errno_return)
-{
- read_protos_list(gpath_return, gopen_errno_return, gread_errno_return,
- path_return, open_errno_return, read_errno_return,
- DISABLED_PROTOCOLS_FILE_NAME, &disabled_protos, &global_disabled_protos);
-}
-
-/*
- * Disable protocols as per the stored configuration
- */
-void
-set_disabled_protos_list(void)
-{
- set_protos_list(disabled_protos, global_disabled_protos, FALSE);
-}
-
-/*
* Disable a particular protocol by name
*/
void
@@ -531,12 +514,6 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
/************************************************************************
* Enabling dissectors (that are disabled by default)
************************************************************************/
-void
-set_enabled_protos_list(void)
-{
- set_protos_list(enabled_protos, global_enabled_protos, TRUE);
-}
-
WS_DLL_PUBLIC void
proto_enable_proto_by_name(const char *name)
@@ -573,27 +550,13 @@ save_enabled_protos_list(char **pref_path_return, int *errno_return)
enable_proto_list_check);
}
-/*
- * Read in a list of enabled protocols (that are disabled by default).
- */
-void
-read_enabled_protos_list(char **gpath_return, int *gopen_errno_return,
- int *gread_errno_return,
- char **path_return, int *open_errno_return,
- int *read_errno_return)
-{
- read_protos_list(gpath_return, gopen_errno_return, gread_errno_return,
- path_return, open_errno_return, read_errno_return,
- ENABLED_PROTOCOLS_FILE_NAME, &enabled_protos, &global_enabled_protos);
-}
-
/************************************************************************
* Heuristic dissectors
************************************************************************/
-void
+static void
set_disabled_heur_dissector_list(void)
{
GList *fl_ent;
@@ -634,8 +597,7 @@ skip:
}
static int
-read_disabled_heur_dissector_list_file(const char *ff_path, FILE *ff,
- GList **flp)
+read_heur_dissector_list_file(const char *ff_path, FILE *ff, GList **flp)
{
heur_protocol_def *heur;
int c;
@@ -737,7 +699,7 @@ read_disabled_heur_dissector_list_file(const char *ff_path, FILE *ff,
}
heuristic_name[name_index] = '\0';
- /* Add the new protocol to the list of disabled protocols */
+ /* Add the new protocol to the list of protocols */
heur = (heur_protocol_def *) g_malloc(sizeof(heur_protocol_def));
heur->name = g_strdup(heuristic_name);
heur->enabled = enabled;
@@ -751,28 +713,28 @@ error:
return errno;
}
-void
-read_disabled_heur_dissector_list(char **gpath_return, int *gopen_errno_return,
- int *gread_errno_return,
- char **path_return, int *open_errno_return,
- int *read_errno_return)
+static void
+read_heur_dissector_list(char **gpath_return, int *gopen_errno_return,
+ int *gread_errno_return,
+ char **path_return, int *open_errno_return,
+ int *read_errno_return)
{
int err;
char *gff_path, *ff_path;
FILE *ff;
- /* Construct the pathname of the global disabled heuristic dissectors file. */
- gff_path = get_datafile_path(HEURISTICS_FILE_NAME);
-
/* If we already have a list of protocols, discard it. */
heur_discard_existing_list(&global_disabled_heuristics);
+ /* Construct the pathname of the global disabled heuristic dissectors file. */
+ gff_path = get_datafile_path(HEURISTICS_FILE_NAME);
+
/* Read the global disabled protocols file, if it exists. */
*gpath_return = NULL;
if ((ff = ws_fopen(gff_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */
- err = read_disabled_heur_dissector_list_file(gff_path, ff,
- &global_disabled_heuristics);
+ err = read_heur_dissector_list_file(gff_path, ff,
+ &global_disabled_heuristics);
if (err != 0) {
/* We had an error reading the file; return the errno and the
pathname, so our caller can report the error. */
@@ -804,7 +766,7 @@ read_disabled_heur_dissector_list(char **gpath_return, int *gopen_errno_return,
*path_return = NULL;
if ((ff = ws_fopen(ff_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */
- err = read_disabled_heur_dissector_list_file(ff_path, ff, &disabled_heuristics);
+ err = read_heur_dissector_list_file(ff_path, ff, &disabled_heuristics);
if (err != 0) {
/* We had an error reading the file; return the errno and the
pathname, so our caller can report the error. */
@@ -933,12 +895,15 @@ save_disabled_heur_dissector_list(char **pref_path_return, int *errno_return)
g_free(ff_path);
}
-void
+gboolean
proto_enable_heuristic_by_name(const char *name, gboolean enable)
{
heur_dtbl_entry_t* heur = find_heur_dissector_by_unique_short_name(name);
if (heur != NULL) {
heur->enabled = enable;
+ return TRUE;
+ } else {
+ return FALSE;
}
}
@@ -950,8 +915,122 @@ disabled_protos_free(gpointer p, gpointer user_data _U_)
g_free(p);
}
+/*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors. Report errors through the UI.
+ */
+void
+read_enabled_and_disabled_protos(void)
+{
+ char *gpath, *path;
+ int gopen_errno, gread_errno;
+ int open_errno, read_errno;
+
+ /*
+ * Read the global and personal disabled protocols files.
+ */
+ read_protos_list(&gpath, &gopen_errno, &gread_errno,
+ &path, &open_errno, &read_errno,
+ DISABLED_PROTOCOLS_FILE_NAME,
+ &global_disabled_protos, &disabled_protos);
+ if (gpath != NULL) {
+ if (gopen_errno != 0) {
+ report_warning("Could not open global disabled protocols file\n\"%s\": %s.",
+ gpath, g_strerror(gopen_errno));
+ }
+ if (gread_errno != 0) {
+ report_warning("I/O error reading global disabled protocols file\n\"%s\": %s.",
+ gpath, g_strerror(gread_errno));
+ }
+ g_free(gpath);
+ gpath = NULL;
+ }
+ if (path != NULL) {
+ if (open_errno != 0) {
+ report_warning("Could not open your disabled protocols file\n\"%s\": %s.",
+ path, g_strerror(open_errno));
+ }
+ if (read_errno != 0) {
+ report_warning("I/O error reading your disabled protocols file\n\"%s\": %s.",
+ path, g_strerror(read_errno));
+ }
+ g_free(path);
+ path = NULL;
+ }
+
+ /*
+ * Read the global and personal enabled protocols files.
+ */
+ read_protos_list(&gpath, &gopen_errno, &gread_errno,
+ &path, &open_errno, &read_errno,
+ ENABLED_PROTOCOLS_FILE_NAME,
+ &global_enabled_protos, &enabled_protos);
+ if (gpath != NULL) {
+ if (gopen_errno != 0) {
+ report_warning("Could not open global enabled protocols file\n\"%s\": %s.",
+ gpath, g_strerror(gopen_errno));
+ }
+ if (gread_errno != 0) {
+ report_warning("I/O error reading global enabled protocols file\n\"%s\": %s.",
+ gpath, g_strerror(gread_errno));
+ }
+ g_free(gpath);
+ gpath = NULL;
+ }
+ if (path != NULL) {
+ if (open_errno != 0) {
+ report_warning("Could not open your enabled protocols file\n\"%s\": %s.",
+ path, g_strerror(open_errno));
+ }
+ if (read_errno != 0) {
+ report_warning("I/O error reading your enabled protocols file\n\"%s\": %s.",
+ path, g_strerror(read_errno));
+ }
+ g_free(path);
+ path = NULL;
+ }
+
+ /*
+ * Read the global and personal heuristic dissector list files.
+ */
+ read_heur_dissector_list(&gpath, &gopen_errno, &gread_errno,
+ &path, &open_errno, &read_errno);
+ if (gpath != NULL) {
+ if (gopen_errno != 0) {
+ report_warning("Could not open global heuristic dissectors file\n\"%s\": %s.",
+ gpath, g_strerror(gopen_errno));
+ }
+ if (gread_errno != 0) {
+ report_warning("I/O error reading global heuristic dissectors file\n\"%s\": %s.",
+ gpath, g_strerror(gread_errno));
+ }
+ g_free(gpath);
+ gpath = NULL;
+ }
+ if (path != NULL) {
+ if (open_errno != 0) {
+ report_warning("Could not open your heuristic dissectors file\n\"%s\": %s.",
+ path, g_strerror(open_errno));
+ }
+ if (read_errno != 0) {
+ report_warning("I/O error reading your heuristic dissectors file\n\"%s\": %s.",
+ path, g_strerror(read_errno));
+ }
+ g_free(path);
+ path = NULL;
+ }
+
+ /*
+ * Enable/disable protocols and heuristic dissectors as per the
+ * contents of the files we just read.
+ */
+ set_protos_list(disabled_protos, global_disabled_protos, FALSE);
+ set_protos_list(enabled_protos, global_enabled_protos, TRUE);
+ set_disabled_heur_dissector_list();
+}
+
void
-disabled_protos_cleanup(void)
+enabled_and_disabled_protos_cleanup(void)
{
g_list_foreach(global_disabled_heuristics, disabled_protos_free, NULL);
g_list_free(global_disabled_heuristics);
diff --git a/epan/disabled_protos.h b/epan/disabled_protos.h
index 52a791bfa7..f1f436464f 100644
--- a/epan/disabled_protos.h
+++ b/epan/disabled_protos.h
@@ -6,7 +6,6 @@
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -30,28 +29,6 @@ extern "C" {
#endif /* __cplusplus */
/*
- * Read in a list of disabled protocols.
- *
- * On success, "*pref_path_return" is set to NULL.
- * On error, "*pref_path_return" is set to point to the pathname of
- * the file we tried to read - it should be freed by our caller -
- * and "*open_errno_return" is set to the error if we couldn't open the file
- * or "*read_errno_return" is set to the error if we got an error reading
- * the file.
- */
-WS_DLL_PUBLIC void
-read_disabled_protos_list(char **gpath_return, int *gopen_errno_return,
- int *gread_errno_return,
- char **path_return, int *open_errno_return,
- int *read_errno_return);
-
-/*
- * Disable protocols as per the stored configuration
- */
-WS_DLL_PUBLIC void
-set_disabled_protos_list(void);
-
-/*
* Write out a list of disabled protocols.
*
* On success, "*pref_path_return" is set to NULL.
@@ -69,29 +46,6 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return);
WS_DLL_PUBLIC void
proto_disable_proto_by_name(const char *name);
-
-/*
- * Read in a list of enabled protocols (who are disabled by default)
- *
- * On success, "*pref_path_return" is set to NULL.
- * On error, "*pref_path_return" is set to point to the pathname of
- * the file we tried to read - it should be freed by our caller -
- * and "*open_errno_return" is set to the error if we couldn't open the file
- * or "*read_errno_return" is set to the error if we got an error reading
- * the file.
- */
-WS_DLL_PUBLIC void
-read_enabled_protos_list(char **gpath_return, int *gopen_errno_return,
- int *gread_errno_return,
- char **path_return, int *open_errno_return,
- int *read_errno_return);
-
-/*
- * Enable protocols (that default to disabled) as per the stored configuration
- */
-WS_DLL_PUBLIC void
-set_enabled_protos_list(void);
-
/*
* Write out a list of enabled protocols (that default to being disabled)
*
@@ -112,28 +66,6 @@ WS_DLL_PUBLIC void
proto_enable_proto_by_name(const char *name);
/*
- * Read in a list of disabled protocols.
- *
- * On success, "*pref_path_return" is set to NULL.
- * On error, "*pref_path_return" is set to point to the pathname of
- * the file we tried to read - it should be freed by our caller -
- * and "*open_errno_return" is set to the error if we couldn't open the file
- * or "*read_errno_return" is set to the error if we got an error reading
- * the file.
- */
-WS_DLL_PUBLIC void
-read_disabled_heur_dissector_list(char **gpath_return, int *gopen_errno_return,
- int *gread_errno_return,
- char **path_return, int *open_errno_return,
- int *read_errno_return);
-
-/*
- * Disable protocols as per the stored configuration
- */
-WS_DLL_PUBLIC void
-set_disabled_heur_dissector_list(void);
-
-/*
* Write out a list of disabled heuristic dissectors.
*
* On success, "*pref_path_return" is set to NULL.
@@ -146,15 +78,24 @@ save_disabled_heur_dissector_list(char **pref_path_return, int *errno_return);
/*
* Enable/disable a particular heuristic dissector by name
+ * On success (found the protocol), return TRUE.
+ * On failure (didn't find the protocol), return FALSE.
*/
-WS_DLL_PUBLIC void
+WS_DLL_PUBLIC gboolean
proto_enable_heuristic_by_name(const char *name, gboolean enable);
/*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors. Report errors through the UI.
+ */
+WS_DLL_PUBLIC void
+read_enabled_and_disabled_protos(void);
+
+/*
* Free the internal structures
*/
extern void
-disabled_protos_cleanup(void);
+enabled_and_disabled_protos_cleanup(void);
#ifdef __cplusplus
}
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 061ed323ad..de5983a5dd 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -55,7 +55,7 @@
#include <epan/show_exception.h>
#include <epan/to_str.h>
#include <wsutil/filesystem.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "packet-tcp.h"
#include "packet-diameter.h"
#include "packet-e212.h"
diff --git a/epan/dissectors/packet-etch.c b/epan/dissectors/packet-etch.c
index 3f23aa08a7..152875f758 100644
--- a/epan/dissectors/packet-etch.c
+++ b/epan/dissectors/packet-etch.c
@@ -33,7 +33,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <wsutil/file_util.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "packet-tcp.h"
void proto_register_etch(void);
diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c
index e83a803335..22879043b0 100644
--- a/epan/dissectors/packet-giop.c
+++ b/epan/dissectors/packet-giop.c
@@ -293,7 +293,7 @@
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
#include <wsutil/pint.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/ws_printf.h> /* ws_debug_printf */
#include "packet-giop.h"
diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c
index 0f1a4deb70..43f1149f94 100644
--- a/epan/dissectors/packet-radius.c
+++ b/epan/dissectors/packet-radius.c
@@ -67,7 +67,7 @@
#include <epan/rtd_table.h>
#include <epan/addr_resolv.h>
#include <wsutil/filesystem.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/wsgcrypt.h>
diff --git a/epan/dissectors/packet-smb-sidsnooping.c b/epan/dissectors/packet-smb-sidsnooping.c
index 3a2ff1628c..7253f00f14 100644
--- a/epan/dissectors/packet-smb-sidsnooping.c
+++ b/epan/dissectors/packet-smb-sidsnooping.c
@@ -26,7 +26,7 @@
#include <epan/packet.h>
#include <epan/epan_dissect.h>
#include <epan/tap.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "packet-dcerpc.h"
#include "packet-dcerpc-nt.h"
#include "packet-smb.h"
diff --git a/epan/dissectors/packet-snort.c b/epan/dissectors/packet-snort.c
index fcc050c2cb..b45d9c206d 100644
--- a/epan/dissectors/packet-snort.c
+++ b/epan/dissectors/packet-snort.c
@@ -49,7 +49,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <epan/wmem/wmem.h>
#include <wiretap/wtap-int.h>
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
index e3b97a7dd6..721705166e 100644
--- a/epan/dissectors/packet-ssl-utils.c
+++ b/epan/dissectors/packet-ssl-utils.c
@@ -46,7 +46,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/pint.h>
#include <wsutil/strtoi.h>
#include <ws_version_info.h>
diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c
index 055172df04..618b5c1a9c 100644
--- a/epan/dissectors/packet-tpncp.c
+++ b/epan/dissectors/packet-tpncp.c
@@ -32,7 +32,7 @@
#include <epan/to_str.h>
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/strtoi.h>
#include "packet-tcp.h"
diff --git a/epan/dissectors/packet-uasip.c b/epan/dissectors/packet-uasip.c
index e5fc4c19f5..e53647887d 100644
--- a/epan/dissectors/packet-uasip.c
+++ b/epan/dissectors/packet-uasip.c
@@ -29,7 +29,7 @@
#include <epan/tap.h>
#endif
#include <epan/addr_resolv.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "packet-uaudp.h"
diff --git a/epan/dissectors/packet-uaudp.c b/epan/dissectors/packet-uaudp.c
index af173dff66..01e3810d50 100644
--- a/epan/dissectors/packet-uaudp.c
+++ b/epan/dissectors/packet-uaudp.c
@@ -25,7 +25,7 @@
#include "epan/packet.h"
#include "epan/prefs.h"
-#include "wsutil/report_err.h"
+#include "wsutil/report_message.h"
#include "wsutil/inet_addr.h"
#include "packet-uaudp.h"
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c
index 5df3573cc8..4e8863bdf8 100644
--- a/epan/dissectors/packet-xml.c
+++ b/epan/dissectors/packet-xml.c
@@ -39,7 +39,7 @@
#include <epan/expert.h>
#include <epan/garrayfix.h>
#include <wsutil/str_util.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "packet-xml.h"
diff --git a/epan/epan.c b/epan/epan.c
index 0d1d257fed..936c27d55c 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -32,7 +32,7 @@
#include <glib.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <epan/exceptions.h>
@@ -223,7 +223,7 @@ epan_cleanup(void)
expert_cleanup();
capture_dissector_cleanup();
export_pdu_cleanup();
- disabled_protos_cleanup();
+ enabled_and_disabled_protos_cleanup();
stats_tree_cleanup();
dtd_location(NULL);
#ifdef HAVE_LUA
diff --git a/epan/geoip_db.c b/epan/geoip_db.c
index f89fd41781..ee5a3103b2 100644
--- a/epan/geoip_db.c
+++ b/epan/geoip_db.c
@@ -42,7 +42,7 @@
#include <epan/prefs.h>
#include <epan/value_string.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/file_util.h>
/* This needs to match NUM_GEOIP_COLS in hostlist_table.h */
diff --git a/epan/oids.c b/epan/oids.c
index f60476967c..ce409a595c 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <string.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "wmem/wmem.h"
#include "uat.h"
diff --git a/epan/proto.c b/epan/proto.c
index 68d650dc90..17c787a906 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -6548,7 +6548,7 @@ proto_set_decoding(const int proto_id, const gboolean enabled)
}
void
-proto_enable_all(void)
+proto_reenable_all(void)
{
protocol_t *protocol;
GList *list_item = protocols;
diff --git a/epan/proto.h b/epan/proto.h
index 9ad0df609c..fca8b01cb8 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -2368,9 +2368,10 @@ WS_DLL_PUBLIC void proto_get_frame_protocols(const wmem_list_t *layers,
gboolean *is_ip, gboolean *is_tcp, gboolean *is_udp, gboolean *is_sctp,
gboolean *is_ssl, gboolean *is_rtp, gboolean *is_lte_rlc);
-/** Find a protocol by name in a layer list.
+/** Check whether a protocol, specified by name, is in a layer list.
* @param layers Protocol layer list
* @param proto_name Name of protocol to find
+ * @return TRUE if the protocol is found, FALSE if it isn't
*/
WS_DLL_PUBLIC gboolean proto_is_frame_protocol(const wmem_list_t *layers, const char* proto_name);
@@ -2383,8 +2384,8 @@ WS_DLL_PUBLIC void proto_disable_by_default(const int proto_id);
@param enabled enable / disable the protocol */
WS_DLL_PUBLIC void proto_set_decoding(const int proto_id, const gboolean enabled);
-/** Enable all protocols */
-WS_DLL_PUBLIC void proto_enable_all(void);
+/** Re-enable all protocols that are not marked as disabled by default. */
+WS_DLL_PUBLIC void proto_reenable_all(void);
/** Disable disabling/enabling of protocol of the given item number.
@param proto_id protocol id (0-indexed) */
@@ -2401,7 +2402,7 @@ extern gboolean proto_check_for_protocol_or_field(const proto_tree* tree, const
tree. Only works with primed trees, and is fast.
@param tree tree of interest
@param hfindex primed hfindex
- @return GPtrArry pointer */
+ @return GPtrArray pointer */
WS_DLL_PUBLIC GPtrArray* proto_get_finfo_ptr_array(const proto_tree *tree, const int hfindex);
/** Return whether we're tracking any interesting fields.
diff --git a/epan/uat.c b/epan/uat.c
index 92fac8f12f..385779a7c5 100644
--- a/epan/uat.c
+++ b/epan/uat.c
@@ -36,7 +36,7 @@
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/filesystem.h>
#include <epan/packet.h>
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index 0fa2c9a6bf..393e8e0a0c 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -40,7 +40,7 @@
#include <wiretap/wtap.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/nstime.h>
#include <epan/packet.h>
diff --git a/mergecap.c b/mergecap.c
index 50362186d0..daddbda1fb 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -55,7 +55,7 @@
#include <wsutil/plugins.h>
#endif
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wiretap/merge.h>
@@ -129,10 +129,11 @@ string_elem_print(gpointer data, gpointer not_used _U_)
#ifdef HAVE_PLUGINS
/*
- * General errors are reported with an console message in mergecap.
+ * General errors and warnings are reported with an console message
+ * in mergecap.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "mergecap: ");
vfprintf(stderr, msg_format, ap);
@@ -310,7 +311,8 @@ main(int argc, char *argv[])
wtap_init();
#ifdef HAVE_PLUGINS
- init_report_err(failure_message,NULL,NULL,NULL);
+ init_report_message(failure_warning_message, failure_warning_message,
+ NULL, NULL, NULL);
/* Scan for plugins. This does *not* call their registration routines;
that's done later.
diff --git a/plugins/mate/mate.h b/plugins/mate/mate.h
index 87fb2a301e..3e9582ec29 100644
--- a/plugins/mate/mate.h
+++ b/plugins/mate/mate.h
@@ -39,7 +39,7 @@
#include <string.h>
#include <errno.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <epan/packet.h>
#include <epan/exceptions.h>
diff --git a/plugins/transum/packet-transum.c b/plugins/transum/packet-transum.c
index 18f2ab25e5..cb06684393 100644
--- a/plugins/transum/packet-transum.c
+++ b/plugins/transum/packet-transum.c
@@ -32,7 +32,7 @@
#include <epan/prefs.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/tap.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "packet-transum.h"
#include "preferences.h"
#include "extractors.h"
diff --git a/plugins/wimaxasncp/packet-wimaxasncp.c b/plugins/wimaxasncp/packet-wimaxasncp.c
index c5c19f391d..1e88d92cdb 100644
--- a/plugins/wimaxasncp/packet-wimaxasncp.c
+++ b/plugins/wimaxasncp/packet-wimaxasncp.c
@@ -39,7 +39,7 @@
#include <epan/expert.h>
#include <epan/eap.h>
#include <wsutil/filesystem.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/ws_printf.h> /* ws_debug_printf */
#include "wimaxasncp_dict.h"
diff --git a/randpkt.c b/randpkt.c
index d10c5d6e03..fa711b917f 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -38,7 +38,7 @@
#include <wsutil/plugins.h>
#endif
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
@@ -54,10 +54,11 @@
#define CLOSE_ERROR 2
/*
- * General errors are reported with an console message in randpkt.
+ * General errors and warnings are reported with an console message
+ * in randpkt.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "randpkt: ");
vfprintf(stderr, msg_format, ap);
@@ -148,7 +149,7 @@ main(int argc, char **argv)
wtap_init();
- cmdarg_err_init(failure_message, failure_message_cont);
+ cmdarg_err_init(failure_warning_message, failure_message_cont);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
@@ -157,7 +158,8 @@ main(int argc, char **argv)
#ifdef HAVE_PLUGINS
/* Register wiretap plugins */
- init_report_err(failure_message,NULL,NULL,NULL);
+ init_report_message(failure_warning_message, failure_warning_message,
+ NULL, NULL, NULL);
/* Scan for plugins. This does *not* call their registration routines;
that's done later.
diff --git a/rawshark.c b/rawshark.c
index ea53183b56..25fa0fa244 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -65,7 +65,7 @@
#include <wsutil/file_util.h>
#include <wsutil/plugins.h>
#include <wsutil/privileges.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "globals.h"
#include <epan/packet.h>
@@ -81,6 +81,7 @@
#include "ui/capture_ui_utils.h"
#endif
#include "ui/util.h"
+#include "ui/dissect_opts.h"
#include "register.h"
#include "conditions.h"
#include "capture_stop_conditions.h"
@@ -155,9 +156,9 @@ static gboolean process_packet(capture_file *cf, epan_dissect_t *edt, gint64 off
struct wtap_pkthdr *whdr, const guchar *pd);
static void show_print_file_io_error(int err);
+static void failure_warning_message(const char *msg_format, va_list ap);
static void open_failure_message(const char *filename, int err,
gboolean for_writing);
-static void failure_message(const char *msg_format, va_list ap);
static void read_failure_message(const char *filename, int err);
static void write_failure_message(const char *filename, int err);
static void rawshark_cmdarg_err(const char *fmt, va_list ap);
@@ -436,11 +437,8 @@ main(int argc, char *argv[])
#endif /* _WIN32 */
char *gpf_path, *pf_path;
- char *gdp_path, *dp_path;
int gpf_open_errno, gpf_read_errno;
int pf_open_errno, pf_read_errno;
- int gdp_open_errno, gdp_read_errno;
- int dp_open_errno, dp_read_errno;
gchar *pipe_name = NULL;
gchar *rfilters[64];
e_prefs *prefs_p;
@@ -526,8 +524,9 @@ main(int argc, char *argv[])
(GLogLevelFlags)log_flags,
log_func_ignore, NULL /* user_data */);
- init_report_err(failure_message, open_failure_message, read_failure_message,
- write_failure_message);
+ init_report_message(failure_warning_message, failure_warning_message,
+ open_failure_message, read_failure_message,
+ write_failure_message);
timestamp_set_type(TS_RELATIVE);
timestamp_set_precision(TS_PREC_AUTO);
@@ -570,37 +569,11 @@ main(int argc, char *argv[])
pf_path = NULL;
}
- /* Read the disabled protocols file. */
- read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- read_enabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- read_disabled_heur_dissector_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- if (gdp_path != NULL) {
- if (gdp_open_errno != 0) {
- cmdarg_err("Could not open global disabled protocols file\n\"%s\": %s.",
- gdp_path, g_strerror(gdp_open_errno));
- }
- if (gdp_read_errno != 0) {
- cmdarg_err("I/O error reading global disabled protocols file\n\"%s\": %s.",
- gdp_path, g_strerror(gdp_read_errno));
- }
- g_free(gdp_path);
- }
- if (dp_path != NULL) {
- if (dp_open_errno != 0) {
- cmdarg_err(
- "Could not open your disabled protocols file\n\"%s\": %s.", dp_path,
- g_strerror(dp_open_errno));
- }
- if (dp_read_errno != 0) {
- cmdarg_err(
- "I/O error reading your disabled protocols file\n\"%s\": %s.", dp_path,
- g_strerror(dp_read_errno));
- }
- g_free(dp_path);
- }
+ /*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors.
+ */
+ read_enabled_and_disabled_protos();
#ifdef _WIN32
ws_init_dll_search_path();
@@ -838,12 +811,11 @@ main(int argc, char *argv[])
of the filter. We can now process all the "-z" arguments. */
start_requested_stats();
- /* disabled protocols as per configuration file */
- if (gdp_path == NULL && dp_path == NULL) {
- set_disabled_protos_list();
- set_enabled_protos_list();
- set_disabled_heur_dissector_list();
- }
+ /*
+ * Enabled and disabled protocols and heuristic dissectors as per
+ * command-line options.
+ */
+ setup_enabled_and_disabled_protocols();
/* Build the column format array */
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
@@ -1545,6 +1517,18 @@ show_print_file_io_error(int err)
}
/*
+ * General errors and warnings are reported with an console message
+ * in Rawshark.
+ */
+static void
+failure_warning_message(const char *msg_format, va_list ap)
+{
+ fprintf(stderr, "rawshark: ");
+ vfprintf(stderr, msg_format, ap);
+ fprintf(stderr, "\n");
+}
+
+/*
* Open/create errors are reported with an console message in Rawshark.
*/
static void
@@ -1625,18 +1609,6 @@ raw_cf_open(capture_file *cf, const char *fname)
return CF_OK;
}
-
-/*
- * General errors are reported with an console message in Rawshark.
- */
-static void
-failure_message(const char *msg_format, va_list ap)
-{
- fprintf(stderr, "rawshark: ");
- vfprintf(stderr, msg_format, ap);
- fprintf(stderr, "\n");
-}
-
/*
* Read errors are reported with an console message in Rawshark.
*/
diff --git a/reordercap.c b/reordercap.c
index 8d53fd728f..ca55267009 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -49,7 +49,7 @@
#include <wsutil/plugins.h>
#endif
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#define INVALID_OPTION 1
#define OPEN_ERROR 2
@@ -152,10 +152,11 @@ frames_compare(gconstpointer a, gconstpointer b)
#ifdef HAVE_PLUGINS
/*
- * General errors are reported with an console message in reordercap.
+ * General errors and warnings are reported with an console message
+ * in reordercap.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "reordercap: ");
vfprintf(stderr, msg_format, ap);
@@ -238,7 +239,8 @@ main(int argc, char *argv[])
#ifdef HAVE_PLUGINS
/* Register wiretap plugins */
- init_report_err(failure_message,NULL,NULL,NULL);
+ init_report_message(failure_warning_message, failure_warning_message,
+ NULL, NULL, NULL);
/* Scan for plugins. This does *not* call their registration routines;
that's done later.
diff --git a/sharkd.c b/sharkd.c
index 6ad971bbf1..a9a451b78c 100644
--- a/sharkd.c
+++ b/sharkd.c
@@ -42,7 +42,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
#include <wsutil/privileges.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <ws_version_info.h>
#include <wiretap/wtap_opttypes.h>
#include <wiretap/pcapng.h>
@@ -88,9 +88,9 @@ static frame_data *prev_cap;
static const char *cf_open_error_message(int err, gchar *err_info,
gboolean for_writing, int file_type);
+static void failure_warning_message(const char *msg_format, va_list ap);
static void open_failure_message(const char *filename, int err,
gboolean for_writing);
-static void failure_message(const char *msg_format, va_list ap);
static void read_failure_message(const char *filename, int err);
static void write_failure_message(const char *filename, int err);
static void failure_message_cont(const char *msg_format, va_list ap);
@@ -123,18 +123,15 @@ main(int argc, char *argv[])
char *init_progfile_dir_error;
char *gpf_path, *pf_path;
- char *gdp_path, *dp_path;
char *cf_path;
char *err_msg = NULL;
int gpf_open_errno, gpf_read_errno;
int pf_open_errno, pf_read_errno;
- int gdp_open_errno, gdp_read_errno;
- int dp_open_errno, dp_read_errno;
int cf_open_errno;
e_prefs *prefs_p;
int ret = EXIT_SUCCESS;
- cmdarg_err_init(failure_message, failure_message_cont);
+ cmdarg_err_init(failure_warning_message, failure_message_cont);
/*
* Get credential information for later use, and drop privileges
@@ -177,8 +174,9 @@ main(int argc, char *argv[])
goto clean_exit;
}
- init_report_err(failure_message, open_failure_message, read_failure_message,
- write_failure_message);
+ init_report_message(failure_warning_message, failure_warning_message,
+ open_failure_message, read_failure_message,
+ write_failure_message);
timestamp_set_type(TS_RELATIVE);
timestamp_set_precision(TS_PREC_AUTO);
@@ -248,35 +246,11 @@ main(int argc, char *argv[])
g_free(err_msg);
}
- /* Read the disabled protocols file. */
- read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- read_disabled_heur_dissector_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- if (gdp_path != NULL) {
- if (gdp_open_errno != 0) {
- cmdarg_err("Could not open global disabled protocols file\n\"%s\": %s.",
- gdp_path, g_strerror(gdp_open_errno));
- }
- if (gdp_read_errno != 0) {
- cmdarg_err("I/O error reading global disabled protocols file\n\"%s\": %s.",
- gdp_path, g_strerror(gdp_read_errno));
- }
- g_free(gdp_path);
- }
- if (dp_path != NULL) {
- if (dp_open_errno != 0) {
- cmdarg_err(
- "Could not open your disabled protocols file\n\"%s\": %s.", dp_path,
- g_strerror(dp_open_errno));
- }
- if (dp_read_errno != 0) {
- cmdarg_err(
- "I/O error reading your disabled protocols file\n\"%s\": %s.", dp_path,
- g_strerror(dp_read_errno));
- }
- g_free(dp_path);
- }
+ /*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors.
+ */
+ read_enabled_and_disabled_protos();
cap_file_init(&cfile);
@@ -285,12 +259,6 @@ main(int argc, char *argv[])
line that their preferences have changed. */
prefs_apply_all();
- /* disabled protocols as per configuration file */
- if (gdp_path == NULL && dp_path == NULL) {
- set_disabled_protos_list();
- set_disabled_heur_dissector_list();
- }
-
/* Build the column format array */
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
@@ -484,7 +452,7 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
switch (err) {
case WTAP_ERR_UNSUPPORTED:
- cmdarg_err("The file \"%s\" contains record data that TShark doesn't support.\n(%s)",
+ cmdarg_err("The file \"%s\" contains record data that sharkd doesn't support.\n(%s)",
cf->filename,
err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
@@ -598,18 +566,18 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
case WTAP_ERR_RANDOM_OPEN_PIPE:
/* Seen only when opening a capture file for reading. */
- errmsg = "The file \"%s\" is a pipe or FIFO; TShark can't read pipe or FIFO files in two-pass mode.";
+ errmsg = "The file \"%s\" is a pipe or FIFO; sharkd can't read pipe or FIFO files in two-pass mode.";
break;
case WTAP_ERR_FILE_UNKNOWN_FORMAT:
/* Seen only when opening a capture file for reading. */
- errmsg = "The file \"%s\" isn't a capture file in a format TShark understands.";
+ errmsg = "The file \"%s\" isn't a capture file in a format sharkd understands.";
break;
case WTAP_ERR_UNSUPPORTED:
/* Seen only when opening a capture file for reading. */
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
- "The file \"%%s\" contains record data that TShark doesn't support.\n"
+ "The file \"%%s\" contains record data that sharkd doesn't support.\n"
"(%s)",
err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
@@ -626,13 +594,13 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
case WTAP_ERR_UNWRITABLE_FILE_TYPE:
/* Seen only when opening a capture file for writing. */
- errmsg = "TShark doesn't support writing capture files in that format.";
+ errmsg = "sharkd doesn't support writing capture files in that format.";
break;
case WTAP_ERR_UNWRITABLE_ENCAP:
/* Seen only when opening a capture file for writing. */
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
- "TShark can't save this capture as a \"%s\" file.",
+ "sharkd can't save this capture as a \"%s\" file.",
wtap_file_type_subtype_short_string(file_type));
errmsg = errmsg_errno;
break;
@@ -640,11 +608,11 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
case WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED:
if (for_writing) {
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
- "TShark can't save this capture as a \"%s\" file.",
+ "sharkd can't save this capture as a \"%s\" file.",
wtap_file_type_subtype_short_string(file_type));
errmsg = errmsg_errno;
} else
- errmsg = "The file \"%s\" is a capture for a network type that TShark doesn't support.";
+ errmsg = "The file \"%s\" is a capture for a network type that sharkd doesn't support.";
break;
case WTAP_ERR_BAD_FILE:
@@ -701,29 +669,30 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
}
/*
- * Open/create errors are reported with an console message in TShark.
+ * General errors and warnings are reported with an console message
+ * in sharkd.
*/
static void
-open_failure_message(const char *filename, int err, gboolean for_writing)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "sharkd: ");
- fprintf(stderr, file_open_error_message(err, for_writing), filename);
+ vfprintf(stderr, msg_format, ap);
fprintf(stderr, "\n");
}
/*
- * General errors are reported with an console message in TShark.
+ * Open/create errors are reported with an console message in sharkd.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+open_failure_message(const char *filename, int err, gboolean for_writing)
{
fprintf(stderr, "sharkd: ");
- vfprintf(stderr, msg_format, ap);
+ fprintf(stderr, file_open_error_message(err, for_writing), filename);
fprintf(stderr, "\n");
}
/*
- * Read errors are reported with an console message in TShark.
+ * Read errors are reported with an console message in sharkd.
*/
static void
read_failure_message(const char *filename, int err)
@@ -733,7 +702,7 @@ read_failure_message(const char *filename, int err)
}
/*
- * Write errors are reported with an console message in TShark.
+ * Write errors are reported with an console message in sharkd.
*/
static void
write_failure_message(const char *filename, int err)
diff --git a/tfshark.c b/tfshark.c
index eca10771fc..294a08e0a8 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -51,7 +51,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
#include <wsutil/privileges.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <ws_version_info.h>
#include "globals.h"
@@ -146,9 +146,9 @@ static gboolean write_finale(void);
static const char *cf_open_error_message(int err, gchar *err_info,
gboolean for_writing, int file_type);
+static void failure_warning_message(const char *msg_format, va_list ap);
static void open_failure_message(const char *filename, int err,
gboolean for_writing);
-static void failure_message(const char *msg_format, va_list ap);
static void read_failure_message(const char *filename, int err);
static void write_failure_message(const char *filename, int err);
static void failure_message_cont(const char *msg_format, va_list ap);
@@ -335,11 +335,8 @@ main(int argc, char *argv[])
gboolean arg_error = FALSE;
char *gpf_path, *pf_path;
- char *gdp_path, *dp_path;
int gpf_open_errno, gpf_read_errno;
int pf_open_errno, pf_read_errno;
- int gdp_open_errno, gdp_read_errno;
- int dp_open_errno, dp_read_errno;
int err;
volatile int exit_status = 0;
gboolean quiet = FALSE;
@@ -379,7 +376,7 @@ main(int argc, char *argv[])
/* Set the C-language locale to the native environment. */
setlocale(LC_ALL, "");
- cmdarg_err_init(failure_message, failure_message_cont);
+ cmdarg_err_init(failure_warning_message, failure_message_cont);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
@@ -501,8 +498,9 @@ main(int argc, char *argv[])
(GLogLevelFlags)log_flags,
tfshark_log_handler, NULL /* user_data */);
- init_report_err(failure_message, open_failure_message, read_failure_message,
- write_failure_message);
+ init_report_message(failure_warning_message, failure_warning_message,
+ open_failure_message, read_failure_message,
+ write_failure_message);
timestamp_set_type(TS_RELATIVE);
timestamp_set_precision(TS_PREC_AUTO);
@@ -628,37 +626,11 @@ main(int argc, char *argv[])
pf_path = NULL;
}
- /* Read the disabled protocols file. */
- read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- read_enabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- read_disabled_heur_dissector_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- if (gdp_path != NULL) {
- if (gdp_open_errno != 0) {
- cmdarg_err("Could not open global disabled protocols file\n\"%s\": %s.",
- gdp_path, g_strerror(gdp_open_errno));
- }
- if (gdp_read_errno != 0) {
- cmdarg_err("I/O error reading global disabled protocols file\n\"%s\": %s.",
- gdp_path, g_strerror(gdp_read_errno));
- }
- g_free(gdp_path);
- }
- if (dp_path != NULL) {
- if (dp_open_errno != 0) {
- cmdarg_err(
- "Could not open your disabled protocols file\n\"%s\": %s.", dp_path,
- g_strerror(dp_open_errno));
- }
- if (dp_read_errno != 0) {
- cmdarg_err(
- "I/O error reading your disabled protocols file\n\"%s\": %s.", dp_path,
- g_strerror(dp_read_errno));
- }
- g_free(dp_path);
- }
+ /*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors.
+ */
+ read_enabled_and_disabled_protos();
cap_file_init(&cfile);
@@ -855,6 +827,10 @@ main(int argc, char *argv[])
case 'K': /* Kerberos keytab file */
case 't': /* Time stamp type */
case 'u': /* Seconds type */
+ case LONGOPT_DISABLE_PROTOCOL: /* disable dissection of protocol */
+ case LONGOPT_ENABLE_HEURISTIC: /* enable heuristic dissection of protocol */
+ case LONGOPT_DISABLE_HEURISTIC: /* disable heuristic dissection of protocol */
+ case LONGOPT_ENABLE_PROTOCOL: /* enable dissection of protocol (that is disabled by default) */
if (!dissect_opts_handle_opt(opt, optarg)) {
exit_status = INVALID_OPTION;
goto clean_exit;
@@ -946,12 +922,14 @@ main(int argc, char *argv[])
have a tap filter with one of MATE's late-registered fields as part
of the filter. We can now process all the "-z" arguments. */
start_requested_stats();
-
- /* disabled protocols as per configuration file */
- if (gdp_path == NULL && dp_path == NULL) {
- set_disabled_protos_list();
- set_enabled_protos_list();
- set_disabled_heur_dissector_list();
+
+ /*
+ * Enabled and disabled protocols and heuristic dissectors as per
+ * command-line options.
+ */
+ if (!setup_enabled_and_disabled_protocols()) {
+ exit_status = INVALID_OPTION;
+ goto clean_exit;
}
/* Build the column format array */
@@ -2306,25 +2284,25 @@ cf_open_error_message(int err, gchar *err_info _U_, gboolean for_writing,
}
/*
- * Open/create errors are reported with an console message in TFShark.
+ * General errors and warnings are reported with an console message
+ * in TFShark.
*/
static void
-open_failure_message(const char *filename, int err, gboolean for_writing)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "tfshark: ");
- fprintf(stderr, file_open_error_message(err, for_writing), filename);
+ vfprintf(stderr, msg_format, ap);
fprintf(stderr, "\n");
}
-
/*
- * General errors are reported with an console message in TFShark.
+ * Open/create errors are reported with an console message in TFShark.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+open_failure_message(const char *filename, int err, gboolean for_writing)
{
fprintf(stderr, "tfshark: ");
- vfprintf(stderr, msg_format, ap);
+ fprintf(stderr, file_open_error_message(err, for_writing), filename);
fprintf(stderr, "\n");
}
diff --git a/tshark.c b/tshark.c
index a54df93708..eb7de0f8b6 100644
--- a/tshark.c
+++ b/tshark.c
@@ -60,7 +60,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
#include <wsutil/privileges.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <ws_version_info.h>
#include <wiretap/wtap_opttypes.h>
#include <wiretap/pcapng.h>
@@ -239,9 +239,9 @@ static gboolean write_finale(void);
static const char *cf_open_error_message(int err, gchar *err_info,
gboolean for_writing, int file_type);
+static void failure_warning_message(const char *msg_format, va_list ap);
static void open_failure_message(const char *filename, int err,
gboolean for_writing);
-static void failure_message(const char *msg_format, va_list ap);
static void read_failure_message(const char *filename, int err);
static void write_failure_message(const char *filename, int err);
static void failure_message_cont(const char *msg_format, va_list ap);
@@ -666,12 +666,9 @@ main(int argc, char *argv[])
#endif /* _WIN32 */
char *gpf_path, *pf_path;
- char *gdp_path, *dp_path;
char *cf_path;
int gpf_open_errno, gpf_read_errno;
int pf_open_errno, pf_read_errno;
- int gdp_open_errno, gdp_read_errno;
- int dp_open_errno, dp_read_errno;
int cf_open_errno;
int err;
volatile int exit_status = EXIT_SUCCESS;
@@ -734,7 +731,7 @@ main(int argc, char *argv[])
/* Set the C-language locale to the native environment. */
setlocale(LC_ALL, "");
- cmdarg_err_init(failure_message, failure_message_cont);
+ cmdarg_err_init(failure_warning_message, failure_message_cont);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
@@ -888,8 +885,9 @@ main(int argc, char *argv[])
tshark_log_handler, NULL /* user_data */);
#endif
- init_report_err(failure_message, open_failure_message, read_failure_message,
- write_failure_message);
+ init_report_message(failure_warning_message, failure_warning_message,
+ open_failure_message, read_failure_message,
+ write_failure_message);
#ifdef HAVE_LIBPCAP
capture_opts_init(&global_capture_opts);
@@ -1045,37 +1043,11 @@ main(int argc, char *argv[])
g_free(cf_path);
}
- /* Read the disabled protocols file. */
- read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- read_enabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- read_disabled_heur_dissector_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
- &dp_path, &dp_open_errno, &dp_read_errno);
- if (gdp_path != NULL) {
- if (gdp_open_errno != 0) {
- cmdarg_err("Could not open global disabled protocols file\n\"%s\": %s.",
- gdp_path, g_strerror(gdp_open_errno));
- }
- if (gdp_read_errno != 0) {
- cmdarg_err("I/O error reading global disabled protocols file\n\"%s\": %s.",
- gdp_path, g_strerror(gdp_read_errno));
- }
- g_free(gdp_path);
- }
- if (dp_path != NULL) {
- if (dp_open_errno != 0) {
- cmdarg_err(
- "Could not open your disabled protocols file\n\"%s\": %s.", dp_path,
- g_strerror(dp_open_errno));
- }
- if (dp_read_errno != 0) {
- cmdarg_err(
- "I/O error reading your disabled protocols file\n\"%s\": %s.", dp_path,
- g_strerror(dp_read_errno));
- }
- g_free(dp_path);
- }
+ /*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors.
+ */
+ read_enabled_and_disabled_protos();
cap_file_init(&cfile);
@@ -1839,43 +1811,13 @@ main(int argc, char *argv[])
timestamp_set_type(global_dissect_options.time_format);
- /* disabled protocols as per configuration file */
- if (gdp_path == NULL && dp_path == NULL) {
- set_disabled_protos_list();
- set_enabled_protos_list();
- set_disabled_heur_dissector_list();
- }
-
- if(global_dissect_options.disable_protocol_slist) {
- GSList *proto_disable;
- for (proto_disable = global_dissect_options.disable_protocol_slist; proto_disable != NULL; proto_disable = g_slist_next(proto_disable))
- {
- proto_disable_proto_by_name((char*)proto_disable->data);
- }
- }
-
- if(global_dissect_options.enable_protocol_slist) {
- GSList *proto_enable;
- for (proto_enable = global_dissect_options.enable_protocol_slist; proto_enable != NULL; proto_enable = g_slist_next(proto_enable))
- {
- proto_enable_proto_by_name((char*)proto_enable->data);
- }
- }
-
- if(global_dissect_options.enable_heur_slist) {
- GSList *heur_enable;
- for (heur_enable = global_dissect_options.enable_heur_slist; heur_enable != NULL; heur_enable = g_slist_next(heur_enable))
- {
- proto_enable_heuristic_by_name((char*)heur_enable->data, TRUE);
- }
- }
-
- if(global_dissect_options.disable_heur_slist) {
- GSList *heur_disable;
- for (heur_disable = global_dissect_options.disable_heur_slist; heur_disable != NULL; heur_disable = g_slist_next(heur_disable))
- {
- proto_enable_heuristic_by_name((char*)heur_disable->data, FALSE);
- }
+ /*
+ * Enabled and disabled protocols and heuristic dissectors as per
+ * command-line options.
+ */
+ if (!setup_enabled_and_disabled_protocols()) {
+ exit_status = INVALID_OPTION;
+ goto clean_exit;
}
/* Build the column format array */
@@ -4383,24 +4325,25 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
}
/*
- * Open/create errors are reported with an console message in TShark.
+ * General errors and warnings are reported with an console message
+ * in TShark.
*/
static void
-open_failure_message(const char *filename, int err, gboolean for_writing)
+failure_warning_message(const char *msg_format, va_list ap)
{
fprintf(stderr, "tshark: ");
- fprintf(stderr, file_open_error_message(err, for_writing), filename);
+ vfprintf(stderr, msg_format, ap);
fprintf(stderr, "\n");
}
/*
- * General errors are reported with an console message in TShark.
+ * Open/create errors are reported with an console message in TShark.
*/
static void
-failure_message(const char *msg_format, va_list ap)
+open_failure_message(const char *filename, int err, gboolean for_writing)
{
fprintf(stderr, "tshark: ");
- vfprintf(stderr, msg_format, ap);
+ fprintf(stderr, file_open_error_message(err, for_writing), filename);
fprintf(stderr, "\n");
}
diff --git a/ui/alert_box.c b/ui/alert_box.c
index c367fb43c7..d49c30b660 100644
--- a/ui/alert_box.c
+++ b/ui/alert_box.c
@@ -52,6 +52,12 @@ vfailure_alert_box(const char *msg_format, va_list ap)
vsimple_error_message_box(msg_format, ap);
}
+void
+vwarning_alert_box(const char *msg_format, va_list ap)
+{
+ vsimple_error_message_box(msg_format, ap);
+}
+
/*
* Alert box for a failed attempt to open or create a file.
* "err" is assumed to be a UNIX-style errno; "for_writing" is TRUE if
diff --git a/ui/alert_box.h b/ui/alert_box.h
index 1028027eb1..9e8c6a64f6 100644
--- a/ui/alert_box.h
+++ b/ui/alert_box.h
@@ -35,6 +35,11 @@ extern void failure_alert_box(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
extern void vfailure_alert_box(const char *msg_format, va_list ap);
/*
+ * Alert box for general warnings.
+ */
+extern void vwarning_alert_box(const char *msg_format, va_list ap);
+
+/*
* Alert box for a failed attempt to open or create a file.
* "err" is assumed to be a UNIX-style errno; "for_writing" is TRUE if
* the file is being opened for writing and FALSE if it's being opened
diff --git a/ui/cli/tap-stats_tree.c b/ui/cli/tap-stats_tree.c
index e3d7b7ac30..1fbfc09995 100644
--- a/ui/cli/tap-stats_tree.c
+++ b/ui/cli/tap-stats_tree.c
@@ -27,7 +27,7 @@
#include <stdio.h>
#include <glib.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <epan/stats_tree_priv.h>
#include <epan/stat_tap_ui.h>
diff --git a/ui/dissect_opts.c b/ui/dissect_opts.c
index 65afd245c1..6b2ac21121 100644
--- a/ui/dissect_opts.c
+++ b/ui/dissect_opts.c
@@ -34,6 +34,7 @@
#include <epan/prefs.h>
#include <epan/timestamp.h>
#include <epan/addr_resolv.h>
+#include <epan/disabled_protos.h>
#include "ui/decode_as_utils.h"
@@ -161,6 +162,49 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p)
return TRUE;
}
+gboolean
+setup_enabled_and_disabled_protocols(void)
+{
+ gboolean success = TRUE;
+
+ if (global_dissect_options.disable_protocol_slist) {
+ GSList *proto_disable;
+
+ for (proto_disable = global_dissect_options.disable_protocol_slist; proto_disable != NULL; proto_disable = g_slist_next(proto_disable))
+ proto_disable_proto_by_name((char*)proto_disable->data);
+ }
+
+ if (global_dissect_options.enable_protocol_slist) {
+ GSList *proto_enable;
+
+ for (proto_enable = global_dissect_options.enable_protocol_slist; proto_enable != NULL; proto_enable = g_slist_next(proto_enable))
+ proto_enable_proto_by_name((char*)proto_enable->data);
+ }
+
+ if (global_dissect_options.enable_heur_slist) {
+ GSList *heur_enable;
+
+ for (heur_enable = global_dissect_options.enable_heur_slist; heur_enable != NULL; heur_enable = g_slist_next(heur_enable)) {
+ if (!proto_enable_heuristic_by_name((char*)heur_enable->data, TRUE)) {
+ cmdarg_err("No such protocol %s, can't enable", (char*)heur_enable->data);
+ success = FALSE;
+ }
+ }
+ }
+
+ if (global_dissect_options.disable_heur_slist) {
+ GSList *heur_disable;
+
+ for (heur_disable = global_dissect_options.disable_heur_slist; heur_disable != NULL; heur_disable = g_slist_next(heur_disable)) {
+ if (!proto_enable_heuristic_by_name((char*)heur_disable->data, FALSE)) {
+ cmdarg_err("No such protocol %s, can't disable", (char*)heur_disable->data);
+ success = FALSE;
+ }
+ }
+ }
+ return success;
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/ui/dissect_opts.h b/ui/dissect_opts.h
index 227ebfc291..9ed08a7529 100644
--- a/ui/dissect_opts.h
+++ b/ui/dissect_opts.h
@@ -93,6 +93,16 @@ dissect_opts_init(void);
extern gboolean
dissect_opts_handle_opt(int opt, char *optarg_str_p);
+/*
+ * Set up disabled protocols and enabled/disabled heuristic protocols
+ * as per specified command-line options.
+ *
+ * Returns TRUE if all specified heuristic protocols exist, FALSE
+ * otherwise.
+ */
+extern gboolean
+setup_enabled_and_disabled_protocols(void);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/ui/gtk/compare_stat.c b/ui/gtk/compare_stat.c
index 9a5d7d04a8..224c24b58e 100644
--- a/ui/gtk/compare_stat.c
+++ b/ui/gtk/compare_stat.c
@@ -38,7 +38,7 @@
#include <gtk/gtk.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <epan/stat_tap_ui.h>
#include <epan/to_str.h>
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index b7002f5660..50b3c4c42d 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -53,7 +53,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
#include <wsutil/privileges.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <ws_version_info.h>
#include <wiretap/merge.h>
@@ -208,6 +208,7 @@
#include <gtkmacintegration/gtkosxapplication.h>
#endif
+#define INVALID_OPTION 1
#define INIT_FAILED 2
#define INVALID_CAPABILITY 2
#define INVALID_LINK_TYPE 2
@@ -1902,12 +1903,10 @@ get_wireshark_runtime_info(GString *str)
}
static e_prefs *
-read_configuration_files(char **gdp_path, char **dp_path)
+read_configuration_files(void)
{
int gpf_open_errno, gpf_read_errno;
int cf_open_errno, df_open_errno;
- int gdp_open_errno, gdp_read_errno;
- int dp_open_errno, dp_read_errno;
char *gpf_path, *pf_path;
char *cf_path, *df_path;
int pf_open_errno, pf_read_errno;
@@ -1972,41 +1971,11 @@ read_configuration_files(char **gdp_path, char **dp_path)
g_free(df_path);
}
- /* Read the disabled protocols file. */
- read_disabled_protos_list(gdp_path, &gdp_open_errno, &gdp_read_errno,
- dp_path, &dp_open_errno, &dp_read_errno);
- read_enabled_protos_list(gdp_path, &gdp_open_errno, &gdp_read_errno,
- dp_path, &dp_open_errno, &dp_read_errno);
- read_disabled_heur_dissector_list(gdp_path, &gdp_open_errno, &gdp_read_errno,
- dp_path, &dp_open_errno, &dp_read_errno);
- if (*gdp_path != NULL) {
- if (gdp_open_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "Could not open global disabled protocols file\n\"%s\": %s.",
- *gdp_path, g_strerror(gdp_open_errno));
- }
- if (gdp_read_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "I/O error reading global disabled protocols file\n\"%s\": %s.",
- *gdp_path, g_strerror(gdp_read_errno));
- }
- g_free(*gdp_path);
- *gdp_path = NULL;
- }
- if (*dp_path != NULL) {
- if (dp_open_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "Could not open your disabled protocols file\n\"%s\": %s.",
- *dp_path, g_strerror(dp_open_errno));
- }
- if (dp_read_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "I/O error reading your disabled protocols file\n\"%s\": %s.",
- *dp_path, g_strerror(dp_read_errno));
- }
- g_free(*dp_path);
- *dp_path = NULL;
- }
+ /*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors.
+ */
+ read_enabled_and_disabled_protos();
return prefs_p;
}
@@ -2071,7 +2040,6 @@ main(int argc, char *argv[])
char *rf_path;
int rf_open_errno;
- char *gdp_path, *dp_path;
int err;
#ifdef HAVE_LIBPCAP
gchar *err_str;
@@ -2280,8 +2248,9 @@ main(int argc, char *argv[])
capture_session_init(&global_capture_session, &cfile);
#endif
- init_report_err(vfailure_alert_box, open_failure_alert_box,
- read_failure_alert_box, write_failure_alert_box);
+ init_report_message(vfailure_alert_box, vwarning_alert_box,
+ open_failure_alert_box, read_failure_alert_box,
+ write_failure_alert_box);
/* Non-blank filter means we're remote. Throttle splash screen and resolution updates. */
filter = get_conn_cfilter();
@@ -2357,7 +2326,7 @@ main(int argc, char *argv[])
splash_update(RA_PREFERENCES, NULL, (gpointer)splash_win);
- global_commandline_info.prefs_p = read_configuration_files (&gdp_path, &dp_path);
+ global_commandline_info.prefs_p = read_configuration_files();
/* Removed thread code:
* https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=9e277ae6154fd04bf6a0a34ec5655a73e5a736a3
*/
@@ -2476,43 +2445,13 @@ main(int argc, char *argv[])
}
#endif
- /* disabled protocols as per configuration file */
- if (gdp_path == NULL && dp_path == NULL) {
- set_disabled_protos_list();
- set_enabled_protos_list();
- set_disabled_heur_dissector_list();
- }
-
- if(global_dissect_options.disable_protocol_slist) {
- GSList *proto_disable;
- for (proto_disable = global_dissect_options.disable_protocol_slist; proto_disable != NULL; proto_disable = g_slist_next(proto_disable))
- {
- proto_disable_proto_by_name((char*)proto_disable->data);
- }
- }
-
- if(global_dissect_options.enable_protocol_slist) {
- GSList *proto_enable;
- for (proto_enable = global_dissect_options.enable_protocol_slist; proto_enable != NULL; proto_enable = g_slist_next(proto_enable))
- {
- proto_enable_proto_by_name((char*)proto_enable->data);
- }
- }
-
- if(global_dissect_options.disable_heur_slist) {
- GSList *heur_enable;
- for (heur_enable = global_dissect_options.disable_heur_slist; heur_enable != NULL; heur_enable = g_slist_next(heur_enable))
- {
- proto_enable_heuristic_by_name((char*)heur_enable->data, TRUE);
- }
- }
-
- if(global_dissect_options.disable_heur_slist) {
- GSList *heur_disable;
- for (heur_disable = global_dissect_options.disable_heur_slist; heur_disable != NULL; heur_disable = g_slist_next(heur_disable))
- {
- proto_enable_heuristic_by_name((char*)heur_disable->data, FALSE);
- }
+ /*
+ * Enabled and disabled protocols and heuristic dissectors as per
+ * command-line options.
+ */
+ if (!setup_enabled_and_disabled_protocols()) {
+ ret = INVALID_OPTION;
+ goto clean_exit;
}
build_column_format_array(&cfile.cinfo, global_commandline_info.prefs_p->num_cols, TRUE);
@@ -3314,7 +3253,6 @@ static void copy_global_profile (const gchar *profile_name)
/* Change configuration profile */
void change_configuration_profile (const gchar *profile_name)
{
- char *gdp_path, *dp_path;
char *rf_path;
int rf_open_errno;
gchar* err_msg = NULL;
@@ -3347,11 +3285,18 @@ void change_configuration_profile (const gchar *profile_name)
set_profile_name (profile_name);
profile_bar_update ();
- /* Reset current preferences and apply the new */
+ /*
+ * Reset current preferences and enabled/disabled protocols and
+ * heuristic dissectors.
+ */
prefs_reset();
menu_prefs_reset();
+ proto_reenable_all();
- (void) read_configuration_files (&gdp_path, &dp_path);
+ /*
+ * Read the configuration files for the new profile.
+ */
+ (void) read_configuration_files();
if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
@@ -3379,14 +3324,6 @@ void change_configuration_profile (const gchar *profile_name)
filter_expression_reinit(FILTER_EXPRESSION_REINIT_CREATE);
toolbar_redraw_all();
- /* Enable all protocols and disable from the disabled list */
- proto_enable_all();
- if (gdp_path == NULL && dp_path == NULL) {
- set_disabled_protos_list();
- set_enabled_protos_list();
- set_disabled_heur_dissector_list();
- }
-
/* Reload color filters */
if (!color_filters_reload(&err_msg, color_filter_add_cb)) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg);
diff --git a/ui/gtk/rtp_player.c b/ui/gtk/rtp_player.c
index 269db47179..7b89901b90 100644
--- a/ui/gtk/rtp_player.c
+++ b/ui/gtk/rtp_player.c
@@ -64,7 +64,7 @@
#include <epan/dissectors/packet-rtp.h>
#include <epan/rtp_pt.h>
#include <epan/prefs.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "globals.h"
diff --git a/ui/gtk/simple_dialog.c b/ui/gtk/simple_dialog.c
index a8359186df..00b4a32af6 100644
--- a/ui/gtk/simple_dialog.c
+++ b/ui/gtk/simple_dialog.c
@@ -545,6 +545,15 @@ simple_error_message_box(const char *msg_format, ...)
}
/*
+ * Warning alert box, taking a format and a va_list argument.
+ */
+void
+vsimple_warning_message_box(const char *msg_format, va_list ap)
+{
+ do_simple_message_box(ESD_TYPE_WARN, NULL, NULL, msg_format, ap);
+}
+
+/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
diff --git a/ui/gtk/stats_tree_stat.c b/ui/gtk/stats_tree_stat.c
index cedab7e84c..b2420fd96b 100644
--- a/ui/gtk/stats_tree_stat.c
+++ b/ui/gtk/stats_tree_stat.c
@@ -34,7 +34,7 @@
#include <gtk/gtk.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/file_util.h>
#include <epan/stats_tree_priv.h>
diff --git a/ui/gtk/uat_gui.c b/ui/gtk/uat_gui.c
index 247e522835..aea06302cb 100644
--- a/ui/gtk/uat_gui.c
+++ b/ui/gtk/uat_gui.c
@@ -44,7 +44,7 @@
# include <gdk/gdkkeysyms-compat.h>
#endif
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <epan/dfilter/dfilter-macro.h>
#include <epan/proto.h>
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 35605057b4..d910b73e3c 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -277,6 +277,22 @@ vsimple_error_message_box(const char *msg_format, va_list ap)
sd.exec();
}
+/*
+ * Warning alert box, taking a format and a va_list argument.
+ */
+void
+vsimple_warning_message_box(const char *msg_format, va_list ap)
+{
+#ifdef HAVE_LIBPCAP
+ // We want to quit after reading the capture file, hence
+ // we don't actually open the error dialog.
+ if (global_commandline_info.quit_after_cap)
+ exit(0);
+#endif
+
+ SimpleDialog sd(gbl_cur_main_window_, ESD_TYPE_WARN, ESD_BTN_OK, msg_format, ap);
+ sd.exec();
+}
QMenu* MainWindow::findOrAddMenu(QMenu *parent_menu, QString& menu_text) {
QList<QAction *> actions = parent_menu->actions();
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 4eef2ec9ca..adec39897b 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -1527,8 +1527,7 @@ void MainWindow::reloadLuaPlugins()
proto_tree_->closeContextMenu();
main_ui_->preferenceEditorFrame->animatedHide();
- char *gdp_path, *dp_path;
- wsApp->readConfigurationFiles(&gdp_path, &dp_path, true);
+ wsApp->readConfigurationFiles(true);
prefs_apply_all();
fieldsChanged();
diff --git a/ui/qt/uat_dialog.cpp b/ui/qt/uat_dialog.cpp
index 6530696924..8a2459a251 100644
--- a/ui/qt/uat_dialog.cpp
+++ b/ui/qt/uat_dialog.cpp
@@ -26,7 +26,7 @@
#include "epan/strutil.h"
#include "epan/uat-int.h"
#include "ui/help_url.h"
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include "qt_ui_utils.h"
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 0f25eee0a2..a2637adf9b 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -326,7 +326,6 @@ int WiresharkApplication::monospaceTextSize(const char *str)
void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bool write_recent)
{
- char *gdp_path, *dp_path;
char *rf_path;
int rf_open_errno;
gchar *err_msg = NULL;
@@ -379,7 +378,7 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bo
emit profileNameChanged(profile_name);
/* Apply new preferences */
- readConfigurationFiles (&gdp_path, &dp_path, true);
+ readConfigurationFiles(true);
if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
@@ -413,14 +412,6 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bo
emit captureFilterListChanged();
emit displayFilterListChanged();
- /* Enable all protocols and disable from the disabled list */
- proto_enable_all();
- if (gdp_path == NULL && dp_path == NULL) {
- set_disabled_protos_list();
- set_enabled_protos_list();
- set_disabled_heur_dissector_list();
- }
-
/* Reload color filters */
if (!color_filters_reload(&err_msg, color_filter_add_cb)) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg);
@@ -1102,20 +1093,23 @@ void WiresharkApplication::allSystemsGo()
#endif
}
-_e_prefs *WiresharkApplication::readConfigurationFiles(char **gdp_path, char **dp_path, bool reset)
+_e_prefs *WiresharkApplication::readConfigurationFiles(bool reset)
{
int gpf_open_errno, gpf_read_errno;
int cf_open_errno, df_open_errno;
- int gdp_open_errno, gdp_read_errno;
- int dp_open_errno, dp_read_errno;
char *gpf_path, *pf_path;
char *cf_path, *df_path;
int pf_open_errno, pf_read_errno;
e_prefs *prefs_p;
if (reset) {
- // reset preferences before reading
+ //
+ // Reset current preferences and enabled/disabled protocols and
+ // heuristic dissectors before reading.
+ // (Needed except when this is called at startup.)
+ //
prefs_reset();
+ proto_reenable_all();
}
/* load the decode as entries of this profile */
@@ -1177,41 +1171,11 @@ _e_prefs *WiresharkApplication::readConfigurationFiles(char **gdp_path, char **d
g_free(df_path);
}
- /* Read the disabled protocols file. */
- read_disabled_protos_list(gdp_path, &gdp_open_errno, &gdp_read_errno,
- dp_path, &dp_open_errno, &dp_read_errno);
- read_enabled_protos_list(gdp_path, &gdp_open_errno, &gdp_read_errno,
- dp_path, &dp_open_errno, &dp_read_errno);
- read_disabled_heur_dissector_list(gdp_path, &gdp_open_errno, &gdp_read_errno,
- dp_path, &dp_open_errno, &dp_read_errno);
- if (*gdp_path != NULL) {
- if (gdp_open_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "Could not open global disabled protocols file\n\"%s\": %s.",
- *gdp_path, g_strerror(gdp_open_errno));
- }
- if (gdp_read_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "I/O error reading global disabled protocols file\n\"%s\": %s.",
- *gdp_path, g_strerror(gdp_read_errno));
- }
- g_free(*gdp_path);
- *gdp_path = NULL;
- }
- if (*dp_path != NULL) {
- if (dp_open_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "Could not open your disabled protocols file\n\"%s\": %s.", *dp_path,
- g_strerror(dp_open_errno));
- }
- if (dp_read_errno != 0) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "I/O error reading your disabled protocols file\n\"%s\": %s.", *dp_path,
- g_strerror(dp_read_errno));
- }
- g_free(*dp_path);
- *dp_path = NULL;
- }
+ /*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors.
+ */
+ read_enabled_and_disabled_protos();
return prefs_p;
}
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index 68706699db..fc81bc5333 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -103,7 +103,7 @@ public:
void allSystemsGo();
void refreshLocalInterfaces();
- struct _e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path, bool reset);
+ struct _e_prefs * readConfigurationFiles(bool reset);
QList<recent_item_status *> recentItems() const;
void addRecentItem(const QString filename, qint64 size, bool accessible);
void removeRecentItem(const QString &filename);
diff --git a/ui/simple_dialog.h b/ui/simple_dialog.h
index c83e87cdc8..149201ce11 100644
--- a/ui/simple_dialog.h
+++ b/ui/simple_dialog.h
@@ -148,6 +148,11 @@ extern void vsimple_error_message_box(const char *msg_format, va_list ap);
*/
extern void simple_error_message_box(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
+/*
+ * Warning alert box, taking a format and a va_list argument.
+ */
+extern void vsimple_warning_message_box(const char *msg_format, va_list ap);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index d8a0afb562..ed481d9e40 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -45,7 +45,7 @@
#ifdef HAVE_PLUGINS
#include <wsutil/plugins.h>
#endif
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/unicode-utils.h>
#include <ws_version_info.h>
@@ -124,6 +124,7 @@
#include <QTextCodec>
#endif
+#define INVALID_OPTION 1
#define INIT_FAILED 2
#define INVALID_CAPABILITY 2
#define INVALID_LINK_TYPE 2
@@ -345,7 +346,6 @@ int main(int argc, char *qt_argv[])
char *rf_path;
int rf_open_errno;
- char *gdp_path, *dp_path;
#ifdef HAVE_LIBPCAP
gchar *err_str;
#else
@@ -571,8 +571,9 @@ int main(int argc, char *qt_argv[])
capture_opts_init(&global_capture_opts);
#endif
- init_report_err(vfailure_alert_box, open_failure_alert_box,
- read_failure_alert_box, write_failure_alert_box);
+ init_report_message(vfailure_alert_box, vwarning_alert_box,
+ open_failure_alert_box, read_failure_alert_box,
+ write_failure_alert_box);
wtap_init();
@@ -658,7 +659,7 @@ int main(int argc, char *qt_argv[])
splash_update(RA_PREFERENCES, NULL, NULL);
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_INFO, "Calling module preferences, elapsed time %" G_GUINT64_FORMAT " us \n", g_get_monotonic_time() - start_time);
- global_commandline_info.prefs_p = ws_app.readConfigurationFiles(&gdp_path, &dp_path, false);
+ global_commandline_info.prefs_p = ws_app.readConfigurationFiles(false);
/* Now get our args */
commandline_other_options(argc, argv, TRUE);
@@ -773,43 +774,13 @@ int main(int argc, char *qt_argv[])
}
#endif
- /* disabled protocols as per configuration file */
- if (gdp_path == NULL && dp_path == NULL) {
- set_disabled_protos_list();
- set_enabled_protos_list();
- set_disabled_heur_dissector_list();
- }
-
- if(global_dissect_options.disable_protocol_slist) {
- GSList *proto_disable;
- for (proto_disable = global_dissect_options.disable_protocol_slist; proto_disable != NULL; proto_disable = g_slist_next(proto_disable))
- {
- proto_disable_proto_by_name((char*)proto_disable->data);
- }
- }
-
- if(global_dissect_options.enable_protocol_slist) {
- GSList *proto_enable;
- for (proto_enable = global_dissect_options.enable_protocol_slist; proto_enable != NULL; proto_enable = g_slist_next(proto_enable))
- {
- proto_enable_proto_by_name((char*)proto_enable->data);
- }
- }
-
- if(global_dissect_options.enable_heur_slist) {
- GSList *heur_enable;
- for (heur_enable = global_dissect_options.enable_heur_slist; heur_enable != NULL; heur_enable = g_slist_next(heur_enable))
- {
- proto_enable_heuristic_by_name((char*)heur_enable->data, TRUE);
- }
- }
-
- if(global_dissect_options.disable_heur_slist) {
- GSList *heur_disable;
- for (heur_disable = global_dissect_options.disable_heur_slist; heur_disable != NULL; heur_disable = g_slist_next(heur_disable))
- {
- proto_enable_heuristic_by_name((char*)heur_disable->data, FALSE);
- }
+ /*
+ * Enabled and disabled protocols and heuristic dissectors as per
+ * command-line options.
+ */
+ if (!setup_enabled_and_disabled_protocols()) {
+ ret_val = INVALID_OPTION;
+ goto clean_exit;
}
build_column_format_array(&CaptureFile::globalCapFile()->cinfo, global_commandline_info.prefs_p->num_cols, TRUE);
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt
index e9a4ed100d..ab9bb7ba82 100644
--- a/wsutil/CMakeLists.txt
+++ b/wsutil/CMakeLists.txt
@@ -58,7 +58,7 @@ set(WSUTIL_COMMON_FILES
strnatcmp.c
str_util.c
strtoi.c
- report_err.c
+ report_message.c
tempfile.c
time_util.c
type_util.c
diff --git a/wsutil/Makefile.am b/wsutil/Makefile.am
index 08af239524..680cf0ea75 100644
--- a/wsutil/Makefile.am
+++ b/wsutil/Makefile.am
@@ -74,7 +74,7 @@ libwsutil_nonrepl_INCLUDES = \
plugins.h \
privileges.h \
processes.h \
- report_err.h \
+ report_message.h \
sign_ext.h \
sober128.h \
socket.h \
@@ -143,7 +143,7 @@ libwsutil_la_SOURCES = \
os_version_info.c \
plugins.c \
privileges.c \
- report_err.c \
+ report_message.c \
sober128.c \
str_util.c \
strtoi.c \
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index aa8a5bcafd..afaf1d673f 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -59,7 +59,7 @@
#endif /* _WIN32 */
#include "filesystem.h"
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/privileges.h>
#include <wsutil/file_util.h>
#include <wsutil/utf8_entities.h>
diff --git a/wsutil/plugins.c b/wsutil/plugins.c
index d726e80c1e..76bb59d770 100644
--- a/wsutil/plugins.c
+++ b/wsutil/plugins.c
@@ -37,7 +37,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
#include <wsutil/file_util.h>
-#include <wsutil/report_err.h>
+#include <wsutil/report_message.h>
#include <wsutil/plugins.h>
#include <wsutil/ws_printf.h> /* ws_debug_printf */
diff --git a/wsutil/report_err.c b/wsutil/report_err.c
deleted file mode 100644
index 557b200c90..0000000000
--- a/wsutil/report_err.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* report_err.c
-* Routines for code that can run in GUI and command-line environments to
-* use to report errors to the user (e.g., I/O errors, or problems with
-* preference settings).
-*
-* The application using libwireshark will register error-reporting
-* routines, and the routines defined here will call the registered
-* routines. That way, these routines can be called by code that
-* doesn't itself know whether to pop up a dialog or print something
-* to the standard error.
-*
-* Wireshark - Network traffic analyzer
-* By Gerald Combs <gerald@wireshark.org>
-* Copyright 1998 Gerald Combs
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include "config.h"
-
-#include <glib.h>
-#include "report_err.h"
-
-static void (*vreport_failure_func)(const char *, va_list);
-static void (*report_open_failure_func)(const char *, int, gboolean);
-static void (*report_read_failure_func)(const char *, int);
-static void (*report_write_failure_func)(const char *, int);
-
-void init_report_err(void (*vreport_failure_fcn_p)(const char *, va_list),
- void (*report_open_failure_fcn_p)(const char *, int, gboolean),
- void (*report_read_failure_fcn_p)(const char *, int),
- void (*report_write_failure_fcn_p)(const char *, int))
-{
- vreport_failure_func = vreport_failure_fcn_p;
- report_open_failure_func = report_open_failure_fcn_p;
- report_read_failure_func = report_read_failure_fcn_p;
- report_write_failure_func = report_write_failure_fcn_p;
-}
-
-/*
- * Report a general error.
- */
-void
-report_failure(const char *msg_format, ...)
-{
- va_list ap;
-
- va_start(ap, msg_format);
- (*vreport_failure_func)(msg_format, ap);
- va_end(ap);
-}
-
-/*
- * Report an error when trying to open or create a file.
- * "err" is assumed to be an error code from Wiretap; positive values are
- * UNIX-style errnos, so this can be used for open failures not from
- * Wiretap as long as the failure code is just an errno.
- */
-void
-report_open_failure(const char *filename, int err,
- gboolean for_writing)
-{
- (*report_open_failure_func)(filename, err, for_writing);
-}
-
-/*
- * Report an error when trying to read a file.
- * "err" is assumed to be a UNIX-style errno.
- */
-void
-report_read_failure(const char *filename, int err)
-{
- (*report_read_failure_func)(filename, err);
-}
-
-/*
- * Report an error when trying to write a file.
- * "err" is assumed to be a UNIX-style errno.
- */
-void
-report_write_failure(const char *filename, int err)
-{
- (*report_write_failure_func)(filename, err);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/wsutil/report_message.c b/wsutil/report_message.c
new file mode 100644
index 0000000000..7889549422
--- /dev/null
+++ b/wsutil/report_message.c
@@ -0,0 +1,125 @@
+/* report_message.c
+ * Routines for code that can run in GUI and command-line environments to
+ * use to report errors and warnings to the user (e.g., I/O errors, or
+ * problems with preference settings) if the message should be shown as
+ * a GUI error in a GUI environment.
+ *
+ * The application using libwsutil will register error-reporting
+ * routines, and the routines defined here will call the registered
+ * routines. That way, these routines can be called by code that
+ * doesn't itself know whether to pop up a dialog or print something
+ * to the standard error.
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#include "config.h"
+
+#include <glib.h>
+#include "report_message.h"
+
+static void (*vreport_failure_func)(const char *, va_list);
+static void (*vreport_warning_func)(const char *, va_list);
+static void (*report_open_failure_func)(const char *, int, gboolean);
+static void (*report_read_failure_func)(const char *, int);
+static void (*report_write_failure_func)(const char *, int);
+
+void init_report_message(void (*vreport_failure_fcn_p)(const char *, va_list),
+ void (*vreport_warning_fcn_p)(const char *, va_list),
+ void (*report_open_failure_fcn_p)(const char *, int, gboolean),
+ void (*report_read_failure_fcn_p)(const char *, int),
+ void (*report_write_failure_fcn_p)(const char *, int))
+{
+ vreport_failure_func = vreport_failure_fcn_p;
+ vreport_warning_func = vreport_warning_fcn_p;
+ report_open_failure_func = report_open_failure_fcn_p;
+ report_read_failure_func = report_read_failure_fcn_p;
+ report_write_failure_func = report_write_failure_fcn_p;
+}
+
+/*
+ * Report a general error.
+ */
+void
+report_failure(const char *msg_format, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg_format);
+ (*vreport_failure_func)(msg_format, ap);
+ va_end(ap);
+}
+
+/*
+ * Report a general warning.
+ */
+void
+report_warning(const char *msg_format, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg_format);
+ (*vreport_warning_func)(msg_format, ap);
+ va_end(ap);
+}
+
+/*
+ * Report an error when trying to open or create a file.
+ * "err" is assumed to be an error code from Wiretap; positive values are
+ * UNIX-style errnos, so this can be used for open failures not from
+ * Wiretap as long as the failure code is just an errno.
+ */
+void
+report_open_failure(const char *filename, int err,
+ gboolean for_writing)
+{
+ (*report_open_failure_func)(filename, err, for_writing);
+}
+
+/*
+ * Report an error when trying to read a file.
+ * "err" is assumed to be a UNIX-style errno.
+ */
+void
+report_read_failure(const char *filename, int err)
+{
+ (*report_read_failure_func)(filename, err);
+}
+
+/*
+ * Report an error when trying to write a file.
+ * "err" is assumed to be a UNIX-style errno.
+ */
+void
+report_write_failure(const char *filename, int err)
+{
+ (*report_write_failure_func)(filename, err);
+}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/wsutil/report_err.h b/wsutil/report_message.h
index fcef2e2e4b..63cbc0d1b4 100644
--- a/wsutil/report_err.h
+++ b/wsutil/report_message.h
@@ -1,9 +1,10 @@
-/* report_err.h
+/* report_message.h
* Declarations of routines for code that can run in GUI and command-line
- * environments to use to report errors to the user (e.g., I/O errors, or
- * problems with preference settings).
+ * environments to use to report errors and warnings to the user (e.g.,
+ * I/O errors, or problems with preference settings) if the message should
+ * be shown as a GUI error in a GUI environment.
*
- * The application using libwireshark will register error-reporting
+ * The application using libwsutil will register message-reporting
* routines, and the routines declared here will call the registered
* routines. That way, these routines can be called by code that
* doesn't itself know whether to pop up a dialog or print something
@@ -28,8 +29,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __REPORT_ERR_H__
-#define __REPORT_ERR_H__
+#ifndef __REPORT_MESSAGE_H__
+#define __REPORT_MESSAGE_H__
#include "ws_symbol_export.h"
@@ -38,10 +39,11 @@ extern "C" {
#endif /* __cplusplus */
/*
- * Initialize the report err routines
+ * Initialize the report message routines
*/
-WS_DLL_PUBLIC void init_report_err(
+WS_DLL_PUBLIC void init_report_message(
void (*vreport_failure)(const char *, va_list),
+ void (*vreport_warning)(const char *, va_list),
void (*report_open_failure)(const char *, int, gboolean),
void (*report_read_failure)(const char *, int),
void (*report_write_failure)(const char *, int));
@@ -52,6 +54,11 @@ WS_DLL_PUBLIC void init_report_err(
WS_DLL_PUBLIC void report_failure(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
/*
+ * Report a general warning.
+ */
+WS_DLL_PUBLIC void report_warning(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
+
+/*
* Report an error when trying to open a file.
* "err" is assumed to be an error code from Wiretap; positive values are
* UNIX-style errnos, so this can be used for open failures not from
@@ -76,4 +83,4 @@ WS_DLL_PUBLIC void report_write_failure(const char *filename, int err);
}
#endif /* __cplusplus */
-#endif /* __REPORT_ERR_H__ */
+#endif /* __REPORT_MESSAGE_H__ */