Add support for a global "ethereal.conf" preferences file, stored in the
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most
likely).
Add a mechanism to allow modules (e.g., dissectors) to register
preference values, which:
can be put into the global or the user's preference file;
can be set from the command line, with arguments to the "-o"
flag;
can be set from tabs in the "Preferences" dialog box.
Use that mechanism to register the "Decode IPv4 TOS field as DiffServ
field" variable for IP as a preference.
Stuff that still needs to be done:
documenting the API for registering preferences;
documenting the "-o" values in the man page (probably needs a
flag similar to "-G", and a Perl script to turn the output into
documentation as is done with the list of field);
handling error checking for numeric values (range checking,
making sure that if the user changes the variable from the GUI
they change it to a valid numeric value);
using the callbacks to, for example, update the display when
preferences are changed (could be expensive);
panic if the user specifies a numeric value with a base other
than 10, 8, or 16.
We may also want to clean up the existing wired-in preferences not to
take effect the instant you tweak the widget, and to add an "Apply"
button to the "Preferences" dialog.
svn path=/trunk/; revision=2117
2000-07-05 09:41:07 +00:00
|
|
|
/* prefs-int.h
|
|
|
|
* Definitions for implementation of preference handling routines;
|
|
|
|
* used by "friends" of the preferences type.
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
Add support for a global "ethereal.conf" preferences file, stored in the
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most
likely).
Add a mechanism to allow modules (e.g., dissectors) to register
preference values, which:
can be put into the global or the user's preference file;
can be set from the command line, with arguments to the "-o"
flag;
can be set from tabs in the "Preferences" dialog box.
Use that mechanism to register the "Decode IPv4 TOS field as DiffServ
field" variable for IP as a preference.
Stuff that still needs to be done:
documenting the API for registering preferences;
documenting the "-o" values in the man page (probably needs a
flag similar to "-G", and a Perl script to turn the output into
documentation as is done with the list of field);
handling error checking for numeric values (range checking,
making sure that if the user changes the variable from the GUI
they change it to a valid numeric value);
using the callbacks to, for example, update the display when
preferences are changed (could be expensive);
panic if the user specifies a numeric value with a base other
than 10, 8, or 16.
We may also want to clean up the existing wired-in preferences not to
take effect the instant you tweak the widget, and to add an "Apply"
button to the "Preferences" dialog.
svn path=/trunk/; revision=2117
2000-07-05 09:41:07 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2018-02-08 16:59:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
Add support for a global "ethereal.conf" preferences file, stored in the
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most
likely).
Add a mechanism to allow modules (e.g., dissectors) to register
preference values, which:
can be put into the global or the user's preference file;
can be set from the command line, with arguments to the "-o"
flag;
can be set from tabs in the "Preferences" dialog box.
Use that mechanism to register the "Decode IPv4 TOS field as DiffServ
field" variable for IP as a preference.
Stuff that still needs to be done:
documenting the API for registering preferences;
documenting the "-o" values in the man page (probably needs a
flag similar to "-G", and a Perl script to turn the output into
documentation as is done with the list of field);
handling error checking for numeric values (range checking,
making sure that if the user changes the variable from the GUI
they change it to a valid numeric value);
using the callbacks to, for example, update the display when
preferences are changed (could be expensive);
panic if the user specifies a numeric value with a base other
than 10, 8, or 16.
We may also want to clean up the existing wired-in preferences not to
take effect the instant you tweak the widget, and to add an "Apply"
button to the "Preferences" dialog.
svn path=/trunk/; revision=2117
2000-07-05 09:41:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PREFS_INT_H__
|
|
|
|
#define __PREFS_INT_H__
|
|
|
|
|
2009-08-27 02:53:13 +00:00
|
|
|
#include <stdio.h>
|
2013-03-01 23:53:11 +00:00
|
|
|
#include "ws_symbol_export.h"
|
2021-07-26 00:31:17 +00:00
|
|
|
#include <epan/wmem_scopes.h>
|
2009-08-27 02:53:13 +00:00
|
|
|
|
2021-03-16 09:36:10 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2010-08-28 19:27:19 +00:00
|
|
|
/**
|
|
|
|
*@file
|
|
|
|
*/
|
|
|
|
|
Add support for a global "ethereal.conf" preferences file, stored in the
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most
likely).
Add a mechanism to allow modules (e.g., dissectors) to register
preference values, which:
can be put into the global or the user's preference file;
can be set from the command line, with arguments to the "-o"
flag;
can be set from tabs in the "Preferences" dialog box.
Use that mechanism to register the "Decode IPv4 TOS field as DiffServ
field" variable for IP as a preference.
Stuff that still needs to be done:
documenting the API for registering preferences;
documenting the "-o" values in the man page (probably needs a
flag similar to "-G", and a Perl script to turn the output into
documentation as is done with the list of field);
handling error checking for numeric values (range checking,
making sure that if the user changes the variable from the GUI
they change it to a valid numeric value);
using the callbacks to, for example, update the display when
preferences are changed (could be expensive);
panic if the user specifies a numeric value with a base other
than 10, 8, or 16.
We may also want to clean up the existing wired-in preferences not to
take effect the instant you tweak the widget, and to add an "Apply"
button to the "Preferences" dialog.
svn path=/trunk/; revision=2117
2000-07-05 09:41:07 +00:00
|
|
|
struct pref_module {
|
2012-07-07 01:26:58 +00:00
|
|
|
const char *name; /**< name of module */
|
|
|
|
const char *title; /**< title of module (displayed in preferences list) */
|
|
|
|
const char *description; /**< Description of module (displayed in preferences notebook) */
|
|
|
|
void (*apply_cb)(void); /**< routine to call when preferences applied */
|
|
|
|
GList *prefs; /**< list of its preferences */
|
2012-06-25 21:05:36 +00:00
|
|
|
struct pref_module *parent; /**< parent module */
|
2013-07-31 01:49:57 +00:00
|
|
|
wmem_tree_t *submodules; /**< list of its submodules */
|
2012-07-07 01:26:58 +00:00
|
|
|
int numprefs; /**< number of non-obsolete preferences */
|
2018-01-06 04:39:55 +00:00
|
|
|
unsigned int prefs_changed_flags; /**< Bitmask of the types of changes done by module preferences since we last checked */
|
2012-07-07 01:26:58 +00:00
|
|
|
gboolean obsolete; /**< if TRUE, this is a module that used to
|
|
|
|
* exist but no longer does
|
|
|
|
*/
|
2012-08-08 12:13:24 +00:00
|
|
|
gboolean use_gui; /**< Determines whether or not the module will use the generic
|
|
|
|
* GUI interface/APIs with the preference value or if its own
|
|
|
|
* independent GUI will be provided. This allows all preferences
|
|
|
|
* to have a common API for reading/writing, but not require them to
|
2013-07-25 23:49:47 +00:00
|
|
|
* use simple GUI controls to change the options. In general, the "general"
|
|
|
|
* Wireshark preferences should have this set to FALSE, while the protocol
|
2012-08-08 12:13:24 +00:00
|
|
|
* modules will have this set to TRUE */
|
2018-01-06 04:39:55 +00:00
|
|
|
unsigned int effect_flags; /**< Flags of types effected by preference (PREF_TYPE_DISSECTION, PREF_EFFECT_CAPTURE, etc).
|
|
|
|
These flags will be set in all module's preferences on creation. Flags must be non-zero
|
|
|
|
to ensure saving to disk */
|
Add support for a global "ethereal.conf" preferences file, stored in the
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most
likely).
Add a mechanism to allow modules (e.g., dissectors) to register
preference values, which:
can be put into the global or the user's preference file;
can be set from the command line, with arguments to the "-o"
flag;
can be set from tabs in the "Preferences" dialog box.
Use that mechanism to register the "Decode IPv4 TOS field as DiffServ
field" variable for IP as a preference.
Stuff that still needs to be done:
documenting the API for registering preferences;
documenting the "-o" values in the man page (probably needs a
flag similar to "-G", and a Perl script to turn the output into
documentation as is done with the list of field);
handling error checking for numeric values (range checking,
making sure that if the user changes the variable from the GUI
they change it to a valid numeric value);
using the callbacks to, for example, update the display when
preferences are changed (could be expensive);
panic if the user specifies a numeric value with a base other
than 10, 8, or 16.
We may also want to clean up the existing wired-in preferences not to
take effect the instant you tweak the widget, and to add an "Apply"
button to the "Preferences" dialog.
svn path=/trunk/; revision=2117
2000-07-05 09:41:07 +00:00
|
|
|
};
|
|
|
|
|
2012-08-08 12:13:24 +00:00
|
|
|
typedef struct {
|
|
|
|
module_t *module;
|
|
|
|
FILE *pf;
|
|
|
|
} write_pref_arg_t;
|
|
|
|
|
2010-08-28 19:27:19 +00:00
|
|
|
/**
|
2010-05-25 20:57:14 +00:00
|
|
|
* Module used for protocol preferences.
|
2006-11-17 01:24:03 +00:00
|
|
|
* With MSVC and a libwireshark.dll, we need a special declaration.
|
2002-12-20 01:48:57 +00:00
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC module_t *protocols_module;
|
2002-12-20 01:48:57 +00:00
|
|
|
|
2012-08-08 12:13:24 +00:00
|
|
|
typedef void (*pref_custom_free_cb) (pref_t* pref);
|
|
|
|
typedef void (*pref_custom_reset_cb) (pref_t* pref);
|
2018-01-06 04:39:55 +00:00
|
|
|
typedef prefs_set_pref_e (*pref_custom_set_cb) (pref_t* pref, const gchar* value, unsigned int* changed_flags);
|
2013-01-05 02:30:58 +00:00
|
|
|
/* typedef void (*pref_custom_write_cb) (pref_t* pref, write_pref_arg_t* arg); Deprecated. */
|
|
|
|
/* pref_custom_type_name_cb should return NULL for internal / hidden preferences. */
|
|
|
|
typedef const char * (*pref_custom_type_name_cb) (void);
|
|
|
|
typedef char * (*pref_custom_type_description_cb) (void);
|
|
|
|
typedef gboolean (*pref_custom_is_default_cb) (pref_t* pref);
|
|
|
|
typedef char * (*pref_custom_to_str_cb) (pref_t* pref, gboolean default_val);
|
2012-08-08 12:13:24 +00:00
|
|
|
|
|
|
|
/** Structure to hold callbacks for PREF_CUSTOM type */
|
|
|
|
struct pref_custom_cbs {
|
|
|
|
pref_custom_free_cb free_cb;
|
|
|
|
pref_custom_reset_cb reset_cb;
|
|
|
|
pref_custom_set_cb set_cb;
|
2013-01-05 02:30:58 +00:00
|
|
|
/* pref_custom_write_cb write_cb; Deprecated. */
|
|
|
|
pref_custom_type_name_cb type_name_cb;
|
|
|
|
pref_custom_type_description_cb type_description_cb;
|
|
|
|
pref_custom_is_default_cb is_default_cb;
|
|
|
|
pref_custom_to_str_cb to_str_cb;
|
2012-08-08 12:13:24 +00:00
|
|
|
};
|
|
|
|
|
2010-08-28 19:27:19 +00:00
|
|
|
/**
|
Allow a dissector to register preferences that it no longer supports as
obsolete; we silently ignore attempts to set those in a preferences
file, so that we don't spam the user with error messages caused by them
having saved preferences in an earlier release that contained those
preferences.
Make the Diameter and iSCSI dissectors register obsolete preferences.
Crash if some code tries to register a preferences module with a name
that contains something other than lower-case ASCII letters, numbers, or
underscores, or that has already been registered, or if some code tries
to register a preference with a name that contains something other than
lower-case ASCII letters, numbers, underscores, or periods, or that has
already been registered, so that we don't put code like that in a
release and have to shovel code into "prefs.c" to fix it up later. (The
problem with multiple modules or preferences with the same name should
be obvious; the problem with names with blanks, or upper-case letters,
or punctuation, is that they're a pain to type on the command line.)
svn path=/trunk/; revision=4148
2001-11-04 02:50:21 +00:00
|
|
|
* PREF_OBSOLETE is used for preferences that a module used to support
|
|
|
|
* but no longer supports; we give different error messages for them.
|
|
|
|
*/
|
2017-04-14 09:33:57 +00:00
|
|
|
#define PREF_UINT (1u << 0)
|
|
|
|
#define PREF_BOOL (1u << 1)
|
|
|
|
#define PREF_ENUM (1u << 2)
|
|
|
|
#define PREF_STRING (1u << 3)
|
|
|
|
#define PREF_RANGE (1u << 4)
|
|
|
|
#define PREF_STATIC_TEXT (1u << 5)
|
|
|
|
#define PREF_UAT (1u << 6)
|
|
|
|
#define PREF_SAVE_FILENAME (1u << 7)
|
|
|
|
#define PREF_COLOR (1u << 8) /* XXX - These are only supported for "internal" (non-protocol) */
|
|
|
|
#define PREF_CUSTOM (1u << 9) /* use and not as a generic protocol preference */
|
|
|
|
#define PREF_OBSOLETE (1u << 10)
|
|
|
|
#define PREF_DIRNAME (1u << 11)
|
|
|
|
#define PREF_DECODE_AS_UINT (1u << 12) /* XXX - These are only supported for "internal" (non-protocol) */
|
|
|
|
#define PREF_DECODE_AS_RANGE (1u << 13) /* use and not as a generic protocol preference */
|
|
|
|
#define PREF_OPEN_FILENAME (1u << 14)
|
2021-12-30 16:03:15 +00:00
|
|
|
#define PREF_PASSWORD (1u << 15) /* like string, but never saved to prefs file */
|
2022-11-01 10:01:35 +00:00
|
|
|
/**
|
|
|
|
* Dedicated to TCP PROTOCOL for handling manual SEQ interpretation,
|
|
|
|
* and allow users manage the sender traffic ambiguities
|
|
|
|
*/
|
|
|
|
#define PREF_PROTO_TCP_SNDAMB_ENUM (1u << 16)
|
Add support for a global "ethereal.conf" preferences file, stored in the
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most
likely).
Add a mechanism to allow modules (e.g., dissectors) to register
preference values, which:
can be put into the global or the user's preference file;
can be set from the command line, with arguments to the "-o"
flag;
can be set from tabs in the "Preferences" dialog box.
Use that mechanism to register the "Decode IPv4 TOS field as DiffServ
field" variable for IP as a preference.
Stuff that still needs to be done:
documenting the API for registering preferences;
documenting the "-o" values in the man page (probably needs a
flag similar to "-G", and a Perl script to turn the output into
documentation as is done with the list of field);
handling error checking for numeric values (range checking,
making sure that if the user changes the variable from the GUI
they change it to a valid numeric value);
using the callbacks to, for example, update the display when
preferences are changed (could be expensive);
panic if the user specifies a numeric value with a base other
than 10, 8, or 16.
We may also want to clean up the existing wired-in preferences not to
take effect the instant you tweak the widget, and to add an "Apply"
button to the "Preferences" dialog.
svn path=/trunk/; revision=2117
2000-07-05 09:41:07 +00:00
|
|
|
|
2013-12-09 10:07:33 +00:00
|
|
|
typedef enum {
|
|
|
|
GUI_ALL,
|
|
|
|
GUI_GTK,
|
|
|
|
GUI_QT
|
|
|
|
} gui_type_t;
|
|
|
|
|
2003-12-13 17:24:47 +00:00
|
|
|
/* read_prefs_file: read in a generic config file and do a callback to */
|
|
|
|
/* pref_set_pair_fct() for every key/value pair found */
|
2010-08-28 19:27:19 +00:00
|
|
|
/**
|
|
|
|
* Given a string of the form "<pref name>:<pref value>", as might appear
|
|
|
|
* as an argument to a "-o" option, parse it and set the preference in
|
2010-10-29 22:09:31 +00:00
|
|
|
* question.
|
2010-08-28 19:27:19 +00:00
|
|
|
* @return an indication of whether it succeeded or failed
|
|
|
|
* in some fashion.
|
|
|
|
*/
|
2012-12-26 05:57:06 +00:00
|
|
|
typedef prefs_set_pref_e (*pref_set_pair_cb) (gchar *key, const gchar *value, void *private_data, gboolean return_range_errors);
|
2003-12-13 17:24:47 +00:00
|
|
|
|
2015-12-18 03:18:33 +00:00
|
|
|
WS_DLL_PUBLIC
|
2017-01-07 13:52:23 +00:00
|
|
|
const char* prefs_get_description(pref_t *pref);
|
2015-12-18 03:18:33 +00:00
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
2017-01-07 13:52:23 +00:00
|
|
|
const char* prefs_get_title(pref_t *pref);
|
2015-12-18 03:18:33 +00:00
|
|
|
|
2017-01-04 15:57:25 +00:00
|
|
|
WS_DLL_PUBLIC
|
2017-01-07 13:52:23 +00:00
|
|
|
const char* prefs_get_name(pref_t *pref);
|
2017-01-04 15:57:25 +00:00
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
2017-01-07 13:52:23 +00:00
|
|
|
int prefs_get_type(pref_t *pref);
|
2017-01-04 15:57:25 +00:00
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
2017-01-07 13:52:23 +00:00
|
|
|
gui_type_t prefs_get_gui_type(pref_t *pref);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC guint32 prefs_get_max_value(pref_t *pref);
|
|
|
|
|
2018-01-07 00:03:36 +00:00
|
|
|
/* Bitmask of flags for the effect of a preference in Wireshark */
|
2018-01-06 04:39:55 +00:00
|
|
|
#define PREF_EFFECT_DISSECTION (1u << 0)
|
|
|
|
#define PREF_EFFECT_CAPTURE (1u << 1)
|
2021-04-04 22:45:43 +00:00
|
|
|
#define PREF_EFFECT_GUI_LAYOUT (1u << 2)
|
|
|
|
#define PREF_EFFECT_FIELDS (1u << 3)
|
2018-01-06 04:39:55 +00:00
|
|
|
|
2018-01-07 00:03:36 +00:00
|
|
|
/** Fetch flags that show the effect of the preference
|
2018-01-06 04:39:55 +00:00
|
|
|
*
|
|
|
|
* @param pref A preference.
|
|
|
|
*
|
|
|
|
* @return A bitmask of the types of things the preference will
|
|
|
|
* effect.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
unsigned int prefs_get_effect_flags(pref_t *pref);
|
|
|
|
|
2018-01-07 00:03:36 +00:00
|
|
|
/** Set flags for the effect of the preference
|
2018-01-06 04:39:55 +00:00
|
|
|
* The intention is to distinguish preferences that affect
|
|
|
|
* dissection from those that don't. A bitmask was added to
|
2018-01-07 00:03:36 +00:00
|
|
|
* provide greater flexibility in the types of effects
|
|
|
|
* preferences can have.
|
2018-01-06 04:39:55 +00:00
|
|
|
*
|
|
|
|
* @param pref A preference.
|
|
|
|
* @param flags Bitmask of flags to apply to preference. Note that flags
|
|
|
|
* must be non-zero to ensure preference is properly saved to disk.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void prefs_set_effect_flags(pref_t *pref, unsigned int flags);
|
|
|
|
|
|
|
|
/** Same as prefs_set_effect_flags, just different way to get preference
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void prefs_set_effect_flags_by_name(module_t * module, const char *pref, unsigned int flags);
|
|
|
|
|
|
|
|
/** Fetch flags that show module's preferences effect
|
|
|
|
* The flag values of the module will be applied to any individual preferences
|
|
|
|
* of the module when they are created
|
|
|
|
*
|
|
|
|
* @param module A preference module.
|
|
|
|
*
|
|
|
|
* @return A bitmask of the types of things the module's preferences will
|
|
|
|
* effect.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
unsigned int prefs_get_module_effect_flags(module_t * module);
|
|
|
|
|
|
|
|
/** Set flags for module's preferences effect
|
|
|
|
* The intention is to distinguish preferences that affect
|
|
|
|
* dissection from those that don't. Since modules are a grouping
|
|
|
|
* of preferences, it's likely that a whole module will want the
|
|
|
|
* same flags for its preferences. The flag values of the module will
|
|
|
|
* be applied to any individual preferences of the module when they
|
|
|
|
* are created
|
|
|
|
*
|
|
|
|
* @param module A preference module.
|
|
|
|
* @param flags Bitmask of flags to apply to module. Note that flags
|
|
|
|
* must be non-zero to ensure preferences are properly saved to disk.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void prefs_set_module_effect_flags(module_t * module, unsigned int flags);
|
|
|
|
|
2017-01-07 13:52:23 +00:00
|
|
|
WS_DLL_PUBLIC
|
|
|
|
gboolean prefs_set_range_value_work(pref_t *pref, const gchar *value,
|
2018-01-06 04:39:55 +00:00
|
|
|
gboolean return_range_errors, unsigned int *changed_flags);
|
2017-01-07 13:52:23 +00:00
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
2018-01-06 04:39:55 +00:00
|
|
|
unsigned int
|
2017-01-07 13:52:23 +00:00
|
|
|
prefs_set_stashed_range_value(pref_t *pref, const gchar *value);
|
2017-01-04 15:57:25 +00:00
|
|
|
|
|
|
|
/** Add a range value of a range preference. */
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void
|
|
|
|
prefs_range_add_value(pref_t *pref, guint32 val);
|
|
|
|
|
|
|
|
/** Remove a range value of a range preference. */
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void
|
|
|
|
prefs_range_remove_value(pref_t *pref, guint32 val);
|
|
|
|
|
2017-01-07 13:52:23 +00:00
|
|
|
|
2018-01-06 04:39:55 +00:00
|
|
|
WS_DLL_PUBLIC unsigned int prefs_set_bool_value(pref_t *pref, gboolean value, pref_source_t source);
|
2017-01-07 13:52:23 +00:00
|
|
|
WS_DLL_PUBLIC gboolean prefs_get_bool_value(pref_t *pref, pref_source_t source);
|
|
|
|
WS_DLL_PUBLIC void prefs_invert_bool_value(pref_t *pref, pref_source_t source);
|
|
|
|
|
2018-01-06 04:39:55 +00:00
|
|
|
WS_DLL_PUBLIC unsigned int prefs_set_uint_value(pref_t *pref, guint value, pref_source_t source);
|
2017-01-07 13:52:23 +00:00
|
|
|
WS_DLL_PUBLIC guint prefs_get_uint_base(pref_t *pref);
|
|
|
|
WS_DLL_PUBLIC guint prefs_get_uint_value_real(pref_t *pref, pref_source_t source);
|
|
|
|
|
|
|
|
|
2018-01-06 04:39:55 +00:00
|
|
|
WS_DLL_PUBLIC unsigned int prefs_set_enum_value(pref_t *pref, gint value, pref_source_t source);
|
2020-10-30 13:46:29 +00:00
|
|
|
WS_DLL_PUBLIC unsigned int prefs_set_enum_string_value(pref_t *pref, const gchar *value, pref_source_t source);
|
2017-01-07 13:52:23 +00:00
|
|
|
WS_DLL_PUBLIC gint prefs_get_enum_value(pref_t *pref, pref_source_t source);
|
|
|
|
WS_DLL_PUBLIC const enum_val_t* prefs_get_enumvals(pref_t *pref);
|
|
|
|
WS_DLL_PUBLIC gboolean prefs_get_enum_radiobuttons(pref_t *pref);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC gboolean prefs_set_color_value(pref_t *pref, color_t value, pref_source_t source);
|
|
|
|
WS_DLL_PUBLIC color_t* prefs_get_color_value(pref_t *pref, pref_source_t source);
|
|
|
|
|
2019-04-21 17:40:19 +00:00
|
|
|
WS_DLL_PUBLIC unsigned int prefs_set_custom_value(pref_t *pref, const char *value, pref_source_t source);
|
|
|
|
|
2018-01-06 04:39:55 +00:00
|
|
|
WS_DLL_PUBLIC unsigned int prefs_set_string_value(pref_t *pref, const char* value, pref_source_t source);
|
2017-01-07 13:52:23 +00:00
|
|
|
WS_DLL_PUBLIC char* prefs_get_string_value(pref_t *pref, pref_source_t source);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC struct epan_uat* prefs_get_uat_value(pref_t *pref);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC gboolean prefs_set_range_value(pref_t *pref, range_t *value, pref_source_t source);
|
|
|
|
WS_DLL_PUBLIC range_t* prefs_get_range_value_real(pref_t *pref, pref_source_t source);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC gboolean prefs_add_decode_as_value(pref_t *pref, guint value, gboolean replace);
|
|
|
|
WS_DLL_PUBLIC gboolean prefs_remove_decode_as_value(pref_t *pref, guint value, gboolean set_default);
|
|
|
|
|
2021-12-30 16:03:15 +00:00
|
|
|
WS_DLL_PUBLIC unsigned int prefs_set_password_value(pref_t *pref, const char* value, pref_source_t source);
|
|
|
|
WS_DLL_PUBLIC char* prefs_get_password_value(pref_t *pref, pref_source_t source);
|
|
|
|
|
2017-01-07 13:52:23 +00:00
|
|
|
WS_DLL_PUBLIC void reset_pref(pref_t *pref);
|
2015-12-18 03:18:33 +00:00
|
|
|
|
2015-11-18 15:55:07 +00:00
|
|
|
/** read the preferences file (or similar) and call the callback
|
2010-08-28 19:27:19 +00:00
|
|
|
* function to set each key/value pair found
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2003-12-13 17:24:47 +00:00
|
|
|
int
|
2006-11-15 23:33:39 +00:00
|
|
|
read_prefs_file(const char *pf_path, FILE *pf, pref_set_pair_cb pref_set_pair_fct, void *private_data);
|
2003-12-13 17:24:47 +00:00
|
|
|
|
2017-01-04 15:57:25 +00:00
|
|
|
WS_DLL_PUBLIC
|
|
|
|
gboolean
|
|
|
|
prefs_pref_is_default(pref_t *pref);
|
|
|
|
|
|
|
|
/** "Stash" a preference.
|
|
|
|
* Copy a preference to its stashed value. Can be called from prefs_pref_foreach().
|
|
|
|
*
|
|
|
|
* @param pref A preference.
|
|
|
|
* @param unused unused
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
2019-07-11 10:23:07 +00:00
|
|
|
guint pref_stash(pref_t *pref, gpointer unused);
|
2017-01-04 15:57:25 +00:00
|
|
|
|
|
|
|
typedef struct pref_unstash_data
|
|
|
|
{
|
|
|
|
/* Used to set prefs_changed member to TRUE if the preference
|
|
|
|
differs from its stashed values. Also used by "decode as" types
|
|
|
|
to look up dissector short name */
|
|
|
|
module_t *module;
|
|
|
|
/* Qt uses stashed values to then "applies" them
|
|
|
|
during unstash. Use this flag for that behavior */
|
|
|
|
gboolean handle_decode_as;
|
|
|
|
} pref_unstash_data_t;
|
|
|
|
|
|
|
|
/** "Unstash" a preference.
|
|
|
|
* Set a preference to its stashed value. Can be called from prefs_pref_foreach().
|
|
|
|
*
|
|
|
|
* @param pref A preference.
|
|
|
|
* @param unstash_data_p A pointer to a pref_unstash_data_t structure.
|
|
|
|
*
|
|
|
|
* @return Always returns 0.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
guint pref_unstash(pref_t *pref, gpointer unstash_data_p);
|
|
|
|
|
|
|
|
/** Clean up a stashed preference.
|
|
|
|
* Can be called from prefs_pref_foreach().
|
|
|
|
*
|
|
|
|
* @param pref A preference.
|
|
|
|
* @param unused unused
|
|
|
|
*
|
|
|
|
* @return Always returns 0.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
2019-07-11 10:23:07 +00:00
|
|
|
guint pref_clean_stash(pref_t *pref, gpointer unused);
|
2017-01-04 15:57:25 +00:00
|
|
|
|
|
|
|
/** Set a stashed preference to its default value.
|
|
|
|
*
|
|
|
|
*@param pref A preference.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void reset_stashed_pref(pref_t *pref);
|
|
|
|
|
2014-04-29 15:10:27 +00:00
|
|
|
/** Convert a string list preference to a preference string.
|
|
|
|
*
|
|
|
|
* Given a GList of gchar pointers, create a quoted, comma-separated
|
|
|
|
* string. Should be used with prefs_get_string_list() and
|
|
|
|
* prefs_clear_string_list().
|
|
|
|
*
|
|
|
|
* @param sl String list.
|
|
|
|
* @return Quoted, joined, and wrapped string. May be empty.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
char *
|
|
|
|
join_string_list(GList *sl);
|
|
|
|
|
2017-01-04 15:57:25 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
Add support for a global "ethereal.conf" preferences file, stored in the
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most
likely).
Add a mechanism to allow modules (e.g., dissectors) to register
preference values, which:
can be put into the global or the user's preference file;
can be set from the command line, with arguments to the "-o"
flag;
can be set from tabs in the "Preferences" dialog box.
Use that mechanism to register the "Decode IPv4 TOS field as DiffServ
field" variable for IP as a preference.
Stuff that still needs to be done:
documenting the API for registering preferences;
documenting the "-o" values in the man page (probably needs a
flag similar to "-G", and a Perl script to turn the output into
documentation as is done with the list of field);
handling error checking for numeric values (range checking,
making sure that if the user changes the variable from the GUI
they change it to a valid numeric value);
using the callbacks to, for example, update the display when
preferences are changed (could be expensive);
panic if the user specifies a numeric value with a base other
than 10, 8, or 16.
We may also want to clean up the existing wired-in preferences not to
take effect the instant you tweak the widget, and to add an "Apply"
button to the "Preferences" dialog.
svn path=/trunk/; revision=2117
2000-07-05 09:41:07 +00:00
|
|
|
#endif /* prefs-int.h */
|