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-nbipx.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-nbipx.c')
-rw-r--r-- | packet-nbipx.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/packet-nbipx.c b/packet-nbipx.c index ade2aed1e6..38be514e55 100644 --- a/packet-nbipx.c +++ b/packet-nbipx.c @@ -2,7 +2,7 @@ * Routines for NetBIOS over IPX packet disassembly * Gilbert Ramirez <gram@verdict.uthscsa.edu> * - * $Id: packet-nbipx.c,v 1.14 1999/09/03 03:22:19 guy Exp $ + * $Id: packet-nbipx.c,v 1.15 1999/11/16 11:42:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -39,6 +39,9 @@ static int proto_nbipx = -1; +static gint ett_nbipx = -1; +static gint ett_nbipx_name_type_flags = -1; + enum nbipx_protocol { NETBIOS_NETWARE, NETBIOS_NWLINK @@ -184,14 +187,14 @@ dissect_nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { ti = proto_tree_add_item(tree, proto_nbipx, offset, 50, NULL); - nbipx_tree = proto_item_add_subtree(ti, ETT_NBIPX); + nbipx_tree = proto_item_add_subtree(ti, ett_nbipx); add_routers(nbipx_tree, pd, offset); tf = proto_tree_add_text(nbipx_tree, offset+32, 1, "Name type flag: 0x%02x", name_type_flag); name_type_flag_tree = proto_item_add_subtree(tf, - ETT_NBIPX_NAME_TYPE_FLAGS); + ett_nbipx_name_type_flags); proto_tree_add_text(name_type_flag_tree, offset+32, 1, "%s", decode_boolean_bitfield(name_type_flag, 0x80, 8, @@ -236,7 +239,7 @@ dissect_nbipx_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { ti = proto_tree_add_item(tree, proto_nbipx, offset, 2+16+16, NULL); - nbipx_tree = proto_item_add_subtree(ti, ETT_NBIPX); + nbipx_tree = proto_item_add_subtree(ti, ett_nbipx); proto_tree_add_text(nbipx_tree, offset, 1, "Connection control: 0x%02x", pd[offset]); @@ -322,7 +325,7 @@ dissect_nwlink_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { ti = proto_tree_add_item(tree, proto_nbipx, offset, 68, NULL); - nbipx_tree = proto_item_add_subtree(ti, ETT_NBIPX); + nbipx_tree = proto_item_add_subtree(ti, ett_nbipx); add_routers(nbipx_tree, pd, offset); @@ -336,7 +339,7 @@ dissect_nwlink_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree "Name type flag: 0x%02x", name_type_flag); name_type_flag_tree = proto_item_add_subtree(tf, - ETT_NBIPX_NAME_TYPE_FLAGS); + ett_nbipx_name_type_flags); proto_tree_add_text(name_type_flag_tree, offset+32, 1, "%s", decode_boolean_bitfield(name_type_flag, 0x80, 8, @@ -401,7 +404,12 @@ proto_register_nbipx(void) { &variable, { "Name", "nbipx.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_nbipx, + &ett_nbipx_name_type_flags, + }; proto_nbipx = proto_register_protocol("NetBIOS over IPX", "nbipx"); /* proto_register_field_array(proto_nbipx, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } |