diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-11-16 11:44:20 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-11-16 11:44:20 +0000 |
commit | a7aba0a28890856d2570951c2b0a76c922fdfa72 (patch) | |
tree | bcc3d6ea4d23e60c7841a408e9b1876ed6a93106 /packet-trmac.c | |
parent | 3a2f7f641a49b5eb9f369dcb29bc8a7cb1c50a91 (diff) | |
download | wireshark-a7aba0a28890856d2570951c2b0a76c922fdfa72.tar.gz wireshark-a7aba0a28890856d2570951c2b0a76c922fdfa72.tar.bz2 wireshark-a7aba0a28890856d2570951c2b0a76c922fdfa72.zip |
Replace the ETT_ "enum" members, declared in "packet.h", with
dynamically-assigned "ett_" integer values, assigned by
"proto_register_subtree_array()"; this:
obviates the need to update "packet.h" whenever you add a new
subtree type - you only have to add a call to
"proto_register_subtree_array()" to a "register" routine and an
array of pointers to "ett_", if they're not already there, and
add a pointer to the new "ett_" variable to the array, if they
are there;
would allow run-time-loaded dissectors to allocate subtree types
when they're loaded.
svn path=/trunk/; revision=1043
Diffstat (limited to 'packet-trmac.c')
-rw-r--r-- | packet-trmac.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/packet-trmac.c b/packet-trmac.c index baf7c3e493..b00497424b 100644 --- a/packet-trmac.c +++ b/packet-trmac.c @@ -2,7 +2,7 @@ * Routines for Token-Ring Media Access Control * Gilbert Ramirez <gram@verdict.uthscsa.edu> * - * $Id: packet-trmac.c,v 1.16 1999/10/12 06:20:19 gram Exp $ + * $Id: packet-trmac.c,v 1.17 1999/11/16 11:43:01 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -55,6 +55,10 @@ static int hf_trmac_errors_freq = -1; static int hf_trmac_errors_token = -1; static int hf_trmac_naun = -1; +static gint ett_tr_mac = -1; +static gint ett_tr_ierr_cnt = -1; +static gint ett_tr_nerr_cnt = -1; + /* Major Vector */ static value_string major_vector_vs[] = { { 0x00, "Response" }, @@ -230,7 +234,7 @@ sv_text(const u_char *pd, int pkt_offset, proto_tree *tree) memcpy(errors, &pd[2], 6); ti = proto_tree_add_item(tree, hf_trmac_errors_iso, pkt_offset+1, sv_length-1, errors[0] + errors[1] + errors[2] + errors[3] + errors[4]); - sv_tree = proto_item_add_subtree(ti, ETT_TR_IERR_CNT); + sv_tree = proto_item_add_subtree(ti, ett_tr_ierr_cnt); proto_tree_add_item(sv_tree, hf_trmac_errors_line, pkt_offset+2, 1, errors[0]); proto_tree_add_item(sv_tree, hf_trmac_errors_internal, pkt_offset+3, 1, errors[1]); @@ -244,7 +248,7 @@ sv_text(const u_char *pd, int pkt_offset, proto_tree *tree) memcpy(errors, &pd[2], 6); ti = proto_tree_add_item(tree, hf_trmac_errors_noniso, pkt_offset+1, sv_length-1, errors[0] + errors[1] + errors[2] + errors[3] + errors[4]); - sv_tree = proto_item_add_subtree(ti, ETT_TR_NERR_CNT); + sv_tree = proto_item_add_subtree(ti, ett_tr_nerr_cnt); proto_tree_add_item(sv_tree, hf_trmac_errors_lost, pkt_offset+2, 1, errors[0]); proto_tree_add_item(sv_tree, hf_trmac_errors_congestion, pkt_offset+3, 1, errors[1]); @@ -289,7 +293,7 @@ dissect_trmac(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_trmac, offset, mv_length, NULL); - mac_tree = proto_item_add_subtree(ti, ETT_TR_MAC); + mac_tree = proto_item_add_subtree(ti, ett_tr_mac); proto_tree_add_item(mac_tree, hf_trmac_mv, offset+3, 1, mv_val); proto_tree_add_item_format(mac_tree, hf_trmac_length, offset, 2, mv_length, @@ -391,7 +395,13 @@ proto_register_trmac(void) { "NAUN", "trmac.naun", FT_ETHER, BASE_DEC, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_tr_mac, + &ett_tr_ierr_cnt, + &ett_tr_nerr_cnt, + }; proto_trmac = proto_register_protocol("Token-Ring Media Access Control", "trmac"); proto_register_field_array(proto_trmac, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } |