summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/README.developer47
-rw-r--r--gtk/gui_prefs.c74
-rw-r--r--gtk/prefs_dlg.c22
-rw-r--r--gtk/print_prefs.c16
-rw-r--r--packet-ansi_a.c16
-rw-r--r--packet-bgp.c10
-rw-r--r--packet-bssap.c8
-rw-r--r--packet-clnp.c10
-rw-r--r--packet-fr.c10
-rw-r--r--packet-ieee80211.c14
-rw-r--r--packet-iscsi.c14
-rw-r--r--packet-lmp.c10
-rw-r--r--packet-m2pa.c8
-rw-r--r--packet-m2ua.c8
-rw-r--r--packet-m3ua.c12
-rw-r--r--packet-mtp3.c22
-rw-r--r--packet-ndmp.c12
-rw-r--r--packet-ppp.c10
-rw-r--r--packet-scsi.c8
-rw-r--r--packet-sctp.c12
-rw-r--r--packet-t38.c10
-rw-r--r--packet-tcap.c8
-rw-r--r--plugins/asn1/packet-asn1.c24
-rw-r--r--prefs.c43
-rw-r--r--prefs.h3
25 files changed, 238 insertions, 193 deletions
diff --git a/doc/README.developer b/doc/README.developer
index 8c6128d0b4..8820fd73a9 100644
--- a/doc/README.developer
+++ b/doc/README.developer
@@ -1,4 +1,4 @@
-$Id: README.developer,v 1.94 2004/03/25 16:01:12 ulfl Exp $
+$Id: README.developer,v 1.95 2004/05/24 02:25:20 guy Exp $
This file is a HOWTO for Ethereal developers. It describes how to start coding
a Ethereal protocol dissector and the use some of the important functions and
@@ -363,12 +363,12 @@ code inside
is needed only if you are using the "snprintf()" function.
-The "$Id: README.developer,v 1.94 2004/03/25 16:01:12 ulfl Exp $"
+The "$Id: README.developer,v 1.95 2004/05/24 02:25:20 guy Exp $"
in the comment will be updated by CVS when the file is
checked in; it will allow the RCS "ident" command to report which
version of the file is currently checked out.
-When creating a new file, it is fine to just write "$Id: README.developer,v 1.94 2004/03/25 16:01:12 ulfl Exp $" as RCS will
+When creating a new file, it is fine to just write "$Id: README.developer,v 1.95 2004/05/24 02:25:20 guy Exp $" as RCS will
automatically fill in the identifier at the time the file will be added to the
CVS repository (checked in).
@@ -377,7 +377,7 @@ CVS repository (checked in).
* Routines for PROTONAME dissection
* Copyright 2000, YOUR_NAME <YOUR_EMAIL_ADDRESS>
*
- * $Id: README.developer,v 1.94 2004/03/25 16:01:12 ulfl Exp $
+ * $Id: README.developer,v 1.95 2004/05/24 02:25:20 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -2314,27 +2314,42 @@ Then you can register the fields that can be configured by the user with these r
/* Register a preference with an enumerated value. */
void prefs_register_enum_preference(module_t *module, const char *name,
const char *title, const char *description, gint *var,
- const enum_val *enumvals, gboolean radio_buttons)
+ const enum_val_t *enumvals, gboolean radio_buttons)
/* 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)
Where: module - Returned by the prefs_register_protocol routine
- name - This is appended to the name of the protocol, with a
- "." between them, to construct a name that
- identifies the field in the preference file;
- the name itself should not include the protocol
- name, as the name in the preference file will
- already have it
- title - Field title in the preferences dialog
+ name - This is appended to the name of the protocol, with a
+ "." between them, to construct a name that identifies
+ the field in the preference file; the name itself
+ should not include the protocol name, as the name in
+ the preference file will already have it
+ title - Field title in the preferences dialog
description - Comments added to the preference file above the
- preference value
+ preference value
var - pointer to the storage location that is updated when the
field is changed in the preference dialog box
- enumvals - an array of enum_val structures. This must be NULL terminated
- radio_buttons - Is the enumvals a list of radio buttons?
-
+ enumvals - an array of enum_val_t structures. This must be
+ NULL-terminated; the members of that structure are:
+
+ a short name, to be used with the "-o" flag - it
+ should not contain spaces or upper-case letters,
+ so that it's easier to put in a command line;
+
+ a description, which is used in the GUI (and
+ which, for compatibility reasons, is currently
+ what's written to the preferences file) - it can
+ contain spaces, capital letters, punctuation,
+ etc.;
+
+ the numerical value corresponding to that name
+ and description
+ radio_buttons - TRUE if the field is to be displayed in the
+ preferences dialog as a set of radio buttons,
+ FALSE if it is to be displayed as an option
+ menu
An example from packet-beep.c -
diff --git a/gtk/gui_prefs.c b/gtk/gui_prefs.c
index e3d8900ba9..9bb8bf63e0 100644
--- a/gtk/gui_prefs.c
+++ b/gtk/gui_prefs.c
@@ -1,7 +1,7 @@
/* gui_prefs.c
* Dialog box for GUI preferences
*
- * $Id: gui_prefs.c,v 1.69 2004/05/13 15:28:02 ulfl Exp $
+ * $Id: gui_prefs.c,v 1.70 2004/05/24 02:25:20 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -76,73 +76,73 @@ static gint recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_,
#define GUI_TOOLBAR_STYLE_KEY "toolbar_style"
static const enum_val_t scrollbar_placement_vals[] = {
- { "Left", FALSE },
- { "Right", TRUE },
- { NULL, 0 }
+ { "FALSE", "Left", FALSE },
+ { "TRUE", "Right", TRUE },
+ { NULL, NULL, 0 }
};
static const enum_val_t selection_mode_vals[] = {
- { "Selects", FALSE },
- { "Browses", TRUE },
- { NULL, 0 }
+ { "FALSE", "Selects", FALSE },
+ { "TRUE", "Browses", TRUE },
+ { NULL, NULL, 0 }
};
#if GTK_MAJOR_VERSION < 2
static const enum_val_t line_style_vals[] = {
- { "None", 0 },
- { "Solid", 1 },
- { "Dotted", 2 },
- { "Tabbed", 3 },
- { NULL, 0 }
+ { "NONE", "None", 0 },
+ { "SOLID", "Solid", 1 },
+ { "DOTTED", "Dotted", 2 },
+ { "TABBED", "Tabbed", 3 },
+ { NULL, NULL, 0 }
};
static const enum_val_t expander_style_vals[] = {
- { "None", 0 },
- { "Square", 1 },
- { "Triangle", 2 },
- { "Circular", 3 },
- { NULL, 0 }
+ { "NONE", "None", 0 },
+ { "SQUARE", "Square", 1 },
+ { "TRIANGLE", "Triangle", 2 },
+ { "CIRCULAR", "Circular", 3 },
+ { NULL, NULL, 0 }
};
#else
static const enum_val_t altern_colors_vals[] = {
- { "No", FALSE },
- { "Yes", TRUE },
- { NULL, 0 }
+ { "FALSE", "No", FALSE },
+ { "TRUE", "Yes", TRUE },
+ { NULL, NULL, 0 }
};
#endif
static const enum_val_t filter_toolbar_placement_vals[] = {
- { "Below the main toolbar", FALSE },
- { "Insert into statusbar", TRUE },
- { NULL, 0 }
+ { "FALSE", "Below the main toolbar", FALSE },
+ { "TRUE", "Insert into statusbar", TRUE },
+ { NULL, NULL, 0 }
};
static const enum_val_t highlight_style_vals[] = {
- { "Bold", FALSE },
- { "Inverse", TRUE },
- { NULL, 0 }
+ { "FALSE", "Bold", FALSE },
+ { "TRUE", "Inverse", TRUE },
+ { NULL, NULL, 0 }
};
static const enum_val_t toolbar_style_vals[] = {
- { "Icons only", TB_STYLE_ICONS },
- { "Text only", TB_STYLE_TEXT },
- { "Icons & Text", TB_STYLE_BOTH },
- { NULL, 0 }
+ { "ICONS", "Icons only", TB_STYLE_ICONS },
+ { "TEXT", "Text only", TB_STYLE_TEXT },
+ { "BOTH", "Icons & Text", TB_STYLE_BOTH },
+ { NULL, NULL, 0 }
};
#ifdef _WIN32
static const enum_val_t gui_console_open_vals[] = {
- { "Never", console_open_never },
- { "Automatic (advanced user)", console_open_auto },
- { "Always (debugging)", console_open_always },
- { NULL, 0 }
+ { "NEVER", "Never", console_open_never },
+ { "AUTOMATIC", "Automatic (advanced user)", console_open_auto },
+ { "ALWAYS", "Always (debugging)", console_open_always },
+ { NULL, NULL, 0 }
};
#endif
static const enum_val_t gui_fileopen_vals[] = {
- { "Remember last directory", FO_STYLE_LAST_OPENED },
- { "Always start in:", FO_STYLE_SPECIFIED },
- { NULL, 0 }
+ { "LAST_OPENED", "Remember last directory", FO_STYLE_LAST_OPENED },
+ { "SPECIFIED", "Always start in:", FO_STYLE_SPECIFIED },
+ { NULL, NULL, 0 }
};
/* Set to FALSE initially; set to TRUE if the user ever hits "OK" on
diff --git a/gtk/prefs_dlg.c b/gtk/prefs_dlg.c
index 67bd3adb44..9b0705510b 100644
--- a/gtk/prefs_dlg.c
+++ b/gtk/prefs_dlg.c
@@ -1,7 +1,7 @@
/* prefs_dlg.c
* Routines for handling preferences
*
- * $Id: prefs_dlg.c,v 1.81 2004/04/29 17:03:27 ulfl Exp $
+ * $Id: prefs_dlg.c,v 1.82 2004/05/24 02:25:21 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -738,7 +738,7 @@ create_preference_radio_buttons(GtkWidget *main_tb, int table_position,
for (enum_valp = enumvals, index = 0; enum_valp->name != NULL;
enum_valp++, index++) {
button = gtk_radio_button_new_with_label(rb_group,
- enum_valp->name);
+ enum_valp->description);
gtk_widget_show(button);
rb_group = gtk_radio_button_group(GTK_RADIO_BUTTON(button));
gtk_box_pack_start(GTK_BOX(radio_button_hbox), button, FALSE,
@@ -770,13 +770,21 @@ static gint
label_to_enum_val(GtkWidget *label, const enum_val_t *enumvals)
{
char *label_string;
- gint enumval;
+ int i;
- /* Get the label's text, and translate it to a value. */
+ /* Get the label's text, and translate it to a value.
+ We match only the descriptions, as those are what appear in
+ the option menu items or as labels for radio buttons.
+ We fail if we don't find a match, as that "can't happen". */
gtk_label_get(GTK_LABEL(label), &label_string);
- enumval = find_val_for_string(label_string, enumvals, 1);
- return enumval;
+ for (i = 0; enumvals[i].name != NULL; i++) {
+ if (strcasecmp(label_string, enumvals[i].description) == 0) {
+ return enumvals[i].value;
+ }
+ }
+ g_assert_not_reached();
+ return -1;
}
gint
@@ -826,7 +834,7 @@ create_preference_option_menu(GtkWidget *main_tb, int table_position,
menu_index = -1;
for (enum_valp = enumvals, index = 0; enum_valp->name != NULL;
enum_valp++, index++) {
- menu_item = gtk_menu_item_new_with_label(enum_valp->name);
+ menu_item = gtk_menu_item_new_with_label(enum_valp->description);
gtk_menu_append(GTK_MENU(menu), menu_item);
if (enum_valp->value == current_val)
menu_index = index;
diff --git a/gtk/print_prefs.c b/gtk/print_prefs.c
index 4875b1123f..6ac093f971 100644
--- a/gtk/print_prefs.c
+++ b/gtk/print_prefs.c
@@ -1,7 +1,7 @@
/* print_prefs.c
* Dialog boxes for preferences for printing
*
- * $Id: print_prefs.c,v 1.19 2004/03/29 22:40:58 guy Exp $
+ * $Id: print_prefs.c,v 1.20 2004/05/24 02:25:21 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -54,20 +54,20 @@ static void printer_opts_fs_destroy_cb(GtkWidget *win, gpointer data);
#define E_PRINT_DESTINATION_KEY "print_destination"
static const enum_val_t print_format_vals[] = {
- { "Plain Text", PR_FMT_TEXT },
- { "Postscript", PR_FMT_PS },
- { NULL, 0 }
+ { "text", "Plain Text", PR_FMT_TEXT },
+ { "postscript", "Postscript", PR_FMT_PS },
+ { NULL, NULL, 0 }
};
static const enum_val_t print_dest_vals[] = {
#ifdef _WIN32
/* "PR_DEST_CMD" means "to printer" on Windows */
- { "Printer", PR_DEST_CMD },
+ { "command", "Printer", PR_DEST_CMD },
#else
- { "Command", PR_DEST_CMD },
+ { "command", "Command", PR_DEST_CMD },
#endif
- { "File", PR_DEST_FILE },
- { NULL, 0 }
+ { "file", "File", PR_DEST_FILE },
+ { NULL, NULL, 0 }
};
GtkWidget * printer_prefs_show(void)
diff --git a/packet-ansi_a.c b/packet-ansi_a.c
index 58100ea79a..648b466251 100644
--- a/packet-ansi_a.c
+++ b/packet-ansi_a.c
@@ -10,7 +10,7 @@
* 2000 Access Network Interfaces
* 3GPP2 A.S0001-1 TIA/EIA-2001
*
- * $Id: packet-ansi_a.c,v 1.16 2004/03/27 11:32:28 guy Exp $
+ * $Id: packet-ansi_a.c,v 1.17 2004/05/24 02:25:17 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -8328,13 +8328,13 @@ proto_register_ansi_a(void)
};
static enum_val_t a_variant_options[] = {
- { "IS-634 rev. 0", A_VARIANT_IS634 },
- { "TSB-80", A_VARIANT_TSB80 },
- { "IS-634-A", A_VARIANT_IS634A },
- { "IOS 2.x", A_VARIANT_IOS2 },
- { "IOS 3.x", A_VARIANT_IOS3 },
- { "IOS 4.0.1", A_VARIANT_IOS401 },
- { NULL, 0 }
+ { "is-634-rev0", "IS-634 rev. 0", A_VARIANT_IS634 },
+ { "tsb-80", "TSB-80", A_VARIANT_TSB80 },
+ { "is-634-a", "IS-634-A", A_VARIANT_IS634A },
+ { "ios-2.x", "IOS 2.x", A_VARIANT_IOS2 },
+ { "ios-3.x", "IOS 3.x", A_VARIANT_IOS3 },
+ { "ios-4.0.1", "IOS 4.0.1", A_VARIANT_IOS401 },
+ { NULL, NULL, 0 }
};
diff --git a/packet-bgp.c b/packet-bgp.c
index bbda8b599c..52dc0fde96 100644
--- a/packet-bgp.c
+++ b/packet-bgp.c
@@ -2,7 +2,7 @@
* Routines for BGP packet dissection.
* Copyright 1999, Jun-ichiro itojun Hagino <itojun@itojun.org>
*
- * $Id: packet-bgp.c,v 1.87 2004/03/06 03:25:09 guy Exp $
+ * $Id: packet-bgp.c,v 1.88 2004/05/24 02:25:17 guy Exp $
*
* Supports:
* RFC1771 A Border Gateway Protocol 4 (BGP-4)
@@ -2770,10 +2770,10 @@ proto_register_bgp(void)
};
module_t *bgp_module;
static enum_val_t asn_len[] = {
- {"Auto-detect", 0},
- {"2 octet", 2},
- {"4 octet", 4},
- {NULL, -1}
+ {"auto-detect", "Auto-detect", 0},
+ {"2", "2 octet", 2},
+ {"4", "4 octet", 4},
+ {NULL, NULL, -1}
};
proto_bgp = proto_register_protocol("Border Gateway Protocol",
diff --git a/packet-bssap.c b/packet-bssap.c
index 4d38681dce..4181087337 100644
--- a/packet-bssap.c
+++ b/packet-bssap.c
@@ -7,7 +7,7 @@
* Copyright 2003, Michael Lum <mlum [AT] telostech.com>
* In association with Telos Technology Inc.
*
- * $Id: packet-bssap.c,v 1.9 2003/12/17 23:54:44 guy Exp $
+ * $Id: packet-bssap.c,v 1.10 2004/05/24 02:25:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -444,9 +444,9 @@ proto_register_bssap(void)
};
static enum_val_t bssap_or_bsap_options[] = {
- { "BSSAP", BSSAP },
- { "BSAP", BSAP },
- { NULL, 0 }
+ { "bssap", "BSSAP", BSSAP },
+ { "bsap", "BSAP", BSAP },
+ { NULL, NULL, 0 }
};
diff --git a/packet-clnp.c b/packet-clnp.c
index ad85950985..c3f0454e0b 100644
--- a/packet-clnp.c
+++ b/packet-clnp.c
@@ -1,7 +1,7 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
- * $Id: packet-clnp.c,v 1.84 2004/05/23 23:07:17 guy Exp $
+ * $Id: packet-clnp.c,v 1.85 2004/05/24 02:25:18 guy Exp $
* Laurent Deniel <laurent.deniel@free.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@@ -365,10 +365,10 @@ static gboolean cotp_reassemble = FALSE;
static gint32 tsap_display = TSAP_DISPLAY_AUTO;
const enum_val_t tsap_display_options[] = {
- {"auto", TSAP_DISPLAY_AUTO},
- {"string", TSAP_DISPLAY_STRING},
- {"bytes", TSAP_DISPLAY_BYTES},
- {NULL, -1}
+ {"auto", "As strings if printable", TSAP_DISPLAY_AUTO},
+ {"string", "As strings", TSAP_DISPLAY_STRING},
+ {"bytes", "As bytes", TSAP_DISPLAY_BYTES},
+ {NULL, NULL, -1}
};
diff --git a/packet-fr.c b/packet-fr.c
index 8c40506bb9..afbbdadb51 100644
--- a/packet-fr.c
+++ b/packet-fr.c
@@ -3,7 +3,7 @@
*
* Copyright 2001, Paul Ionescu <paul@acorp.ro>
*
- * $Id: packet-fr.c,v 1.47 2004/01/18 08:32:45 guy Exp $
+ * $Id: packet-fr.c,v 1.48 2004/05/24 02:25:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -694,10 +694,10 @@ void proto_register_fr(void)
&ett_fr_control,
};
static enum_val_t fr_encap_options[] = {
- {"FRF 3.2/Cisco HDLC", FRF_3_2 },
- {"GPRS Network Service", GPRS_NS },
- {"Raw Ethernet", RAW_ETHER },
- { NULL, 0 },
+ { "frf-3.2", "FRF 3.2/Cisco HDLC", FRF_3_2 },
+ { "gprs-ns", "GPRS Network Service", GPRS_NS },
+ { "ethernet", "Raw Ethernet", RAW_ETHER },
+ { NULL, NULL, 0 },
};
module_t *frencap_module;
diff --git a/packet-ieee80211.c b/packet-ieee80211.c
index 7206727787..455e9e6ce8 100644
--- a/packet-ieee80211.c
+++ b/packet-ieee80211.c
@@ -3,7 +3,7 @@
* Copyright 2000, Axis Communications AB
* Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
*
- * $Id: packet-ieee80211.c,v 1.107 2004/03/23 19:25:50 guy Exp $
+ * $Id: packet-ieee80211.c,v 1.108 2004/05/24 02:25:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -2739,12 +2739,12 @@ proto_register_ieee80211 (void)
module_t *wlan_module;
static const enum_val_t wep_keys_options[] = {
- {"0", 0},
- {"1", 1},
- {"2", 2},
- {"3", 3},
- {"4", 4},
- {NULL, -1},
+ {"0", "0", 0},
+ {"1", "1", 1},
+ {"2", "2", 2},
+ {"3", "3", 3},
+ {"4", "4", 4},
+ {NULL, NULL, -1},
};
diff --git a/packet-iscsi.c b/packet-iscsi.c
index 07ee1e44c2..e7439d73a2 100644
--- a/packet-iscsi.c
+++ b/packet-iscsi.c
@@ -3,7 +3,7 @@
* Copyright 2001, Eurologic and Mark Burton <markb@ordern.com>
* 2004 Request/Response matching and Service Response Time: ronnie sahlberg
*
- * $Id: packet-iscsi.c,v 1.49 2004/02/18 09:10:02 sahlberg Exp $
+ * $Id: packet-iscsi.c,v 1.50 2004/05/24 02:25:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -49,12 +49,12 @@
#define ISCSI_PROTOCOL_DRAFT13 5
static enum_val_t iscsi_protocol_versions[] = {
- { "Draft 08", ISCSI_PROTOCOL_DRAFT08 },
- { "Draft 09", ISCSI_PROTOCOL_DRAFT09 },
- { "Draft 11", ISCSI_PROTOCOL_DRAFT11 },
- { "Draft 12", ISCSI_PROTOCOL_DRAFT12 },
- { "Draft 13", ISCSI_PROTOCOL_DRAFT13 },
- { NULL, 0 }
+ { "draft-08", "Draft 08", ISCSI_PROTOCOL_DRAFT08 },
+ { "draft-09", "Draft 09", ISCSI_PROTOCOL_DRAFT09 },
+ { "draft-11", "Draft 11", ISCSI_PROTOCOL_DRAFT11 },
+ { "draft-12", "Draft 12", ISCSI_PROTOCOL_DRAFT12 },
+ { "draft-13", "Draft 13", ISCSI_PROTOCOL_DRAFT13 },
+ { NULL, NULL, 0 }
};
static gint iscsi_protocol_version = ISCSI_PROTOCOL_DRAFT13;
diff --git a/packet-lmp.c b/packet-lmp.c
index 4fe2d3b7ab..5a6b248896 100644
--- a/packet-lmp.c
+++ b/packet-lmp.c
@@ -3,7 +3,7 @@
*
* (c) Copyright Ashok Narayanan <ashokn@cisco.com>
*
- * $Id: packet-lmp.c,v 1.20 2004/05/20 11:47:46 ulfl Exp $
+ * $Id: packet-lmp.c,v 1.21 2004/05/24 02:25:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -2264,10 +2264,10 @@ register_lmp_prefs (void)
{
module_t *lmp_module;
static enum_val_t lmp_ver[] = {
- {"draft-ietf-ccamp-lmp-09", LMP_VER_DRAFT_CCAMP_09},
- {"draft-ietf-ccamp-lmp-03", LMP_VER_DRAFT_CCAMP_03},
- {"draft-ietf-ccamp-lmp-02", LMP_VER_DRAFT_CCAMP_02},
- {NULL, -1}
+ {"draft-ietf-ccamp-lmp-09", "draft-ietf-ccamp-lmp-09", LMP_VER_DRAFT_CCAMP_09},
+ {"draft-ietf-ccamp-lmp-03", "draft-ietf-ccamp-lmp-03", LMP_VER_DRAFT_CCAMP_03},
+ {"draft-ietf-ccamp-lmp-02", "draft-ietf-ccamp-lmp-02", LMP_VER_DRAFT_CCAMP_02},
+ {NULL, NULL, -1}
};
lmp_module = prefs_register_protocol(proto_lmp, lmp_prefs_applied);
diff --git a/packet-m2pa.c b/packet-m2pa.c
index 199cf6742d..43189a050c 100644
--- a/packet-m2pa.c
+++ b/packet-m2pa.c
@@ -7,7 +7,7 @@
* Copyright 2001, 2002, Jeff Morriss <jeff.morriss[AT]ulticom.com>,
* updated by Michael Tuexen <tuexen [AT] fh-muenster.de>
*
- * $Id: packet-m2pa.c,v 1.23 2004/03/23 18:59:44 tuexen Exp $
+ * $Id: packet-m2pa.c,v 1.24 2004/05/24 02:25:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -420,9 +420,9 @@ proto_register_m2pa(void)
};
static enum_val_t m2pa_version_options[] = {
- { "Internet Draft version 2", M2PA_V2 },
- { "Internet Draft version 11", M2PA_V11 },
- { NULL, 0 }
+ { "draft-2", "Internet Draft version 2", M2PA_V2 },
+ { "draft-11", "Internet Draft version 11", M2PA_V11 },
+ { NULL, NULL, 0 }
};
proto_m2pa = proto_register_protocol("MTP2 Peer Adaptation Layer", "M2PA", "m2pa");
diff --git a/packet-m2ua.c b/packet-m2ua.c
index 87df31e94e..8bcc61a1ef 100644
--- a/packet-m2ua.c
+++ b/packet-m2ua.c
@@ -6,7 +6,7 @@
*
* Copyright 2002, Michael Tuexen <tuexen [AT] fh-muenster.de>
*
- * $Id: packet-m2ua.c,v 1.14 2003/12/01 23:26:40 guy Exp $
+ * $Id: packet-m2ua.c,v 1.15 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1123,9 +1123,9 @@ proto_register_m2ua(void)
};
static enum_val_t protocol_data_1_options[] = {
- { "0x000e (Draft 7)", PROTOCOL_DATA_1_DRAFT_7 },
- { "0x0300 (RFC3331)", PROTOCOL_DATA_1_PARAMETER_TAG },
- { NULL, 0 }
+ { "draft-7", "0x000e (Draft 7)", PROTOCOL_DATA_1_DRAFT_7 },
+ { "rfc3331", "0x0300 (RFC3331)", PROTOCOL_DATA_1_PARAMETER_TAG },
+ { NULL, NULL, 0 }
};
module_t *m2ua_module;
diff --git a/packet-m3ua.c b/packet-m3ua.c
index 7ca6da111e..7a9ac90438 100644
--- a/packet-m3ua.c
+++ b/packet-m3ua.c
@@ -8,7 +8,7 @@
*
* Copyright 2000, 2001, 2002, 2003, 2004 Michael Tuexen <tuexen [AT] fh-muenster.de>
*
- * $Id: packet-m3ua.c,v 1.39 2004/03/25 23:25:20 tuexen Exp $
+ * $Id: packet-m3ua.c,v 1.40 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1953,11 +1953,11 @@ proto_register_m3ua(void)
};
static enum_val_t options[] = {
- { "Internet Draft version 5", M3UA_V5 },
- { "Internet Draft version 6", M3UA_V6 },
- { "Internet Draft version 7", M3UA_V7 },
- { "RFC 3332", M3UA_RFC },
- { NULL, 0 }
+ { "draft-5", "Internet Draft version 5", M3UA_V5 },
+ { "draft-6", "Internet Draft version 6", M3UA_V6 },
+ { "draft-7", "Internet Draft version 7", M3UA_V7 },
+ { "rfc3332", "RFC 3332", M3UA_RFC },
+ { NULL, NULL, 0 }
};
/* Register the protocol name and description */
diff --git a/packet-mtp3.c b/packet-mtp3.c
index d6c3b97633..759c6afced 100644
--- a/packet-mtp3.c
+++ b/packet-mtp3.c
@@ -9,7 +9,7 @@
* Copyright 2001, Michael Tuexen <tuexen [AT] fh-muenster.de>
* Updated for ANSI and Chinese ITU support by Jeff Morriss <jeff.morriss[AT]ulticom.com>
*
- * $Id: packet-mtp3.c,v 1.27 2004/04/21 05:53:56 guy Exp $
+ * $Id: packet-mtp3.c,v 1.28 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -634,19 +634,19 @@ proto_register_mtp3(void)
};
static enum_val_t mtp3_options[] = {
- { "ITU", ITU_STANDARD },
- { "ANSI", ANSI_STANDARD },
- { "Chinese ITU", CHINESE_ITU_STANDARD },
- { NULL, 0 }
+ { "itu", "ITU", ITU_STANDARD },
+ { "ansi", "ANSI", ANSI_STANDARD },
+ { "chinese-itu", "Chinese ITU", CHINESE_ITU_STANDARD },
+ { NULL, NULL, 0 }
};
static enum_val_t mtp3_net_addr_fmt_str_e[] = {
- { "Decimal", MTP3_NET_ADDR_FMT_DEC },
- { "Hexadecimal", MTP3_NET_ADDR_FMT_HEX },
- { "NI-Decimal", MTP3_NET_ADDR_FMT_NI_DEC },
- { "NI-Hexadecimal", MTP3_NET_ADDR_FMT_NI_HEX },
- { "Dashed", MTP3_NET_ADDR_FMT_DASHED },
- { NULL, 0 }
+ { "decimal", "Decimal", MTP3_NET_ADDR_FMT_DEC },
+ { "hexadecimal", "Hexadecimal", MTP3_NET_ADDR_FMT_HEX },
+ { "ni-decimal", "NI-Decimal", MTP3_NET_ADDR_FMT_NI_DEC },
+ { "ni-hexadecimal", "NI-Hexadecimal", MTP3_NET_ADDR_FMT_NI_HEX },
+ { "dashed", "Dashed", MTP3_NET_ADDR_FMT_DASHED },
+ { NULL, NULL, 0 }
};
/* Register the protocol name and description */
diff --git a/packet-ndmp.c b/packet-ndmp.c
index 70399b0b6c..4aad9397a3 100644
--- a/packet-ndmp.c
+++ b/packet-ndmp.c
@@ -2,7 +2,7 @@
* Routines for NDMP dissection
* 2001 Ronnie Sahlberg (see AUTHORS for email)
*
- * $Id: packet-ndmp.c,v 1.27 2004/03/11 09:54:00 sahlberg Exp $
+ * $Id: packet-ndmp.c,v 1.28 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -235,11 +235,11 @@ static gint ett_ndmp_state_invalids = -1;
#define NDMP_PROTOCOL_V5 4
static enum_val_t ndmp_protocol_versions[] = {
- { "Version 2", NDMP_PROTOCOL_V2 },
- { "Version 3", NDMP_PROTOCOL_V3 },
- { "Version 4", NDMP_PROTOCOL_V4 },
- { "Version 5", NDMP_PROTOCOL_V5 },
- { NULL, 0 }
+ { "version2", "Version 2", NDMP_PROTOCOL_V2 },
+ { "version3", "Version 3", NDMP_PROTOCOL_V3 },
+ { "version4", "Version 4", NDMP_PROTOCOL_V4 },
+ { "version5", "Version 5", NDMP_PROTOCOL_V5 },
+ { NULL, NULL, 0 }
};
static gint ndmp_protocol_version = NDMP_PROTOCOL_V2;
diff --git a/packet-ppp.c b/packet-ppp.c
index 22d662c4e9..9aea556c85 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -2,7 +2,7 @@
* Routines for ppp packet disassembly
* RFC 1661, RFC 1662
*
- * $Id: packet-ppp.c,v 1.118 2004/04/29 20:21:28 gerald Exp $
+ * $Id: packet-ppp.c,v 1.119 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -177,10 +177,10 @@ static gint ppp_fcs_decode = 0; /* 0 = No FCS, 1 = 16 bit FCS, 2 = 32 bit FCS */
#define FCS_32 2
const enum_val_t fcs_options[] = {
- {"None", NO_FCS},
- {"16-Bit", FCS_16},
- {"32-Bit", FCS_32},
- {NULL, -1}
+ {"none", "None", NO_FCS},
+ {"16-bit", "16-Bit", FCS_16},
+ {"32-bit", "32-Bit", FCS_32},
+ {NULL, NULL, -1}
};
gboolean ppp_vj_decomp = TRUE; /* Default to VJ header decompression */
diff --git a/packet-scsi.c b/packet-scsi.c
index 884c1a48f0..30b3230b21 100644
--- a/packet-scsi.c
+++ b/packet-scsi.c
@@ -2,7 +2,7 @@
* Routines for decoding SCSI CDBs and responses
* Author: Dinesh G Dutt (ddutt@cisco.com)
*
- * $Id: packet-scsi.c,v 1.37 2004/05/13 21:56:19 gerald Exp $
+ * $Id: packet-scsi.c,v 1.38 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -644,9 +644,9 @@ static const value_string scsi_devtype_val[] = {
};
static const enum_val_t scsi_devtype_options[] = {
- {"Block Device", SCSI_DEV_SBC},
- {"Sequential Device", SCSI_DEV_SSC},
- {NULL, -1},
+ {"block", "Block Device", SCSI_DEV_SBC},
+ {"sequential", "Sequential Device", SCSI_DEV_SSC},
+ {NULL, NULL, -1},
};
static const value_string scsi_inquiry_vers_val[] = {
diff --git a/packet-sctp.c b/packet-sctp.c
index 8c5c1525d5..f97ac03a9e 100644
--- a/packet-sctp.c
+++ b/packet-sctp.c
@@ -16,7 +16,7 @@
* * bundling errors
* * value errors
*
- * $Id: packet-sctp.c,v 1.71 2004/05/08 17:54:54 tuexen Exp $
+ * $Id: packet-sctp.c,v 1.72 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -2248,11 +2248,11 @@ proto_register_sctp(void)
};
static enum_val_t sctp_checksum_options[] = {
- { "None", SCTP_CHECKSUM_NONE },
- { "Adler 32", SCTP_CHECKSUM_ADLER32 },
- { "CRC 32c", SCTP_CHECKSUM_CRC32C },
- { "Automatic", SCTP_CHECKSUM_AUTOMATIC},
- { NULL, 0 }
+ { "none", "None", SCTP_CHECKSUM_NONE },
+ { "adler-32", "Adler 32", SCTP_CHECKSUM_ADLER32 },
+ { "crc-32c", "CRC 32c", SCTP_CHECKSUM_CRC32C },
+ { "automatic", "Automatic", SCTP_CHECKSUM_AUTOMATIC},
+ { NULL, NULL, 0 }
};
/* Register the protocol name and description */
diff --git a/packet-t38.c b/packet-t38.c
index c728666d43..1dd1d53a6c 100644
--- a/packet-t38.c
+++ b/packet-t38.c
@@ -2,7 +2,7 @@
* Routines for T.38 packet dissection
* 2003 Hans Viens
*
- * $Id: packet-t38.c,v 1.6 2004/01/26 22:52:22 guy Exp $
+ * $Id: packet-t38.c,v 1.7 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -97,10 +97,10 @@ static gboolean t38_tpkt_reassembly = TRUE;
static gint t38_tpkt_usage = T38_TPKT_MAYBE;
static const enum_val_t t38_tpkt_options[] = {
- {"Never", T38_TPKT_NEVER},
- {"Always", T38_TPKT_ALWAYS},
- {"Maybe", T38_TPKT_MAYBE},
- {NULL, -1}
+ {"never", "Never", T38_TPKT_NEVER},
+ {"always", "Always", T38_TPKT_ALWAYS},
+ {"maybe", "Maybe", T38_TPKT_MAYBE},
+ {NULL, NULL, -1}
};
diff --git a/packet-tcap.c b/packet-tcap.c
index 3929ffd049..6c8d00f88f 100644
--- a/packet-tcap.c
+++ b/packet-tcap.c
@@ -9,7 +9,7 @@
*
* (append your name here for newer version)
*
- * $Id: packet-tcap.c,v 1.10 2004/03/20 07:26:41 guy Exp $
+ * $Id: packet-tcap.c,v 1.11 2004/05/24 02:25:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -2835,9 +2835,9 @@ proto_register_tcap(void)
};
static enum_val_t tcap_options[] = {
- { "ITU", ITU_TCAP_STANDARD },
- { "ANSI", ANSI_TCAP_STANDARD },
- { NULL, 0 }
+ { "itu", "ITU", ITU_TCAP_STANDARD },
+ { "ansi", "ANSI", ANSI_TCAP_STANDARD },
+ { NULL, NULL, 0 }
};
module_t *tcap_module;
diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c
index 2c87ae2c0b..65f0288809 100644
--- a/plugins/asn1/packet-asn1.c
+++ b/plugins/asn1/packet-asn1.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2003 by Matthijs Melchior <matthijs.melchior@xs4all.nl>
*
- * $Id: packet-asn1.c,v 1.22 2004/03/23 21:19:58 guy Exp $
+ * $Id: packet-asn1.c,v 1.23 2004/05/24 02:25:21 guy Exp $
*
* A plugin for:
*
@@ -4637,17 +4637,17 @@ void
proto_register_asn1(void) {
static const enum_val_t type_recursion_opts[] = {
- { "0", 0 },
- { "1", 1 },
- { "2", 2 },
- { "3", 3 },
- { "4", 4 },
- { "5", 5 },
- { "6", 6 },
- { "7", 7 },
- { "8", 8 },
- { "9", 9 },
- { NULL, -1},
+ { "0", "0", 0 },
+ { "1", "1", 1 },
+ { "2", "2", 2 },
+ { "3", "3", 3 },
+ { "4", "4", 4 },
+ { "4", "5", 5 },
+ { "6", "6", 6 },
+ { "7", "7", 7 },
+ { "8", "8", 8 },
+ { "9", "9", 9 },
+ { NULL, NULL, -1},
};
static gint *ett[1+MAX_NEST+MAXPDU];
diff --git a/prefs.c b/prefs.c
index cc2d00c632..132becac13 100644
--- a/prefs.c
+++ b/prefs.c
@@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
- * $Id: prefs.c,v 1.132 2004/05/13 15:28:01 ulfl Exp $
+ * $Id: prefs.c,v 1.133 2004/05/24 02:25:20 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -804,21 +804,35 @@ clear_string_list(GList *sl)
* Takes a string, a pointer to an array of "enum_val_t"s, and a default gint
* value.
* The array must be terminated by an entry with a null "name" string.
- * If the string matches a "name" strings in an entry, the value from that
- * entry is returned. Otherwise, the default value that was passed as the
- * third argument is returned.
+ *
+ * If the string matches a "name" string in an entry, the value from that
+ * entry is returned.
+ *
+ * Otherwise, if a string matches a "desctiption" string in an entry, the
+ * value from that entry is returned; we do that for backwards compatibility,
+ * as we used to have only a "name" string that was used both for command-line
+ * and configuration-file values and in the GUI (which meant either that
+ * the GUI had what might be somewhat cryptic values to select from or that
+ * the "-o" flag took long strings, often with spaces in them).
+ *
+ * Otherwise, the default value that was passed as the third argument is
+ * returned.
*/
gint
find_val_for_string(const char *needle, const enum_val_t *haystack,
gint default_value)
{
- int i = 0;
+ int i;
- while (haystack[i].name != NULL) {
+ for (i = 0; haystack[i].name != NULL; i++) {
if (strcasecmp(needle, haystack[i].name) == 0) {
return haystack[i].value;
}
- i++;
+ }
+ for (i = 0; haystack[i].name != NULL; i++) {
+ if (strcasecmp(needle, haystack[i].description) == 0) {
+ return haystack[i].value;
+ }
}
return default_value;
}
@@ -2006,13 +2020,20 @@ write_pref(gpointer data, gpointer user_data)
break;
case PREF_ENUM:
+ /*
+ * For now, we save the "description" value, so that if we
+ * save the preferences older versions of Ethereal can at
+ * least read preferences that they supported; we support
+ * either the short name or the description when reading
+ * the preferences file or a "-o" option.
+ */
fprintf(arg->pf, "# One of: ");
enum_valp = pref->info.enum_info.enumvals;
val_string = NULL;
while (enum_valp->name != NULL) {
if (enum_valp->value == *pref->varp.enump)
- val_string = enum_valp->name;
- fprintf(arg->pf, "%s", enum_valp->name);
+ val_string = enum_valp->description;
+ fprintf(arg->pf, "%s", enum_valp->description);
enum_valp++;
if (enum_valp->name == NULL)
fprintf(arg->pf, "\n");
@@ -2020,8 +2041,8 @@ write_pref(gpointer data, gpointer user_data)
fprintf(arg->pf, ", ");
}
fprintf(arg->pf, "# (case-insensitive).\n");
- fprintf(arg->pf, "%s.%s: %s\n", arg->module->name, pref->name,
- val_string);
+ fprintf(arg->pf, "%s.%s: %s\n", arg->module->name,
+ pref->name, val_string);
break;
case PREF_STRING:
diff --git a/prefs.h b/prefs.h
index 11f296cccb..722a77589d 100644
--- a/prefs.h
+++ b/prefs.h
@@ -1,7 +1,7 @@
/* prefs.h
* Definitions for preference handling routines
*
- * $Id: prefs.h,v 1.63 2004/05/13 16:34:29 jmayer Exp $
+ * $Id: prefs.h,v 1.64 2004/05/24 02:25:20 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -255,6 +255,7 @@ extern void prefs_register_bool_preference(module_t *module, const char *name,
*/
typedef struct {
char *name;
+ char *description;
gint value;
} enum_val_t;