diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-07-05 09:41:07 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-07-05 09:41:07 +0000 |
commit | b1f950b377a99de3fdba8814434b0019c0df3506 (patch) | |
tree | 1b304d0bd143ae0727409660feb1e8c0b487eb8a /packet-ip.c | |
parent | ed5651a90939c40d1ca64a0b0e67b89b8031da21 (diff) |
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
Diffstat (limited to 'packet-ip.c')
-rw-r--r-- | packet-ip.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packet-ip.c b/packet-ip.c index db729e6126..523357cde8 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -1,7 +1,7 @@ /* packet-ip.c * Routines for IP and miscellaneous IP protocol packet disassembly * - * $Id: packet-ip.c,v 1.94 2000/06/20 13:21:55 gram Exp $ + * $Id: packet-ip.c,v 1.95 2000/07/05 09:40:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -40,6 +40,7 @@ #include <glib.h> #include "packet.h" #include "resolv.h" +#include "prefs.h" #ifdef NEED_SNPRINTF_H # ifdef HAVE_STDARG_H @@ -1390,6 +1391,7 @@ proto_register_ip(void) &ett_ip_option_route, &ett_ip_option_timestamp, }; + module_t *ip_module; proto_ip = proto_register_protocol ("Internet Protocol", "ip"); proto_register_field_array(proto_ip, hf, array_length(hf)); @@ -1397,6 +1399,13 @@ proto_register_ip(void) /* subdissector code */ ip_dissector_table = register_dissector_table("ip.proto"); + + /* Register a configuration option for decoding TOS as DSCP */ + ip_module = prefs_register_module("ip", "IP", NULL); + prefs_register_bool_preference(ip_module, "decode_tos_as_diffserv", + "Decode IPv4 TOS field as DiffServ field", +"Whether the IPv4 type-of-service field should be decoded as a Differentiated Services field", + &g_ip_dscp_actif); } void |