summaryrefslogtreecommitdiff
path: root/ui/qt/wireshark_application.cpp
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-04-08 12:45:19 -0700
committerGuy Harris <guy@alum.mit.edu>2017-04-08 20:40:08 +0000
commit2c44a7f930967335b442e899c17e1eb46831e3c1 (patch)
tree7ce2db4007feccf638308dc205f509ec385436a3 /ui/qt/wireshark_application.cpp
parentf1751ef22fc9877e59fad3b1c60826bff8569d94 (diff)
downloadwireshark-2c44a7f930967335b442e899c17e1eb46831e3c1.tar.gz
Clean up handling of enabled/disabled protocols/heuristic dissectors.
Add a "report a warning message" routine to the "report_err" code in libwsutil, and rename files and routines appropriately, as they don't only handle errors any more. Have a routine read_enabled_and_disabled_protos() that reads all the files that enable or disable protocols or heuristic dissectors, enables and disables them based on the contents of those files, and reports errors itself (as warnings) using the new "report a warning message" routine. Fix that error reporting to report separately on the disabled protocols, enabled protocols, and heuristic dissectors files. Have a routine to set up the enabled and disabled protocols and heuristic dissectors from the command-line arguments, so it's done the same way in all programs. If we try to enable or disable an unknown heuristic dissector via a command-line argument, report an error. Update a bunch of comments. Update the name of disabled_protos_cleanup(), as it cleans up information for disabled *and* enabled protocols and for heuristic dissectors. Support the command-line flags to enable and disable protocols and heuristic dissectors in tfshark. Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df Reviewed-on: https://code.wireshark.org/review/20966 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/wireshark_application.cpp')
-rw-r--r--ui/qt/wireshark_application.cpp62
1 files changed, 13 insertions, 49 deletions
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;
}