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-rip.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-rip.c')
-rw-r--r-- | packet-rip.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/packet-rip.c b/packet-rip.c index f81efc48fc..d1309610e8 100644 --- a/packet-rip.c +++ b/packet-rip.c @@ -2,7 +2,7 @@ * Routines for RIPv1 and RIPv2 packet disassembly * (c) Copyright Hannes R. Boehm <hannes@boehm.org> * - * $Id: packet-rip.c,v 1.12 1999/08/26 07:34:40 guy Exp $ + * $Id: packet-rip.c,v 1.13 1999/11/16 11:42:50 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -40,6 +40,9 @@ static int proto_rip = -1; +static gint ett_rip = -1; +static gint ett_rip_vec = -1; + static void dissect_ip_rip_vektor(guint8 version, const e_rip_vektor *rip_vektor, int offset, proto_tree *tree); static void dissect_rip_authentication(const e_rip_authentication *rip_authentication, @@ -93,7 +96,7 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_rip, offset, END_OF_FRAME, NULL); - rip_tree = proto_item_add_subtree(ti, ETT_RIP); + rip_tree = proto_item_add_subtree(ti, ett_rip); proto_tree_add_text(rip_tree, offset, 1, "Command: %d (%s)", rip_header.command, packet_type[rip_header.command]); proto_tree_add_text(rip_tree, offset + 1, 1, "Version: %d", rip_header.version); @@ -141,7 +144,7 @@ dissect_ip_rip_vektor(guint8 version, const e_rip_vektor *rip_vektor, { proto_tree *rip_vektor_tree; - rip_vektor_tree = proto_item_add_subtree(tree, ETT_RIP_VEC); + rip_vektor_tree = proto_item_add_subtree(tree, ett_rip_vec); proto_tree_add_text(rip_vektor_tree, offset, 2, "Address Family ID: IP"); if(version == RIPv2) @@ -166,7 +169,7 @@ dissect_rip_authentication(const e_rip_authentication *rip_authentication, proto_tree *rip_authentication_tree; guint16 authtype; - rip_authentication_tree = proto_item_add_subtree(tree, ETT_RIP_VEC); + rip_authentication_tree = proto_item_add_subtree(tree, ett_rip_vec); authtype = ntohs(rip_authentication->authtype); proto_tree_add_text(rip_authentication_tree, offset + 2, 2, @@ -184,7 +187,12 @@ proto_register_rip(void) { &variable, { "Name", "rip.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_rip, + &ett_rip_vec, + }; proto_rip = proto_register_protocol("Routing Information Protocol", "rip"); /* proto_register_field_array(proto_rip, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } |