When registering a field, make sure its ID is -1 or 0 - if it's not,

that probably means you've registered two fields with the same field ID
variable, which is an error.

Fix the bugs doing so found.

svn path=/trunk/; revision=8629
This commit is contained in:
Guy Harris 2003-10-06 20:46:52 +00:00
parent 7183be72b2
commit af5b47a0c2
10 changed files with 28 additions and 48 deletions

View File

@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
* $Id: proto.c,v 1.99 2003/08/25 00:15:01 guy Exp $
* $Id: proto.c,v 1.100 2003/10/06 20:46:52 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -2283,6 +2283,16 @@ proto_register_field_array(int parent, hf_register_info *hf, int num_records)
proto = find_protocol_by_id(parent);
for (i = 0; i < num_records; i++, ptr++) {
/*
* Make sure we haven't registed this yet.
* Most fields have variables associated with them
* that are initialized to -1; some have array elements,
* or possibly uninitialized variables, so we also allow
* 0 (which is unlikely to be the field ID we get back
* from "proto_register_field_init()").
*/
g_assert(*ptr->p_id == -1 || *ptr->p_id == 0);
if (proto != NULL) {
if (proto->fields == NULL) {
proto->fields = g_list_append(NULL, ptr);

View File

@ -8,7 +8,7 @@
* Portions based on information/specs retrieved from the OpenAFS sources at
* www.openafs.org, Copyright IBM.
*
* $Id: packet-afs-register-info.h,v 1.18 2003/03/08 07:27:41 guy Exp $
* $Id: packet-afs-register-info.h,v 1.19 2003/10/06 20:46:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -143,7 +143,7 @@
FT_UINT32, BASE_DEC, 0, 0, "XStats Version", HFILL }},
{ &hf_afs_fs_xstats_clientversion, { "Client Version", "afs.fs.xstats.clientversion",
FT_UINT32, BASE_DEC, 0, 0, "Client Version", HFILL }},
{ &hf_afs_fs_xstats_version, { "Collection Number", "afs.fs.xstats.collnumber",
{ &hf_afs_fs_xstats_collnumber, { "Collection Number", "afs.fs.xstats.collnumber",
FT_UINT32, BASE_DEC, VALS(xstat_collections), 0, "Collection Number", HFILL }},
{ &hf_afs_fs_xstats_timestamp, { "XStats Timestamp", "afs.fs.xstats.timestamp",
FT_UINT32, BASE_DEC, 0, 0, "XStats Timestamp", HFILL }},
@ -155,10 +155,9 @@
FT_UINT32, BASE_DEC, 0, 0, "CPS Spare3", HFILL }},
{ &hf_afs_fs_vicelocktype, { "Vice Lock Type", "afs.fs.vicelocktype",
FT_UINT32, BASE_DEC, VALS(vice_lock_types), 0, "Vice Lock Type", HFILL }},
/* XXX - is this an IP address? */
{ &hf_afs_fs_viceid, { "Vice ID", "afs.fs.viceid",
FT_UINT32, BASE_DEC, 0, 0, "Vice ID", HFILL }},
{ &hf_afs_fs_viceid, { "IP Address", "afs.fs.ipaddr",
FT_IPv4, BASE_HEX, 0, 0, "IP Address", HFILL }},
{ &hf_afs_fs_status_mask, { "Mask", "afs.fs.status.mask",
FT_UINT32, BASE_HEX, 0, 0, "Mask", HFILL }},

View File

@ -1,7 +1,7 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
* $Id: packet-clnp.c,v 1.77 2003/08/28 04:19:28 guy Exp $
* $Id: packet-clnp.c,v 1.78 2003/10/06 20:46:50 guy Exp $
* Laurent Deniel <laurent.deniel@free.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@ -2284,12 +2284,6 @@ void proto_register_cotp(void)
void proto_register_cltp(void)
{
static hf_register_info hf[] = {
{ &hf_cotp_srcref,
{ "Source reference", "cotp.srcref", FT_UINT16, BASE_HEX, NULL, 0x0,
"Source address reference", HFILL}},
{ &hf_cotp_destref,
{ "Destination reference", "cotp.destref", FT_UINT16, BASE_HEX, NULL, 0x0,
"Destination address reference", HFILL}},
{ &hf_cltp_type,
{ "CLTP PDU Type", "cltp.type", FT_UINT8, BASE_HEX, VALS(cltp_tpdu_type_abbrev_vals), 0x0,
"CLTP PDU Type", HFILL}},

View File

@ -2,7 +2,7 @@
* Routines for FC distributed Name Server (dNS)
* Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
*
* $Id: packet-fcdns.c,v 1.1 2003/01/14 01:17:44 guy Exp $
* $Id: packet-fcdns.c,v 1.2 2003/10/06 20:46:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1790,9 +1790,6 @@ proto_register_fcdns (void)
{ &hf_fcdns_fc4type,
{"FC-4 Type", "fcdns.req.fc4type", FT_STRING, BASE_HEX, NULL, 0x0,
"", HFILL}},
{ &hf_fcdns_rply_fc4desc,
{"FC-4 Descriptor", "fcdns.rply.fc4desc", FT_STRING, BASE_HEX, NULL,
0x0, "", HFILL}},
{ &hf_fcdns_rply_fc4feat,
{"FC-4 Features", "fcdns.rply.fc4features", FT_STRING, BASE_HEX,
NULL, 0x0, "", HFILL}},

View File

@ -5,7 +5,7 @@
* <anders.broman@ericsson.com>
* Inserted routines for BICC dissection according to Q.765.5 Q.1902 Q.1970 Q.1990,
* calling SDP dissector for RFC2327 decoding.
* $Id: packet-isup.c,v 1.30 2003/10/06 08:35:30 guy Exp $
* $Id: packet-isup.c,v 1.31 2003/10/06 20:46:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1274,7 +1274,7 @@ static int hf_isup_inband_information_ind = -1;
static int hf_isup_call_diversion_may_occur_ind = -1;
static int hf_isup_mlpp_user_ind = -1;
static int hf_isup_access_delivery_ind =- -1;
static int hf_isup_access_delivery_ind = -1;
static int hf_isup_transmission_medium_requirement_prime = -1;
@ -5530,11 +5530,6 @@ proto_register_isup(void)
FT_UINT8, BASE_HEX, VALS(bearer_network_connection_characteristics_vals),0x0,
"", HFILL }},
{ &hf_isup_app_cont_ident,
{ "Application context identifier", "isup.app_context_identifier",
FT_UINT8, BASE_DEC, VALS(isup_application_transport_parameter_value),0x0,
"", HFILL }},
{ &hf_Organization_Identifier,
{ "Organization identifier subfield ", "bat_ase.organization_identifier_subfield",
FT_UINT8, BASE_DEC, VALS(bat_ase_organization_identifier_subfield_vals),0x0,

View File

@ -2,7 +2,7 @@
* Routines for Frame Relay Local Management Interface (LMI) disassembly
* Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet-lmi.c,v 1.13 2003/10/06 07:26:10 guy Exp $
* $Id: packet-lmi.c,v 1.14 2003/10/06 20:46:51 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -169,15 +169,15 @@ dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ele_id = tvb_get_guint8( tvb, offset);
len = tvb_get_guint8( tvb, offset + 1);
ti = proto_tree_add_uint(lmi_tree, hf_lmi_inf_ele, tvb, offset, len + 2,
tvb_get_guint8( tvb, offset));
ti = proto_tree_add_text(lmi_tree, tvb, offset, len + 2,
"Information Element: %s",
val_to_str(ele_id, element_type_str, "Unknown (%u)"));
lmi_subtree = proto_item_add_subtree(ti, ett_lmi_ele);
proto_tree_add_uint(lmi_subtree, hf_lmi_inf_ele, tvb, offset, 1,
tvb_get_guint8( tvb, offset));
ele_id);
++offset;
len = tvb_get_guint8( tvb, offset);
proto_tree_add_uint(lmi_subtree, hf_lmi_inf_len, tvb, offset, 1, len);
++offset;
if (( ele_id == 1) || (ele_id == 51))
@ -207,9 +207,6 @@ proto_register_lmi(void)
{ "Message Type", "lmi.msg_type", FT_UINT8, BASE_HEX, VALS(msg_type_str), 0,
"Message Type", HFILL }},
{ &hf_lmi_inf_ele,
{ "Information Element", "lmi.inf_ele", FT_UINT8, BASE_DEC, VALS(element_type_str), 0,
"Information Element", HFILL }},
{ &hf_lmi_inf_ele,
{ "Type", "lmi.inf_ele_type", FT_UINT8, BASE_DEC, VALS(element_type_str), 0,
"Information Element Type", HFILL }},

View File

@ -3,7 +3,7 @@
*
* (c) Copyright Ashok Narayanan <ashokn@cisco.com>
*
* $Id: packet-lmp.c,v 1.15 2003/01/28 23:56:39 guy Exp $
* $Id: packet-lmp.c,v 1.16 2003/10/06 20:46:51 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -467,13 +467,6 @@ static hf_register_info lmpf_info[] = {
{ "REMOTE_NODE_ID", "lmp.obj.remote_nodeid", FT_NONE, BASE_NONE, NULL, 0x0,
"", HFILL }},
{&lmp_filter[LMPF_CLASS_LOCAL_NODE_ID],
{ "LOCAL_NODE_ID", "lmp.obj.local_nodeid", FT_NONE, BASE_NONE, NULL, 0x0,
"", HFILL }},
{&lmp_filter[LMPF_CLASS_REMOTE_NODE_ID],
{ "REMOTE_NODE_ID", "lmp.obj.remote_nodeid", FT_NONE, BASE_NONE, NULL, 0x0,
"", HFILL }},
{&lmp_filter[LMPF_CLASS_LOCAL_LINK_ID],
{ "LOCAL_LINK_ID", "lmp.obj.local_linkid", FT_NONE, BASE_NONE, NULL, 0x0,
"", HFILL }},

View File

@ -7,7 +7,7 @@
*
* Copyright 2000, 2001, 2002, 2003 Michael Tuexen <tuexen [AT] fh-muenster.de>
*
* $Id: packet-m3ua.c,v 1.35 2003/09/05 20:11:44 tuexen Exp $
* $Id: packet-m3ua.c,v 1.36 2003/10/06 20:46:51 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1723,7 +1723,6 @@ proto_register_m3ua(void)
{ &hf_correlation_identifier, { "Correlation Identifier", "m3ua.correlation_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
{ &hf_registration_status, { "Registration status", "m3ua.registration_status", FT_UINT32, BASE_DEC, VALS(registration_status_values), 0x0, "", HFILL } },
{ &hf_deregistration_status, { "Deregistration status", "m3ua.deregistration_status", FT_UINT32, BASE_DEC, VALS(deregistration_status_values), 0x0, "", HFILL } },
{ &hf_traffic_mode_type, { "Traffic mode Type", "m3ua.traffic_mode_type", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
{ &hf_registration_result_identifier, { "Local RK-identifier value", "m3ua.registration_result_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
{ &hf_registration_result_status, { "Registration status", "m3ua.registration_results_status", FT_UINT32, BASE_DEC, VALS(registration_result_status_values), 0x0, "", HFILL } },
{ &hf_registration_result_context, { "Routing context", "m3ua.registration_result_routing_context", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },

View File

@ -4,7 +4,7 @@
*
* Guy Harris <guy@alum.mit.edu>
*
* $Id: packet-nfsacl.c,v 1.10 2003/09/28 01:52:57 sahlberg Exp $
* $Id: packet-nfsacl.c,v 1.11 2003/10/06 20:46:51 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -43,7 +43,7 @@ static int hf_nfsacl2_status = -1;
static int hf_nfsacl3_status = -1;
static int hf_nfsacl_aclent = -1;
static int hf_nfsacl_aclent_type = -1;
static int hf_nfsacl_aclent_uid = 1;
static int hf_nfsacl_aclent_uid = -1;
static int hf_nfsacl_aclent_perm = -1;
static int hf_nfsacl_create = -1;

View File

@ -3,7 +3,7 @@
*
* (c) Copyright Ashok Narayanan <ashokn@cisco.com>
*
* $Id: packet-rsvp.c,v 1.82 2003/04/22 20:40:32 deniel Exp $
* $Id: packet-rsvp.c,v 1.83 2003/10/06 20:46:51 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -880,10 +880,6 @@ static hf_register_info rsvpf_info[] = {
{ "MESSAGE-ID LIST", "rsvp.msgid_list", FT_NONE, BASE_NONE, NULL, 0x0,
"", HFILL }},
{&rsvp_filter[RSVPF_HELLO_OBJ],
{ "HELLO", "rsvp.hello", FT_NONE, BASE_NONE, NULL, 0x0,
"", HFILL }},
{&rsvp_filter[RSVPF_DCLASS],
{ "DCLASS", "rsvp.dclass", FT_NONE, BASE_NONE, NULL, 0x0,
"", HFILL }},