*
* $Id$
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * 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
#define MAX_VAL_LEN 1024
-/* only GTK1 *or* GTK2 font_name should be used */
-#if GTK_MAJOR_VERSION < 2
-#define PREFS_GUI_FONT_NAME gui_font_name1
-#else
-#define PREFS_GUI_FONT_NAME gui_font_name2
-#endif
+#define RTP_PLAYER_DEFAULT_VISIBLE 4
+#define TAP_UPDATE_DEFAULT_INTERVAL 3000
/*
* Convert a string listing name resolution types to a bitmask of
gint gui_ptree_expander_style;
gboolean gui_hex_dump_highlight_style;
gint gui_toolbar_main_style;
- gchar *gui_font_name1;
- gchar *gui_font_name2;
+ gchar *gui_font_name;
color_t gui_marked_fg;
color_t gui_marked_bg;
+ gchar *gui_colorized_fg;
+ gchar *gui_colorized_bg;
gboolean gui_geometry_save_position;
gboolean gui_geometry_save_size;
gboolean gui_geometry_save_maximized;
+ gboolean gui_macosx_style;
console_open_e gui_console_open;
+ guint gui_recent_df_entries_max;
guint gui_recent_files_count_max;
guint gui_fileopen_style;
gchar *gui_fileopen_dir;
guint gui_fileopen_preview;
gboolean gui_ask_unsaved;
gboolean gui_find_wrap;
+ gboolean gui_use_pref_save;
gchar *gui_webbrowser;
+ gchar *gui_window_title;
+ gchar *gui_start_title;
+ gboolean gui_version_in_start_page;
layout_type_e gui_layout_type;
layout_pane_content_e gui_layout_content_1;
layout_pane_content_e gui_layout_content_2;
layout_pane_content_e gui_layout_content_3;
+ gint console_log_level;
guint32 name_resolve;
gint name_resolve_concurrency;
gchar *capture_device;
+ gchar *capture_devices_linktypes;
gchar *capture_devices_descr;
gchar *capture_devices_hide;
gboolean capture_prom_mode;
gboolean capture_real_time;
gboolean capture_auto_scroll;
gboolean capture_show_info;
+ guint rtp_player_max_visible;
+ guint tap_update_interval;
+ gboolean display_hidden_proto_items;
} e_prefs;
-ETH_VAR_IMPORT e_prefs prefs;
+WS_VAR_IMPORT e_prefs prefs;
/*
* Routines to let modules that have preference settings register
typedef struct pref_module module_t;
+/** Sets up memory used by proto routines. Called at program startup */
+extern void prefs_init(void);
+
+/** Reset preferences to default values. Called at profile change */
+extern void prefs_reset(void);
+
+/** Frees memory used by proto routines. Called at program shutdown */
+extern void prefs_cleanup(void);
+
/*
* Register a module that will have preferences.
* Specify the module under which to register it or NULL to register it
* call so that the "Protocol Properties..." menu item works.
*/
extern module_t *prefs_register_module(module_t *parent, const char *name,
- const char *title, void (*apply_cb)(void));
+ const char *title, const char *description, void (*apply_cb)(void));
/*
* Register a subtree that will have modules under it.
* at the top level and the title used in the tab for it in a preferences
* dialog box.
*/
-extern module_t *prefs_register_subtree(module_t *parent, const char *title);
+extern module_t *prefs_register_subtree(module_t *parent, const char *title,
+ const char *description);
/*
* Register that a protocol has preferences.
*/
extern module_t *prefs_register_protocol(int id, void (*apply_cb)(void));
+/*
+ * Register that a protocol has preferences and group it under a single
+ * subtree
+ */
+#define PREFERENCE_GROUPING
+extern module_t *prefs_register_protocol_subtree(const char *subtree, int id,
+ void (*apply_cb)(void));
+
/*
* Register that a protocol used to have preferences but no longer does,
* by creating an "obsolete" module for it.
typedef guint (*module_cb)(module_t *module, gpointer user_data);
/*
- * Call a callback function, with a specified argument, for each module
- * in a list of modules. If the list is NULL, searches the top-level
- * list in the display tree of modules.
- *
- * Ignores "obsolete" modules; their sole purpose is to allow old
- * preferences for dissectors that no longer have preferences to be
- * silently ignored in preference files. Does not ignore subtrees,
- * as this can be used when walking the display tree of modules.
+ * Returns TRUE if module has any submodules
*/
-extern guint prefs_module_list_foreach(GList *module_list, module_cb callback,
- gpointer user_data);
+extern gboolean prefs_module_has_submodules(module_t *module);
/*
* Call a callback function, with a specified argument, for each module
*/
extern guint prefs_modules_foreach(module_cb callback, gpointer user_data);
+/*
+ * Call a callback function, with a specified argument, for each submodule
+ * of specified modules. If the module is NULL, goes through the top-level
+ * list in the display tree of modules.
+ *
+ * Ignores "obsolete" modules; their sole purpose is to allow old
+ * preferences for dissectors that no longer have preferences to be
+ * silently ignored in preference files. Does not ignore subtrees,
+ * as this can be used when walking the display tree of modules.
+ */
+extern guint prefs_modules_foreach_submodules(module_t *module, module_cb callback, gpointer user_data);
+
/*
* Call the "apply" callback function for each module if any of its
* preferences have changed, and then clear the flag saying its
*/
extern void prefs_apply_all(void);
+/*
+ * Call the "apply" callback function for a specific module if any of
+ * its preferences have changed, and then clear the flag saying its
+ * preferences have changed, as the module has been notified of that
+ * fact.
+ */
+extern void prefs_apply(module_t *module);
+
+
struct preference;
typedef struct preference pref_t;
/*
* Returns TRUE if the given protocol has registered preferences.
*/
-extern gboolean prefs_is_registered_protocol(char *name);
+extern gboolean prefs_is_registered_protocol(const char *name);
/*
* Returns the module title of a registered protocol (or NULL if unknown).
*/
-extern const char *prefs_get_title_by_name(char *name);
+extern const char *prefs_get_title_by_name(const char *name);
+
+/** Given a module name, return a pointer to its pref_module struct,
+ * or NULL if it's not found.
+ *
+ * @param name The preference module name. Usually the same as the protocol
+ * name, e.g. "tcp".
+ * @return A pointer to the corresponding preference module, or NULL if it
+ * wasn't found.
+ */
+extern module_t *prefs_find_module(const char *name);
/*
* Register a preference with an unsigned integral value.
/*
* Register a preference with an Boolean value.
+ * Note that the name must be in lowercase letters only (underscore allowed).
*/
extern void prefs_register_bool_preference(module_t *module, const char *name,
const char *title, const char *description, gboolean *var);
* Register a preference with an enumerated value.
*/
typedef struct {
- char *name;
- char *description;
- gint value;
+ const char *name;
+ const char *description;
+ gint value;
} enum_val_t;
extern void prefs_register_enum_preference(module_t *module, const char *name,
* Register a preference with a character-string value.
*/
extern void prefs_register_string_preference(module_t *module, const char *name,
- const char *title, const char *description, char **var);
+ const char *title, const char *description, const char **var);
/*
* Register a preference with a ranged value.
const char *title, const char *description, range_t **var,
guint32 max_value);
+/*
+ * Register a static text 'preference'. It can be used to add some info/explanation.
+ */
+extern void prefs_register_static_text_preference(module_t *module, const char *name,
+ const char *title, const char *description);
+
+/*
+ * Register a uat 'preference'. It adds a button that opens the uat's window in the
+ * preferences tab of the module.
+ */
+extern void prefs_register_uat_preference(module_t *module,
+ const char *name,
+ const char* title,
+ const char *description,
+ void* uat);
+
/*
* Register a preference that used to be supported but no longer is.
*/
extern guint prefs_pref_foreach(module_t *module, pref_cb callback,
gpointer user_data);
+/* Parse through a list of comma-separated, possibly quoted strings.
+ * Return a list of the string data.
+ */
+extern GList *prefs_get_string_list(gchar *str);
+
+/* Clear the given list of string data. */
+extern void prefs_clear_string_list(GList *sl);
+
/*
* Register all non-dissector modules' preferences.
*/
* XXX - should supply, for syntax errors, a detailed explanation of
* the syntax error.
*/
-#define PREFS_SET_OK 0 /* succeeded */
-#define PREFS_SET_SYNTAX_ERR 1 /* syntax error in string */
-#define PREFS_SET_NO_SUCH_PREF 2 /* no such preference */
-#define PREFS_SET_OBSOLETE 3 /* preference used to exist but no longer does */
+typedef enum {
+ PREFS_SET_OK, /* succeeded */
+ PREFS_SET_SYNTAX_ERR, /* syntax error in string */
+ PREFS_SET_NO_SUCH_PREF, /* no such preference */
+ PREFS_SET_OBSOLETE /* preference used to exist but no longer does */
+} prefs_set_pref_e;
+
+extern prefs_set_pref_e prefs_set_pref(char *prefarg);
-extern int prefs_set_pref(char *prefarg);
+/*
+ * Returns TRUE if the given device is hidden
+ */
+extern gboolean prefs_is_capture_device_hidden(const char *name);
#endif /* prefs.h */