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-telnet.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-telnet.c')
-rw-r--r-- | packet-telnet.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/packet-telnet.c b/packet-telnet.c index 34e342ef5f..36b7917f93 100644 --- a/packet-telnet.c +++ b/packet-telnet.c @@ -2,7 +2,7 @@ * Routines for telnet packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-telnet.c,v 1.6 1999/08/24 17:26:15 gram Exp $ + * $Id: packet-telnet.c,v 1.7 1999/11/16 11:42:59 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -45,6 +45,9 @@ static int proto_telnet = -1; +static gint ett_telnet = -1; +static gint ett_telnet_subopt = -1; + /* Some defines for Telnet */ #define TN_IAC 255 @@ -140,7 +143,7 @@ void telnet_sub_option(proto_tree *telnet_tree, char *rr, int *i, int offset, in ti = proto_tree_add_text(telnet_tree, offset, subneg_len, "Suboption Begin: %s", opt); - option_tree = proto_item_add_subtree(ti, ETT_TELNET_SUBOPT); + option_tree = proto_item_add_subtree(ti, ett_telnet_subopt); proto_tree_add_text(option_tree, offset + 2, subneg_len - 2, "%s %s", (req ? "Send your" : "Here's my"), opt); @@ -332,7 +335,7 @@ dissect_telnet(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) memcpy(rr, pd + offset, max_data); ti = proto_tree_add_item(tree, proto_telnet, offset, END_OF_FRAME, NULL); - telnet_tree = proto_item_add_subtree(ti, ETT_TELNET); + telnet_tree = proto_item_add_subtree(ti, ett_telnet); i1 = i2 = i3 = 0; @@ -380,7 +383,12 @@ proto_register_telnet(void) { &variable, { "Name", "telnet.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_telnet, + &ett_telnet_subopt, + }; proto_telnet = proto_register_protocol("Telnet", "telnet"); /* proto_register_field_array(proto_telnet, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } |