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-ipsec.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-ipsec.c')
-rw-r--r-- | packet-ipsec.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/packet-ipsec.c b/packet-ipsec.c index 9aeca16f89..7ee18aa5d3 100644 --- a/packet-ipsec.c +++ b/packet-ipsec.c @@ -1,7 +1,7 @@ /* packet-ipsec.c * Routines for IPsec/IPComp packet disassembly * - * $Id: packet-ipsec.c,v 1.9 1999/10/17 08:33:23 deniel Exp $ + * $Id: packet-ipsec.c,v 1.10 1999/11/16 11:42:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -51,6 +51,10 @@ static int proto_ipcomp = -1; static int hf_ipcomp_flags = -1; static int hf_ipcomp_cpi = -1; +static gint ett_ah = -1; +static gint ett_esp = -1; +static gint ett_ipcomp = -1; + struct newah { guint8 ah_nxt; /* Next Header */ guint8 ah_len; /* Length of data + 1, in 32bit */ @@ -115,7 +119,7 @@ dissect_ah(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { /* !!! specify length */ ti = proto_tree_add_item(tree, proto_ah, offset, advance, NULL); - ah_tree = proto_item_add_subtree(ti, ETT_AH); + ah_tree = proto_item_add_subtree(ti, ett_ah); proto_tree_add_text(ah_tree, offset + offsetof(struct newah, ah_nxt), 1, "Next Header: %s (0x%02x)", ipprotostr(ah.ah_nxt), ah.ah_nxt); @@ -161,7 +165,7 @@ dissect_esp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) */ if(tree) { ti = proto_tree_add_item(tree, proto_esp, offset, END_OF_FRAME, NULL); - esp_tree = proto_item_add_subtree(ti, ETT_ESP); + esp_tree = proto_item_add_subtree(ti, ett_esp); proto_tree_add_item(esp_tree, hf_esp_spi, offset + offsetof(struct newesp, esp_spi), 4, (guint32)ntohl(esp.esp_spi)); @@ -204,7 +208,7 @@ dissect_ipcomp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_ipcomp, offset, END_OF_FRAME, NULL); - ipcomp_tree = proto_item_add_subtree(ti, ETT_IPCOMP); + ipcomp_tree = proto_item_add_subtree(ti, ett_ipcomp); proto_tree_add_text(ipcomp_tree, offset + offsetof(struct ipcomp, comp_nxt), 1, @@ -259,6 +263,11 @@ proto_register_ipsec(void) { "CPI", "ipcomp.cpi", FT_UINT16, BASE_HEX, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_ah, + &ett_esp, + &ett_ipcomp, + }; proto_ah = proto_register_protocol("Authentication Header", "ah"); proto_register_field_array(proto_ah, hf_ah, array_length(hf_ah)); @@ -268,4 +277,6 @@ proto_register_ipsec(void) proto_ipcomp = proto_register_protocol("IP Payload Compression", "ipcomp"); proto_register_field_array(proto_ipcomp, hf_ipcomp, array_length(hf_ipcomp)); + + proto_register_subtree_array(ett, array_length(ett)); } |