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-llc.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-llc.c')
-rw-r--r-- | packet-llc.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/packet-llc.c b/packet-llc.c index f015677564..d24156caae 100644 --- a/packet-llc.c +++ b/packet-llc.c @@ -2,7 +2,7 @@ * Routines for IEEE 802.2 LLC layer * Gilbert Ramirez <gramirez@tivoli.com> * - * $Id: packet-llc.c,v 1.27 1999/11/11 08:04:06 guy Exp $ + * $Id: packet-llc.c,v 1.28 1999/11/16 11:42:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -43,6 +43,9 @@ static int hf_llc_ctrl = -1; static int hf_llc_type = -1; static int hf_llc_oui = -1; +static gint ett_llc = -1; +static gint ett_llc_ctrl = -1; + typedef void (capture_func_t)(const u_char *, int, guint32, packet_counts *); typedef void (dissect_func_t)(const u_char *, int, frame_data *, proto_tree *); @@ -241,7 +244,7 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_llc, offset, 0, NULL); - llc_tree = proto_item_add_subtree(ti, ETT_LLC); + llc_tree = proto_item_add_subtree(ti, ett_llc); proto_tree_add_item(llc_tree, hf_llc_dsap, offset, 1, pd[offset]); proto_tree_add_item(llc_tree, hf_llc_ssap, offset+1, 1, pd[offset+1]); } else @@ -263,7 +266,8 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { * it's basic or extended operation; is that the case? */ control = dissect_xdlc_control(pd, offset+2, fd, llc_tree, - hf_llc_ctrl, pd[offset+1] & 0x01, TRUE); + hf_llc_ctrl, ett_llc_ctrl, + pd[offset+1] & 0x01, TRUE); llc_header_len += XDLC_CONTROL_LEN(control, TRUE); if (is_snap) llc_header_len += 5; /* 3 bytes of OUI, 2 bytes of ethertype */ @@ -344,7 +348,12 @@ proto_register_llc(void) { "Organization Code", "llc.oui", FT_UINT24, BASE_HEX, VALS(llc_oui_vals), 0x0, ""}} }; + static gint *ett[] = { + &ett_llc, + &ett_llc_ctrl, + }; proto_llc = proto_register_protocol ("Logical-Link Control", "llc" ); proto_register_field_array(proto_llc, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } |