diff options
55 files changed, 1068 insertions, 508 deletions
diff --git a/packet-aarp.c b/packet-aarp.c index 49af2ede28..f12149aeb8 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.16 1999/12/10 00:45:15 nneul Exp $ + * $Id: packet-aarp.c,v 1.17 2000/03/12 04:47:33 gram Exp $ * * Simon Wilkinson <sxw@dcs.ed.ac.uk> * @@ -191,13 +191,13 @@ dissect_aarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (tree) { if ((op_str = match_strval(ar_op, op_vals))) - ti = proto_tree_add_item_format(tree, proto_aarp, offset, + ti = proto_tree_add_protocol_format(tree, proto_aarp, offset, MIN_AARP_HEADER_SIZE + 2*ar_hln + - 2*ar_pln, NULL, "AppleTalk Address Resolution Protocol (%s)", op_str); + 2*ar_pln, "AppleTalk Address Resolution Protocol (%s)", op_str); else - ti = proto_tree_add_item_format(tree, proto_aarp, offset, + ti = proto_tree_add_protocol_format(tree, proto_aarp, offset, MIN_AARP_HEADER_SIZE + 2*ar_hln + - 2*ar_pln, NULL, + 2*ar_pln, "AppleTalk Address Resolution Protocol (opcode 0x%04x)", ar_op); aarp_tree = proto_item_add_subtree(ti, ett_aarp); proto_tree_add_item(aarp_tree, hf_aarp_hard_type, offset + AR_HRD, 2, @@ -210,16 +210,16 @@ dissect_aarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ar_pln); proto_tree_add_item(aarp_tree, hf_aarp_opcode, offset + AR_OP, 2, ar_op); - proto_tree_add_item_format(aarp_tree, hf_aarp_src_ether, sha_offset, ar_hln, + proto_tree_add_bytes_format(aarp_tree, hf_aarp_src_ether, sha_offset, ar_hln, &pd[sha_offset], "Sender hardware address: %s", sha_str); - proto_tree_add_item_format(aarp_tree, hf_aarp_src_id, spa_offset, ar_pln, + proto_tree_add_bytes_format(aarp_tree, hf_aarp_src_id, spa_offset, ar_pln, &pd[spa_offset], "Sender ID: %s", spa_str); - proto_tree_add_item_format(aarp_tree, hf_aarp_dst_ether, tha_offset, ar_hln, + proto_tree_add_bytes_format(aarp_tree, hf_aarp_dst_ether, tha_offset, ar_hln, &pd[tha_offset], "Target hardware address: %s", tha_str); - proto_tree_add_item_format(aarp_tree, hf_aarp_dst_id, tpa_offset, ar_pln, + proto_tree_add_bytes_format(aarp_tree, hf_aarp_dst_id, tpa_offset, ar_pln, &pd[tpa_offset], "Target ID: %s", tpa_str); } diff --git a/packet-arp.c b/packet-arp.c index 9bc9cceef5..cce1e92028 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.25 1999/12/07 15:38:20 nneul Exp $ + * $Id: packet-arp.c,v 1.26 2000/03/12 04:47:34 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -496,13 +496,11 @@ dissect_atmarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { if ((op_str = match_strval(ar_op, atmop_vals))) - ti = proto_tree_add_item_format(tree, proto_arp, offset, tot_len, - NULL, + ti = proto_tree_add_protocol_format(tree, proto_arp, offset, tot_len, "ATM Address Resolution Protocol (%s)", op_str); else - ti = proto_tree_add_item_format(tree, proto_arp, offset, tot_len, - NULL, + ti = proto_tree_add_protocol_format(tree, proto_arp, offset, tot_len, "ATM Address Resolution Protocol (opcode 0x%04x)", ar_op); arp_tree = proto_item_add_subtree(ti, ett_arp); proto_tree_add_item(arp_tree, hf_arp_hard_type, offset + ATM_AR_HRD, 2, @@ -527,24 +525,24 @@ dissect_atmarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) dissect_atm_number(pd, sha_offset, ar_shtl, hf_atmarp_src_atm_num_e164, hf_atmarp_src_atm_num_nsap, arp_tree); if (ar_ssl != 0) - proto_tree_add_item_format(arp_tree, hf_atmarp_src_atm_subaddr, ssa_offset, + proto_tree_add_bytes_format(arp_tree, hf_atmarp_src_atm_subaddr, ssa_offset, ar_ssl, &pd[ssa_offset], "Sender ATM subaddress: %s", ssa_str); if (ar_spln != 0) - proto_tree_add_item_format(arp_tree, hf_arp_src_proto, spa_offset, ar_spln, + proto_tree_add_bytes_format(arp_tree, hf_arp_src_proto, spa_offset, ar_spln, &pd[spa_offset], "Sender protocol address: %s", spa_str); if (ar_thl != 0) dissect_atm_number(pd, tha_offset, ar_thtl, hf_atmarp_dst_atm_num_e164, hf_atmarp_dst_atm_num_nsap, arp_tree); if (ar_tsl != 0) - proto_tree_add_item_format(arp_tree, hf_atmarp_dst_atm_subaddr, tsa_offset, + proto_tree_add_bytes_format(arp_tree, hf_atmarp_dst_atm_subaddr, tsa_offset, ar_tsl, &pd[tsa_offset], "Target ATM subaddress: %s", tsa_str); if (ar_tpln != 0) - proto_tree_add_item_format(arp_tree, hf_arp_dst_proto, tpa_offset, ar_tpln, + proto_tree_add_bytes_format(arp_tree, hf_arp_dst_proto, tpa_offset, ar_tpln, &pd[tpa_offset], "Target protocol address: %s", tpa_str); } @@ -641,12 +639,10 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { if ((op_str = match_strval(ar_op, op_vals))) - ti = proto_tree_add_item_format(tree, proto_arp, offset, tot_len, - NULL, + ti = proto_tree_add_protocol_format(tree, proto_arp, offset, tot_len, "Address Resolution Protocol (%s)", op_str); else - ti = proto_tree_add_item_format(tree, proto_arp, offset, tot_len, - NULL, + ti = proto_tree_add_protocol_format(tree, proto_arp, offset, tot_len, "Address Resolution Protocol (opcode 0x%04x)", ar_op); arp_tree = proto_item_add_subtree(ti, ett_arp); proto_tree_add_item(arp_tree, hf_arp_hard_type, offset + AR_HRD, 2, @@ -660,19 +656,19 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_item(arp_tree, hf_arp_opcode, offset + AR_OP, 2, ar_op); if (ar_hln != 0) - proto_tree_add_item_format(arp_tree, hf_arp_src_ether, sha_offset, ar_hln, + proto_tree_add_bytes_format(arp_tree, hf_arp_src_ether, sha_offset, ar_hln, &pd[sha_offset], "Sender hardware address: %s", sha_str); if (ar_pln != 0) - proto_tree_add_item_format(arp_tree, hf_arp_src_proto, spa_offset, ar_pln, + proto_tree_add_bytes_format(arp_tree, hf_arp_src_proto, spa_offset, ar_pln, &pd[spa_offset], "Sender protocol address: %s", spa_str); if (ar_hln != 0) - proto_tree_add_item_format(arp_tree, hf_arp_dst_ether, tha_offset, ar_hln, + proto_tree_add_bytes_format(arp_tree, hf_arp_dst_ether, tha_offset, ar_hln, &pd[tha_offset], "Target hardware address: %s", tha_str); if (ar_pln != 0) - proto_tree_add_item_format(arp_tree, hf_arp_dst_proto, tpa_offset, ar_pln, + proto_tree_add_bytes_format(arp_tree, hf_arp_dst_proto, tpa_offset, ar_pln, &pd[tpa_offset], "Target protocol address: %s", tpa_str); } diff --git a/packet-atalk.c b/packet-atalk.c index 51b8d7d2b5..824d5f68e9 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.30 1999/12/09 17:06:37 nneul Exp $ + * $Id: packet-atalk.c,v 1.31 2000/03/12 04:47:35 gram Exp $ * * Simon Wilkinson <sxw@dcs.ed.ac.uk> * @@ -313,7 +313,7 @@ dissect_nbp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ti = proto_tree_add_item(tree, proto_nbp, offset, END_OF_FRAME, NULL); nbp_tree = proto_item_add_subtree(ti, ett_nbp); - info_item = proto_tree_add_item_format(nbp_tree, hf_nbp_info, offset, 1, + info_item = proto_tree_add_uint_format(nbp_tree, hf_nbp_info, offset, 1, pd[offset], "Info: 0x%01X Operation: %s Count: %d", pd[offset], val_to_str(op, nbp_op_vals, "unknown"), diff --git a/packet-atm.c b/packet-atm.c index 294b4b6af2..731c7af12c 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.12 2000/02/15 21:02:00 gram Exp $ + * $Id: packet-atm.c,v 1.13 2000/03/12 04:47:35 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -153,8 +153,7 @@ dissect_le_client(const u_char *pd, int offset, frame_data *fd, proto_tree *tree proto_tree *lane_tree; if (tree) { - ti = proto_tree_add_item_format(tree, proto_atm_lane, offset, 2, NULL, - "ATM LANE"); + ti = proto_tree_add_protocol_format(tree, proto_atm_lane, offset, 2, "ATM LANE"); lane_tree = proto_item_add_subtree(ti, ett_atm_lane); proto_tree_add_text(lane_tree, offset, 2, "LE Client: 0x%04X", @@ -263,8 +262,7 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre col_add_str(fd, COL_INFO, "LE Control"); if (tree) { - ti = proto_tree_add_item_format(tree, proto_atm_lane, offset, 108, NULL, - "ATM LANE"); + ti = proto_tree_add_protocol_format(tree, proto_atm_lane, offset, 108, "ATM LANE"); lane_tree = proto_item_add_subtree(ti, ett_atm_lane); proto_tree_add_text(lane_tree, offset, 2, "Marker: 0x%04X", @@ -621,8 +619,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"); + ti = proto_tree_add_protocol_format(tree, proto_atm, 0, 0, "ATM"); atm_tree = proto_item_add_subtree(ti, ett_atm); proto_tree_add_text(atm_tree, 0, 0, "AAL: %s", diff --git a/packet-auto_rp.c b/packet-auto_rp.c index 90e17473f2..4436bbef0c 100644 --- a/packet-auto_rp.c +++ b/packet-auto_rp.c @@ -4,7 +4,7 @@ * * Heikki Vatiainen <hessu@cs.tut.fi> * - * $Id: packet-auto_rp.c,v 1.2 2000/01/07 22:05:29 guy Exp $ + * $Id: packet-auto_rp.c,v 1.3 2000/03/12 04:47:35 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -152,7 +152,7 @@ void dissect_auto_rp(const u_char *pd, int offset, frame_data *fd, proto_tree *t ti = proto_tree_add_item(tree, proto_auto_rp, offset, END_OF_FRAME, NULL); auto_rp_tree = proto_item_add_subtree(ti, ett_auto_rp); - tv = proto_tree_add_item_format(auto_rp_tree, hf_auto_rp_ver_type, offset, 1, + tv = proto_tree_add_uint_format(auto_rp_tree, hf_auto_rp_ver_type, offset, 1, arh.ver_type, "Version: %s, Packet type: %s", val_to_str(hi_nibble(arh.ver_type), auto_rp_ver_vals, "Unknown"), val_to_str(lo_nibble(arh.ver_type), auto_rp_type_vals, "Unknown")); @@ -254,7 +254,7 @@ static int do_auto_rp_map(const u_char *pd, int offset, frame_data *fd, proto_tr return -1; memcpy(&m, pd+offset, sizeof(struct auto_rp_map_hdr)); - ti = proto_tree_add_item_format(auto_rp_tree, hf_auto_rp_map, offset, + ti = proto_tree_add_uint_format(auto_rp_tree, hf_auto_rp_map, offset, MIN(sizeof(m) + m.group_count*sizeof(g), END_OF_FRAME), 1, "RP %s: %u group%s", ip_to_str((void *)&m.rp_address), m.group_count, plurality(m.group_count, "", "s")); @@ -273,7 +273,7 @@ static int do_auto_rp_map(const u_char *pd, int offset, frame_data *fd, proto_tr if (2*sizeof(guint8) + sizeof(guint32) > END_OF_FRAME) /* struct auto_rp_enc_grp_hdr */ return -1; - gi = proto_tree_add_item_format(map_tree, hf_auto_rp_group, offset, 6, 1, + gi = proto_tree_add_uint_format(map_tree, hf_auto_rp_group, offset, 6, 1, "group %s/%u (%s)", ip_to_str(pd + offset + 2), pd[offset + 1], val_to_str(pd[offset]&AUTO_RP_SIGN_MASK, auto_rp_mask_sign_vals, "")); diff --git a/packet-bootp.c b/packet-bootp.c index 78bf6fcd99..f16e662274 100644 --- a/packet-bootp.c +++ b/packet-bootp.c @@ -2,7 +2,7 @@ * Routines for BOOTP/DHCP packet disassembly * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-bootp.c,v 1.26 2000/02/14 18:15:29 guy Exp $ + * $Id: packet-bootp.c,v 1.27 2000/03/12 04:47:35 gram Exp $ * * The information used comes from: * RFC 2132: DHCP Options and BOOTP Vendor Extensions @@ -479,12 +479,12 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_item(tree, proto_bootp, offset, END_OF_FRAME, NULL); bp_tree = proto_item_add_subtree(ti, ett_bootp); - proto_tree_add_item_format(bp_tree, hf_bootp_type, + proto_tree_add_uint_format(bp_tree, hf_bootp_type, offset, 1, pd[offset], pd[offset] == 1 ? "Boot Request" : "Boot Reply"); - proto_tree_add_item_format(bp_tree, hf_bootp_hw_type, + proto_tree_add_uint_format(bp_tree, hf_bootp_hw_type, offset + 1, 1, pd[offset+1], "Hardware type: %s", @@ -514,7 +514,7 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_item(bp_tree, hf_bootp_ip_relay, offset + 24, 4, ip_addr); - proto_tree_add_item_format(bp_tree, hf_bootp_hw_addr, + proto_tree_add_bytes_format(bp_tree, hf_bootp_hw_addr, offset + 28, pd[offset+2], &pd[offset+28], "Client hardware address: %s", @@ -523,14 +523,14 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* The server host name is optional */ if (pd[offset+44]) { - proto_tree_add_item_format(bp_tree, hf_bootp_server, + proto_tree_add_string_format(bp_tree, hf_bootp_server, offset + 44, 64, &pd[offset+44], "Server host name: %s", &pd[offset+44]); } else { - proto_tree_add_item_format(bp_tree, hf_bootp_server, + proto_tree_add_string_format(bp_tree, hf_bootp_server, offset + 44, 64, &pd[offset+44], "Server host name not given"); @@ -538,21 +538,21 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* Boot file */ if (pd[offset+108]) { - proto_tree_add_item_format(bp_tree, hf_bootp_file, + proto_tree_add_string_format(bp_tree, hf_bootp_file, offset + 108, 128, &pd[offset+108], "Boot file name: %s", &pd[offset+108]); } else { - proto_tree_add_item_format(bp_tree, hf_bootp_file, + proto_tree_add_string_format(bp_tree, hf_bootp_file, offset + 108, 128, &pd[offset+108], "Boot file name not given"); } if (pntohl(&pd[offset+236]) == 0x63825363) { - proto_tree_add_item_format(bp_tree, hf_bootp_cookie, + proto_tree_add_ipv4_format(bp_tree, hf_bootp_cookie, offset + 236, 4, pd[offset+236], "Magic cookie: (OK)"); diff --git a/packet-bpdu.c b/packet-bpdu.c index cb7bbac743..1db910270a 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.7 2000/01/16 02:54:44 guy Exp $ + * $Id: packet-bpdu.c,v 1.8 2000/03/12 04:47:36 gram Exp $ * * Copyright 1999 Christophe Tronche <ch.tronche@computer.org> * @@ -120,9 +120,10 @@ void dissect_bpdu(const u_char *pd, int offset, frame_data *fd, proto_tree *tree protocol_identifier = pntohs(bpdu + BPDU_IDENTIFIER); protocol_version_identifier = (guint8) bpdu[BPDU_VERSION_IDENTIFIER]; - ti = proto_tree_add_item_format(tree, proto_bpdu, offset, 35, NULL, "Spanning Tree Protocol"); + ti = proto_tree_add_protocol_format(tree, proto_bpdu, offset, 35, + "Spanning Tree Protocol"); bpdu_tree = proto_item_add_subtree(ti, ett_bpdu); - proto_tree_add_item_format(bpdu_tree, hf_bpdu_proto_id, + proto_tree_add_uint_format(bpdu_tree, hf_bpdu_proto_id, offset + BPDU_IDENTIFIER, 2, protocol_identifier, "Protocol Identifier: 0x%04x (%s)", @@ -135,7 +136,7 @@ void dissect_bpdu(const u_char *pd, int offset, frame_data *fd, proto_tree *tree protocol_version_identifier); if (protocol_version_identifier != 0) proto_tree_add_text(bpdu_tree, offset + BPDU_VERSION_IDENTIFIER, 1, " (Warning: this version of packet-bpdu only knows about version = 0)"); - proto_tree_add_item_format(bpdu_tree, hf_bpdu_type, + proto_tree_add_uint_format(bpdu_tree, hf_bpdu_type, offset + BPDU_TYPE, 1, bpdu_type, "BPDU Type: 0x%02x (%s)", diff --git a/packet-cdp.c b/packet-cdp.c index d907366055..78adaa24fa 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 <hannes@boehm.org> * - * $Id: packet-cdp.c,v 1.20 2000/01/22 04:59:54 guy Exp $ + * $Id: packet-cdp.c,v 1.21 2000/03/12 04:47:36 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -113,11 +113,11 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* CDP header */ proto_tree_add_item(cdp_tree, hf_cdp_version, offset, 1, pd[offset]); offset += 1; - proto_tree_add_item_format(cdp_tree, hf_cdp_ttl, offset, 1, + proto_tree_add_uint_format(cdp_tree, hf_cdp_ttl, offset, 1, pntohs(&pd[offset]), "TTL: %u seconds", pd[offset]); offset += 1; - proto_tree_add_item_format(cdp_tree, hf_cdp_flags, offset, 2, + proto_tree_add_uint_format(cdp_tree, hf_cdp_flags, offset, 2, pd[offset], "Checksum: 0x%04x", pntohs(&pd[offset])); offset += 2; diff --git a/packet-data.c b/packet-data.c index 653ab246be..fadbf405df 100644 --- a/packet-data.c +++ b/packet-data.c @@ -2,7 +2,7 @@ * Routines for raw data (default case) * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-data.c,v 1.14 2000/01/24 03:33:35 guy Exp $ + * $Id: packet-data.c,v 1.15 2000/03/12 04:47:36 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -44,8 +44,8 @@ void dissect_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (IS_DATA_IN_FRAME(offset) && tree) { - proto_tree_add_item_format(tree, proto_data, offset, - END_OF_FRAME, NULL, "Data (%d byte%s)", END_OF_FRAME, + proto_tree_add_protocol_format(tree, proto_data, offset, + END_OF_FRAME, "Data (%d byte%s)", END_OF_FRAME, plurality(END_OF_FRAME, "", "s")); } } diff --git a/packet-dns.c b/packet-dns.c index c8ed8c88ef..10d33352b9 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.35 2000/03/07 05:57:13 guy Exp $ + * $Id: packet-dns.c,v 1.36 2000/03/12 04:47:36 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1377,7 +1377,7 @@ dissect_dns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } if (tree) { - ti = proto_tree_add_item_format(tree, proto_dns, offset, 4, NULL, + ti = proto_tree_add_protocol_format(tree, proto_dns, offset, 4, "Domain Name System (%s)", (flags & F_RESPONSE) ? "response" : "query"); dns_tree = proto_item_add_subtree(ti, ett_dns); @@ -1397,7 +1397,7 @@ dissect_dns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) strcat(buf, val_to_str(flags & F_RCODE, rcode_vals, "Unknown error")); } - tf = proto_tree_add_item_format(dns_tree, hf_dns_flags, + tf = proto_tree_add_uint_format(dns_tree, hf_dns_flags, offset + DNS_FLAGS, 2, flags, "Flags: 0x%04x (%s)", diff --git a/packet-eth.c b/packet-eth.c index 39acc5c1fd..15230e6619 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.29 2000/02/15 21:02:07 gram Exp $ + * $Id: packet-eth.c,v 1.30 2000/03/12 04:47:37 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -191,8 +191,8 @@ dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } if (tree) { - ti = proto_tree_add_item_format(tree, proto_eth, offset, ETH_HEADER_SIZE, - NULL, "IEEE 802.3 %s", (ethhdr_type == ETHERNET_802_3 ? "Raw " : "")); + ti = proto_tree_add_protocol_format(tree, proto_eth, offset, ETH_HEADER_SIZE, + "IEEE 802.3 %s", (ethhdr_type == ETHERNET_802_3 ? "Raw " : "")); fh_tree = proto_item_add_subtree(ti, ett_ieee8023); @@ -217,8 +217,8 @@ dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) col_add_str(fd, COL_INFO, "Ethernet II"); if (tree) { - ti = proto_tree_add_item_format(tree, proto_eth, offset, ETH_HEADER_SIZE, - NULL, "Ethernet II"); + ti = proto_tree_add_protocol_format(tree, proto_eth, offset, ETH_HEADER_SIZE, + "Ethernet II"); fh_tree = proto_item_add_subtree(ti, ett_ether2); diff --git a/packet-fddi.c b/packet-fddi.c index 7e21bf446a..8940f65d07 100644 --- a/packet-fddi.c +++ b/packet-fddi.c @@ -3,7 +3,7 @@ * * Laurent Deniel <deniel@worldnet.fr> * - * $Id: packet-fddi.c,v 1.27 2000/02/15 21:02:08 gram Exp $ + * $Id: packet-fddi.c,v 1.28 2000/03/12 04:47:37 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -294,7 +294,7 @@ void dissect_fddi(const u_char *pd, frame_data *fd, proto_tree *tree, offset = FDDI_HEADER_SIZE; if (tree) { - ti = proto_tree_add_item_format(tree, proto_fddi, 0, offset, NULL, + ti = proto_tree_add_protocol_format(tree, proto_fddi, 0, offset, "Fiber Distributed Data Interface, %s", fc_str); swap_mac_addr(dst_swapped, (u_char*)&pd[FDDI_P_DHOST]); diff --git a/packet-ftp.c b/packet-ftp.c index 7ee3aef157..62a97d50d4 100644 --- a/packet-ftp.c +++ b/packet-ftp.c @@ -2,7 +2,7 @@ * Routines for ftp packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-ftp.c,v 1.11 2000/01/07 22:05:30 guy Exp $ + * $Id: packet-ftp.c,v 1.12 2000/03/12 04:47:37 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -114,9 +114,9 @@ dissect_ftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset, i1, TRUE); proto_tree_add_item_hidden(ftp_tree, hf_ftp_response, offset, i1, FALSE); - proto_tree_add_item_format(ftp_tree, hf_ftp_request_command, + proto_tree_add_string_format(ftp_tree, hf_ftp_request_command, offset, i1, rr, "Request: %s", rr); - proto_tree_add_item_format(ftp_tree, hf_ftp_request_data, + proto_tree_add_string_format(ftp_tree, hf_ftp_request_data, offset + i1 + 1, END_OF_FRAME, rd, "Request Arg: %s", rd); } @@ -126,10 +126,10 @@ dissect_ftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset, i1, FALSE); proto_tree_add_item_hidden(ftp_tree, hf_ftp_response, offset, i1, TRUE); - proto_tree_add_item_format(ftp_tree, hf_ftp_response_code, + proto_tree_add_uint_format(ftp_tree, hf_ftp_response_code, offset, i1, atoi(rr), "Response: %s", rr); - proto_tree_add_item_format(ftp_tree, hf_ftp_response_data, + proto_tree_add_string_format(ftp_tree, hf_ftp_response_data, offset + i1 + 1, END_OF_FRAME, rd, "Response Arg: %s", rd); } diff --git a/packet-giop.c b/packet-giop.c index bcb54f23f1..8157864143 100644 --- a/packet-giop.c +++ b/packet-giop.c @@ -3,7 +3,7 @@ * * Laurent Deniel <deniel@worldnet.fr> * - * $Id: packet-giop.c,v 1.10 1999/11/16 11:42:30 guy Exp $ + * $Id: packet-giop.c,v 1.11 2000/03/12 04:47:38 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -290,7 +290,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree break; } /* minor_version */ - proto_tree_add_item_format(clnp_tree, + proto_tree_add_uint_format(clnp_tree, hf_giop_message_type, offset + 7, 1, header.message_type, diff --git a/packet-gre.c b/packet-gre.c index 939516f6e0..cbd9d7ae8f 100644 --- a/packet-gre.c +++ b/packet-gre.c @@ -2,7 +2,7 @@ * Routines for the Generic Routing Encapsulation (GRE) protocol * Brad Robel-Forrest <brad.robel-forrest@watchguard.com> * - * $Id: packet-gre.c,v 1.15 2000/02/15 21:02:11 gram Exp $ + * $Id: packet-gre.c,v 1.16 2000/03/12 04:47:38 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -120,7 +120,7 @@ dissect_gre(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { break; } - ti = proto_tree_add_item_format(tree, proto_gre, offset, len, NULL, + ti = proto_tree_add_protocol_format(tree, proto_gre, offset, len, "Generic Routing Encapsulation (%s)", val_to_str(type, typevals, "0x%04X - unknown")); gre_tree = proto_item_add_subtree(ti, ett_gre); diff --git a/packet-icmpv6.c b/packet-icmpv6.c index b6c49f741c..9d39912efa 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.13 2000/01/24 03:51:34 guy Exp $ + * $Id: packet-icmpv6.c,v 1.14 2000/03/12 04:47:38 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -347,12 +347,12 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_item(tree, proto_icmpv6, offset, len, NULL); icmp6_tree = proto_item_add_subtree(ti, ett_icmpv6); - proto_tree_add_item_format(icmp6_tree, hf_icmpv6_type, + proto_tree_add_uint_format(icmp6_tree, hf_icmpv6_type, offset + offsetof(struct icmp6_hdr, icmp6_type), 1, dp->icmp6_type, "Type: 0x%02x (%s)", dp->icmp6_type, typename); if (codename) { - proto_tree_add_item_format(icmp6_tree, hf_icmpv6_code, + proto_tree_add_uint_format(icmp6_tree, hf_icmpv6_code, offset + offsetof(struct icmp6_hdr, icmp6_code), 1, dp->icmp6_code, "Code: 0x%02x (%s)", dp->icmp6_code, codename); diff --git a/packet-icp.c b/packet-icp.c index c2d16b7497..c283bb7cd5 100644 --- a/packet-icp.c +++ b/packet-icp.c @@ -2,7 +2,7 @@ * Routines for ICP (internet cache protocol) packet disassembly * RFC 2186 && RFC 2187 * - * $Id: packet-icp.c,v 1.4 1999/12/23 09:53:53 guy Exp $ + * $Id: packet-icp.c,v 1.5 2000/03/12 04:47:38 gram Exp $ * * Ethereal - Network traffic analyzer * By Peter Torvals @@ -209,16 +209,16 @@ void dissect_icp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) NULL); icp_tree = proto_item_add_subtree(ti, ett_icp); - proto_tree_add_item_format(icp_tree,hf_icp_opcode, offset, 1, + proto_tree_add_uint_format(icp_tree,hf_icp_opcode, offset, 1, icph.opcode, "Opcode:0x%01x (%s)",icph.opcode, opcodestrval); - proto_tree_add_item_format(icp_tree,hf_icp_version, offset+1, 1, + proto_tree_add_uint_format(icp_tree,hf_icp_version, offset+1, 1, icph.version,"Version: 0x%01x (%d)", icph.version, (int)icph.version); - proto_tree_add_item_format(icp_tree,hf_icp_length, offset+2, 2, + proto_tree_add_uint_format(icp_tree,hf_icp_length, offset+2, 2, icph.message_length, "Length: 0x%02x (%d)", icph.message_length,(int)icph.message_length); - proto_tree_add_item_format(icp_tree,hf_icp_request_nr, offset+4, 4, + proto_tree_add_uint_format(icp_tree,hf_icp_request_nr, offset+4, 4, icph.request_number, "Request Number: 0x%04x (%u)", icph.request_number,icph.request_number); diff --git a/packet-icq.c b/packet-icq.c index cfee9491f8..b51d16f733 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.11 2000/03/07 05:30:37 guy Exp $ + * $Id: packet-icq.c,v 1.12 2000/03/12 04:47:38 gram Exp $ * * Ethereal - Network traffic analyzer * By Johan Feyaerts @@ -909,7 +909,7 @@ icqv5_cmd_ack(proto_tree* tree,/* Tree to put the data in */ proto_item* ti; if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 4, @@ -948,7 +948,7 @@ icqv5_cmd_rand_search(proto_tree* tree, /* Tree to put the data in */ }; if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 4, @@ -979,7 +979,7 @@ icqv5_cmd_ack_messages(proto_tree* tree,/* Tree to put the data in */ proto_item* ti; if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 4, @@ -1004,7 +1004,7 @@ icqv5_cmd_keep_alive(proto_tree* tree,/* Tree to put the data in */ proto_item* ti; if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 4, @@ -1032,7 +1032,7 @@ icqv5_cmd_send_text_code(proto_tree* tree,/* Tree to put the data in */ int left = size; /* The amount of data left to analyse */ if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, left, @@ -1092,7 +1092,7 @@ icqv5_cmd_add_to_list(proto_tree* tree,/* Tree to put the data in */ if (size>=4) uin = pletohl(pd + CMD_ADD_TO_LIST); if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 4, @@ -1119,7 +1119,7 @@ icqv5_cmd_status_change(proto_tree* tree,/* Tree to put the data in */ if (size >= CMD_STATUS_CHANGE_STATUS + 4) status = pletohl(pd + CMD_STATUS_CHANGE_STATUS); if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 4, @@ -1162,7 +1162,7 @@ icqv5_cmd_send_msg(proto_tree* tree, left -= 2; if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, size, @@ -1223,7 +1223,7 @@ icqv5_cmd_login(proto_tree* tree, status = pletohs(pd + CMD_LOGIN_PASSWD + passwdLen + CMD_LOGIN_STATUS); } if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, size, @@ -1277,7 +1277,7 @@ icqv5_cmd_contact_list(proto_tree* tree, num = pd[CMD_CONTACT_LIST_NUM]; if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, size, @@ -1320,7 +1320,7 @@ icqv5_cmd_no_params(proto_tree* tree,/* Tree to put the data in */ proto_item* ti; if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 0, @@ -1351,7 +1351,7 @@ icqv5_srv_no_params(proto_tree* tree,/* Tree to put the data in */ proto_item* ti; if (tree){ - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 0, @@ -1379,7 +1379,7 @@ icqv5_srv_login_reply(proto_tree* tree,/* Tree to put the data in */ ipAddrp = &pd[SRV_LOGIN_REPLY_IP]; if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, SRV_LOGIN_REPLY_IP + 8, @@ -1432,7 +1432,7 @@ icqv5_srv_user_online(proto_tree* tree,/* Tree to put the data in */ version = pletohl(pd + SRV_USER_ONL_X2); if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, SRV_LOGIN_REPLY_IP + 8, @@ -1480,7 +1480,7 @@ icqv5_srv_user_offline(proto_tree* tree,/* Tree to put the data in */ uin = pletohl(&pd[SRV_USER_OFFLINE]); if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, SRV_USER_OFFLINE_UIN + 4, @@ -1512,7 +1512,7 @@ icqv5_srv_multi(proto_tree* tree,/* Tree to put the data in */ num = pd[SRV_MULTI_NUM]; if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, size, @@ -1570,7 +1570,7 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ if (tree) { #if 0 - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, size, @@ -1848,7 +1848,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */ unsigned char minute = -1; if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, 4, @@ -1857,7 +1857,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */ 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, + proto_tree_add_uint_format(subtree, hf_icq_uin, offset + SRV_RECV_MSG_UIN, sizeof(guint32), @@ -1907,7 +1907,7 @@ icqv5_srv_rand_user(proto_tree* tree, /* Tree to put the data in */ int left = size; if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, hf_icq_cmd, offset, SRV_RAND_USER_TCP_VER + 2, @@ -2020,7 +2020,7 @@ dissect_icqv5Client(const u_char *pd, } if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, proto_icq, offset, pktsize, NULL, @@ -2028,7 +2028,7 @@ dissect_icqv5Client(const u_char *pd, findClientCmd(cmd), pktsize); icq_tree = proto_item_add_subtree(ti, ett_icq); - ti = proto_tree_add_item_format(icq_tree, + ti = proto_tree_add_uint_format(icq_tree, hf_icq_type, offset, ICQ5_CL_HDRSIZE, @@ -2036,21 +2036,21 @@ dissect_icqv5Client(const u_char *pd, "Header"); icq_header_tree = proto_item_add_subtree(ti, ett_icq_header); - proto_tree_add_item_format(icq_header_tree, + proto_tree_add_uint_format(icq_header_tree, hf_icq_sessionid, offset+ICQ5_CL_SESSIONID, 4, sessionid, "Session ID: 0x%08x", sessionid); - proto_tree_add_item_format(icq_header_tree, + proto_tree_add_uint_format(icq_header_tree, hf_icq_checkcode, offset+ICQ5_CL_CHECKCODE, 4, key, "Key: 0x%08x", key); - proto_tree_add_item_format(icq_header_tree, + proto_tree_add_uint_format(icq_header_tree, hf_icq_uin, offset+ICQ5_CL_UIN, 4, @@ -2139,7 +2139,7 @@ dissect_icqv5Client(const u_char *pd, cmd); break; default: - proto_tree_add_item_format(icq_tree, + proto_tree_add_uint_format(icq_tree, hf_icq_cmd, offset+ICQ5_CL_CMD, 2, @@ -2195,7 +2195,7 @@ dissect_icqv5Server(const u_char *pd, col_add_fstr(fd, COL_INFO, "ICQv5 %s", findServerCmd(cmd)); if (tree) { - ti = proto_tree_add_item_format(tree, + ti = proto_tree_add_uint_format(tree, proto_icq, offset, pktsize, NULL, @@ -2205,7 +2205,7 @@ dissect_icqv5Server(const u_char *pd, icq_tree = proto_item_add_subtree(ti, ett_icq); - ti = proto_tree_add_item_format(icq_tree, + ti = proto_tree_add_uint_format(icq_tree, hf_icq_type, offset, ICQ5_SRV_HDRSIZE, @@ -2213,7 +2213,7 @@ dissect_icqv5Server(const u_char *pd, "Header"); icq_header_tree = proto_item_add_subtree(ti, ett_icq_header); - proto_tree_add_item_format(icq_header_tree, + proto_tree_add_uint_format(icq_header_tree, hf_icq_sessionid, offset+ICQ5_SRV_SESSIONID, 4, @@ -2230,14 +2230,14 @@ dissect_icqv5Server(const u_char *pd, 2, "Seq Number2: 0x%04x", seq_num2); - proto_tree_add_item_format(icq_header_tree, + proto_tree_add_uint_format(icq_header_tree, hf_icq_uin, offset+ICQ5_SRV_UIN, 4, uin, "UIN: %u", uin); - proto_tree_add_item_format(icq_header_tree, + proto_tree_add_uint_format(icq_header_tree, hf_icq_checkcode, offset+ICQ5_SRV_CHECKCODE, 4, @@ -2309,7 +2309,7 @@ dissect_icqv5Server(const u_char *pd, cmd); break; default: - proto_tree_add_item_format(icq_tree, + proto_tree_add_uint_format(icq_tree, hf_icq_cmd, offset + ICQ5_SRV_CMD, 2, diff --git a/packet-ip.c b/packet-ip.c index e384d90b58..ad680c2550 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.75 2000/03/07 05:24:12 guy Exp $ + * $Id: packet-ip.c,v 1.76 2000/03/12 04:47:39 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -933,11 +933,11 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { 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, + proto_tree_add_uint_format(ip_tree, hf_ip_hdr_len, offset, 1, hlen, "Header length: %u bytes", hlen); if (g_ip_dscp_actif) { - tf = proto_tree_add_item_format(ip_tree, hf_ip_dsfield, offset + 1, 1, iph.ip_tos, + tf = proto_tree_add_uint_format(ip_tree, hf_ip_dsfield, offset + 1, 1, iph.ip_tos, "Differentiated Services Field: 0x%02x (DSCP 0x%02x: %s)", iph.ip_tos, IPDSFIELD_DSCP(iph.ip_tos), val_to_str(IPDSFIELD_DSCP(iph.ip_tos), dscp_vals, "Unknown DSCP")); @@ -946,7 +946,7 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree_add_item(field_tree, hf_ip_dsfield_dscp, offset + 1, 1, iph.ip_tos); proto_tree_add_item(field_tree, hf_ip_dsfield_cu, offset + 1, 1, iph.ip_tos); } else { - tf = proto_tree_add_item_format(ip_tree, hf_ip_tos, offset + 1, 1, iph.ip_tos, + tf = proto_tree_add_uint_format(ip_tree, hf_ip_tos, offset + 1, 1, iph.ip_tos, "Type of service: 0x%02x (%s)", iph.ip_tos, val_to_str( IPTOS_TOS(iph.ip_tos), iptos_vals, "Unknown") ); @@ -969,9 +969,9 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree_add_item(ip_tree, hf_ip_frag_offset, offset + 6, 2, iph.ip_off & IP_OFFSET); proto_tree_add_item(ip_tree, hf_ip_ttl, offset + 8, 1, iph.ip_ttl); - proto_tree_add_item_format(ip_tree, hf_ip_proto, offset + 9, 1, iph.ip_p, + proto_tree_add_uint_format(ip_tree, hf_ip_proto, offset + 9, 1, iph.ip_p, "Protocol: %s (0x%02x)", ipprotostr(iph.ip_p), iph.ip_p); - proto_tree_add_item_format(ip_tree, hf_ip_checksum, offset + 10, 2, iph.ip_sum, + proto_tree_add_uint_format(ip_tree, hf_ip_checksum, offset + 10, 2, iph.ip_sum, "Header checksum: 0x%04x (%s)", iph.ip_sum, ip_checksum_state((e_ip*) &pd[offset])); proto_tree_add_item(ip_tree, hf_ip_src, offset + 12, 4, iph.ip_src); proto_tree_add_item(ip_tree, hf_ip_dst, offset + 16, 4, iph.ip_dst); @@ -1201,11 +1201,11 @@ 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); - proto_tree_add_item_format(icmp_tree, hf_icmp_type, offset, 1, + proto_tree_add_uint_format(icmp_tree, hf_icmp_type, offset, 1, ih.icmp_type, "Type: %u (%s)", ih.icmp_type, type_str); - proto_tree_add_item_format(icmp_tree, hf_icmp_code, offset + 1, 1, + proto_tree_add_uint_format(icmp_tree, hf_icmp_code, offset + 1, 1, ih.icmp_code, "Code: %u %s", ih.icmp_code, code_str); @@ -1362,11 +1362,11 @@ dissect_igmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { 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, + proto_tree_add_uint_format(igmp_tree, hf_igmp_type, offset , 1, lo_nibble(ih.igmp_v_t), "Type: %u (%s)", lo_nibble(ih.igmp_v_t), type_str); - proto_tree_add_item_format(igmp_tree, hf_igmp_unused, offset + 1, 1, + proto_tree_add_uint_format(igmp_tree, hf_igmp_unused, offset + 1, 1, ih.igmp_unused, "Unused: 0x%02x", ih.igmp_unused); diff --git a/packet-ipsec.c b/packet-ipsec.c index ad1374b023..f2dd9164bd 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.11 2000/02/15 21:02:19 gram Exp $ + * $Id: packet-ipsec.c,v 1.12 2000/03/12 04:47:40 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -224,7 +224,7 @@ dissect_ipcomp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset + offsetof(struct ipcomp, comp_cpi), 2, ntohs(ipcomp.comp_cpi)); } else { - proto_tree_add_item_format(ipcomp_tree, hf_ipcomp_cpi, + proto_tree_add_uint_format(ipcomp_tree, hf_ipcomp_cpi, offset + offsetof(struct ipcomp, comp_cpi), 2, ntohs(ipcomp.comp_cpi), "CPI: %s (0x%04x)", diff --git a/packet-ipv6.c b/packet-ipv6.c index 4b8df2cf1c..d8c7e425a2 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.28 2000/03/07 05:26:05 guy Exp $ + * $Id: packet-ipv6.c,v 1.29 2000/03/12 04:47:40 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -286,7 +286,7 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { * there should be no alignment problems for ip6_flow, since it's the first * guint32 in the ipv6 struct */ - proto_tree_add_item_format(ipv6_tree, hf_ipv6_flow, + proto_tree_add_uint_format(ipv6_tree, hf_ipv6_flow, offset + offsetof(struct ip6_hdr, ip6_flow), 4, (unsigned long)(ntohl(ipv6.ip6_flow & IPV6_FLOWLABEL_MASK)), "Flowlabel: 0x%05lx", @@ -296,7 +296,7 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { offset + offsetof(struct ip6_hdr, ip6_plen), 2, ntohs(ipv6.ip6_plen)); - proto_tree_add_item_format(ipv6_tree, hf_ipv6_nxt, + proto_tree_add_uint_format(ipv6_tree, hf_ipv6_nxt, offset + offsetof(struct ip6_hdr, ip6_nxt), 1, ipv6.ip6_nxt, "Next header: %s (0x%02x)", @@ -306,7 +306,7 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { offset + offsetof(struct ip6_hdr, ip6_hlim), 1, ipv6.ip6_hlim); - proto_tree_add_item_format(ipv6_tree, hf_ipv6_src, + proto_tree_add_ipv6_format(ipv6_tree, hf_ipv6_src, offset + offsetof(struct ip6_hdr, ip6_src), 16, &ipv6.ip6_src, #ifdef INET6 @@ -317,7 +317,7 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { #endif ip6_to_str(&ipv6.ip6_src)); - proto_tree_add_item_format(ipv6_tree, hf_ipv6_dst, + proto_tree_add_ipv6_format(ipv6_tree, hf_ipv6_dst, offset + offsetof(struct ip6_hdr, ip6_dst), 16, &ipv6.ip6_dst, #ifdef INET6 diff --git a/packet-ipx.c b/packet-ipx.c index 48413dd099..2d9f6b5393 100644 --- a/packet-ipx.c +++ b/packet-ipx.c @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-ipx.c,v 1.49 2000/02/15 21:02:23 gram Exp $ + * $Id: packet-ipx.c,v 1.50 2000/03/12 04:47:40 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -397,19 +397,19 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ti = proto_tree_add_item(tree, proto_ipx, offset, 30, NULL); 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, + proto_tree_add_uint_format(ipx_tree, hf_ipx_len, offset+2, 2, ipx_length, "Length: %d bytes", ipx_length); - proto_tree_add_item_format(ipx_tree, hf_ipx_hops, offset+4, 1, ipx_hops, + proto_tree_add_uint_format(ipx_tree, hf_ipx_hops, offset+4, 1, ipx_hops, "Transport Control: %d hops", ipx_hops); proto_tree_add_item(ipx_tree, hf_ipx_packet_type, offset+5, 1, ipx_type); proto_tree_add_item(ipx_tree, hf_ipx_dnet, offset+6, 4, ipx_dnet_val); proto_tree_add_item(ipx_tree, hf_ipx_dnode, offset+10, 6, ipx_dnode); - proto_tree_add_item_format(ipx_tree, hf_ipx_dsocket, offset+16, 2, + proto_tree_add_uint_format(ipx_tree, hf_ipx_dsocket, offset+16, 2, ipx_dsocket, "Destination Socket: %s (0x%04X)", port_text(ipx_dsocket), ipx_dsocket); proto_tree_add_item(ipx_tree, hf_ipx_snet, offset+18, 4, ipx_snet_val); proto_tree_add_item(ipx_tree, hf_ipx_snode, offset+22, 6, ipx_snode); - proto_tree_add_item_format(ipx_tree, hf_ipx_ssocket, offset+28, 2, + proto_tree_add_uint_format(ipx_tree, hf_ipx_ssocket, offset+28, 2, ipx_ssocket, "Source Socket: %s (0x%04X)", port_text(ipx_ssocket), ipx_ssocket); } @@ -516,14 +516,14 @@ dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ti = proto_tree_add_item(tree, proto_spx, offset, 12, NULL); spx_tree = proto_item_add_subtree(ti, ett_spx); - proto_tree_add_item_format(spx_tree, hf_spx_connection_control, + proto_tree_add_uint_format(spx_tree, hf_spx_connection_control, offset, 1, pd[offset], "Connection Control: %s (0x%02X)", spx_conn_ctrl(pd[offset]), pd[offset]); - proto_tree_add_item_format(spx_tree, hf_spx_datastream_type, + proto_tree_add_uint_format(spx_tree, hf_spx_datastream_type, offset+1, 1, pd[offset+1], "Datastream Type: %s (0x%02X)", diff --git a/packet-isis-hello.c b/packet-isis-hello.c index 1710e05a7f..4e6606c84d 100644 --- a/packet-isis-hello.c +++ b/packet-isis-hello.c @@ -1,7 +1,7 @@ /* packet-isis-hello.c * Routines for decoding isis hello packets and their CLVs * - * $Id: packet-isis-hello.c,v 1.2 2000/01/24 03:33:33 guy Exp $ + * $Id: packet-isis-hello.c,v 1.3 2000/03/12 04:47:41 gram Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -440,7 +440,7 @@ isis_dissect_isis_hello(int hello_type, int header_length, ti = proto_tree_add_item(tree, proto_isis_hello, offset, END_OF_FRAME, NULL); hello_tree = proto_item_add_subtree(ti, ett_isis_hello); - proto_tree_add_item_format(hello_tree, + proto_tree_add_uint_format(hello_tree, hf_isis_hello_circuit_reserved, offset, 1, ihp->isis_hello_circuit_reserved, "Circuit type: %s, reserved(0x%02x == 0)", @@ -450,7 +450,7 @@ isis_dissect_isis_hello(int hello_type, int header_length, ihp->isis_hello_creserved ); - proto_tree_add_item_format(hello_tree, hf_isis_hello_lan_id, + proto_tree_add_string_format(hello_tree, hf_isis_hello_lan_id, offset + 1, 6, ihp->isis_hello_source_id, "Lan ID: %02x%02x.%02x%02x.%02x%02x", ihp->isis_hello_lan_id[0], @@ -463,18 +463,18 @@ isis_dissect_isis_hello(int hello_type, int header_length, offset + 7, 2,pntohs(&ihp->isis_hello_holding_timer[0])); proto_tree_add_item(hello_tree, hf_isis_hello_pdu_length, offset + 9, 2,pntohs(&ihp->isis_hello_pdu_length[0])); - proto_tree_add_item_format(hello_tree, + proto_tree_add_uint_format(hello_tree, hf_isis_hello_priority_reserved, offset + 11, 1, ihp->isis_hello_priority_reserved, "Priority: %d, reserved(0x%02x == 0)", ihp->isis_hello_priority, ihp->isis_hello_preserved ); if (hello_type == ISIS_TYPE_PTP_HELLO) { - proto_tree_add_item_format(hello_tree, + proto_tree_add_item(hello_tree, hf_isis_hello_local_circuit_id, offset + 12, 1, ihp->isis_hello_lan_id[0] ); } else { - proto_tree_add_item_format(hello_tree, + proto_tree_add_string_format(hello_tree, hf_isis_hello_lan_id, offset + 12, 7, ihp->isis_hello_lan_id, "Lan ID: %02x%02x.%02x%02x.%02x%02x-%02d", diff --git a/packet-isis.c b/packet-isis.c index ba54a2b88c..5d635e1604 100644 --- a/packet-isis.c +++ b/packet-isis.c @@ -2,7 +2,7 @@ * Routines for ISO/OSI network and transport protocol packet disassembly, core * bits. * - * $Id: packet-isis.c,v 1.3 2000/01/24 03:33:31 guy Exp $ + * $Id: packet-isis.c,v 1.4 2000/03/12 04:47:41 gram Exp $ * Stuart Stanley <stuarts@mxmail.net> * * Ethereal - Network traffic analyzer @@ -207,7 +207,7 @@ dissect_isis(const u_char *pd, int offset, frame_data *fd, offset + 2, 1, ihdr->isis_version ); proto_tree_add_item(isis_tree, hf_isis_reserved, offset + 3, 1, ihdr->isis_reserved ); - proto_tree_add_item_format(isis_tree, hf_isis_type, + proto_tree_add_uint_format(isis_tree, hf_isis_type, offset + 4, 1, ihdr->isis_type, "Type: %s (R:%s%s%s)", val_to_str(ihdr->isis_type & ISIS_TYPE_MASK, isis_vals, diff --git a/packet-isl.c b/packet-isl.c index 9a7ec6f40c..ff0a626ba4 100644 --- a/packet-isl.c +++ b/packet-isl.c @@ -1,7 +1,7 @@ /* packet-isl.c * Routines for Cisco ISL Ethernet header disassembly * - * $Id: packet-isl.c,v 1.5 2000/02/15 21:02:27 gram Exp $ + * $Id: packet-isl.c,v 1.6 2000/03/12 04:47:41 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -157,8 +157,8 @@ dissect_isl(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) type = (pd[offset+5] >> 4)&0x0F; if (tree) { - ti = proto_tree_add_item_format(tree, proto_isl, offset, ISL_HEADER_SIZE, - NULL, "ISL"); + ti = proto_tree_add_protocol_format(tree, proto_isl, offset, ISL_HEADER_SIZE, + "ISL"); fh_tree = proto_item_add_subtree(ti, ett_isl); proto_tree_add_item(fh_tree, hf_isl_dst, offset+0, 6, &pd[offset+0]); proto_tree_add_item(fh_tree, hf_isl_type, offset+5, 1, pd[offset+5]); diff --git a/packet-l2tp.c b/packet-l2tp.c index 951aef8359..c6a5556aab 100644 --- a/packet-l2tp.c +++ b/packet-l2tp.c @@ -7,7 +7,7 @@ * Laurent Cazalet <laurent.cazalet@mailclub.net> * Thomas Parvais <thomas.parvais@advalvas.be> * - * $Id: packet-l2tp.c,v 1.3 2000/01/10 23:22:22 guy Exp $ + * $Id: packet-l2tp.c,v 1.4 2000/03/12 04:47:41 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -335,25 +335,25 @@ void dissect_l2tp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (tree) { ti = proto_tree_add_item(tree,proto_l2tp, offset, length , NULL); l2tp_tree = proto_item_add_subtree(ti, ett_l2tp); - proto_tree_add_item_format(l2tp_tree,hf_l2tp_code, offset ,1, + proto_tree_add_uint_format(l2tp_tree,hf_l2tp_code, offset ,1, rhcode, "Packet Type: %s Tunnel Id=%d Session Id=%d",( CONTROL_BIT(ver) ? control_msg : data_msg) ,tid,cid); if (LENGTH_BIT(ver)) { - proto_tree_add_item_format(l2tp_tree,hf_l2tp_code, (offset += 2), 2, + proto_tree_add_uint_format(l2tp_tree,hf_l2tp_code, (offset += 2), 2, rhcode, "Length: %d ", length); } if (SEQUENCE_BIT(ver)) { memcpy(&Ns,(ptr+=2),sizeof(unsigned short)); memcpy(&Nr,(ptr+=2),sizeof(unsigned short)); index += 4; - proto_tree_add_item_format(l2tp_tree,hf_l2tp_code, (offset += 6 ), 4, + proto_tree_add_uint_format(l2tp_tree,hf_l2tp_code, (offset += 6 ), 4, rhcode, "Ns: %d Nr: %d ", htons(Ns), htons(Nr)); } if ((LENGTH_BIT(ver))&&(length==12)) { - proto_tree_add_item_format(l2tp_tree,hf_l2tp_code,offset,1,rhcode, + proto_tree_add_uint_format(l2tp_tree,hf_l2tp_code,offset,1,rhcode, "Zero Length Bit message"); } if (!CONTROL_BIT(ver)) { /* Data Messages so we are done */ - proto_tree_add_item_format(l2tp_tree,hf_l2tp_code, (offset += 4) , (length - 12 ) , rhcode, "Data: "); + proto_tree_add_uint_format(l2tp_tree,hf_l2tp_code, (offset += 4) , (length - 12 ) , rhcode, "Data: "); return; } @@ -366,16 +366,16 @@ void dissect_l2tp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree memcpy(&vendor,(tmp_ptr+=2),sizeof(unsigned short)); memcpy(&avp_type,(tmp_ptr+=2),sizeof(unsigned short)); avp_type=htons(avp_type); - tf = proto_tree_add_item_format(l2tp_tree,hf_l2tp_code, offset , avp_len, + tf = proto_tree_add_uint_format(l2tp_tree,hf_l2tp_code, offset , avp_len, rhcode, "AVP Type %s ", (NUM_AVP_TYPES > avp_type) ? avptypestr[avp_type] : "Unknown"); l2tp_avp_tree = proto_item_add_subtree(tf, ett_l2tp_avp); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset , 1, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset , 1, rhcode, " Mandatory:%s" , (MANDATORY_BIT(htons(ver_len_hidden))) ? "True" : "False" ); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset , 1, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset , 1, rhcode, " Hidden:%s" , (HIDDEN_BIT(htons(ver_len_hidden))) ? "True" : "False" ); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, (offset + 1), 1, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, (offset + 1), 1, rhcode, " Length:%d" , avp_len ); if (HIDDEN_BIT(htons(ver_len_hidden))) { /* don't try do display hidden */ @@ -388,7 +388,7 @@ void dissect_l2tp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree case CONTROL_MESSAGE: memcpy(&msg_type,(tmp_ptr+=2),sizeof(unsigned short)); msg_type=htons(msg_type); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 2 , + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 2 , rhcode, " Control Message Type: (%d) %s", msg_type, ((NUM_CONTROL_CALL_TYPES + 1 ) > msg_type) ? calltypestr[msg_type] : "Unknown" ); @@ -398,7 +398,7 @@ void dissect_l2tp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if ( avp_len >= 10 ) { memcpy(&error_type,(tmp_ptr+=2),sizeof(unsigned short)); error_type=htons(error_type); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 2, rhcode, " Error Type: %d", error_type ); @@ -408,7 +408,7 @@ void dissect_l2tp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree memset(error_string,'\0' ,sizeof(error_string)); tmp_ptr+=4; strncpy(error_string,(tmp_ptr),(avp_len - 10)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 9, (avp_len - 10), + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 9, (avp_len - 10), rhcode, " Error Message: %s", error_string ); } break; @@ -420,235 +420,235 @@ void dissect_l2tp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree avp_ver=(htons(avp_ver)); avp_rev=(htons(avp_rev)); memcpy(&avp_rev,(tmp_ptr+=2),sizeof(unsigned short)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 1, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 1, rhcode, " Version: %d", ((avp_ver&0xff00)>>8) ); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 7, 1, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 7, 1, rhcode, " Revision: %d", (avp_ver&0x00ff)); break; case FRAMING_CAPABIlITIES: tmp_ptr+=2; memcpy(&framing,(tmp_ptr+=2),sizeof(unsigned short)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 4, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 4, rhcode, " ASYNC FRAMING: %s" , (FRAMING_ASYNC(htons(framing))) ? "True" : "False" ); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 4, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 4, rhcode, " SYNC FRAMING: %s" , (FRAMING_SYNC(htons(framing))) ? "True" : "False" ); break; case BEARER_CAPABIlITIES: tmp_ptr+=2; memcpy(&framing,(tmp_ptr+=2),sizeof(unsigned short)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 4 , + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 4 , rhcode, " Analog Access: %s" , (FRAMING_ASYNC(htons(framing))) ? "True" : "False" ); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 4, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 4, rhcode, " Digital Access: %s" , (FRAMING_SYNC(htons(framing))) ? "True" : "False" ); break; case TIE_BREAKER: memcpy(&long_type,(tmp_ptr+=8),sizeof(unsigned long)); long_type = htonl(long_type); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 1, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 1, rhcode, " TIE_BREAKER %l 0x%x", long_type,long_type ); break; case FIRMWARE_REVISION: memcpy(&firmware_rev,(tmp_ptr+=2),sizeof(unsigned short)); firmware_rev=htons(firmware_rev); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 2, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, 2, rhcode, " Firmware Revision: %d 0x%x", firmware_rev,firmware_rev ); break; case HOST_NAME: memset(error_string,'\0',sizeof(error_string)); strncpy(error_string,(tmp_ptr+=2),(avp_len - 6)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, (avp_len - 6), rhcode, " Host Name: %s", error_string ); break; case VENDOR_NAME: memset(message_string,'\0' ,sizeof(message_string)); strncpy(message_string,(tmp_ptr+=2),(avp_len - 6)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, (avp_len - 6), rhcode, " Vendor Name: %s", message_string ); break; case ASSIGNED_TUNNEL_ID: memcpy(&gen_type,(tmp_ptr+=2),sizeof(unsigned short)); gen_type=htons(gen_type); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 2, rhcode, " Tunnel ID: %d", gen_type ); break; case RECEIVE_WINDOW_SIZE: memcpy(&gen_type,(tmp_ptr+=2),sizeof(unsigned short)); gen_type=htons(gen_type); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 2, rhcode, " Receive Window Size: %d", gen_type ); break; case CHALLENGE: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, (avp_len - 6 ), rhcode, " CHAP Challenge: "); break; case CHALLENGE_RESPONSE: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, (avp_len - 6 ), rhcode, " CHAP Challenge Response: "); break; case CAUSE_CODE: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 1, rhcode, " Cause Code: "); break; case ASSIGNED_SESSION: memcpy(&gen_type,(tmp_ptr+=2),sizeof(unsigned short)); gen_type=htons(gen_type); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 2, rhcode, " Assigned Session: %d", gen_type ); break; case CALL_SERIAL_NUMBER: memcpy(&gen_type,(tmp_ptr+=2),sizeof(unsigned short)); gen_type=htons(gen_type); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " Call Serial Number: %d", gen_type ); break; case MINIMUM_BPS: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " Minimum BPS: "); break; case MAXIMUM_BPS: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " Maximum BPS "); break; case BEARER_TYPE: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " Bearer Type: "); break; case FRAMING_TYPE: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " Framing Type: "); break; case UNKNOWN_MESSAGE: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 1, rhcode, " Unknown Message: "); break; case CALLED_NUMBER: memset(message_string,'\0' ,sizeof(message_string)); strncpy(message_string,(tmp_ptr+=2),(avp_len - 6)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, (avp_len - 6), rhcode, " Called Number: %s", message_string ); break; case CALLING_NUMBER: memset(message_string,'\0' ,sizeof(message_string)); strncpy(message_string,(tmp_ptr+=2),(avp_len - 6)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, (avp_len - 6), rhcode, " Calling Number: %s", message_string ); break; case SUB_ADDRESS: memset(message_string,'\0' ,sizeof(message_string)); strncpy(message_string,(tmp_ptr+=2),(avp_len - 6)); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code, offset + 6, (avp_len - 6), rhcode, " Sub-Address: %s", message_string ); break; case TX_CONNECT_SPEED: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " Connect Speed: "); break; case PHYSICAL_CHANNEL: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " Physical Channel: "); break; case INITIAL_RECEIVED_LCP: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, (avp_len - 6 ), rhcode, " Initial LCP Conf REQ: "); break; case LAST_SEND_LCP_CONFREQ: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, (avp_len - 6 ), rhcode, " Last Sent LCP Conf REQ: "); break; case LAST_RECEIVED_LCP_CONFREQ: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, (avp_len - 6 ), rhcode, " Last Received LCP Conf REQ: "); break; case PROXY_AUTHEN_TYPE: memcpy(&msg_type,(tmp_ptr+=2),sizeof(unsigned short)); msg_type=htons(msg_type); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 1, rhcode, " Proxy Authen Type: %s ", authen_types[msg_type] ); break; case PROXY_AUTHEN_NAME: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, (avp_len - 6 ), rhcode, " Proxy Authen Name: "); break; case PROXY_AUTHEN_CHALLENGE: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, (avp_len - 6 ), rhcode, " Proxy Authen Challenge: "); break; case PROXY_AUTHEN_ID: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 2, rhcode, " Paorx Authen ID: "); break; case PROXY_AUTHEN_RESPONSE: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, (avp_len - 6 ), rhcode, " Proxy Authen Response: "); break; case CALL_STATUS_AVPS: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " CRC Errors: "); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 10, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 10, 4, rhcode, " Framing Errors: "); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 14, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 14, 4, rhcode, " Hardware Overruns: "); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 18, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 18, 4, rhcode, " Buffer Overruns: "); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 23, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 23, 4, rhcode, " Time-out Errors: "); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 26, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 26, 4, rhcode, " Alignment Errors: "); break; case ACCM: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 2, rhcode, " Reserve Quantity: "); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 8, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 8, 4, rhcode, " Send ACCM: "); - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 12, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 12, 4, rhcode, " Recv ACCM: "); break; case PRIVATE_GROUP_ID: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 1, rhcode, " Private Group ID: "); break; case RX_CONNECT_SPEED: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset + 6, 4, rhcode, " RX Connect Speed: "); break; case SEQUENCING_REQUIRED: - proto_tree_add_item_format(l2tp_avp_tree,hf_l2tp_code,offset , + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_code,offset , 1, rhcode, " Sequencing Required: "); break; } diff --git a/packet-lapb.c b/packet-lapb.c index 011b5366af..8690c88b7c 100644 --- a/packet-lapb.c +++ b/packet-lapb.c @@ -2,7 +2,7 @@ * Routines for lapb frame disassembly * Olivier Abad <abad@daba.dhis.net> * - * $Id: packet-lapb.c,v 1.10 2000/02/15 21:02:29 gram Exp $ + * $Id: packet-lapb.c,v 1.11 2000/03/12 04:47:42 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -64,8 +64,8 @@ dissect_lapb(const u_char *pd, frame_data *fd, proto_tree *tree) if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, "Invalid LAPB frame"); if (tree) - ti = proto_tree_add_item_format(tree, proto_lapb, 0, fd->cap_len, - NULL, "Invalid LAPB frame"); + ti = proto_tree_add_protocol_format(tree, proto_lapb, 0, fd->cap_len, + "Invalid LAPB frame"); return; } @@ -89,10 +89,10 @@ dissect_lapb(const u_char *pd, frame_data *fd, proto_tree *tree) is_response = FALSE; if (tree) { - ti = proto_tree_add_item_format(tree, proto_lapb, 0, 2, NULL, + ti = proto_tree_add_protocol_format(tree, proto_lapb, 0, 2, "LAPB"); lapb_tree = proto_item_add_subtree(ti, ett_lapb); - proto_tree_add_item_format(lapb_tree, hf_lapb_address, 0, 1, pd[0], + proto_tree_add_uint_format(lapb_tree, hf_lapb_address, 0, 1, pd[0], "Address: 0x%02X", pd[0]); } else @@ -109,7 +109,7 @@ proto_register_lapb(void) { static hf_register_info hf[] = { { &hf_lapb_address, - { "Address Field", "lapb.address", FT_UINT8, BASE_DEC, NULL, 0x0, + { "Address Field", "lapb.address", FT_UINT8, BASE_HEX, NULL, 0x0, "" }}, { &hf_lapb_control, diff --git a/packet-nbns.c b/packet-nbns.c index 8daca2331c..c9ad53dc5f 100644 --- a/packet-nbns.c +++ b/packet-nbns.c @@ -4,7 +4,7 @@ * Gilbert Ramirez <gram@xiexie.org> * Much stuff added by Guy Harris <guy@alum.mit.edu> * - * $Id: packet-nbns.c,v 1.37 2000/02/15 21:02:37 gram Exp $ + * $Id: packet-nbns.c,v 1.38 2000/03/12 04:47:42 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1314,22 +1314,22 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_item(tree, proto_nbdgm, offset, header.dgm_length, NULL); nbdgm_tree = proto_item_add_subtree(ti, ett_nbdgm); - proto_tree_add_item_format(nbdgm_tree, hf_nbdgm_type, + proto_tree_add_uint_format(nbdgm_tree, hf_nbdgm_type, offset, 1, header.msg_type, "Message Type: %s", message[message_index]); - proto_tree_add_item_format(nbdgm_tree, hf_nbdgm_fragment, + proto_tree_add_boolean_format(nbdgm_tree, hf_nbdgm_fragment, offset+1, 1, header.flags.more, "More fragments follow: %s", yesno[header.flags.more]); - proto_tree_add_item_format(nbdgm_tree, hf_nbdgm_first, + proto_tree_add_boolean_format(nbdgm_tree, hf_nbdgm_first, offset+1, 1, header.flags.first, "This is first fragment: %s", yesno[header.flags.first]); - proto_tree_add_item_format(nbdgm_tree, hf_nbdgm_node_type, + proto_tree_add_uint_format(nbdgm_tree, hf_nbdgm_node_type, offset+1, 1, header.flags.node_type, "Node Type: %s", @@ -1466,7 +1466,7 @@ dissect_nbss_packet(const u_char *pd, int offset, frame_data *fd, proto_tree *tr ti = proto_tree_add_item(tree, proto_nbss, offset, length + 4, NULL); nbss_tree = proto_item_add_subtree(ti, ett_nbss); - proto_tree_add_item_format(nbss_tree, hf_nbss_type, + proto_tree_add_uint_format(nbss_tree, hf_nbss_type, offset, 1, msg_type, "Message Type: %s", diff --git a/packet-ncp.c b/packet-ncp.c index a0b41601ea..b26d0aff45 100644 --- a/packet-ncp.c +++ b/packet-ncp.c @@ -3,7 +3,7 @@ * Gilbert Ramirez <gram@xiexie.org> * Modified to allow NCP over TCP/IP decodes by James Coe <jammer@cin.net> * - * $Id: packet-ncp.c,v 1.30 2000/01/22 06:22:16 guy Exp $ + * $Id: packet-ncp.c,v 1.31 2000/03/12 04:47:43 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -590,7 +590,7 @@ dissect_ncp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree_add_text(ncp_tree, offset - 4, 4, "Reply buffer size: %d", ncpiphrq.rplybufsize); }; }; - proto_tree_add_item_format(ncp_tree, hf_ncp_type, + proto_tree_add_uint_format(ncp_tree, hf_ncp_type, offset, 2, header.type, "Type: %s", diff --git a/packet-nfs.c b/packet-nfs.c index c987eb4dbe..d54c9bc99c 100644 --- a/packet-nfs.c +++ b/packet-nfs.c @@ -2,7 +2,7 @@ * Routines for nfs dissection * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de> * - * $Id: packet-nfs.c,v 1.22 2000/03/07 05:22:51 guy Exp $ + * $Id: packet-nfs.c,v 1.23 2000/03/12 04:47:43 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -174,7 +174,7 @@ guint32* status) if (tree) { /* this gives the right NFSv2 number<->message relation */ /* and makes it searchable via "nfs.status" */ - proto_tree_add_item_format(tree, hf_nfs_nfsstat3, + proto_tree_add_uint_format(tree, hf_nfs_nfsstat3, offset+0, 4, stat, "Status: %s (%u)", val_to_str(stat,names_nfs_stat,"%u"), stat); } diff --git a/packet-ntp.c b/packet-ntp.c index 6b97d8a530..9865987449 100644 --- a/packet-ntp.c +++ b/packet-ntp.c @@ -2,7 +2,7 @@ * Routines for NTP packet dissection * Copyright 1999, Nathan Neulinger <nneul@umr.edu> * - * $Id: packet-ntp.c,v 1.9 2000/01/22 02:00:27 guy Exp $ + * $Id: packet-ntp.c,v 1.10 2000/03/12 04:47:44 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -258,15 +258,15 @@ dissect_ntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* Adding flag subtree and items */ flags_tree = proto_item_add_subtree(tf, ett_ntp_flags); - proto_tree_add_item_format(flags_tree, hf_ntp_flags_li, offset, 1, + proto_tree_add_uint_format(flags_tree, hf_ntp_flags_li, offset, 1, *pkt->flags & NTP_LI_MASK, decode_enumerated_bitfield(*pkt->flags, NTP_LI_MASK, sizeof(pkt->flags) * 8, li_types, "Leap Indicator: %s")); - proto_tree_add_item_format(flags_tree, hf_ntp_flags_vn, offset, 1, + proto_tree_add_uint_format(flags_tree, hf_ntp_flags_vn, offset, 1, *pkt->flags & NTP_VN_MASK, decode_enumerated_bitfield(*pkt->flags, NTP_VN_MASK, sizeof(pkt->flags) * 8, ver_nums, "Version number: %s")); - proto_tree_add_item_format(flags_tree, hf_ntp_flags_mode, offset, 1, + proto_tree_add_uint_format(flags_tree, hf_ntp_flags_mode, offset, 1, *pkt->flags & NTP_MODE_MASK, decode_enumerated_bitfield(*pkt->flags, NTP_MODE_MASK, sizeof(pkt->flags) * 8, mode_types, "Mode: %s")); @@ -282,12 +282,12 @@ dissect_ntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } else { strcpy (buff, "Peer Clock Stratum: reserved: %d"); } - proto_tree_add_item_format(ntp_tree, hf_ntp_stratum, offset+1, 1, pkt->stratum, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_stratum, offset+1, 1, pkt->stratum, buff, (int) *pkt->stratum); /* Poll interval, 1byte field indicating the maximum interval between * successive messages, in seconds to the nearest power of two. */ - proto_tree_add_item_format(ntp_tree, hf_ntp_ppoll, offset+2, 1, pkt->ppoll, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_ppoll, offset+2, 1, pkt->ppoll, (((*pkt->ppoll >= 4) && (*pkt->ppoll <= 16)) ? "Peer Pooling Interval: %d (%d sec)" : "Peer Pooling Interval: invalid (%d)"), (int) *pkt->ppoll, @@ -295,13 +295,13 @@ dissect_ntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* Precision, 1byte field indicating the precision of the * local clock, in seconds to the nearest power of two. */ - proto_tree_add_item_format(ntp_tree, hf_ntp_precision, offset+3, 1, pkt->precision, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_precision, offset+3, 1, pkt->precision, "Peer Clock Precision: %8.6f sec", pow(2, *pkt->precision)); /* Root Delay is a 32-bit signed fixed-point number indicating the * total roundtrip delay to the primary reference source, in seconds * with fraction point between bits 15 and 16. */ - proto_tree_add_item_format(ntp_tree, hf_ntp_rootdelay, offset+4, 4, pkt->rootdelay, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_rootdelay, offset+4, 4, pkt->rootdelay, "Root Delay: %9.4f sec", ((gint32) pntohs(pkt->rootdelay)) + pntohs(pkt->rootdelay + 2) / 65536.0); @@ -309,7 +309,7 @@ dissect_ntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) * the nominal error relative to the primary reference source, in * seconds with fraction point between bits 15 and 16. */ - proto_tree_add_item_format(ntp_tree, hf_ntp_rootdispersion, offset+8, 4, pkt->rootdispersion, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_rootdispersion, offset+8, 4, pkt->rootdispersion, "Clock Dispersion: %9.4f sec", ((gint32) pntohs(pkt->rootdispersion)) + pntohs(pkt->rootdispersion + 2) / 65536.0); @@ -332,30 +332,30 @@ dissect_ntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } } else strcpy (buff, get_hostname (pntohl(pkt->refid))); - proto_tree_add_item_format(ntp_tree, hf_ntp_refid, offset+12, 4, pkt->refid, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_refid, offset+12, 4, pkt->refid, "Reference Clock ID: %s", buff); /* Reference Timestamp: This is the time at which the local clock was * last set or corrected. */ - proto_tree_add_item_format(ntp_tree, hf_ntp_reftime, offset+16, 8, pkt->reftime, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_reftime, offset+16, 8, pkt->reftime, "Reference Clock Update Time: %s", ntp_fmt_ts(pkt->reftime, buff)); /* Originate Timestamp: This is the time at which the request departed * the client for the server. */ - proto_tree_add_item_format(ntp_tree, hf_ntp_org, offset+24, 8, pkt->org, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_org, offset+24, 8, pkt->org, "Originate Time Stamp: %s", ntp_fmt_ts(pkt->org, buff)); /* Receive Timestamp: This is the time at which the request arrived at * the server. */ - proto_tree_add_item_format(ntp_tree, hf_ntp_rec, offset+32, 8, pkt->rec, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_rec, offset+32, 8, pkt->rec, "Receive Time Stamp: %s", ntp_fmt_ts(pkt->rec, buff)); /* Transmit Timestamp: This is the time at which the reply departed the * server for the client. */ - proto_tree_add_item_format(ntp_tree, hf_ntp_xmt, offset+40, 8, pkt->xmt, + proto_tree_add_bytes_format(ntp_tree, hf_ntp_xmt, offset+40, 8, pkt->xmt, "Transmit Time Stamp: %s", ntp_fmt_ts(pkt->xmt, buff)); diff --git a/packet-osi.c b/packet-osi.c index a831b5b00e..1359d249a8 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.22 2000/03/02 07:27:05 guy Exp $ + * $Id: packet-osi.c,v 1.23 2000/03/12 04:47:45 gram Exp $ * Laurent Deniel <deniel@worldnet.fr> * * Ethereal - Network traffic analyzer @@ -1499,7 +1499,7 @@ void dissect_clnp(const u_char *pd, int offset, frame_data *fd, if (tree) { ti = proto_tree_add_item(tree, proto_clnp, offset, 1, NULL); clnp_tree = proto_item_add_subtree(ti, ett_clnp); - proto_tree_add_item_format(clnp_tree, hf_clnp_id, offset, 1, + proto_tree_add_uint_format(clnp_tree, hf_clnp_id, offset, 1, clnp.cnf_proto_id, "Inactive subset"); } @@ -1529,11 +1529,11 @@ void dissect_clnp(const u_char *pd, int offset, frame_data *fd, clnp.cnf_hdr_len); proto_tree_add_item(clnp_tree, hf_clnp_version, offset + 2, 1, clnp.cnf_vers); - proto_tree_add_item_format(clnp_tree, hf_clnp_ttl, offset + 3, 1, + proto_tree_add_uint_format(clnp_tree, hf_clnp_ttl, offset + 3, 1, clnp.cnf_ttl, "TTL: %d (%d secs)", clnp.cnf_ttl, clnp.cnf_ttl / 2); - proto_tree_add_item_format(clnp_tree, hf_clnp_type, offset + 4, 1, + proto_tree_add_uint_format(clnp_tree, hf_clnp_type, offset + 4, 1, clnp.cnf_type, "Type code: 0x%02x (%s%s%s%s)", clnp.cnf_type, @@ -1544,7 +1544,7 @@ void dissect_clnp(const u_char *pd, int offset, frame_data *fd, "DT" : "ER"); proto_tree_add_item(clnp_tree, hf_clnp_pdu_length, offset + 5, 2, EXTRACT_SHORT(&clnp.cnf_seglen_msb)); - proto_tree_add_item_format(clnp_tree, hf_clnp_checksum, offset + 7, 2, + proto_tree_add_uint_format(clnp_tree, hf_clnp_checksum, offset + 7, 2, EXTRACT_SHORT(&clnp.cnf_cksum_msb), "Checksum: 0x%04x", EXTRACT_SHORT(&clnp.cnf_cksum_msb)); @@ -1567,13 +1567,13 @@ void dissect_clnp(const u_char *pd, int offset, frame_data *fd, if (tree) { proto_tree_add_item(clnp_tree, hf_clnp_dest_length, offset, 1, dst_len); - proto_tree_add_item_format(clnp_tree, hf_clnp_dest, offset + 1 , dst_len, + proto_tree_add_bytes_format(clnp_tree, hf_clnp_dest, offset + 1 , dst_len, &pd[offset + 1], "Destination address: %s", print_nsap(&pd[offset + 1], dst_len)); proto_tree_add_item(clnp_tree, hf_clnp_src_length, offset + 1 + dst_len, 1, src_len); - proto_tree_add_item_format(clnp_tree, hf_clnp_src, + proto_tree_add_bytes_format(clnp_tree, hf_clnp_src, offset + dst_len + 2, src_len, &pd[offset + dst_len + 2], "Source address: %s", diff --git a/packet-pim.c b/packet-pim.c index e481fa7563..bcd5a0b8d0 100644 --- a/packet-pim.c +++ b/packet-pim.c @@ -2,7 +2,7 @@ * Routines for PIM disassembly * (c) Copyright Jun-ichiro itojun Hagino <itojun@itojun.org> * - * $Id: packet-pim.c,v 1.9 2000/02/15 21:02:49 gram Exp $ + * $Id: packet-pim.c,v 1.10 2000/03/12 04:47:47 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -223,7 +223,7 @@ dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree_add_item(pim_tree, hf_pim_version, offset, 1, PIM_VER(pim.pim_typever)); - proto_tree_add_item_format(pim_tree, hf_pim_type, offset, 1, + proto_tree_add_uint_format(pim_tree, hf_pim_type, offset, 1, PIM_TYPE(pim.pim_typever), "Type: %s (%u)", typestr, PIM_TYPE(pim.pim_typever)); diff --git a/packet-portmap.c b/packet-portmap.c index 60698d1b17..57db44fdd8 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.12 2000/01/22 05:49:06 guy Exp $ + * $Id: packet-portmap.c,v 1.13 2000/03/12 04:47:48 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -74,14 +74,14 @@ int dissect_getport_call(const u_char *pd, int offset, frame_data *fd, if ( tree ) { prog = pntohl(&pd[offset+0]); - proto_tree_add_item_format(tree, hf_portmap_prog, + proto_tree_add_uint_format(tree, hf_portmap_prog, offset, 4, prog, "Program: %s (%u)", rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, offset+4, 4, pntohl(&pd[offset+4])); proto = pntohl(&pd[offset+8]); - proto_tree_add_item_format(tree, hf_portmap_proto, + proto_tree_add_uint_format(tree, hf_portmap_proto, offset+8, 4, proto, "Proto: %s (%u)", ipprotostr(proto), proto); proto_tree_add_item(tree, hf_portmap_port, @@ -114,14 +114,14 @@ int dissect_set_call(const u_char *pd, int offset, frame_data *fd, if ( tree ) { prog = pntohl(&pd[offset+0]); - proto_tree_add_item_format(tree, hf_portmap_prog, + proto_tree_add_uint_format(tree, hf_portmap_prog, offset, 4, prog, "Program: %s (%d)", rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, offset+4, 4, pntohl(&pd[offset+4])); proto = pntohl(&pd[offset+8]); - proto_tree_add_item_format(tree, hf_portmap_proto, + proto_tree_add_uint_format(tree, hf_portmap_proto, offset+8, 4, proto, "Proto: %s (%d)", ipprotostr(proto), proto); proto_tree_add_item(tree, hf_portmap_port, @@ -142,7 +142,7 @@ int dissect_unset_call(const u_char *pd, int offset, frame_data *fd, if ( tree ) { prog = pntohl(&pd[offset+0]); - proto_tree_add_item_format(tree, hf_portmap_prog, + proto_tree_add_uint_format(tree, hf_portmap_prog, offset, 4, prog, "Program: %s (%d)", rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, @@ -206,12 +206,12 @@ int dissect_dump_reply(const u_char *pd, int offset, frame_data *fd, rpc_prog_name(prog), prog, version); subtree = proto_item_add_subtree(ti, ett_portmap_entry); - proto_tree_add_item_format(subtree, hf_portmap_prog, + proto_tree_add_uint_format(subtree, hf_portmap_prog, offset+0, 4, prog, "Program: %s (%u)", rpc_prog_name(prog), prog); proto_tree_add_item(subtree, hf_portmap_version, offset+4, 4, version); - proto_tree_add_item_format(subtree, hf_portmap_proto, + proto_tree_add_uint_format(subtree, hf_portmap_proto, offset+8, 4, proto, "Protocol: %s (0x%02x)", ipprotostr(proto), proto); proto_tree_add_item(subtree, hf_portmap_port, @@ -273,7 +273,7 @@ int dissect_rpcb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset; prog = EXTRACT_UINT(pd, offset + 0); if (rpcb_tree) - proto_tree_add_item_format(rpcb_tree, hf_portmap_rpcb_prog, + proto_tree_add_uint_format(rpcb_tree, hf_portmap_rpcb_prog, offset+0, 4, prog, "Program: %s (%u)", rpc_prog_name(prog), prog); offset += 4; diff --git a/packet-ppp.c b/packet-ppp.c index f8d0971407..bf81184d52 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.28 2000/02/15 21:02:51 gram Exp $ + * $Id: packet-ppp.c,v 1.29 2000/03/12 04:47:48 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1092,10 +1092,10 @@ dissect_mp(const u_char *pd, int offset, frame_data *fd, 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); - proto_tree_add_item_format(hdr_tree, hf_mp_frag_first, offset, 1, first, + proto_tree_add_boolean_format(hdr_tree, hf_mp_frag_first, offset, 1, first, "%s", decode_boolean_bitfield(flags, MP_FRAG_FIRST, sizeof(flags) * 8, "first", "not first")); - proto_tree_add_item_format(hdr_tree, hf_mp_frag_last, offset, 1, last, + proto_tree_add_boolean_format(hdr_tree, hf_mp_frag_last, offset, 1, last, "%s", decode_boolean_bitfield(flags, MP_FRAG_LAST, sizeof(flags) * 8, "last", "not last")); proto_tree_add_text(hdr_tree, offset, 1, "%s", diff --git a/packet-radius.c b/packet-radius.c index e0ce3ae05f..0adfba4383 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.6 1999/12/02 23:25:29 gram Exp $ + * $Id: packet-radius.c,v 1.7 2000/03/12 04:47:48 gram Exp $ * * Ethereal - Network traffic analyzer * By Johan Feyaerts @@ -584,13 +584,13 @@ proto_tree radius_tree = proto_item_add_subtree(ti, ett_radius); - proto_tree_add_item_format(radius_tree,hf_radius_code, offset, 1, + proto_tree_add_uint_format(radius_tree,hf_radius_code, offset, 1, rh.rh_code, "Packet code:0x%01x (%s)",rhcode, codestrval); - proto_tree_add_item_format(radius_tree,hf_radius_id, offset+1, 1, + proto_tree_add_uint_format(radius_tree,hf_radius_id, offset+1, 1, rh.rh_ident, "Packet identifier: 0x%01x (%d)", rhident,rhident); - proto_tree_add_item_format(radius_tree, hf_radius_length, + proto_tree_add_uint_format(radius_tree, hf_radius_length, offset+2, 2, (guint16)rhlength, "Packet length: 0x%02x(%d)",rhlength,rhlength); diff --git a/packet-ripng.c b/packet-ripng.c index dc7b00d019..e6243c81ba 100644 --- a/packet-ripng.c +++ b/packet-ripng.c @@ -3,7 +3,7 @@ * (c) Copyright Jun-ichiro itojun Hagino <itojun@itojun.org> * derived from packet-rip.c * - * $Id: packet-ripng.c,v 1.7 2000/03/07 05:28:39 guy Exp $ + * $Id: packet-ripng.c,v 1.8 2000/03/12 04:47:48 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -79,7 +79,7 @@ dissect_ripng(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ti = proto_tree_add_item(tree, proto_ripng, offset, END_OF_FRAME, NULL); ripng_tree = proto_item_add_subtree(ti, ett_ripng); - proto_tree_add_item_format(ripng_tree, hf_ripng_cmd, offset, 1, + proto_tree_add_uint_format(ripng_tree, hf_ripng_cmd, offset, 1, rip6.rip6_cmd, "Command: %s (%u)", cmd, rip6.rip6_cmd); proto_tree_add_item(ripng_tree, hf_ripng_version, offset + 1, 1, diff --git a/packet-rpc.c b/packet-rpc.c index e1c72fceb1..5652dd6096 100644 --- a/packet-rpc.c +++ b/packet-rpc.c @@ -2,7 +2,7 @@ * Routines for rpc dissection * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de> * - * $Id: packet-rpc.c,v 1.27 2000/03/09 12:09:53 girlich Exp $ + * $Id: packet-rpc.c,v 1.28 2000/03/12 04:47:49 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -913,7 +913,7 @@ dissect_rpc( const u_char *pd, int offset, frame_data *fd, proto_tree *tree) xid = EXTRACT_UINT(pd,offset+0); if (rpc_tree) { - proto_tree_add_item_format(rpc_tree,hf_rpc_xid, + proto_tree_add_uint_format(rpc_tree,hf_rpc_xid, offset+0, 4, xid, "XID: 0x%x (%u)", xid, xid); } @@ -941,7 +941,7 @@ dissect_rpc( const u_char *pd, int offset, frame_data *fd, proto_tree *tree) prog = EXTRACT_UINT(pd,offset+4); if (rpc_tree) { - proto_tree_add_item_format(rpc_tree, + proto_tree_add_uint_format(rpc_tree, hf_rpc_program, offset+4, 4, prog, "Program: %s (%u)", progname, prog); } @@ -981,7 +981,7 @@ dissect_rpc( const u_char *pd, int offset, frame_data *fd, proto_tree *tree) procname = procname_static; } if (rpc_tree) { - proto_tree_add_item_format(rpc_tree, + proto_tree_add_uint_format(rpc_tree, hf_rpc_procedure, offset+12, 4, proc, "Procedure: %s (%u)", procname, proc); } @@ -1098,12 +1098,12 @@ dissect_rpc( const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } if (rpc_tree) { - proto_tree_add_item_format(rpc_tree, + proto_tree_add_uint_format(rpc_tree, hf_rpc_program, 0, 0, prog, "Program: %s (%u)", progname, prog); proto_tree_add_item(rpc_tree, hf_rpc_programversion, 0, 0, vers); - proto_tree_add_item_format(rpc_tree, + proto_tree_add_uint_format(rpc_tree, hf_rpc_procedure, 0, 0, proc, "Procedure: %s (%u)", procname, proc); } @@ -1220,7 +1220,7 @@ dissect_rpc_prog: if (ptree) { proto_tree_add_item(ptree, hf_rpc_programversion, 0, 0, vers); - proto_tree_add_item_format(ptree, + proto_tree_add_uint_format(ptree, hf_rpc_procedure, 0, 0, proc, "Procedure: %s (%u)", procname, proc); } diff --git a/packet-rx.c b/packet-rx.c index 98172e339a..1e88f54d89 100644 --- a/packet-rx.c +++ b/packet-rx.c @@ -4,7 +4,7 @@ * Based on routines from tcpdump patches by * Ken Hornstein <kenh@cmf.nrl.navy.mil> * - * $Id: packet-rx.c,v 1.8 2000/02/15 21:03:05 gram Exp $ + * $Id: packet-rx.c,v 1.9 2000/03/12 04:47:49 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -110,8 +110,8 @@ dissect_rx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (tree) { - ti = proto_tree_add_item_format(tree, proto_rx, offset, - sizeof(struct rx_header), NULL, "RX Protocol (%s)", + ti = proto_tree_add_protocol_format(tree, proto_rx, offset, + sizeof(struct rx_header), "RX Protocol (%s)", val_to_str(rxh->type,rx_types,"unknown (%d)")); rx_tree = proto_item_add_subtree(ti, ett_rx); diff --git a/packet-sna.c b/packet-sna.c index 817030413d..8b738ba19a 100644 --- a/packet-sna.c +++ b/packet-sna.c @@ -2,7 +2,7 @@ * Routines for SNA * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-sna.c,v 1.11 2000/01/07 22:05:39 guy Exp $ + * $Id: packet-sna.c,v 1.12 2000/03/12 04:47:49 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -491,9 +491,9 @@ dissect_fid2 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* Addresses in FID 2 are FT_UINT8 */ proto_tree_add_text(tree, offset+1, 1, "Reserved"); - proto_tree_add_item_format(tree, hf_sna_th_daf ,offset+2, 1, daf, + proto_tree_add_uint_format(tree, hf_sna_th_daf ,offset+2, 1, daf, "Destination Address Field: 0x%02x", daf); - proto_tree_add_item_format(tree, hf_sna_th_oaf ,offset+3, 1, oaf, + proto_tree_add_uint_format(tree, hf_sna_th_oaf ,offset+3, 1, oaf, "Origin Address Field: 0x%02x", oaf); proto_tree_add_item(tree, hf_sna_th_snf ,offset+4, 2, snf); diff --git a/packet-sscop.c b/packet-sscop.c index 80a0bbc63a..85df8e37b6 100644 --- a/packet-sscop.c +++ b/packet-sscop.c @@ -2,7 +2,7 @@ * Routines for SSCOP (Q.2110, Q.SAAL) frame disassembly * Guy Harris <guy@alum.mit.edu> * - * $Id: packet-sscop.c,v 1.5 2000/02/15 21:03:12 gram Exp $ + * $Id: packet-sscop.c,v 1.6 2000/03/12 04:47:50 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -192,8 +192,8 @@ dissect_sscop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) break; } if (tree) { - ti = proto_tree_add_item_format(tree, proto_sscop, pi.len - pdu_len, - pdu_len, NULL, "SSCOP"); + ti = proto_tree_add_protocol_format(tree, proto_sscop, pi.len - pdu_len, + pdu_len, "SSCOP"); sscop_tree = proto_item_add_subtree(ti, ett_sscop); proto_tree_add_text(sscop_tree, SSCOP_PDU_TYPE, 1, diff --git a/packet-tcp.c b/packet-tcp.c index 3933e63016..fa4ba8b555 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.59 2000/03/12 04:26:35 guy Exp $ + * $Id: packet-tcp.c,v 1.60 2000/03/12 04:47:50 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -452,20 +452,20 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { } if (tree) { - ti = proto_tree_add_item_format(tree, proto_tcp, offset, hlen, NULL, "Transmission Control Protocol, Src Port: %s (%u), Dst Port: %s (%u), Seq: %u, Ack: %u", get_tcp_port(th.th_sport), th.th_sport, get_tcp_port(th.th_dport), th.th_dport, th.th_seq, th.th_ack); + ti = proto_tree_add_protocol_format(tree, proto_tcp, offset, hlen, "Transmission Control Protocol, Src Port: %s (%u), Dst Port: %s (%u), Seq: %u, Ack: %u", get_tcp_port(th.th_sport), th.th_sport, get_tcp_port(th.th_dport), th.th_dport, th.th_seq, th.th_ack); tcp_tree = proto_item_add_subtree(ti, ett_tcp); - proto_tree_add_item_format(tcp_tree, hf_tcp_srcport, offset, 2, th.th_sport, + proto_tree_add_uint_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, + proto_tree_add_uint_format(tcp_tree, hf_tcp_dstport, offset + 2, 2, th.th_dport, "Destination port: %s (%u)", get_tcp_port(th.th_dport), th.th_dport); proto_tree_add_item_hidden(tcp_tree, hf_tcp_port, offset, 2, th.th_sport); proto_tree_add_item_hidden(tcp_tree, hf_tcp_port, offset + 2, 2, th.th_dport); proto_tree_add_item(tcp_tree, hf_tcp_seq, offset + 4, 4, th.th_seq); if (th.th_flags & TH_ACK) proto_tree_add_item(tcp_tree, hf_tcp_ack, offset + 8, 4, th.th_ack); - proto_tree_add_item_format(tcp_tree, hf_tcp_hdr_len, offset + 12, 1, hlen, + proto_tree_add_uint_format(tcp_tree, hf_tcp_hdr_len, offset + 12, 1, hlen, "Header length: %u bytes", hlen); - tf = proto_tree_add_item_format(tcp_tree, hf_tcp_flags, offset + 13, 1, + tf = proto_tree_add_uint_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); proto_tree_add_item(field_tree, hf_tcp_flags_urg, offset + 13, 1, th.th_flags); diff --git a/packet-trmac.c b/packet-trmac.c index 199e3c2561..87babc5cb0 100644 --- a/packet-trmac.c +++ b/packet-trmac.c @@ -2,7 +2,7 @@ * Routines for Token-Ring Media Access Control * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-trmac.c,v 1.19 2000/01/22 06:22:18 guy Exp $ + * $Id: packet-trmac.c,v 1.20 2000/03/12 04:47:50 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -296,7 +296,7 @@ dissect_trmac(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { 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, + proto_tree_add_uint_format(mac_tree, hf_trmac_length, offset, 2, mv_length, "Total Length: %d bytes", mv_length); proto_tree_add_item(mac_tree, hf_trmac_srcclass, offset+2, 1, pd[offset+2] & 0x0f); proto_tree_add_item(mac_tree, hf_trmac_dstclass, offset+2, 1, pd[offset+2] >> 4 ); diff --git a/packet-udp.c b/packet-udp.c index 65b608ef5f..f0d724de7e 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.51 2000/02/23 22:28:50 oabad Exp $ + * $Id: packet-udp.c,v 1.52 2000/03/12 04:47:50 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -252,16 +252,16 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { ti = proto_tree_add_item(tree, proto_udp, offset, 8); udp_tree = proto_item_add_subtree(ti, ett_udp); - proto_tree_add_item_format(udp_tree, hf_udp_srcport, offset, 2, uh_sport, + proto_tree_add_uint_format(udp_tree, hf_udp_srcport, offset, 2, uh_sport, "Source port: %s (%u)", get_udp_port(uh_sport), uh_sport); - proto_tree_add_item_format(udp_tree, hf_udp_dstport, offset + 2, 2, uh_dport, + proto_tree_add_uint_format(udp_tree, hf_udp_dstport, offset + 2, 2, uh_dport, "Destination port: %s (%u)", get_udp_port(uh_dport), uh_dport); proto_tree_add_item_hidden(udp_tree, hf_udp_port, offset, 2, uh_sport); proto_tree_add_item_hidden(udp_tree, hf_udp_port, offset+2, 2, uh_dport); proto_tree_add_item(udp_tree, hf_udp_length, offset + 4, 2, uh_ulen); - proto_tree_add_item_format(udp_tree, hf_udp_checksum, offset + 6, 2, uh_sum, + proto_tree_add_uint_format(udp_tree, hf_udp_checksum, offset + 6, 2, uh_sum, "Checksum: 0x%04x", uh_sum); } diff --git a/packet-v120.c b/packet-v120.c index 6e94f24735..1a4bd318fc 100644 --- a/packet-v120.c +++ b/packet-v120.c @@ -2,7 +2,7 @@ * Routines for v120 frame disassembly * Bert Driehuis <driehuis@playbeing.org> * - * $Id: packet-v120.c,v 1.3 1999/12/14 06:21:19 guy Exp $ + * $Id: packet-v120.c,v 1.4 2000/03/12 04:47:51 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -71,8 +71,8 @@ dissect_v120(const u_char *pd, frame_data *fd, proto_tree *tree) if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, "Invalid V.120 frame"); if (tree) - ti = proto_tree_add_item_format(tree, proto_v120, 0, fd->cap_len, - NULL, "Invalid V.120 frame"); + ti = proto_tree_add_protocol_format(tree, proto_v120, 0, fd->cap_len, + "Invalid V.120 frame"); return; } @@ -100,14 +100,14 @@ dissect_v120(const u_char *pd, frame_data *fd, proto_tree *tree) else v120len = 5; if (tree) { - ti = proto_tree_add_item_format(tree, proto_v120, 0, v120len, NULL, + ti = proto_tree_add_protocol_format(tree, proto_v120, 0, v120len, "V.120"); v120_tree = proto_item_add_subtree(ti, ett_v120); addr = pd[1] << 8 | pd[0]; sprintf(info, "LLI: %d C/R: %s", ((pd[0] & 0xfc) << 5) | ((pd[1] & 0xfe) >> 1), pd[0] & 0x02 ? "R" : "C"); - tc = proto_tree_add_item_format(v120_tree, ett_v120_address, + tc = proto_tree_add_text(v120_tree, 0, 2, "Address field: %s", info); address_tree = proto_item_add_subtree(tc, ett_v120_address); @@ -150,7 +150,7 @@ dissect_v120_header(const u_char *pd, int offset, frame_data *fd, proto_tree *tr nbits = header_len * 8; sprintf(info, "Header: B: %d F: %d", pd[offset] & 0x02 ? 1:0, pd[offset] & 0x01 ? 1:0); - tc = proto_tree_add_item_format(tree, ett_v120_header, + tc = proto_tree_add_text(tree, offset, header_len, "Header octet: %s (0x%02X)", info, pd[offset]); h_tree = proto_item_add_subtree(tc, ett_v120_header); diff --git a/packet-vrrp.c b/packet-vrrp.c index f905b6c0b7..a383c9c966 100644 --- a/packet-vrrp.c +++ b/packet-vrrp.c @@ -4,7 +4,7 @@ * * Heikki Vatiainen <hessu@cs.tut.fi> * - * $Id: packet-vrrp.c,v 1.2 2000/01/07 22:05:42 guy Exp $ + * $Id: packet-vrrp.c,v 1.3 2000/03/12 04:47:51 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -133,7 +133,7 @@ void dissect_vrrp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree ti = proto_tree_add_item(tree, proto_vrrp, offset, END_OF_FRAME, NULL); vrrp_tree = proto_item_add_subtree(ti, ett_vrrp); - tv = proto_tree_add_item_format(vrrp_tree, hf_vrrp_ver_type, offset, 1, + tv = proto_tree_add_uint_format(vrrp_tree, hf_vrrp_ver_type, offset, 1, vrh.ver_type, "Version %u, Packet type %u (%s)", hi_nibble(vrh.ver_type), lo_nibble(vrh.ver_type), val_to_str(lo_nibble(vrh.ver_type), vrrp_type_vals, "Unknown")); diff --git a/packet-vtp.c b/packet-vtp.c index d53fb13a6e..3374e047e1 100644 --- a/packet-vtp.c +++ b/packet-vtp.c @@ -1,7 +1,7 @@ /* packet-vtp.c * Routines for the disassembly of Cisco's Virtual Trunking Protocol * - * $Id: packet-vtp.c,v 1.1 2000/02/05 09:19:04 guy Exp $ + * $Id: packet-vtp.c,v 1.2 2000/03/12 04:47:51 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -131,7 +131,7 @@ dissect_vtp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) 1, md_len); offset += 1; - proto_tree_add_item_format(vtp_tree, hf_vtp_md, offset, + proto_tree_add_string_format(vtp_tree, hf_vtp_md, offset, 32, &pd[offset], "Management Domain: %.32s", &pd[offset]); offset += 32; @@ -144,7 +144,7 @@ dissect_vtp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset, 4, &pd[offset]); offset += 4; - proto_tree_add_item_format(vtp_tree, hf_vtp_upd_ts, + proto_tree_add_string_format(vtp_tree, hf_vtp_upd_ts, offset, 12, &pd[offset], "Update Timestamp: %.2s-%.2s-%.2s %.2s:%.2s:%.2s", &pd[offset], &pd[offset+2], &pd[offset+4], @@ -165,7 +165,7 @@ dissect_vtp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) 1, md_len); offset += 1; - proto_tree_add_item_format(vtp_tree, hf_vtp_md, offset, + proto_tree_add_string_format(vtp_tree, hf_vtp_md, offset, 32, &pd[offset], "Management Domain: %.32s", &pd[offset]); offset += 32; @@ -207,7 +207,7 @@ dissect_vtp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) 1, md_len); offset += 1; - proto_tree_add_item_format(vtp_tree, hf_vtp_md, offset, + proto_tree_add_string_format(vtp_tree, hf_vtp_md, offset, 32, &pd[offset], "Management Domain: %.32s", &pd[offset]); offset += 32; @@ -341,7 +341,7 @@ dissect_vlan_info(const u_char *pd, int offset, proto_tree *tree) if (!BYTES_ARE_IN_FRAME(offset, vlan_name_len) || vlan_info_left < vlan_name_len) return -1; - proto_tree_add_item_format(vlan_info_tree, hf_vtp_vlan_name, offset, + proto_tree_add_string_format(vlan_info_tree, hf_vtp_vlan_name, offset, vlan_name_len, &pd[offset], "VLAN Name: %.*s", vlan_name_len, &pd[offset]); offset += vlan_name_len; diff --git a/packet-wccp.c b/packet-wccp.c index f70ccc0324..88c208be9c 100644 --- a/packet-wccp.c +++ b/packet-wccp.c @@ -2,7 +2,7 @@ * Routines for Web Cache Coordination Protocol dissection * Jerry Talkington <jerryt@netapp.com> * - * $Id: packet-wccp.c,v 1.4 1999/12/14 02:09:52 guy Exp $ + * $Id: packet-wccp.c,v 1.5 2000/03/12 04:47:51 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -168,7 +168,7 @@ dissect_wccp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "Number of Web Caches: %u", cache_count); offset += 4; for (i = 0; i < cache_count; i++) { - proto_tree_add_item_format(wccp_tree, + proto_tree_add_ipv4_format(wccp_tree, hf_cache_ip, offset, 4, pntohl(&pd[offset]), "Web Cache %d IP Address: %s", i, diff --git a/packet-who.c b/packet-who.c index bfc9b05eaf..1c67041b67 100644 --- a/packet-who.c +++ b/packet-who.c @@ -2,7 +2,7 @@ * Routines for who protocol (see man rwhod) * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-who.c,v 1.3 2000/01/07 22:05:42 guy Exp $ + * $Id: packet-who.c,v 1.4 2000/03/12 04:47:51 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -216,7 +216,7 @@ dissect_whoent(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) line_offset += 4; idle_secs = pntohl(&pd[line_offset]); - proto_tree_add_item_format(whoent_tree, hf_who_idle, line_offset, 4, idle_secs, + proto_tree_add_uint_format(whoent_tree, hf_who_idle, line_offset, 4, idle_secs, "Idle: %s", time_secs_to_str(idle_secs)); line_offset += 4; diff --git a/packet-x25.c b/packet-x25.c index 3030bee76b..e6ece02fa8 100644 --- a/packet-x25.c +++ b/packet-x25.c @@ -2,7 +2,7 @@ * Routines for x25 packet disassembly * Olivier Abad <abad@daba.dhis.net> * - * $Id: packet-x25.c,v 1.21 2000/02/22 07:42:49 guy Exp $ + * $Id: packet-x25.c,v 1.22 2000/03/12 04:47:51 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1387,8 +1387,8 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, "Invalid/short X.25 packet"); if (tree) - proto_tree_add_item_format(tree, (modulo == 8 ? proto_x25 : proto_ex25), - localoffset, END_OF_FRAME, NULL, + proto_tree_add_protocol_format(tree, (modulo == 8 ? proto_x25 : proto_ex25), + localoffset, END_OF_FRAME, "Invalid/short X.25 packet"); return; } @@ -1416,7 +1416,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (x25_tree) { proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, localoffset, 2, pd[localoffset]*256+pd[localoffset+1]); - proto_tree_add_item_format(x25_tree, + proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, localoffset+2, 1, X25_CALL_REQUEST, (fd->pseudo_header.x25.flags & FROM_DCE) ? "Incoming call" @@ -1528,7 +1528,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (x25_tree) { proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, localoffset, 2, pd[localoffset]*256+pd[localoffset+1]); - proto_tree_add_item_format(x25_tree, + proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, localoffset+2, 1, X25_CALL_ACCEPTED, (fd->pseudo_header.x25.flags & FROM_DCE) ? "Call connected" @@ -1560,7 +1560,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (x25_tree) { proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, localoffset, 2, pd[localoffset]*256+pd[localoffset+1]); - proto_tree_add_item_format(x25_tree, + proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, localoffset+2, 1, X25_CLEAR_REQUEST, (fd->pseudo_header.x25.flags & FROM_DCE) ? "Clear indication" @@ -1639,7 +1639,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (x25_tree) { proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, localoffset, 2, pd[localoffset]*256+pd[localoffset+1]); - proto_tree_add_item_format(x25_tree, + proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, localoffset+2, 1, X25_RESET_REQUEST, (fd->pseudo_header.x25.flags & FROM_DCE) ? "Reset indication" @@ -1673,7 +1673,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) (int)pd[localoffset+4]); } if (x25_tree) { - proto_tree_add_item_format(x25_tree, + proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, localoffset+2, 1, X25_RESTART_REQUEST, (fd->pseudo_header.x25.flags & FROM_DCE) ? "Restart indication" @@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.64 2000/02/15 21:03:33 gram Exp $ + * $Id: packet.c,v 1.65 2000/03/12 04:47:53 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1073,8 +1073,8 @@ dissect_packet(const u_char *pd, frame_data *fd, proto_tree *tree) /* Put in frame header information. */ if (tree) { - ti = proto_tree_add_item_format(tree, proto_frame, 0, fd->cap_len, - NULL, "Frame %u (%u on wire, %u captured)", fd->num, + ti = proto_tree_add_protocol_format(tree, proto_frame, 0, fd->cap_len, + "Frame %u (%u on wire, %u captured)", fd->num, fd->pkt_len, fd->cap_len); fh_tree = proto_item_add_subtree(ti, ett_frame); @@ -1094,11 +1094,11 @@ dissect_packet(const u_char *pd, frame_data *fd, proto_tree *tree) proto_tree_add_item(fh_tree, hf_frame_number, 0, 0, fd->num); - proto_tree_add_item_format(fh_tree, hf_frame_packet_len, + proto_tree_add_uint_format(fh_tree, hf_frame_packet_len, 0, 0, fd->pkt_len, "Packet Length: %d byte%s", fd->pkt_len, plurality(fd->pkt_len, "", "s")); - proto_tree_add_item_format(fh_tree, hf_frame_capture_len, + proto_tree_add_uint_format(fh_tree, hf_frame_capture_len, 0, 0, fd->cap_len, "Capture Length: %d byte%s", fd->cap_len, plurality(fd->cap_len, "", "s")); } diff --git a/plugins/gryphon/packet-gryphon.c b/plugins/gryphon/packet-gryphon.c index 6c7bb071bd..801c2377a6 100644 --- a/plugins/gryphon/packet-gryphon.c +++ b/plugins/gryphon/packet-gryphon.c @@ -1,7 +1,7 @@ /* packet-gryphon.c * Routines for Gryphon protocol packet disassembly * - * $Id: packet-gryphon.c,v 1.6 2000/02/07 17:23:53 gram Exp $ + * $Id: packet-gryphon.c,v 1.7 2000/03/12 04:48:32 gram Exp $ * * Ethereal - Network traffic analyzer * By Steve Limkemann <stevelim@dgtech.com> @@ -153,7 +153,7 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) msglen = pntohs ((unsigned short *)&data[4]); header_item = proto_tree_add_text(gryphon_tree, offset, - MSG_HDR_SZ, "Header", NULL); + MSG_HDR_SZ, "Header"); header_tree = proto_item_add_subtree(header_item, ett_gryphon_header); for (i = 0; i < SIZEOF(src_dest); i++) { @@ -182,14 +182,14 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "Data length: %d bytes", msglen); proto_tree_add_text(header_tree, offset+6, 1, "Frame type: %s", frame_type[frmtyp]); - proto_tree_add_text(header_tree, offset+7, 1, "reserved", NULL); + proto_tree_add_text(header_tree, offset+7, 1, "reserved"); proto_tree_add_item_hidden(header_tree, hf_gryph_type, offset+6, 1, frmtyp); msgpad = 3 - (msglen + 3) % 4; msgend = data + msglen + msgpad + MSG_HDR_SZ; body_item = proto_tree_add_text(gryphon_tree, offset + MSG_HDR_SZ, - msglen + msgpad, "Body", NULL); + msglen + msgpad, "Body"); body_tree = proto_item_add_subtree(body_item, ett_gryphon_body); offset += MSG_HDR_SZ; @@ -216,12 +216,12 @@ dissector(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } if (data < msgend - msgpad) { i = msgend - msgpad - data; - proto_tree_add_text(gryphon_tree, offset, i, "Data", NULL); + proto_tree_add_text(gryphon_tree, offset, i, "Data"); BUMP (offset, data, i); } if (data < msgend) { i = msgend - data; - proto_tree_add_text(gryphon_tree, offset, i, "padding", NULL); + proto_tree_add_text(gryphon_tree, offset, i, "padding"); BUMP (offset, data, i); } /* data = dataend;*/ @@ -534,7 +534,7 @@ decode_data (int src, const u_char **data, const u_char *dataend, int *offset, i padding = 3 - (hdrsize + datasize + extrasize + 3) % 4; msgsize = hdrsize + datasize + extrasize + padding + 16; - item = proto_tree_add_text(pt, *offset, 16, "Message header", NULL); + item = proto_tree_add_text(pt, *offset, 16, "Message header"); tree = proto_item_add_subtree (item, ett_gryphon_data_header); proto_tree_add_text(tree, *offset, 2, "Header length: %d bytes, %d bits", hdrsize, hdrbits); proto_tree_add_text(tree, *offset+2, 2, "Data length: %d bytes", datasize); @@ -544,15 +544,15 @@ decode_data (int src, const u_char **data, const u_char *dataend, int *offset, i if (mode) { tree1 = proto_item_add_subtree (item1, ett_gryphon_flags); if (mode & 0x80) - proto_tree_add_text(tree1, *offset+5, 1, "1... .... = Transmitted message", NULL); + proto_tree_add_text(tree1, *offset+5, 1, "1... .... = Transmitted message"); if (mode & 0x40) - proto_tree_add_text(tree1, *offset+5, 1, ".1.. .... = Received message", NULL); + proto_tree_add_text(tree1, *offset+5, 1, ".1.. .... = Received message"); if (mode & 0x20) - proto_tree_add_text(tree1, *offset+5, 1, "..1. .... = Local message", NULL); + proto_tree_add_text(tree1, *offset+5, 1, "..1. .... = Local message"); if (mode & 0x10) - proto_tree_add_text(tree1, *offset+5, 1, "...1 .... = Remote message", NULL); + proto_tree_add_text(tree1, *offset+5, 1, "...1 .... = Remote message"); if (mode & 0x01) - proto_tree_add_text(tree1, *offset+5, 1, ".... ...1 = Internal message", NULL); + proto_tree_add_text(tree1, *offset+5, 1, ".... ...1 = Internal message"); } proto_tree_add_text(tree, *offset+6, 1, "Priority: %d", (*data)[6]); proto_tree_add_text(tree, *offset+7, 1, "Error status: %hd", (*data)[7]); @@ -563,24 +563,24 @@ decode_data (int src, const u_char **data, const u_char *dataend, int *offset, i fraction = timestamp % 100000; proto_tree_add_text(tree, *offset+8, 4, "Timestamp: %d:%02d:%02d.%05d", hours, minutes, seconds, fraction); proto_tree_add_text(tree, *offset+12, 1, "Context: %hd", (*data)[12]); - proto_tree_add_text(tree, *offset+13, 3, "reserved:", NULL); + proto_tree_add_text(tree, *offset+13, 3, "reserved:"); BUMP (*offset, *data, 16); - item = proto_tree_add_text(pt, *offset, msgsize-16-padding, "Message Body", NULL); + item = proto_tree_add_text(pt, *offset, msgsize-16-padding, "Message Body"); tree = proto_item_add_subtree (item, ett_gryphon_data_body); if (hdrsize) { - proto_tree_add_text(tree, *offset, hdrsize, "Header", NULL); + proto_tree_add_text(tree, *offset, hdrsize, "Header"); BUMP (*offset, *data, hdrsize); } if (datasize) { - proto_tree_add_text(tree, *offset, datasize, "Data", NULL); + proto_tree_add_text(tree, *offset, datasize, "Data"); BUMP (*offset, *data, datasize); } if (extrasize) { - proto_tree_add_text(tree, *offset, extrasize, "Extra data", NULL); + proto_tree_add_text(tree, *offset, extrasize, "Extra data"); BUMP (*offset, *data, extrasize); } if (padding) { - proto_tree_add_text(pt, *offset, padding, "padding", NULL); + proto_tree_add_text(pt, *offset, padding, "padding"); BUMP (*offset, *data, padding); } } @@ -596,7 +596,7 @@ decode_event (int src, const u_char **data, const u_char *dataend, int *offset, msgend = *data + msglen; proto_tree_add_text(pt, *offset, 1, "Event ID: %hd", **data); proto_tree_add_text(pt, *offset+1, 1, "Event context: %hd", *((*data)+1)); - proto_tree_add_text(pt, *offset+2, 2, "reserved", NULL); + proto_tree_add_text(pt, *offset+2, 2, "reserved"); BUMP (*offset, *data, 4); timestamp = pntohl ((unsigned long *)(*data)); hours = timestamp /(100000 * 60 *60); @@ -611,7 +611,7 @@ decode_event (int src, const u_char **data, const u_char *dataend, int *offset, BUMP (*offset, *data, length); } if (padding) { - proto_tree_add_text (pt, *offset, padding, "padding", NULL); + proto_tree_add_text (pt, *offset, padding, "padding"); BUMP (*offset, *data, padding); } } @@ -628,7 +628,7 @@ cmd_init (int src, const u_char **data, const u_char *dataend, int *offset, int else ptr = "Initialize if not previously initialized"; proto_tree_add_text(pt, *offset, 1, "Mode: %s", ptr); - proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); } @@ -640,8 +640,8 @@ eventnum (int src, const u_char **data, const u_char *dataend, int *offset, int if (event) proto_tree_add_text(pt, *offset, 1, "Event number: %hd", event); else - proto_tree_add_text(pt, *offset, 1, "Event numbers: All", NULL); - proto_tree_add_text(pt, *offset+1, 3, "padding", NULL); + proto_tree_add_text(pt, *offset, 1, "Event numbers: All"); + proto_tree_add_text(pt, *offset+1, 3, "padding"); BUMP (*offset, *data, 4); } @@ -689,12 +689,12 @@ cmd_setfilt (int src, const u_char **data, const u_char *dataend, int *offset, i proto_tree_add_text(pt, *offset+4, 4, "Length of Pattern & Mask: %d", length); BUMP (*offset, *data, 8); if (length) { - proto_tree_add_text(pt, *offset, length * 2, "discarded data", NULL); + proto_tree_add_text(pt, *offset, length * 2, "discarded data"); BUMP (*offset, *data, length * 2); } padding = 3 - (length * 2 + 3) % 4; if (padding) { - proto_tree_add_text(pt, *offset+1, 3, "padding", NULL); + proto_tree_add_text(pt, *offset+1, 3, "padding"); BUMP (*offset, *data, padding); } } @@ -714,7 +714,7 @@ cmd_ioctl (int src, const u_char **data, const u_char *dataend, int *offset, int i = SIZEOF(ioctls) - 1; proto_tree_add_text(pt, *offset, 4, "IOCTL: %s", ioctls[i].strptr); BUMP (*offset, *data, 4); - proto_tree_add_text(pt, *offset, dataend - *data, "Data", NULL); + proto_tree_add_text(pt, *offset, dataend - *data, "Data"); BUMP (*offset, *data, dataend - *data); } @@ -730,22 +730,22 @@ cmd_addfilt (int src, const u_char **data, const u_char *dataend, int *offset, i char active[] = ".... ..1. = The filter is active"; char inactive[] = ".... ..0. = The filter is inactive"; - item = proto_tree_add_text(pt, *offset, 1, "Flags", NULL); + item = proto_tree_add_text(pt, *offset, 1, "Flags"); tree = proto_item_add_subtree (item, ett_gryphon_flags); if (**data & FILTER_PASS_FLAG) ptr = pass; else ptr = block; - proto_tree_add_text(tree, *offset, 1, ptr, NULL); + proto_tree_add_text(tree, *offset, 1, ptr); if (**data & FILTER_ACTIVE_FLAG) ptr = active; else ptr = inactive; - proto_tree_add_text(tree, *offset, 1, ptr, NULL); + proto_tree_add_text(tree, *offset, 1, ptr); BUMP (*offset, *data, 1); blocks = **data; proto_tree_add_text(pt, *offset, 1, "Number of filter blocks = %d", blocks); - proto_tree_add_text(pt, *offset+1, 6, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 6, "reserved"); BUMP (*offset, *data, 7); for (i = 1; i <= blocks; i++) { length = pntohs ((unsigned short *)((*data)+2)) * 2 + 8; @@ -760,7 +760,7 @@ void resp_addfilt (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { proto_tree_add_text(pt, *offset, 1, "Filter handle: %hd", **data); - proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); } @@ -773,7 +773,7 @@ cmd_modfilt (int src, const u_char **data, const u_char *dataend, int *offset, i if (**data) proto_tree_add_text(pt, *offset, 1, "Filter handle: %hd", **data); else - proto_tree_add_text(pt, *offset, 1, "Filter handles: all", NULL); + proto_tree_add_text(pt, *offset, 1, "Filter handles: all"); action = *((*data) + 1); for (i = 0; i < SIZEOF(filtacts); i++) { if (filtacts[i].value == action) @@ -782,7 +782,7 @@ cmd_modfilt (int src, const u_char **data, const u_char *dataend, int *offset, i if (i >= SIZEOF(filtacts)) i = SIZEOF(filtacts) - 1; proto_tree_add_text(pt, *offset+1, 1, "Action: %s filter", filtacts[i].strptr); - proto_tree_add_text(pt, *offset+2, 2, "reserved", NULL); + proto_tree_add_text(pt, *offset+2, 2, "reserved"); BUMP (*offset, *data, 4); } @@ -798,7 +798,7 @@ resp_filthan (int src, const u_char **data, const u_char *dataend, int *offset, } padding = 3 - (handles + 1 + 3) % 4; if (padding) - proto_tree_add_text(pt, *offset+1+handles, padding, "padding", NULL); + proto_tree_add_text(pt, *offset+1+handles, padding, "padding"); BUMP (*offset, *data, 1+handles+padding); } @@ -815,7 +815,7 @@ dfiltmode (int src, const u_char **data, const u_char *dataend, int *offset, int if (i >= SIZEOF(dmodes)) i = SIZEOF(dmodes) - 1; proto_tree_add_text(pt, *offset, 1, "Filter mode: %s", dmodes[i].strptr); - proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); } @@ -832,7 +832,7 @@ filtmode (int src, const u_char **data, const u_char *dataend, int *offset, int if (i >= SIZEOF(modes)) i = SIZEOF(modes) - 1; proto_tree_add_text(pt, *offset, 1, "Filter mode: %s", modes[i].strptr); - proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); } @@ -871,7 +871,7 @@ resp_register (int src, const u_char **data, const u_char *dataend, int *offset, proto_tree_add_text(pt, *offset, 1, "Client ID: %hd", (*data)[0]); proto_tree_add_text(pt, *offset+1, 1, "Privileges: %hd", (*data)[1]); - proto_tree_add_text(pt, *offset+2, 2, "reserved", NULL); + proto_tree_add_text(pt, *offset+2, 2, "reserved"); BUMP (*offset, *data, 4); } @@ -915,7 +915,7 @@ resp_config (int src, const u_char **data, const u_char *dataend, int *offset, i devices = **data; proto_tree_add_text(pt, *offset, 1, "Number of channels: %d", devices); - proto_tree_add_text(pt, *offset+1, 15, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 15, "reserved"); BUMP (*offset, *data, 16); for (i = 1; i <= devices; i++) { pi = proto_tree_add_text(pt, *offset, 80, "Channel %d:", i); @@ -947,7 +947,7 @@ resp_config (int src, const u_char **data, const u_char *dataend, int *offset, i BUMP (*offset, *data, 2); proto_tree_add_text(ft, *offset, 1, "Channel ID: %hd", **data); - proto_tree_add_text(ft, *offset+1, 5, "reserved", NULL); + proto_tree_add_text(ft, *offset+1, 5, "reserved"); BUMP (*offset, *data, 6); } } @@ -965,12 +965,12 @@ cmd_sched (int src, const u_char **data, const u_char *dataend, int *offset, int x = pntohl ((unsigned int *)*data); if (x == 0xFFFFFFFF) - proto_tree_add_text(pt, *offset, 4, "Number of iterations: infinite", NULL); + proto_tree_add_text(pt, *offset, 4, "Number of iterations: infinite"); else proto_tree_add_text(pt, *offset, 4, "Number of iterations: %d", x); BUMP (*offset, *data, 4); x = pntohl ((unsigned int *)*data); - item = proto_tree_add_text(pt, *offset, 4, "Flags", NULL); + item = proto_tree_add_text(pt, *offset, 4, "Flags"); tree = proto_item_add_subtree (item, ett_gryphon_flags); ptr = x & 1 ? crit : norm; proto_tree_add_text(tree, *offset, 4, ptr, NULL); @@ -990,14 +990,14 @@ cmd_sched (int src, const u_char **data, const u_char *dataend, int *offset, int x = pntohl ((unsigned int *)*data); proto_tree_add_text(tree, *offset, 4, "Transmit period: %d milliseconds", x); BUMP (*offset, *data, 4); - proto_tree_add_text(tree, *offset, 2, "reserved flags", NULL); + proto_tree_add_text(tree, *offset, 2, "reserved flags"); x = *((*data)+2); if (x == 0) x = def_chan; proto_tree_add_text(tree, *offset+2, 1, "Channel: %d", x); - proto_tree_add_text(tree, *offset+3, 1, "reserved", NULL); + proto_tree_add_text(tree, *offset+3, 1, "reserved"); BUMP (*offset, *data, 4); - item1 = proto_tree_add_text(tree, *offset, length, "Message", NULL); + item1 = proto_tree_add_text(tree, *offset, length, "Message"); tree1 = proto_item_add_subtree (item1, ett_gryphon_cmd_sched_cmd); decode_data (src, data, dataend, offset, msglen, tree1); i++; @@ -1065,7 +1065,7 @@ cmd_addresp (int src, const u_char **data, const u_char *dataend, int *offset, i char inactive[] = ".... ..0. = The response is inactive"; actionType = 0; - item = proto_tree_add_text(pt, *offset, 1, "Flags", NULL); + item = proto_tree_add_text(pt, *offset, 1, "Flags"); tree = proto_item_add_subtree (item, ett_gryphon_flags); if (**data & FILTER_ACTIVE_FLAG) ptr = active; @@ -1100,19 +1100,19 @@ cmd_addresp (int src, const u_char **data, const u_char *dataend, int *offset, i tree = proto_item_add_subtree (item, ett_gryphon_flags); if (action & FR_DEACT_AFTER_PER && !(action & FR_DELETE)){ proto_tree_add_text(tree, *offset, 1, - "1.0. .... Deactivate this response after the specified period following a conforming message", NULL); + "1.0. .... Deactivate this response after the specified period following a conforming message"); } if (action & FR_DEACT_ON_EVENT && !(action & FR_DELETE)){ proto_tree_add_text(tree, *offset, 1, - ".10. .... Deactivate this response for a conforming message", NULL); + ".10. .... Deactivate this response for a conforming message"); } if (action & FR_DEACT_AFTER_PER && action & FR_DELETE){ proto_tree_add_text(tree, *offset, 1, - "1.1. .... Delete this response after the specified period following a conforming message", NULL); + "1.1. .... Delete this response after the specified period following a conforming message"); } if (action & FR_DEACT_ON_EVENT && action & FR_DELETE){ proto_tree_add_text(tree, *offset, 1, - ".11. .... Delete this response for a conforming message", NULL); + ".11. .... Delete this response for a conforming message"); } actionValue = pntohs ((unsigned short *)((*data)+2)); if (actionValue) { @@ -1126,7 +1126,7 @@ cmd_addresp (int src, const u_char **data, const u_char *dataend, int *offset, i proto_tree_add_text(tree, *offset, 1, ptr, NULL); } BUMP (*offset, *data, 1); - proto_tree_add_text(pt, *offset, 1, "reserved", NULL); + proto_tree_add_text(pt, *offset, 1, "reserved"); BUMP (*offset, *data, 1); if (actionValue) { if (actionType == 1) { @@ -1158,7 +1158,7 @@ resp_addresp (int src, const u_char **data, const u_char *dataend, int *offset, { if (*data < dataend) { proto_tree_add_text(pt, *offset, 1, "Response handle: %hd", **data); - proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); } } @@ -1175,7 +1175,7 @@ cmd_modresp (int src, const u_char **data, const u_char *dataend, int *offset, i else if (dest) proto_tree_add_text(pt, *offset, 1, "Response handles: all on channel %hd", dest); else - proto_tree_add_text(pt, *offset, 1, "Response handles: all", NULL); + proto_tree_add_text(pt, *offset, 1, "Response handles: all"); action = *((*data) + 1); for (i = 0; i < SIZEOF(filtacts); i++) { if (filtacts[i].value == action) @@ -1184,7 +1184,7 @@ cmd_modresp (int src, const u_char **data, const u_char *dataend, int *offset, i if (i >= SIZEOF(filtacts)) i = SIZEOF(filtacts) - 1; proto_tree_add_text(pt, *offset+1, 1, "Action: %s response", filtacts[i].strptr); - proto_tree_add_text(pt, *offset+2, 2, "reserved", NULL); + proto_tree_add_text(pt, *offset+2, 2, "reserved"); BUMP (*offset, *data, 4); } @@ -1200,7 +1200,7 @@ resp_resphan (int src, const u_char **data, const u_char *dataend, int *offset, } padding = 3 - (handles + 1 + 3) % 4; if (padding) - proto_tree_add_text(pt, *offset+1+handles, padding, "padding", NULL); + proto_tree_add_text(pt, *offset+1+handles, padding, "padding"); BUMP (*offset, *data, 1+handles+padding); } @@ -1238,15 +1238,15 @@ resp_desc (int src, const u_char **data, const u_char *dataend, int *offset, int char missing[] = ".... ...0 = The program is not present"; char present[] = ".... ...1 = The program is already present"; - item = proto_tree_add_text(pt, *offset, 1, "Flags", NULL); + item = proto_tree_add_text(pt, *offset, 1, "Flags"); tree = proto_item_add_subtree (item, ett_gryphon_flags); if (**data & 1) ptr = present; else ptr = missing; - proto_tree_add_text(tree, *offset, 1, ptr, NULL); + proto_tree_add_text(tree, *offset, 1, ptr); proto_tree_add_text(pt, *offset+1, 1, "Handle: %hd", (*data)[1]); - proto_tree_add_text(pt, *offset+2, 2, "reserved", NULL); + proto_tree_add_text(pt, *offset+2, 2, "reserved"); BUMP (*offset, *data, 4); } @@ -1263,7 +1263,7 @@ cmd_upload (int src, const u_char **data, const u_char *dataend, int *offset, in BUMP (*offset, *data, length); length = 3 - (length + 3) % 4; if (length) { - proto_tree_add_text(pt, *offset, length, "padding", NULL); + proto_tree_add_text(pt, *offset, length, "padding"); BUMP (*offset, *data, length); } } @@ -1282,7 +1282,7 @@ void cmd_list (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { proto_tree_add_text(pt, *offset, 1, "Block number: %hd", (*data)[0]); - proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); } @@ -1295,7 +1295,7 @@ resp_list (int src, const u_char **data, const u_char *dataend, int *offset, int count = (*data)[0]; proto_tree_add_text(pt, *offset, 1, "Number of programs in this response: %d", count); - proto_tree_add_text(pt, *offset+1, 1, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 1, "reserved"); BUMP (*offset, *data, 2); proto_tree_add_text(pt, *offset, 2, "Number of remaining programs: %d", pntohs ((unsigned short *)(*data))); BUMP (*offset, *data, 2); @@ -1326,7 +1326,7 @@ cmd_start (int src, const u_char **data, const u_char *dataend, int *offset, int BUMP (*offset, *data, length); length = 3 - (length + 3) % 4; if (length) { - proto_tree_add_text(pt, *offset, length, "padding", NULL); + proto_tree_add_text(pt, *offset, length, "padding"); BUMP (*offset, *data, length); } } @@ -1335,7 +1335,7 @@ void resp_start (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { proto_tree_add_text(pt, *offset, 1, "Channel (Client) number: %hd", (*data)[0]); - proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); } @@ -1357,7 +1357,7 @@ resp_status (int src, const u_char **data, const u_char *dataend, int *offset, i } length = 3 - (copies + 1 + 3) % 4; if (length) { - proto_tree_add_text(pt, *offset, length, "padding", NULL); + proto_tree_add_text(pt, *offset, length, "padding"); BUMP (*offset, *data, length); } } @@ -1370,7 +1370,7 @@ cmd_options (int src, const u_char **data, const u_char *dataend, int *offset, i unsigned char *string, *string1; item = proto_tree_add_text(pt, *offset, 1, "Handle: %hd", **data); - item = proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + item = proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); for (i = 1; *data <= dataend; i++) { size = (*data)[1] + 2; @@ -1421,7 +1421,7 @@ cmd_options (int src, const u_char **data, const u_char *dataend, int *offset, i proto_tree_add_text(tree, *offset, 1, "%s", string); proto_tree_add_text(tree, *offset+2, option_length, "%s", string1); if (padding) - proto_tree_add_text(tree, *offset+option_length+2, padding, "padding", NULL); + proto_tree_add_text(tree, *offset+option_length+2, padding, "padding"); BUMP (*offset, *data, size + padding); } } @@ -1430,7 +1430,7 @@ void speed (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { proto_tree_add_text(pt, *offset, 1, "Baud rate index: %hd", (*data)[0]); - proto_tree_add_text(pt, *offset+1, 3, "reserved", NULL); + proto_tree_add_text(pt, *offset+1, 3, "reserved"); BUMP (*offset, *data, 4); } @@ -1458,12 +1458,12 @@ filter_block (int src, const u_char **data, const u_char *dataend, int *offset, if (i >= SIZEOF(operators)) i = SIZEOF(operators) - 1; proto_tree_add_text(pt, *offset+5, 1, "Type of comparison: %s", operators[i].strptr); - proto_tree_add_text(pt, *offset+6, 2, "reserved" ,NULL); + proto_tree_add_text(pt, *offset+6, 2, "reserved"); BUMP (*offset, *data, 8); if (operator == BIT_FIELD_CHECK) { - proto_tree_add_text(pt, *offset, length, "Pattern" ,NULL); - proto_tree_add_text(pt, *offset+length, length, "Mask" ,NULL); + proto_tree_add_text(pt, *offset, length, "Pattern"); + proto_tree_add_text(pt, *offset+length, length, "Mask"); } else { switch (length) { case 1: @@ -1476,13 +1476,13 @@ filter_block (int src, const u_char **data, const u_char *dataend, int *offset, proto_tree_add_text(pt, *offset, 4, "Value: %dl", pntohl ((unsigned long *)(*data))); break; default: - proto_tree_add_text(pt, *offset, length, "Value", NULL); + proto_tree_add_text(pt, *offset, length, "Value"); } } BUMP (*offset, *data, length * 2); padding = 3 - (length * 2 + 3) % 4; if (padding) { - proto_tree_add_text(pt, *offset, padding, "padding", NULL); + proto_tree_add_text(pt, *offset, padding, "padding"); BUMP (*offset, *data, padding); } } @@ -1,7 +1,7 @@ /* proto.c * Routines for protocol tree * - * $Id: proto.c,v 1.54 2000/03/07 05:54:52 guy Exp $ + * $Id: proto.c,v 1.55 2000/03/12 04:47:54 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -93,6 +93,39 @@ static char* hfinfo_int_format(header_field_info *hfinfo); static gboolean check_for_protocol_or_field_id(GNode *node, gpointer data); static gboolean check_for_field_within_protocol(GNode *node, gpointer data); +static field_info* +proto_tree_add_field_info(int hfindex, gint start, gint length, int visible); + +static proto_item* +proto_tree_add_node(proto_tree *tree, field_info *fi); + +static proto_item * +proto_tree_add_pi(proto_tree *tree, int hfindex, gint start, gint length, + const char *format, gboolean visible, field_info **pfi, va_list ap); + +static void +proto_tree_set_value(field_info *fi, gint length, va_list ap); +static void +proto_tree_set_bytes(field_info *fi, guint8* start_ptr, gint length); +static void +proto_tree_set_time(field_info *fi, struct timeval *value_ptr); +static void +proto_tree_set_string(field_info *fi, char* value); +static void +proto_tree_set_ether(field_info *fi, guint8* value); +static void +proto_tree_set_ipxnet(field_info *fi, guint32 value); +static void +proto_tree_set_ipv4(field_info *fi, guint32 value); +static void +proto_tree_set_ipv6(field_info *fi, guint8* value_ptr); +static void +proto_tree_set_boolean(field_info *fi, guint32 value); +static void +proto_tree_set_double(field_info *fi, double value); +static void +proto_tree_set_uint(field_info *fi, guint32 value); + static int proto_register_field_init(header_field_info *hfinfo, int parent); /* special-case header field used within proto.c */ @@ -225,125 +258,131 @@ find_hfinfo_record(int hfindex) return g_ptr_array_index(gpa_hfinfo, hfindex); } + +/* Add a node with no text */ proto_item * -proto_tree_add_item(proto_tree *tree, int hfindex, gint start, gint length, ...) +proto_tree_add_notext(proto_tree *tree, gint start, gint length) { + field_info *fi; proto_item *pi; - va_list ap; - va_start(ap, length); - pi = _proto_tree_add_item_value(tree, hfindex, start, length, 0, 1, ap); - va_end(ap); + if (!tree) + return(NULL); + + fi = proto_tree_add_field_info(hf_text_only, start, length, + proto_tree_is_visible); + pi = proto_tree_add_node(tree, fi); + fi->representation = NULL; return pi; } +/* Add a text-only node to the proto_tree */ proto_item * -proto_tree_add_item_hidden(proto_tree *tree, int hfindex, gint start, gint length, ...) +proto_tree_add_text(proto_tree *tree, gint start, gint length, + const char *format, ...) { + field_info *fi; proto_item *pi; va_list ap; - va_start(ap, length); - pi = _proto_tree_add_item_value(tree, hfindex, start, length, 0, 0, ap); - va_end(ap); - - return pi; -} + if (!tree) + return(NULL); -proto_item * -proto_tree_add_item_format(proto_tree *tree, int hfindex, gint start, gint length, ...) -{ - proto_item *pi; - va_list ap; + fi = proto_tree_add_field_info(hf_text_only, start, length, + proto_tree_is_visible); + pi = proto_tree_add_node(tree, fi); - va_start(ap, length); - pi = _proto_tree_add_item_value(tree, hfindex, start, length, 1, 1, ap); - va_end(ap); + /* Only add text if we know that proto_tree is to be shown */ + if (proto_tree_is_visible) { + va_start(ap, format); + fi->representation = g_mem_chunk_alloc(gmc_item_labels); + vsnprintf(fi->representation, ITEM_LABEL_LENGTH, format, ap); + va_end(ap); + } + else { + fi->representation = NULL; + } return pi; } +/* Add an item to a proto_tree, using the text label registered to that item. */ proto_item * -proto_tree_add_notext(proto_tree *tree, gint start, gint length, ...) +proto_tree_add_item(proto_tree *tree, int hfindex, gint start, gint length, ...) { proto_item *pi; va_list ap; + field_info *new_fi; + + if (!tree) + return(NULL); va_start(ap, length); - pi = _proto_tree_add_item_value(tree, hf_text_only, start, length, 0, 1, ap); + /* ap won't be used since format is NULL */ + pi = proto_tree_add_pi(tree, hfindex, start, length, + NULL, TRUE, &new_fi, ap); + proto_tree_set_value(new_fi, length, ap); va_end(ap); return pi; } +/* Add an item to a proto_tree, but make it invisible in GUI. The field is + * still searchable, though. */ proto_item * -proto_tree_add_text(proto_tree *tree, gint start, gint length, ...) +proto_tree_add_item_hidden(proto_tree *tree, int hfindex, gint start, gint length, ...) { proto_item *pi; va_list ap; + field_info *new_fi; + + if (!tree) + return(NULL); va_start(ap, length); - pi = _proto_tree_add_item_value(tree, hf_text_only, start, length, 1, 1, ap); + /* ap won't be used since format is NULL */ + pi = proto_tree_add_pi(tree, hfindex, start, length, + NULL, FALSE, &new_fi, ap); + proto_tree_set_value(new_fi, length, ap); va_end(ap); return pi; } -proto_item * -_proto_tree_add_item_value(proto_tree *tree, int hfindex, gint start, - gint length, int include_format, int visible, va_list ap) +static void +proto_tree_set_value(field_info *fi, gint length, va_list ap) { - proto_item *pi; - field_info *fi; - char *junk, *format; - header_field_info *hfinfo; - - if (!tree) - return(NULL); - - /* either visibility flag can nullify the other */ - visible = proto_tree_is_visible && visible; - - fi = g_mem_chunk_alloc(gmc_field_info); - - fi->hfinfo = find_hfinfo_record(hfindex); - g_assert(fi->hfinfo != NULL); - fi->start = start; - fi->length = length; - fi->tree_type = ETT_NONE; - fi->visible = visible; - - /* for convenience */ + header_field_info *hfinfo; hfinfo = fi->hfinfo; -/* from the stdarg man page on Solaris 2.6: -NOTES - It is up to the calling routine to specify in some manner - how many arguments there are, since it is not always possi- - ble to determine the number of arguments from the stack - frame. For example, execl is passed a zero pointer to sig- - nal the end of the list. printf can tell how many arguments - there are by the format. It is non-portable to specify a - second argument of char, short, or float to va_arg, because - arguments seen by the called function are not char, short, - or float. C converts char and short arguments to int and - converts float arguments to double before passing them to a - function. -*/ + + /* from the stdarg man page on Solaris 2.6: + NOTES + It is up to the calling routine to specify in some manner + how many arguments there are, since it is not always possi- + ble to determine the number of arguments from the stack + frame. For example, execl is passed a zero pointer to sig- + nal the end of the list. printf can tell how many arguments + there are by the format. It is non-portable to specify a + second argument of char, short, or float to va_arg, because + arguments seen by the called function are not char, short, + or float. C converts char and short arguments to int and + converts float arguments to double before passing them to a + function. + */ switch(hfinfo->type) { case FT_NONE: - junk = va_arg(ap, guint8*); break; case FT_BYTES: - /* This g_malloc'ed memory is freed in - proto_tree_free_node() */ - fi->value.bytes = (guint8 *)g_malloc(length); - memcpy(fi->value.bytes, va_arg(ap, guint8*), length); + proto_tree_set_bytes(fi, va_arg(ap, guint8*), length); break; case FT_BOOLEAN: + proto_tree_set_boolean(fi, va_arg(ap, unsigned int)); + break; + case FT_UINT8: case FT_UINT16: case FT_UINT24: @@ -352,48 +391,37 @@ NOTES case FT_INT16: case FT_INT24: case FT_INT32: - fi->value.numeric = va_arg(ap, unsigned int); - if (hfinfo->bitmask) { - /* Mask out irrelevant portions */ - fi->value.numeric &= hfinfo->bitmask; - - /* Shift bits */ - if (hfinfo->bitshift > 0) { - fi->value.numeric >>= hfinfo->bitshift; - } - } + proto_tree_set_uint(fi, va_arg(ap, unsigned int)); break; case FT_IPv4: - ipv4_addr_set_net_order_addr(&(fi->value.ipv4), va_arg(ap, unsigned int)); - ipv4_addr_set_netmask_bits(&(fi->value.ipv4), 32); + proto_tree_set_ipv4(fi, va_arg(ap, unsigned int)); break; case FT_IPXNET: - fi->value.numeric = va_arg(ap, unsigned int); + proto_tree_set_ipxnet(fi, va_arg(ap, unsigned int)); break; case FT_IPv6: - memcpy(fi->value.ipv6, va_arg(ap, guint8*), 16); + proto_tree_set_ipv6(fi, va_arg(ap, guint8*)); break; case FT_DOUBLE: - fi->value.floating = va_arg(ap, double); + proto_tree_set_double(fi, va_arg(ap, double)); break; case FT_ETHER: - memcpy(fi->value.ether, va_arg(ap, guint8*), 6); + proto_tree_set_ether(fi, va_arg(ap, guint8*)); break; case FT_ABSOLUTE_TIME: case FT_RELATIVE_TIME: - memcpy(&fi->value.time, va_arg(ap, struct timeval*), - sizeof(struct timeval)); + proto_tree_set_time(fi, va_arg(ap, struct timeval*)); break; case FT_STRING: /* This g_strdup'ed memory is freed in proto_tree_free_node() */ - fi->value.string = g_strdup(va_arg(ap, char*)); + proto_tree_set_string(fi, va_arg(ap, char*)); break; case FT_TEXT_ONLY: @@ -402,26 +430,452 @@ NOTES default: g_error("hfinfo->type %d not handled\n", hfinfo->type); + g_assert_not_reached(); + break; + } +} + + +/* Add a FT_NONE to a proto_tree */ +proto_item * +proto_tree_add_protocol_format(proto_tree *tree, int hfindex, gint start, gint length, + const char *format, ...) +{ + proto_item *pi; + va_list ap; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_NONE); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, NULL, ap); + /* no value to set for FT_NONE */ + va_end(ap); + + return pi; +} + +/* Add a FT_BYTES to a proto_tree */ +proto_item * +proto_tree_add_bytes_format(proto_tree *tree, int hfindex, gint start, gint length, + guint8 *start_ptr, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_BYTES); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_bytes(new_fi, start_ptr, length); + va_end(ap); + + return pi; +} + +/* Set the FT_BYTES value */ +static void +proto_tree_set_bytes(field_info *fi, guint8* start_ptr, gint length) +{ + + /* This g_malloc'ed memory is freed in + proto_tree_free_node() */ + fi->value.bytes = g_malloc(length); + memcpy(fi->value.bytes, start_ptr, length); +} + +/* Add a FT_*TIME to a proto_tree */ +proto_item * +proto_tree_add_time_format(proto_tree *tree, int hfindex, gint start, gint length, + struct timeval *value_ptr, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_ABSOLUTE_TIME || + hfinfo->type == FT_RELATIVE_TIME); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_time(new_fi, value_ptr); + va_end(ap); + + return pi; +} + +/* Set the FT_*TIME value */ +static void +proto_tree_set_time(field_info *fi, struct timeval *value_ptr) +{ + memcpy(&fi->value.time, value_ptr, sizeof(struct timeval)); +} + +/* Add a FT_IPXNET to a proto_tree */ +proto_item * +proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, gint start, gint length, + guint32 value, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_IPXNET); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_ipxnet(new_fi, value); + va_end(ap); + + return pi; +} + +/* Set the FT_IPXNET value */ +static void +proto_tree_set_ipxnet(field_info *fi, guint32 value) +{ + fi->value.numeric = value; +} + +/* Add a FT_IPv4 to a proto_tree */ +proto_item * +proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, gint start, gint length, + guint32 value, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_IPv4); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_ipv4(new_fi, value); + va_end(ap); + + return pi; +} + +/* Set the FT_IPv4 value */ +static void +proto_tree_set_ipv4(field_info *fi, guint32 value) +{ + ipv4_addr_set_net_order_addr(&(fi->value.ipv4), value); + ipv4_addr_set_netmask_bits(&(fi->value.ipv4), 32); +} + +/* Add a FT_IPv6 to a proto_tree */ +proto_item * +proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, gint start, gint length, + guint8* value_ptr, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_IPv6); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_ipv6(new_fi, value_ptr); + va_end(ap); + + return pi; +} + +/* Set the FT_IPv4 value */ +static void +proto_tree_set_ipv6(field_info *fi, guint8* value_ptr) +{ + memcpy(fi->value.ipv6, value_ptr, 16); +} + +/* Add a FT_STRING to a proto_tree */ +proto_item * +proto_tree_add_string_format(proto_tree *tree, int hfindex, gint start, gint length, + char* value, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_STRING); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_string(new_fi, value); + va_end(ap); + + return pi; +} + +/* Set the FT_STRING value */ +static void +proto_tree_set_string(field_info *fi, char* value) +{ + /* This g_strdup'ed memory is freed in proto_tree_free_node() */ + fi->value.string = g_strdup(value); +} + +/* Add a FT_ETHER to a proto_tree */ +proto_item * +proto_tree_add_ether_format(proto_tree *tree, int hfindex, gint start, gint length, + guint8* value, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_ETHER); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_ether(new_fi, value); + va_end(ap); + + return pi; +} + +/* Set the FT_ETHER value */ +static void +proto_tree_set_ether(field_info *fi, guint8* value) +{ + memcpy(fi->value.ether, value, 6); +} + +/* Add a FT_BOOLEAN to a proto_tree */ +proto_item * +proto_tree_add_boolean_format(proto_tree *tree, int hfindex, gint start, gint length, + guint32 value, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_BOOLEAN); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_boolean(new_fi, value); + va_end(ap); + + return pi; +} + +/* Set the FT_BOOLEAN value */ +static void +proto_tree_set_boolean(field_info *fi, guint32 value) +{ + fi->value.numeric = value; +} + +/* Add a FT_DOUBLE to a proto_tree */ +proto_item * +proto_tree_add_double_format(proto_tree *tree, int hfindex, gint start, gint length, + double value, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + g_assert(hfinfo->type == FT_DOUBLE); + + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_double(new_fi, value); + va_end(ap); + + return pi; +} + +/* Set the FT_DOUBLE value */ +static void +proto_tree_set_double(field_info *fi, double value) +{ + fi->value.floating = value; +} + +/* Add any FT_UINT* to a proto_tree */ +proto_item * +proto_tree_add_uint_format(proto_tree *tree, int hfindex, gint start, gint length, + guint32 value, const char *format, ...) +{ + proto_item *pi; + va_list ap; + field_info *new_fi; + header_field_info *hfinfo; + + if (!tree) + return (NULL); + + hfinfo = find_hfinfo_record(hfindex); + switch(hfinfo->type) { + case FT_UINT8: + case FT_UINT16: + case FT_UINT24: + case FT_UINT32: + va_start(ap, format); + pi = proto_tree_add_pi(tree, hfindex, start, length, + format, TRUE, &new_fi, ap); + proto_tree_set_uint(new_fi, value); + va_end(ap); break; + + default: + g_assert_not_reached(); } + return pi; +} + +/* Set the FT_UINT* value */ +static void +proto_tree_set_uint(field_info *fi, guint32 value) +{ + header_field_info *hfinfo; + + hfinfo = fi->hfinfo; + fi->value.numeric = value; + if (hfinfo->bitmask) { + /* Mask out irrelevant portions */ + fi->value.numeric &= hfinfo->bitmask; + + /* Shift bits */ + if (hfinfo->bitshift > 0) { + fi->value.numeric >>= hfinfo->bitshift; + } + } +} + + + +/* Create a new field_info struct, and initialize it */ +static field_info * +proto_tree_add_field_info(int hfindex, gint start, gint length, int visible) +{ + field_info *fi; + + fi = g_mem_chunk_alloc(gmc_field_info); + + fi->hfinfo = find_hfinfo_record(hfindex); + g_assert(fi->hfinfo != NULL); + fi->start = start; + fi->length = length; + fi->tree_type = ETT_NONE; + fi->visible = visible; + + return fi; +} + +/* Add a field_info struct to the proto_tree, encapsulating it in a GNode (proto_item) */ +static proto_item * +proto_tree_add_node(proto_tree *tree, field_info *fi) +{ + proto_item *pi; + pi = (proto_item*) g_node_new(fi); g_node_append((GNode*)tree, (GNode*)pi); + return pi; +} + + +/* Generic way to allocate field_info, add to proto_tree, and set representation. + * Sets *pfi to address of newly-allocated field_info struct, if pfi is non-NULL. */ +static proto_item * +proto_tree_add_pi(proto_tree *tree, int hfindex, gint start, gint length, + const char *format, gboolean visible, field_info **pfi, va_list ap) +{ + proto_item *pi; + field_info *fi; + + if (!tree) + return(NULL); + + /* either visibility flag can nullify the other */ + visible = proto_tree_is_visible && visible; + + fi = proto_tree_add_field_info(hfindex, start, length, visible); + + pi = proto_tree_add_node(tree, fi); + /* are there any formatting arguments? */ - if (visible && include_format) { - format = va_arg(ap, char*); + if (visible && format) { fi->representation = g_mem_chunk_alloc(gmc_item_labels); - vsnprintf(fi->representation, ITEM_LABEL_LENGTH, - format, ap); + vsnprintf(fi->representation, ITEM_LABEL_LENGTH, format, ap); } else { fi->representation = NULL; } + if (pfi) { + *pfi = fi; + } + return pi; } + void proto_item_set_text(proto_item *pi, const char *format, ...) { @@ -1,7 +1,7 @@ /* proto.h * Definitions for protocol display * - * $Id: proto.h,v 1.23 2000/03/07 05:54:52 guy Exp $ + * $Id: proto.h,v 1.24 2000/03/12 04:47:54 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -94,7 +94,7 @@ typedef struct header_field_info { char *name; char *abbrev; enum ftenum type; - int display; /* for integers only, so far. Base and Endianness */ + int display; /* for integers only, so far. Base */ void *strings; /* val_string or true_false_string */ guint32 bitmask; char *blurb; /* Brief description of field. */ @@ -184,12 +184,7 @@ proto_register_field_array(int parent, hf_register_info *hf, int num_records); void proto_register_subtree_array(gint **indices, int num_indices); -/* We have to make this prototype accessible for plugin_api.c, but we - don't want anybody except plugin_api.c to use it directly */ -proto_item * -_proto_tree_add_item_value(proto_tree *tree, int hfindex, gint start, - gint length, int include_format, int visible, va_list ap); - +/* Add item's value to proto_tree, using label registered to that field */ proto_item * proto_tree_add_item(proto_tree *tree, int hfindex, gint start, gint length, ...); @@ -198,15 +193,132 @@ proto_item * proto_tree_add_item_hidden(proto_tree *tree, int hfindex, gint start, gint length, ...); +#if __GNUC__ == 2 proto_item * -proto_tree_add_item_format(proto_tree *tree, int hfindex, gint start, - gint length, ...); +proto_tree_add_protocol_format(proto_tree *tree, int hfindex, gint start, + gint length, const char *format, ...) + __attribute__((format (printf, 5, 6))); +#else +proto_item * +proto_tree_add_protocol_format(proto_tree *tree, int hfindex, gint start, + gint length, const char *format, ...); +#endif + +#if __GNUC__ == 2 proto_item * -proto_tree_add_notext(proto_tree *tree, gint start, gint length, ...); +proto_tree_add_bytes_format(proto_tree *tree, int hfindex, gint start, + gint length, guint8* start_ptr, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_bytes_format(proto_tree *tree, int hfindex, gint start, + gint length, guint8* start_ptr, const char *format, ...); +#endif +#if __GNUC__ == 2 proto_item * -proto_tree_add_text(proto_tree *tree, gint start, gint length, ...); +proto_tree_add_time_format(proto_tree *tree, int hfindex, gint start, + gint length, struct timeval* value_ptr, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_time_format(proto_tree *tree, int hfindex, gint start, + gint length, struct timeval* value_ptr, const char *format, ...); +#endif + +#if __GNUC__ == 2 +proto_item * +proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, gint start, + gint length, guint32 value, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, gint start, + gint length, guint32 value, const char *format, ...); +#endif + +#if __GNUC__ == 2 +proto_item * +proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, gint start, + gint length, guint32 value, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, gint start, + gint length, guint32 value, const char *format, ...); +#endif + +#if __GNUC__ == 2 +proto_item * +proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, gint start, + gint length, guint8* value_ptr, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, gint start, + gint length, guint8* value_ptr, const char *format, ...); +#endif + +#if __GNUC__ == 2 +proto_item * +proto_tree_add_ether_format(proto_tree *tree, int hfindex, gint start, + gint length, guint8* value, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_ether_format(proto_tree *tree, int hfindex, gint start, + gint length, guint8* value, const char *format, ...); +#endif + +#if __GNUC__ == 2 +proto_item * +proto_tree_add_string_format(proto_tree *tree, int hfindex, gint start, + gint length, char* value, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_string_format(proto_tree *tree, int hfindex, gint start, + gint length, char* value, const char *format, ...); +#endif + +#if __GNUC__ == 2 +proto_item * +proto_tree_add_boolean_format(proto_tree *tree, int hfindex, gint start, + gint length, guint32 value, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_boolean_format(proto_tree *tree, int hfindex, gint start, + gint length, guint32 value, const char *format, ...); +#endif + +#if __GNUC__ == 2 +proto_item * +proto_tree_add_uint_format(proto_tree *tree, int hfindex, gint start, + gint length, guint32 value, const char *format, ...) + __attribute__((format (printf, 6, 7))); +#else +proto_item * +proto_tree_add_uint_format(proto_tree *tree, int hfindex, gint start, + gint length, guint32 value, const char *format, ...); +#endif + + +#if __GNUC__ == 2 +proto_item * +proto_tree_add_text(proto_tree *tree, gint start, gint length, const char *, + ...) __attribute__((format (printf, 4, 5))); +#else +proto_item * +proto_tree_add_text(proto_tree *tree, gint start, gint length, const char *, + ...); +#endif + + +proto_item * +proto_tree_add_notext(proto_tree *tree, gint start, gint length); + void proto_item_fill_label(field_info *fi, gchar *label_str); @@ -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.11 2000/01/07 22:05:43 guy Exp $ + * $Id: xdlc.c,v 1.12 2000/03/12 04:47:55 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -249,7 +249,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, col_add_str(fd, COL_INFO, info); if (xdlc_tree) { if (is_extended) { - tc = proto_tree_add_item_format(xdlc_tree, hf_xdlc_control, + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, offset, 2, frame_type, "Control field: %s (0x%04X)", info, control); @@ -270,7 +270,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, decode_boolean_bitfield(control, 0x03, 2*8, "Supervisory frame", NULL)); } else { - tc = proto_tree_add_item_format(xdlc_tree, hf_xdlc_control, + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, offset, 1, frame_type, "Control field: %s (0x%02X)", info, control); @@ -323,7 +323,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, info); if (xdlc_tree) { - tc = proto_tree_add_item_format(xdlc_tree, hf_xdlc_control, + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, offset, 1, frame_type, "Control field: %s (0x%02X)", info, control); @@ -366,7 +366,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, info); if (xdlc_tree) { - tc = proto_tree_add_item_format(xdlc_tree, hf_xdlc_control, + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, offset, (is_extended) ? 2 : 1, frame_type, (is_extended) ? "Control field: %s (0x%04X)" |