aboutsummaryrefslogtreecommitdiffstats
path: root/packet-vlan.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>1999-11-16 11:44:20 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>1999-11-16 11:44:20 +0000
commite4c62806db219ae013652ae479827fb38a0a9635 (patch)
treebcc3d6ea4d23e60c7841a408e9b1876ed6a93106 /packet-vlan.c
parent8f0f1f9ae49aca3671a8c4c3aa81858684a4f05c (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-vlan.c')
-rw-r--r--packet-vlan.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/packet-vlan.c b/packet-vlan.c
index add2d59832..d6292fcae1 100644
--- a/packet-vlan.c
+++ b/packet-vlan.c
@@ -1,7 +1,7 @@
/* packet-vlan.c
* Routines for VLAN 802.1Q ethernet header disassembly
*
- * $Id: packet-vlan.c,v 1.3 1999/11/10 05:42:06 guy Exp $
+ * $Id: packet-vlan.c,v 1.4 1999/11/16 11:43:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -44,6 +44,8 @@ static int hf_vlan_priority = -1;
static int hf_vlan_id = -1;
static int hf_vlan_cfi = -1;
+static gint ett_vlan = -1;
+
void
dissect_vlan(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
proto_tree *ti, *vlan_tree = NULL;
@@ -66,7 +68,7 @@ dissect_vlan(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
if (tree) {
ti = proto_tree_add_item(tree, proto_vlan, offset, 4);
- vlan_tree = proto_item_add_subtree(ti, ETT_VLAN);
+ vlan_tree = proto_item_add_subtree(ti, ett_vlan);
proto_tree_add_item(vlan_tree, hf_vlan_priority, offset, 2, tci);
proto_tree_add_item(vlan_tree, hf_vlan_cfi, offset, 2, tci);
@@ -93,7 +95,11 @@ proto_register_vlan(void)
"ID", "vlan.id", FT_UINT16, BASE_BIN,
0, 0x0FFF, "ID" }},
};
+ static gint *ett[] = {
+ &ett_vlan,
+ };
proto_vlan = proto_register_protocol("802.1q Virtual LAN", "vlan");
proto_register_field_array(proto_vlan, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
}