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-q931.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-q931.c')
-rw-r--r-- | packet-q931.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/packet-q931.c b/packet-q931.c index 960bedb4c4..4aa0a4bbe1 100644 --- a/packet-q931.c +++ b/packet-q931.c @@ -2,7 +2,7 @@ * Routines for Q.931 frame disassembly * Guy Harris <guy@alum.mit.edu> * - * $Id: packet-q931.c,v 1.5 1999/11/13 10:13:24 guy Exp $ + * $Id: packet-q931.c,v 1.6 1999/11/16 11:42:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -49,11 +49,14 @@ * http://www.tulatelecom.ru/staff/german/DSSHelp/MessList/InfEl/InfElList.html */ -int proto_q931 = -1; -int hf_q931_discriminator = -1; -int hf_q931_call_ref_len = -1; -int hf_q931_call_ref = -1; -int hf_q931_message_type = -1; +static int proto_q931 = -1; +static int hf_q931_discriminator = -1; +static int hf_q931_call_ref_len = -1; +static int hf_q931_call_ref = -1; +static int hf_q931_message_type = -1; + +static gint ett_q931 = -1; +static gint ett_q931_ie = -1; /* * Q.931 message types. @@ -1959,7 +1962,7 @@ dissect_q931(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_q931, offset, 3, NULL); - q931_tree = proto_item_add_subtree(ti, ETT_Q931); + q931_tree = proto_item_add_subtree(ti, ett_q931); proto_tree_add_item(q931_tree, hf_q931_discriminator, offset, 1, pd[offset]); } @@ -2084,7 +2087,7 @@ dissect_q931(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) 1+1+info_element_len, "%s", val_to_str(info_element, q931_info_element_vals, "Unknown information element (0x%02X)")); - ie_tree = proto_item_add_subtree(ti, ETT_Q931_IE); + ie_tree = proto_item_add_subtree(ti, ett_q931_ie); proto_tree_add_text(ie_tree, offset, 1, "Information element: %s", val_to_str(info_element, q931_info_element_vals, @@ -2255,7 +2258,12 @@ proto_register_q931(void) "" }}, }; + static gint *ett[] = { + &ett_q931, + &ett_q931_ie, + }; proto_q931 = proto_register_protocol ("Q.931", "q931"); proto_register_field_array (proto_q931, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } |