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-ipv6.c | |
parent | 3a2f7f641a49b5eb9f369dcb29bc8a7cb1c50a91 (diff) |
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-ipv6.c')
-rw-r--r-- | packet-ipv6.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packet-ipv6.c b/packet-ipv6.c index 4622ca7bc4..3c30156391 100644 --- a/packet-ipv6.c +++ b/packet-ipv6.c @@ -1,7 +1,7 @@ /* packet-ipv6.c * Routines for IPv6 packet disassembly * - * $Id: packet-ipv6.c,v 1.24 1999/10/22 07:17:32 guy Exp $ + * $Id: packet-ipv6.c,v 1.25 1999/11/16 11:42:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -66,6 +66,8 @@ static int hf_ipv6_dst = -1; static int hf_ipv6_final = -1; #endif +static gint ett_ipv6 = -1; + #ifndef offsetof #define offsetof(type, member) ((size_t)(&((type *)0)->member)) #endif @@ -85,7 +87,7 @@ dissect_routing6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* !!! specify length */ ti = proto_tree_add_text(tree, offset, len, "Routing Header, Type %d", rt.ip6r_type); - rthdr_tree = proto_item_add_subtree(ti, ETT_IPv6); + rthdr_tree = proto_item_add_subtree(ti, ett_ipv6); proto_tree_add_text(rthdr_tree, offset + offsetof(struct ip6_rthdr, ip6r_nxt), 1, @@ -167,7 +169,7 @@ dissect_opts(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, /* !!! specify length */ ti = proto_tree_add_text(tree, offset, len, "%s Header", optname); - dstopt_tree = proto_item_add_subtree(ti, ETT_IPv6); + dstopt_tree = proto_item_add_subtree(ti, ett_ipv6); proto_tree_add_text(dstopt_tree, offset + offsetof(struct ip6_ext, ip6e_nxt), 1, @@ -263,7 +265,7 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { /* !!! specify length */ ti = proto_tree_add_item(tree, proto_ipv6, offset, 40, NULL); - ipv6_tree = proto_item_add_subtree(ti, ETT_IPv6); + ipv6_tree = proto_item_add_subtree(ti, ett_ipv6); /* !!! warning: version also contains 4 Bit priority */ proto_tree_add_item(ipv6_tree, hf_ipv6_version, @@ -443,7 +445,11 @@ proto_register_ipv6(void) FT_UINT8, BASE_HEX, NULL, 0x0, "" }}, #endif }; + static gint *ett[] = { + &ett_ipv6, + }; proto_ipv6 = proto_register_protocol("Internet Protocol Version 6", "ipv6"); proto_register_field_array(proto_ipv6, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } |