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-pppoe.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-pppoe.c')
-rw-r--r-- | packet-pppoe.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/packet-pppoe.c b/packet-pppoe.c index abde716c62..31e1e52ef1 100644 --- a/packet-pppoe.c +++ b/packet-pppoe.c @@ -1,7 +1,7 @@ /* packet-arp.c * Routines for ARP packet disassembly * - * $Id: packet-pppoe.c,v 1.3 1999/08/24 17:26:13 gram Exp $ + * $Id: packet-pppoe.c,v 1.4 1999/11/16 11:42:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -34,6 +34,9 @@ #include <glib.h> #include "packet.h" +static gint ett_pppoed = -1; +static gint ett_pppoed_tags = -1; + /* For lack of a better source, I made up the following defines. -jsj */ #define PPPOE_CODE_SESSION 0x00 @@ -101,7 +104,7 @@ dissect_pppoe_tags(const u_char *pd, int offset, frame_data *fd, proto_tree *tre if (tree) { ti = proto_tree_add_text(tree,offset,payload_length,"PPPoE Tags"); - pppoe_tree = proto_item_add_subtree(ti, ETT_PPPOED_TAGS); + pppoe_tree = proto_item_add_subtree(ti, ett_pppoed_tags); tagstart = offset; while(tagstart <= payload_length-2 ) { @@ -167,7 +170,7 @@ dissect_pppoed(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_text(tree,offset,pppoe_length+6,"PPPoE Discovery"); - pppoe_tree = proto_item_add_subtree(ti, ETT_PPPOED); + pppoe_tree = proto_item_add_subtree(ti, ett_pppoed); proto_tree_add_text(pppoe_tree,offset,1, "Version: %d", pppoe_ver); proto_tree_add_text(pppoe_tree,offset,1, @@ -211,7 +214,7 @@ dissect_pppoes(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_text(tree,offset,pppoe_length+6,"PPPoE Session"); - pppoe_tree = proto_item_add_subtree(ti, ETT_PPPOED); + pppoe_tree = proto_item_add_subtree(ti, ett_pppoed); proto_tree_add_text(pppoe_tree,offset,1, "Version: %d", pppoe_ver); proto_tree_add_text(pppoe_tree,offset,1, @@ -231,3 +234,15 @@ dissect_pppoes(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { dissect_payload_ppp(pd,offset+6,fd,tree); } + +void +proto_register_pppoed(void) +{ + static gint *ett[] = { + &ett_pppoed, + &ett_pppoed_tags, + }; + + proto_register_subtree_array(ett, array_length(ett)); +} + |