summaryrefslogtreecommitdiff
path: root/packet-lapb.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-11-16 11:44:20 +0000
committerGuy Harris <guy@alum.mit.edu>1999-11-16 11:44:20 +0000
commita7aba0a28890856d2570951c2b0a76c922fdfa72 (patch)
treebcc3d6ea4d23e60c7841a408e9b1876ed6a93106 /packet-lapb.c
parent3a2f7f641a49b5eb9f369dcb29bc8a7cb1c50a91 (diff)
downloadwireshark-a7aba0a28890856d2570951c2b0a76c922fdfa72.tar.gz
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-lapb.c')
-rw-r--r--packet-lapb.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/packet-lapb.c b/packet-lapb.c
index a6b11e3a6d..18e33b9de6 100644
--- a/packet-lapb.c
+++ b/packet-lapb.c
@@ -2,7 +2,7 @@
* Routines for lapb frame disassembly
* Olivier Abad <abad@daba.dhis.org>
*
- * $Id: packet-lapb.c,v 1.7 1999/10/15 21:05:49 gram Exp $
+ * $Id: packet-lapb.c,v 1.8 1999/11/16 11:42:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -40,9 +40,12 @@
#define FROM_DCE 0x80
-int proto_lapb = -1;
-int hf_lapb_address = -1;
-int hf_lapb_control = -1;
+static int proto_lapb = -1;
+static int hf_lapb_address = -1;
+static int hf_lapb_control = -1;
+
+static gint ett_lapb = -1;
+static gint ett_lapb_control = -1;
void
dissect_lapb(const u_char *pd, frame_data *fd, proto_tree *tree)
@@ -87,14 +90,14 @@ dissect_lapb(const u_char *pd, frame_data *fd, proto_tree *tree)
if (tree) {
ti = proto_tree_add_item_format(tree, proto_lapb, 0, 2, NULL,
"LAPB");
- lapb_tree = proto_item_add_subtree(ti, ETT_LAPB);
+ lapb_tree = proto_item_add_subtree(ti, ett_lapb);
proto_tree_add_item_format(lapb_tree, hf_lapb_address, 0, 1, pd[0],
"Address: 0x%02X", pd[0]);
}
else
lapb_tree = NULL;
dissect_xdlc_control(pd, 1, fd, lapb_tree, hf_lapb_control,
- is_response, FALSE);
+ ett_lapb_control, is_response, FALSE);
/* not end of frame ==> X.25 */
if (fd->cap_len > 2) dissect_x25(pd, 2, fd, tree);
@@ -112,7 +115,12 @@ proto_register_lapb(void)
{ "Control Field", "lapb.control", FT_STRING, BASE_NONE, NULL, 0x0,
"" }},
};
+ static gint *ett[] = {
+ &ett_lapb,
+ &ett_lapb_control,
+ };
proto_lapb = proto_register_protocol ("Link Access Procedure Balanced (LAPB)", "lapb");
proto_register_field_array (proto_lapb, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
}