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-nntp.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-nntp.c')
-rw-r--r-- | packet-nntp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packet-nntp.c b/packet-nntp.c index aa20363bc7..0c77c7751c 100644 --- a/packet-nntp.c +++ b/packet-nntp.c @@ -2,7 +2,7 @@ * Routines for nntp packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-nntp.c,v 1.5 1999/10/17 14:46:40 deniel Exp $ + * $Id: packet-nntp.c,v 1.6 1999/11/16 11:42:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -45,6 +45,8 @@ static int proto_nntp = -1; static int hf_nntp_response = -1; static int hf_nntp_request = -1; +static gint ett_nntp = -1; + void dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -81,7 +83,7 @@ dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_nntp, offset, END_OF_FRAME, NULL); - nntp_tree = proto_item_add_subtree(ti, ETT_NNTP); + nntp_tree = proto_item_add_subtree(ti, ett_nntp); if (pi.match_port == pi.destport) { proto_tree_add_item_hidden(nntp_tree, hf_nntp_request, 0, 0, TRUE); @@ -130,9 +132,12 @@ proto_register_nntp(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if NNTP request" }} }; + static gint *ett[] = { + &ett_nntp, + }; proto_nntp = proto_register_protocol("Network News Transfer Protocol", "nntp"); proto_register_field_array(proto_nntp, hf, array_length(hf)); - + proto_register_subtree_array(ett, array_length(ett)); } |