1998-09-25 23:24:07 +00:00
|
|
|
/* prefs.h
|
|
|
|
* Definitions for preference handling routines
|
|
|
|
*
|
2001-01-03 07:53:48 +00:00
|
|
|
* $Id: prefs.h,v 1.27 2001/01/03 07:53:44 guy Exp $
|
1998-09-25 23:24:07 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@zing.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PREFS_H__
|
|
|
|
#define __PREFS_H__
|
|
|
|
|
2000-11-21 23:54:10 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include "color.h"
|
|
|
|
|
1998-10-28 21:38:11 +00:00
|
|
|
#define PR_DEST_CMD 0
|
|
|
|
#define PR_DEST_FILE 1
|
|
|
|
|
|
|
|
typedef struct _e_prefs {
|
1999-12-02 04:30:15 +00:00
|
|
|
gint pr_format;
|
|
|
|
gint pr_dest;
|
|
|
|
gchar *pr_file;
|
|
|
|
gchar *pr_cmd;
|
|
|
|
GList *col_list;
|
|
|
|
gint num_cols;
|
2000-11-21 23:54:10 +00:00
|
|
|
color_t st_client_fg, st_client_bg, st_server_fg, st_server_bg;
|
Instead of having the normal-weight and bold fonts set separately,
generate the name of the boldface font from the Roman font; if the two
fonts don't have the same widths, the display will look weird when a
field is selected, and it's a bit of a pain for the user to have to
select *two* fonts.
On UNIX/X, default to
"-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*-" rather than to
"-*-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-iso8859-1" - some
Linux distributions appear to lack the Lucida typewriter font.
Add a "gui.font_name" preference to the preferences file, specifying the
normal-weight font to use. Have it settable from the "GUI" tab in the
Preferences dialog box - the "Font..." button, when clicked, pops up a
font selection dialog box.
If we either can't open the selected font or the boldfaced version of
the font, default to "6x13" and "6x13bold" as fallbacks - the former
will probably be "fixed", and the latter would be "fixedbold" if X
actually created such an alias, but it doesn't so we use "6x13bold"
instead.
svn path=/trunk/; revision=2304
2000-08-20 07:53:45 +00:00
|
|
|
gboolean gui_scrollbar_on_right;
|
|
|
|
gboolean gui_plist_sel_browse;
|
|
|
|
gboolean gui_ptree_sel_browse;
|
|
|
|
gint gui_ptree_line_style;
|
|
|
|
gint gui_ptree_expander_style;
|
2000-09-08 09:50:08 +00:00
|
|
|
gboolean gui_hex_dump_highlight_style;
|
Instead of having the normal-weight and bold fonts set separately,
generate the name of the boldface font from the Roman font; if the two
fonts don't have the same widths, the display will look weird when a
field is selected, and it's a bit of a pain for the user to have to
select *two* fonts.
On UNIX/X, default to
"-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*-" rather than to
"-*-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-iso8859-1" - some
Linux distributions appear to lack the Lucida typewriter font.
Add a "gui.font_name" preference to the preferences file, specifying the
normal-weight font to use. Have it settable from the "GUI" tab in the
Preferences dialog box - the "Font..." button, when clicked, pops up a
font selection dialog box.
If we either can't open the selected font or the boldfaced version of
the font, default to "6x13" and "6x13bold" as fallbacks - the former
will probably be "fixed", and the latter would be "fixedbold" if X
actually created such an alias, but it doesn't so we use "6x13bold"
instead.
svn path=/trunk/; revision=2304
2000-08-20 07:53:45 +00:00
|
|
|
gchar *gui_font_name;
|
2000-11-21 23:54:10 +00:00
|
|
|
color_t gui_marked_fg;
|
|
|
|
color_t gui_marked_bg;
|
1998-10-28 21:38:11 +00:00
|
|
|
} e_prefs;
|
|
|
|
|
1999-07-23 08:29:24 +00:00
|
|
|
extern e_prefs prefs;
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Routines to let modules that have preference settings register
|
|
|
|
* themselves by name, and to let them register preference settings
|
|
|
|
* by name.
|
|
|
|
*/
|
|
|
|
struct pref_module;
|
|
|
|
|
|
|
|
typedef struct pref_module module_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Register a module that will have preferences.
|
|
|
|
* Specify the name used for the module in the preferences file, the
|
|
|
|
* title used in the tab for it in a preferences dialog box, and a
|
|
|
|
* routine to call back when we apply the preferences.
|
2000-08-17 21:02:10 +00:00
|
|
|
* Note:
|
|
|
|
* In case of dissectors, the specified name should be the protocol
|
|
|
|
* name specified at the proto_register_protocol() call in order to
|
|
|
|
* make the "Protocol Properties..." menu item work.
|
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
|
|
|
*/
|
|
|
|
module_t *prefs_register_module(const char *name, const char *title,
|
|
|
|
void (*apply_cb)(void));
|
|
|
|
|
|
|
|
typedef void (*module_cb)(module_t *module, gpointer user_data);
|
|
|
|
|
2001-01-03 07:53:48 +00:00
|
|
|
/*
|
|
|
|
* Register that a protocol has preferences.
|
|
|
|
*/
|
|
|
|
module_t *prefs_register_protocol(int id, void (*apply_cb)(void));
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Call a callback function, with a specified argument, for each module.
|
|
|
|
*/
|
|
|
|
void prefs_module_foreach(module_cb callback, gpointer user_data);
|
|
|
|
|
|
|
|
/*
|
2000-07-09 03:29:42 +00:00
|
|
|
* Call the "apply" callback function for each 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.
|
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
|
|
|
*/
|
|
|
|
void prefs_apply_all(void);
|
|
|
|
|
|
|
|
struct preference;
|
|
|
|
|
|
|
|
typedef struct preference pref_t;
|
|
|
|
|
2000-08-15 20:46:17 +00:00
|
|
|
/*
|
|
|
|
* Returns TRUE if the given protocol has registered preferences
|
|
|
|
*/
|
|
|
|
gboolean prefs_is_registered_protocol(char *name);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns the module title of a registered protocol (or NULL if unknown)
|
|
|
|
*/
|
2000-08-15 20:53:31 +00:00
|
|
|
const char *prefs_get_title_by_name(char *name);
|
2000-08-15 20:46:17 +00:00
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Register a preference with an unsigned integral value.
|
|
|
|
*/
|
|
|
|
void prefs_register_uint_preference(module_t *module, const char *name,
|
|
|
|
const char *title, const char *description, guint base, guint *var);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Register a preference with an Boolean value.
|
|
|
|
*/
|
|
|
|
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;
|
|
|
|
gint value;
|
2000-11-18 21:41:40 +00:00
|
|
|
} enum_val_t;
|
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
|
|
|
|
|
|
|
void prefs_register_enum_preference(module_t *module, const char *name,
|
|
|
|
const char *title, const char *description, gint *var,
|
2000-11-18 21:41:40 +00:00
|
|
|
const enum_val_t *enumvals, gboolean radio_buttons);
|
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
|
|
|
|
|
|
|
/*
|
|
|
|
* Register a preference with a character-string value.
|
|
|
|
*/
|
|
|
|
void prefs_register_string_preference(module_t *module, const char *name,
|
|
|
|
const char *title, const char *description, char **var);
|
|
|
|
|
|
|
|
typedef void (*pref_cb)(pref_t *pref, gpointer user_data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call a callback function, with a specified argument, for each preference
|
|
|
|
* in a given module.
|
|
|
|
*/
|
|
|
|
void prefs_pref_foreach(module_t *module, pref_cb callback, gpointer user_data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Register all non-dissector modules' preferences.
|
|
|
|
*/
|
|
|
|
void prefs_register_modules(void);
|
|
|
|
|
Instead of each set of built-in preferences having "ok", "save",
"cancel", and "delete" methods, give them:
"fetch" - fetch from the notebook tab any values not already
stored in "prefs", and store them there, but doesn't apply them;
"apply" - apply the settings in "prefs";
"destroy" - clean up any windows created from the tab.
As we no longer have "cancel" methods, we don't have per-preference code
to revert preference values; instead, we have the common preference
dialog box code make a copy of all the current preferences, and, when
the "Cancel" button is clicked, free the current preferences and copy
the saved preferences to it, and apply the preferences.
Add an "Apply" button to the preference dialog box, which applies the
current preferences without closing the dialog box.
Treat a request to delete the preferences dialog box as equivalent to
clicking "Cancel".
Have a "remember_ptree_widget()" routine to remember all protocol tree
widgets, and use the list of those widgets when we set GUI preferences
for the protocol tree widgets, rather than setting the main protocol
tree widget and then using the list of packet windows. Move that code
out of "main.c" to "proto_draw.c", as it's not used by anything in
"main.c", but is used by stuff in "proto_draw.c".
Make the font one of the preferences we can set on the fly for protocol
tree widgets. Also make it something we can set on the fly for the
packet list widget.
svn path=/trunk/; revision=2316
2000-08-21 08:09:17 +00:00
|
|
|
/* Read the preferences file, fill in "prefs", and return a pointer to it.
|
|
|
|
|
|
|
|
If we got an error (other than "it doesn't exist") trying to read
|
|
|
|
the global preferences file, stuff the errno into "*gpf_errno_return"
|
|
|
|
and a pointer to the path of the file into "*gpf_path_return", and
|
|
|
|
return NULL.
|
|
|
|
|
|
|
|
If we got an error (other than "it doesn't exist") trying to read
|
|
|
|
the user's preferences file, stuff the errno into "*pf_errno_return"
|
|
|
|
and a pointer to the path of the file into "*pf_path_return", and
|
|
|
|
return NULL. */
|
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
|
|
|
e_prefs *read_prefs(int *, char **, int *, char **);
|
Instead of each set of built-in preferences having "ok", "save",
"cancel", and "delete" methods, give them:
"fetch" - fetch from the notebook tab any values not already
stored in "prefs", and store them there, but doesn't apply them;
"apply" - apply the settings in "prefs";
"destroy" - clean up any windows created from the tab.
As we no longer have "cancel" methods, we don't have per-preference code
to revert preference values; instead, we have the common preference
dialog box code make a copy of all the current preferences, and, when
the "Cancel" button is clicked, free the current preferences and copy
the saved preferences to it, and apply the preferences.
Add an "Apply" button to the preference dialog box, which applies the
current preferences without closing the dialog box.
Treat a request to delete the preferences dialog box as equivalent to
clicking "Cancel".
Have a "remember_ptree_widget()" routine to remember all protocol tree
widgets, and use the list of those widgets when we set GUI preferences
for the protocol tree widgets, rather than setting the main protocol
tree widget and then using the list of packet windows. Move that code
out of "main.c" to "proto_draw.c", as it's not used by anything in
"main.c", but is used by stuff in "proto_draw.c".
Make the font one of the preferences we can set on the fly for protocol
tree widgets. Also make it something we can set on the fly for the
packet list widget.
svn path=/trunk/; revision=2316
2000-08-21 08:09:17 +00:00
|
|
|
|
|
|
|
/* Write out "prefs" to the user's preferences file, and return 0.
|
|
|
|
|
|
|
|
If we got an error, stuff a pointer to the path of the preferences file
|
|
|
|
into "*pf_path_return", and return the errno. */
|
2000-01-03 06:29:39 +00:00
|
|
|
int write_prefs(char **);
|
1998-09-25 23:24:07 +00:00
|
|
|
|
Instead of each set of built-in preferences having "ok", "save",
"cancel", and "delete" methods, give them:
"fetch" - fetch from the notebook tab any values not already
stored in "prefs", and store them there, but doesn't apply them;
"apply" - apply the settings in "prefs";
"destroy" - clean up any windows created from the tab.
As we no longer have "cancel" methods, we don't have per-preference code
to revert preference values; instead, we have the common preference
dialog box code make a copy of all the current preferences, and, when
the "Cancel" button is clicked, free the current preferences and copy
the saved preferences to it, and apply the preferences.
Add an "Apply" button to the preference dialog box, which applies the
current preferences without closing the dialog box.
Treat a request to delete the preferences dialog box as equivalent to
clicking "Cancel".
Have a "remember_ptree_widget()" routine to remember all protocol tree
widgets, and use the list of those widgets when we set GUI preferences
for the protocol tree widgets, rather than setting the main protocol
tree widget and then using the list of packet windows. Move that code
out of "main.c" to "proto_draw.c", as it's not used by anything in
"main.c", but is used by stuff in "proto_draw.c".
Make the font one of the preferences we can set on the fly for protocol
tree widgets. Also make it something we can set on the fly for the
packet list widget.
svn path=/trunk/; revision=2316
2000-08-21 08:09:17 +00:00
|
|
|
/* Copy a set of preferences. */
|
|
|
|
void copy_prefs(e_prefs *dest, e_prefs *src);
|
|
|
|
|
|
|
|
/* Free a set of preferences. */
|
|
|
|
void free_prefs(e_prefs *pr);
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* question. Return an indication of whether it succeeded or failed
|
|
|
|
* in some fashion.
|
|
|
|
*/
|
|
|
|
#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 */
|
|
|
|
|
|
|
|
int prefs_set_pref(char *prefarg);
|
|
|
|
|
1998-09-25 23:24:07 +00:00
|
|
|
#endif /* prefs.h */
|