aboutsummaryrefslogtreecommitdiffstats
path: root/packet-arp.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-arp.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-arp.c')
-rw-r--r--packet-arp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/packet-arp.c b/packet-arp.c
index 8a78c3c156..52e2cfa7b9 100644
--- a/packet-arp.c
+++ b/packet-arp.c
@@ -1,7 +1,7 @@
/* packet-arp.c
* Routines for ARP packet disassembly
*
- * $Id: packet-arp.c,v 1.21 1999/11/04 08:15:38 guy Exp $
+ * $Id: packet-arp.c,v 1.22 1999/11/16 11:42:24 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -46,6 +46,8 @@ static int hf_arp_src_proto = -1;
static int hf_arp_dst_ether = -1;
static int hf_arp_dst_proto = -1;
+static gint ett_arp = -1;
+
/* Definitions taken from Linux "linux/if_arp.h" header file, and from
http://www.isi.edu/in-notes/iana/assignments/arp-parameters
@@ -254,7 +256,7 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
MIN_ARP_HEADER_SIZE + 2*ar_hln +
2*ar_pln, NULL,
"Unknown ARP (opcode 0x%04x)", ar_op);
- arp_tree = proto_item_add_subtree(ti, ETT_ARP);
+ arp_tree = proto_item_add_subtree(ti, ett_arp);
proto_tree_add_item(arp_tree, hf_arp_hard_type, offset + AR_HRD, 2,
ar_hrd);
proto_tree_add_item(arp_tree, hf_arp_proto_type, offset + AR_PRO, 2,
@@ -329,7 +331,11 @@ proto_register_arp(void)
FT_BYTES, BASE_NONE, NULL, 0x0,
"" }}
};
+ static gint *ett[] = {
+ &ett_arp,
+ };
proto_arp = proto_register_protocol("Address Resolution Protocol", "arp");
proto_register_field_array(proto_arp, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
}