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-ftp.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-ftp.c')
-rw-r--r-- | packet-ftp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packet-ftp.c b/packet-ftp.c index dcdbf758b7..068cfffaad 100644 --- a/packet-ftp.c +++ b/packet-ftp.c @@ -2,7 +2,7 @@ * Routines for ftp packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-ftp.c,v 1.9 1999/10/12 06:20:05 gram Exp $ + * $Id: packet-ftp.c,v 1.10 1999/11/16 11:42:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -52,6 +52,8 @@ static int hf_ftp_request_data = -1; static int hf_ftp_response_code = -1; static int hf_ftp_response_data = -1; +static gint ett_ftp = -1; + void dissect_ftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -104,7 +106,7 @@ dissect_ftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_ftp, offset, END_OF_FRAME, NULL); - ftp_tree = proto_item_add_subtree(ti, ETT_FTP); + ftp_tree = proto_item_add_subtree(ti, ett_ftp); if (pi.match_port == pi.destport) { /* Request */ @@ -185,8 +187,11 @@ proto_register_ftp(void) { "Response data", "ftp.reponse.data", FT_STRING, BASE_NONE, NULL, 0x0, "" }} }; + static gint *ett[] = { + &ett_ftp, + }; proto_ftp = proto_register_protocol("File Transfer Protocol", "ftp"); proto_register_field_array(proto_ftp, hf, array_length(hf)); - + proto_register_subtree_array(ett, array_length(ett)); } |