diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 1999-11-16 11:44:20 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 1999-11-16 11:44:20 +0000 |
commit | e4c62806db219ae013652ae479827fb38a0a9635 (patch) | |
tree | bcc3d6ea4d23e60c7841a408e9b1876ed6a93106 /packet-lpd.c | |
parent | 8f0f1f9ae49aca3671a8c4c3aa81858684a4f05c (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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1043 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-lpd.c')
-rw-r--r-- | packet-lpd.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packet-lpd.c b/packet-lpd.c index f1851c5cee..02a06b362d 100644 --- a/packet-lpd.c +++ b/packet-lpd.c @@ -2,7 +2,7 @@ * Routines for LPR and LPRng packet disassembly * Gilbert Ramirez <gram@verdict.uthscsa.edu> * - * $Id: packet-lpd.c,v 1.12 1999/11/05 15:55:09 gram Exp $ + * $Id: packet-lpd.c,v 1.13 1999/11/16 11:42:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -41,6 +41,8 @@ static int proto_lpd = -1; static int hf_lpd_response = -1; static int hf_lpd_request = -1; +static gint ett_lpd = -1; + enum lpr_type { request, response }; void @@ -98,7 +100,7 @@ dissect_lpd(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_lpd, offset, END_OF_FRAME, NULL); - lpd_tree = proto_item_add_subtree(ti, ETT_LPD); + lpd_tree = proto_item_add_subtree(ti, ett_lpd); if (lpr_packet_type == response) { proto_tree_add_item_hidden(lpd_tree, hf_lpd_response, @@ -171,8 +173,11 @@ proto_register_lpd(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if LPD request" }} }; + static gint *ett[] = { + &ett_lpd, + }; proto_lpd = proto_register_protocol("Line Printer Daemon Protocol", "lpd"); proto_register_field_array(proto_lpd, hf, array_length(hf)); - + proto_register_subtree_array(ett, array_length(ett)); } |