diff options
author | Michael Mann <mmann78@netscape.net> | 2015-08-11 19:50:43 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-08-13 04:19:48 +0000 |
commit | beb5c0b765c7a303f31d68df852befdbb3647462 (patch) | |
tree | 1bbd77071073d79c079cbbd20b2f1a0c18c58d11 | |
parent | 61d1ea417231ea5ee8b40f3f32c1065c1eff2a57 (diff) | |
download | wireshark-beb5c0b765c7a303f31d68df852befdbb3647462.tar.gz |
Eliminate proto_tree_add_text from some dissectors.
Change-Id: I1e6bf52fad1b1fffefc174a557ff836f400e8fd7
Reviewed-on: https://code.wireshark.org/review/9996
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-bpdu.c | 166 | ||||
-rw-r--r-- | epan/dissectors/packet-ipdc.c | 53 | ||||
-rw-r--r-- | epan/dissectors/packet-ipp.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-mq.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-pdcp-lte.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-slsk.c | 150 |
6 files changed, 228 insertions, 166 deletions
diff --git a/epan/dissectors/packet-bpdu.c b/epan/dissectors/packet-bpdu.c index f1b9ef3963..0e54c9e606 100644 --- a/epan/dissectors/packet-bpdu.c +++ b/epan/dissectors/packet-bpdu.c @@ -138,11 +138,18 @@ static int hf_bpdu_cist_bridge_sys_id_ext = -1; static int hf_bpdu_cist_bridge_mac = -1; static int hf_bpdu_cist_remaining_hops = -1; static int hf_bpdu_msti_flags = -1; +static int hf_bpdu_msti_id = -1; +static int hf_bpdu_msti_id_FFF = -1; +static int hf_bpdu_mst_priority = -1; +static int hf_bpdu_msti_regional_root_id = -1; static int hf_bpdu_msti_regional_root_mac = -1; static int hf_bpdu_msti_internal_root_path_cost = -1; static int hf_bpdu_msti_bridge_identifier_priority = -1; static int hf_bpdu_msti_port_identifier_priority = -1; static int hf_bpdu_msti_port_id = -1; +static int hf_bpdu_msti_bridge_id = -1; +static int hf_bpdu_msti_bridge_id_priority = -1; +static int hf_bpdu_msti_bridge_id_mac = -1; static int hf_bpdu_msti_remaining_hops = -1; static int hf_bpdu_version_4_length = -1; static int hf_bpdu_spt_config_format_selector = -1; @@ -154,6 +161,11 @@ static int hf_bpdu_flags_dagree_num = -1; static int hf_bpdu_flags_agree_valid = -1; static int hf_bpdu_flags_restricted_role = -1; static int hf_bpdu_spt_agreement_digest = -1; +static int hf_bpdu_agreement_digest_format_id = -1; +static int hf_bpdu_agreement_digest_format_capabilities = -1; +static int hf_bpdu_agreement_digest_convention_id = -1; +static int hf_bpdu_agreement_digest_convention_capabilities = -1; +static int hf_bpdu_agreement_digest_edge_count = -1; static int hf_bpdu_pvst_tlvtype = -1; static int hf_bpdu_pvst_tlvlength = -1; @@ -176,6 +188,9 @@ static expert_field ei_pvst_tlv_length_invalid = EI_INIT; static expert_field ei_pvst_tlv_origvlan_missing = EI_INIT; static expert_field ei_pvst_tlv_truncated = EI_INIT; static expert_field ei_pvst_tlv_unknown = EI_INIT; +static expert_field ei_bpdu_type = EI_INIT; +static expert_field ei_bpdu_version_support = EI_INIT; + static gboolean bpdu_use_system_id_extensions = TRUE; @@ -329,17 +344,14 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp guint16 cist_bridge_identifier_bridge_priority; guint16 cist_bridge_identifier_system_id_extension = 0; const gchar *cist_bridge_identifier_mac_str; - guint16 msti_mstid; guint32 msti_regional_root_mstid, msti_regional_root_priority; const gchar *msti_regional_root_mac_str; guint16 msti_bridge_identifier_priority, msti_port_identifier_priority; - const gchar *msti_bridge_identifier_mac_str; int total_msti_length, offset, msti, msti_format; int msti_length_remaining; guint8 agree_num = 0, dagree_num = 0; int spt_offset = 0; - guint16 spt_edge_count = 0; int MCID_LEN = 51; guint8 spt_agree_data = 0; @@ -347,11 +359,10 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp proto_tree *bpdu_tree; proto_tree *mstp_tree, *msti_tree, *spt_tree = NULL, *aux_mcid_tree = NULL, *agreement_tree = NULL; proto_item *bpdu_item; - proto_item *agreement_item; + proto_item *agreement_item, *proto_id_item, *type_item; proto_tree *root_id_tree; proto_tree *bridge_id_tree; proto_tree *cist_bridge_id_tree; - proto_item *hidden_item; const char *sep; static const int * bpdu_flags[] = { @@ -499,7 +510,6 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp break; } - if (tree) { bpdu_item = proto_tree_add_protocol_format(tree, proto_bpdu, tvb, 0, -1, "Spanning Tree Protocol"); bpdu_tree = proto_item_add_subtree(bpdu_item, ett_bpdu); @@ -508,7 +518,7 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp proto_tree_add_uint(bpdu_tree, hf_bpdu_proto_id, tvb, BPDU_IDENTIFIER, 2, protocol_identifier); - proto_tree_add_uint(bpdu_tree, hf_bpdu_version_id, tvb, + proto_id_item = proto_tree_add_uint(bpdu_tree, hf_bpdu_version_id, tvb, BPDU_VERSION_IDENTIFIER, 1, protocol_version_identifier); switch (protocol_version_identifier) { @@ -522,11 +532,10 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp break; default: - proto_tree_add_text(bpdu_tree, tvb, BPDU_VERSION_IDENTIFIER, 1, - " (Warning: this version of Wireshark only knows about versions 0, 2, 3 & 4)"); + expert_add_info(pinfo, proto_id_item, &ei_bpdu_version_support); break; } - proto_tree_add_uint(bpdu_tree, hf_bpdu_type, tvb, BPDU_TYPE, 1, bpdu_type); + type_item = proto_tree_add_uint(bpdu_tree, hf_bpdu_type, tvb, BPDU_TYPE, 1, bpdu_type); if (bpdu_type == BPDU_TYPE_TOPOLOGY_CHANGE) { set_actual_length(tvb, TC_BPDU_SIZE); @@ -535,8 +544,7 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp if (bpdu_type != BPDU_TYPE_CONF && bpdu_type != BPDU_TYPE_RST) { /* Unknown BPDU type - just display the rest of the PDU as data */ - proto_tree_add_text(bpdu_tree, tvb, BPDU_TYPE + 1, -1, - "Unknown BPDU type data"); + expert_add_info(pinfo, type_item, &ei_bpdu_type); return; } @@ -857,16 +865,11 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp proto_tree_add_bitmask_with_flags(msti_tree, tvb, offset+MSTI_FLAGS, hf_bpdu_msti_flags, ett_bpdu_flags, rst_flags, ENC_NA, BMT_NO_FALSE|BMT_NO_TFS); /* pri, MSTID, Regional root */ - hidden_item = proto_tree_add_item(msti_tree, hf_bpdu_msti_regional_root_mac, tvb, + proto_tree_add_item(msti_tree, hf_bpdu_mst_priority, tvb, offset + MSTI_REGIONAL_ROOT, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(msti_tree, hf_bpdu_msti_id_FFF, tvb, offset + MSTI_REGIONAL_ROOT, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(msti_tree, hf_bpdu_msti_regional_root_mac, tvb, offset + MSTI_REGIONAL_ROOT + 2, 6, ENC_NA); - PROTO_ITEM_SET_HIDDEN(hidden_item); - proto_tree_add_text(msti_tree, tvb, offset + MSTI_REGIONAL_ROOT, 8, - "MSTID %d, priority %d Root Identifier %s", - msti_regional_root_mstid, - msti_regional_root_priority, - msti_regional_root_mac_str); - proto_tree_add_item(msti_tree, hf_bpdu_msti_internal_root_path_cost, tvb, offset+MSTI_INTERNAL_ROOT_PATH_COST, 4, ENC_BIG_ENDIAN); @@ -900,39 +903,26 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp msti_regional_root_priority, msti_regional_root_mac_str); - msti_mstid = tvb_get_ntohs(tvb, offset+ ALT_MSTI_MSTID); - proto_tree_add_text(msti_tree, tvb, offset+ALT_MSTI_MSTID, 2, - "MSTID: %d", msti_mstid); + proto_tree_add_item(msti_tree, hf_bpdu_msti_id, tvb, offset+ALT_MSTI_MSTID, 2, ENC_BIG_ENDIAN); /* flags */ proto_tree_add_bitmask_with_flags(msti_tree, tvb, offset+ALT_MSTI_FLAGS, hf_bpdu_msti_flags, ett_bpdu_flags, rst_flags, ENC_NA, BMT_NO_FALSE|BMT_NO_TFS); /* pri, MSTID, Regional root */ - hidden_item = proto_tree_add_item(msti_tree, hf_bpdu_msti_regional_root_mac, tvb, + proto_tree_add_item(msti_tree, hf_bpdu_mst_priority, tvb, offset + ALT_MSTI_REGIONAL_ROOT, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(msti_tree, hf_bpdu_msti_regional_root_id, tvb, offset + ALT_MSTI_REGIONAL_ROOT, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(msti_tree, hf_bpdu_msti_regional_root_mac, tvb, offset + ALT_MSTI_REGIONAL_ROOT + 2, 6, ENC_NA); - PROTO_ITEM_SET_HIDDEN(hidden_item); - proto_tree_add_text(msti_tree, tvb, offset + ALT_MSTI_REGIONAL_ROOT, 8, - "MSTI Regional Root Identifier: %d / %d / %s", - msti_regional_root_mstid, - msti_regional_root_priority, - msti_regional_root_mac_str); - proto_tree_add_item(msti_tree, hf_bpdu_msti_internal_root_path_cost, tvb, offset+ALT_MSTI_INTERNAL_ROOT_PATH_COST, 4, ENC_BIG_ENDIAN); - msti_bridge_identifier_priority = tvb_get_ntohs(tvb, offset+ALT_MSTI_BRIDGE_IDENTIFIER); - msti_bridge_identifier_mac_str = tvb_ether_to_str(tvb, ALT_MSTI_BRIDGE_IDENTIFIER + 2); + proto_tree_add_item(msti_tree, hf_bpdu_msti_bridge_id, tvb, offset + ALT_MSTI_BRIDGE_IDENTIFIER, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(msti_tree, hf_bpdu_msti_bridge_id_priority, tvb, offset + ALT_MSTI_BRIDGE_IDENTIFIER, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(msti_tree, hf_bpdu_msti_bridge_id_mac, tvb, + offset + ALT_MSTI_BRIDGE_IDENTIFIER + 2, 6, ENC_NA); - proto_tree_add_text(msti_tree, tvb, offset+ALT_MSTI_BRIDGE_IDENTIFIER, 8, - "MSTI Bridge Identifier: %d / %d / %s", - msti_bridge_identifier_priority & 0x0fff, - msti_bridge_identifier_priority & 0xf000, - msti_bridge_identifier_mac_str); - - msti_port_identifier_priority = tvb_get_ntohs(tvb, offset+ALT_MSTI_PORT_IDENTIFIER); - proto_tree_add_uint(msti_tree, hf_bpdu_msti_port_id, tvb, - offset+ALT_MSTI_PORT_IDENTIFIER, 2, msti_port_identifier_priority); + proto_tree_add_item(msti_tree, hf_bpdu_msti_port_id, tvb, offset+ALT_MSTI_PORT_IDENTIFIER, 2, ENC_BIG_ENDIAN); proto_tree_add_item(msti_tree, hf_bpdu_msti_remaining_hops, tvb, offset + ALT_MSTI_REMAINING_HOPS, 1, ENC_BIG_ENDIAN); @@ -1020,28 +1010,17 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp spt_agree_data = tvb_get_guint8(tvb, spt_offset); - proto_tree_add_text(agreement_tree, tvb, spt_offset, 1, - "Agreement Digest Format Id: %d", - (spt_agree_data & 0xf0) >> 4); - proto_tree_add_text(agreement_tree, tvb, spt_offset, 1, - "Agreement Digest Format Capabilities: %d", - (spt_agree_data & 0x0f)); + proto_tree_add_item(agreement_tree, hf_bpdu_agreement_digest_format_id, tvb, spt_offset, 1, ENC_NA); + proto_tree_add_item(agreement_tree, hf_bpdu_agreement_digest_format_capabilities, tvb, spt_offset, 1, ENC_NA); spt_offset += 1; spt_agree_data = tvb_get_guint8(tvb, spt_offset); - proto_tree_add_text(agreement_tree, tvb, spt_offset, 1, - "Agreement Digest Convention Id: %d", - (spt_agree_data & 0xf0) >> 4); - proto_tree_add_text(agreement_tree, tvb, spt_offset, 1, - "Agreement Digest Convention Capabilities: %d", - (spt_agree_data & 0x0f)); + proto_tree_add_item(agreement_tree, hf_bpdu_agreement_digest_convention_id, tvb, spt_offset, 1, ENC_NA); + proto_tree_add_item(agreement_tree, hf_bpdu_agreement_digest_convention_capabilities, tvb, spt_offset, 1, ENC_NA); spt_offset += 1; - spt_edge_count = tvb_get_ntohs(tvb, spt_offset); - - proto_tree_add_text(agreement_tree, tvb, spt_offset, 2, - "Agreement Digest Edge Count: %d", spt_edge_count); + proto_tree_add_item(agreement_tree, hf_bpdu_agreement_digest_edge_count, tvb, spt_offset, 2, ENC_BIG_ENDIAN); spt_offset += 10; proto_tree_add_item(agreement_tree, hf_bpdu_spt_agreement_digest, @@ -1057,7 +1036,6 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp if (is_bpdu_pvst) dissect_bpdu_pvst_tlv(pinfo, bpdu_tree, tvb); } - } } void @@ -1221,6 +1199,22 @@ proto_register_bpdu(void) { "MSTI flags", "mstp.msti.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_bpdu_mst_priority, + { "Priority", "mstp.msti.priority", + FT_UINT8, BASE_HEX, NULL, 0xF0, + NULL, HFILL }}, + { &hf_bpdu_msti_id_FFF, + { "MSTID", "mstp.msti.msti_id", + FT_UINT16, BASE_DEC, NULL, 0x0FFF, + NULL, HFILL }}, + { &hf_bpdu_msti_id, + { "MSTID", "mstp.msti.msti_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + { &hf_bpdu_msti_regional_root_id, + { "MSTI Regional Root Identifier", "mstp.msti.regional_root_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, { &hf_bpdu_msti_regional_root_mac, { "Regional Root", "mstp.msti.root.hw", FT_ETHER, BASE_NONE, NULL, 0x0, @@ -1229,6 +1223,18 @@ proto_register_bpdu(void) { "Internal root path cost", "mstp.msti.root_cost", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_bpdu_msti_bridge_id, + { "MSTI Bridge Identifier", "mstp.msti.bridge_id", + FT_UINT16, BASE_DEC, NULL, 0x0FFF, + NULL, HFILL }}, + { &hf_bpdu_msti_bridge_id_priority, + { "MSTI Bridge Priority", "mstp.msti.bridge_id_priority", + FT_UINT16, BASE_DEC, NULL, 0xF000, + NULL, HFILL }}, + { &hf_bpdu_msti_bridge_id_mac, + { "MSTI Bridge MAC", "mstp.msti.bridge_id_mac", + FT_ETHER, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, { &hf_bpdu_msti_bridge_identifier_priority, { "Bridge Identifier Priority", "mstp.msti.bridge_priority", FT_UINT8, BASE_DEC, NULL, 0x0, @@ -1279,12 +1285,32 @@ proto_register_bpdu(void) NULL, HFILL } }, { &hf_bpdu_flags_restricted_role, { "Restricted Role", "mstp.agree_flags.rest_role", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, - NULL, HFILL } }, - { &hf_bpdu_spt_agreement_digest, - { "Agreement Digest", "mstp.agreement_digest", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL } }, + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, + NULL, HFILL } }, + { &hf_bpdu_spt_agreement_digest, + { "Agreement Digest", "mstp.agreement_digest", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } }, + { &hf_bpdu_agreement_digest_format_id, + { "Agreement Digest Format Id", "bpdu.agreement_digest_format_id", + FT_UINT8, BASE_DEC, NULL, 0xF0, + NULL, HFILL }}, + { &hf_bpdu_agreement_digest_format_capabilities, + { "Agreement Digest Format Capabilities", "bpdu.agreement_digest_format_capabilities", + FT_UINT8, BASE_DEC, NULL, 0x0F, + NULL, HFILL }}, + { &hf_bpdu_agreement_digest_convention_id, + { "Agreement Digest Convention Id", "bpdu.agreement_digest_convention_id", + FT_UINT8, BASE_DEC, NULL, 0xF0, + NULL, HFILL }}, + { &hf_bpdu_agreement_digest_convention_capabilities, + { "Agreement Digest Convention Capabilities", "bpdu.agreement_digest_convention_capabilities", + FT_UINT8, BASE_DEC, NULL, 0x0F, + NULL, HFILL }}, + { &hf_bpdu_agreement_digest_edge_count, + { "Agreement Digest Edge Count", "bpdu.agreement_digest_edge_count", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { &ett_bpdu, @@ -1315,7 +1341,15 @@ proto_register_bpdu(void) { &ei_pvst_tlv_unknown, { "stp.pvst.tlv.unknown", PI_UNDECODED, PI_COMMENT, - "TLV type is unknown", EXPFILL }} + "TLV type is unknown", EXPFILL }}, + + { &ei_bpdu_version_support, + { "bpdu.version_support", PI_PROTOCOL, PI_WARN, + "This version of Wireshark only knows about versions 0, 2, 3 & 4", EXPFILL }}, + + { &ei_bpdu_type, + { "stp.type.unknown", PI_PROTOCOL, PI_WARN, + "Unknown BPDU type data", EXPFILL }}, }; module_t *bpdu_module; diff --git a/epan/dissectors/packet-ipdc.c b/epan/dissectors/packet-ipdc.c index 765f7a2fe0..d40c123cc8 100644 --- a/epan/dissectors/packet-ipdc.c +++ b/epan/dissectors/packet-ipdc.c @@ -44,6 +44,7 @@ #include <epan/to_str.h> #include "packet-tcp.h" #include <epan/prefs.h> +#include <epan/expert.h> void proto_register_ipdc(void); void proto_reg_handoff_ipdc(void); @@ -696,9 +697,15 @@ static int hf_ipdc_ipv4 = -1; static int hf_ipdc_line_status = -1; static int hf_ipdc_channel_status = -1; static int hf_ipdc_enctype = -1; +static int hf_ipdc_end_of_tags = -1; +static int hf_ipdc_data_trailing_end_of_tags = -1; +static int hf_ipdc_type_unknown = -1; static gint ett_ipdc = -1; static gint ett_ipdc_tag = -1; +static gint ett_ipdc_line_status = -1; + +static expert_field ei_ipdc_ipv4 = EI_INIT; static gboolean ipdc_desegment = TRUE; static guint ipdc_port_pref = TCP_PORT_IPDC; @@ -720,7 +727,7 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d { proto_item *ti; proto_tree *ipdc_tree; - proto_tree *tag_tree; + proto_tree *tag_tree, *line_tree; tvbuff_t *q931_tvb; const char *des; @@ -807,11 +814,9 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d if (tag == 0x0) { if (offset == payload_len - 1) { - proto_tree_add_text(tag_tree, tvb, - offset, 1, "end of tags"); + proto_tree_add_item(tag_tree, hf_ipdc_end_of_tags, tvb, offset, 1, ENC_NA); } else { - proto_tree_add_text(tag_tree, tvb, - offset, 1, "data trailing end of tags"); + proto_tree_add_item(tag_tree, hf_ipdc_data_trailing_end_of_tags, tvb, offset, 1, ENC_NA); } break; @@ -879,22 +884,19 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d des, tag, tvb_ip_to_str(tvb, offset + 2), tvb_get_ntohs(tvb, offset + 6)); break; default: - proto_tree_add_text(tag_tree, tvb, - offset, len + 2, - "%s (0x%2.2x): Invalid IP address length %u", + proto_tree_add_expert_format(tag_tree, pinfo, &ei_ipdc_ipv4, tvb, offset, len + 2, "%s (0x%2.2x): Invalid IP address length %u", des, tag, len); } break; /* Line status arrays */ case IPDC_LINESTATUS: case IPDC_CHANNELSTATUS: - proto_tree_add_text(tag_tree, tvb, offset, - len + 2, "%s (0x%2.2x)", des, tag); + line_tree = proto_tree_add_subtree_format(tag_tree, tvb, offset, len + 2, ett_ipdc_line_status, NULL, "%s (0x%2.2x)", des, tag); val_ptr = (type == IPDC_LINESTATUS) ? line_status_vals : channel_status_vals; hf_ptr = (type == IPDC_LINESTATUS) ? hf_ipdc_line_status : hf_ipdc_channel_status; for (i = 0; i < len; i++) { status = tvb_get_guint8(tvb,offset+2+i); - proto_tree_add_uint_format(tag_tree, hf_ptr, tvb, + proto_tree_add_uint_format(line_tree, hf_ptr, tvb, offset + 2 + i, 1, status, "%s (0x%2.2x) %.2u: %u (%s)", des, tag, i + 1, status, @@ -926,8 +928,7 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d break; /* default */ default: - proto_tree_add_text(tag_tree, tvb, offset, - len + 2, "0x%2.2x: %s", tag, des); + proto_tree_add_bytes_format(tag_tree, hf_ipdc_type_unknown, tvb, offset, len + 2, NULL, "0x%2.2x: %s", tag, des); } /* switch */ offset += len + 2; } @@ -1032,19 +1033,45 @@ proto_register_ipdc(void) FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + + { &hf_ipdc_end_of_tags, + { "end of tags", "ipdc.end_of_tags", + FT_NONE, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + + { &hf_ipdc_data_trailing_end_of_tags, + { "data trailing end of tags", "ipdc.data_trailing_end_of_tags", + FT_NONE, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + + { &hf_ipdc_type_unknown, + { "Unknown type", "ipdc.type_unknown", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, }; static gint *ett[] = { &ett_ipdc, &ett_ipdc_tag, + &ett_ipdc_line_status, + }; + + static ei_register_info ei[] = { + { &ei_ipdc_ipv4, { "ipdc.ipv4.invalid_length", PI_PROTOCOL, PI_WARN, "Invalid IP address length", EXPFILL }}, }; module_t *ipdc_module; + expert_module_t* expert_ipdc; proto_ipdc = proto_register_protocol("IP Device Control (SS7 over IP)", "IPDC", "ipdc"); proto_register_field_array(proto_ipdc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ipdc = expert_register_protocol(proto_ipdc); + expert_register_field_array(expert_ipdc, ei, array_length(ei)); ipdc_module = prefs_register_protocol(proto_ipdc, proto_reg_handoff_ipdc); prefs_register_bool_preference(ipdc_module, "desegment_ipdc_messages", diff --git a/epan/dissectors/packet-ipp.c b/epan/dissectors/packet-ipp.c index 4ca6415b6d..9c13c7b1dd 100644 --- a/epan/dissectors/packet-ipp.c +++ b/epan/dissectors/packet-ipp.c @@ -333,6 +333,7 @@ parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree) proto_item *tas = NULL; int start_offset = offset; proto_tree *attr_tree = tree; + proto_tree *subtree = NULL; while (tvb_offset_exists(tvb, offset)) { tag = tvb_get_guint8(tvb, offset); @@ -365,9 +366,8 @@ parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree) /* * Now create a new item for this tag. - * XXX - should use proto_tree_add_subtree */ - tas = proto_tree_add_text(tree, tvb, offset, 1, "%s", tag_desc); + subtree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_ipp_as, &tas, tag_desc); offset += 1; if (tag == TAG_END_OF_ATTRIBUTES) { /* @@ -397,8 +397,7 @@ parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree) * have a tree for that tag yet; create * a tree. */ - as_tree = proto_item_add_subtree(tas, - ett_ipp_as); + as_tree = subtree; attr_tree = as_tree; } diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c index 9535feb58f..e0c753ec25 100644 --- a/epan/dissectors/packet-mq.c +++ b/epan/dissectors/packet-mq.c @@ -3777,14 +3777,8 @@ static void dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_reported_length_remaining(tvb, offset) >= 4) { p_mq_parm->mq_strucID = tvb_get_ntohl(tvb, offset); - if (tree) - { - /* - proto_tree_add_text(mqroot_tree, tvb, offset, -1, "%s", val_to_str_ext(p_mq_parm->mq_strucID, GET_VALS_EXTP(StructID), "Unknown (0x%08x)")); - */ - proto_tree_add_subtree_format(mqroot_tree, tvb, offset, -1, ett_mq_structid, NULL, + proto_tree_add_subtree_format(mqroot_tree, tvb, offset, -1, ett_mq_structid, NULL, "%s", val_to_str_ext(p_mq_parm->mq_strucID, GET_VALS_EXTP(StructID), "Unknown (0x%08x)")); - } } } else diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c index f5c75ce125..f44efb1502 100644 --- a/epan/dissectors/packet-pdcp-lte.c +++ b/epan/dissectors/packet-pdcp-lte.c @@ -101,6 +101,7 @@ static int hf_pdcp_lte_fms = -1; static int hf_pdcp_lte_reserved4 = -1; static int hf_pdcp_lte_fms2 = -1; static int hf_pdcp_lte_bitmap = -1; +static int hf_pdcp_lte_bitmap_byte = -1; /* Sequence Analysis */ @@ -1975,7 +1976,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree not_received++; } } - proto_tree_add_text(bitmap_tree, tvb, bit_offset/8, 1, "%s", buff); + proto_tree_add_uint_format(bitmap_tree, hf_pdcp_lte_bitmap_byte, tvb, bit_offset/8, 1, bits, "%s", buff); bit_offset += 8; } } @@ -2421,7 +2422,12 @@ void proto_register_pdcp(void) "Status report bitmap (0=error, 1=OK)", HFILL } }, - + { &hf_pdcp_lte_bitmap_byte, + { "Bitmap byte", + "pdcp-lte.bitmap.byte", FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL + } + }, { &hf_pdcp_lte_sequence_analysis, { "Sequence Analysis", diff --git a/epan/dissectors/packet-slsk.c b/epan/dissectors/packet-slsk.c index 11c13087db..cfdf8ff17b 100644 --- a/epan/dissectors/packet-slsk.c +++ b/epan/dissectors/packet-slsk.c @@ -51,6 +51,7 @@ static int hf_slsk_message_code = -1; static int hf_slsk_client_ip = -1; /* static int hf_slsk_server_ip = -1; */ static int hf_slsk_string_length = -1; +static int hf_slsk_directory_name = -1; static int hf_slsk_username = -1; static int hf_slsk_password = -1; static int hf_slsk_version = -1; @@ -78,6 +79,7 @@ static int hf_slsk_slotsfull = -1; static int hf_slsk_place_in_queue = -1; static int hf_slsk_number_of_rooms = -1; static int hf_slsk_filename = -1; +static int hf_slsk_filename_ext = -1; static int hf_slsk_directory = -1; static int hf_slsk_size = -1; /* static int hf_slsk_checksum = -1; */ @@ -101,6 +103,7 @@ static int hf_slsk_seconds_server_inactivity_before_disconnect = -1; static int hf_slsk_nodes_in_cache_before_disconnect = -1; static int hf_slsk_seconds_before_ping_children = -1; static int hf_slsk_recommendation = -1; +static int hf_slsk_user = -1; static int hf_slsk_ranking = -1; @@ -109,6 +112,7 @@ static gint ett_slsk = -1; static gint ett_slsk_compr_packet = -1; static expert_field ei_slsk_unknown_data = EI_INIT; +static expert_field ei_slsk_zlib_decompression_failed = EI_INIT; #define TCP_PORT_SLSK_1 2234 #define TCP_PORT_SLSK_2 5534 @@ -472,11 +476,8 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvbuff_t *uncompr_tvb = tvb_child_uncompress(tvb, tvb, offset, comprlen); if (uncompr_tvb == NULL) { - proto_tree_add_text(slsk_tree, tvb, offset, -1, - "[zlib compressed packet]"); + proto_tree_add_expert(slsk_tree, pinfo, &ei_slsk_zlib_decompression_failed, tvb, offset, -1); offset += tvb_captured_length_remaining(tvb, offset); - proto_tree_add_text(slsk_tree, tvb, 0, 0, - "(uncompression failed !)"); } else { proto_item *ti2 = proto_tree_add_item(slsk_tree, hf_slsk_compr_packet, tvb, offset, -1, ENC_NA); @@ -505,9 +506,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "Directory #%d String Length: %u", i+1, len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, uncompr_tvb_offset+4, len, - "Directory #%d Name: %s", i+1, - tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + str = tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len); + proto_tree_add_string_format(slsk_compr_packet_tree, hf_slsk_directory_name, uncompr_tvb, uncompr_tvb_offset+4, len, str, + "Directory #%d Name: %s", i+1, str); uncompr_tvb_offset += 4+len; i2=0; j2 = tvb_get_letohl(uncompr_tvb, uncompr_tvb_offset); @@ -525,10 +526,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "Dir #%d File #%d String Length: %u", i+1, i2+1, len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, - uncompr_tvb_offset+4, len, - "Dir #%d File #%d Filename: %s", i+1, i2+1, - tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + str = tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len); + proto_tree_add_string_format(slsk_compr_packet_tree, hf_slsk_filename, uncompr_tvb, uncompr_tvb_offset+4, len, str, + "Dir #%d File #%d Filename: %s", i+1, i2+1, str); uncompr_tvb_offset += 4+len; proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_integer, uncompr_tvb, uncompr_tvb_offset, 4, @@ -544,10 +544,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "Dir #%d File #%d String Length: %u", i+1, i2+1, len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, - uncompr_tvb_offset+4, len, - "Dir #%d File #%d ext: %s", i+1, i2+1, - tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + str = tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len); + proto_tree_add_string_format(slsk_compr_packet_tree, hf_slsk_filename_ext, uncompr_tvb, uncompr_tvb_offset+4, len, str, + "Dir #%d File #%d ext: %s", i+1, i2+1, str); uncompr_tvb_offset += 4+len; i3=0; j3 = tvb_get_letohl(uncompr_tvb, uncompr_tvb_offset); @@ -674,9 +673,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "File #%d String Length: %u", i+1, len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, uncompr_tvb_offset+4, len, - "File #%d Filename: %s", i+1, - tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + str = tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len); + proto_tree_add_string_format(slsk_compr_packet_tree, hf_slsk_filename, uncompr_tvb, uncompr_tvb_offset+4, len, str, + "File #%d Filename: %s", i+1, str); uncompr_tvb_offset += 4+len; proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_integer, uncompr_tvb, uncompr_tvb_offset, 4, tvb_get_letohl(uncompr_tvb, uncompr_tvb_offset), @@ -690,9 +689,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "File #%d String Length: %d", i+1, len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, uncompr_tvb_offset+4, len, - "File #%d ext: %s", i+1, - tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + str = tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len); + proto_tree_add_string_format(slsk_compr_packet_tree, hf_slsk_filename_ext, uncompr_tvb, uncompr_tvb_offset+4, len, str, + "File #%d ext: %s", i+1, str); uncompr_tvb_offset += 4+len; i2=0; j2 = tvb_get_letohl(uncompr_tvb, uncompr_tvb_offset); @@ -798,8 +797,8 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "User #%d: %s", i+1, tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_user, tvb, offset+4, len, str, "User #%d: %s", i+1, str); offset += 4+len; } i++; @@ -1176,11 +1175,8 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvbuff_t *uncompr_tvb = tvb_child_uncompress(tvb, tvb, offset, comprlen); if (uncompr_tvb == NULL) { - proto_tree_add_text(slsk_tree, tvb, offset, -1, - "[zlib compressed packet]"); + proto_tree_add_expert(slsk_tree, pinfo, &ei_slsk_zlib_decompression_failed, tvb, offset, -1); offset += tvb_captured_length_remaining(tvb, offset); - proto_tree_add_text(slsk_tree, tvb, 0, 0, - "[uncompression failed !]"); } else { proto_item *ti2 = proto_tree_add_item(slsk_tree, hf_slsk_compr_packet, tvb, offset, -1, ENC_NA); @@ -1206,8 +1202,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "Directory Name String Length: %u", len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, uncompr_tvb_offset+4, len, - "Directory Name: %s", tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + proto_tree_add_item(slsk_compr_packet_tree, hf_slsk_directory_name, uncompr_tvb, uncompr_tvb_offset+4, len, ENC_ASCII|ENC_NA); uncompr_tvb_offset += 4+len; i=0; j = tvb_get_letohl(uncompr_tvb, uncompr_tvb_offset); @@ -1221,9 +1216,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "Directory #%d Name String Length: %u", i+1, len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, uncompr_tvb_offset+4, len, - "Directory #%d Name: %s", i+1, - tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + str = tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len); + proto_tree_add_string_format(slsk_compr_packet_tree, hf_slsk_directory_name, uncompr_tvb, uncompr_tvb_offset+4, len, + str, "Directory #%d Name: %s", i+1, str); uncompr_tvb_offset += 4+len; i2 = 0; j2 = tvb_get_letohl(uncompr_tvb, uncompr_tvb_offset); @@ -1241,10 +1236,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "Dir #%d File #%d String Length: %d", i+1, i2+1, len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, - uncompr_tvb_offset+4, len, - "Dir #%d File #%d Filename: %s", i+1, i2+1, - tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + str = tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len); + proto_tree_add_string_format(slsk_compr_packet_tree, hf_slsk_filename, uncompr_tvb, uncompr_tvb_offset+4, len, str, + "Dir #%d File #%d Filename: %s", i+1, i2+1, str); uncompr_tvb_offset += 4+len; proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_integer, uncompr_tvb, uncompr_tvb_offset, 4, tvb_get_letohl(uncompr_tvb, uncompr_tvb_offset), @@ -1258,10 +1252,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_compr_packet_tree, hf_slsk_string_length, uncompr_tvb, uncompr_tvb_offset, 4, len, "Dir #%d File #%d String Length: %d", i+1, i2+1, len); - proto_tree_add_text(slsk_compr_packet_tree, uncompr_tvb, - uncompr_tvb_offset+4, len, - "Dir #%d File #%d ext: %s", i+1, i2+1, - tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len)); + str = tvb_format_text(uncompr_tvb, uncompr_tvb_offset+4, len); + proto_tree_add_string_format(slsk_compr_packet_tree, hf_slsk_filename_ext, uncompr_tvb, uncompr_tvb_offset+4, len, str, + "Dir #%d File #%d ext: %s", i+1, i2+1, str); uncompr_tvb_offset += 4+len; i3 = 0; j3 = tvb_get_letohl(uncompr_tvb, uncompr_tvb_offset); @@ -1512,9 +1505,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "Recommendation #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_recommendation, tvb, offset+4, len, str, + "Recommendation #%d: %s", i+1, str); offset += 4+len; proto_tree_add_uint_format(slsk_tree, hf_slsk_ranking, tvb, offset, 4, tvb_get_letohl(tvb, offset), "Ranking #%d: %d", i+1, tvb_get_letohl(tvb, offset)); @@ -1560,9 +1553,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "Recommendation #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_recommendation, tvb, offset+4, len, str, + "Recommendation #%d: %s", i+1, str); offset += 4+len; proto_tree_add_uint_format(slsk_tree, hf_slsk_ranking, tvb, offset, 4, tvb_get_letohl(tvb, offset), "Ranking #%d: %d", i+1, tvb_get_letohl(tvb, offset)); @@ -1604,9 +1597,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "Recommendation #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_recommendation, tvb, offset+4, len, str, + "Recommendation #%d: %s", i+1, str); offset += 4+len; } i++; @@ -1635,9 +1628,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "String #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_string, tvb, offset+4, len, str, + "String #%d: %s", i+1, str); offset += 4+len; } i++; @@ -1712,9 +1705,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "Room #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_room, tvb, offset+4, len, str, + "Room #%d: %s", i+1, str); offset += 4+len; } i++; @@ -1817,9 +1810,8 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "User #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_user, tvb, offset+4, len, str, "User #%d: %s", i+1, str); offset += 4+len; } i++; @@ -1927,9 +1919,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "User #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_user, tvb, offset+4, len, str, + "User #%d: %s", i+1, str); offset += 4+len; } i++; @@ -2122,9 +2114,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "User #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_user, tvb, offset+4, len, str, + "User #%d: %s", i+1, str); offset += 4+len; proto_tree_add_item(slsk_tree, hf_slsk_ip, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; @@ -2188,9 +2180,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "User #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_user, tvb, offset+4, len, str, + "User #%d: %s", i+1, str); offset += 4+len; proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, 4, tvb_get_letohl(tvb, offset), "Same Recommendations #%d: %d", i+1, tvb_get_letohl(tvb, offset)); @@ -2232,9 +2224,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "Recommendation #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_recommendation, tvb, offset+4, len, str, + "Recommendation #%d: %s", i+1, str); offset += 4+len; proto_tree_add_uint_format(slsk_tree, hf_slsk_ranking, tvb, offset, 4, tvb_get_letohl(tvb, offset), "Ranking #%d: %d", i+1, tvb_get_letohl(tvb, offset)); @@ -2262,7 +2254,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code, "Message Type: %s (Code: %02d)", message_type, msg_code); offset += 4; - proto_tree_add_uint(slsk_tree, hf_slsk_string_length, tvb, offset, 4, tvb_get_letohl(tvb, offset)); + proto_tree_add_item(slsk_tree, hf_slsk_string_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(slsk_tree, hf_slsk_recommendation, tvb, offset+4, tvb_get_letohl(tvb, offset), ENC_ASCII|ENC_NA); offset += 4+tvb_get_letohl(tvb, offset); i=0; j = tvb_get_letohl(tvb, offset); @@ -2276,9 +2268,9 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, len = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_string_length, tvb, offset, 4, len, "String #%d Length: %d", i+1, len); - proto_tree_add_text(slsk_tree, tvb, offset+4, len, - "Username #%d: %s", i+1, - tvb_format_text(tvb, offset+4, len)); + str = tvb_format_text(tvb, offset+4, len); + proto_tree_add_string_format(slsk_tree, hf_slsk_username, tvb, offset+4, len, str, + "Username #%d: %s", i+1, str); offset += 4+len; } i++; @@ -2425,6 +2417,9 @@ proto_register_slsk(void) { &hf_slsk_string_length, { "String Length", "slsk.string.length", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_slsk_directory_name, + { "Directory name", "slsk.directory_name", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, { &hf_slsk_username, { "Username", "slsk.username", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, @@ -2506,6 +2501,9 @@ proto_register_slsk(void) { &hf_slsk_filename, { "Filename", "slsk.filename", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_slsk_filename_ext, + { "Filename ext", "slsk.filename_ext", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, { &hf_slsk_directory, { "Directory", "slsk.directory", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, @@ -2579,6 +2577,9 @@ proto_register_slsk(void) { &hf_slsk_recommendation, { "Recommendation", "slsk.recommendation", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_slsk_user, + { "User", "slsk.user", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, { &hf_slsk_ranking, { "Ranking", "slsk.ranking", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } }, @@ -2592,6 +2593,7 @@ proto_register_slsk(void) static ei_register_info ei[] = { { &ei_slsk_unknown_data, { "slsk.unknown_data", PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)", EXPFILL }}, + { &ei_slsk_zlib_decompression_failed, { "slsk.zlib_decompression_failed", PI_PROTOCOL, PI_WARN, "zlib compressed packet failed to decompress", EXPFILL }}, }; module_t *slsk_module; |