aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debian/libwireshark0.symbols5
-rw-r--r--dftest.c3
-rw-r--r--epan/decode_as.h4
-rw-r--r--epan/disabled_protos.h5
-rw-r--r--epan/epan.c22
-rw-r--r--epan/epan.h7
-rw-r--r--epan/prefs.h7
-rw-r--r--rawshark.c9
-rw-r--r--sharkd.c12
-rw-r--r--tfshark.c11
-rw-r--r--tshark.c16
-rw-r--r--ui/gtk/main.c13
-rw-r--r--ui/qt/wireshark_application.cpp13
13 files changed, 59 insertions, 68 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols
index 6b0b943eed..a7da4fd965 100644
--- a/debian/libwireshark0.symbols
+++ b/debian/libwireshark0.symbols
@@ -499,6 +499,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
epan_get_user_comment@Base 1.99.2
epan_get_version@Base 1.9.1
epan_init@Base 1.9.1
+ epan_load_settings@Base 2.3.0
epan_memmem@Base 1.9.1
epan_new@Base 1.12.0~rc1
epan_register_plugin_types@Base 1.12.0~rc1
@@ -857,7 +858,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
link_type_vals@Base 2.1.0
list_stat_cmd_args@Base 1.9.1
llc_add_oui@Base 1.9.1
- load_decode_as_entries@Base 2.3.0
make_printable_string@Base 1.9.1
manually_resolve_cleanup@Base 1.12.0~rc1
mark_frame_as_depended_upon@Base 1.9.1
@@ -1235,11 +1235,8 @@ libwireshark.so.0 libwireshark0 #MINVER#
range_add_value@Base 2.3.0
range_remove_value@Base 2.3.0
ranges_are_equal@Base 1.9.1
- read_enabled_and_disabled_lists@Base 2.3.0
- read_enabled_protos_list@Base 2.3.0
read_keytab_file@Base 1.9.1
read_keytab_file_from_preferences@Base 1.9.1
- read_prefs@Base 1.9.1
read_prefs_file@Base 1.9.1
reassembly_table_register@Base 2.3.0
reassembly_table_destroy@Base 1.9.1
diff --git a/dftest.c b/dftest.c
index 81e5185260..73cdb6425d 100644
--- a/dftest.c
+++ b/dftest.c
@@ -106,7 +106,8 @@ main(int argc, char **argv)
/* set the c-language locale to the native environment. */
setlocale(LC_ALL, "");
- read_prefs();
+ /* Load libwireshark settings from the current profile. */
+ epan_load_settings();
/* notify all registered modules that have had any of their preferences
changed either from one of the preferences file or from the command
diff --git a/epan/decode_as.h b/epan/decode_as.h
index a7b03b7025..931d782d28 100644
--- a/epan/decode_as.h
+++ b/epan/decode_as.h
@@ -100,8 +100,10 @@ WS_DLL_PUBLIC GList *decode_as_list;
/* Some useful utilities for Decode As */
/** Reset the "decode as" entries and reload ones of the current profile.
+ * This is called by epan_load_settings(); programs should call that
+ * rather than individually calling the routines it calls.
*/
-WS_DLL_PUBLIC void load_decode_as_entries(void);
+extern void load_decode_as_entries(void);
/** Write out the "decode as" entries of the current profile.
*/
diff --git a/epan/disabled_protos.h b/epan/disabled_protos.h
index 03da425729..0d729e0c87 100644
--- a/epan/disabled_protos.h
+++ b/epan/disabled_protos.h
@@ -52,8 +52,11 @@ 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.
+ *
+ * This is called by epan_load_settings(); programs should call that
+ * rather than individually calling the routines it calls.
*/
-WS_DLL_PUBLIC void
+extern void
read_enabled_and_disabled_lists(void);
/*
diff --git a/epan/epan.c b/epan/epan.c
index e0503801d1..464cc75cb1 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -209,6 +209,28 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da
return status;
}
+/*
+ * Load all settings, from the current profile, that affect libwireshark.
+ */
+e_prefs *
+epan_load_settings(void)
+{
+ e_prefs *prefs_p;
+
+ /* load the decode as entries of the current profile */
+ load_decode_as_entries();
+
+ prefs_p = read_prefs();
+
+ /*
+ * Read the files that enable and disable protocols and heuristic
+ * dissectors.
+ */
+ read_enabled_and_disabled_lists();
+
+ return prefs_p;
+}
+
void
epan_cleanup(void)
{
diff --git a/epan/epan.h b/epan/epan.h
index f809c117f9..5e7e87cfa4 100644
--- a/epan/epan.h
+++ b/epan/epan.h
@@ -28,6 +28,7 @@ extern "C" {
#include <glib.h>
#include <epan/tvbuff.h>
+#include <epan/prefs.h>
#include <epan/frame_data.h>
#include "register.h"
#include "ws_symbol_export.h"
@@ -102,6 +103,12 @@ gboolean epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer
void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
register_cb cb, void *client_data);
+/**
+ * Load all settings, from the current profile, that affect epan.
+ */
+WS_DLL_PUBLIC
+e_prefs *epan_load_settings(void);
+
/** cleanup the whole epan module, this is used to be called only once in a program */
WS_DLL_PUBLIC
void epan_cleanup(void);
diff --git a/epan/prefs.h b/epan/prefs.h
index 77a3624ff5..1f9f38a41d 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -590,8 +590,11 @@ char *prefs_pref_to_str(pref_t *pref, pref_source_t source);
/* Read the preferences file, fill in "prefs", and return a pointer to it.
If we got an error (other than "it doesn't exist") we report it through
- the UI. */
-WS_DLL_PUBLIC e_prefs *read_prefs(void);
+ the UI.
+
+ This is called by epan_load_settings(); programs should call that
+ rather than individually calling the routines it calls. */
+extern e_prefs *read_prefs(void);
/* Write out "prefs" to the user's preferences file, and return 0.
diff --git a/rawshark.c b/rawshark.c
index 43d76be232..988d59ae91 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -541,13 +541,8 @@ main(int argc, char *argv[])
goto clean_exit;
}
- prefs_p = read_prefs();
-
- /*
- * Read the files that enable and disable protocols and heuristic
- * dissectors.
- */
- read_enabled_and_disabled_lists();
+ /* Load libwireshark settings from the current profile. */
+ prefs_p = epan_load_settings();
#ifdef _WIN32
ws_init_dll_search_path();
diff --git a/sharkd.c b/sharkd.c
index 3b10e89f79..712e73117d 100644
--- a/sharkd.c
+++ b/sharkd.c
@@ -201,10 +201,8 @@ main(int argc, char *argv[])
goto clean_exit;
}
- /* load the decode as entries of this profile */
- load_decode_as_entries();
-
- prefs_p = read_prefs();
+ /* Load libwireshark settings from the current profile. */
+ prefs_p = epan_load_settings();
read_filter_list(CFILTER_LIST);
@@ -213,12 +211,6 @@ main(int argc, char *argv[])
g_free(err_msg);
}
- /*
- * Read the files that enable and disable protocols and heuristic
- * dissectors.
- */
- read_enabled_and_disabled_lists();
-
cap_file_init(&cfile);
/* Notify all registered modules that have had any of their preferences
diff --git a/tfshark.c b/tfshark.c
index e72645aedb..2dcd57385f 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -557,7 +557,7 @@ main(int argc, char *argv[])
if (strcmp(argv[2], "column-formats") == 0)
column_dump_column_formats();
else if (strcmp(argv[2], "currentprefs") == 0) {
- read_prefs();
+ epan_load_settings();
write_prefs(NULL);
}
else if (strcmp(argv[2], "decodes") == 0)
@@ -597,13 +597,8 @@ main(int argc, char *argv[])
goto clean_exit;
}
- prefs_p = read_prefs();
-
- /*
- * Read the files that enable and disable protocols and heuristic
- * dissectors.
- */
- read_enabled_and_disabled_lists();
+ /* Load libwireshark settings from the current profile. */
+ prefs_p = epan_load_settings();
cap_file_init(&cfile);
diff --git a/tshark.c b/tshark.c
index 6a7e345507..d8e70622a6 100644
--- a/tshark.c
+++ b/tshark.c
@@ -953,7 +953,7 @@ main(int argc, char *argv[])
if (strcmp(argv[2], "column-formats") == 0)
column_dump_column_formats();
else if (strcmp(argv[2], "currentprefs") == 0) {
- read_prefs();
+ epan_load_settings();
write_prefs(NULL);
}
else if (strcmp(argv[2], "decodes") == 0)
@@ -1000,21 +1000,13 @@ main(int argc, char *argv[])
goto clean_exit;
}
- /* load the decode as entries of this profile */
- load_decode_as_entries();
+ tshark_debug("tshark reading settings");
- tshark_debug("tshark reading preferences");
-
- prefs_p = read_prefs();
+ /* Load libwireshark settings from the current profile. */
+ prefs_p = epan_load_settings();
read_filter_list(CFILTER_LIST);
- /*
- * Read the files that enable and disable protocols and heuristic
- * dissectors.
- */
- read_enabled_and_disabled_lists();
-
cap_file_init(&cfile);
/* Print format defaults to this. */
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 1516fbadce..b9b4292cc4 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -1907,11 +1907,8 @@ read_configuration_files(void)
{
e_prefs *prefs_p;
- /* load the decode as entries of this profile */
- load_decode_as_entries();
-
- /* Read the preference files. */
- prefs_p = read_prefs();
+ /* Load libwireshark settings from the current profile. */
+ prefs_p = epan_load_settings();
#ifdef _WIN32
/* if the user wants a console to be always there, well, we should open one for him */
@@ -1926,12 +1923,6 @@ read_configuration_files(void)
/* Read the display filter file. */
read_filter_list(DFILTER_LIST);
- /*
- * Read the files that enable and disable protocols and heuristic
- * dissectors.
- */
- read_enabled_and_disabled_lists();
-
return prefs_p;
}
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 3345bf4bd3..dfffc9748b 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -1107,11 +1107,8 @@ _e_prefs *WiresharkApplication::readConfigurationFiles(bool reset)
proto_reenable_all();
}
- /* load the decode as entries of this profile */
- load_decode_as_entries();
-
- /* Read the preference files. */
- prefs_p = read_prefs();
+ /* Load libwireshark settings from the current profile. */
+ prefs_p = epan_load_settings();
#ifdef _WIN32
/* if the user wants a console to be always there, well, we should open one for him */
@@ -1126,12 +1123,6 @@ _e_prefs *WiresharkApplication::readConfigurationFiles(bool reset)
/* Read the display filter file. */
read_filter_list(DFILTER_LIST);
- /*
- * Read the files that enable and disable protocols and heuristic
- * dissectors.
- */
- read_enabled_and_disabled_lists();
-
return prefs_p;
}