diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index 456bced699..5b3aaeb2a9 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -1,7 +1,7 @@ /* gtkpacket.c * Routines for GTK+ packet display * - * $Id: proto_draw.c,v 1.4 1999/11/15 22:52:03 gram Exp $ + * $Id: proto_draw.c,v 1.5 1999/11/16 11:44:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -121,7 +121,7 @@ packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen) { void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) { int i; - for(i=0; i < NUM_TREE_TYPES; i++) { + for(i=0; i < num_tree_types; i++) { tree_is_expanded[i] = TRUE; } gtk_tree_clear_items(GTK_TREE(tree_view), 0, -1); @@ -130,7 +130,7 @@ void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) { void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) { int i; - for(i=0; i < NUM_TREE_TYPES; i++) { + for(i=0; i < num_tree_types; i++) { tree_is_expanded[i] = FALSE; } gtk_tree_clear_items(GTK_TREE(tree_view), 0, -1); diff --git a/packet-aarp.c b/packet-aarp.c index 757a79cc51..d7b51c5bf8 100644 --- a/packet-aarp.c +++ b/packet-aarp.c @@ -1,7 +1,7 @@ /* packet-aarp.c * Routines for Appletalk ARP packet disassembly * - * $Id: packet-aarp.c,v 1.13 1999/11/04 08:21:04 guy Exp $ + * $Id: packet-aarp.c,v 1.14 1999/11/16 11:42:23 guy Exp $ * * Simon Wilkinson * @@ -44,6 +44,8 @@ static int hf_aarp_src_id = -1; static int hf_aarp_dst_ether = -1; static int hf_aarp_dst_id = -1; +static gint ett_aarp = -1; + #ifndef AARP_REQUEST #define AARP_REQUEST 0x0001 #endif @@ -185,7 +187,7 @@ dissect_aarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { MIN_AARP_HEADER_SIZE + 2*ar_hln + 2*ar_pln, NULL, "Unknown AARP (opcode 0x%04x)", ar_op); - aarp_tree = proto_item_add_subtree(ti, ETT_AARP); + aarp_tree = proto_item_add_subtree(ti, ett_aarp); proto_tree_add_item(aarp_tree, hf_aarp_hard_type, offset + AR_HRD, 2, ar_hrd); proto_tree_add_item(aarp_tree, hf_aarp_proto_type, offset + AR_PRO, 2, @@ -260,8 +262,12 @@ proto_register_aarp(void) FT_BYTES, BASE_HEX, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_aarp, + }; proto_aarp = proto_register_protocol("Appletalk Address Resolution Protocol", "aarp"); proto_register_field_array(proto_aarp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-afs.c b/packet-afs.c index 612187f62f..3b45e2e402 100644 --- a/packet-afs.c +++ b/packet-afs.c @@ -6,7 +6,7 @@ * Portions based on information retrieved from the RX definitions * in Arla, the free AFS client at http://www.stacken.kth.se/project/arla/ * - * $Id: packet-afs.c,v 1.5 1999/10/28 20:46:42 nneul Exp $ + * $Id: packet-afs.c,v 1.6 1999/11/16 11:42:23 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -604,6 +604,13 @@ static int hf_afs_ubik_locktype = -1; static int hf_afs_ubik_voteend = -1; static int hf_afs_ubik_votetype = -1; +static gint ett_afs = -1; +static gint ett_afs_op = -1; +static gint ett_afs_acl = -1; +static gint ett_afs_fid = -1; +static gint ett_afs_callback = -1; +static gint ett_afs_ubikver = -1; + /* * Dissector prototypes */ @@ -880,7 +887,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_afs, doffset, END_OF_FRAME); - afs_tree = proto_item_add_subtree(ti, ETT_AFS); + afs_tree = proto_item_add_subtree(ti, ett_afs); if ( !BYTES_ARE_IN_FRAME(offset, sizeof(struct rx_header) + sizeof(struct afs_header)) ) @@ -919,7 +926,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } /* Add the subtree for this particular service */ - afs_op_tree = proto_item_add_subtree(ti, ETT_AFS_OP); + afs_op_tree = proto_item_add_subtree(ti, ett_afs_op); if ( typenode != 0 ) { @@ -1001,7 +1008,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree *save, *ti; \ ti = proto_tree_add_text(tree, curoffset, 3*4, "Callback"); \ save = tree; \ - tree = proto_item_add_subtree(ti, ETT_AFS_CALLBACK); \ + tree = proto_item_add_subtree(ti, ett_afs_callback); \ TRUNC(3*sizeof(guint32)); \ UINTOUT(hf_afs_fs_callback_version); \ BIGDATEOUT(hf_afs_fs_callback_expires); \ @@ -1014,7 +1021,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree *save, *ti; \ ti = proto_tree_add_text(tree, curoffset, 3*4, "Callback"); \ save = tree; \ - tree = proto_item_add_subtree(ti, ETT_AFS_CALLBACK); \ + tree = proto_item_add_subtree(ti, ett_afs_callback); \ TRUNC(3*sizeof(guint32)); \ UINTOUT(hf_afs_cb_callback_version); \ DATEOUT(hf_afs_cb_callback_expires); \ @@ -1029,7 +1036,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_text(tree, curoffset, 3*4, \ "FileID (%s)", label); \ save = tree; \ - tree = proto_item_add_subtree(ti, ETT_AFS_FID); \ + tree = proto_item_add_subtree(ti, ett_afs_fid); \ UINTOUT(hf_afs_fs_fid_volume); \ UINTOUT(hf_afs_fs_fid_vnode); \ UINTOUT(hf_afs_fs_fid_uniqifier); \ @@ -1042,7 +1049,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_text(tree, curoffset, 3*4, \ "FileID (%s)", label); \ save = tree; \ - tree = proto_item_add_subtree(ti, ETT_AFS_FID); \ + tree = proto_item_add_subtree(ti, ett_afs_fid); \ UINTOUT(hf_afs_cb_fid_volume); \ UINTOUT(hf_afs_cb_fid_vnode); \ UINTOUT(hf_afs_cb_fid_uniqifier); \ @@ -1067,7 +1074,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "ACL: %s %s%s", \ who, tmp, positive ? "" : " (negative)"); \ save = tree; \ - tree = proto_item_add_subtree(ti, ETT_AFS_ACL); \ + tree = proto_item_add_subtree(ti, ett_afs_acl); \ proto_tree_add_item(tree,hf_afs_fs_acl_entity,curoffset,strlen(who), who);\ tmpoffset = curoffset + strlen(who) + 1; \ acllen = bytes - strlen(who) - 1; \ @@ -1144,7 +1151,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_text(tree, curoffset, 3*4, \ "UBIK Version (%s): %u.%u", label, epoch, counter ); \ save = tree; \ - tree = proto_item_add_subtree(ti, ETT_AFS_UBIKVER); \ + tree = proto_item_add_subtree(ti, ett_afs_ubikver); \ proto_tree_add_item(tree,hf_afs_ubik_version_epoch,curoffset-8, \ sizeof(guint32),&tv); \ proto_tree_add_item(tree,hf_afs_ubik_version_counter,curoffset-4, \ @@ -2588,7 +2595,16 @@ proto_register_afs(void) 0, 0, "Site" }}, }; + static gint *ett[] = { + &ett_afs, + &ett_afs_op, + &ett_afs_acl, + &ett_afs_fid, + &ett_afs_callback, + &ett_afs_ubikver, + }; proto_afs = proto_register_protocol("Andrew File System (AFS)", "afs"); proto_register_field_array(proto_afs, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } 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 @@ -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)); } diff --git a/packet-ascend.c b/packet-ascend.c index 19d5910532..b21cf49212 100644 --- a/packet-ascend.c +++ b/packet-ascend.c @@ -1,7 +1,7 @@ /* packet-ascend.c * Routines for decoding Lucent/Ascend packet traces * - * $Id: packet-ascend.c,v 1.7 1999/10/16 14:04:22 deniel Exp $ + * $Id: packet-ascend.c,v 1.8 1999/11/16 11:42:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -41,6 +41,8 @@ static int hf_chunk = -1; static int hf_task = -1; static int hf_user_name = -1; +static gint ett_raw = -1; + static const value_string encaps_vals[] = { {ASCEND_PFX_WDS_X, "PPP Transmit"}, {ASCEND_PFX_WDS_R, "PPP Receive" }, @@ -67,7 +69,7 @@ dissect_ascend( const u_char *pd, frame_data *fd, proto_tree *tree ) { layer (ie none) */ if(tree) { ti = proto_tree_add_text(tree, 0, 0, "Lucent/Ascend packet trace" ); - fh_tree = proto_item_add_subtree(ti, ETT_RAW); + fh_tree = proto_item_add_subtree(ti, ett_raw); proto_tree_add_item(fh_tree, hf_link_type, 0, 0, fd->pseudo_header.ascend.type); if (fd->pseudo_header.ascend.type == ASCEND_PFX_WDD) { @@ -127,8 +129,11 @@ proto_register_ascend(void) { "User name", "ascend.user", FT_STRING, BASE_NONE, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_raw, + }; proto_ascend = proto_register_protocol("Lucent/Ascend debug output", "ascend"); proto_register_field_array(proto_ascend, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } - diff --git a/packet-atalk.c b/packet-atalk.c index 0f2d6bbf69..71aa5ce16d 100644 --- a/packet-atalk.c +++ b/packet-atalk.c @@ -1,7 +1,7 @@ /* packet-atalk.c * Routines for Appletalk packet disassembly (DDP, currently). * - * $Id: packet-atalk.c,v 1.21 1999/11/04 07:06:50 guy Exp $ + * $Id: packet-atalk.c,v 1.22 1999/11/16 11:42:25 guy Exp $ * * Simon Wilkinson * @@ -49,6 +49,8 @@ static int hf_ddp_dst_socket = -1; static int hf_ddp_src_socket = -1; static int hf_ddp_type = -1; +static gint ett_ddp = -1; + /* P = Padding, H = Hops, L = Len */ #if BYTE_ORDER == BIG_ENDIAN /* PPHHHHLL LLLLLLLL */ @@ -141,7 +143,7 @@ dissect_ddp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_ddp, offset, DDP_HEADER_SIZE, NULL); - ddp_tree = proto_item_add_subtree(ti, ETT_DDP); + ddp_tree = proto_item_add_subtree(ti, ett_ddp); proto_tree_add_item(ddp_tree, hf_ddp_hopcount, offset, 1, ddp_hops(ddp.hops_len)); proto_tree_add_item(ddp_tree, hf_ddp_len, offset, 2, @@ -205,7 +207,11 @@ proto_register_atalk(void) { "Protocol type", "ddp.type", FT_UINT8, BASE_DEC, VALS(op_vals), 0x0, "" }}, }; + static gint *ett[] = { + &ett_ddp, + }; proto_ddp = proto_register_protocol("Datagram Delivery Protocol", "ddp"); proto_register_field_array(proto_ddp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-atm.c b/packet-atm.c index 71b0d191c5..fac63cb2cc 100644 --- a/packet-atm.c +++ b/packet-atm.c @@ -1,7 +1,7 @@ /* packet-atm.c * Routines for ATM packet disassembly * - * $Id: packet-atm.c,v 1.1 1999/08/20 06:55:05 guy Exp $ + * $Id: packet-atm.c,v 1.2 1999/11/16 11:42:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -39,6 +39,12 @@ static int proto_atm = -1; static int proto_atm_lane = -1; +static gint ett_atm = -1; +static gint ett_atm_lane = -1; +static gint ett_atm_lane_lc_lan_dest = -1; +static gint ett_atm_lane_lc_lan_dest_rd = -1; +static gint ett_atm_lane_lc_flags = -1; + /* * See * @@ -137,7 +143,7 @@ dissect_le_client(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { ti = proto_tree_add_item_format(tree, proto_atm_lane, offset, 2, NULL, "ATM LANE"); - lane_tree = proto_item_add_subtree(ti, ETT_ATM_LANE); + lane_tree = proto_item_add_subtree(ti, ett_atm_lane); proto_tree_add_text(lane_tree, offset, 2, "LE Client: 0x%04X", pntohs(&pd[offset])); @@ -156,7 +162,7 @@ dissect_lan_destination(const u_char *pd, int offset, const char *type, proto_tr td = proto_tree_add_text(tree, offset, 8, "%s LAN destination", type); - dest_tree = proto_item_add_subtree(td, ETT_ATM_LANE_LC_LAN_DEST); + dest_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest); tag = pntohs(&pd[offset]); proto_tree_add_text(dest_tree, offset, 2, "Tag: %s", val_to_str(tag, le_control_landest_tag_vals, @@ -175,7 +181,7 @@ dissect_lan_destination(const u_char *pd, int offset, const char *type, proto_tr route_descriptor = pntohs(&pd[offset]); trd = proto_tree_add_text(dest_tree, offset, 2, "Route descriptor: 0x%02X", route_descriptor); - rd_tree = proto_item_add_subtree(td, ETT_ATM_LANE_LC_LAN_DEST_RD); + rd_tree = proto_item_add_subtree(td, ett_atm_lane_lc_lan_dest_rd); proto_tree_add_text(rd_tree, offset, 2, decode_numeric_bitfield(route_descriptor, 0xFFF0, 2*8, "LAN ID = %u")); @@ -202,7 +208,7 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre if (tree) { ti = proto_tree_add_item_format(tree, proto_atm_lane, offset, 108, NULL, "ATM LANE"); - lane_tree = proto_item_add_subtree(ti, ETT_ATM_LANE); + lane_tree = proto_item_add_subtree(ti, ett_atm_lane); proto_tree_add_text(lane_tree, offset, 2, "Marker: 0x%04X", pntohs(&pd[offset])); @@ -246,7 +252,7 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre flags = pntohs(&pd[offset]); tf = proto_tree_add_text(lane_tree, offset, 2, "Flags: 0x%04X", pntohs(&pd[offset])); - flags_tree = proto_item_add_subtree(tf, ETT_ATM_LANE_LC_FLAGS); + flags_tree = proto_item_add_subtree(tf, ett_atm_lane_lc_flags); proto_tree_add_text(flags_tree, offset, 2, "%s", decode_boolean_bitfield(flags, 0x0001, 8*2, "Remote address", "Local address")); @@ -446,7 +452,7 @@ dissect_atm(const u_char *pd, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item_format(tree, proto_atm, 0, 0, NULL, "ATM"); - atm_tree = proto_item_add_subtree(ti, ETT_ATM); + atm_tree = proto_item_add_subtree(ti, ett_atm); proto_tree_add_text(atm_tree, 0, 0, "AAL: %s", val_to_str(aal_type, aal_vals, "Unknown AAL (%x)")); @@ -541,6 +547,14 @@ dissect_atm(const u_char *pd, frame_data *fd, proto_tree *tree) void proto_register_atm(void) { + static gint *ett[] = { + &ett_atm, + &ett_atm_lane, + &ett_atm_lane_lc_lan_dest, + &ett_atm_lane_lc_lan_dest_rd, + &ett_atm_lane_lc_flags, + }; proto_atm = proto_register_protocol("ATM", "atm"); proto_atm_lane = proto_register_protocol("ATM LANE", "lane"); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-bgp.c b/packet-bgp.c index 2a71e839c5..f651bdee83 100644 --- a/packet-bgp.c +++ b/packet-bgp.c @@ -2,7 +2,7 @@ * Routines for BGP packet dissection. * Copyright 1999, Jun-ichiro itojun Hagino * - * $Id: packet-bgp.c,v 1.9 1999/11/11 21:08:51 itojun Exp $ + * $Id: packet-bgp.c,v 1.10 1999/11/16 11:42:26 guy Exp $ * * Supports: * RFC1771 A Border Gateway Protocol 4 (BGP-4) @@ -179,6 +179,18 @@ static const value_string afnumber[] = { static int proto_bgp = -1; +static gint ett_bgp = -1; +static gint ett_bgp_unfeas = -1; +static gint ett_bgp_attrs = -1; +static gint ett_bgp_attr = -1; +static gint ett_bgp_attr_flags = -1; +static gint ett_bgp_mp_reach_nlri = -1; +static gint ett_bgp_mp_unreach_nlri = -1; +static gint ett_bgp_nlri = -1; +static gint ett_bgp_open = -1; +static gint ett_bgp_update = -1; +static gint ett_bgp_notification = -1; + /* * Decode an IPv4 prefix. */ @@ -296,7 +308,7 @@ dissect_bgp_update(const u_char *pd, int offset, frame_data *fd, if (len > 0) { ti = proto_tree_add_text(tree, p - pd, len, "Withdrawn routes:"); /* TODO: unfeasible */ - subtree = proto_item_add_subtree(ti, ETT_BGP_UNFEAS); + subtree = proto_item_add_subtree(ti, ett_bgp_unfeas); } p += 2 + len; @@ -309,7 +321,7 @@ dissect_bgp_update(const u_char *pd, int offset, frame_data *fd, /* --- move --- */ if (len > 0) { ti = proto_tree_add_text(tree, p - pd + 2, len, "Path attributes"); - subtree = proto_item_add_subtree(ti, ETT_BGP_ATTRS); + subtree = proto_item_add_subtree(ti, ett_bgp_attrs); i = 2; while (i < len) { int alen, aoff; @@ -429,13 +441,13 @@ dissect_bgp_update(const u_char *pd, int offset, frame_data *fd, val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"), alen + aoff, (alen + aoff == 1) ? "byte" : "bytes"); } - subtree2 = proto_item_add_subtree(ti, ETT_BGP_ATTR); + subtree2 = proto_item_add_subtree(ti, ett_bgp_attr); /* figure out flags */ ti = proto_tree_add_text(subtree2, p - pd + i + offsetof(struct bgp_attr, bgpa_flags), 1, "Flags: 0x%02x", bgpa.bgpa_flags); - subtree3 = proto_item_add_subtree(ti, ETT_BGP_ATTR_FLAGS); + subtree3 = proto_item_add_subtree(ti, ett_bgp_attr_flags); proto_tree_add_text(subtree3, p - pd + i + offsetof(struct bgp_attr, bgpa_flags), 1, "%s", decode_boolean_bitfield(bgpa.bgpa_flags, @@ -566,7 +578,7 @@ dissect_bgp_update(const u_char *pd, int offset, frame_data *fd, int j, advance; const char *s; - subtree3 = proto_item_add_subtree(ti, ETT_BGP_MP_REACH_NLRI); + subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri); j = 0; while (j < p[i + aoff + 3]) { @@ -600,7 +612,7 @@ dissect_bgp_update(const u_char *pd, int offset, frame_data *fd, "Subnetwork points of attachment: %u", snpa); off++; if (snpa) - subtree3 = proto_item_add_subtree(ti, ETT_BGP_MP_REACH_NLRI); + subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri); for (/*nothing*/; snpa > 0; snpa--) { proto_tree_add_text(subtree3, p - pd + i + aoff + off, 1, "SNPA length: ", p[i + aoff + off]); @@ -618,7 +630,7 @@ dissect_bgp_update(const u_char *pd, int offset, frame_data *fd, "Network Layer Reachability Information (%u %s)", alen, (alen == 1) ? "byte" : "bytes"); if (alen) - subtree3 = proto_item_add_subtree(ti, ETT_BGP_MP_UNREACH_NLRI); + subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_unreach_nlri); while (alen > 0) { int advance; char buf[256]; @@ -660,7 +672,7 @@ dissect_bgp_update(const u_char *pd, int offset, frame_data *fd, alen -= 3; aoff += 3; if (alen > 0) - subtree3 = proto_item_add_subtree(ti, ETT_BGP_MP_UNREACH_NLRI); + subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_unreach_nlri); while (alen > 0) { int advance; char buf[256]; @@ -704,7 +716,7 @@ dissect_bgp_update(const u_char *pd, int offset, frame_data *fd, (len == 1) ? "byte" : "bytes"); if (len > 0) { - subtree = proto_item_add_subtree(ti, ETT_BGP_NLRI); + subtree = proto_item_add_subtree(ti, ett_bgp_nlri); /* parse prefixes */ end = p + len; @@ -826,7 +838,7 @@ dissect_bgp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "Border Gateway Protocol"); - bgp_tree = proto_item_add_subtree(ti, ETT_BGP); + bgp_tree = proto_item_add_subtree(ti, ett_bgp); p = &pd[offset]; l = END_OF_FRAME; @@ -858,19 +870,19 @@ dissect_bgp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* add a different tree for each message type */ switch (bgp.bgp_type) { case BGP_OPEN: - bgp1_tree = proto_item_add_subtree(ti, ETT_BGP_OPEN); + bgp1_tree = proto_item_add_subtree(ti, ett_bgp_open); break; case BGP_UPDATE: - bgp1_tree = proto_item_add_subtree(ti, ETT_BGP_UPDATE); + bgp1_tree = proto_item_add_subtree(ti, ett_bgp_update); break; case BGP_NOTIFICATION: - bgp1_tree = proto_item_add_subtree(ti, ETT_BGP_NOTIFICATION); + bgp1_tree = proto_item_add_subtree(ti, ett_bgp_notification); break; case BGP_KEEPALIVE: - bgp1_tree = proto_item_add_subtree(ti, ETT_BGP); + bgp1_tree = proto_item_add_subtree(ti, ett_bgp); break; default: - bgp1_tree = proto_item_add_subtree(ti, ETT_BGP); + bgp1_tree = proto_item_add_subtree(ti, ett_bgp); break; } @@ -924,5 +936,20 @@ dissect_bgp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) void proto_register_bgp(void) { + static gint *ett[] = { + &ett_bgp, + &ett_bgp_unfeas, + &ett_bgp_attrs, + &ett_bgp_attr, + &ett_bgp_attr_flags, + &ett_bgp_mp_reach_nlri, + &ett_bgp_mp_unreach_nlri, + &ett_bgp_nlri, + &ett_bgp_open, + &ett_bgp_update, + &ett_bgp_notification, + }; + proto_bgp = proto_register_protocol("Border Gateway Protocol", "bgp"); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-bootp.c b/packet-bootp.c index 48a11425d9..6455b7f548 100644 --- a/packet-bootp.c +++ b/packet-bootp.c @@ -2,7 +2,7 @@ * Routines for BOOTP/DHCP packet disassembly * Gilbert Ramirez * - * $Id: packet-bootp.c,v 1.21 1999/10/12 06:20:02 gram Exp $ + * $Id: packet-bootp.c,v 1.22 1999/11/16 11:42:27 guy Exp $ * * The information used comes from: * RFC 2132: DHCP Options and BOOTP Vendor Extensions @@ -57,6 +57,9 @@ static int hf_bootp_server = -1; static int hf_bootp_file = -1; static int hf_bootp_cookie = -1; +static guint ett_bootp = -1; +static guint ett_bootp_option = -1; + enum field_type { none, ipv4, string, toggle, yes_no, special, opaque, time_in_secs, val_u_byte, val_u_short, val_u_long, @@ -209,7 +212,7 @@ bootp_option(const u_char *pd, proto_tree *bp_tree, int voff, int eoff) vti = proto_tree_add_text(bp_tree, voff, consumed, "Option %d: %s", code, text); - v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION); + v_tree = proto_item_add_subtree(vti, ett_bootp_option); for (i = voff + 2; i < voff + consumed; i += 8) { proto_tree_add_text(v_tree, i, 8, "IP Address/Mask: %s/%s", ip_to_str((guint8*)&pd[i]), @@ -232,7 +235,7 @@ bootp_option(const u_char *pd, proto_tree *bp_tree, int voff, int eoff) vti = proto_tree_add_text(bp_tree, voff, consumed, "Option %d: %s", code, text); - v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION); + v_tree = proto_item_add_subtree(vti, ett_bootp_option); for (i = voff + 2; i < voff + consumed; i += 8) { proto_tree_add_text(v_tree, i, 8, "Destination IP Address/Router: %s/%s", @@ -274,7 +277,7 @@ bootp_option(const u_char *pd, proto_tree *bp_tree, int voff, int eoff) case 55: vti = proto_tree_add_text(bp_tree, voff, vlen + 2, "Option %d: %s", code, text); - v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION); + v_tree = proto_item_add_subtree(vti, ett_bootp_option); for (i = 0; i < vlen; i++) { byte = pd[voff+2+i]; if (byte < NUM_OPT_INFOS) { @@ -296,7 +299,7 @@ bootp_option(const u_char *pd, proto_tree *bp_tree, int voff, int eoff) if (vlen == 7) { vti = proto_tree_add_text(bp_tree, voff, consumed, "Option %d: %s", code, text); - v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION); + v_tree = proto_item_add_subtree(vti, ett_bootp_option); proto_tree_add_text(v_tree, voff+2, 1, "Hardware type: %s", arphrdtype_to_str(pd[voff+2], @@ -345,7 +348,7 @@ bootp_option(const u_char *pd, proto_tree *bp_tree, int voff, int eoff) vti = proto_tree_add_text(bp_tree, voff, consumed, "Option %d: %s", code, text); - v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION); + v_tree = proto_item_add_subtree(vti, ett_bootp_option); for (i = voff + 2; i < voff + consumed; i += 4) { proto_tree_add_text(v_tree, i, 4, "IP Address: %s", ip_to_str((guint8*)&pd[i])); @@ -378,7 +381,7 @@ bootp_option(const u_char *pd, proto_tree *bp_tree, int voff, int eoff) else { vti = proto_tree_add_text(bp_tree, voff, consumed, "Option %d: %s", code, text); - v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION); + v_tree = proto_item_add_subtree(vti, ett_bootp_option); for (i = voff + 2; i < voff + consumed; i += 2) { proto_tree_add_text(v_tree, i, 4, "Value: %d", pntohs(&pd[i])); @@ -471,7 +474,7 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_bootp, offset, END_OF_FRAME, NULL); - bp_tree = proto_item_add_subtree(ti, ETT_BOOTP); + bp_tree = proto_item_add_subtree(ti, ett_bootp); proto_tree_add_item_format(bp_tree, hf_bootp_type, offset, 1, @@ -630,7 +633,12 @@ proto_register_bootp(void) { "Magic cookie", "bootp.cookie", FT_IPv4, BASE_NONE, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_bootp, + &ett_bootp_option, + }; proto_bootp = proto_register_protocol("Bootstrap Protocol", "bootp"); proto_register_field_array(proto_bootp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-bootparams.c b/packet-bootparams.c index a07b2ca60c..c7491fff10 100644 --- a/packet-bootparams.c +++ b/packet-bootparams.c @@ -1,7 +1,7 @@ /* packet-bootparams.c * Routines for bootparams dissection * - * $Id: packet-bootparams.c,v 1.5 1999/11/15 17:16:50 nneul Exp $ + * $Id: packet-bootparams.c,v 1.6 1999/11/16 11:42:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -50,6 +50,8 @@ static int hf_bootparams_filepath = -1; static int hf_bootparams_hostaddr = -1; static int hf_bootparams_routeraddr = -1; +static gint ett_bootparams = -1; + int dissect_bp_address(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hfindex) { @@ -172,12 +174,16 @@ proto_register_bootparams(void) "Router Address", "bootparams.routeraddr", FT_IPv4, BASE_DEC, NULL, 0, "Router Address" }}, }; + static gint *ett[] = { + &ett_bootparams, + }; proto_bootparams = proto_register_protocol("Boot Parameters", "bootparams"); proto_register_field_array(proto_bootparams, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_bootparams, BOOTPARAMS_PROGRAM, ETT_BOOTPARAMS); + rpc_init_prog(proto_bootparams, BOOTPARAMS_PROGRAM, ett_bootparams); /* Register the procedure tables */ rpc_init_proc_table(BOOTPARAMS_PROGRAM, 1, bootparams1_proc); } diff --git a/packet-bpdu.c b/packet-bpdu.c index ad904ca101..8b92eb3d9f 100644 --- a/packet-bpdu.c +++ b/packet-bpdu.c @@ -1,7 +1,7 @@ /* packet-bpdu.c * Routines for BPDU (Spanning Tree Protocol) disassembly * - * $Id: packet-bpdu.c,v 1.5 1999/10/16 09:31:47 deniel Exp $ + * $Id: packet-bpdu.c,v 1.6 1999/11/16 11:42:27 guy Exp $ * * Copyright 1999 Christophe Tronche * @@ -73,6 +73,8 @@ static int hf_bpdu_max_age = -1; static int hf_bpdu_hello_time = -1; static int hf_bpdu_forward_delay = -1; +static gint ett_bpdu = -1; + void dissect_bpdu(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { guint16 protocol_identifier; guint8 protocol_version_identifier; @@ -120,7 +122,7 @@ void dissect_bpdu(const u_char *pd, int offset, frame_data *fd, proto_tree *tree protocol_version_identifier = (guint8) bpdu[BPDU_VERSION_IDENTIFIER]; ti = proto_tree_add_item_format(tree, proto_bpdu, offset, 35, NULL, "Spanning Tree Protocol"); - bpdu_tree = proto_item_add_subtree(ti, ETT_BPDU); + bpdu_tree = proto_item_add_subtree(ti, ett_bpdu); proto_tree_add_item_format(bpdu_tree, hf_bpdu_proto_id, offset + BPDU_IDENTIFIER, 2, protocol_identifier, @@ -252,8 +254,11 @@ proto_register_bpdu(void) FT_DOUBLE, BASE_NONE, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_bpdu, + }; proto_bpdu = proto_register_protocol("Spanning Tree Protocol", "stp"); proto_register_field_array(proto_bpdu, hf, array_length(hf)); - + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-cdp.c b/packet-cdp.c index 5ea46954ec..95a826953c 100644 --- a/packet-cdp.c +++ b/packet-cdp.c @@ -2,7 +2,7 @@ * Routines for the disassembly of the "Cisco Discovery Protocol" * (c) Copyright Hannes R. Boehm * - * $Id: packet-cdp.c,v 1.16 1999/10/16 14:27:00 deniel Exp $ + * $Id: packet-cdp.c,v 1.17 1999/11/16 11:42:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -47,6 +47,9 @@ static int hf_cdp_ttl = -1; static int hf_cdp_tlvtype = -1; static int hf_cdp_tlvlength = -1; +static gint ett_cdp = -1; +static gint ett_cdp_tlv = -1; + static void add_multi_line_string_to_tree(proto_tree *tree, gint start, gint len, const gchar *prefix, const gchar *string); @@ -88,7 +91,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if(tree){ ti = proto_tree_add_item(tree, proto_cdp, offset, END_OF_FRAME, NULL); - cdp_tree = proto_item_add_subtree(ti, ETT_CDP); + cdp_tree = proto_item_add_subtree(ti, ett_cdp); /* CDP header */ proto_tree_add_item(cdp_tree, hf_cdp_version, offset, 1, pd[offset]); @@ -117,7 +120,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { length + 4, "Type: %s, length: %u", type_str, length); tlv_tree = proto_item_add_subtree(tlvi, - ETT_CDP_TLV); + ett_cdp_tlv); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, offset + TLV_TYPE, 2, type); proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, @@ -134,7 +137,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { length, "Chassis ID: %s", &pd[offset+4]); tlv_tree = proto_item_add_subtree(tlvi, - ETT_CDP_TLV); + ett_cdp_tlv); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, offset + TLV_TYPE, 2, type); proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, @@ -153,7 +156,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { 4, "Type: %u (unknown), second field: %u", type, length); tlv_tree = proto_item_add_subtree(tlvi, - ETT_CDP_TLV); + ett_cdp_tlv); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, offset + TLV_TYPE, 2, type); proto_tree_add_text(tlv_tree, @@ -167,7 +170,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { length, "Sent through Interface: %s", &pd[offset+4]); tlv_tree = proto_item_add_subtree(tlvi, - ETT_CDP_TLV); + ett_cdp_tlv); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, offset + TLV_TYPE, 2, type); proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, @@ -193,7 +196,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { offset, length, "Platform: %s", stringmem); tlv_tree = proto_item_add_subtree(tlvi, - ETT_CDP_TLV); + ett_cdp_tlv); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, offset + TLV_TYPE, 2, type); proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, @@ -211,7 +214,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { offset, length + 4, "Mgmt IP: %s", ip_to_str(&pd[offset+4])); tlv_tree = proto_item_add_subtree(tlvi, - ETT_CDP_TLV); + ett_cdp_tlv); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, offset + TLV_TYPE, 2, type); proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, @@ -226,7 +229,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { length, "Type: %s, length: %u", type_str, length); tlv_tree = proto_item_add_subtree(tlvi, - ETT_CDP_TLV); + ett_cdp_tlv); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, offset + TLV_TYPE, 2, type); proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, @@ -304,7 +307,12 @@ proto_register_cdp(void) { "Length", "cdp.tlv.len", FT_UINT16, BASE_DEC, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_cdp, + &ett_cdp_tlv, + }; proto_cdp = proto_register_protocol("Cisco Discovery Protocol", "cdp"); proto_register_field_array(proto_cdp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-clip.c b/packet-clip.c index b2f64cd216..cfc4c0fd50 100644 --- a/packet-clip.c +++ b/packet-clip.c @@ -1,7 +1,7 @@ /* packet-clip.c * Routines for clip packet disassembly * - * $Id: packet-clip.c,v 1.2 1999/08/24 06:16:27 guy Exp $ + * $Id: packet-clip.c,v 1.3 1999/11/16 11:42:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -36,6 +36,8 @@ #include #include "packet.h" +static gint ett_clip = -1; + void capture_clip( const u_char *pd, guint32 cap_len, packet_counts *ld ) { @@ -70,8 +72,18 @@ dissect_clip( const u_char *pd, frame_data *fd, proto_tree *tree ) { header. */ if(tree) { ti = proto_tree_add_text(tree, 0, 0, "Classical IP frame" ); - fh_tree = proto_item_add_subtree(ti, ETT_CLIP); + fh_tree = proto_item_add_subtree(ti, ett_clip); proto_tree_add_text(fh_tree, 0, 0, "No link information available"); } dissect_ip(pd, 0, fd, tree); } + +void +proto_register_clip(void) +{ + static gint *ett[] = { + &ett_clip, + }; + + proto_register_subtree_array(ett, array_length(ett)); +} diff --git a/packet-dns.c b/packet-dns.c index 4db72fef35..a50e54b646 100644 --- a/packet-dns.c +++ b/packet-dns.c @@ -1,7 +1,7 @@ /* packet-dns.c * Routines for DNS packet disassembly * - * $Id: packet-dns.c,v 1.28 1999/11/12 22:43:32 guy Exp $ + * $Id: packet-dns.c,v 1.29 1999/11/16 11:42:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -50,6 +50,13 @@ static int hf_dns_count_answers = -1; static int hf_dns_count_auth_rr = -1; static int hf_dns_count_add_rr = -1; +static gint ett_dns = -1; +static gint ett_dns_qd = -1; +static gint ett_dns_rr = -1; +static gint ett_dns_qry = -1; +static gint ett_dns_ans = -1; +static gint ett_dns_flags = -1; + /* DNS structs and definitions */ /* Offsets of fields in the DNS header. */ @@ -500,7 +507,7 @@ dissect_dns_query(const u_char *pd, int offset, int dns_data_offset, if (dns_tree != NULL) { tq = proto_tree_add_text(dns_tree, offset, len, "%s: type %s, class %s", name, type_name, class_name); - q_tree = proto_item_add_subtree(tq, ETT_DNS_QD); + q_tree = proto_item_add_subtree(tq, ett_dns_qd); proto_tree_add_text(q_tree, offset, name_len, "Name: %s", name); offset += name_len; @@ -600,7 +607,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, "%s: type %s, class %s, addr %s", name, type_name, class_name, ip_to_str((guint8 *)dptr)); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); if (!BYTES_ARE_IN_FRAME(cur_offset, 4)) { /* We ran past the end of the captured data in the packet. */ @@ -623,7 +630,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, ns %s", name, type_name, class_name, ns_name); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); if (ns_name_len < 0) { /* We ran past the end of the captured data in the packet. */ @@ -647,7 +654,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, cname %s", name, type_name, class_name, cname); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); if (cname_len < 0) { /* We ran past the end of the captured data in the packet. */ @@ -684,7 +691,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, mname %s", name, type_name, class_name, mname); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); if (mname_len < 0) { /* We ran past the end of the captured data in the packet. */ @@ -761,7 +768,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, ptr %s", name, type_name, class_name, pname); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); if (pname_len < 0) { /* We ran past the end of the captured data in the packet. */ @@ -789,7 +796,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, ", name, type_name, class_name); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); } return 0; @@ -801,7 +808,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, ", name, type_name, class_name); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); } return 0; @@ -813,7 +820,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, CPU %.*s, ", name, type_name, class_name, cpu_len, &pd[cpu_offset + 1]); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); } return 0; @@ -825,7 +832,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, CPU %*.s, ", name, type_name, class_name, cpu_len, &pd[cpu_offset + 1]); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); } return 0; @@ -838,7 +845,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, "%s: type %s, class %s, CPU %.*s, OS %.*s", name, type_name, class_name, cpu_len, &pd[cpu_offset + 1], os_len, &pd[os_offset + 1]); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); proto_tree_add_text(rr_tree, cpu_offset, 1 + cpu_len, "CPU: %.*s", cpu_len, &pd[cpu_offset + 1]); @@ -861,7 +868,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, ", name, type_name, class_name); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); } return 0; @@ -874,7 +881,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, preference %u, ", name, type_name, class_name, preference); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); } return 0; @@ -885,7 +892,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s, preference %u, mx %s", name, type_name, class_name, preference, mx_name); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); proto_tree_add_text(rr_tree, cur_offset, 2, "Preference: %u", preference); proto_tree_add_text(rr_tree, cur_offset + 2, mx_name_len, "Mail exchange: %s", @@ -902,7 +909,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s", name, type_name, class_name); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); if (!BYTES_ARE_IN_FRAME(cur_offset, 1)) { /* We ran past the end of the captured data in the packet. */ @@ -975,7 +982,7 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, trr = proto_tree_add_text(dns_tree, offset, (dptr - data_start) + data_len, "%s: type %s, class %s", name, type_name, class_name); - rr_tree = add_rr_to_tree(trr, ETT_DNS_RR, offset, name, name_len, + rr_tree = add_rr_to_tree(trr, ett_dns_rr, offset, name, name_len, long_type_name, class_name, ttl, data_len); proto_tree_add_text(rr_tree, cur_offset, data_len, "Data"); } @@ -997,7 +1004,7 @@ dissect_query_records(const u_char *pd, int cur_off, int dns_data_offset, start_off = cur_off; if (dns_tree) { ti = proto_tree_add_text(dns_tree, start_off, 0, "Queries"); - qatree = proto_item_add_subtree(ti, ETT_DNS_QRY); + qatree = proto_item_add_subtree(ti, ett_dns_qry); } while (count-- > 0) { add_off = dissect_dns_query(pd, cur_off, dns_data_offset, fd, qatree); @@ -1024,7 +1031,7 @@ dissect_answer_records(const u_char *pd, int cur_off, int dns_data_offset, start_off = cur_off; if (dns_tree) { ti = proto_tree_add_text(dns_tree, start_off, 0, name); - qatree = proto_item_add_subtree(ti, ETT_DNS_ANS); + qatree = proto_item_add_subtree(ti, ett_dns_ans); } while (count-- > 0) { add_off = dissect_dns_answer(pd, cur_off, dns_data_offset, fd, qatree); @@ -1099,7 +1106,7 @@ dissect_dns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_item_format(tree, proto_dns, offset, 4, NULL, (flags & F_RESPONSE) ? "DNS response" : "DNS query"); - dns_tree = proto_item_add_subtree(ti, ETT_DNS); + dns_tree = proto_item_add_subtree(ti, ett_dns); if (flags & F_RESPONSE) proto_tree_add_item_hidden(dns_tree, hf_dns_response, offset, 4, 1); @@ -1121,7 +1128,7 @@ dissect_dns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) flags, "Flags: 0x%04x (%s)", flags, buf); - field_tree = proto_item_add_subtree(tf, ETT_DNS_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_dns_flags); proto_tree_add_text(field_tree, offset + DNS_FLAGS, 2, "%s", decode_boolean_bitfield(flags, F_RESPONSE, 2*8, "Response", "Query")); @@ -1233,8 +1240,16 @@ proto_register_dns(void) FT_UINT16, BASE_DEC, NULL, 0x0, "Number of additional records in packet" }} }; + static gint *ett[] = { + &ett_dns, + &ett_dns_qd, + &ett_dns_rr, + &ett_dns_qry, + &ett_dns_ans, + &ett_dns_flags, + }; proto_dns = proto_register_protocol("Domain Name Service", "dns"); proto_register_field_array(proto_dns, hf, array_length(hf)); - + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-eth.c b/packet-eth.c index 7ce9437ed6..1e8f0d67db 100644 --- a/packet-eth.c +++ b/packet-eth.c @@ -1,7 +1,7 @@ /* packet-eth.c * Routines for ethernet packet disassembly * - * $Id: packet-eth.c,v 1.21 1999/10/22 07:17:31 guy Exp $ + * $Id: packet-eth.c,v 1.22 1999/11/16 11:42:29 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -45,6 +45,9 @@ static int hf_eth_src = -1; static int hf_eth_len = -1; static int hf_eth_type = -1; +static gint ett_ieee8023 = -1; +static gint ett_ether2 = -1; + #define ETH_HEADER_SIZE 14 /* These are the Netware-ish names for the different Ethernet frame types. @@ -154,7 +157,7 @@ dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ti = proto_tree_add_item_format(tree, proto_eth, 0, ETH_HEADER_SIZE, NULL, "IEEE 802.3 %s", (ethhdr_type == ETHERNET_802_3 ? "Raw " : "")); - fh_tree = proto_item_add_subtree(ti, ETT_IEEE8023); + fh_tree = proto_item_add_subtree(ti, ett_ieee8023); proto_tree_add_item(fh_tree, hf_eth_dst, 0, 6, &pd[offset+0]); proto_tree_add_item(fh_tree, hf_eth_src, 6, 6, &pd[offset+6]); @@ -180,7 +183,7 @@ dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ti = proto_tree_add_item_format(tree, proto_eth, 0, ETH_HEADER_SIZE, NULL, "Ethernet II"); - fh_tree = proto_item_add_subtree(ti, ETT_ETHER2); + fh_tree = proto_item_add_subtree(ti, ett_ether2); proto_tree_add_item_format(fh_tree, hf_eth_dst, 0, 6, &pd[offset+0], "Destination: %s (%s)", ether_to_str((guint8 *) &pd[offset+0]), @@ -228,7 +231,12 @@ proto_register_eth(void) { "Type", "eth.type", FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0, "" }} }; + static gint *ett[] = { + &ett_ieee8023, + &ett_ether2, + }; proto_eth = proto_register_protocol ("Ethernet", "eth" ); proto_register_field_array(proto_eth, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-fddi.c b/packet-fddi.c index 6f9538bb14..cdfae657b5 100644 --- a/packet-fddi.c +++ b/packet-fddi.c @@ -3,7 +3,7 @@ * * Laurent Deniel * - * $Id: packet-fddi.c,v 1.24 1999/10/22 07:17:31 guy Exp $ + * $Id: packet-fddi.c,v 1.25 1999/11/16 11:42:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -43,6 +43,8 @@ static int hf_fddi_fc = -1; static int hf_fddi_dst = -1; static int hf_fddi_src = -1; +static gint ett_fddi = -1; + /* FDDI Frame Control values */ #define FDDI_FC_VOID 0x00 /* Void frame */ @@ -296,7 +298,7 @@ void dissect_fddi(const u_char *pd, frame_data *fd, proto_tree *tree, swap_mac_addr(dst_swapped, (u_char*)&pd[FDDI_P_DHOST]); swap_mac_addr(src_swapped, (u_char*)&pd[FDDI_P_SHOST]); - fh_tree = proto_item_add_subtree(ti, ETT_FDDI); + fh_tree = proto_item_add_subtree(ti, ett_fddi); proto_tree_add_item(fh_tree, hf_fddi_fc, FDDI_P_FC, 1, fc); proto_tree_add_item(fh_tree, hf_fddi_dst, FDDI_P_DHOST, 6, dst); proto_tree_add_item(fh_tree, hf_fddi_src, FDDI_P_SHOST, 6, src); @@ -358,7 +360,11 @@ proto_register_fddi(void) { "Source", "fddi.src", FT_ETHER, BASE_NONE, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_fddi, + }; proto_fddi = proto_register_protocol ("Fiber Distributed Data Interface", "fddi" ); proto_register_field_array(proto_fddi, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ftp.c b/packet-ftp.c index dcdbf758b7..068cfffaad 100644 --- a/packet-ftp.c +++ b/packet-ftp.c @@ -2,7 +2,7 @@ * Routines for ftp packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-ftp.c,v 1.9 1999/10/12 06:20:05 gram Exp $ + * $Id: packet-ftp.c,v 1.10 1999/11/16 11:42:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -52,6 +52,8 @@ static int hf_ftp_request_data = -1; static int hf_ftp_response_code = -1; static int hf_ftp_response_data = -1; +static gint ett_ftp = -1; + void dissect_ftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -104,7 +106,7 @@ dissect_ftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_ftp, offset, END_OF_FRAME, NULL); - ftp_tree = proto_item_add_subtree(ti, ETT_FTP); + ftp_tree = proto_item_add_subtree(ti, ett_ftp); if (pi.match_port == pi.destport) { /* Request */ @@ -185,8 +187,11 @@ proto_register_ftp(void) { "Response data", "ftp.reponse.data", FT_STRING, BASE_NONE, NULL, 0x0, "" }} }; + static gint *ett[] = { + &ett_ftp, + }; proto_ftp = proto_register_protocol("File Transfer Protocol", "ftp"); proto_register_field_array(proto_ftp, hf, array_length(hf)); - + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-giop.c b/packet-giop.c index f24634839c..bcb54f23f1 100644 --- a/packet-giop.c +++ b/packet-giop.c @@ -3,7 +3,7 @@ * * Laurent Deniel * - * $Id: packet-giop.c,v 1.9 1999/10/16 19:50:19 deniel Exp $ + * $Id: packet-giop.c,v 1.10 1999/11/16 11:42:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -44,6 +44,8 @@ static int proto_giop = -1; static int hf_giop_message_type = -1; static int hf_giop_message_size = -1; +static gint ett_giop = -1; + /* * GIOP / IIOP types definition - OMG CORBA 2.x / GIOP 1.[01] * See OMG WEB site - CORBA+IIOP 2.2 (98-02-01.ps) @@ -264,7 +266,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { ti = proto_tree_add_item(tree, proto_giop, offset, GIOP_HEADER_SIZE + message_size, NULL); - clnp_tree = proto_item_add_subtree(ti, ETT_GIOP); + clnp_tree = proto_item_add_subtree(ti, ett_giop); proto_tree_add_text(clnp_tree, offset, 4, "Magic number: %s", GIOP_MAGIC); proto_tree_add_text(clnp_tree, offset + 4, 2, @@ -715,7 +717,11 @@ proto_register_giop(void) { "Message size", "giop.len", FT_UINT32, BASE_DEC, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_giop, + }; proto_giop = proto_register_protocol("General Inter-ORB Protocol", "giop"); proto_register_field_array(proto_giop, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-gre.c b/packet-gre.c index b8298dfaae..c5b8f0b499 100644 --- a/packet-gre.c +++ b/packet-gre.c @@ -2,7 +2,7 @@ * Routines for the Generic Routing Encapsulation (GRE) protocol * Brad Robel-Forrest * - * $Id: packet-gre.c,v 1.6 1999/09/17 05:56:54 guy Exp $ + * $Id: packet-gre.c,v 1.7 1999/11/16 11:42:31 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -40,6 +40,9 @@ static int proto_gre = -1; +static gint ett_gre = -1; +static gint ett_gre_flags = -1; + /* bit positions for flags in header */ #define GH_B_C 0x8000 #define GH_B_R 0x4000 @@ -86,13 +89,13 @@ dissect_gre(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { is_ppp = 1; ti = proto_tree_add_item_format(tree, proto_gre, offset, calc_len(flags_and_ver, 1), NULL, "Generic Routing Encapsulation (PPP)"); - gre_tree = proto_item_add_subtree(ti, ETT_GRE); + gre_tree = proto_item_add_subtree(ti, ett_gre); add_flags_and_ver(gre_tree, flags_and_ver, offset, 1); } else { is_ppp = 0; ti = proto_tree_add_item(tree, proto_gre, offset, calc_len(flags_and_ver, 1), NULL); - gre_tree = proto_item_add_subtree(ti, ETT_GRE); + gre_tree = proto_item_add_subtree(ti, ett_gre); add_flags_and_ver(gre_tree, flags_and_ver, offset, 0); } @@ -196,7 +199,7 @@ add_flags_and_ver(proto_tree *tree, guint16 flags_and_ver, int offset, int is_pp ti = proto_tree_add_text(tree, offset, 2, "Flags and version: %#08x", flags_and_ver); - fv_tree = proto_item_add_subtree(ti, ETT_GRE_FLAGS); + fv_tree = proto_item_add_subtree(ti, ett_gre_flags); proto_tree_add_text(fv_tree, offset, sizeof(flags_and_ver), "%s", decode_boolean_bitfield(flags_and_ver, GH_B_C, nbits, @@ -242,7 +245,11 @@ proto_register_gre(void) { &variable, { "Name", "gre.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_gre, + }; proto_gre = proto_register_protocol("Generic Routing Encapsulation", "gre"); /* proto_register_field_array(proto_gre, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-http.c b/packet-http.c index 4eb1b625f5..ff6eeaf1a3 100644 --- a/packet-http.c +++ b/packet-http.c @@ -3,7 +3,7 @@ * * Guy Harris * - * $Id: packet-http.c,v 1.10 1999/10/16 20:30:14 deniel Exp $ + * $Id: packet-http.c,v 1.11 1999/11/16 11:42:31 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -45,6 +45,8 @@ static int proto_http = -1; static int hf_http_response = -1; static int hf_http_request = -1; +static gint ett_http = -1; + static proto_tree *http_tree; static int is_http_request_or_reply(const u_char *data, int linelen); @@ -79,7 +81,7 @@ void dissect_http(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { ti = proto_tree_add_item(tree, proto_http, offset, END_OF_FRAME, NULL); - http_tree = proto_item_add_subtree(ti, ETT_HTTP); + http_tree = proto_item_add_subtree(ti, ett_http); while (data < dataend) { /* @@ -238,7 +240,11 @@ proto_register_http(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if HTTP request (GET, PUT, HEAD, POST)" }}, }; + static gint *ett[] = { + &ett_http, + }; proto_http = proto_register_protocol("Hypertext Transfer Protocol", "http"); proto_register_field_array(proto_http, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-icmpv6.c b/packet-icmpv6.c index 08a3859e2d..3607a01440 100644 --- a/packet-icmpv6.c +++ b/packet-icmpv6.c @@ -1,7 +1,7 @@ /* packet-icmpv6.c * Routines for ICMPv6 packet disassembly * - * $Id: packet-icmpv6.c,v 1.10 1999/10/16 20:41:37 deniel Exp $ + * $Id: packet-icmpv6.c,v 1.11 1999/11/16 11:42:31 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -68,6 +68,10 @@ static int hf_icmpv6_type = -1; static int hf_icmpv6_code = -1; static int hf_icmpv6_checksum = -1; +static gint ett_icmpv6 = -1; +static gint ett_icmpv6opt = -1; +static gint ett_icmpv6flag = -1; + static void dissect_icmpv6opt(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -89,7 +93,7 @@ again: /* !!! specify length */ ti = proto_tree_add_text(tree, offset, len, "ICMPv6 options"); - icmp6opt_tree = proto_item_add_subtree(ti, ETT_ICMPv6OPT); + icmp6opt_tree = proto_item_add_subtree(ti, ett_icmpv6opt); switch (opt->nd_opt_type) { case ND_OPT_SOURCE_LINKADDR: @@ -151,7 +155,7 @@ again: flagoff = offsetof(struct nd_opt_prefix_info, nd_opt_pi_flags_reserved); tf = proto_tree_add_text(icmp6opt_tree, flagoff, 1, "Flags: 0x%02x", pntohl(&pi->nd_opt_pi_flags_reserved)); - field_tree = proto_item_add_subtree(tf, ETT_ICMPv6FLAG); + field_tree = proto_item_add_subtree(tf, ett_icmpv6flag); proto_tree_add_text(field_tree, flagoff, 1, "%s", decode_boolean_bitfield(pi->nd_opt_pi_flags_reserved, 0x80, 8, "Onlink", "Not onlink")); @@ -342,7 +346,7 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { /* !!! specify length */ ti = proto_tree_add_item(tree, proto_icmpv6, offset, len, NULL); - icmp6_tree = proto_item_add_subtree(ti, ETT_ICMPv6); + icmp6_tree = proto_item_add_subtree(ti, ett_icmpv6); proto_tree_add_item_format(icmp6_tree, hf_icmpv6_type, offset + offsetof(struct icmp6_hdr, icmp6_type), 1, @@ -428,7 +432,7 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) flagoff = offset + offsetof(struct nd_router_advert, nd_ra_flags_reserved); ra_flags = pntohl(&pd[flagoff]); tf = proto_tree_add_text(icmp6_tree, flagoff, 4, "Flags: 0x%08x", ra_flags); - field_tree = proto_item_add_subtree(tf, ETT_ICMPv6FLAG); + field_tree = proto_item_add_subtree(tf, ett_icmpv6flag); proto_tree_add_text(field_tree, flagoff, 4, "%s", decode_boolean_bitfield(ra_flags, 0x80000000, 32, "Managed", "Not managed")); @@ -476,7 +480,7 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) na_flags = pntohl(&pd[flagoff]); tf = proto_tree_add_text(icmp6_tree, flagoff, 4, "Flags: 0x%08x", na_flags); - field_tree = proto_item_add_subtree(tf, ETT_ICMPv6FLAG); + field_tree = proto_item_add_subtree(tf, ett_icmpv6flag); proto_tree_add_text(field_tree, flagoff, 4, "%s", decode_boolean_bitfield(na_flags, 0x80000000, 32, "Router", "Not router")); @@ -543,7 +547,7 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) flagoff = offset + offsetof(struct icmp6_router_renum, rr_segnum) + 1; tf = proto_tree_add_text(icmp6_tree, flagoff, 4, "Flags: 0x%08x", pd[flagoff]); - field_tree = proto_item_add_subtree(tf, ETT_ICMPv6FLAG); + field_tree = proto_item_add_subtree(tf, ett_icmpv6flag); proto_tree_add_text(field_tree, flagoff, 1, "%s", decode_boolean_bitfield(pd[flagoff], 0x80, 8, "Test command", "Not test command")); @@ -586,8 +590,14 @@ proto_register_icmpv6(void) { "Checksum", "icmpv6.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, "" }} }; + static gint *ett[] = { + &ett_icmpv6, + &ett_icmpv6opt, + &ett_icmpv6flag, + }; proto_icmpv6 = proto_register_protocol("Internet Control Message Protocol v6", "icmpv6"); proto_register_field_array(proto_icmpv6, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-icp.c b/packet-icp.c index 717a2df487..18d328daf8 100644 --- a/packet-icp.c +++ b/packet-icp.c @@ -1,8 +1,8 @@ /* packet-icp.c - * Routines for ICP (internet cache protocol) packet disassembly RFC 2186 && RFC 2187 - * + * Routines for ICP (internet cache protocol) packet disassembly + * RFC 2186 && RFC 2187 * - * $Id: packet-icp.c,v 1.2 1999/10/12 06:20:07 gram Exp $ + * $Id: packet-icp.c,v 1.3 1999/11/16 11:42:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Peter Torvals @@ -23,13 +23,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -int proto_icp=-1; -int hf_icp_length=-1; -int hf_icp_opcode=-1; -int hf_icp_version=-1; -int hf_icp_request_nr=-1; - - #define MAX_TEXTBUF_LENGTH 600 #ifdef HAVE_CONFIG_H #include "config.h" @@ -49,6 +42,15 @@ int hf_icp_request_nr=-1; #include "packet.h" #include "resolv.h" +static int proto_icp=-1; +static int hf_icp_length=-1; +static int hf_icp_opcode=-1; +static int hf_icp_version=-1; +static int hf_icp_request_nr=-1; + +static gint ett_icp = -1; +static gint ett_icp_payload = -1; + #define CODE_ICP_OP_QUERY 1 #define CODE_ICP_OP_INVALID 0 #define CODE_ICP_OP_HIT 2 @@ -206,7 +208,7 @@ void dissect_icp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_item(tree,proto_icp ,offset,fd->pkt_len-offset, NULL); - icp_tree = proto_item_add_subtree(ti, ETT_ICP); + icp_tree = proto_item_add_subtree(ti, ett_icp); proto_tree_add_item_format(icp_tree,hf_icp_opcode, offset, 1, icph.opcode, "Opcode:0x%01x (%s)",icph.opcode, opcodestrval); @@ -246,7 +248,7 @@ void dissect_icp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) payloadtf = proto_tree_add_text(icp_tree, offset+20,icph.message_length - 20, "Payload"); - payload_tree = proto_item_add_subtree(payloadtf, ETT_ICP_PAYLOAD); + payload_tree = proto_item_add_subtree(payloadtf, ett_icp_payload); if (payload_tree !=NULL) { @@ -275,7 +277,12 @@ proto_register_icp(void) { "Request Number","icp.nr", FT_UINT32, BASE_DEC, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_icp, + &ett_icp_payload, + }; proto_icp = proto_register_protocol ("Internet Cache protocol", "icp"); proto_register_field_array(proto_icp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-icq.c b/packet-icq.c index ea9aea34a6..36abd8f527 100644 --- a/packet-icq.c +++ b/packet-icq.c @@ -1,7 +1,7 @@ /* packet-icq.c * Routines for ICQ packet disassembly * - * $Id: packet-icq.c,v 1.5 1999/11/06 03:08:33 guy Exp $ + * $Id: packet-icq.c,v 1.6 1999/11/16 11:42:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Johan Feyaerts @@ -68,13 +68,19 @@ #include "packet.h" #include "resolv.h" -int proto_icq = -1; -int hf_icq_uin =-1; -int hf_icq_cmd =-1; -int hf_icq_sessionid =-1; -int hf_icq_checkcode =-1; -int hf_icq_decode = -1; -int hf_icq_type = -1; +static int proto_icq = -1; +static int hf_icq_uin =-1; +static int hf_icq_cmd =-1; +static int hf_icq_sessionid =-1; +static int hf_icq_checkcode =-1; +static int hf_icq_decode = -1; +static int hf_icq_type = -1; + +static gint ett_icq = -1; +static gint ett_icq_header = -1; +static gint ett_icq_decode = -1; +static gint ett_icq_body = -1; +static gint ett_icq_body_parts = -1; enum { ICQ5_client, ICQ5_server}; @@ -609,7 +615,7 @@ icqv5_decode_msgType(proto_tree* tree, 2, "Type: %d (%s)", msgType, findMsgType(msgType)); /* Create a new subtree */ - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY_PARTS); + subtree = proto_item_add_subtree(ti, ett_icq_body_parts); switch(msgType) { case 0xffff: /* Field unknown */ @@ -755,7 +761,7 @@ icqv5_decode_msgType(proto_tree* tree, u_char* msgText2 = NULL; msgText = NULL; /* Create a new subtree */ - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY_PARTS); + subtree = proto_item_add_subtree(ti, ett_icq_body_parts); while (p!=NULL) { p = strnchr(pprev, 0xfe, left); @@ -826,7 +832,7 @@ icqv5_cmd_ack(proto_tree* tree,/* Tree to put the data in */ 4, CMD_ACK, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + CMD_ACK_RANDOM, 4, @@ -865,7 +871,7 @@ icqv5_cmd_rand_search(proto_tree* tree, /* Tree to put the data in */ 4, CMD_RAND_SEARCH, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); if (group>0 && (group<=sizeof(groups)/sizeof(const char*))) proto_tree_add_text(subtree, offset + CMD_RAND_SEARCH_GROUP, @@ -896,7 +902,7 @@ icqv5_cmd_ack_messages(proto_tree* tree,/* Tree to put the data in */ 4, CMD_ACK_MESSAGES, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + CMD_ACK_MESSAGES_RANDOM, 4, @@ -921,7 +927,7 @@ icqv5_cmd_keep_alive(proto_tree* tree,/* Tree to put the data in */ 4, CMD_KEEP_ALIVE, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + CMD_KEEP_ALIVE_RANDOM, 4, @@ -964,7 +970,7 @@ icqv5_cmd_send_text_code(proto_tree* tree,/* Tree to put the data in */ left, CMD_KEEP_ALIVE, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + CMD_SEND_TEXT_CODE_LEN, 2, @@ -1000,7 +1006,7 @@ icqv5_cmd_add_to_list(proto_tree* tree,/* Tree to put the data in */ 4, CMD_ADD_TO_LIST, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + CMD_ADD_TO_LIST_UIN, 4, @@ -1026,7 +1032,7 @@ icqv5_cmd_status_change(proto_tree* tree,/* Tree to put the data in */ offset, 4, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); if (status!=-1) proto_tree_add_text(subtree, offset + CMD_STATUS_CHANGE_STATUS, @@ -1067,7 +1073,7 @@ icqv5_cmd_send_msg(proto_tree* tree, size, CMD_SEND_MSG, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + CMD_SEND_MSG_RECV_UIN, 4, @@ -1128,7 +1134,7 @@ icqv5_cmd_login(proto_tree* tree, size, CMD_SEND_MSG, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); if (theTime!=-1) proto_tree_add_text(subtree, offset + CMD_LOGIN_TIME, @@ -1182,7 +1188,7 @@ icqv5_cmd_contact_list(proto_tree* tree, size, CMD_CONTACT_LIST, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + CMD_CONTACT_LIST, 1, @@ -1225,7 +1231,7 @@ icqv5_cmd_no_params(proto_tree* tree,/* Tree to put the data in */ 0, cmd, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset, 0, @@ -1256,7 +1262,7 @@ icqv5_srv_no_params(proto_tree* tree,/* Tree to put the data in */ 0, cmd, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset, 0, @@ -1284,7 +1290,7 @@ icqv5_srv_login_reply(proto_tree* tree,/* Tree to put the data in */ SRV_LOGIN_REPLY_IP + 8, SRV_LOGIN_REPLY, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + SRV_LOGIN_REPLY_IP, 4, @@ -1337,7 +1343,7 @@ icqv5_srv_user_online(proto_tree* tree,/* Tree to put the data in */ SRV_LOGIN_REPLY_IP + 8, SRV_LOGIN_REPLY, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + SRV_USER_ONL_UIN, 4, @@ -1385,7 +1391,7 @@ icqv5_srv_user_offline(proto_tree* tree,/* Tree to put the data in */ SRV_USER_OFFLINE_UIN + 4, SRV_USER_OFFLINE, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + SRV_USER_OFFLINE_UIN, 4, @@ -1417,7 +1423,7 @@ icqv5_srv_multi(proto_tree* tree,/* Tree to put the data in */ size, SRV_MULTI, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_text(subtree, offset + SRV_MULTI_NUM, 1, @@ -1471,7 +1477,7 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ size, SRV_META_USER, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); ti = proto_tree_add_text(subtree, offset + SRV_META_USER_SUBCMD, 2, @@ -1497,7 +1503,7 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ int len = 0; guint16 x2 = -1; guint32 x3 = -1; - proto_tree* sstree = proto_item_add_subtree(ti, ETT_ICQ_BODY_PARTS); + proto_tree* sstree = proto_item_add_subtree(ti, ett_icq_body_parts); /* Skip over META_USER header */ left -= 3; @@ -1606,7 +1612,7 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ { int len; char* about = NULL; - proto_tree* sstree = proto_item_add_subtree(ti, ETT_ICQ_BODY_PARTS); + proto_tree* sstree = proto_item_add_subtree(ti, ett_icq_body_parts); /* Skip over META_USER header */ left -= 3; @@ -1657,7 +1663,7 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ unsigned char user_timezone = -1; unsigned char auth = -1; int len = 0; - proto_tree* sstree = proto_item_add_subtree(ti, ETT_ICQ_BODY_PARTS); + proto_tree* sstree = proto_item_add_subtree(ti, ett_icq_body_parts); /* Skip over META_USER header */ left -= 3; @@ -1777,7 +1783,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */ 4, SRV_RECV_MESSAGE, "Body"); - subtree = proto_item_add_subtree(ti, ETT_ICQ_BODY); + subtree = proto_item_add_subtree(ti, ett_icq_body); if (left>=sizeof(guint32)) { uin = pletohl(pd + SRV_RECV_MSG_UIN); proto_tree_add_item_format(subtree, @@ -1863,14 +1869,14 @@ dissect_icqv5Client(const u_char *pd, "ICQv5 %s (len %d)", findClientCmd(cmd), pktsize); - icq_tree = proto_item_add_subtree(ti, ETT_ICQ); + icq_tree = proto_item_add_subtree(ti, ett_icq); ti = proto_tree_add_item_format(icq_tree, hf_icq_type, offset, ICQ5_CL_HDRSIZE, ICQ5_client, "Header"); - icq_header_tree = proto_item_add_subtree(ti, ETT_ICQ_HEADER); + icq_header_tree = proto_item_add_subtree(ti, ett_icq_header); proto_tree_add_item_format(icq_header_tree, hf_icq_sessionid, @@ -1988,7 +1994,7 @@ dissect_icqv5Client(const u_char *pd, pktsize, "Decoded packet"); icq_decode_tree = proto_item_add_subtree(ti, - ETT_ICQ_DECODE); + ett_icq_decode); proto_tree_add_hexdump(icq_decode_tree, offset, decr_pd, pktsize); } @@ -2037,7 +2043,7 @@ dissect_icqv5Server(const u_char *pd, findServerCmd(cmd), pktsize); - icq_tree = proto_item_add_subtree(ti, ETT_ICQ); + icq_tree = proto_item_add_subtree(ti, ett_icq); ti = proto_tree_add_item_format(icq_tree, hf_icq_type, @@ -2045,7 +2051,7 @@ dissect_icqv5Server(const u_char *pd, ICQ5_SRV_HDRSIZE, ICQ5_server, "Header"); - icq_header_tree = proto_item_add_subtree(ti, ETT_ICQ_HEADER); + icq_header_tree = proto_item_add_subtree(ti, ett_icq_header); proto_tree_add_item_format(icq_header_tree, hf_icq_sessionid, @@ -2144,7 +2150,7 @@ dissect_icqv5Server(const u_char *pd, pktsize, "Decoded packet"); icq_decode_tree = proto_item_add_subtree(ti, - ETT_ICQ_DECODE); + ett_icq_decode); proto_tree_add_hexdump(icq_decode_tree, offset, decr_pd, pktsize); } } @@ -2206,8 +2212,17 @@ proto_register_icq(void) { &hf_icq_decode, {"Decode", "icq.decode", FT_STRING, BASE_NONE, NULL, 0x0, ""}} }; + static gint *ett[] = { + &ett_icq, + &ett_icq_header, + &ett_icq_decode, + &ett_icq_body, + &ett_icq_body_parts, + }; proto_icq = proto_register_protocol ("ICQ Protocol", "icq"); proto_register_field_array(proto_icq, hf, array_length(hf)); + + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-imap.c b/packet-imap.c index 15135c19cd..2561e80ca7 100644 --- a/packet-imap.c +++ b/packet-imap.c @@ -2,7 +2,7 @@ * Routines for imap packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-imap.c,v 1.2 1999/11/14 10:48:17 deniel Exp $ + * $Id: packet-imap.c,v 1.3 1999/11/16 11:42:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -47,6 +47,8 @@ static int proto_imap = -1; static int hf_imap_response = -1; static int hf_imap_request = -1; +static gint ett_imap = -1; + void dissect_imap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -88,7 +90,7 @@ dissect_imap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_imap, offset, END_OF_FRAME, NULL); - imap_tree = proto_item_add_subtree(ti, ETT_IMAP); + imap_tree = proto_item_add_subtree(ti, ett_imap); if (pi.match_port == pi.destport) { /* Request */ @@ -123,8 +125,12 @@ proto_register_imap(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if IMAP request" }} }; + static gint *ett[] = { + &ett_imap, + }; proto_imap = proto_register_protocol("Internet Message Access Protocol", "imap"); proto_register_field_array(proto_imap, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ip.c b/packet-ip.c index 0645ae4505..bd76e2957b 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -1,7 +1,7 @@ /* packet-ip.c * Routines for IP and miscellaneous IP protocol packet disassembly * - * $Id: packet-ip.c,v 1.61 1999/11/02 07:06:07 guy Exp $ + * $Id: packet-ip.c,v 1.62 1999/11/16 11:42:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -77,6 +77,14 @@ static int hf_ip_ttl = -1; static int hf_ip_proto = -1; static int hf_ip_checksum = -1; +static gint ett_ip = -1; +static gint ett_ip_tos = -1; +static gint ett_ip_off = -1; +static gint ett_ip_options = -1; +static gint ett_ip_option_sec = -1; +static gint ett_ip_option_route = -1; +static gint ett_ip_option_timestamp = -1; + static int proto_igmp = -1; static int hf_igmp_version = -1; static int hf_igmp_type = -1; @@ -84,11 +92,15 @@ static int hf_igmp_unused = -1; static int hf_igmp_checksum = -1; static int hf_igmp_group = -1; +static gint ett_igmp = -1; + static int proto_icmp = -1; static int hf_icmp_type = -1; static int hf_icmp_code = -1; static int hf_icmp_checksum = -1; +static gint ett_icmp = -1; + /* ICMP structs and definitions */ typedef struct _e_icmp { guint8 icmp_type; @@ -348,7 +360,7 @@ dissect_ipopt_security(const ip_tcp_opt *optp, const u_char *opd, int offset, {0, NULL } }; tf = proto_tree_add_text(opt_tree, offset, optlen, "%s:", optp->name); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); offset += 2; val = pntohs(opd); @@ -384,7 +396,7 @@ dissect_ipopt_route(const ip_tcp_opt *optp, const u_char *opd, int offset, tf = proto_tree_add_text(opt_tree, offset, optlen, "%s (%d bytes)", optp->name, optlen); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); optoffset += 2; /* skip past type and length */ optlen -= 2; /* subtract size of type and length */ @@ -446,7 +458,7 @@ dissect_ipopt_timestamp(const ip_tcp_opt *optp, const u_char *opd, guint ts; tf = proto_tree_add_text(opt_tree, offset, optlen, "%s:", optp->name); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); optoffset += 2; /* skip past type and length */ optlen -= 2; /* subtract size of type and length */ @@ -517,7 +529,7 @@ static const ip_tcp_opt ipopts[] = { { IPOPT_END, "EOL", - -1, + NULL, NO_LENGTH, 0, NULL, @@ -525,7 +537,7 @@ static const ip_tcp_opt ipopts[] = { { IPOPT_NOOP, "NOP", - -1, + NULL, NO_LENGTH, 0, NULL, @@ -533,7 +545,7 @@ static const ip_tcp_opt ipopts[] = { { IPOPT_SEC, "Security", - ETT_IP_OPTION_SEC, + &ett_ip_option_sec, FIXED_LENGTH, IPOLEN_SEC, dissect_ipopt_security @@ -541,7 +553,7 @@ static const ip_tcp_opt ipopts[] = { { IPOPT_SSRR, "Strict source route", - ETT_IP_OPTION_ROUTE, + &ett_ip_option_route, VARIABLE_LENGTH, IPOLEN_SSRR_MIN, dissect_ipopt_route @@ -549,7 +561,7 @@ static const ip_tcp_opt ipopts[] = { { IPOPT_LSRR, "Loose source route", - ETT_IP_OPTION_ROUTE, + &ett_ip_option_route, VARIABLE_LENGTH, IPOLEN_LSRR_MIN, dissect_ipopt_route @@ -557,7 +569,7 @@ static const ip_tcp_opt ipopts[] = { { IPOPT_RR, "Record route", - ETT_IP_OPTION_ROUTE, + &ett_ip_option_route, VARIABLE_LENGTH, IPOLEN_RR_MIN, dissect_ipopt_route @@ -565,7 +577,7 @@ static const ip_tcp_opt ipopts[] = { { IPOPT_SID, "Stream identifier", - -1, + NULL, FIXED_LENGTH, IPOLEN_SID, dissect_ipopt_sid @@ -573,7 +585,7 @@ static const ip_tcp_opt ipopts[] = { { IPOPT_TIMESTAMP, "Time stamp", - ETT_IP_OPTION_TIMESTAMP, + &ett_ip_option_timestamp, VARIABLE_LENGTH, IPOLEN_TIMESTAMP_MIN, dissect_ipopt_timestamp @@ -823,7 +835,7 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { } ti = proto_tree_add_item(tree, proto_ip, offset, hlen, NULL); - ip_tree = proto_item_add_subtree(ti, ETT_IP); + ip_tree = proto_item_add_subtree(ti, ett_ip); proto_tree_add_item(ip_tree, hf_ip_version, offset, 1, hi_nibble(iph.ip_v_hl)); proto_tree_add_item_format(ip_tree, hf_ip_hdr_len, offset, 1, hlen, @@ -832,7 +844,7 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { "Type of service: 0x%02x (%s)", iph.ip_tos, val_to_str( IPTOS_TOS(iph.ip_tos), iptos_vals, "Unknown") ); - field_tree = proto_item_add_subtree(tf, ETT_IP_TOS); + field_tree = proto_item_add_subtree(tf, ett_ip_tos); proto_tree_add_item(field_tree, hf_ip_tos_precedence, offset + 1, 1, iph.ip_tos); proto_tree_add_item(field_tree, hf_ip_tos_delay, offset + 1, 1, iph.ip_tos); proto_tree_add_item(field_tree, hf_ip_tos_throughput, offset + 1, 1, iph.ip_tos); @@ -843,7 +855,7 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { flags = (iph.ip_off & (IP_DF|IP_MF)) >> 12; tf = proto_tree_add_item(ip_tree, hf_ip_flags, offset + 6, 1, flags); - field_tree = proto_item_add_subtree(tf, ETT_IP_OFF); + field_tree = proto_item_add_subtree(tf, ett_ip_off); proto_tree_add_item(field_tree, hf_ip_flags_df, offset + 6, 1, flags), proto_tree_add_item(field_tree, hf_ip_flags_mf, offset + 6, 1, flags), @@ -865,7 +877,7 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { optlen = hlen - sizeof (e_ip); /* length of options, in bytes */ tf = proto_tree_add_text(ip_tree, offset + 20, optlen, "Options: (%d bytes)", optlen); - field_tree = proto_item_add_subtree(tf, ETT_IP_OPTIONS); + field_tree = proto_item_add_subtree(tf, ett_ip_options); dissect_ip_tcp_options(&pd[offset + 20], offset + 20, optlen, ipopts, N_IP_OPTS, IPOPT_END, field_tree); } @@ -1071,7 +1083,7 @@ dissect_icmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_icmp, offset, 4, NULL); - icmp_tree = proto_item_add_subtree(ti, ETT_ICMP); + icmp_tree = proto_item_add_subtree(ti, ett_icmp); proto_tree_add_item_format(icmp_tree, hf_icmp_type, offset, 1, ih.icmp_type, "Type: %d (%s)", @@ -1230,7 +1242,7 @@ dissect_igmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { col_add_str(fd, COL_INFO, type_str); if (tree) { ti = proto_tree_add_item(tree, proto_igmp, offset, 8, NULL); - igmp_tree = proto_item_add_subtree(ti, ETT_IGMP); + igmp_tree = proto_item_add_subtree(ti, ett_igmp); proto_tree_add_item(igmp_tree, hf_igmp_version, offset, 1, hi_nibble(ih.igmp_v_t)); proto_tree_add_item_format(igmp_tree, hf_igmp_type, offset , 1, @@ -1273,9 +1285,13 @@ proto_register_igmp(void) { "Group address", "igmp.group", FT_IPv4, BASE_NONE, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_igmp, + }; proto_igmp = proto_register_protocol ("Internet Group Management Protocol", "igmp"); proto_register_field_array(proto_igmp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } void @@ -1368,9 +1384,19 @@ proto_register_ip(void) { "Header checksum", "ip.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_ip, + &ett_ip_tos, + &ett_ip_off, + &ett_ip_options, + &ett_ip_option_sec, + &ett_ip_option_route, + &ett_ip_option_timestamp, + }; proto_ip = proto_register_protocol ("Internet Protocol", "ip"); proto_register_field_array(proto_ip, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } void @@ -1390,14 +1416,20 @@ proto_register_icmp(void) { "Checksum", "icmp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_icmp, + }; proto_icmp = proto_register_protocol ("Internet Control Message Protocol", "icmp"); proto_register_field_array(proto_icmp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } static int proto_eigrp = -1; +static gint ett_eigrp = -1; + void dissect_eigrp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { e_eigrp ih; @@ -1427,7 +1459,7 @@ static const value_string eigrp_opcode_vals[] = { if (tree) { ti = proto_tree_add_item(tree, proto_eigrp, offset, END_OF_FRAME, NULL); - eigrp_tree = proto_item_add_subtree(ti, ETT_RIP); + eigrp_tree = proto_item_add_subtree(ti, ett_eigrp); proto_tree_add_text(eigrp_tree, offset, 1, "Version: %d", ih.eigrp_version); proto_tree_add_text(eigrp_tree, offset + 1, 1, "Opcode: %d (%s)", ih.eigrp_opcode, @@ -1444,5 +1476,9 @@ static const value_string eigrp_opcode_vals[] = { void proto_register_eigrp(void) { + static gint *ett[] = { + &ett_eigrp, + }; proto_eigrp = proto_register_protocol("Enhanced Interior Gateway Routing Protocol", "eigrp"); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ip.h b/packet-ip.h index a4e1aabd59..606ca91dcf 100644 --- a/packet-ip.h +++ b/packet-ip.h @@ -1,7 +1,7 @@ /* packet-ip.h * Definitions for IP packet disassembly structures and routines * - * $Id: packet-ip.h,v 1.7 1999/10/30 06:10:32 guy Exp $ + * $Id: packet-ip.h,v 1.8 1999/11/16 11:42:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -66,8 +66,8 @@ typedef enum { /* Member of table of IP or TCP options. */ typedef struct ip_tcp_opt { int optcode; /* code for option */ - char *name; /* name of option */ - int subtree_index; /* ETT_ value for option */ + char *name; /* name of option */ + int *subtree_index; /* pointer to subtree index for option */ opt_len_type len_type; /* type of option length field */ int optlen; /* value length should be (minimum if VARIABLE) */ void (*dissect)(const struct ip_tcp_opt *, const u_char *, int, guint, proto_tree *); diff --git a/packet-ipp.c b/packet-ipp.c index 54d6857d1c..18311ea484 100644 --- a/packet-ipp.c +++ b/packet-ipp.c @@ -3,7 +3,7 @@ * * Guy Harris * - * $Id: packet-ipp.c,v 1.2 1999/09/17 06:25:41 guy Exp $ + * $Id: packet-ipp.c,v 1.3 1999/11/16 11:42:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -43,6 +43,10 @@ static int proto_ipp = -1; +static gint ett_ipp = -1; +static gint ett_ipp_as = -1; +static gint ett_ipp_attr = -1; + #define PRINT_JOB 0x0002 #define PRINT_URI 0x0003 #define VALIDATE_JOB 0x0004 @@ -173,7 +177,7 @@ void dissect_ipp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_ipp, offset, END_OF_FRAME, NULL); - ipp_tree = proto_item_add_subtree(ti, ETT_IPP); + ipp_tree = proto_item_add_subtree(ti, ett_ipp); proto_tree_add_text(ipp_tree, offset, 2, "Version: %u.%u", pd[offset], pd[offset + 1]); @@ -387,7 +391,7 @@ parse_attributes(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) * a tree. */ as_tree = proto_item_add_subtree(tas, - ETT_IPP_AS); + ett_ipp_as); attr_tree = as_tree; } @@ -466,7 +470,7 @@ add_integer_tree(proto_tree *tree, const u_char *pd, int offset, name_length, &pd[offset + 1 + 2], pntohl(&pd[1 + 2 + name_length + 2])); } - return proto_item_add_subtree(ti, ETT_IPP_ATTR); + return proto_item_add_subtree(ti, ett_ipp_attr); } static void @@ -493,7 +497,7 @@ add_octetstring_tree(proto_tree *tree, const u_char *pd, int offset, name_length, &pd[offset + 1 + 2]); bytes_to_str(&pd[offset + 1 + 2 + name_length + 2], value_length); - return proto_item_add_subtree(ti, ETT_IPP_ATTR); + return proto_item_add_subtree(ti, ett_ipp_attr); } static void @@ -517,7 +521,7 @@ add_charstring_tree(proto_tree *tree, const u_char *pd, int offset, "%.*s: %.*s", name_length, &pd[offset + 1 + 2], value_length, &pd[offset + 1 + 2 + name_length + 2]); - return proto_item_add_subtree(ti, ETT_IPP_ATTR); + return proto_item_add_subtree(ti, ett_ipp_attr); } static void @@ -557,7 +561,13 @@ proto_register_ipp(void) { &variable, { "Name", "ipp.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_ipp, + &ett_ipp_as, + &ett_ipp_attr, + }; proto_ipp = proto_register_protocol("Internet Printing Protocol", "ipp"); /* proto_register_field_array(proto_ipp, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } 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 @@ -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)); } diff --git a/packet-ipv6.c b/packet-ipv6.c index 4622ca7bc4..3c30156391 100644 --- a/packet-ipv6.c +++ b/packet-ipv6.c @@ -1,7 +1,7 @@ /* packet-ipv6.c * Routines for IPv6 packet disassembly * - * $Id: packet-ipv6.c,v 1.24 1999/10/22 07:17:32 guy Exp $ + * $Id: packet-ipv6.c,v 1.25 1999/11/16 11:42:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -66,6 +66,8 @@ static int hf_ipv6_dst = -1; static int hf_ipv6_final = -1; #endif +static gint ett_ipv6 = -1; + #ifndef offsetof #define offsetof(type, member) ((size_t)(&((type *)0)->member)) #endif @@ -85,7 +87,7 @@ dissect_routing6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* !!! specify length */ ti = proto_tree_add_text(tree, offset, len, "Routing Header, Type %d", rt.ip6r_type); - rthdr_tree = proto_item_add_subtree(ti, ETT_IPv6); + rthdr_tree = proto_item_add_subtree(ti, ett_ipv6); proto_tree_add_text(rthdr_tree, offset + offsetof(struct ip6_rthdr, ip6r_nxt), 1, @@ -167,7 +169,7 @@ dissect_opts(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, /* !!! specify length */ ti = proto_tree_add_text(tree, offset, len, "%s Header", optname); - dstopt_tree = proto_item_add_subtree(ti, ETT_IPv6); + dstopt_tree = proto_item_add_subtree(ti, ett_ipv6); proto_tree_add_text(dstopt_tree, offset + offsetof(struct ip6_ext, ip6e_nxt), 1, @@ -263,7 +265,7 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { /* !!! specify length */ ti = proto_tree_add_item(tree, proto_ipv6, offset, 40, NULL); - ipv6_tree = proto_item_add_subtree(ti, ETT_IPv6); + ipv6_tree = proto_item_add_subtree(ti, ett_ipv6); /* !!! warning: version also contains 4 Bit priority */ proto_tree_add_item(ipv6_tree, hf_ipv6_version, @@ -443,7 +445,11 @@ proto_register_ipv6(void) FT_UINT8, BASE_HEX, NULL, 0x0, "" }}, #endif }; + static gint *ett[] = { + &ett_ipv6, + }; proto_ipv6 = proto_register_protocol("Internet Protocol Version 6", "ipv6"); proto_register_field_array(proto_ipv6, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ipx.c b/packet-ipx.c index 376b34fad2..2be71ad3d9 100644 --- a/packet-ipx.c +++ b/packet-ipx.c @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez * - * $Id: packet-ipx.c,v 1.31 1999/11/15 21:33:56 nneul Exp $ + * $Id: packet-ipx.c,v 1.32 1999/11/16 11:42:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -61,6 +61,8 @@ static int hf_ipx_snet = -1; static int hf_ipx_snode = -1; static int hf_ipx_ssocket = -1; +static gint ett_ipx = -1; + static int proto_spx = -1; static int hf_spx_connection_control = -1; static int hf_spx_datastream_type = -1; @@ -70,14 +72,21 @@ static int hf_spx_seq_nr = -1; static int hf_spx_ack_nr = -1; static int hf_spx_all_nr = -1; +static gint ett_spx = -1; + static int proto_ipxrip = -1; static int hf_ipxrip_request = -1; static int hf_ipxrip_response = -1; +static gint ett_ipxrip = -1; + static int proto_sap = -1; static int hf_sap_request = -1; static int hf_sap_response = -1; +static gint ett_ipxsap = -1; +static gint ett_ipxsap_server = -1; + static void dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree); @@ -310,7 +319,7 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ipx_hops = pd[offset+4]; ti = proto_tree_add_item(tree, proto_ipx, offset, 30, NULL); - ipx_tree = proto_item_add_subtree(ti, ETT_IPX); + ipx_tree = proto_item_add_subtree(ti, ett_ipx); proto_tree_add_item(ipx_tree, hf_ipx_checksum, offset, 2, ipx_checksum); proto_tree_add_item_format(ipx_tree, hf_ipx_len, offset+2, 2, ipx_length, "Length: %d bytes", ipx_length); @@ -429,7 +438,7 @@ dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_spx, offset, 12, NULL); - spx_tree = proto_item_add_subtree(ti, ETT_SPX); + spx_tree = proto_item_add_subtree(ti, ett_spx); proto_tree_add_item_format(spx_tree, hf_spx_connection_control, offset, 1, @@ -498,7 +507,7 @@ dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_ipxrip, offset, END_OF_FRAME, NULL); - rip_tree = proto_item_add_subtree(ti, ETT_IPXRIP); + rip_tree = proto_item_add_subtree(ti, ett_ipxrip); if (operation < 2) { proto_tree_add_text(rip_tree, offset, 2, @@ -646,7 +655,7 @@ dissect_sap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_sap, offset, END_OF_FRAME, NULL); - sap_tree = proto_item_add_subtree(ti, ETT_IPXSAP); + sap_tree = proto_item_add_subtree(ti, ett_ipxsap); if (query.query_type >= 1 && query.query_type <= 4) { proto_tree_add_text(sap_tree, offset, 2, sap_type[query.query_type - 1]); @@ -678,7 +687,7 @@ dissect_sap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ti = proto_tree_add_text(sap_tree, cursor+2, 48, "Server Name: %s", server.server_name); - s_tree = proto_item_add_subtree(ti, ETT_IPXSAP_SERVER); + s_tree = proto_item_add_subtree(ti, ett_ipxsap_server); proto_tree_add_text(s_tree, cursor, 2, "Server Type: %s (0x%04X)", server_type(server.server_type), server.server_type); @@ -807,7 +816,14 @@ proto_register_ipx(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if SAP response" }} }; - + static gint *ett[] = { + &ett_ipx, + &ett_spx, + &ett_ipxrip, + &ett_ipxsap, + &ett_ipxsap_server, + }; + proto_ipx = proto_register_protocol ("Internetwork Packet eXchange", "ipx"); proto_register_field_array(proto_ipx, hf_ipx, array_length(hf_ipx)); @@ -819,4 +835,6 @@ proto_register_ipx(void) proto_sap = proto_register_protocol ("Service Advertisement Protocol", "sap"); proto_register_field_array(proto_sap, hf_sap, array_length(hf_sap)); + + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-isakmp.c b/packet-isakmp.c index 1e12c542bb..f2dc6562fd 100644 --- a/packet-isakmp.c +++ b/packet-isakmp.c @@ -2,7 +2,7 @@ * Routines for the Internet Security Association and Key Management Protocol (ISAKMP) * Brad Robel-Forrest * - * $Id: packet-isakmp.c,v 1.9 1999/09/17 05:56:54 guy Exp $ + * $Id: packet-isakmp.c,v 1.10 1999/11/16 11:42:37 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -52,6 +52,10 @@ static int proto_isakmp = -1; +static gint ett_isakmp = -1; +static gint ett_isakmp_flags = -1; +static gint ett_isakmp_payload = -1; + #define NUM_PROTO_TYPES 5 #define proto2str(t) \ ((t < NUM_PROTO_TYPES) ? prototypestr[t] : "UNKNOWN-PROTO-TYPE") @@ -294,7 +298,7 @@ void dissect_isakmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tr proto_tree * isakmp_tree; ti = proto_tree_add_item(tree, proto_isakmp, offset, len, NULL); - isakmp_tree = proto_item_add_subtree(ti, ETT_ISAKMP); + isakmp_tree = proto_item_add_subtree(ti, ett_isakmp); proto_tree_add_text(isakmp_tree, offset, sizeof(hdr->icookie), "Initiator cookie"); @@ -324,7 +328,7 @@ void dissect_isakmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tr proto_tree * ftree; fti = proto_tree_add_text(isakmp_tree, offset, sizeof(hdr->flags), "Flags"); - ftree = proto_item_add_subtree(fti, ETT_ISAKMP_FLAGS); + ftree = proto_item_add_subtree(fti, ett_isakmp_flags); proto_tree_add_text(ftree, offset, 1, "%s", decode_boolean_bitfield(hdr->flags, E_FLAG, sizeof(hdr->flags)*8, @@ -366,7 +370,7 @@ dissect_sa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item * ti = proto_tree_add_text(tree, offset, length, "Security Association payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -405,7 +409,7 @@ dissect_proposal(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree * ntree; guint8 i; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -457,7 +461,7 @@ dissect_transform(const u_char *pd, int offset, frame_data *fd, proto_tree *tree proto_item * ti = proto_tree_add_text(tree, offset, length, "Transform payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -516,7 +520,7 @@ dissect_key_exch(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_item * ti = proto_tree_add_text(tree, offset, length, "Key Exchange payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -544,7 +548,7 @@ dissect_id(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item * ti = proto_tree_add_text(tree, offset, length, "Identification payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -597,7 +601,7 @@ dissect_cert(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item * ti = proto_tree_add_text(tree, offset, length, "Certificate payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -629,7 +633,7 @@ dissect_certreq(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_item * ti = proto_tree_add_text(tree, offset, length, "Certificate Request payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -661,7 +665,7 @@ dissect_hash(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item * ti = proto_tree_add_text(tree, offset, length, "Hash payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -689,7 +693,7 @@ dissect_sig(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item * ti = proto_tree_add_text(tree, offset, length, "Signature payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -717,7 +721,7 @@ dissect_nonce(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item * ti = proto_tree_add_text(tree, offset, length, "Nonce payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -747,7 +751,7 @@ dissect_notif(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item * ti = proto_tree_add_text(tree, offset, length, "Notification payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -803,7 +807,7 @@ dissect_delete(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree * ntree; guint16 i; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -851,7 +855,7 @@ dissect_vid(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item * ti = proto_tree_add_text(tree, offset, length, "Vendor ID payload"); proto_tree * ntree; - ntree = proto_item_add_subtree(ti, ETT_ISAKMP_PAYLOAD); + ntree = proto_item_add_subtree(ti, ett_isakmp_payload); proto_tree_add_text(ntree, offset, sizeof(hdr->next_payload), "Next payload: %s (%u)", @@ -1057,7 +1061,13 @@ proto_register_isakmp(void) { &variable, { "Name", "isakmp.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_isakmp, + &ett_isakmp_flags, + &ett_isakmp_payload, + }; proto_isakmp = proto_register_protocol("Internet Security Association and Key Management Protocol", "isakmp"); /* proto_register_field_array(proto_isakmp, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-lapb.c b/packet-lapb.c index a6b11e3a6d..18e33b9de6 100644 --- a/packet-lapb.c +++ b/packet-lapb.c @@ -2,7 +2,7 @@ * Routines for lapb frame disassembly * Olivier Abad * - * $Id: packet-lapb.c,v 1.7 1999/10/15 21:05:49 gram Exp $ + * $Id: packet-lapb.c,v 1.8 1999/11/16 11:42:37 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -40,9 +40,12 @@ #define FROM_DCE 0x80 -int proto_lapb = -1; -int hf_lapb_address = -1; -int hf_lapb_control = -1; +static int proto_lapb = -1; +static int hf_lapb_address = -1; +static int hf_lapb_control = -1; + +static gint ett_lapb = -1; +static gint ett_lapb_control = -1; void dissect_lapb(const u_char *pd, frame_data *fd, proto_tree *tree) @@ -87,14 +90,14 @@ dissect_lapb(const u_char *pd, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item_format(tree, proto_lapb, 0, 2, NULL, "LAPB"); - lapb_tree = proto_item_add_subtree(ti, ETT_LAPB); + lapb_tree = proto_item_add_subtree(ti, ett_lapb); proto_tree_add_item_format(lapb_tree, hf_lapb_address, 0, 1, pd[0], "Address: 0x%02X", pd[0]); } else lapb_tree = NULL; dissect_xdlc_control(pd, 1, fd, lapb_tree, hf_lapb_control, - is_response, FALSE); + ett_lapb_control, is_response, FALSE); /* not end of frame ==> X.25 */ if (fd->cap_len > 2) dissect_x25(pd, 2, fd, tree); @@ -112,7 +115,12 @@ proto_register_lapb(void) { "Control Field", "lapb.control", FT_STRING, BASE_NONE, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_lapb, + &ett_lapb_control, + }; proto_lapb = proto_register_protocol ("Link Access Procedure Balanced (LAPB)", "lapb"); proto_register_field_array (proto_lapb, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-lapd.c b/packet-lapd.c index 38db27d384..1618e0ddf6 100644 --- a/packet-lapd.c +++ b/packet-lapd.c @@ -2,7 +2,7 @@ * Routines for LAPD frame disassembly * Gilbert Ramirez * - * $Id: packet-lapd.c,v 1.2 1999/11/11 08:35:10 guy Exp $ + * $Id: packet-lapd.c,v 1.3 1999/11/16 11:42:37 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -45,14 +45,18 @@ * http://www.acacia-net.com/Clarinet/Protocol/q9213o84.htm */ -int proto_lapd = -1; -int hf_lapd_address = -1; -int hf_lapd_sapi = -1; -int hf_lapd_cr = -1; -int hf_lapd_ea1 = -1; -int hf_lapd_tei = -1; -int hf_lapd_ea2 = -1; -int hf_lapd_control = -1; +static int proto_lapd = -1; +static int hf_lapd_address = -1; +static int hf_lapd_sapi = -1; +static int hf_lapd_cr = -1; +static int hf_lapd_ea1 = -1; +static int hf_lapd_tei = -1; +static int hf_lapd_ea2 = -1; +static int hf_lapd_control = -1; + +static gint ett_lapd = -1; +static gint ett_lapd_address = -1; +static gint ett_lapd_control = -1; /* * Bits in the address field. @@ -115,10 +119,10 @@ dissect_lapd(const u_char *pd, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_lapd, 0, 3, NULL); - lapd_tree = proto_item_add_subtree(ti, ETT_LAPD); + lapd_tree = proto_item_add_subtree(ti, ett_lapd); ti = proto_tree_add_item(lapd_tree, hf_lapd_address, 0, 2, address); - addr_tree = proto_item_add_subtree(ti, ETT_LAPD_ADDRESS); + addr_tree = proto_item_add_subtree(ti, ett_lapd_address); proto_tree_add_item(addr_tree, hf_lapd_sapi, 0, 1, address); proto_tree_add_item(addr_tree, hf_lapd_cr, 0, 1, address); @@ -130,7 +134,8 @@ dissect_lapd(const u_char *pd, frame_data *fd, proto_tree *tree) lapd_tree = NULL; } - control = dissect_xdlc_control(pd, 2, fd, lapd_tree, hf_lapd_control, is_response, TRUE); + control = dissect_xdlc_control(pd, 2, fd, lapd_tree, hf_lapd_control, + ett_lapd_control, is_response, TRUE); lapd_header_len += XDLC_CONTROL_LEN(control, TRUE); if (XDLC_HAS_PAYLOAD(control)) { @@ -180,7 +185,13 @@ proto_register_lapd(void) { "Control Field", "lapd.control", FT_UINT16, BASE_HEX, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_lapd, + &ett_lapd_address, + &ett_lapd_control, + }; proto_lapd = proto_register_protocol ("Link Access Procedure, Channel D (LAPD)", "lapd"); proto_register_field_array (proto_lapd, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-llc.c b/packet-llc.c index f015677564..d24156caae 100644 --- a/packet-llc.c +++ b/packet-llc.c @@ -2,7 +2,7 @@ * Routines for IEEE 802.2 LLC layer * Gilbert Ramirez * - * $Id: packet-llc.c,v 1.27 1999/11/11 08:04:06 guy Exp $ + * $Id: packet-llc.c,v 1.28 1999/11/16 11:42:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -43,6 +43,9 @@ static int hf_llc_ctrl = -1; static int hf_llc_type = -1; static int hf_llc_oui = -1; +static gint ett_llc = -1; +static gint ett_llc_ctrl = -1; + typedef void (capture_func_t)(const u_char *, int, guint32, packet_counts *); typedef void (dissect_func_t)(const u_char *, int, frame_data *, proto_tree *); @@ -241,7 +244,7 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_llc, offset, 0, NULL); - llc_tree = proto_item_add_subtree(ti, ETT_LLC); + llc_tree = proto_item_add_subtree(ti, ett_llc); proto_tree_add_item(llc_tree, hf_llc_dsap, offset, 1, pd[offset]); proto_tree_add_item(llc_tree, hf_llc_ssap, offset+1, 1, pd[offset+1]); } else @@ -263,7 +266,8 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { * it's basic or extended operation; is that the case? */ control = dissect_xdlc_control(pd, offset+2, fd, llc_tree, - hf_llc_ctrl, pd[offset+1] & 0x01, TRUE); + hf_llc_ctrl, ett_llc_ctrl, + pd[offset+1] & 0x01, TRUE); llc_header_len += XDLC_CONTROL_LEN(control, TRUE); if (is_snap) llc_header_len += 5; /* 3 bytes of OUI, 2 bytes of ethertype */ @@ -344,7 +348,12 @@ proto_register_llc(void) { "Organization Code", "llc.oui", FT_UINT24, BASE_HEX, VALS(llc_oui_vals), 0x0, ""}} }; + static gint *ett[] = { + &ett_llc, + &ett_llc_ctrl, + }; proto_llc = proto_register_protocol ("Logical-Link Control", "llc" ); proto_register_field_array(proto_llc, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } 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 * - * $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 @@ -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)); } diff --git a/packet-mapi.c b/packet-mapi.c index 68a0966dd2..8c48681027 100644 --- a/packet-mapi.c +++ b/packet-mapi.c @@ -1,7 +1,7 @@ /* packet-mapi.c * Routines for MSX mapi packet dissection * - * $Id: packet-mapi.c,v 1.1 1999/11/11 23:13:42 nneul Exp $ + * $Id: packet-mapi.c,v 1.2 1999/11/16 11:42:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -44,6 +44,8 @@ static int proto_mapi = -1; +static gint ett_mapi = -1; + void dissect_mapi(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -61,7 +63,7 @@ dissect_mapi(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_mapi, offset, END_OF_FRAME, NULL); - mapi_tree = proto_item_add_subtree(ti, ETT_MAPI); + mapi_tree = proto_item_add_subtree(ti, ett_mapi); if (pi.match_port == pi.destport) { @@ -79,5 +81,9 @@ dissect_mapi(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) void proto_register_mapi(void) { + static gint *ett[] = { + &ett_mapi, + }; proto_mapi = proto_register_protocol("MAPI", "mapi"); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-mount.c b/packet-mount.c index fe2763a135..25e2376249 100644 --- a/packet-mount.c +++ b/packet-mount.c @@ -1,7 +1,7 @@ /* packet-mount.c * Routines for mount dissection * - * $Id: packet-mount.c,v 1.3 1999/11/15 17:16:51 nneul Exp $ + * $Id: packet-mount.c,v 1.4 1999/11/16 11:42:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -41,6 +41,7 @@ static int proto_mount = -1; static int hf_mount_path = -1; +static gint ett_mount = -1; int dissect_mount_dirpath_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) @@ -100,12 +101,16 @@ proto_register_mount(void) "Path", "mount.path", FT_STRING, BASE_DEC, NULL, 0, "Path" }}, }; + static gint *ett[] = { + &ett_mount, + }; proto_mount = proto_register_protocol("Mount Service", "mount"); proto_register_field_array(proto_mount, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_mount, MOUNT_PROGRAM, ETT_MOUNT); + rpc_init_prog(proto_mount, MOUNT_PROGRAM, ett_mount); /* Register the procedure tables */ rpc_init_proc_table(MOUNT_PROGRAM, 1, mount1_proc); rpc_init_proc_table(MOUNT_PROGRAM, 3, mount3_proc); diff --git a/packet-nbipx.c b/packet-nbipx.c index ade2aed1e6..38be514e55 100644 --- a/packet-nbipx.c +++ b/packet-nbipx.c @@ -2,7 +2,7 @@ * Routines for NetBIOS over IPX packet disassembly * Gilbert Ramirez * - * $Id: packet-nbipx.c,v 1.14 1999/09/03 03:22:19 guy Exp $ + * $Id: packet-nbipx.c,v 1.15 1999/11/16 11:42:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -39,6 +39,9 @@ static int proto_nbipx = -1; +static gint ett_nbipx = -1; +static gint ett_nbipx_name_type_flags = -1; + enum nbipx_protocol { NETBIOS_NETWARE, NETBIOS_NWLINK @@ -184,14 +187,14 @@ dissect_nbipx_ns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { ti = proto_tree_add_item(tree, proto_nbipx, offset, 50, NULL); - nbipx_tree = proto_item_add_subtree(ti, ETT_NBIPX); + nbipx_tree = proto_item_add_subtree(ti, ett_nbipx); add_routers(nbipx_tree, pd, offset); tf = proto_tree_add_text(nbipx_tree, offset+32, 1, "Name type flag: 0x%02x", name_type_flag); name_type_flag_tree = proto_item_add_subtree(tf, - ETT_NBIPX_NAME_TYPE_FLAGS); + ett_nbipx_name_type_flags); proto_tree_add_text(name_type_flag_tree, offset+32, 1, "%s", decode_boolean_bitfield(name_type_flag, 0x80, 8, @@ -236,7 +239,7 @@ dissect_nbipx_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { ti = proto_tree_add_item(tree, proto_nbipx, offset, 2+16+16, NULL); - nbipx_tree = proto_item_add_subtree(ti, ETT_NBIPX); + nbipx_tree = proto_item_add_subtree(ti, ett_nbipx); proto_tree_add_text(nbipx_tree, offset, 1, "Connection control: 0x%02x", pd[offset]); @@ -322,7 +325,7 @@ dissect_nwlink_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { ti = proto_tree_add_item(tree, proto_nbipx, offset, 68, NULL); - nbipx_tree = proto_item_add_subtree(ti, ETT_NBIPX); + nbipx_tree = proto_item_add_subtree(ti, ett_nbipx); add_routers(nbipx_tree, pd, offset); @@ -336,7 +339,7 @@ dissect_nwlink_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree "Name type flag: 0x%02x", name_type_flag); name_type_flag_tree = proto_item_add_subtree(tf, - ETT_NBIPX_NAME_TYPE_FLAGS); + ett_nbipx_name_type_flags); proto_tree_add_text(name_type_flag_tree, offset+32, 1, "%s", decode_boolean_bitfield(name_type_flag, 0x80, 8, @@ -401,7 +404,12 @@ proto_register_nbipx(void) { &variable, { "Name", "nbipx.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_nbipx, + &ett_nbipx_name_type_flags, + }; proto_nbipx = proto_register_protocol("NetBIOS over IPX", "nbipx"); /* proto_register_field_array(proto_nbipx, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-nbns.c b/packet-nbns.c index a979ac9093..48bca058f1 100644 --- a/packet-nbns.c +++ b/packet-nbns.c @@ -4,7 +4,7 @@ * Gilbert Ramirez * Much stuff added by Guy Harris * - * $Id: packet-nbns.c,v 1.32 1999/11/08 09:16:52 guy Exp $ + * $Id: packet-nbns.c,v 1.33 1999/11/16 11:42:39 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -51,6 +51,15 @@ static int hf_nbns_count_answers = -1; static int hf_nbns_count_auth_rr = -1; static int hf_nbns_count_add_rr = -1; +static gint ett_nbns = -1; +static gint ett_nbns_qd = -1; +static gint ett_nbns_flags = -1; +static gint ett_nbns_nb_flags = -1; +static gint ett_nbns_name_flags = -1; +static gint ett_nbns_rr = -1; +static gint ett_nbns_qry = -1; +static gint ett_nbns_ans = -1; + static int proto_nbdgm = -1; static int hf_nbdgm_type = -1; static int hf_nbdgm_fragment = -1; @@ -60,10 +69,15 @@ static int hf_nbdgm_datagram_id = -1; static int hf_nbdgm_src_ip = -1; static int hf_nbdgm_src_port = -1; +static gint ett_nbdgm = -1; + static int proto_nbss = -1; static int hf_nbss_type = -1; static int hf_nbss_flags = -1; +static gint ett_nbss = -1; +static gint ett_nbss_flags = -1; + /* Packet structure taken from RFC 1002. See also RFC 1001. * Opcode, flags, and rcode treated as "flags", similarly to DNS, * to make it easier to lift the dissection code from "packet-dns.c". */ @@ -339,7 +353,7 @@ dissect_nbns_query(const u_char *pd, int offset, int nbns_data_offset, if (nbns_tree != NULL) { tq = proto_tree_add_text(nbns_tree, offset, len, "%s: type %s, class %s", name, type_name, class_name); - q_tree = proto_item_add_subtree(tq, ETT_NBNS_QD); + q_tree = proto_item_add_subtree(tq, ett_nbns_qd); add_name_and_type(q_tree, offset, name_len, "Name", name, name_type); @@ -384,7 +398,7 @@ nbns_add_nbns_flags(proto_tree *nbns_tree, int offset, u_short flags, } tf = proto_tree_add_text(nbns_tree, offset, 2, "Flags: 0x%04x (%s)", flags, buf); - field_tree = proto_item_add_subtree(tf, ETT_NBNS_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_nbns_flags); proto_tree_add_text(field_tree, offset, 2, "%s", decode_boolean_bitfield(flags, F_RESPONSE, 2*8, "Response", "Query")); @@ -454,7 +468,7 @@ nbns_add_nb_flags(proto_tree *rr_tree, int offset, u_short flags) strcat(buf, "unique"); tf = proto_tree_add_text(rr_tree, offset, 2, "Flags: 0x%x (%s)", flags, buf); - field_tree = proto_item_add_subtree(tf, ETT_NBNS_NB_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_nbns_nb_flags); proto_tree_add_text(field_tree, offset, 2, "%s", decode_boolean_bitfield(flags, NB_FLAGS_G, 2*8, @@ -495,7 +509,7 @@ nbns_add_name_flags(proto_tree *rr_tree, int offset, u_short flags) strcat(buf, ", permanent node name"); tf = proto_tree_add_text(rr_tree, offset, 2, "Name flags: 0x%x (%s)", flags, buf); - field_tree = proto_item_add_subtree(tf, ETT_NBNS_NAME_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_nbns_name_flags); proto_tree_add_text(field_tree, offset, 2, "%s", decode_boolean_bitfield(flags, NAME_FLAGS_G, 2*8, @@ -599,7 +613,7 @@ dissect_nbns_answer(const u_char *pd, int offset, int nbns_data_offset, strcat(name, " ("); strcat(name, netbios_name_type_descr(name_type)); strcat(name, ")"); - rr_tree = add_rr_to_tree(trr, ETT_NBNS_RR, offset, name, + rr_tree = add_rr_to_tree(trr, ett_nbns_rr, offset, name, name_len, type_name, class_name, ttl, data_len); while (data_len > 0) { if (opcode == OPCODE_WACK) { @@ -668,7 +682,7 @@ dissect_nbns_answer(const u_char *pd, int offset, int nbns_data_offset, (dptr - data_start) + data_len, "%s: type %s, class %s", name, type_name, class_name); - rr_tree = add_rr_to_tree(trr, ETT_NBNS_RR, offset, name, + rr_tree = add_rr_to_tree(trr, ett_nbns_rr, offset, name, name_len, type_name, class_name, ttl, data_len); if (!BYTES_ARE_IN_FRAME(cur_offset, 1)) { /* We ran past the end of the captured @@ -1026,7 +1040,7 @@ dissect_nbns_answer(const u_char *pd, int offset, int nbns_data_offset, (dptr - data_start) + data_len, "%s: type %s, class %s", name, type_name, class_name); - rr_tree = add_rr_to_tree(trr, ETT_NBNS_RR, offset, name, + rr_tree = add_rr_to_tree(trr, ett_nbns_rr, offset, name, name_len, type_name, class_name, ttl, data_len); proto_tree_add_text(rr_tree, cur_offset, data_len, "Data"); break; @@ -1047,7 +1061,7 @@ dissect_query_records(const u_char *pd, int cur_off, int nbns_data_offset, start_off = cur_off; if (nbns_tree != NULL) { ti = proto_tree_add_text(nbns_tree, start_off, 0, "Queries"); - qatree = proto_item_add_subtree(ti, ETT_NBNS_QRY); + qatree = proto_item_add_subtree(ti, ett_nbns_qry); } while (count-- > 0) { add_off = dissect_nbns_query(pd, cur_off, nbns_data_offset, @@ -1078,7 +1092,7 @@ dissect_answer_records(const u_char *pd, int cur_off, int nbns_data_offset, start_off = cur_off; if (nbns_tree != NULL) { ti = proto_tree_add_text(nbns_tree, start_off, 0, name); - qatree = proto_item_add_subtree(ti, ETT_NBNS_ANS); + qatree = proto_item_add_subtree(ti, ett_nbns_ans); } while (count-- > 0) { add_off = dissect_nbns_answer(pd, cur_off, nbns_data_offset, @@ -1139,7 +1153,7 @@ dissect_nbns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_nbns, offset, END_OF_FRAME, NULL); - nbns_tree = proto_item_add_subtree(ti, ETT_NBNS); + nbns_tree = proto_item_add_subtree(ti, ett_nbns); if (flags & F_RESPONSE) { proto_tree_add_item_hidden(nbns_tree, hf_nbns_response, @@ -1297,7 +1311,7 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_nbdgm, offset, header.dgm_length, NULL); - nbdgm_tree = proto_item_add_subtree(ti, ETT_NBDGM); + nbdgm_tree = proto_item_add_subtree(ti, ett_nbdgm); proto_tree_add_item_format(nbdgm_tree, hf_nbdgm_type, offset, 1, @@ -1449,7 +1463,7 @@ dissect_nbss_packet(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { ti = proto_tree_add_item(tree, proto_nbss, offset, length + 4, NULL); - nbss_tree = proto_item_add_subtree(ti, ETT_NBSS); + nbss_tree = proto_item_add_subtree(ti, ett_nbss); proto_tree_add_item_format(nbss_tree, hf_nbss_type, offset, 1, @@ -1463,7 +1477,7 @@ dissect_nbss_packet(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { tf = proto_tree_add_item(nbss_tree, hf_nbss_flags, offset, 1, flags); - field_tree = proto_item_add_subtree(tf, ETT_NBSS_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_nbss_flags); proto_tree_add_text(field_tree, offset, 1, "%s", decode_boolean_bitfield(flags, NBSS_FLAGS_E, 8, "Add 65536 to length", "Add 0 to length")); @@ -1665,6 +1679,19 @@ proto_register_nbt(void) FT_UINT8, BASE_HEX, NULL, 0x0, "NBSS message flags" }} }; + static gint *ett[] = { + &ett_nbns, + &ett_nbns_qd, + &ett_nbns_flags, + &ett_nbns_nb_flags, + &ett_nbns_name_flags, + &ett_nbns_rr, + &ett_nbns_qry, + &ett_nbns_ans, + &ett_nbdgm, + &ett_nbss, + &ett_nbss_flags, + }; proto_nbns = proto_register_protocol("NetBIOS Name Service", "nbns"); proto_register_field_array(proto_nbns, hf_nbns, array_length(hf_nbns)); @@ -1675,4 +1702,5 @@ proto_register_nbt(void) proto_nbss = proto_register_protocol("NetBIOS Session Service", "nbss"); proto_register_field_array(proto_nbss, hf_nbss, array_length(hf_nbss)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ncp.c b/packet-ncp.c index 65a7a6ef18..6d6b62591f 100644 --- a/packet-ncp.c +++ b/packet-ncp.c @@ -2,7 +2,7 @@ * Routines for NetWare Core Protocol * Gilbert Ramirez * - * $Id: packet-ncp.c,v 1.20 1999/10/17 14:09:35 deniel Exp $ + * $Id: packet-ncp.c,v 1.21 1999/11/16 11:42:40 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -49,6 +49,10 @@ static int hf_ncp_seq = -1; static int hf_ncp_connection = -1; static int hf_ncp_task = -1; +static gint ett_ncp = -1; +static gint ett_ncp_request_fields = -1; +static gint ett_ncp_reply_fields = -1; + struct svc_record; static void @@ -455,7 +459,7 @@ dissect_ncp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_ncp, offset, END_OF_FRAME, NULL); - ncp_tree = proto_item_add_subtree(ti, ETT_NCP); + ncp_tree = proto_item_add_subtree(ti, ett_ncp); proto_tree_add_item_format(ncp_tree, hf_ncp_type, offset, 2, @@ -536,7 +540,7 @@ dissect_ncp_request(const u_char *pd, int offset, frame_data *fd, if (ncp_request->req) { ti = proto_tree_add_text(ncp_tree, offset, END_OF_FRAME, "NCP Request Packet"); - field_tree = proto_item_add_subtree(ti, ETT_NCP_REQUEST_FIELDS); + field_tree = proto_item_add_subtree(ti, ett_ncp_request_fields); parse_ncp_svc_fields(pd, field_tree, offset, ncp_request->req); } @@ -621,7 +625,7 @@ dissect_ncp_reply(const u_char *pd, int offset, frame_data *fd, if (ncp_request->rep) { ti = proto_tree_add_text(ncp_tree, offset+8, END_OF_FRAME, "NCP Reply Packet"); - field_tree = proto_item_add_subtree(ti, ETT_NCP_REPLY_FIELDS); + field_tree = proto_item_add_subtree(ti, ett_ncp_reply_fields); parse_ncp_svc_fields(pd, field_tree, offset+8, ncp_request->rep); } @@ -878,8 +882,13 @@ proto_register_ncp(void) FT_UINT8, BASE_DEC, NULL, 0x0, "" }} }; + static gint *ett[] = { + &ett_ncp, + &ett_ncp_request_fields, + &ett_ncp_reply_fields, + }; proto_ncp = proto_register_protocol("NetWare Core Protocol", "ncp"); proto_register_field_array(proto_ncp, hf, array_length(hf)); - + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-netbios.c b/packet-netbios.c index f5e73989cc..c065e119de 100644 --- a/packet-netbios.c +++ b/packet-netbios.c @@ -5,7 +5,7 @@ * * derived from the packet-nbns.c * - * $Id: packet-netbios.c,v 1.9 1999/11/15 21:33:57 nneul Exp $ + * $Id: packet-netbios.c,v 1.10 1999/11/16 11:42:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -84,6 +84,11 @@ static int proto_netbios = -1; +static gint ett_netb = -1; +static gint ett_netb_name = -1; +static gint ett_netb_flags = -1; +static gint ett_netb_status = -1; + /* The strings for the station type, used by get_netbios_name function; many of them came from the file "NetBIOS.txt" in the Zip archive at @@ -242,7 +247,7 @@ void netbios_add_name( char* label, const u_char *pd, int offset, tf = proto_tree_add_text( tree, offset + nb_offset, NETBIOS_NAME_LEN, "%s: %s<%02x> (%s)", label, name_str, name_type, name_type_str); - field_tree = proto_item_add_subtree( tf, ETT_NETB_NAME); + field_tree = proto_item_add_subtree( tf, ett_netb_name); proto_tree_add_text( field_tree, offset + nb_offset, 15, "%s", name_str); @@ -262,7 +267,7 @@ static void netbios_data_first_middle_flags( const u_char *pd, proto_tree *tree, tf = proto_tree_add_text( tree, offset, 1, "Flags: 0x%02x", flags); - field_tree = proto_item_add_subtree(tf, ETT_NETB_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_netb_flags); proto_tree_add_text(field_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x08, 8, @@ -288,7 +293,7 @@ static void netbios_data_only_flags( const u_char *pd, proto_tree *tree, tf = proto_tree_add_text( tree, offset, 1, "Flags: 0x%02x", flags); - field_tree = proto_item_add_subtree(tf, ETT_NETB_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_netb_flags); proto_tree_add_text(field_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x08, 8, @@ -314,7 +319,7 @@ static void netbios_add_ses_confirm_flags( const u_char *pd, proto_tree *tree, tf = proto_tree_add_text( tree, offset, 1, "Flags: 0x%02x", flags); - field_tree = proto_item_add_subtree( tf, ETT_NETB_FLAGS); + field_tree = proto_item_add_subtree( tf, ett_netb_flags); proto_tree_add_text(field_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x80, 8, @@ -336,7 +341,7 @@ static void netbios_add_session_init_flags( const u_char *pd, proto_tree *tree, tf = proto_tree_add_text( tree, offset, 1, "Flags: 0x%02x", flags); - field_tree = proto_item_add_subtree(tf, ETT_NETB_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_netb_flags); proto_tree_add_text(field_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x80, 8, @@ -365,7 +370,7 @@ static void netbios_no_receive_flags( const u_char *pd, proto_tree *tree, "Flags: 0x%02x", flags); if (flags & 0x02) { - field_tree = proto_item_add_subtree(tf, ETT_NETB_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_netb_flags); proto_tree_add_text(field_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x02, 8, "SEND.NO.ACK data not received", NULL)); @@ -734,7 +739,7 @@ static void dissect_netb_status_resp(const u_char *data_ptr, int offset, data2 = pletohs(data_ptr + NB_DATA2); td2 = proto_tree_add_text(tree, offset + NB_DATA2, 2, "Status: 0x04x", data2); - data2_tree = proto_item_add_subtree(td2, ETT_NETB_STATUS); + data2_tree = proto_item_add_subtree(td2, ett_netb_status); if (data2 & 0x8000) { proto_tree_add_text(data2_tree, offset, 2, "%s", decode_boolean_bitfield(data2, 0x8000, 8*2, @@ -973,7 +978,7 @@ void dissect_netbios(const u_char *pd, int offset, frame_data *fd, if (tree) { ti = proto_tree_add_item(tree, proto_netbios, offset, END_OF_FRAME, NULL); - netb_tree = proto_item_add_subtree(ti, ETT_NETB); + netb_tree = proto_item_add_subtree(ti, ett_netb); proto_tree_add_text( netb_tree, offset, END_OF_FRAME, "Data (%u bytes)", @@ -1019,7 +1024,7 @@ void dissect_netbios(const u_char *pd, int offset, frame_data *fd, if (tree) { ti = proto_tree_add_item(tree, proto_netbios, offset, END_OF_FRAME, NULL); - netb_tree = proto_item_add_subtree(ti, ETT_NETB); + netb_tree = proto_item_add_subtree(ti, ett_netb); proto_tree_add_text(netb_tree, offset, 2, "Header Length: %d", hdr_len); @@ -1059,6 +1064,13 @@ void dissect_netbios(const u_char *pd, int offset, frame_data *fd, void proto_register_netbios(void) { + static gint *ett[] = { + &ett_netb, + &ett_netb_name, + &ett_netb_flags, + &ett_netb_status, + }; proto_netbios = proto_register_protocol("NetBIOS", "netbios"); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-nfs.c b/packet-nfs.c index e5d1c96244..ea79be8960 100644 --- a/packet-nfs.c +++ b/packet-nfs.c @@ -2,7 +2,7 @@ * Routines for nfs dissection * Copyright 1999, Uwe Girlich * - * $Id: packet-nfs.c,v 1.4 1999/11/15 14:32:15 nneul Exp $ + * $Id: packet-nfs.c,v 1.5 1999/11/16 11:42:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -41,6 +41,30 @@ static int proto_nfs = -1; +static gint ett_nfs = -1; +static gint ett_nfs_fhandle = -1; +static gint ett_nfs_timeval = -1; +static gint ett_nfs_mode = -1; +static gint ett_nfs_fattr = -1; +static gint ett_nfs_sattr = -1; +static gint ett_nfs_mode3 = -1; +static gint ett_nfs_specdata3 = -1; +static gint ett_nfs_fh3 = -1; +static gint ett_nfs_nfstime3 = -1; +static gint ett_nfs_fattr3 = -1; +static gint ett_nfs_sattr3 = -1; +static gint ett_nfs_sattrguard3 = -1; +static gint ett_nfs_set_mode3 = -1; +static gint ett_nfs_set_uid3 = -1; +static gint ett_nfs_set_gid3 = -1; +static gint ett_nfs_set_size3 = -1; +static gint ett_nfs_set_atime = -1; +static gint ett_nfs_set_mtime = -1; +static gint ett_nfs_pre_op_attr = -1; +static gint ett_nfs_post_op_attr = -1; +static gint ett_nfs_wcc_attr = -1; +static gint ett_nfs_wcc_data = -1; + /***************************/ /* NFS Version 2, RFC 1094 */ @@ -147,7 +171,7 @@ dissect_fhandle(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, fitem = proto_tree_add_text(tree, offset, FHSIZE, "%s", name); if (fitem) - ftree = proto_item_add_subtree(fitem, ETT_NFS_FHANDLE); + ftree = proto_item_add_subtree(fitem, ett_nfs_fhandle); } if (ftree) { @@ -177,7 +201,7 @@ dissect_timeval(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, time_item = proto_tree_add_text(tree, offset, 8, "%s: %u.%06u", name, seconds, mseconds); if (time_item) - time_tree = proto_item_add_subtree(time_item, ETT_NFS_TIMEVAL); + time_tree = proto_item_add_subtree(time_item, ett_nfs_timeval); } if (time_tree) { @@ -216,7 +240,7 @@ char* name) mode_item = proto_tree_add_text(tree, offset, 4, "%s: 0%o", name, mode); if (mode_item) - mode_tree = proto_item_add_subtree(mode_item, ETT_NFS_MODE); + mode_tree = proto_item_add_subtree(mode_item, ett_nfs_mode); } if (mode_tree) { @@ -266,7 +290,7 @@ dissect_fattr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, ch fattr_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s", name); if (fattr_item) - fattr_tree = proto_item_add_subtree(fattr_item, ETT_NFS_FATTR); + fattr_tree = proto_item_add_subtree(fattr_item, ett_nfs_fattr); } offset = dissect_ftype (pd,offset,fd,fattr_tree,"type"); @@ -305,7 +329,7 @@ dissect_sattr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, ch sattr_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s", name); if (sattr_item) - sattr_tree = proto_item_add_subtree(sattr_item, ETT_NFS_SATTR); + sattr_tree = proto_item_add_subtree(sattr_item, ett_nfs_sattr); } /* some how we should indicate here, that -1 means "do not set" */ @@ -520,7 +544,7 @@ char* name) mode3_item = proto_tree_add_text(tree, offset, 4, "%s: 0%o", name, mode3); if (mode3_item) - mode3_tree = proto_item_add_subtree(mode3_item, ETT_NFS_MODE3); + mode3_tree = proto_item_add_subtree(mode3_item, ett_nfs_mode3); } /* RFC 1813, Page 23 */ @@ -680,7 +704,7 @@ dissect_specdata3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree "%s: %u,%u", name, specdata1, specdata2); if (specdata3_item) specdata3_tree = proto_item_add_subtree(specdata3_item, - ETT_NFS_SPECDATA3); + ett_nfs_specdata3); } if (specdata3_tree) { @@ -713,7 +737,7 @@ dissect_nfs_fh3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, fitem = proto_tree_add_text(tree, offset, 4+fh_len_full, "%s", name); if (fitem) - ftree = proto_item_add_subtree(fitem, ETT_NFS_FH3); + ftree = proto_item_add_subtree(fitem, ett_nfs_fh3); } if (ftree) { @@ -748,7 +772,7 @@ dissect_nfstime3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, time_item = proto_tree_add_text(tree, offset, 8, "%s: %u.%09u", name, seconds, nseconds); if (time_item) - time_tree = proto_item_add_subtree(time_item, ETT_NFS_NFSTIME3); + time_tree = proto_item_add_subtree(time_item, ett_nfs_nfstime3); } if (time_tree) { @@ -774,7 +798,7 @@ dissect_fattr3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, c fattr3_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s", name); if (fattr3_item) - fattr3_tree = proto_item_add_subtree(fattr3_item, ETT_NFS_FATTR3); + fattr3_tree = proto_item_add_subtree(fattr3_item, ett_nfs_fattr3); } offset = dissect_ftype3 (pd,offset,fd,fattr3_tree,"type"); @@ -821,7 +845,7 @@ dissect_post_op_attr(const u_char *pd, int offset, frame_data *fd, proto_tree *t post_op_attr_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s", name); if (post_op_attr_item) - post_op_attr_tree = proto_item_add_subtree(post_op_attr_item, ETT_NFS_POST_OP_ATTR); + post_op_attr_tree = proto_item_add_subtree(post_op_attr_item, ett_nfs_post_op_attr); } if (!BYTES_ARE_IN_FRAME(offset,4)) return offset; @@ -861,7 +885,7 @@ dissect_wcc_attr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, wcc_attr_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s", name); if (wcc_attr_item) - wcc_attr_tree = proto_item_add_subtree(wcc_attr_item, ETT_NFS_WCC_ATTR); + wcc_attr_tree = proto_item_add_subtree(wcc_attr_item, ett_nfs_wcc_attr); } offset = dissect_size3 (pd, offset, fd, wcc_attr_tree, "size" ); @@ -890,7 +914,7 @@ dissect_pre_op_attr(const u_char *pd, int offset, frame_data *fd, proto_tree *tr pre_op_attr_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s", name); if (pre_op_attr_item) - pre_op_attr_tree = proto_item_add_subtree(pre_op_attr_item, ETT_NFS_PRE_OP_ATTR); + pre_op_attr_tree = proto_item_add_subtree(pre_op_attr_item, ett_nfs_pre_op_attr); } if (!BYTES_ARE_IN_FRAME(offset,4)) return offset; @@ -930,7 +954,7 @@ dissect_wcc_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, wcc_data_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s", name); if (wcc_data_item) - wcc_data_tree = proto_item_add_subtree(wcc_data_item, ETT_NFS_WCC_DATA); + wcc_data_tree = proto_item_add_subtree(wcc_data_item, ett_nfs_wcc_data); } offset = dissect_pre_op_attr (pd, offset, fd, wcc_data_tree, "before"); @@ -963,7 +987,7 @@ dissect_set_mode3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree set_mode3_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s: %s", name, set_it_name); if (set_mode3_item) - set_mode3_tree = proto_item_add_subtree(set_mode3_item, ETT_NFS_SET_MODE3); + set_mode3_tree = proto_item_add_subtree(set_mode3_item, ett_nfs_set_mode3); } if (set_mode3_tree) @@ -1009,7 +1033,7 @@ dissect_set_uid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, set_uid3_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s: %s", name, set_it_name); if (set_uid3_item) - set_uid3_tree = proto_item_add_subtree(set_uid3_item, ETT_NFS_SET_UID3); + set_uid3_tree = proto_item_add_subtree(set_uid3_item, ett_nfs_set_uid3); } if (set_uid3_tree) @@ -1055,7 +1079,7 @@ dissect_set_gid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, set_gid3_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s: %s", name, set_it_name); if (set_gid3_item) - set_gid3_tree = proto_item_add_subtree(set_gid3_item, ETT_NFS_SET_GID3); + set_gid3_tree = proto_item_add_subtree(set_gid3_item, ett_nfs_set_gid3); } if (set_gid3_tree) @@ -1101,7 +1125,7 @@ dissect_set_size3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree set_size3_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s: %s", name, set_it_name); if (set_size3_item) - set_size3_tree = proto_item_add_subtree(set_size3_item, ETT_NFS_SET_SIZE3); + set_size3_tree = proto_item_add_subtree(set_size3_item, ett_nfs_set_size3); } if (set_size3_tree) @@ -1162,7 +1186,7 @@ dissect_set_atime(const u_char *pd, int offset, frame_data *fd, proto_tree *tree END_OF_FRAME, "%s: %s", name, set_it_name, set_it); if (set_atime_item) - set_atime_tree = proto_item_add_subtree(set_atime_item, ETT_NFS_SET_ATIME); + set_atime_tree = proto_item_add_subtree(set_atime_item, ett_nfs_set_atime); } if (set_atime_tree) @@ -1210,7 +1234,7 @@ dissect_set_mtime(const u_char *pd, int offset, frame_data *fd, proto_tree *tree END_OF_FRAME, "%s: %s", name, set_it_name, set_it); if (set_mtime_item) - set_mtime_tree = proto_item_add_subtree(set_mtime_item, ETT_NFS_SET_MTIME); + set_mtime_tree = proto_item_add_subtree(set_mtime_item, ett_nfs_set_mtime); } if (set_mtime_tree) @@ -1251,7 +1275,7 @@ dissect_sattr3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, c sattr3_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s", name); if (sattr3_item) - sattr3_tree = proto_item_add_subtree(sattr3_item, ETT_NFS_SATTR3); + sattr3_tree = proto_item_add_subtree(sattr3_item, ett_nfs_sattr3); } offset = dissect_set_mode3(pd, offset, fd, sattr3_tree, "mode"); @@ -1339,7 +1363,7 @@ dissect_sattrguard3(const u_char* pd, int offset, frame_data* fd, proto_tree* tr sattrguard3_item = proto_tree_add_text(tree, offset, END_OF_FRAME, "%s: %s", name, check_name); if (sattrguard3_item) - sattrguard3_tree = proto_item_add_subtree(sattrguard3_item, ETT_NFS_SATTRGUARD3); + sattrguard3_tree = proto_item_add_subtree(sattrguard3_item, ett_nfs_sattrguard3); } if (sattrguard3_tree) @@ -1431,12 +1455,37 @@ const vsff nfs3_proc[] = { void proto_register_nfs(void) { + static gint *ett[] = { + &ett_nfs, + &ett_nfs_fhandle, + &ett_nfs_timeval, + &ett_nfs_mode, + &ett_nfs_fattr, + &ett_nfs_sattr, + &ett_nfs_mode3, + &ett_nfs_specdata3, + &ett_nfs_fh3, + &ett_nfs_nfstime3, + &ett_nfs_fattr3, + &ett_nfs_sattr3, + &ett_nfs_sattrguard3, + &ett_nfs_set_mode3, + &ett_nfs_set_uid3, + &ett_nfs_set_gid3, + &ett_nfs_set_size3, + &ett_nfs_set_atime, + &ett_nfs_set_mtime, + &ett_nfs_pre_op_attr, + &ett_nfs_post_op_attr, + &ett_nfs_wcc_attr, + &ett_nfs_wcc_data, + }; proto_nfs = proto_register_protocol("Network File System", "nfs"); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_nfs, NFS_PROGRAM, ETT_NFS); + rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs); /* Register the procedure tables */ rpc_init_proc_table(NFS_PROGRAM, 2, nfs2_proc); rpc_init_proc_table(NFS_PROGRAM, 3, nfs3_proc); } - diff --git a/packet-nlm.c b/packet-nlm.c index 14a2bc32a0..b8f870f6c9 100644 --- a/packet-nlm.c +++ b/packet-nlm.c @@ -1,7 +1,7 @@ /* packet-nlm.c * Routines for nlm dissection * - * $Id: packet-nlm.c,v 1.2 1999/11/15 14:32:16 nneul Exp $ + * $Id: packet-nlm.c,v 1.3 1999/11/16 11:42:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -41,6 +41,7 @@ static int proto_nlm = -1; +static gint ett_nlm = -1; /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: take the generic one. */ @@ -74,10 +75,15 @@ const vsff nlm3_proc[] = { void proto_register_nlm(void) { + static gint *ett[] = { + &ett_nlm, + }; + proto_nlm = proto_register_protocol("Network Lock Manager Protocol", "nlm"); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_nlm, NLM_PROGRAM, ETT_NLM); + rpc_init_prog(proto_nlm, NLM_PROGRAM, ett_nlm); /* Register the procedure table */ rpc_init_proc_table(NLM_PROGRAM, 3, nlm3_proc); } diff --git a/packet-nntp.c b/packet-nntp.c index aa20363bc7..0c77c7751c 100644 --- a/packet-nntp.c +++ b/packet-nntp.c @@ -2,7 +2,7 @@ * Routines for nntp packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-nntp.c,v 1.5 1999/10/17 14:46:40 deniel Exp $ + * $Id: packet-nntp.c,v 1.6 1999/11/16 11:42:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -45,6 +45,8 @@ static int proto_nntp = -1; static int hf_nntp_response = -1; static int hf_nntp_request = -1; +static gint ett_nntp = -1; + void dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -81,7 +83,7 @@ dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_nntp, offset, END_OF_FRAME, NULL); - nntp_tree = proto_item_add_subtree(ti, ETT_NNTP); + nntp_tree = proto_item_add_subtree(ti, ett_nntp); if (pi.match_port == pi.destport) { proto_tree_add_item_hidden(nntp_tree, hf_nntp_request, 0, 0, TRUE); @@ -130,9 +132,12 @@ proto_register_nntp(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if NNTP request" }} }; + static gint *ett[] = { + &ett_nntp, + }; proto_nntp = proto_register_protocol("Network News Transfer Protocol", "nntp"); proto_register_field_array(proto_nntp, hf, array_length(hf)); - + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ntp.c b/packet-ntp.c index c3a813fc46..b511fdbce0 100644 --- a/packet-ntp.c +++ b/packet-ntp.c @@ -2,7 +2,7 @@ * Routines for NTP packet dissection * Copyright 1999, Nathan Neulinger * - * $Id: packet-ntp.c,v 1.4 1999/10/25 20:48:48 guy Exp $ + * $Id: packet-ntp.c,v 1.5 1999/11/16 11:42:43 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -191,6 +191,9 @@ static int hf_ntp_xmt = -1; static int hf_ntp_keyid = -1; static int hf_ntp_mac = -1; +static gint ett_ntp = -1; +static gint ett_ntp_flags = -1; + /* ntm_fmt_ts - converts NTP timestamp to human readable string. * tsdata - 64bit timestamp (IN) * buff - string buffer for result (OUT) @@ -250,11 +253,11 @@ dissect_ntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { /* Adding NTP item and subtree */ ti = proto_tree_add_item(tree, proto_ntp, offset, END_OF_FRAME, NULL); - ntp_tree = proto_item_add_subtree(ti, ETT_NTP); + ntp_tree = proto_item_add_subtree(ti, ett_ntp); tf = proto_tree_add_item(ntp_tree, hf_ntp_flags, offset, 1, pkt->flags); /* Adding flag subtree and items */ - flags_tree = proto_item_add_subtree(tf, ETT_NTP_FLAGS); + flags_tree = proto_item_add_subtree(tf, ett_ntp_flags); proto_tree_add_item_format(flags_tree, hf_ntp_flags_li, offset, 1, *pkt->flags & NTP_LI_MASK, decode_enumerated_bitfield(*pkt->flags, NTP_LI_MASK, @@ -415,7 +418,12 @@ proto_register_ntp(void) "Message Authentication Code", "ntp.mac", FT_BYTES, BASE_HEX, NULL, 0, "Message Authentication Code" }}, }; + static gint *ett[] = { + &ett_ntp, + &ett_ntp_flags, + }; proto_ntp = proto_register_protocol("Network Time Protocol", "ntp"); proto_register_field_array(proto_ntp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-null.c b/packet-null.c index fb68fb40ab..3eaf2682ee 100644 --- a/packet-null.c +++ b/packet-null.c @@ -1,7 +1,7 @@ /* packet-null.c * Routines for null packet disassembly * - * $Id: packet-null.c,v 1.16 1999/10/12 06:20:12 gram Exp $ + * $Id: packet-null.c,v 1.17 1999/11/16 11:42:43 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -48,6 +48,8 @@ static int proto_null = -1; static int hf_null_etype = -1; static int hf_null_family = -1; +static gint ett_null = -1; + /* Null/loopback structs and definitions */ /* Macro to byte-swap 32-bit quantities. */ @@ -260,7 +262,7 @@ dissect_null( const u_char *pd, frame_data *fd, proto_tree *tree ) if (null_header > IEEE_802_3_MAX_LEN) { if (tree) { ti = proto_tree_add_item(tree, proto_null, 0, 4, NULL); - fh_tree = proto_item_add_subtree(ti, ETT_NULL); + fh_tree = proto_item_add_subtree(ti, ett_null); } else fh_tree = NULL; ethertype(null_header, 4, pd, fd, tree, fh_tree, hf_null_etype); @@ -269,7 +271,7 @@ dissect_null( const u_char *pd, frame_data *fd, proto_tree *tree ) layer (ie none) */ if (tree) { ti = proto_tree_add_item(tree, proto_null, 0, 4, NULL); - fh_tree = proto_item_add_subtree(ti, ETT_NULL); + fh_tree = proto_item_add_subtree(ti, ett_null); proto_tree_add_item(fh_tree, hf_null_family, 0, 4, null_header); } @@ -318,7 +320,11 @@ proto_register_null(void) { "Family", "null.family", FT_UINT32, BASE_HEX, VALS(family_vals), 0x0, "" }} }; + static gint *ett[] = { + &ett_null, + }; proto_null = proto_register_protocol ("Null/Loopback", "null" ); proto_register_field_array(proto_null, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-osi.c b/packet-osi.c index 5c5bbd737f..f1246d5869 100644 --- a/packet-osi.c +++ b/packet-osi.c @@ -1,7 +1,7 @@ /* packet-osi.c * Routines for ISO/OSI network and transport protocol packet disassembly * - * $Id: packet-osi.c,v 1.11 1999/10/12 06:20:12 gram Exp $ + * $Id: packet-osi.c,v 1.12 1999/11/16 11:42:44 guy Exp $ * Laurent Deniel * * Ethereal - Network traffic analyzer @@ -61,8 +61,12 @@ static int hf_clnp_dest = -1; static int hf_clnp_src_length = -1; static int hf_clnp_src = -1; +static gint ett_clnp = -1; + static int proto_cotp = -1; +static gint ett_cotp = -1; + /* Network layer protocol identifiers */ #define ISO8473_CLNP 0x81 @@ -264,7 +268,7 @@ static int osi_decode_DR(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -356,7 +360,7 @@ static int osi_decode_DT(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -491,7 +495,7 @@ static int osi_decode_ED(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -574,7 +578,7 @@ static int osi_decode_RJ(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -662,7 +666,7 @@ static int osi_decode_CC(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -934,7 +938,7 @@ static int osi_decode_DC(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -987,7 +991,7 @@ static int osi_decode_AK(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -1093,7 +1097,7 @@ static int osi_decode_AK(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -1246,7 +1250,7 @@ static int osi_decode_EA(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -1331,7 +1335,7 @@ static int osi_decode_ER(const u_char *pd, int offset, if (tree) { ti = proto_tree_add_item(tree, proto_cotp, offset, li + 1, NULL); - cotp_tree = proto_item_add_subtree(ti, ETT_COTP); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); proto_tree_add_text(cotp_tree, offset, 1, "Length indicator: %d", li); proto_tree_add_text(cotp_tree, offset + 1, 1, @@ -1470,7 +1474,7 @@ void dissect_clnp(const u_char *pd, int offset, frame_data *fd, if (tree) { ti = proto_tree_add_item(tree, proto_clnp, offset, clnp.cnf_hdr_len, NULL); - clnp_tree = proto_item_add_subtree(ti, ETT_CLNP); + clnp_tree = proto_item_add_subtree(ti, ett_clnp); proto_tree_add_item_format(clnp_tree, hf_clnp_id, offset, 1, clnp.cnf_proto_id, "Protocol identifier: 0x%02x", @@ -1676,9 +1680,13 @@ void proto_register_clnp(void) { "Source address", "clnp.ssap", FT_BYTES, BASE_NONE, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_clnp, + }; proto_clnp = proto_register_protocol("ISO CLNP", "clnp"); proto_register_field_array(proto_clnp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } void proto_register_cotp(void) @@ -1687,7 +1695,11 @@ void proto_register_cotp(void) { &variable, { "Name", "cotp.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_cotp, + }; proto_cotp = proto_register_protocol("ISO COTP", "cotp"); /* proto_register_field_array(proto_cotp, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ospf.c b/packet-ospf.c index 1179e46dd3..81a08b6aae 100644 --- a/packet-ospf.c +++ b/packet-ospf.c @@ -2,7 +2,7 @@ * Routines for OSPF packet disassembly * (c) Copyright Hannes R. Boehm * - * $Id: packet-ospf.c,v 1.15 1999/10/27 03:10:37 guy Exp $ + * $Id: packet-ospf.c,v 1.16 1999/11/16 11:42:45 guy Exp $ * * At this time, this module is able to analyze OSPF * packets as specified in RFC2328. MOSPF (RFC1584) and other @@ -52,6 +52,14 @@ static int proto_ospf = -1; +static gint ett_ospf = -1; +static gint ett_ospf_hdr = -1; +static gint ett_ospf_hello = -1; +static gint ett_ospf_desc = -1; +static gint ett_ospf_lsr = -1; +static gint ett_ospf_lsa = -1; +static gint ett_ospf_lsa_upd = -1; + void dissect_ospf(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { e_ospfhdr ospfh; @@ -84,10 +92,10 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_ospf, offset, ntohs(ospfh.length), NULL); - ospf_tree = proto_item_add_subtree(ti, ETT_OSPF); + ospf_tree = proto_item_add_subtree(ti, ett_ospf); ti = proto_tree_add_text(ospf_tree, offset, OSPF_HEADER_LENGTH, "OSPF Header"); - ospf_header_tree = proto_item_add_subtree(ti, ETT_OSPF_HDR); + ospf_header_tree = proto_item_add_subtree(ti, ett_ospf_hdr); proto_tree_add_text(ospf_header_tree, offset, 1, "OSPF Version: %d", ospfh.version); proto_tree_add_text(ospf_header_tree, offset + 1 , 1, "OSPF Packet Type: %d (%s)", @@ -188,7 +196,7 @@ dissect_ospf_hello(const u_char *pd, int offset, frame_data *fd, proto_tree *tre if (tree) { ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "OSPF Hello Packet"); - ospf_hello_tree = proto_item_add_subtree(ti, ETT_OSPF_HELLO); + ospf_hello_tree = proto_item_add_subtree(ti, ett_ospf_hello); proto_tree_add_text(ospf_hello_tree, offset , 4, "Network Mask: %s", ip_to_str((guint8 *) &ospfhello.network_mask)); @@ -248,7 +256,7 @@ dissect_ospf_db_desc(const u_char *pd, int offset, frame_data *fd, proto_tree *t if (tree) { ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "OSPF DB Description"); - ospf_db_desc_tree = proto_item_add_subtree(ti, ETT_OSPF_DESC); + ospf_db_desc_tree = proto_item_add_subtree(ti, ett_ospf_desc); proto_tree_add_text(ospf_db_desc_tree, offset, 2, "Interface MTU: %d", ntohs(ospf_dbd.interface_mtu) ); @@ -318,7 +326,7 @@ dissect_ospf_ls_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tr while( ((int) (pi.captured_len - offset)) >= OSPF_LS_REQ_LENGTH ){ memcpy(&ospf_lsr, &pd[offset], sizeof(e_ospf_ls_req)); ti = proto_tree_add_text(tree, offset, OSPF_LS_REQ_LENGTH, "Link State Request"); - ospf_lsr_tree = proto_item_add_subtree(ti, ETT_OSPF_LSR); + ospf_lsr_tree = proto_item_add_subtree(ti, ett_ospf_lsr); switch( ntohl( ospf_lsr.ls_type ) ){ case OSPF_LSTYPE_ROUTER: @@ -367,7 +375,7 @@ dissect_ospf_ls_upd(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "LS Update Packet"); - ospf_lsa_upd_tree = proto_item_add_subtree(ti, ETT_OSPF_LSA_UPD); + ospf_lsa_upd_tree = proto_item_add_subtree(ti, ett_ospf_lsa_upd); proto_tree_add_text(ospf_lsa_upd_tree, offset, 4, "Nr oF LSAs: %ld", (long)ntohl(upd_hdr.lsa_nr) ); } @@ -451,7 +459,7 @@ dissect_ospf_lsa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, } else { ti = proto_tree_add_text(tree, offset, OSPF_LSA_HEADER_LENGTH, "LSA Header"); } - ospf_lsa_tree = proto_item_add_subtree(ti, ETT_OSPF_LSA); + ospf_lsa_tree = proto_item_add_subtree(ti, ett_ospf_lsa); proto_tree_add_text(ospf_lsa_tree, offset, 2, "LS Age: %d seconds", ntohs(lsa_hdr.ls_age)); @@ -605,7 +613,17 @@ proto_register_ospf(void) { &variable, { "Name", "ospf.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_ospf, + &ett_ospf_hdr, + &ett_ospf_hello, + &ett_ospf_desc, + &ett_ospf_lsr, + &ett_ospf_lsa, + &ett_ospf_lsa_upd, + }; proto_ospf = proto_register_protocol("Open Shortest Path First", "ospf"); /* proto_register_field_array(proto_ospf, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-pim.c b/packet-pim.c index 5b450ced74..a42b5f18ca 100644 --- a/packet-pim.c +++ b/packet-pim.c @@ -2,7 +2,7 @@ * Routines for PIM disassembly * (c) Copyright Jun-ichiro itojun Hagino * - * $Id: packet-pim.c,v 1.6 1999/10/21 15:06:02 gram Exp $ + * $Id: packet-pim.c,v 1.7 1999/11/16 11:42:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -68,6 +68,8 @@ static int hf_pim_version = -1; static int hf_pim_type = -1; static int hf_pim_cksum = -1; +static gint ett_pim = -1; + static const char * dissect_pim_addr(const u_char *bp, const u_char *ep, enum pimv2_addrtype at, int *advance) { @@ -216,7 +218,7 @@ dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_pim, offset, END_OF_FRAME, NULL); - pim_tree = proto_item_add_subtree(ti, ETT_PIM); + pim_tree = proto_item_add_subtree(ti, ett_pim); proto_tree_add_item(pim_tree, hf_pim_version, offset, 1, PIM_VER(pim.pim_typever)); @@ -232,7 +234,7 @@ dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { tiopt = proto_tree_add_text(pim_tree, offset + sizeof(struct pim), END_OF_FRAME, "PIM parameters"); - pimopt_tree = proto_item_add_subtree(tiopt, ETT_PIM); + pimopt_tree = proto_item_add_subtree(tiopt, ett_pim); } else goto done; @@ -268,7 +270,7 @@ dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { flagoff = offset + sizeof(struct pim); tiflag = proto_tree_add_text(pimopt_tree, flagoff, 4, "Flags: 0x%08x", ntohl(*(guint32 *)&pd[flagoff])); - flag_tree = proto_item_add_subtree(tiflag, ETT_PIM); + flag_tree = proto_item_add_subtree(tiflag, ett_pim); proto_tree_add_text(flag_tree, flagoff, 1, "%s", decode_boolean_bitfield(pd[flagoff], 0x80000000, 32, "Border", "Not border")); @@ -373,7 +375,7 @@ dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { goto breakbreak3; tigroup = proto_tree_add_text(pimopt_tree, offset, advance, "Group %d: %s", i, s); - grouptree = proto_item_add_subtree(tigroup, ETT_PIM); + grouptree = proto_item_add_subtree(tigroup, ett_pim); offset += advance; if (&pd[offset + 4] > ep) @@ -383,7 +385,7 @@ dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { tisub = proto_tree_add_text(grouptree, offset, 2, "Join: %d", njoin); - subtree = proto_item_add_subtree(tisub, ETT_PIM); + subtree = proto_item_add_subtree(tisub, ett_pim); off = offset + 4; for (j = 0; j < nprune; j++) { s = dissect_pim_addr(&pd[off], ep, pimv2_source, @@ -397,7 +399,7 @@ dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { tisub = proto_tree_add_text(grouptree, offset + 2, 2, "Prune: %d", nprune); - subtree = proto_item_add_subtree(tisub, ETT_PIM); + subtree = proto_item_add_subtree(tisub, ett_pim); for (j = 0; j < nprune; j++) { s = dissect_pim_addr(&pd[off], ep, pimv2_source, &advance); @@ -451,7 +453,7 @@ dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { goto breakbreak4; tigroup = proto_tree_add_text(pimopt_tree, offset, advance, "Group %d: %s", i, s); - grouptree = proto_item_add_subtree(tigroup, ETT_PIM); + grouptree = proto_item_add_subtree(tigroup, ett_pim); offset += advance; if (END_OF_FRAME < 2) @@ -589,8 +591,12 @@ proto_register_pim(void) { "Checksum", "pim.cksum", FT_UINT16, BASE_HEX, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_pim, + }; proto_pim = proto_register_protocol("Protocol Independent Multicast", "pim"); proto_register_field_array(proto_pim, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-pop.c b/packet-pop.c index 052aa28205..59ee2d2e83 100644 --- a/packet-pop.c +++ b/packet-pop.c @@ -2,7 +2,7 @@ * Routines for pop packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-pop.c,v 1.9 1999/11/14 10:16:25 deniel Exp $ + * $Id: packet-pop.c,v 1.10 1999/11/16 11:42:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -47,6 +47,8 @@ static int proto_pop = -1; static int hf_pop_response = -1; static int hf_pop_request = -1; +static gint ett_pop = -1; + void dissect_pop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -88,7 +90,7 @@ dissect_pop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_pop, offset, END_OF_FRAME, NULL); - pop_tree = proto_item_add_subtree(ti, ETT_POP); + pop_tree = proto_item_add_subtree(ti, ett_pop); if (pi.match_port == pi.destport) { /* Request */ proto_tree_add_item_hidden(pop_tree, hf_pop_request, offset, i1, TRUE); @@ -122,7 +124,11 @@ proto_register_pop(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if POP request" }} }; + static gint *ett[] = { + &ett_pop, + }; proto_pop = proto_register_protocol("Post Office Protocol", "pop"); proto_register_field_array(proto_pop, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-portmap.c b/packet-portmap.c index 9091e469ff..88d59bb917 100644 --- a/packet-portmap.c +++ b/packet-portmap.c @@ -1,7 +1,7 @@ /* packet-portmap.c * Routines for portmap dissection * - * $Id: packet-portmap.c,v 1.6 1999/11/15 14:17:19 nneul Exp $ + * $Id: packet-portmap.c,v 1.7 1999/11/16 11:42:47 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -45,6 +45,8 @@ static int hf_portmap_version = -1; static int hf_portmap_port = -1; static int hf_portmap_answer = -1; +static gint ett_portmap = -1; + /* Dissect a getport call */ int dissect_getport_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) @@ -266,16 +268,19 @@ proto_register_portmap(void) "Answer", "portmap.answer", FT_BOOLEAN, BASE_DEC, NULL, 0, "Answer" }}, }; + static gint *ett[] = { + &ett_portmap, + }; proto_portmap = proto_register_protocol("Portmap", "portmap"); proto_register_field_array(proto_portmap, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_portmap, PORTMAP_PROGRAM, ETT_PORTMAP); + rpc_init_prog(proto_portmap, PORTMAP_PROGRAM, ett_portmap); /* Register the procedure tables */ rpc_init_proc_table(PORTMAP_PROGRAM, 1, portmap1_proc); rpc_init_proc_table(PORTMAP_PROGRAM, 2, portmap2_proc); rpc_init_proc_table(PORTMAP_PROGRAM, 3, portmap3_proc); rpc_init_proc_table(PORTMAP_PROGRAM, 4, portmap4_proc); } - diff --git a/packet-ppp.c b/packet-ppp.c index c1bc51c305..c03d2353d1 100644 --- a/packet-ppp.c +++ b/packet-ppp.c @@ -1,7 +1,7 @@ /* packet-ppp.c * Routines for ppp packet disassembly * - * $Id: packet-ppp.c,v 1.21 1999/10/12 06:20:14 gram Exp $ + * $Id: packet-ppp.c,v 1.22 1999/11/16 11:42:47 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -37,11 +37,33 @@ #include "packet-ip.h" static int proto_ppp = -1; + +static gint ett_ppp = -1; +static gint ett_ipcp = -1; +static gint ett_ipcp_options = -1; +static gint ett_ipcp_ipaddrs_opt = -1; +static gint ett_ipcp_compressprot_opt = -1; +static gint ett_lcp = -1; +static gint ett_lcp_options = -1; +static gint ett_lcp_mru_opt = -1; +static gint ett_lcp_async_map_opt = -1; +static gint ett_lcp_authprot_opt = -1; +static gint ett_lcp_qualprot_opt = -1; +static gint ett_lcp_magicnum_opt = -1; +static gint ett_lcp_fcs_alternatives_opt = -1; +static gint ett_lcp_numbered_mode_opt = -1; +static gint ett_lcp_callback_opt = -1; +static gint ett_lcp_multilink_ep_disc_opt = -1; +static gint ett_lcp_internationalization_opt = -1; + static int proto_mp = -1; static int hf_mp_frag_first = -1; static int hf_mp_frag_last = -1; static int hf_mp_sequence_num = -1; +static int ett_mp = -1; +static int ett_mp_flags = -1; + /* PPP structs and definitions */ typedef struct _e_ppphdr { @@ -218,7 +240,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_MRU, "Maximum Receive Unit", - ETT_LCP_MRU_OPT, + &ett_lcp_mru_opt, FIXED_LENGTH, 4, dissect_lcp_mru_opt @@ -226,7 +248,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_ASYNCMAP, "Async Control Character Map", - ETT_LCP_ASYNC_MAP_OPT, + &ett_lcp_async_map_opt, FIXED_LENGTH, 6, dissect_lcp_async_map_opt @@ -234,7 +256,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_AUTHTYPE, "Authentication protocol", - ETT_LCP_AUTHPROT_OPT, + &ett_lcp_authprot_opt, VARIABLE_LENGTH, 4, dissect_lcp_protocol_opt @@ -242,7 +264,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_QUALITY, "Quality protocol", - ETT_LCP_QUALPROT_OPT, + &ett_lcp_qualprot_opt, VARIABLE_LENGTH, 4, dissect_lcp_protocol_opt @@ -250,7 +272,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_MAGICNUMBER, NULL, - ETT_LCP_MAGICNUM_OPT, + &ett_lcp_magicnum_opt, FIXED_LENGTH, 6, dissect_lcp_magicnumber_opt @@ -258,7 +280,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_PCOMPRESSION, "Protocol field compression", - -1, + NULL, FIXED_LENGTH, 2, NULL @@ -266,7 +288,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_ACCOMPRESSION, "Address/control field compression", - -1, + NULL, FIXED_LENGTH, 2, NULL @@ -274,7 +296,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_FCS_ALTERNATIVES, NULL, - ETT_LCP_FCS_ALTERNATIVES_OPT, + &ett_lcp_fcs_alternatives_opt, FIXED_LENGTH, 3, dissect_lcp_fcs_alternatives_opt @@ -282,7 +304,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_SELF_DESCRIBING_PAD, NULL, - -1, + NULL, FIXED_LENGTH, 3, dissect_lcp_self_describing_pad_opt @@ -290,7 +312,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_NUMBERED_MODE, "Numbered mode", - ETT_LCP_NUMBERED_MODE_OPT, + &ett_lcp_numbered_mode_opt, VARIABLE_LENGTH, 4, dissect_lcp_numbered_mode_opt @@ -298,7 +320,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_CALLBACK, "Callback", - ETT_LCP_CALLBACK_OPT, + &ett_lcp_callback_opt, VARIABLE_LENGTH, 3, dissect_lcp_callback_opt, @@ -306,7 +328,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_COMPOUND_FRAMES, "Compound frames", - -1, + NULL, FIXED_LENGTH, 2, NULL @@ -314,7 +336,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_MULTILINK_MRRU, NULL, - -1, + NULL, FIXED_LENGTH, 4, dissect_lcp_multilink_mrru_opt @@ -322,7 +344,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_MULTILINK_SSNH, "Use short sequence number headers", - -1, + NULL, FIXED_LENGTH, 2, NULL @@ -330,7 +352,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_MULTILINK_EP_DISC, "Multilink endpoint discriminator", - ETT_LCP_MULTILINK_EP_DISC_OPT, + &ett_lcp_multilink_ep_disc_opt, VARIABLE_LENGTH, 3, dissect_lcp_multilink_ep_disc_opt, @@ -338,7 +360,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_DCE_IDENTIFIER, "DCE identifier", - -1, + NULL, VARIABLE_LENGTH, 2, NULL @@ -346,7 +368,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_MULTILINK_PLUS_PROC, "Multilink Plus Procedure", - -1, + NULL, VARIABLE_LENGTH, 2, NULL @@ -354,7 +376,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_LINK_DISC_FOR_BACP, NULL, - -1, + NULL, FIXED_LENGTH, 4, dissect_lcp_bap_link_discriminator_opt @@ -362,7 +384,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_LCP_AUTHENTICATION, "LCP authentication", - -1, + NULL, VARIABLE_LENGTH, 2, NULL @@ -370,7 +392,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_COBS, "Consistent Overhead Byte Stuffing", - -1, + NULL, VARIABLE_LENGTH, 2, NULL @@ -378,7 +400,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_PREFIX_ELISION, "Prefix elision", - -1, + NULL, VARIABLE_LENGTH, 2, NULL @@ -386,7 +408,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_MULTILINK_HDR_FMT, "Multilink header format", - -1, + NULL, VARIABLE_LENGTH, 2, NULL @@ -394,7 +416,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_INTERNATIONALIZATION, "Internationalization", - ETT_LCP_INTERNATIONALIZATION_OPT, + &ett_lcp_internationalization_opt, VARIABLE_LENGTH, 7, dissect_lcp_internationalization_opt @@ -402,7 +424,7 @@ static const ip_tcp_opt lcp_opts[] = { { CI_SDL_ON_SONET_SDH, "Simple data link on SONET/SDH", - -1, + NULL, VARIABLE_LENGTH, 2, NULL @@ -432,7 +454,7 @@ static const ip_tcp_opt ipcp_opts[] = { { CI_ADDRS, "IP addresses (deprecated)", - ETT_IPCP_IPADDRS_OPT, + &ett_ipcp_ipaddrs_opt, FIXED_LENGTH, 10, dissect_ipcp_addrs_opt @@ -440,7 +462,7 @@ static const ip_tcp_opt ipcp_opts[] = { { CI_COMPRESSTYPE, "IP compression protocol", - ETT_IPCP_COMPRESSPROT_OPT, + &ett_ipcp_compressprot_opt, VARIABLE_LENGTH, 4, dissect_lcp_protocol_opt @@ -448,7 +470,7 @@ static const ip_tcp_opt ipcp_opts[] = { { CI_ADDR, "IP address", - -1, + NULL, FIXED_LENGTH, 6, dissect_ipcp_addr_opt @@ -456,7 +478,7 @@ static const ip_tcp_opt ipcp_opts[] = { { CI_MOBILE_IPv4, "Mobile node's home IP address", - -1, + NULL, FIXED_LENGTH, 6, dissect_ipcp_addr_opt @@ -464,7 +486,7 @@ static const ip_tcp_opt ipcp_opts[] = { { CI_MS_DNS1, "Primary DNS server IP address", - -1, + NULL, FIXED_LENGTH, 6, dissect_ipcp_addr_opt @@ -472,7 +494,7 @@ static const ip_tcp_opt ipcp_opts[] = { { CI_MS_WINS1, "Primary WINS server IP address", - -1, + NULL, FIXED_LENGTH, 6, dissect_ipcp_addr_opt @@ -480,7 +502,7 @@ static const ip_tcp_opt ipcp_opts[] = { { CI_MS_DNS2, "Secondary DNS server IP address", - -1, + NULL, FIXED_LENGTH, 6, dissect_ipcp_addr_opt @@ -488,7 +510,7 @@ static const ip_tcp_opt ipcp_opts[] = { { CI_MS_WINS2, "Secondary WINS server IP address", - -1, + NULL, FIXED_LENGTH, 6, dissect_ipcp_addr_opt @@ -534,7 +556,7 @@ dissect_lcp_protocol_opt(const ip_tcp_opt *optp, const u_char *opd, int offset, tf = proto_tree_add_text(tree, offset, length, "%s: %u byte%s", optp->name, length, plurality(length, "", "s")); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); offset += 2; length -= 2; protocol = pntohs(opd); @@ -567,7 +589,7 @@ dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp, const u_char *opd, alternatives = *opd; tf = proto_tree_add_text(tree, offset, length, "%s: 0x%02x", optp->name, alternatives); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); offset += 2; if (alternatives & 0x1) proto_tree_add_text(field_tree, offset + 2, 1, "%s", @@ -598,7 +620,7 @@ dissect_lcp_numbered_mode_opt(const ip_tcp_opt *optp, const u_char *opd, tf = proto_tree_add_text(tree, offset, length, "%s: %u byte%s", optp->name, length, plurality(length, "", "s")); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); offset += 2; length -= 2; proto_tree_add_text(field_tree, offset, 1, "Window: %u", *opd); @@ -628,7 +650,7 @@ dissect_lcp_callback_opt(const ip_tcp_opt *optp, const u_char *opd, int offset, tf = proto_tree_add_text(tree, offset, length, "%s: %u byte%s", optp->name, length, plurality(length, "", "s")); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); offset += 2; length -= 2; proto_tree_add_text(field_tree, offset, 1, "Operation: %s (0x%02x)", @@ -677,7 +699,7 @@ dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp, const u_char *opd, tf = proto_tree_add_text(tree, offset, length, "%s: %u byte%s", optp->name, length, plurality(length, "", "s")); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); offset += 2; length -= 2; ep_disc_class = *opd; @@ -788,7 +810,7 @@ dissect_lcp_internationalization_opt(const ip_tcp_opt *optp, const u_char *opd, tf = proto_tree_add_text(tree, offset, length, "%s: %u byte%s", optp->name, length, plurality(length, "", "s")); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); offset += 2; length -= 2; proto_tree_add_text(field_tree, offset, 4, "Character set: %s (0x%04x)", @@ -813,7 +835,7 @@ dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, const u_char *opd, tf = proto_tree_add_text(tree, offset, length, "%s: %u byte%s", optp->name, length, plurality(length, "", "s")); - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); offset += 2; length -= 2; proto_tree_add_text(field_tree, offset, 4, @@ -995,11 +1017,11 @@ dissect_ppp_stuff( const u_char *pd, int offset, frame_data *fd, dissect_ipv6(pd, offset, fd, tree); return TRUE; case PPP_LCP: - dissect_cp(pd, offset, "L", "Link", ETT_LCP, lcp_vals, ETT_LCP_OPTIONS, + dissect_cp(pd, offset, "L", "Link", ett_lcp, lcp_vals, ett_lcp_options, lcp_opts, N_LCP_OPTS, fd, tree); return TRUE; case PPP_IPCP: - dissect_cp(pd, offset, "IP", "IP", ETT_IPCP, cp_vals, ETT_IPCP_OPTIONS, + dissect_cp(pd, offset, "IP", "IP", ett_ipcp, cp_vals, ett_ipcp_options, ipcp_opts, N_IPCP_OPTS, fd, tree); return TRUE; default: @@ -1056,10 +1078,10 @@ dissect_mp(const u_char *pd, int offset, frame_data *fd, break; } ti = proto_tree_add_item(tree, proto_mp, offset, 4, NULL); - mp_tree = proto_item_add_subtree(ti, ETT_MP); + mp_tree = proto_item_add_subtree(ti, ett_mp); ti = proto_tree_add_text(mp_tree, offset, 1, "Fragment: 0x%2X (%s)", flags, flag_str); - hdr_tree = proto_item_add_subtree(ti, ETT_MP_FLAGS); + hdr_tree = proto_item_add_subtree(ti, ett_mp_flags); proto_tree_add_item_format(hdr_tree, hf_mp_frag_first, offset, 1, first, "%s", decode_boolean_bitfield(flags, MP_FRAG_FIRST, sizeof(flags) * 8, "first", "not first")); @@ -1078,7 +1100,7 @@ dissect_mp(const u_char *pd, int offset, frame_data *fd, if (fd->cap_len > offset) { if (tree) { ti = proto_tree_add_item(tree, proto_ppp, offset, 1, NULL); - fh_tree = proto_item_add_subtree(ti, ETT_PPP); + fh_tree = proto_item_add_subtree(ti, ett_ppp); } dissect_ppp_stuff(pd, offset, fd, tree, fh_tree); } @@ -1093,7 +1115,7 @@ dissect_payload_ppp( const u_char *pd, int offset, frame_data *fd, proto_tree *t layer (ie none) */ if(tree) { ti = proto_tree_add_item(tree, proto_ppp, 0+offset, 2, NULL); - fh_tree = proto_item_add_subtree(ti, ETT_PPP); + fh_tree = proto_item_add_subtree(ti, ett_ppp); } dissect_ppp_stuff(pd, offset, fd, tree, fh_tree); @@ -1123,7 +1145,7 @@ dissect_ppp( const u_char *pd, frame_data *fd, proto_tree *tree ) { layer (ie none) */ if(tree) { ti = proto_tree_add_item(tree, proto_ppp, 0, 4, NULL); - fh_tree = proto_item_add_subtree(ti, ETT_PPP); + fh_tree = proto_item_add_subtree(ti, ett_ppp); proto_tree_add_text(fh_tree, 0, 1, "Address: %02x", ph.ppp_addr); proto_tree_add_text(fh_tree, 1, 1, "Control: %02x", ph.ppp_ctl); } @@ -1141,9 +1163,29 @@ proto_register_ppp(void) { &variable, { "Name", "ppp.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_ppp, + &ett_ipcp, + &ett_ipcp_options, + &ett_ipcp_ipaddrs_opt, + &ett_ipcp_compressprot_opt, + &ett_lcp, + &ett_lcp_options, + &ett_lcp_mru_opt, + &ett_lcp_async_map_opt, + &ett_lcp_authprot_opt, + &ett_lcp_qualprot_opt, + &ett_lcp_magicnum_opt, + &ett_lcp_fcs_alternatives_opt, + &ett_lcp_numbered_mode_opt, + &ett_lcp_callback_opt, + &ett_lcp_multilink_ep_disc_opt, + &ett_lcp_internationalization_opt, + }; proto_ppp = proto_register_protocol("Point-to-Point Protocol", "ppp"); /* proto_register_field_array(proto_ppp, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } void @@ -1162,7 +1204,12 @@ proto_register_mp(void) { "Sequence number", "mp.seq", FT_UINT32, BASE_DEC, NULL, 0x0, "" }} }; + static gint *ett[] = { + &ett_mp, + &ett_mp_flags, + }; proto_mp = proto_register_protocol("PPP Multilink Protocol", "mp"); proto_register_field_array(proto_mp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-pppoe.c b/packet-pppoe.c index abde716c62..31e1e52ef1 100644 --- a/packet-pppoe.c +++ b/packet-pppoe.c @@ -1,7 +1,7 @@ /* packet-arp.c * Routines for ARP packet disassembly * - * $Id: packet-pppoe.c,v 1.3 1999/08/24 17:26:13 gram Exp $ + * $Id: packet-pppoe.c,v 1.4 1999/11/16 11:42:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -34,6 +34,9 @@ #include #include "packet.h" +static gint ett_pppoed = -1; +static gint ett_pppoed_tags = -1; + /* For lack of a better source, I made up the following defines. -jsj */ #define PPPOE_CODE_SESSION 0x00 @@ -101,7 +104,7 @@ dissect_pppoe_tags(const u_char *pd, int offset, frame_data *fd, proto_tree *tre if (tree) { ti = proto_tree_add_text(tree,offset,payload_length,"PPPoE Tags"); - pppoe_tree = proto_item_add_subtree(ti, ETT_PPPOED_TAGS); + pppoe_tree = proto_item_add_subtree(ti, ett_pppoed_tags); tagstart = offset; while(tagstart <= payload_length-2 ) { @@ -167,7 +170,7 @@ dissect_pppoed(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_text(tree,offset,pppoe_length+6,"PPPoE Discovery"); - pppoe_tree = proto_item_add_subtree(ti, ETT_PPPOED); + pppoe_tree = proto_item_add_subtree(ti, ett_pppoed); proto_tree_add_text(pppoe_tree,offset,1, "Version: %d", pppoe_ver); proto_tree_add_text(pppoe_tree,offset,1, @@ -211,7 +214,7 @@ dissect_pppoes(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_text(tree,offset,pppoe_length+6,"PPPoE Session"); - pppoe_tree = proto_item_add_subtree(ti, ETT_PPPOED); + pppoe_tree = proto_item_add_subtree(ti, ett_pppoed); proto_tree_add_text(pppoe_tree,offset,1, "Version: %d", pppoe_ver); proto_tree_add_text(pppoe_tree,offset,1, @@ -231,3 +234,15 @@ dissect_pppoes(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { dissect_payload_ppp(pd,offset+6,fd,tree); } + +void +proto_register_pppoed(void) +{ + static gint *ett[] = { + &ett_pppoed, + &ett_pppoed_tags, + }; + + proto_register_subtree_array(ett, array_length(ett)); +} + diff --git a/packet-pptp.c b/packet-pptp.c index 5ffe972ced..c2a766d3e7 100644 --- a/packet-pptp.c +++ b/packet-pptp.c @@ -2,7 +2,7 @@ * Routines for the Point-to-Point Tunnelling Protocol (PPTP) * Brad Robel-Forrest * - * $Id: packet-pptp.c,v 1.5 1999/09/17 05:56:55 guy Exp $ + * $Id: packet-pptp.c,v 1.6 1999/11/16 11:42:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -41,6 +41,8 @@ #include #include "packet.h" +static gint ett_pptp = -1; + #define NUM_MSG_TYPES 3 #define msgtype2str(t) \ ((t < NUM_MSG_TYPES) ? msgtypestr[t] : "UNKNOWN-MESSAGES-TYPE") @@ -396,7 +398,7 @@ dissect_pptp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree * pptp_tree; ti = proto_tree_add_text(tree, offset, len, "PPTP Control Channel"); - pptp_tree = proto_item_add_subtree(ti, ETT_PPTP); + pptp_tree = proto_item_add_subtree(ti, ett_pptp); proto_tree_add_text(pptp_tree, offset, sizeof(hdr->len), "Length: %u", len); @@ -885,3 +887,13 @@ dissect_set_link(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "Recv ACCM: %#08x", hdr->recv_acm); offset += sizeof(hdr->recv_acm); } + +void +proto_register_pptp(void) +{ + static gint *ett[] = { + &ett_pptp, + }; + + proto_register_subtree_array(ett, array_length(ett)); +} diff --git a/packet-q931.c b/packet-q931.c index 960bedb4c4..4aa0a4bbe1 100644 --- a/packet-q931.c +++ b/packet-q931.c @@ -2,7 +2,7 @@ * Routines for Q.931 frame disassembly * Guy Harris * - * $Id: packet-q931.c,v 1.5 1999/11/13 10:13:24 guy Exp $ + * $Id: packet-q931.c,v 1.6 1999/11/16 11:42:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -49,11 +49,14 @@ * http://www.tulatelecom.ru/staff/german/DSSHelp/MessList/InfEl/InfElList.html */ -int proto_q931 = -1; -int hf_q931_discriminator = -1; -int hf_q931_call_ref_len = -1; -int hf_q931_call_ref = -1; -int hf_q931_message_type = -1; +static int proto_q931 = -1; +static int hf_q931_discriminator = -1; +static int hf_q931_call_ref_len = -1; +static int hf_q931_call_ref = -1; +static int hf_q931_message_type = -1; + +static gint ett_q931 = -1; +static gint ett_q931_ie = -1; /* * Q.931 message types. @@ -1959,7 +1962,7 @@ dissect_q931(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_q931, offset, 3, NULL); - q931_tree = proto_item_add_subtree(ti, ETT_Q931); + q931_tree = proto_item_add_subtree(ti, ett_q931); proto_tree_add_item(q931_tree, hf_q931_discriminator, offset, 1, pd[offset]); } @@ -2084,7 +2087,7 @@ dissect_q931(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) 1+1+info_element_len, "%s", val_to_str(info_element, q931_info_element_vals, "Unknown information element (0x%02X)")); - ie_tree = proto_item_add_subtree(ti, ETT_Q931_IE); + ie_tree = proto_item_add_subtree(ti, ett_q931_ie); proto_tree_add_text(ie_tree, offset, 1, "Information element: %s", val_to_str(info_element, q931_info_element_vals, @@ -2255,7 +2258,12 @@ proto_register_q931(void) "" }}, }; + static gint *ett[] = { + &ett_q931, + &ett_q931_ie, + }; proto_q931 = proto_register_protocol ("Q.931", "q931"); proto_register_field_array (proto_q931, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-radius.c b/packet-radius.c index 57e7a279b1..2aaa1ebae9 100644 --- a/packet-radius.c +++ b/packet-radius.c @@ -1,7 +1,7 @@ /* packet-radius.c * Routines for RADIUS packet disassembly * - * $Id: packet-radius.c,v 1.4 1999/10/12 06:20:15 gram Exp $ + * $Id: packet-radius.c,v 1.5 1999/11/16 11:42:49 guy Exp $ * * Ethereal - Network traffic analyzer * By Johan Feyaerts @@ -20,10 +20,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -int proto_radius = -1; -int hf_radius_length = -1; -int hf_radius_code = -1; -int hf_radius_id =-1; #ifdef HAVE_CONFIG_H #include "config.h" @@ -44,6 +40,14 @@ int hf_radius_id =-1; #include "packet.h" #include "resolv.h" +static int proto_radius = -1; +static int hf_radius_length = -1; +static int hf_radius_code = -1; +static int hf_radius_id =-1; + +static gint ett_radius = -1; +static gint ett_radius_avp = -1; + typedef struct _e_radiushdr { guint8 rh_code; guint8 rh_ident; @@ -572,7 +576,7 @@ proto_tree ti = proto_tree_add_item(tree,proto_radius, offset, rhlength, NULL); - radius_tree = proto_item_add_subtree(ti, ETT_RADIUS); + radius_tree = proto_item_add_subtree(ti, ett_radius); proto_tree_add_item_format(radius_tree,hf_radius_code, offset, 1, rh.rh_code, "Packet code:0x%01x (%s)",rhcode, codestrval); @@ -599,7 +603,7 @@ proto_tree avptf = proto_tree_add_text(radius_tree ,offset+hdrlength,avplength, "Attribute value pairs"); - avptree = proto_item_add_subtree(avptf, ETT_RADIUS_AVP); + avptree = proto_item_add_subtree(avptf, ett_radius_avp); if (avptree !=NULL) { @@ -625,8 +629,12 @@ proto_register_radius(void) { "Length","radius.length", FT_UINT16, BASE_DEC, NULL, 0x0, "" }} }; + static gint *ett[] = { + &ett_radius, + &ett_radius_avp, + }; proto_radius = proto_register_protocol ("Radius Protocol", "radius"); proto_register_field_array(proto_radius, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } - diff --git a/packet-raw.c b/packet-raw.c index f0fab49ab0..ae7b829e9e 100644 --- a/packet-raw.c +++ b/packet-raw.c @@ -1,7 +1,7 @@ /* packet-raw.c * Routines for raw packet disassembly * - * $Id: packet-raw.c,v 1.10 1999/07/07 22:51:52 gram Exp $ + * $Id: packet-raw.c,v 1.11 1999/11/16 11:42:50 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -35,6 +35,8 @@ #include #include "packet.h" +static gint ett_raw = -1; + void capture_raw( const u_char *pd, guint32 cap_len, packet_counts *ld ) { @@ -72,7 +74,7 @@ dissect_raw( const u_char *pd, frame_data *fd, proto_tree *tree ) { layer (ie none) */ if(tree) { ti = proto_tree_add_text(tree, 0, 0, "Raw packet data" ); - fh_tree = proto_item_add_subtree(ti, ETT_RAW); + fh_tree = proto_item_add_subtree(ti, ett_raw); proto_tree_add_text(fh_tree, 0, 0, "No link information available"); } @@ -90,3 +92,12 @@ dissect_raw( const u_char *pd, frame_data *fd, proto_tree *tree ) { dissect_ip(pd, 0, fd, tree); } +void +proto_register_raw(void) +{ + static gint *ett[] = { + &ett_raw, + }; + + proto_register_subtree_array(ett, array_length(ett)); +} diff --git a/packet-rip.c b/packet-rip.c index f81efc48fc..d1309610e8 100644 --- a/packet-rip.c +++ b/packet-rip.c @@ -2,7 +2,7 @@ * Routines for RIPv1 and RIPv2 packet disassembly * (c) Copyright Hannes R. Boehm * - * $Id: packet-rip.c,v 1.12 1999/08/26 07:34:40 guy Exp $ + * $Id: packet-rip.c,v 1.13 1999/11/16 11:42:50 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -40,6 +40,9 @@ static int proto_rip = -1; +static gint ett_rip = -1; +static gint ett_rip_vec = -1; + static void dissect_ip_rip_vektor(guint8 version, const e_rip_vektor *rip_vektor, int offset, proto_tree *tree); static void dissect_rip_authentication(const e_rip_authentication *rip_authentication, @@ -93,7 +96,7 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_rip, offset, END_OF_FRAME, NULL); - rip_tree = proto_item_add_subtree(ti, ETT_RIP); + rip_tree = proto_item_add_subtree(ti, ett_rip); proto_tree_add_text(rip_tree, offset, 1, "Command: %d (%s)", rip_header.command, packet_type[rip_header.command]); proto_tree_add_text(rip_tree, offset + 1, 1, "Version: %d", rip_header.version); @@ -141,7 +144,7 @@ dissect_ip_rip_vektor(guint8 version, const e_rip_vektor *rip_vektor, { proto_tree *rip_vektor_tree; - rip_vektor_tree = proto_item_add_subtree(tree, ETT_RIP_VEC); + rip_vektor_tree = proto_item_add_subtree(tree, ett_rip_vec); proto_tree_add_text(rip_vektor_tree, offset, 2, "Address Family ID: IP"); if(version == RIPv2) @@ -166,7 +169,7 @@ dissect_rip_authentication(const e_rip_authentication *rip_authentication, proto_tree *rip_authentication_tree; guint16 authtype; - rip_authentication_tree = proto_item_add_subtree(tree, ETT_RIP_VEC); + rip_authentication_tree = proto_item_add_subtree(tree, ett_rip_vec); authtype = ntohs(rip_authentication->authtype); proto_tree_add_text(rip_authentication_tree, offset + 2, 2, @@ -184,7 +187,12 @@ proto_register_rip(void) { &variable, { "Name", "rip.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_rip, + &ett_rip_vec, + }; proto_rip = proto_register_protocol("Routing Information Protocol", "rip"); /* proto_register_field_array(proto_rip, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ripng.c b/packet-ripng.c index 6f44d8b0a1..e328f2ce4d 100644 --- a/packet-ripng.c +++ b/packet-ripng.c @@ -3,7 +3,7 @@ * (c) Copyright Jun-ichiro itojun Hagino * derived from packet-rip.c * - * $Id: packet-ripng.c,v 1.5 1999/10/18 00:37:35 itojun Exp $ + * $Id: packet-ripng.c,v 1.6 1999/11/16 11:42:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -48,6 +48,9 @@ static int proto_ripng = -1; static int hf_ripng_cmd = -1; static int hf_ripng_version = -1; +static gint ett_ripng = -1; +static gint ett_ripng_addr = -1; + void dissect_ripng(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { struct rip6 rip6; @@ -74,7 +77,7 @@ dissect_ripng(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_ripng, offset, END_OF_FRAME, NULL); - ripng_tree = proto_item_add_subtree(ti, ETT_RIPNG); + ripng_tree = proto_item_add_subtree(ti, ett_ripng); proto_tree_add_item_format(ripng_tree, hf_ripng_cmd, offset, 1, rip6.rip6_cmd, @@ -99,7 +102,7 @@ dissect_ripng(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ni6.rip6_plen, ni6.rip6_metric); } - subtree = proto_item_add_subtree(ti, ETT_RIPNG_ADDR); + subtree = proto_item_add_subtree(ti, ett_ripng_addr); proto_tree_add_text(subtree, offset + offsetof(struct netinfo6, rip6_dest), sizeof(ni6.rip6_dest), "IP Address: %s", @@ -133,7 +136,12 @@ proto_register_ripng(void) { "Version", "ripng.version", FT_UINT8, BASE_DEC, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_ripng, + &ett_ripng_addr, + }; proto_ripng = proto_register_protocol("RIPng", "ripng"); proto_register_field_array(proto_ripng, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-rpc.c b/packet-rpc.c index 6bef7ea187..a84e7479d0 100644 --- a/packet-rpc.c +++ b/packet-rpc.c @@ -2,7 +2,7 @@ * Routines for rpc dissection * Copyright 1999, Uwe Girlich * - * $Id: packet-rpc.c,v 1.15 1999/11/15 17:16:51 nneul Exp $ + * $Id: packet-rpc.c,v 1.16 1999/11/16 11:42:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -42,19 +42,19 @@ #include "packet-rpc.h" -const value_string rpc_msg_type[3] = { +static const value_string rpc_msg_type[3] = { { RPC_CALL, "Call" }, { RPC_REPLY, "Reply" }, { 0, NULL } }; -const value_string rpc_reply_state[3] = { +static const value_string rpc_reply_state[3] = { { MSG_ACCEPTED, "accepted" }, { MSG_DENIED, "denied" }, { 0, NULL } }; -const value_string rpc_auth_flavor[5] = { +static const value_string rpc_auth_flavor[5] = { { AUTH_NULL, "AUTH_NULL" }, { AUTH_UNIX, "AUTH_UNIX" }, { AUTH_SHORT, "AUTH_SHORT" }, @@ -62,7 +62,7 @@ const value_string rpc_auth_flavor[5] = { { 0, NULL } }; -const value_string rpc_accept_state[6] = { +static const value_string rpc_accept_state[6] = { { SUCCESS, "RPC executed successfully" }, { PROG_UNAVAIL, "remote hasn't exported program" }, { PROG_MISMATCH, "remote can't support version #" }, @@ -71,13 +71,13 @@ const value_string rpc_accept_state[6] = { { 0, NULL } }; -const value_string rpc_reject_state[3] = { +static const value_string rpc_reject_state[3] = { { RPC_MISMATCH, "RPC_MISMATCH" }, { AUTH_ERROR, "AUTH_ERROR" }, { 0, NULL } }; -const value_string rpc_auth_state[6] = { +static const value_string rpc_auth_state[6] = { { AUTH_BADCRED, "bad credential (seal broken)" }, { AUTH_REJECTEDCRED, "client must begin new session" }, { AUTH_BADVERF, "bad verifier (seal broken)" }, @@ -110,12 +110,17 @@ static int hf_rpc_state_reply = -1; static int hf_rpc_state_reject = -1; static int hf_rpc_state_auth = -1; +static gint ett_rpc = -1; +static gint ett_rpc_string = -1; +static gint ett_rpc_cred = -1; +static gint ett_rpc_verf = -1; +static gint ett_rpc_gids = -1; /* Hash table with info on RPC program numbers */ -GHashTable *rpc_progs; +static GHashTable *rpc_progs; /* Hash table with info on RPC procedure numbers */ -GHashTable *rpc_procs; +static GHashTable *rpc_procs; /***********************************/ @@ -403,7 +408,7 @@ dissect_rpc_string(const u_char *pd, int offset, frame_data *fd, proto_tree *tre proto_tree_add_item_hidden(tree, hfindex, offset+4, string_length, string_buffer); if (string_item) { - string_tree = proto_item_add_subtree(string_item, ETT_RPC_STRING); + string_tree = proto_item_add_subtree(string_item, ett_rpc_string); } } if (string_tree) { @@ -483,8 +488,8 @@ dissect_rpc_auth( const u_char *pd, int offset, frame_data *fd, proto_tree *tree gids_count = EXTRACT_UINT(pd,offset+0); if (tree) { gitem = proto_tree_add_text(tree, offset, 4+gids_count*4, - "Auxilliary GIDs"); - gtree = proto_item_add_subtree(gitem, ETT_RPC_GIDS); + "Auxiliary GIDs"); + gtree = proto_item_add_subtree(gitem, ett_rpc_gids); } offset += 4; if (!BYTES_ARE_IN_FRAME(offset,4*gids_count)) return; @@ -536,7 +541,7 @@ dissect_rpc_cred( const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { citem = proto_tree_add_text(tree, offset, 8+length_full, "Credentials"); - ctree = proto_item_add_subtree(citem, ETT_RPC_CRED); + ctree = proto_item_add_subtree(citem, ett_rpc_cred); dissect_rpc_auth(pd, offset, fd, ctree); } offset += 8 + length_full; @@ -561,7 +566,7 @@ dissect_rpc_verf( const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { vitem = proto_tree_add_text(tree, offset, 8+length_full, "Verifier"); - vtree = proto_item_add_subtree(vitem, ETT_RPC_VERF); + vtree = proto_item_add_subtree(vitem, ett_rpc_verf); dissect_rpc_auth(pd, offset, fd, vtree); } offset += 8 + length_full; @@ -691,7 +696,7 @@ dissect_rpc( const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { rpc_item = proto_tree_add_item(tree, proto_rpc, offset, END_OF_FRAME, NULL); if (rpc_item) { - rpc_tree = proto_item_add_subtree(rpc_item, ETT_RPC); + rpc_tree = proto_item_add_subtree(rpc_item, ett_rpc); } } @@ -1085,8 +1090,15 @@ proto_register_rpc(void) "Machine Name", "rpc.auth.machinename", FT_STRING, BASE_DEC, NULL, 0, "Machine Name" }}, }; - + static gint *ett[] = { + &ett_rpc, + &ett_rpc_string, + &ett_rpc_cred, + &ett_rpc_verf, + &ett_rpc_gids, + }; proto_rpc = proto_register_protocol("Remote Procedure Call", "rpc"); proto_register_field_array(proto_rpc, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-rpc.h b/packet-rpc.h index 31b8fe4e89..d57d3aa495 100644 --- a/packet-rpc.h +++ b/packet-rpc.h @@ -1,5 +1,5 @@ /* packet-rpc.h (c) 1999 Uwe Girlich */ -/* $Id: packet-rpc.h,v 1.6 1999/11/15 17:16:51 nneul Exp $ */ +/* $Id: packet-rpc.h,v 1.7 1999/11/16 11:42:52 guy Exp $ */ #ifndef __PACKET_RPC_H__ #define __PACKET_RPC_H__ @@ -43,8 +43,6 @@ typedef int (dissect_function_t)(const u_char* pd, int offset, frame_data* fd, proto_tree* tree); -extern GHashTable *rpc_progs; - typedef struct _vsff { guint32 value; gchar *strptr; diff --git a/packet-rsvp.c b/packet-rsvp.c index cb46223186..d054d9ba08 100644 --- a/packet-rsvp.c +++ b/packet-rsvp.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan * - * $Id: packet-rsvp.c,v 1.9 1999/10/12 06:20:16 gram Exp $ + * $Id: packet-rsvp.c,v 1.10 1999/11/16 11:42:52 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -75,6 +75,25 @@ static int proto_rsvp = -1; +static gint ett_rsvp = -1; +static gint ett_rsvp_hdr = -1; +static gint ett_rsvp_session = -1; +static gint ett_rsvp_hop = -1; +static gint ett_rsvp_time_values = -1; +static gint ett_rsvp_error = -1; +static gint ett_rsvp_scope = -1; +static gint ett_rsvp_style = -1; +static gint ett_rsvp_confirm = -1; +static gint ett_rsvp_sender_template = -1; +static gint ett_rsvp_filter_spec = -1; +static gint ett_rsvp_sender_tspec = -1; +static gint ett_rsvp_flowspec = -1; +static gint ett_rsvp_adspec = -1; +static gint ett_rsvp_adspec_subtree = -1; +static gint ett_rsvp_integrity = -1; +static gint ett_rsvp_policy = -1; +static gint ett_rsvp_unknown_class = -1; + /* Stuff for IEEE float handling */ #define IEEE_NUMBER_WIDTH 32 /* bits in number */ @@ -373,11 +392,11 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { msg_length = pntohs(pd+offset+6); ti = proto_tree_add_item(tree, proto_rsvp, offset, msg_length, NULL); - rsvp_tree = proto_item_add_subtree(ti, ETT_RSVP); + rsvp_tree = proto_item_add_subtree(ti, ett_rsvp); ti = proto_tree_add_text(rsvp_tree, offset, sizeof(rsvp_header), "RSVP Header"); - rsvp_header_tree = proto_item_add_subtree(ti, ETT_RSVP_HDR); + rsvp_header_tree = proto_item_add_subtree(ti, ett_rsvp_hdr); proto_tree_add_text(rsvp_header_tree, offset, 1, "RSVP Version: %d", (hdr->ver_flags & 0xf0)>>4); @@ -426,7 +445,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) switch(obj->class) { case RSVP_CLASS_SESSION : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_SESSION); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_session); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -488,7 +507,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) break; case RSVP_CLASS_HOP : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_HOP); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_hop); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -533,7 +552,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) break; case RSVP_CLASS_TIME_VALUES : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_TIME_VALUES); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_time_values); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -563,7 +582,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) break; case RSVP_CLASS_ERROR : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_ERROR); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_error); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -625,7 +644,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) case RSVP_CLASS_SCOPE : mylen = obj_length; - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_SCOPE); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_scope); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -674,7 +693,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) break; case RSVP_CLASS_STYLE : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_STYLE); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_style); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -705,7 +724,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) break; case RSVP_CLASS_CONFIRM : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_CONFIRM); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_confirm); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -744,7 +763,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) break; case RSVP_CLASS_SENDER_TEMPLATE : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_SENDER_TEMPLATE); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_sender_template); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -752,7 +771,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) obj->class, object_type); goto common_template; case RSVP_CLASS_FILTER_SPEC : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_FILTER_SPEC); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_filter_spec); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -803,7 +822,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) char *str; mylen = obj_length; - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_SENDER_TSPEC); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_sender_tspec); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -915,7 +934,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) char *str; mylen = obj_length; - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_FLOWSPEC); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_flowspec); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -1043,10 +1062,9 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) param_hdr *phdr; char *str; - int tree_num; mylen = obj_length; - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_ADSPEC); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_adspec); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -1060,7 +1078,6 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "Data length: %d words, not including header", pntohs(pd+offset2+2)); offset2+=4; - tree_num=ETT_RSVP_ADSPEC_SUBTREE1; mylen -= 4; while (mylen > 4) { shdr = (service_hdr *)(pd + offset2); @@ -1069,7 +1086,8 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_text(rsvp_object_tree, offset2, (pntohs(&shdr->length)+1)<<2, str?str:"Unknown"); - adspec_tree = proto_item_add_subtree(ti, tree_num++); + adspec_tree = proto_item_add_subtree(ti, + ett_rsvp_adspec_subtree); proto_tree_add_text(adspec_tree, offset2, 1, "Service header %d - %s", shdr->service_num, str); @@ -1132,7 +1150,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } case RSVP_CLASS_INTEGRITY : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_INTEGRITY); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_integrity); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -1141,7 +1159,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) goto default_class; case RSVP_CLASS_POLICY : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_POLICY); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_policy); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -1150,7 +1168,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) goto default_class; default : - rsvp_object_tree = proto_item_add_subtree(ti, ETT_RSVP_UNKNOWN_CLASS); + rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_unknown_class); proto_tree_add_text(rsvp_object_tree, offset, 2, "Length: %d", obj_length); proto_tree_add_text(rsvp_object_tree, offset+2, 1, @@ -1176,6 +1194,28 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) void proto_register_rsvp(void) { + static gint *ett[] = { + &ett_rsvp, + &ett_rsvp_hdr, + &ett_rsvp_session, + &ett_rsvp_hop, + &ett_rsvp_time_values, + &ett_rsvp_error, + &ett_rsvp_scope, + &ett_rsvp_style, + &ett_rsvp_confirm, + &ett_rsvp_sender_template, + &ett_rsvp_filter_spec, + &ett_rsvp_sender_tspec, + &ett_rsvp_flowspec, + &ett_rsvp_adspec, + &ett_rsvp_adspec_subtree, + &ett_rsvp_integrity, + &ett_rsvp_policy, + &ett_rsvp_unknown_class, + }; + proto_rsvp = proto_register_protocol("Resource ReserVation Protocol (RSVP)", "rsvp"); proto_register_field_array(proto_rsvp, rsvpf_info, array_length(rsvpf_info)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-rtsp.c b/packet-rtsp.c index e546068d33..af6ed38992 100644 --- a/packet-rtsp.c +++ b/packet-rtsp.c @@ -4,7 +4,7 @@ * Jason Lango * Liberally copied from packet-http.c, by Guy Harris * - * $Id: packet-rtsp.c,v 1.3 1999/07/29 05:47:03 gram Exp $ + * $Id: packet-rtsp.c,v 1.4 1999/11/16 11:42:53 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -42,6 +42,8 @@ static int proto_rtsp = -1; +static gint ett_rtsp = -1; + static int is_rtsp_request_or_reply(const u_char *data, int linelen); static int @@ -107,7 +109,7 @@ void dissect_rtsp(const u_char *pd, int offset, frame_data *fd, if (tree) { ti = proto_tree_add_item(tree, proto_rtsp, offset, END_OF_FRAME, NULL); - rtsp_tree = proto_item_add_subtree(ti, ETT_RTSP); + rtsp_tree = proto_item_add_subtree(ti, ett_rtsp); } while (data < dataend) { @@ -247,7 +249,11 @@ proto_register_rtsp(void) { &variable, { "Name", "rtsp.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_rtsp, + }; proto_rtsp = proto_register_protocol("Real Time Streaming Protocol", "rtsp"); /* proto_register_field_array(proto_rtsp, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-rx.c b/packet-rx.c index 0e3a63f1a2..d787baf851 100644 --- a/packet-rx.c +++ b/packet-rx.c @@ -4,7 +4,7 @@ * Based on routines from tcpdump patches by * Ken Hornstein * - * $Id: packet-rx.c,v 1.3 1999/10/28 15:08:42 nneul Exp $ + * $Id: packet-rx.c,v 1.4 1999/11/16 11:42:53 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -88,6 +88,9 @@ static int hf_rx_securityindex = -1; static int hf_rx_spare = -1; static int hf_rx_serviceid = -1; +static gint ett_rx = -1; +static gint ett_rx_flags = -1; + void dissect_rx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -108,7 +111,7 @@ dissect_rx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_rx, offset, sizeof(struct rx_header), NULL); - rx_tree = proto_item_add_subtree(ti, ETT_RX); + rx_tree = proto_item_add_subtree(ti, ett_rx); proto_tree_add_item(rx_tree, hf_rx_epoch, offset, 4, ntohl(rxh->epoch)); @@ -126,7 +129,7 @@ dissect_rx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) rx_flags = proto_tree_add_item(rx_tree, hf_rx_flags, offset+21, 1, rxh->flags); - rx_tree_flags = proto_item_add_subtree(rx_flags, ETT_RX_FLAGS); + rx_tree_flags = proto_item_add_subtree(rx_flags, ett_rx_flags); proto_tree_add_item(rx_tree_flags, hf_rx_flags_free_packet, offset+21, 1, rxh->flags); proto_tree_add_item(rx_tree_flags, hf_rx_flags_more_packets, @@ -223,7 +226,12 @@ proto_register_rx(void) "Service ID", "rx.serviceid", FT_UINT16, BASE_DEC, NULL, 0, "Service ID" }}, }; + static gint *ett[] = { + &ett_rx, + &ett_rx_flags, + }; proto_rx = proto_register_protocol("RX Protocol", "rx"); proto_register_field_array(proto_rx, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-sdp.c b/packet-sdp.c index 8281e46321..ec10169380 100644 --- a/packet-sdp.c +++ b/packet-sdp.c @@ -4,7 +4,7 @@ * Jason Lango * Liberally copied from packet-http.c, by Guy Harris * - * $Id: packet-sdp.c,v 1.3 1999/07/29 05:47:03 gram Exp $ + * $Id: packet-sdp.c,v 1.4 1999/11/16 11:42:53 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -42,6 +42,8 @@ static int proto_sdp = -1; +static int ett_sdp = -1; + void dissect_sdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -71,7 +73,7 @@ void dissect_sdp(const u_char *pd, int offset, frame_data *fd, return; ti = proto_tree_add_item(tree, proto_sdp, offset, END_OF_FRAME, NULL); - sdp_tree = proto_item_add_subtree(ti, ETT_SDP); + sdp_tree = proto_item_add_subtree(ti, ett_sdp); section = 0; for (; data < dataend; offset += linelen, data = lineend) { @@ -182,7 +184,11 @@ proto_register_sdp(void) { &variable, { "Name", "sdp.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_sdp, + }; proto_sdp = proto_register_protocol("Session Description Protocol", "sdp"); /* proto_register_field_array(proto_sdp, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-smb.c b/packet-smb.c index 4ba62ab291..30a1a4e785 100644 --- a/packet-smb.c +++ b/packet-smb.c @@ -2,7 +2,7 @@ * Routines for smb packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-smb.c,v 1.38 1999/11/16 07:58:12 sharpe Exp $ + * $Id: packet-smb.c,v 1.39 1999/11/16 11:42:53 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -48,8 +48,30 @@ #include "alignment.h" static int proto_smb = -1; + +static gint ett_smb = -1; +static gint ett_smb_fileattributes = -1; +static gint ett_smb_capabilities = -1; +static gint ett_smb_aflags = -1; +static gint ett_smb_dialects = -1; +static gint ett_smb_mode = -1; +static gint ett_smb_rawmode = -1; +static gint ett_smb_flags = -1; +static gint ett_smb_flags2 = -1; +static gint ett_smb_desiredaccess = -1; +static gint ett_smb_search = -1; +static gint ett_smb_file = -1; +static gint ett_smb_openfunction = -1; +static gint ett_smb_filetype = -1; +static gint ett_smb_action = -1; +static gint ett_smb_writemode = -1; +static gint ett_smb_lock_type = -1; + static int proto_browse = -1; +static gint ett_browse = -1; +static gint ett_browse_flags = -1; + /* * Struct passed to each SMB decode routine of info it may need */ @@ -783,7 +805,7 @@ dissect_set_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Attributes: 0x%02x", Attributes); - Attributes_tree = proto_item_add_subtree(ti, ETT_SMB_FILEATTRIBUTES); + Attributes_tree = proto_item_add_subtree(ti, ett_smb_fileattributes); proto_tree_add_text(Attributes_tree, offset, 2, "%s", decode_boolean_bitfield(Attributes, 0x01, 16, "Read-only file", "Not a read-only file")); proto_tree_add_text(Attributes_tree, offset, 2, "%s", @@ -1628,7 +1650,7 @@ dissect_query_info2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Attributes: 0x%02x", Attributes); - Attributes_tree = proto_item_add_subtree(ti, ETT_SMB_FILEATTRIBUTES); + Attributes_tree = proto_item_add_subtree(ti, ett_smb_fileattributes); proto_tree_add_text(Attributes_tree, offset, 2, "%s", decode_boolean_bitfield(Attributes, 0x01, 16, "Read-only file", "Not a read-only file")); proto_tree_add_text(Attributes_tree, offset, 2, "%s", @@ -2215,7 +2237,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { ti = proto_tree_add_text(tree, offset, 4, "Capabilities: 0x%04x", Capabilities); - Capabilities_tree = proto_item_add_subtree(ti, ETT_SMB_CAPABILITIES); + Capabilities_tree = proto_item_add_subtree(ti, ett_smb_capabilities); proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0001, 32, " Raw Mode supported", " Raw Mode not supported")); proto_tree_add_text(Capabilities_tree, offset, 4, "%s", @@ -2575,7 +2597,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Additional Flags: 0x%02x", flags); - flags_tree = proto_item_add_subtree(ti, ETT_SMB_AFLAGS); + flags_tree = proto_item_add_subtree(ti, ett_smb_aflags); proto_tree_add_text(flags_tree, offset, 2, "%s", decode_boolean_bitfield(flags, 0x01, 16, "Disconnect TID", @@ -2772,7 +2794,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa if (tree) { ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "Dialects"); - dialects = proto_item_add_subtree(ti, ETT_SMB_DIALECTS); + dialects = proto_item_add_subtree(ti, ett_smb_dialects); } @@ -2848,7 +2870,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Security Mode: 0x%04x", mode); - mode_tree = proto_item_add_subtree(ti, ETT_SMB_MODE); + mode_tree = proto_item_add_subtree(ti, ett_smb_mode); proto_tree_add_text(mode_tree, offset, 2, "%s", decode_boolean_bitfield(mode, 0x0001, 16, "Security = User", @@ -2891,7 +2913,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Raw Mode: 0x%04x", rawmode); - rawmode_tree = proto_item_add_subtree(ti, ETT_SMB_RAWMODE); + rawmode_tree = proto_item_add_subtree(ti, ett_smb_rawmode); proto_tree_add_text(rawmode_tree, offset, 2, "%s", decode_boolean_bitfield(rawmode, 0x01, 16, "Read Raw supported", @@ -3008,7 +3030,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa if (tree) { ti = proto_tree_add_text(tree, offset, 1, "Security Mode: 0x%02x", mode); - mode_tree = proto_item_add_subtree(ti, ETT_SMB_MODE); + mode_tree = proto_item_add_subtree(ti, ett_smb_mode); proto_tree_add_text(mode_tree, offset, 1, "%s", decode_boolean_bitfield(mode, 0x01, 8, "Security = User", @@ -3075,7 +3097,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *pa if (tree) { ti = proto_tree_add_text(tree, offset, 4, "Capabilities: 0x%04x", caps); - caps_tree = proto_item_add_subtree(ti, ETT_SMB_CAPABILITIES); + caps_tree = proto_item_add_subtree(ti, ett_smb_capabilities); proto_tree_add_text(caps_tree, offset, 4, "%s", decode_boolean_bitfield(caps, 0x0001, 32, "Raw Mode supported", @@ -3660,7 +3682,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Flags: 0x%02x", Flags); - Flags_tree = proto_item_add_subtree(ti, ETT_SMB_FLAGS); + Flags_tree = proto_item_add_subtree(ti, ett_smb_flags); proto_tree_add_text(Flags_tree, offset, 2, "%s", decode_boolean_bitfield(Flags, 0x01, 16, "Dont Return Additional Info", "Return Additional Info")); proto_tree_add_text(Flags_tree, offset, 2, "%s", @@ -3679,7 +3701,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Desired Access: 0x%02x", DesiredAccess); - DesiredAccess_tree = proto_item_add_subtree(ti, ETT_SMB_DESIREDACCESS); + DesiredAccess_tree = proto_item_add_subtree(ti, ett_smb_desiredaccess); proto_tree_add_text(DesiredAccess_tree, offset, 2, "%s", decode_enumerated_bitfield(DesiredAccess, 0x07, 16, DesiredAccess_0x07, "%s")); proto_tree_add_text(DesiredAccess_tree, offset, 2, "%s", @@ -3702,7 +3724,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Search: 0x%02x", Search); - Search_tree = proto_item_add_subtree(ti, ETT_SMB_SEARCH); + Search_tree = proto_item_add_subtree(ti, ett_smb_search); proto_tree_add_text(Search_tree, offset, 2, "%s", decode_boolean_bitfield(Search, 0x01, 16, "Read only file", "Not a read only file")); proto_tree_add_text(Search_tree, offset, 2, "%s", @@ -3727,7 +3749,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "File: 0x%02x", File); - File_tree = proto_item_add_subtree(ti, ETT_SMB_FILE); + File_tree = proto_item_add_subtree(ti, ett_smb_file); proto_tree_add_text(File_tree, offset, 2, "%s", decode_boolean_bitfield(File, 0x01, 16, "Read only file", "Not a read only file")); proto_tree_add_text(File_tree, offset, 2, "%s", @@ -3776,7 +3798,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Open Function: 0x%02x", OpenFunction); - OpenFunction_tree = proto_item_add_subtree(ti, ETT_SMB_OPENFUNCTION); + OpenFunction_tree = proto_item_add_subtree(ti, ett_smb_openfunction); proto_tree_add_text(OpenFunction_tree, offset, 2, "%s", decode_enumerated_bitfield(OpenFunction, 0x10, 16, OpenFunction_0x10, "%s")); proto_tree_add_text(OpenFunction_tree, offset, 2, "%s", @@ -3927,7 +3949,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "FileAttributes: 0x%02x", FileAttributes); - FileAttributes_tree = proto_item_add_subtree(ti, ETT_SMB_FILEATTRIBUTES); + FileAttributes_tree = proto_item_add_subtree(ti, ett_smb_fileattributes); proto_tree_add_text(FileAttributes_tree, offset, 2, "%s", decode_boolean_bitfield(FileAttributes, 0x01, 16, "Read only file", "Not a read only file")); proto_tree_add_text(FileAttributes_tree, offset, 2, "%s", @@ -4000,7 +4022,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "File Type: 0x%02x", FileType); - FileType_tree = proto_item_add_subtree(ti, ETT_SMB_FILETYPE); + FileType_tree = proto_item_add_subtree(ti, ett_smb_filetype); proto_tree_add_text(FileType_tree, offset, 2, "%s", decode_enumerated_bitfield(FileType, 0xFFFF, 16, FileType_0xFFFF, "%s")); @@ -4027,7 +4049,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Action: 0x%02x", Action); - Action_tree = proto_item_add_subtree(ti, ETT_SMB_ACTION); + Action_tree = proto_item_add_subtree(ti, ett_smb_action); proto_tree_add_text(Action_tree, offset, 2, "%s", decode_enumerated_bitfield(Action, 0x8000, 16, Action_0x8000, "%s")); proto_tree_add_text(Action_tree, offset, 2, "%s", @@ -4193,7 +4215,7 @@ dissect_write_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "WriteMode: 0x%02x", WriteMode); - WriteMode_tree = proto_item_add_subtree(ti, ETT_SMB_WRITEMODE); + WriteMode_tree = proto_item_add_subtree(ti, ett_smb_writemode); proto_tree_add_text(WriteMode_tree, offset, 2, "%s", decode_boolean_bitfield(WriteMode, 0x01, 16, "Write through requested", "Write through not requested")); proto_tree_add_text(WriteMode_tree, offset, 2, "%s", @@ -4334,7 +4356,7 @@ dissect_write_raw_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "WriteMode: 0x%02x", WriteMode); - WriteMode_tree = proto_item_add_subtree(ti, ETT_SMB_WRITEMODE); + WriteMode_tree = proto_item_add_subtree(ti, ett_smb_writemode); proto_tree_add_text(WriteMode_tree, offset, 2, "%s", decode_boolean_bitfield(WriteMode, 0x01, 16, "Write through requested", "Write through not requested")); proto_tree_add_text(WriteMode_tree, offset, 2, "%s", @@ -4589,7 +4611,7 @@ dissect_move_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *paren if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Flags: 0x%02x", Flags); - Flags_tree = proto_item_add_subtree(ti, ETT_SMB_FLAGS); + Flags_tree = proto_item_add_subtree(ti, ett_smb_flags); proto_tree_add_text(Flags_tree, offset, 2, "%s", decode_enumerated_bitfield(Flags, 0x03, 16, Flags_0x03, "%s")); @@ -4851,7 +4873,7 @@ dissect_open_print_file_smb(const u_char *pd, int offset, frame_data *fd, proto_ if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Mode: 0x%02x", Mode); - Mode_tree = proto_item_add_subtree(ti, ETT_SMB_MODE); + Mode_tree = proto_item_add_subtree(ti, ett_smb_mode); proto_tree_add_text(Mode_tree, offset, 2, "%s", decode_enumerated_bitfield(Mode, 0x03, 16, Mode_0x03, "%s")); @@ -5464,7 +5486,7 @@ dissect_seek_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Mode: 0x%02x", Mode); - Mode_tree = proto_item_add_subtree(ti, ETT_SMB_MODE); + Mode_tree = proto_item_add_subtree(ti, ett_smb_mode); proto_tree_add_text(Mode_tree, offset, 2, "%s", decode_enumerated_bitfield(Mode, 0x03, 16, Mode_0x03, "%s")); @@ -6190,7 +6212,7 @@ dissect_locking_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tre if (tree) { ti = proto_tree_add_text(tree, offset, 1, "Lock Type: 0x%01x", LockType); - LockType_tree = proto_item_add_subtree(ti, ETT_SMB_LOCK_TYPE); + LockType_tree = proto_item_add_subtree(ti, ett_smb_lock_type); proto_tree_add_text(LockType_tree, offset, 1, "%s", decode_boolean_bitfield(LockType, 0x01, 16, "Read-only lock", "Not a Read-only lock")); proto_tree_add_text(LockType_tree, offset, 1, "%s", @@ -6492,7 +6514,7 @@ dissect_create_file_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Attributes: 0x%02x", Attributes); - Attributes_tree = proto_item_add_subtree(ti, ETT_SMB_FILEATTRIBUTES); + Attributes_tree = proto_item_add_subtree(ti, ett_smb_fileattributes); proto_tree_add_text(Attributes_tree, offset, 2, "%s", decode_boolean_bitfield(Attributes, 0x01, 16, "Read-only file", "Not a read-only file")); proto_tree_add_text(Attributes_tree, offset, 2, "%s", @@ -7543,7 +7565,7 @@ dissect_get_file_attr_smb(const u_char *pd, int offset, frame_data *fd, proto_tr if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Attributes: 0x%02x", Attributes); - Attributes_tree = proto_item_add_subtree(ti, ETT_SMB_FILEATTRIBUTES); + Attributes_tree = proto_item_add_subtree(ti, ett_smb_fileattributes); proto_tree_add_text(Attributes_tree, offset, 2, "%s", decode_boolean_bitfield(Attributes, 0x01, 16, "Read-only file", "Not a read-only file")); proto_tree_add_text(Attributes_tree, offset, 2, "%s", @@ -7974,7 +7996,7 @@ dissect_write_mpx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "WriteMode: 0x%02x", WriteMode); - WriteMode_tree = proto_item_add_subtree(ti, ETT_SMB_WRITEMODE); + WriteMode_tree = proto_item_add_subtree(ti, ett_smb_writemode); proto_tree_add_text(WriteMode_tree, offset, 2, "%s", decode_boolean_bitfield(WriteMode, 0x01, 16, "Write through requested", "Write through not requested")); proto_tree_add_text(WriteMode_tree, offset, 2, "%s", @@ -8381,7 +8403,7 @@ dissect_transact2_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Flags: 0x%02x", Flags); - Flags_tree = proto_item_add_subtree(ti, ETT_SMB_FLAGS); + Flags_tree = proto_item_add_subtree(ti, ett_smb_flags); proto_tree_add_text(Flags_tree, offset, 2, "%s", decode_boolean_bitfield(Flags, 0x01, 16, "Also disconnect TID", "Dont disconnect TID")); proto_tree_add_text(Flags_tree, offset, 2, "%s", @@ -9005,7 +9027,7 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Flags: 0x%02x", Flags); - Flags_tree = proto_item_add_subtree(ti, ETT_SMB_FLAGS); + Flags_tree = proto_item_add_subtree(ti, ett_smb_flags); proto_tree_add_text(Flags_tree, offset, 2, "%s", decode_boolean_bitfield(Flags, 0x01, 16, "Also disconnect TID", "Dont disconnect TID")); proto_tree_add_text(Flags_tree, offset, 2, "%s", @@ -9604,7 +9626,7 @@ dissect_mailslot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p if (tree) { /* Add the browse tree */ ti = proto_tree_add_item(parent, proto_browse, DataOffset, DataCount, NULL); - browse_tree = proto_item_add_subtree(ti, ETT_BROWSE); + browse_tree = proto_item_add_subtree(ti, ett_browse); proto_tree_add_text(browse_tree, loc_offset, 1, "OpCode: %s", (OpCode > (sizeof(browse_commands)/sizeof(char *))) ? "Error, No Such Command" : browse_commands[OpCode]); @@ -9673,7 +9695,7 @@ dissect_mailslot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p if (tree) { ti = proto_tree_add_text(browse_tree, loc_offset, 4, "Server Type: 0x%04x", ServerType); - flags_tree = proto_item_add_subtree(ti, ETT_BROWSE_FLAGS); + flags_tree = proto_item_add_subtree(ti, ett_browse_flags); proto_tree_add_text(flags_tree, loc_offset, 4, "%s", decode_boolean_bitfield(ServerType, 0x0001, 32, "Workstation", "Not Workstation")); proto_tree_add_text(flags_tree, loc_offset, 4, "%s", @@ -10359,7 +10381,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { ti = proto_tree_add_item(tree, proto_smb, offset, END_OF_FRAME, NULL); - smb_tree = proto_item_add_subtree(ti, ETT_SMB); + smb_tree = proto_item_add_subtree(ti, ett_smb); /* 0xFFSMB is actually a 1 byte msg type and 3 byte server * component ... SMB is only one used @@ -10423,7 +10445,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int tf = proto_tree_add_text(smb_tree, offset, 1, "Flags: 0x%02x", flags); - flags_tree = proto_item_add_subtree(tf, ETT_SMB_FLAGS); + flags_tree = proto_item_add_subtree(tf, ett_smb_flags); proto_tree_add_text(flags_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x01, 8, "Lock&Read, Write&Unlock supported", @@ -10463,7 +10485,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int tf = proto_tree_add_text(smb_tree, offset, 1, "Flags2: 0x%04x", flags2); - flags2_tree = proto_item_add_subtree(tf, ETT_SMB_FLAGS2); + flags2_tree = proto_item_add_subtree(tf, ett_smb_flags2); proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x0001, 16, "Long file names supported", @@ -10576,8 +10598,30 @@ proto_register_smb(void) { &variable, { "Name", "smb.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_smb, + &ett_smb_fileattributes, + &ett_smb_capabilities, + &ett_smb_aflags, + &ett_smb_dialects, + &ett_smb_mode, + &ett_smb_rawmode, + &ett_smb_flags, + &ett_smb_flags2, + &ett_smb_desiredaccess, + &ett_smb_search, + &ett_smb_file, + &ett_smb_openfunction, + &ett_smb_filetype, + &ett_smb_action, + &ett_smb_writemode, + &ett_smb_lock_type, + &ett_browse, + &ett_browse_flags, + }; proto_smb = proto_register_protocol("Server Message Block Protocol", "smb"); proto_browse = proto_register_protocol("Microsoft Windows Browser Protocol", "browser"); /* proto_register_field_array(proto_smb, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-sna.c b/packet-sna.c index 6e1adcab54..4a89e22ddb 100644 --- a/packet-sna.c +++ b/packet-sna.c @@ -2,7 +2,7 @@ * Routines for SNA * Gilbert Ramirez * - * $Id: packet-sna.c,v 1.8 1999/10/26 08:08:24 gram Exp $ + * $Id: packet-sna.c,v 1.9 1999/11/16 11:42:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -112,6 +112,14 @@ static int hf_sna_rh_pdi = -1; static int hf_sna_rh_cebi = -1; static int hf_sna_ru = -1; +static gint ett_sna = -1; +static gint ett_sna_th = -1; +static gint ett_sna_th_fid = -1; +static gint ett_sna_rh = -1; +static gint ett_sna_rh_0 = -1; +static gint ett_sna_rh_1 = -1; +static gint ett_sna_rh_2 = -1; + /* Format Identifier */ static const value_string sna_th_fid_vals[] = { { 0x0, "SNA device <--> Non-SNA Device" }, @@ -321,13 +329,13 @@ dissect_sna(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Don't bother setting length. We'll set it later after we find * the lengths of TH/RH/RU */ sna_ti = proto_tree_add_item(tree, proto_sna, offset, 0, NULL); - sna_tree = proto_item_add_subtree(sna_ti, ETT_SNA); + sna_tree = proto_item_add_subtree(sna_ti, ett_sna); /* --- TH --- */ /* Don't bother setting length. We'll set it later after we find * the length of TH */ th_ti = proto_tree_add_item(sna_tree, hf_sna_th, offset, 0, NULL); - th_tree = proto_item_add_subtree(th_ti, ETT_SNA_TH); + th_tree = proto_item_add_subtree(th_ti, ett_sna_th); } /* Get size of TH */ @@ -364,7 +372,7 @@ dissect_sna(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* --- RH --- */ if (BYTES_ARE_IN_FRAME(offset, 3)) { rh_ti = proto_tree_add_item(sna_tree, hf_sna_rh, offset, 3, NULL); - rh_tree = proto_item_add_subtree(rh_ti, ETT_SNA_RH); + rh_tree = proto_item_add_subtree(rh_ti, ett_sna_rh); dissect_rh(pd, offset, fd, rh_tree); sna_header_len += 3; offset += 3; @@ -421,7 +429,7 @@ dissect_fid0_1 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* Create the bitfield tree */ bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0); proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0); @@ -471,7 +479,7 @@ dissect_fid2 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0); proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0); @@ -513,7 +521,7 @@ dissect_fid3 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0); proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0); @@ -590,7 +598,7 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_byte); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); /* Byte 0 */ proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_byte); @@ -604,7 +612,7 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 1"); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); /* Byte 1 */ proto_tree_add_item(bf_tree, hf_sna_th_tgsf, offset, 1, th_byte); @@ -617,7 +625,7 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 2"); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); /* Byte 2 */ if (mft) { @@ -634,7 +642,7 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_text(tree, offset, 1, "Transmision Header Byte 3"); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); /* Byte 3 */ proto_tree_add_item(bf_tree, hf_sna_th_vrn, offset, 1, th_byte); @@ -645,7 +653,7 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Bytes 4-5"); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); /* Bytes 4-5 */ proto_tree_add_item(bf_tree, hf_sna_th_vr_cwi, offset, 2, th_word); @@ -660,7 +668,7 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Bytes 6-7"); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); /* Bytes 6-7 */ proto_tree_add_item(bf_tree, hf_sna_th_vrprq, offset, 2, th_word); @@ -686,7 +694,7 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_text(tree, offset, 2, "Transmision Header Byte 16"); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); /* Byte 16 */ proto_tree_add_item(tree, hf_sna_th_snai, offset, 1, th_byte); @@ -733,7 +741,7 @@ dissect_fid5 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0); proto_tree_add_item(bf_tree, hf_sna_th_mpf, offset, 1, th_0); @@ -777,7 +785,7 @@ dissect_fidf (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree */ bf_item = proto_tree_add_item(tree, hf_sna_th_0, offset, 1, th_0); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_TH_FID); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_th_fid); proto_tree_add_item(bf_tree, hf_sna_th_fid, offset, 1, th_0); proto_tree_add_text(tree, offset+1, 1, "Reserved"); @@ -811,7 +819,7 @@ dissect_rh (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree for byte 0*/ bf_item = proto_tree_add_item(tree, hf_sna_rh_0, offset, 1, rh_0); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_RH_0); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_0); proto_tree_add_item(bf_tree, hf_sna_rh_rri, offset, 1, rh_0); proto_tree_add_item(bf_tree, hf_sna_rh_ru_category, offset, 1, rh_0); @@ -824,7 +832,7 @@ dissect_rh (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the bitfield tree for byte 1*/ bf_item = proto_tree_add_item(tree, hf_sna_rh_1, offset, 1, rh_1); - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_RH_1); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_1); proto_tree_add_item(bf_tree, hf_sna_rh_dr1, offset, 1, rh_1); @@ -851,7 +859,7 @@ dissect_rh (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { bf_item = proto_tree_add_item(tree, hf_sna_rh_2, offset, 1, rh_2); if (!is_response) { - bf_tree = proto_item_add_subtree(bf_item, ETT_SNA_RH_2); + bf_tree = proto_item_add_subtree(bf_item, ett_sna_rh_2); proto_tree_add_item(bf_tree, hf_sna_rh_bbi, offset, 1, rh_2); proto_tree_add_item(bf_tree, hf_sna_rh_ebi, offset, 1, rh_2); @@ -1176,8 +1184,17 @@ proto_register_sna(void) { "Request/Response Unit", "sna.ru", FT_NONE, BASE_NONE, NULL, 0x0, ""}}, }; + static gint *ett[] = { + &ett_sna, + &ett_sna_th, + &ett_sna_th_fid, + &ett_sna_rh, + &ett_sna_rh_0, + &ett_sna_rh_1, + &ett_sna_rh_2, + }; proto_sna = proto_register_protocol("Systems Network Architecture", "sna"); proto_register_field_array(proto_sna, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } - diff --git a/packet-snmp.c b/packet-snmp.c index 008179331b..e46b9bbce9 100644 --- a/packet-snmp.c +++ b/packet-snmp.c @@ -2,7 +2,7 @@ * Routines for SNMP (simple network management protocol) * D.Jorand (c) 1998 * - * $Id: packet-snmp.c,v 1.12 1999/10/27 02:05:09 guy Exp $ + * $Id: packet-snmp.c,v 1.13 1999/11/16 11:42:58 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -56,6 +56,8 @@ static int proto_snmp = -1; +static gint ett_snmp = -1; + #ifdef WITH_SNMP_UCD /* should be defined only if supported in ucd-snmp */ #define OPAQUE_SPECIAL_TYPES 1 @@ -455,7 +457,7 @@ dissect_snmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* all_length=header_length+pdu_type_length+request_id_length+error_status_length+error_index_length; */ all_length=fd->pkt_len-offset; item = proto_tree_add_item(tree, proto_snmp, offset, all_length, NULL); - snmp_tree = proto_item_add_subtree(item, ETT_SNMP); + snmp_tree = proto_item_add_subtree(item, ett_snmp); proto_tree_add_text(snmp_tree, offset, header_length, "Community: \"%s\", Version: %s", community, val_to_str(version, versions, "Unknown version %#x")); offset+=header_length; proto_tree_add_text(snmp_tree, offset, pdu_type_length, "%s", pdu_type_string); @@ -483,7 +485,7 @@ dissect_snmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if(tree) { all_length=fd->pkt_len-offset; item = proto_tree_add_item(tree, proto_snmp, offset, all_length, NULL); - snmp_tree = proto_item_add_subtree(item, ETT_SNMP); + snmp_tree = proto_item_add_subtree(item, ett_snmp); proto_tree_add_text(snmp_tree, offset, header_length, "Community: \"%s\", Version: %s", community, val_to_str(version, versions, "Unknown version %#x")); offset+=header_length; proto_tree_add_text(snmp_tree, offset, pdu_type_length, "Pdu type: %s", pdu_type_string); @@ -875,9 +877,13 @@ proto_register_snmp(void) { &variable, { "Name", "snmp.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_snmp, + }; init_mib(); proto_snmp = proto_register_protocol("Simple Network Management Protocol", "snmp"); /* proto_register_field_array(proto_snmp, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); #endif /* WITH_SNMP: CMU or UCD */ } diff --git a/packet-stat.c b/packet-stat.c index 55e8970233..09643118d2 100644 --- a/packet-stat.c +++ b/packet-stat.c @@ -1,7 +1,7 @@ /* packet-stat.c * Routines for stat dissection * - * $Id: packet-stat.c,v 1.1 1999/11/11 21:22:00 nneul Exp $ + * $Id: packet-stat.c,v 1.2 1999/11/16 11:42:58 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -38,6 +38,8 @@ static int proto_stat = -1; +static gint ett_stat = -1; + /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: take the generic one. */ @@ -70,13 +72,16 @@ proto_register_stat(void) NULL, 0, "Path" }}, #endif }; + static gint *ett[] = { + &ett_stat, + }; proto_stat = proto_register_protocol("Status Service", "stat"); proto_register_field_array(proto_stat, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_stat, STAT_PROGRAM, ETT_STAT); + rpc_init_prog(proto_stat, STAT_PROGRAM, ett_stat); /* Register the procedure tables */ rpc_init_proc_table(STAT_PROGRAM, 1, stat_proc); } - diff --git a/packet-tcp.c b/packet-tcp.c index 01e5cb24f3..7fc70cd691 100644 --- a/packet-tcp.c +++ b/packet-tcp.c @@ -1,7 +1,7 @@ /* packet-tcp.c * Routines for TCP packet disassembly * - * $Id: packet-tcp.c,v 1.43 1999/11/15 14:17:20 nneul Exp $ + * $Id: packet-tcp.c,v 1.44 1999/11/16 11:42:59 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -78,6 +78,11 @@ static int hf_tcp_window_size = -1; static int hf_tcp_checksum = -1; static int hf_tcp_urgent_pointer = -1; +static gint ett_tcp = -1; +static gint ett_tcp_flags = -1; +static gint ett_tcp_options = -1; +static gint ett_tcp_option_sack = -1; + /* TCP Ports */ #define TCP_PORT_FTPDATA 20 @@ -194,7 +199,7 @@ dissect_tcpopt_sack(const ip_tcp_opt *optp, const u_char *opd, while (optlen > 0) { if (field_tree == NULL) { /* Haven't yet made a subtree out of this option. Do so. */ - field_tree = proto_item_add_subtree(tf, optp->subtree_index); + field_tree = proto_item_add_subtree(tf, *optp->subtree_index); } if (optlen < 4) { proto_tree_add_text(field_tree, offset, optlen, @@ -254,7 +259,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_EOL, "EOL", - -1, + NULL, NO_LENGTH, 0, NULL, @@ -262,7 +267,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_NOP, "NOP", - -1, + NULL, NO_LENGTH, 0, NULL, @@ -270,7 +275,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_MSS, "Maximum segment size", - -1, + NULL, FIXED_LENGTH, TCPOLEN_MSS, dissect_tcpopt_maxseg @@ -278,7 +283,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_WINDOW, "Window scale", - -1, + NULL, FIXED_LENGTH, TCPOLEN_WINDOW, dissect_tcpopt_wscale @@ -286,7 +291,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_SACK_PERM, "SACK permitted", - -1, + NULL, FIXED_LENGTH, TCPOLEN_SACK_PERM, NULL, @@ -294,7 +299,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_SACK, "SACK", - ETT_TCP_OPTION_SACK, + &ett_tcp_option_sack, VARIABLE_LENGTH, TCPOLEN_SACK_MIN, dissect_tcpopt_sack @@ -302,7 +307,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_ECHO, "Echo", - -1, + NULL, FIXED_LENGTH, TCPOLEN_ECHO, dissect_tcpopt_echo @@ -310,7 +315,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_ECHOREPLY, "Echo reply", - -1, + NULL, FIXED_LENGTH, TCPOLEN_ECHOREPLY, dissect_tcpopt_echo @@ -318,7 +323,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_TIMESTAMP, "Time stamp", - -1, + NULL, FIXED_LENGTH, TCPOLEN_TIMESTAMP, dissect_tcpopt_timestamp @@ -326,7 +331,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_CC, "CC", - -1, + NULL, FIXED_LENGTH, TCPOLEN_CC, dissect_tcpopt_cc @@ -334,7 +339,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_CCNEW, "CC.NEW", - -1, + NULL, FIXED_LENGTH, TCPOPT_CCNEW, dissect_tcpopt_cc @@ -342,7 +347,7 @@ static const ip_tcp_opt tcpopts[] = { { TCPOPT_CCECHO, "CC.ECHO", - -1, + NULL, FIXED_LENGTH, TCPOLEN_CCECHO, dissect_tcpopt_cc @@ -418,7 +423,7 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_tcp, offset, hlen, NULL); - tcp_tree = proto_item_add_subtree(ti, ETT_TCP); + tcp_tree = proto_item_add_subtree(ti, ett_tcp); proto_tree_add_item_format(tcp_tree, hf_tcp_srcport, offset, 2, th.th_sport, "Source port: %s (%u)", get_tcp_port(th.th_sport), th.th_sport); proto_tree_add_item_format(tcp_tree, hf_tcp_dstport, offset + 2, 2, th.th_dport, @@ -432,7 +437,7 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { "Header length: %u bytes", hlen); tf = proto_tree_add_item_format(tcp_tree, hf_tcp_flags, offset + 13, 1, th.th_flags, "Flags: 0x%04x (%s)", th.th_flags, flags); - field_tree = proto_item_add_subtree(tf, ETT_TCP_FLAGS); + field_tree = proto_item_add_subtree(tf, ett_tcp_flags); proto_tree_add_item(field_tree, hf_tcp_flags_urg, offset + 13, 1, th.th_flags); proto_tree_add_item(field_tree, hf_tcp_flags_ack, offset + 13, 1, th.th_flags); proto_tree_add_item(field_tree, hf_tcp_flags_push, offset + 13, 1, th.th_flags); @@ -452,7 +457,7 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { optlen = hlen - sizeof (e_tcphdr); /* length of options, in bytes */ tf = proto_tree_add_text(tcp_tree, offset + 20, optlen, "Options: (%d bytes)", optlen); - field_tree = proto_item_add_subtree(tf, ETT_TCP_OPTIONS); + field_tree = proto_item_add_subtree(tf, ett_tcp_options); dissect_ip_tcp_options(&pd[offset + 20], offset + 20, optlen, tcpopts, N_TCP_OPTS, TCPOPT_EOL, field_tree); } @@ -621,7 +626,14 @@ proto_register_tcp(void) { "Urgent pointer", "tcp.urgent_pointer", FT_UINT16, BASE_DEC, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_tcp, + &ett_tcp_flags, + &ett_tcp_options, + &ett_tcp_option_sack, + }; proto_tcp = proto_register_protocol ("Transmission Control Protocol", "tcp"); proto_register_field_array(proto_tcp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-telnet.c b/packet-telnet.c index 34e342ef5f..36b7917f93 100644 --- a/packet-telnet.c +++ b/packet-telnet.c @@ -2,7 +2,7 @@ * Routines for telnet packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-telnet.c,v 1.6 1999/08/24 17:26:15 gram Exp $ + * $Id: packet-telnet.c,v 1.7 1999/11/16 11:42:59 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -45,6 +45,9 @@ static int proto_telnet = -1; +static gint ett_telnet = -1; +static gint ett_telnet_subopt = -1; + /* Some defines for Telnet */ #define TN_IAC 255 @@ -140,7 +143,7 @@ void telnet_sub_option(proto_tree *telnet_tree, char *rr, int *i, int offset, in ti = proto_tree_add_text(telnet_tree, offset, subneg_len, "Suboption Begin: %s", opt); - option_tree = proto_item_add_subtree(ti, ETT_TELNET_SUBOPT); + option_tree = proto_item_add_subtree(ti, ett_telnet_subopt); proto_tree_add_text(option_tree, offset + 2, subneg_len - 2, "%s %s", (req ? "Send your" : "Here's my"), opt); @@ -332,7 +335,7 @@ dissect_telnet(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) memcpy(rr, pd + offset, max_data); ti = proto_tree_add_item(tree, proto_telnet, offset, END_OF_FRAME, NULL); - telnet_tree = proto_item_add_subtree(ti, ETT_TELNET); + telnet_tree = proto_item_add_subtree(ti, ett_telnet); i1 = i2 = i3 = 0; @@ -380,7 +383,12 @@ proto_register_telnet(void) { &variable, { "Name", "telnet.abbreviation", TYPE, VALS_POINTER }}, };*/ + static gint *ett[] = { + &ett_telnet, + &ett_telnet_subopt, + }; proto_telnet = proto_register_protocol("Telnet", "telnet"); /* proto_register_field_array(proto_telnet, hf, array_length(hf));*/ + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-tftp.c b/packet-tftp.c index 383558aaf1..b04c937b0e 100644 --- a/packet-tftp.c +++ b/packet-tftp.c @@ -3,7 +3,7 @@ * * Richard Sharpe * - * $Id: packet-tftp.c,v 1.6 1999/11/14 10:32:26 deniel Exp $ + * $Id: packet-tftp.c,v 1.7 1999/11/16 11:43:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -45,6 +45,8 @@ static int proto_tftp = -1; static int hf_tftp_type = -1; static int hf_tftp_error_code = -1; +static gint ett_tftp = -1; + #define RRQ 1 #define WRQ 2 #define DATA 3 @@ -93,7 +95,7 @@ dissect_tftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_tftp, offset, END_OF_FRAME, NULL); - tftp_tree = proto_item_add_subtree(ti, ETT_TFTP); + tftp_tree = proto_item_add_subtree(ti, ett_tftp); i1 = pntohs(pd+offset); proto_tree_add_item_hidden(tftp_tree, hf_tftp_type, offset, 2, i1); @@ -165,7 +167,11 @@ proto_register_tftp(void) FT_UINT16, BASE_DEC, NULL, 0x0, "Error code in case of TFTP error message" }} }; + static gint *ett[] = { + &ett_tftp, + }; proto_tftp = proto_register_protocol("Trivial File Transfer Protocol", "tftp"); proto_register_field_array(proto_tftp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-tr.c b/packet-tr.c index f29ead77c3..be357ba8cf 100644 --- a/packet-tr.c +++ b/packet-tr.c @@ -2,7 +2,7 @@ * Routines for Token-Ring packet disassembly * Gilbert Ramirez * - * $Id: packet-tr.c,v 1.30 1999/10/22 07:17:43 guy Exp $ + * $Id: packet-tr.c,v 1.31 1999/11/16 11:43:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -56,6 +56,10 @@ static int hf_tr_rif = -1; static int hf_tr_rif_ring = -1; static int hf_tr_rif_bridge = -1; +static gint ett_token_ring = -1; +static gint ett_token_ring_ac = -1; +static gint ett_token_ring_fc = -1; + #define TR_MIN_HEADER_LEN 14 #define TR_MAX_HEADER_LEN 32 @@ -414,11 +418,11 @@ dissect_tr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { /* Create Token-Ring Tree */ ti = proto_tree_add_item(tree, proto_tr, offset, 14 + actual_rif_bytes, NULL); - tr_tree = proto_item_add_subtree(ti, ETT_TOKEN_RING); + tr_tree = proto_item_add_subtree(ti, ett_token_ring); /* Create the Access Control bitfield tree */ ti = proto_tree_add_item(tr_tree, hf_tr_ac, offset, 1, trn_ac); - bf_tree = proto_item_add_subtree(ti, ETT_TOKEN_RING_AC); + bf_tree = proto_item_add_subtree(ti, ett_token_ring_ac); proto_tree_add_item(bf_tree, hf_tr_priority, offset, 1, trn_ac); proto_tree_add_item(bf_tree, hf_tr_frame, offset, 1, trn_ac); @@ -427,7 +431,7 @@ dissect_tr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Create the Frame Control bitfield tree */ ti = proto_tree_add_item(tr_tree, hf_tr_fc, offset + 1, 1, trn_fc); - bf_tree = proto_item_add_subtree(ti, ETT_TOKEN_RING_FC); + bf_tree = proto_item_add_subtree(ti, ett_token_ring_fc); proto_tree_add_item(bf_tree, hf_tr_fc_type, offset + 1, 1, trn_fc); proto_tree_add_item(bf_tree, hf_tr_fc_pcf, offset + 1, 1, trn_fc); @@ -615,8 +619,14 @@ proto_register_tr(void) { "RIF Bridge", "tr.rif.bridge", FT_UINT8, BASE_HEX, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_token_ring, + &ett_token_ring_ac, + &ett_token_ring_fc, + }; proto_tr = proto_register_protocol("Token-Ring", "tr"); proto_register_field_array(proto_tr, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-trmac.c b/packet-trmac.c index baf7c3e493..b00497424b 100644 --- a/packet-trmac.c +++ b/packet-trmac.c @@ -2,7 +2,7 @@ * Routines for Token-Ring Media Access Control * Gilbert Ramirez * - * $Id: packet-trmac.c,v 1.16 1999/10/12 06:20:19 gram Exp $ + * $Id: packet-trmac.c,v 1.17 1999/11/16 11:43:01 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -55,6 +55,10 @@ static int hf_trmac_errors_freq = -1; static int hf_trmac_errors_token = -1; static int hf_trmac_naun = -1; +static gint ett_tr_mac = -1; +static gint ett_tr_ierr_cnt = -1; +static gint ett_tr_nerr_cnt = -1; + /* Major Vector */ static value_string major_vector_vs[] = { { 0x00, "Response" }, @@ -230,7 +234,7 @@ sv_text(const u_char *pd, int pkt_offset, proto_tree *tree) memcpy(errors, &pd[2], 6); ti = proto_tree_add_item(tree, hf_trmac_errors_iso, pkt_offset+1, sv_length-1, errors[0] + errors[1] + errors[2] + errors[3] + errors[4]); - sv_tree = proto_item_add_subtree(ti, ETT_TR_IERR_CNT); + sv_tree = proto_item_add_subtree(ti, ett_tr_ierr_cnt); proto_tree_add_item(sv_tree, hf_trmac_errors_line, pkt_offset+2, 1, errors[0]); proto_tree_add_item(sv_tree, hf_trmac_errors_internal, pkt_offset+3, 1, errors[1]); @@ -244,7 +248,7 @@ sv_text(const u_char *pd, int pkt_offset, proto_tree *tree) memcpy(errors, &pd[2], 6); ti = proto_tree_add_item(tree, hf_trmac_errors_noniso, pkt_offset+1, sv_length-1, errors[0] + errors[1] + errors[2] + errors[3] + errors[4]); - sv_tree = proto_item_add_subtree(ti, ETT_TR_NERR_CNT); + sv_tree = proto_item_add_subtree(ti, ett_tr_nerr_cnt); proto_tree_add_item(sv_tree, hf_trmac_errors_lost, pkt_offset+2, 1, errors[0]); proto_tree_add_item(sv_tree, hf_trmac_errors_congestion, pkt_offset+3, 1, errors[1]); @@ -289,7 +293,7 @@ dissect_trmac(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_trmac, offset, mv_length, NULL); - mac_tree = proto_item_add_subtree(ti, ETT_TR_MAC); + mac_tree = proto_item_add_subtree(ti, ett_tr_mac); proto_tree_add_item(mac_tree, hf_trmac_mv, offset+3, 1, mv_val); proto_tree_add_item_format(mac_tree, hf_trmac_length, offset, 2, mv_length, @@ -391,7 +395,13 @@ proto_register_trmac(void) { "NAUN", "trmac.naun", FT_ETHER, BASE_DEC, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_tr_mac, + &ett_tr_ierr_cnt, + &ett_tr_nerr_cnt, + }; proto_trmac = proto_register_protocol("Token-Ring Media Access Control", "trmac"); proto_register_field_array(proto_trmac, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-udp.c b/packet-udp.c index c7a90df5af..21b18e37c2 100644 --- a/packet-udp.c +++ b/packet-udp.c @@ -1,7 +1,7 @@ /* packet-udp.c * Routines for UDP packet disassembly * - * $Id: packet-udp.c,v 1.34 1999/11/14 20:44:51 guy Exp $ + * $Id: packet-udp.c,v 1.35 1999/11/16 11:43:01 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -44,12 +44,14 @@ #include "packet.h" #include "resolv.h" -int proto_udp = -1; -int hf_udp_srcport = -1; -int hf_udp_dstport = -1; -int hf_udp_port = -1; -int hf_udp_length = -1; -int hf_udp_checksum = -1; +static int proto_udp = -1; +static int hf_udp_srcport = -1; +static int hf_udp_dstport = -1; +static int hf_udp_port = -1; +static int hf_udp_length = -1; +static int hf_udp_checksum = -1; + +static gint ett_udp = -1; /* UDP structs and definitions */ @@ -200,7 +202,7 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { ti = proto_tree_add_item(tree, proto_udp, offset, 8); - udp_tree = proto_item_add_subtree(ti, ETT_UDP); + udp_tree = proto_item_add_subtree(ti, ett_udp); proto_tree_add_item_format(udp_tree, hf_udp_srcport, offset, 2, uh_sport, "Source port: %s (%u)", get_udp_port(uh_sport), uh_sport); @@ -324,8 +326,11 @@ proto_register_udp(void) { "Checksum", "udp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, "" }}, }; + static gint *ett[] = { + &ett_udp, + }; proto_udp = proto_register_protocol("User Datagram Protocol", "udp"); proto_register_field_array(proto_udp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } - diff --git a/packet-vines.c b/packet-vines.c index 98cc8a8f9f..f5b3895ce4 100644 --- a/packet-vines.c +++ b/packet-vines.c @@ -1,7 +1,7 @@ /* packet-vines.c * Routines for Banyan VINES protocol packet disassembly * - * $Id: packet-vines.c,v 1.9 1999/10/22 08:51:04 guy Exp $ + * $Id: packet-vines.c,v 1.10 1999/11/16 11:43:02 guy Exp $ * * Don Lafontaine * @@ -40,6 +40,9 @@ #include "packet.h" #include "packet-vines.h" +static gint ett_vines = -1; +static gint ett_vines_frp = -1; +static gint ett_vines_spp = -1; /* AFAIK Vines FRP (Fragmentation Protocol) is used on all media except Ethernet * and TR (and probably FDDI) - Fragmentation on these media types is not possible @@ -85,7 +88,7 @@ dissect_vines_frp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { ti = proto_tree_add_text(tree, offset, 2, "Vines Fragmentation Protocol"); - vines_frp_tree = proto_item_add_subtree(ti, ETT_VINES_FRP); + vines_frp_tree = proto_item_add_subtree(ti, ett_vines_frp); proto_tree_add_text(vines_frp_tree, offset, 1, "Control Flags: 0x%02x = %s fragment", vines_frp_ctrl, frp_flags_str); proto_tree_add_text(vines_frp_tree, offset + 1, 1, "Sequence Number: 0x%02x", vines_frp_seqno); } @@ -213,7 +216,7 @@ dissect_vines(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_text(tree, offset, (viph.vip_pktlen), "Vines IP"); - vip_tree = proto_item_add_subtree(ti, ETT_VINES); + vip_tree = proto_item_add_subtree(ti, ett_vines); proto_tree_add_text(vip_tree, offset, 2, "Packet checksum: 0x%04x", viph.vip_chksum); proto_tree_add_text(vip_tree, offset + 2, 2, "Packet length: 0x%04x (%d)", viph.vip_pktlen, viph.vip_pktlen); proto_tree_add_text(vip_tree, offset + 4, 1, "Transport control: 0x%02x", @@ -300,7 +303,7 @@ void dissect_vines_spp(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { ti = proto_tree_add_text(tree, offset, sizeof(viph), "Vines SPP"); - vspp_tree = proto_item_add_subtree(ti, ETT_VINES_SPP); + vspp_tree = proto_item_add_subtree(ti, ett_vines_spp); proto_tree_add_text(vspp_tree, offset, 2, "Source port: 0x%04x", viph.vspp_sport); proto_tree_add_text(vspp_tree, offset+2, 2, "Destination port: 0x%04x", viph.vspp_dport); proto_tree_add_text(vspp_tree, offset+4, 1, "Packet type: 0x%02x", viph.vspp_pkttype); @@ -310,6 +313,17 @@ void dissect_vines_spp(const u_char *pd, int offset, frame_data *fd, proto_tree proto_tree_add_text(vspp_tree, offset+10, 2, "Sequence number: 0x%04x", viph.vspp_seqno); proto_tree_add_text(vspp_tree, offset+12, 2, "Ack number: 0x%04x", viph.vspp_ack); proto_tree_add_text(vspp_tree, offset+14, 2, "Window: 0x%04x", viph.vspp_win); - } - + } } + +void +proto_register_vines(void) +{ + static gint *ett[] = { + &ett_vines, + &ett_vines_frp, + &ett_vines_spp, + }; + + proto_register_subtree_array(ett, array_length(ett)); +} 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 @@ -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)); } diff --git a/packet-x25.c b/packet-x25.c index 6f93d98d6f..55ce3f428f 100644 --- a/packet-x25.c +++ b/packet-x25.c @@ -2,7 +2,7 @@ * Routines for x25 packet disassembly * Olivier Abad * - * $Id: packet-x25.c,v 1.8 1999/10/18 01:51:25 guy Exp $ + * $Id: packet-x25.c,v 1.9 1999/11/16 11:43:02 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -84,24 +84,26 @@ #define X25_FAC_ADDR_EXT 0xCB #define X25_FAC_CALL_DEFLECT 0xD1 -int proto_x25 = -1; -int hf_x25_qbit = -1; -int hf_x25_dbit = -1; -int hf_x25_mod = -1; -int hf_x25_lcn = -1; -int hf_x25_type = -1; -int hf_x25_p_r = -1; -int hf_x25_mbit = -1; -int hf_x25_p_s = -1; -int proto_ex25 = -1; -int hf_ex25_qbit = -1; -int hf_ex25_dbit = -1; -int hf_ex25_mod = -1; -int hf_ex25_lcn = -1; -int hf_ex25_type = -1; -int hf_ex25_p_r = -1; -int hf_ex25_mbit = -1; -int hf_ex25_p_s = -1; +static int proto_x25 = -1; +static int hf_x25_qbit = -1; +static int hf_x25_dbit = -1; +static int hf_x25_mod = -1; +static int hf_x25_lcn = -1; +static int hf_x25_type = -1; +static int hf_x25_p_r = -1; +static int hf_x25_mbit = -1; +static int hf_x25_p_s = -1; +static int proto_ex25 = -1; +static int hf_ex25_qbit = -1; +static int hf_ex25_dbit = -1; +static int hf_ex25_mod = -1; +static int hf_ex25_lcn = -1; +static int hf_ex25_type = -1; +static int hf_ex25_p_r = -1; +static int hf_ex25_mbit = -1; +static int hf_ex25_p_s = -1; + +static gint ett_x25 = -1; static const value_string vals_modulo[] = { { 1, "8" }, @@ -1068,7 +1070,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, (modulo == 8) ? proto_x25 : proto_ex25, localoffset, x25_pkt_len, NULL); - x25_tree = proto_item_add_subtree(ti, ETT_X25); + x25_tree = proto_item_add_subtree(ti, ett_x25); if (pd[localoffset] & 0x80) proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_qbit : hf_ex25_qbit, localoffset, 2, pd[localoffset]*256+pd[localoffset+1]); @@ -1568,9 +1570,13 @@ proto_register_x25(void) { "P(S)", "ex25.p_s", FT_UINT8, BASE_HEX, NULL, 0xFE, "Packet Send Sequence Number" } }, }; + static gint *ett[] = { + &ett_x25, + }; proto_x25 = proto_register_protocol ("X.25", "x25"); proto_ex25 = proto_register_protocol ("Extended X.25 (modulo 128)", "ex25"); proto_register_field_array (proto_x25, hf8, array_length(hf8)); proto_register_field_array (proto_ex25, hf128, array_length(hf128)); + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-yhoo.c b/packet-yhoo.c index acc146cc6e..5b5f0b23df 100644 --- a/packet-yhoo.c +++ b/packet-yhoo.c @@ -2,7 +2,7 @@ * Routines for yahoo messenger packet dissection * Copyright 1999, Nathan Neulinger * - * $Id: packet-yhoo.c,v 1.3 1999/10/20 16:36:07 gram Exp $ + * $Id: packet-yhoo.c,v 1.4 1999/11/16 11:43:03 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -56,6 +56,8 @@ static int hf_yhoo_nick1 = -1; static int hf_yhoo_nick2 = -1; static int hf_yhoo_content = -1; +static gint ett_yhoo = -1; + static const value_string yhoo_service_vals[] = { {YAHOO_SERVICE_LOGON, "Pager Logon"}, {YAHOO_SERVICE_LOGOFF, "Pager Logoff"}, @@ -125,7 +127,7 @@ dissect_yhoo(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_yhoo, offset, END_OF_FRAME, NULL); - yhoo_tree = proto_item_add_subtree(ti, ETT_YHOO); + yhoo_tree = proto_item_add_subtree(ti, ett_yhoo); proto_tree_add_item(yhoo_tree, hf_yhoo_version, offset, 8, pkt->version); @@ -185,8 +187,13 @@ proto_register_yhoo(void) "Version", "yhoo.version", FT_STRING, 0, NULL, 0, "Packet version identifier" }}, }; + static gint *ett[] = { + &ett_yhoo, + }; proto_yhoo = proto_register_protocol("Yahoo Messenger Protocol", "yhoo"); proto_register_field_array(proto_yhoo, hf, array_length(hf)); + + proto_register_subtree_array(ett, array_length(ett)); } diff --git a/packet-ypbind.c b/packet-ypbind.c index 9a65887acc..2fdfe7954b 100644 --- a/packet-ypbind.c +++ b/packet-ypbind.c @@ -1,7 +1,7 @@ /* packet-ypbind.c * Routines for ypbind dissection * - * $Id: packet-ypbind.c,v 1.2 1999/11/10 21:05:11 nneul Exp $ + * $Id: packet-ypbind.c,v 1.3 1999/11/16 11:43:03 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -39,6 +39,8 @@ static int proto_ypbind = -1; +static gint ett_ypbind = -1; + /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: take the generic one. */ const vsff ypbind1_proc[] = { @@ -61,12 +63,16 @@ const vsff ypbind2_proc[] = { void proto_register_ypbind(void) { + static gint *ett[] = { + &ett_ypbind, + }; + proto_ypbind = proto_register_protocol("Yellow Pages Bind", "ypbind"); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_ypbind, YPBIND_PROGRAM, ETT_YPBIND); + rpc_init_prog(proto_ypbind, YPBIND_PROGRAM, ett_ypbind); /* Register the procedure tables */ rpc_init_proc_table(YPBIND_PROGRAM, 1, ypbind1_proc); rpc_init_proc_table(YPBIND_PROGRAM, 2, ypbind2_proc); } - diff --git a/packet-ypserv.c b/packet-ypserv.c index 15b414972b..667bc65b98 100644 --- a/packet-ypserv.c +++ b/packet-ypserv.c @@ -1,7 +1,7 @@ /* packet-ypserv.c * Routines for ypserv dissection * - * $Id: packet-ypserv.c,v 1.5 1999/11/15 17:16:51 nneul Exp $ + * $Id: packet-ypserv.c,v 1.6 1999/11/16 11:43:04 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -45,6 +45,8 @@ static int hf_ypserv_key = -1; static int hf_ypserv_value = -1; static int hf_ypserv_status = -1; +static gint ett_ypserv = -1; + /* Dissect a domain call */ int dissect_domain_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) @@ -233,14 +235,17 @@ proto_register_ypserv(void) "Status", "ypserv.status", FT_BOOLEAN, BASE_DEC, &okfailed , 0, "Status" }}, }; + static gint *ett[] = { + &ett_ypserv, + }; proto_ypserv = proto_register_protocol("Yellow Pages Service", "ypserv"); proto_register_field_array(proto_ypserv, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_ypserv, YPSERV_PROGRAM, ETT_YPSERV); + rpc_init_prog(proto_ypserv, YPSERV_PROGRAM, ett_ypserv); /* Register the procedure tables */ rpc_init_proc_table(YPSERV_PROGRAM, 1, ypserv1_proc); rpc_init_proc_table(YPSERV_PROGRAM, 2, ypserv2_proc); } - diff --git a/packet-ypxfr.c b/packet-ypxfr.c index 9c61394efa..a53a81b064 100644 --- a/packet-ypxfr.c +++ b/packet-ypxfr.c @@ -1,7 +1,7 @@ /* packet-ypxfr.c * Routines for ypxfr dissection * - * $Id: packet-ypxfr.c,v 1.1 1999/11/10 17:23:55 nneul Exp $ + * $Id: packet-ypxfr.c,v 1.2 1999/11/16 11:43:04 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -39,6 +39,8 @@ static int proto_ypxfr = -1; +static gint ett_ypxfr = -1; + /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: take the generic one. */ const vsff ypxfr1_proc[] = { @@ -51,10 +53,15 @@ const vsff ypxfr1_proc[] = { void proto_register_ypxfr(void) { + static gint *ett[] = { + &ett_ypxfr + }; + proto_ypxfr = proto_register_protocol("Yellow Pages Transfer", "ypxfr"); + proto_register_subtree_array(ett, array_length(ett)); /* Register the protocol as RPC */ - rpc_init_prog(proto_ypxfr, YPXFR_PROGRAM, ETT_YPXFR); + rpc_init_prog(proto_ypxfr, YPXFR_PROGRAM, ett_ypxfr); /* Register the procedure tables */ rpc_init_proc_table(YPXFR_PROGRAM, 1, ypxfr1_proc); } 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 @@ -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)); } diff --git a/packet.h b/packet.h index 7426438a65..3da7599af2 100644 --- a/packet.h +++ b/packet.h @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.141 1999/11/15 14:17:20 nneul Exp $ + * $Id: packet.h,v 1.142 1999/11/16 11:43:05 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -206,287 +206,6 @@ typedef struct tcp_extra_data { int dport; } tcp_extra_data; -/* Tree types. Each dissect_* routine should have one for each - add_subtree() call. */ - -enum { - ETT_NONE, - ETT_FRAME, - ETT_IEEE8023, - ETT_ETHER2, - ETT_LLC, - ETT_TOKEN_RING, - ETT_TOKEN_RING_AC, - ETT_TOKEN_RING_FC, - ETT_TR_IERR_CNT, - ETT_TR_NERR_CNT, - ETT_TR_MAC, - ETT_PPP, - ETT_ARP, - ETT_BPDU, - ETT_FDDI, - ETT_NULL, - ETT_IP, - ETT_IP_OPTIONS, - ETT_IP_OPTION_SEC, - ETT_IP_OPTION_ROUTE, - ETT_IP_OPTION_TIMESTAMP, - ETT_IP_TOS, - ETT_IP_OFF, - ETT_UDP, - ETT_TCP, - ETT_TCP_OPTIONS, - ETT_TCP_OPTION_SACK, - ETT_TCP_FLAGS, - ETT_ICMP, - ETT_IGMP, - ETT_IPX, - ETT_SPX, - ETT_NCP, - ETT_NCP_REQUEST_FIELDS, - ETT_NCP_REPLY_FIELDS, - ETT_DNS, - ETT_DNS_FLAGS, - ETT_DNS_QRY, - ETT_DNS_QD, - ETT_DNS_ANS, - ETT_DNS_RR, - ETT_EIGRP, - ETT_ICQ, - ETT_ICQ_DECODE, - ETT_ICQ_HEADER, - ETT_ICQ_BODY, - ETT_ICQ_BODY_PARTS, - ETT_ISAKMP, - ETT_ISAKMP_FLAGS, - ETT_ISAKMP_PAYLOAD, - ETT_RIP, - ETT_RIP_VEC, - ETT_RIPNG, - ETT_RIPNG_ADDR, - ETT_PIM, - ETT_OSPF, - ETT_OSPF_HDR, - ETT_OSPF_HELLO, - ETT_OSPF_DESC, - ETT_OSPF_LSR, - ETT_OSPF_LSA_UPD, - ETT_OSPF_LSA, - ETT_LPD, - ETT_RAW, - ETT_CLIP, - ETT_BOOTP, - ETT_BOOTP_OPTION, - ETT_BOOTPARAMS, - ETT_IPv6, - ETT_BGP, - ETT_BGP_OPEN, - ETT_BGP_UPDATE, - ETT_BGP_NOTIFICATION, - ETT_BGP_ATTRS, - ETT_BGP_ATTR, - ETT_BGP_ATTR_FLAGS, - ETT_BGP_UNFEAS, - ETT_BGP_NLRI, - ETT_BGP_MP_REACH_NLRI, - ETT_BGP_MP_UNREACH_NLRI, - ETT_CLNP, - ETT_COTP, - ETT_VINES_FRP, - ETT_VINES, - ETT_VINES_ARP, - ETT_VINES_ICP, - ETT_VINES_IPC, - ETT_VINES_RTP, - ETT_VINES_SPP, - ETT_VLAN, - ETT_IPXRIP, - ETT_IPXSAP, - ETT_IPXSAP_SERVER, - ETT_NBNS, - ETT_NBNS_FLAGS, - ETT_NBNS_NB_FLAGS, - ETT_NBNS_NAME_FLAGS, - ETT_NBNS_QRY, - ETT_NBNS_QD, - ETT_NETB, - ETT_NETB_FLAGS, - ETT_NETB_STATUS, - ETT_NETB_NAME, - ETT_NBNS_ANS, - ETT_NBNS_RR, - ETT_NBIPX, - ETT_NBIPX_NAME_TYPE_FLAGS, - ETT_AARP, - ETT_GIOP, - ETT_NBDGM, - ETT_CDP, - ETT_CDP_TLV, - ETT_HTTP, - ETT_TFTP, - ETT_AH, - ETT_ESP, - ETT_IPCOMP, - ETT_ICMPv6, - ETT_ICMPv6OPT, - ETT_ICMPv6FLAG, - ETT_POP, - ETT_IMAP, - ETT_MAPI, - ETT_FTP, - ETT_TELNET, - ETT_TELNET_SUBOPT, - ETT_NNTP, - ETT_NTP, - ETT_NTP_FLAGS, - ETT_SNMP, - ETT_NBSS, - ETT_NBSS_FLAGS, - ETT_RX, - ETT_RX_FLAGS, - ETT_AFS, - ETT_AFS_OP, - ETT_AFS_FID, - ETT_AFS_ACL, - ETT_AFS_CALLBACK, - ETT_AFS_UBIKVER, - ETT_SMB, - ETT_SMB_FLAGS, - ETT_SMB_FLAGS2, - ETT_SMB_DIALECTS, - ETT_SMB_MODE, - ETT_SMB_CAPABILITIES, - ETT_SMB_RAWMODE, - ETT_SMB_AFLAGS, - ETT_SMB_DESIREDACCESS, - ETT_SMB_SEARCH, - ETT_SMB_FILE, - ETT_SMB_OPENFUNCTION, - ETT_SMB_FILEATTRIBUTES, - ETT_SMB_FILETYPE, - ETT_SMB_ACTION, - ETT_SMB_WRITEMODE, - ETT_SMB_LOCK_TYPE, - ETT_BROWSE, - ETT_BROWSE_FLAGS, - ETT_PPTP, - ETT_GRE, - ETT_GRE_FLAGS, - ETT_ICP, - ETT_ICP_PAYLOAD, - ETT_PPPOED, - ETT_PPPOED_TAGS, - ETT_PPPOES, - ETT_LCP, - ETT_LCP_OPTIONS, - ETT_LCP_MRU_OPT, - ETT_LCP_ASYNC_MAP_OPT, - ETT_LCP_AUTHPROT_OPT, - ETT_LCP_QUALPROT_OPT, - ETT_LCP_MAGICNUM_OPT, - ETT_LCP_FCS_ALTERNATIVES_OPT, - ETT_LCP_NUMBERED_MODE_OPT, - ETT_LCP_CALLBACK_OPT, - ETT_LCP_MULTILINK_EP_DISC_OPT, - ETT_LCP_INTERNATIONALIZATION_OPT, - ETT_IPCP, - ETT_IPCP_OPTIONS, - ETT_IPCP_IPADDRS_OPT, - ETT_IPCP_COMPRESSPROT_OPT, - ETT_RSVP, - ETT_RSVP_UNKNOWN_CLASS, - ETT_RSVP_HDR, - ETT_RSVP_SESSION, - ETT_RSVP_SGROUP, - ETT_RSVP_HOP, - ETT_RSVP_INTEGRITY, - ETT_RSVP_TIME_VALUES, - ETT_RSVP_ERROR, - ETT_RSVP_SCOPE, - ETT_RSVP_STYLE, - ETT_RSVP_FLOWSPEC, - ETT_RSVP_FILTER_SPEC, - ETT_RSVP_SENDER_TEMPLATE, - ETT_RSVP_SENDER_TSPEC, - ETT_RSVP_ADSPEC, - ETT_RSVP_POLICY, - ETT_RSVP_CONFIRM, - ETT_RSVP_ADSPEC_SUBTREE1, - ETT_RSVP_ADSPEC_SUBTREE2, - ETT_RSVP_ADSPEC_SUBTREE3, - ETT_RTSP, - ETT_SDP, - ETT_RADIUS, - ETT_RADIUS_AVP, - ETT_LAPB, - ETT_LAPD, - ETT_LAPD_ADDRESS, - ETT_X25, - ETT_XDLC_CONTROL, - ETT_Q931, - ETT_Q931_IE, - ETT_ATM, - ETT_ATM_LANE, - ETT_ATM_LANE_LC_FLAGS, - ETT_ATM_LANE_LC_LAN_DEST, - ETT_ATM_LANE_LC_LAN_DEST_RD, - ETT_MP, - ETT_MP_FLAGS, - ETT_IPP, - ETT_IPP_AS, - ETT_IPP_ATTR, - ETT_SNA, - ETT_SNA_TH, - ETT_SNA_TH_FID, - ETT_SNA_RH, - ETT_SNA_RH_0, - ETT_SNA_RH_1, - ETT_SNA_RH_2, - ETT_SNA_RU, - ETT_YHOO, - ETT_RPC, - ETT_RPC_STRING, - ETT_RPC_CRED, - ETT_RPC_VERF, - ETT_RPC_GIDS, - ETT_MOUNT, - ETT_NFS, - ETT_NFS_FHANDLE, - ETT_NFS_TIMEVAL, - ETT_NFS_MODE, - ETT_NFS_FATTR, - ETT_NFS_SATTR, - ETT_NFS_MODE3, - ETT_NFS_SPECDATA3, - ETT_NFS_FH3, - ETT_NFS_NFSTIME3, - ETT_NFS_FATTR3, - ETT_NFS_POST_OP_ATTR, - ETT_NFS_WCC_ATTR, - ETT_NFS_PRE_OP_ATTR, - ETT_NFS_WCC_DATA, - ETT_NFS_SET_MODE3, - ETT_NFS_SET_UID3, - ETT_NFS_SET_GID3, - ETT_NFS_SET_SIZE3, - ETT_NFS_SET_ATIME, - ETT_NFS_SET_MTIME, - ETT_NFS_SATTR3, - ETT_NFS_SATTRGUARD3, - ETT_BOOT, - ETT_NLM, - ETT_PORTMAP, - ETT_STAT, - ETT_YPBIND, - ETT_YPSERV, - ETT_YPXFR, - ETT_DDP, - NUM_TREE_TYPES /* last item number plus one */ -}; - -/* TRUE if subtrees of an item of the specified type are to be expanded. */ -extern gboolean tree_is_expanded[NUM_TREE_TYPES]; - /* Utility routines used by packet*.c */ gchar* ether_to_str(const guint8 *); gchar* ip_to_str(const guint8 *); diff --git a/proto.c b/proto.c index 9e80203578..feeb458dcd 100644 --- a/proto.c +++ b/proto.c @@ -1,7 +1,7 @@ /* proto.c * Routines for protocol tree * - * $Id: proto.c,v 1.48 1999/11/15 06:32:14 gram Exp $ + * $Id: proto.c,v 1.49 1999/11/16 11:43:06 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -121,6 +121,14 @@ GMemChunk *gmc_item_labels = NULL; /* List which stores protocols and fields that have been registered */ GPtrArray *gpa_hfinfo = NULL; +/* Points to the first element of an array of Booleans, indexed by + a subtree item type; that array element is TRUE if subtrees of + an item of that type are to be expanded. */ +gboolean *tree_is_expanded; + +/* Number of elements in that array. */ +int num_tree_types; + /* Is the parsing being done for a visible proto_tree or an invisible one? * By setting this correctly, the proto_tree creation is sped up by not * having to call vsnprintf and copy strings around. @@ -145,6 +153,8 @@ proto_init(void) g_mem_chunk_destroy(gmc_item_labels); if (gpa_hfinfo) g_ptr_array_free(gpa_hfinfo, FALSE); + if (tree_is_expanded != NULL) + g_free(tree_is_expanded); gmc_hfinfo = g_mem_chunk_new("gmc_hfinfo", sizeof(struct header_field_info), 50 * sizeof(struct @@ -157,6 +167,12 @@ proto_init(void) G_ALLOC_AND_FREE); gpa_hfinfo = g_ptr_array_new(); + /* Allocate "tree_is_expanded", with one element for ETT_NONE, + and initialize that element to FALSE. */ + tree_is_expanded = g_malloc(sizeof (gint)); + tree_is_expanded[0] = FALSE; + num_tree_types = 1; + /* Have each dissector register its protocols and fields. */ register_all_protocols(); @@ -164,6 +180,11 @@ proto_init(void) converting ethereal to new-style proto_tree. These fields are merely strings on the GUI tree; they are not filterable */ proto_register_field_array(-1, hf, array_length(hf)); + + /* We've assigned all the subtree type values; allocate the array + for them, and zero it out. */ + tree_is_expanded = g_malloc(num_tree_types*sizeof (gint *)); + memset(tree_is_expanded, '\0', num_tree_types*sizeof (gint *)); } void @@ -413,6 +434,7 @@ proto_tree_create_root(void) proto_tree* proto_item_add_subtree(proto_item *pi, gint idx) { field_info *fi = (field_info*) (((GNode*)pi)->data); + g_assert(idx >= 0 && idx < num_tree_types); fi->tree_type = idx; return (proto_tree*) pi; } @@ -480,6 +502,31 @@ proto_register_field_init(header_field_info *hfinfo, int parent) return hfinfo->id; } +void +proto_register_subtree_array(gint **indices, int num_indices) +{ + int i; + gint **ptr = indices; + + /* + * Add "num_indices" elements to "tree_is_expanded". + */ + tree_is_expanded = g_realloc(tree_is_expanded, + (num_tree_types + num_indices)*sizeof (gint)); + + /* + * Assign "num_indices" subtree numbers starting at "num_tree_types", + * returning the indices through the pointers in the array whose + * first element is pointed to by "indices", set to FALSE the + * elements to which those subtree numbers refer, and update + * "num_tree_types" appropriately. + */ + for (i = 0; i < num_indices; i++, ptr++, num_tree_types++) { + tree_is_expanded[num_tree_types] = FALSE; + **ptr = num_tree_types; + } +} + void proto_item_fill_label(field_info *fi, gchar *label_str) { diff --git a/proto.h b/proto.h index 1dc7f5c1e3..b5b0442dcb 100644 --- a/proto.h +++ b/proto.h @@ -1,7 +1,7 @@ /* proto.h * Definitions for protocol display * - * $Id: proto.h,v 1.19 1999/11/15 06:32:15 gram Exp $ + * $Id: proto.h,v 1.20 1999/11/16 11:43:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -173,6 +173,9 @@ proto_register_protocol(char *name, char *abbrev); void proto_register_field_array(int parent, hf_register_info *hf, int num_records); +void +proto_register_subtree_array(gint **indices, int num_indices); + proto_item * proto_tree_add_item(proto_tree *tree, int hfindex, gint start, gint length, ...); @@ -238,4 +241,15 @@ void proto_registrar_dump(void); */ extern gboolean proto_tree_is_visible; +/* Points to the first element of an array of Booleans, indexed by + a subtree item type; that array element is TRUE if subtrees of + an item of that type are to be expanded. + + ETT_NONE is reserved for unregistered subtree types. */ +#define ETT_NONE 0 +extern gboolean *tree_is_expanded; + +/* Number of elements in that array. */ +extern int num_tree_types; + #endif /* proto.h */ diff --git a/xdlc.c b/xdlc.c index c5e0cdfcc8..68116d4350 100644 --- a/xdlc.c +++ b/xdlc.c @@ -2,7 +2,7 @@ * Routines for use by various SDLC-derived protocols, such as HDLC * and its derivatives LAPB, IEEE 802.2 LLC, etc.. * - * $Id: xdlc.c,v 1.9 1999/09/26 20:31:50 guy Exp $ + * $Id: xdlc.c,v 1.10 1999/11/16 11:43:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -196,7 +196,7 @@ get_xdlc_control(const u_char *pd, int offset, int is_response, int is_extended) int dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, - proto_tree *xdlc_tree, int hf_xdlc_control, + proto_tree *xdlc_tree, int hf_xdlc_control, gint ett_xdlc_control, int is_response, int is_extended) { guint16 control; @@ -253,7 +253,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, offset, 2, frame_type, "Control field: %s (0x%04X)", info, control); - control_tree = proto_item_add_subtree(tc, ETT_XDLC_CONTROL); + control_tree = proto_item_add_subtree(tc, ett_xdlc_control); proto_tree_add_text(control_tree, offset, 2, decode_numeric_bitfield(control, XDLC_N_R_EXT_MASK, 2*8, "N(R) = %u")); @@ -274,7 +274,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, offset, 1, frame_type, "Control field: %s (0x%02X)", info, control); - control_tree = proto_item_add_subtree(tc, ETT_XDLC_CONTROL); + control_tree = proto_item_add_subtree(tc, ett_xdlc_control); proto_tree_add_text(control_tree, offset, 1, decode_numeric_bitfield(control, XDLC_N_R_MASK, 1*8, "N(R) = %u")); @@ -327,7 +327,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, offset, 1, frame_type, "Control field: %s (0x%02X)", info, control); - control_tree = proto_item_add_subtree(tc, ETT_XDLC_CONTROL); + control_tree = proto_item_add_subtree(tc, ett_xdlc_control); if (control & XDLC_P_F) { proto_tree_add_text(control_tree, offset, 2, decode_boolean_bitfield(control, XDLC_P_F, 1*8, @@ -372,7 +372,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, (is_extended) ? "Control field: %s (0x%04X)" : "Control field: %s (0x%02X)", info, control); - control_tree = proto_item_add_subtree(tc, ETT_XDLC_CONTROL); + control_tree = proto_item_add_subtree(tc, ett_xdlc_control); if (is_extended) { proto_tree_add_text(control_tree, offset, 2, decode_numeric_bitfield(control, XDLC_N_R_EXT_MASK, 2*8, diff --git a/xdlc.h b/xdlc.h index 8d0e2cc77e..1638b40a6a 100644 --- a/xdlc.h +++ b/xdlc.h @@ -2,7 +2,7 @@ * Define *DLC frame types, and routine to dissect the control field of * a *DLC frame. * - * $Id: xdlc.h,v 1.9 1999/11/11 08:04:06 guy Exp $ + * $Id: xdlc.h,v 1.10 1999/11/16 11:43:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -79,4 +79,5 @@ int get_xdlc_control(const u_char *pd, int offset, int is_response, int extended); int dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, - proto_tree *xdlc_tree, int hf_xdlc_control, int is_response, int extended); + proto_tree *xdlc_tree, int hf_xdlc_control, gint ett_xdlc_control, + int is_response, int extended);