aboutsummaryrefslogtreecommitdiffstats
path: root/packet.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-11-16 11:44:20 +0000
committerGuy Harris <guy@alum.mit.edu>1999-11-16 11:44:20 +0000
commita7aba0a28890856d2570951c2b0a76c922fdfa72 (patch)
treebcc3d6ea4d23e60c7841a408e9b1876ed6a93106 /packet.c
parent3a2f7f641a49b5eb9f369dcb29bc8a7cb1c50a91 (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.c')
-rw-r--r--packet.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/packet.c b/packet.c
index 8fda40492a..b6899d930a 100644
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.53 1999/11/11 05:36:05 gram Exp $
+ * $Id: packet.c,v 1.54 1999/11/16 11:43:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -67,14 +67,14 @@
extern capture_file cf;
-gboolean tree_is_expanded[NUM_TREE_TYPES];
+static int proto_frame = -1;
+static int hf_frame_arrival_time = -1;
+static int hf_frame_time_delta = -1;
+static int hf_frame_number = -1;
+static int hf_frame_packet_len = -1;
+static int hf_frame_capture_len = -1;
-int proto_frame = -1;
-int hf_frame_arrival_time = -1;
-int hf_frame_time_delta = -1;
-int hf_frame_number = -1;
-int hf_frame_packet_len = -1;
-int hf_frame_capture_len = -1;
+static gint ett_frame = -1;
gchar *
ether_to_str(const guint8 *ad) {
@@ -735,7 +735,7 @@ dissect_packet(const u_char *pd, frame_data *fd, proto_tree *tree)
ti = proto_tree_add_item_format(tree, proto_frame, 0, fd->cap_len,
NULL, "Frame (%d on wire, %d captured)", fd->pkt_len, fd->cap_len);
- fh_tree = proto_item_add_subtree(ti, ETT_FRAME);
+ fh_tree = proto_item_add_subtree(ti, ett_frame);
tv.tv_sec = fd->abs_secs;
tv.tv_usec = fd->abs_usecs;
@@ -834,7 +834,11 @@ proto_register_frame(void)
{ "Capture Frame Length", "frame.cap_len", FT_UINT32, BASE_DEC, NULL, 0x0,
"" }},
};
+ static gint *ett[] = {
+ &ett_frame,
+ };
proto_frame = proto_register_protocol("Frame", "frame");
proto_register_field_array(proto_frame, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
}