From fa5b45834b3199bc3c47b3d328d54e0504d7b942 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Fri, 14 Jun 2013 01:56:28 +0000 Subject: Remove check_col() and the occasional tree. svn path=/trunk/; revision=49921 --- epan/dissectors/packet-nt-tpcp.c | 3 +- epan/dissectors/packet-olsr.c | 16 +- epan/dissectors/packet-omapi.c | 12 +- epan/dissectors/packet-omron-fins.c | 8 +- epan/dissectors/packet-openwire.c | 9 +- epan/dissectors/packet-opsi.c | 20 ++- epan/dissectors/packet-osi.c | 5 +- epan/dissectors/packet-ositp.c | 50 +++--- epan/dissectors/packet-p_mul.c | 71 ++++----- epan/dissectors/packet-pagp.c | 64 +++----- epan/dissectors/packet-pana.c | 4 +- epan/dissectors/packet-pcep.c | 4 +- epan/dissectors/packet-pcli.c | 4 +- epan/dissectors/packet-pflog.c | 9 +- epan/dissectors/packet-pgm.c | 23 +-- epan/dissectors/packet-pim.c | 10 +- epan/dissectors/packet-pingpongprotocol.c | 5 +- epan/dissectors/packet-pktc.c | 12 +- epan/dissectors/packet-pktgen.c | 2 - epan/dissectors/packet-pop.c | 26 ++-- epan/dissectors/packet-portmap.c | 17 +-- epan/dissectors/packet-ppi-antenna.c | 3 +- epan/dissectors/packet-ppi-gps.c | 3 +- epan/dissectors/packet-ppi-sensor.c | 8 +- epan/dissectors/packet-ppi-vector.c | 3 +- epan/dissectors/packet-ppi.c | 13 +- epan/dissectors/packet-ppp.c | 4 +- epan/dissectors/packet-pppoe.c | 15 +- epan/dissectors/packet-ptp.c | 63 ++++---- epan/dissectors/packet-pvfs2.c | 2 +- epan/dissectors/packet-pw-atm.c | 44 ++---- epan/dissectors/packet-pw-cesopsn.c | 35 ++--- epan/dissectors/packet-pw-fr.c | 19 +-- epan/dissectors/packet-pw-satop.c | 33 ++-- epan/dissectors/packet-q2931.c | 5 +- epan/dissectors/packet-q931.c | 32 ++-- epan/dissectors/packet-qllc.c | 9 +- epan/dissectors/packet-quake.c | 12 +- epan/dissectors/packet-quake2.c | 3 +- epan/dissectors/packet-quake3.c | 3 +- epan/dissectors/packet-quakeworld.c | 9 +- epan/dissectors/packet-radius.c | 17 +-- epan/dissectors/packet-retix-bpdu.c | 5 +- epan/dissectors/packet-rgmp.c | 2 - epan/dissectors/packet-rip.c | 6 +- epan/dissectors/packet-ripng.c | 2 - epan/dissectors/packet-rlogin.c | 95 ++++++------ epan/dissectors/packet-rmcp.c | 3 +- epan/dissectors/packet-rmi.c | 2 - epan/dissectors/packet-rmp.c | 4 +- epan/dissectors/packet-roofnet.c | 14 +- epan/dissectors/packet-rpcap.c | 4 +- epan/dissectors/packet-rpl.c | 5 +- epan/dissectors/packet-rsh.c | 28 ++-- epan/dissectors/packet-rtmpt.c | 31 ++-- epan/dissectors/packet-rtnet.c | 18 +-- epan/dissectors/packet-rtp-events.c | 9 +- epan/dissectors/packet-rtse.c | 3 +- epan/dissectors/packet-rtsp.c | 50 +++--- epan/dissectors/packet-rx.c | 20 +-- epan/dissectors/packet-s5066.c | 4 +- epan/dissectors/packet-sap.c | 4 +- epan/dissectors/packet-sbus.c | 244 +++++++++++++++--------------- epan/dissectors/packet-scriptingservice.c | 5 +- epan/dissectors/packet-scsi-osd.c | 10 +- epan/dissectors/packet-scsi-sbc.c | 164 +++++++++----------- epan/dissectors/packet-scsi-ssc.c | 70 ++++----- 67 files changed, 613 insertions(+), 898 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-nt-tpcp.c b/epan/dissectors/packet-nt-tpcp.c index 2d2b1f0a06..301d67ae1f 100644 --- a/epan/dissectors/packet-nt-tpcp.c +++ b/epan/dissectors/packet-nt-tpcp.c @@ -130,8 +130,7 @@ dissect_tpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tpcph.cport = g_ntohs(tpcph.cport); tpcph.signature = g_ntohl(tpcph.signature); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO,"%s id %d CPort %s CIP %s SIP %s", + col_add_fstr(pinfo->cinfo, COL_INFO,"%s id %d CPort %s CIP %s SIP %s", val_to_str_const(tpcph.type, type_vals, "Unknown"), tpcph.id, get_udp_port(tpcph.cport), diff --git a/epan/dissectors/packet-olsr.c b/epan/dissectors/packet-olsr.c index da043a50f2..5aa1ff974b 100644 --- a/epan/dissectors/packet-olsr.c +++ b/epan/dissectors/packet-olsr.c @@ -531,17 +531,13 @@ static int dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* Does this packet have a valid message type at the beginning? */ if (tvb_length(tvb) < 4) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR Packet, Length: %u Bytes (not enough data in packet)", + col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR Packet, Length: %u Bytes (not enough data in packet)", tvb_length(tvb)); - } return 0; /* not enough bytes for the packet length */ } packet_len = tvb_get_ntohs(tvb, 0); if (packet_len > tvb_length(tvb)) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR Packet, Length: %u Bytes (not enough data in packet)", packet_len); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR Packet, Length: %u Bytes (not enough data in packet)", packet_len); return 0; } /*-------------Setting the Protocol and Info Columns in the Wireshark Display----------*/ @@ -549,14 +545,12 @@ static int dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi col_clear(pinfo->cinfo, COL_INFO); if ((pinfo->src.type != AT_IPv4) && (pinfo->src.type != AT_IPv6)) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR (unknown address type) Packet, Length: %u Bytes", packet_len); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR (unknown address type) Packet, Length: %u Bytes", packet_len); return 0; } - if (check_col(pinfo->cinfo, COL_INFO) && (pinfo->src.type == AT_IPv4)) { + if (pinfo->src.type == AT_IPv4) { col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR (IPv4) Packet, Length: %u Bytes", packet_len); - } else if (check_col(pinfo->cinfo, COL_INFO) && (pinfo->src.type == AT_IPv6)) { + } else if (pinfo->src.type == AT_IPv6) { col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR (IPv6) Packet, Length: %u Bytes", packet_len); } diff --git a/epan/dissectors/packet-omapi.c b/epan/dissectors/packet-omapi.c index 64797a5ec3..2ab45403de 100644 --- a/epan/dissectors/packet-omapi.c +++ b/epan/dissectors/packet-omapi.c @@ -136,10 +136,8 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ptvcursor_add(cursor, hf_omapi_version, 4, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_omapi_hlength, 4, ENC_BIG_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_str(pinfo->cinfo, COL_INFO, "Status message"); - } + col_append_str(pinfo->cinfo, COL_INFO, "Status message"); + proto_item_append_text(ti, ", Status message"); } @@ -147,11 +145,9 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) authlength = tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_omapi_auth_len, 4, ENC_BIG_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, + col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, val_to_str(tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)), omapi_opcode_vals, "Unknown opcode (0x%04x)")); - } + proto_item_append_text(ti, ", Opcode: %s", val_to_str(tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)), omapi_opcode_vals, "Unknown opcode (0x%04x)")); diff --git a/epan/dissectors/packet-omron-fins.c b/epan/dissectors/packet-omron-fins.c index 1864529920..6e2fcf2b25 100644 --- a/epan/dissectors/packet-omron-fins.c +++ b/epan/dissectors/packet-omron-fins.c @@ -1125,16 +1125,12 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da icf_flags = tvb_get_guint8(tvb, offset); if (icf_flags & 0x40) { is_response = TRUE; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Response : %s", cmd_str); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "Response : %s", cmd_str); } else { is_command = TRUE; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Command : %s", cmd_str); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "Command : %s", cmd_str); } if (tree) { /* we are being asked for details */ diff --git a/epan/dissectors/packet-openwire.c b/epan/dissectors/packet-openwire.c index 97824a0ee9..9a5b1887b5 100644 --- a/epan/dissectors/packet-openwire.c +++ b/epan/dissectors/packet-openwire.c @@ -1323,12 +1323,9 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) iCommand = tvb_get_guint8(tvb, offset + 4); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", - val_to_str_ext(iCommand, &openwire_opcode_vals_ext, "Unknown (0x%02x)")); - col_set_fence(pinfo->cinfo, COL_INFO); - } + col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", + val_to_str_ext(iCommand, &openwire_opcode_vals_ext, "Unknown (0x%02x)")); + col_set_fence(pinfo->cinfo, COL_INFO); detect_protocol_options(tvb, pinfo, offset, iCommand); diff --git a/epan/dissectors/packet-opsi.c b/epan/dissectors/packet-opsi.c index 492b1dff0c..54ce51e86c 100644 --- a/epan/dissectors/packet-opsi.c +++ b/epan/dissectors/packet-opsi.c @@ -559,19 +559,17 @@ dissect_opsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "OPSI"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_clear(pinfo->cinfo, COL_INFO); - if (tvb_length(tvb) < CODE_OFFSET+1) { - col_set_str(pinfo->cinfo, COL_INFO, "Open Policy Service Interface"); - } - else { - col_add_fstr(pinfo->cinfo, COL_INFO, "Open Policy Service Interface, %s", - val_to_str(tvb_get_guint8(tvb, CODE_OFFSET), opsi_opcode, - "")); - } + col_clear(pinfo->cinfo, COL_INFO); + if (tvb_length(tvb) < CODE_OFFSET+1) { + col_set_str(pinfo->cinfo, COL_INFO, "Open Policy Service Interface"); + } + else { + col_add_fstr(pinfo->cinfo, COL_INFO, "Open Policy Service Interface, %s", + val_to_str(tvb_get_guint8(tvb, CODE_OFFSET), opsi_opcode, + "")); } } - else if (check_col(pinfo->cinfo, COL_INFO) && (tvb_length(tvb) > CODE_OFFSET)) { + else if (tvb_length(tvb) > CODE_OFFSET) { col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(tvb_get_guint8(tvb, CODE_OFFSET), opsi_opcode, "")); diff --git a/epan/dissectors/packet-osi.c b/epan/dissectors/packet-osi.c index 9d53d3a473..1c9782540b 100644 --- a/epan/dissectors/packet-osi.c +++ b/epan/dissectors/packet-osi.c @@ -486,9 +486,8 @@ static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISO"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ISO protocol (%02x)", nlpid); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ISO protocol (%02x)", nlpid); + call_dissector(data_handle,tvb, pinfo, tree); break; } diff --git a/epan/dissectors/packet-ositp.c b/epan/dissectors/packet-ositp.c index 867b716325..bc134c74a1 100644 --- a/epan/dissectors/packet-ositp.c +++ b/epan/dissectors/packet-ositp.c @@ -876,8 +876,7 @@ static int ositp_decode_DR(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, default: return -1; } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "DR TPDU src-ref: 0x%04x dst-ref: 0x%04x", src_ref, dst_ref); @@ -1099,15 +1098,13 @@ static int ositp_decode_DT(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, pinfo->clnp_dstref = dst_ref; pinfo->fragmented = fragment; - if (check_col(pinfo->cinfo, COL_INFO)) { - if (is_class_234) { + if (is_class_234) { col_append_fstr(pinfo->cinfo, COL_INFO, "DT TPDU (%u) dst-ref: 0x%04x", tpdu_nr, dst_ref); } else { col_append_fstr(pinfo->cinfo, COL_INFO, "DT TPDU (%u)", tpdu_nr); } - } if (tree) { ti = proto_tree_add_item(tree, proto_cotp, tvb, offset, li + 1, ENC_NA); @@ -1157,13 +1154,11 @@ static int ositp_decode_DT(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, next_tvb = tvb_new_subset_remaining(tvb, offset); fragment_length = tvb_length(next_tvb); - if (check_col(pinfo->cinfo, COL_INFO)) { - if (fragment) { - col_append_fstr(pinfo->cinfo, COL_INFO, " [COTP fragment, %u byte%s]", - fragment_length, plurality(fragment_length, "", "s")); - } else { - col_append_fstr(pinfo->cinfo, COL_INFO, " EOT"); - } + if (fragment) { + col_append_fstr(pinfo->cinfo, COL_INFO, " [COTP fragment, %u byte%s]", + fragment_length, plurality(fragment_length, "", "s")); + } else { + col_append_fstr(pinfo->cinfo, COL_INFO, " EOT"); } if (cotp_reassemble) { @@ -1381,8 +1376,7 @@ static int ositp_decode_ED(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, dst_ref = tvb_get_ntohs(tvb, offset + P_DST_REF); pinfo->clnp_dstref = dst_ref; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "ED TPDU (%u) dst-ref: 0x%04x", + col_append_fstr(pinfo->cinfo, COL_INFO, "ED TPDU (%u) dst-ref: 0x%04x", tpdu_nr, dst_ref); if (tree) { @@ -1486,8 +1480,7 @@ static int ositp_decode_RJ(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, dst_ref = tvb_get_ntohs(tvb, offset + P_DST_REF); pinfo->clnp_dstref = dst_ref; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "RJ TPDU (%u) dst-ref: 0x%04x", + col_append_fstr(pinfo->cinfo, COL_INFO, "RJ TPDU (%u) dst-ref: 0x%04x", tpdu_nr, dst_ref); if (tree) { @@ -1551,8 +1544,7 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, pinfo->clnp_srcref = src_ref; pinfo->clnp_dstref = dst_ref; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "%s TPDU src-ref: 0x%04x dst-ref: 0x%04x", (tpdu == CR_TPDU) ? "CR" : "CC", src_ref, @@ -1675,8 +1667,7 @@ static int ositp_decode_DC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, pinfo->clnp_dstref = dst_ref; pinfo->clnp_dstref = src_ref; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "DC TPDU src-ref: 0x%04x dst-ref: 0x%04x", src_ref, dst_ref); @@ -1744,8 +1735,7 @@ static int ositp_decode_AK(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, tpdu_nr = tvb_get_guint8(tvb, offset + P_TPDU_NR_234); pinfo->clnp_dstref = dst_ref; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "AK TPDU (%u) dst-ref: 0x%04x", + col_append_fstr(pinfo->cinfo, COL_INFO, "AK TPDU (%u) dst-ref: 0x%04x", tpdu_nr, dst_ref); if (tree) { @@ -1786,8 +1776,7 @@ static int ositp_decode_AK(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, cdt_in_ak = tvb_get_ntohs(tvb, offset + P_CDT_IN_AK); pinfo->clnp_dstref = dst_ref; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "AK TPDU (%u) dst-ref: 0x%04x Credit: %u", + col_append_fstr(pinfo->cinfo, COL_INFO, "AK TPDU (%u) dst-ref: 0x%04x Credit: %u", tpdu_nr, dst_ref, cdt_in_ak); if (tree) { @@ -1968,8 +1957,7 @@ static int ositp_decode_EA(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, dst_ref = tvb_get_ntohs(tvb, offset + P_DST_REF); pinfo->clnp_dstref = dst_ref; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "EA TPDU (%u) dst-ref: 0x%04x", tpdu_nr, dst_ref); if (tree) { @@ -2055,8 +2043,7 @@ static int ositp_decode_ER(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, dst_ref = tvb_get_ntohs(tvb, offset + P_DST_REF); pinfo->clnp_dstref = dst_ref; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "ER TPDU dst-ref: 0x%04x", dst_ref); + col_append_fstr(pinfo->cinfo, COL_INFO, "ER TPDU dst-ref: 0x%04x", dst_ref); if (tree) { ti = proto_tree_add_item(tree, proto_cotp, tvb, offset, li + 1, ENC_NA); @@ -2157,8 +2144,7 @@ static gint dissect_ositp_internal(tvbuff_t *tvb, packet_info *pinfo, /* Initialize the COL_INFO field; each of the TPDUs will have its information appended. */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_set_str(pinfo->cinfo, COL_INFO, ""); + col_set_str(pinfo->cinfo, COL_INFO, ""); while (tvb_offset_exists(tvb, offset)) { if (!first_tpdu) { @@ -2217,7 +2203,7 @@ static gint dissect_ositp_internal(tvbuff_t *tvb, packet_info *pinfo, is_cltp = TRUE; break; default : - if (first_tpdu && check_col(pinfo->cinfo, COL_INFO)) + if (first_tpdu) col_append_fstr(pinfo->cinfo, COL_INFO, "Unknown TPDU type (0x%x)", tpdu); new_offset = -1; /* bad PDU type */ break; @@ -2233,7 +2219,7 @@ static gint dissect_ositp_internal(tvbuff_t *tvb, packet_info *pinfo, if (first_tpdu) { /* Well, we found at least one valid COTP or CLTP PDU, so I guess this is either COTP or CLTP. */ - if (!subdissector_found && check_col(pinfo->cinfo, COL_PROTOCOL)) + if (!subdissector_found) col_set_str(pinfo->cinfo, COL_PROTOCOL, is_cltp ? "CLTP" : "COTP"); found_ositp = TRUE; } diff --git a/epan/dissectors/packet-p_mul.c b/epan/dissectors/packet-p_mul.c index 6059973084..03ccf0a3c3 100644 --- a/epan/dissectors/packet-p_mul.c +++ b/epan/dissectors/packet-p_mul.c @@ -1080,9 +1080,8 @@ static void dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case Ack_PDU: - if (check_col (pinfo->cinfo, COL_INFO)) { - message_id_list = ep_strbuf_new_label(""); - } + message_id_list = ep_strbuf_new_label(""); + for (i = 0; i < count; i++) { /* Ack Info Entry */ len = tvb_get_ntohs (tvb, offset); @@ -1124,12 +1123,10 @@ static void dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } offset += 4; - if (check_col (pinfo->cinfo, COL_INFO)) { - if (i == 0) { - ep_strbuf_printf (message_id_list, "%u", message_id); - } else { - ep_strbuf_append_printf (message_id_list, ",%u", message_id); - } + if (i == 0) { + ep_strbuf_printf (message_id_list, "%u", message_id); + } else { + ep_strbuf_append_printf (message_id_list, ",%u", message_id); } if (len > 10) { @@ -1254,37 +1251,35 @@ static void dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_id, seq_no, tot_no_missing); } - if (check_col (pinfo->cinfo, COL_INFO)) { - /* Check if printing Ack-Ack */ - if (pdu_type == Address_PDU && no_dest == 0) { - col_append_str (pinfo->cinfo, COL_INFO, get_type (Ack_Ack_PDU)); - } else { - col_append_str (pinfo->cinfo, COL_INFO, get_type (pdu_type)); - } - if (pdu_type == Address_PDU || pdu_type == Extra_Address_PDU || - pdu_type == FEC_Address_PDU || pdu_type == Extra_FEC_Address_PDU) { - col_append_fstr (pinfo->cinfo, COL_INFO, ", No PDUs: %u", no_pdus); - } else if (pdu_type == Data_PDU) { - col_append_fstr (pinfo->cinfo, COL_INFO, ", Seq no: %u", seq_no); + /* Check if printing Ack-Ack */ + if (pdu_type == Address_PDU && no_dest == 0) { + col_append_str (pinfo->cinfo, COL_INFO, get_type (Ack_Ack_PDU)); + } else { + col_append_str (pinfo->cinfo, COL_INFO, get_type (pdu_type)); + } + if (pdu_type == Address_PDU || pdu_type == Extra_Address_PDU || + pdu_type == FEC_Address_PDU || pdu_type == Extra_FEC_Address_PDU) { + col_append_fstr (pinfo->cinfo, COL_INFO, ", No PDUs: %u", no_pdus); + } else if (pdu_type == Data_PDU) { + col_append_fstr (pinfo->cinfo, COL_INFO, ", Seq no: %u", seq_no); + } + if (pdu_type == Address_PDU || pdu_type == Extra_Address_PDU || + pdu_type == FEC_Address_PDU || pdu_type == Extra_FEC_Address_PDU) { + if (no_dest > 0) { + col_append_fstr (pinfo->cinfo, COL_INFO, ", Count of Dest: %u", no_dest); } - if (pdu_type == Address_PDU || pdu_type == Extra_Address_PDU || - pdu_type == FEC_Address_PDU || pdu_type == Extra_FEC_Address_PDU) { - if (no_dest > 0) { - col_append_fstr (pinfo->cinfo, COL_INFO, ", Count of Dest: %u", no_dest); - } - } else if (pdu_type == Ack_PDU) { - if (tot_no_missing) { - col_append_fstr (pinfo->cinfo, COL_INFO, ", Missing seq numbers: %u", - tot_no_missing); - } - col_append_fstr (pinfo->cinfo, COL_INFO, ", Count of Ack: %u", count); + } else if (pdu_type == Ack_PDU) { + if (tot_no_missing) { + col_append_fstr (pinfo->cinfo, COL_INFO, ", Missing seq numbers: %u", + tot_no_missing); } - if (pdu_type != Ack_PDU) { - col_append_fstr (pinfo->cinfo, COL_INFO, ", MSID: %u", message_id); - } else { - if (message_id_list && message_id_list->len > 0) { - col_append_fstr (pinfo->cinfo, COL_INFO, ", MSID: %s", message_id_list->str); - } + col_append_fstr (pinfo->cinfo, COL_INFO, ", Count of Ack: %u", count); + } + if (pdu_type != Ack_PDU) { + col_append_fstr (pinfo->cinfo, COL_INFO, ", MSID: %u", message_id); + } else { + if (message_id_list && message_id_list->len > 0) { + col_append_fstr (pinfo->cinfo, COL_INFO, ", MSID: %s", message_id_list->str); } } diff --git a/epan/dissectors/packet-pagp.c b/epan/dissectors/packet-pagp.c index a36c453e6e..e0b13a845a 100644 --- a/epan/dissectors/packet-pagp.c +++ b/epan/dissectors/packet-pagp.c @@ -192,49 +192,35 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(pagp_tree, hf_pagp_version_number, tvb, PAGP_VERSION_NUMBER, 1, raw_octet); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_str(pinfo->cinfo, COL_INFO, - val_to_str_const(raw_octet, pdu_vers, "Unknown PDU version")); - } + col_append_str(pinfo->cinfo, COL_INFO, + val_to_str_const(raw_octet, pdu_vers, "Unknown PDU version")); if (raw_octet == PAGP_FLUSH_PDU) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, "; Local DevID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, "; Local DevID: %s", tvb_ether_to_str(tvb, PAGP_FLUSH_LOCAL_DEVICE_ID)); - } - if (tree) { - proto_tree_add_item(pagp_tree, hf_pagp_flush_local_device_id, tvb, - PAGP_FLUSH_LOCAL_DEVICE_ID, 6, ENC_NA); - } - - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Partner DevID: %s", + + proto_tree_add_item(pagp_tree, hf_pagp_flush_local_device_id, tvb, + PAGP_FLUSH_LOCAL_DEVICE_ID, 6, ENC_NA); + + col_append_fstr(pinfo->cinfo, COL_INFO, ", Partner DevID: %s", tvb_ether_to_str(tvb, PAGP_FLUSH_PARTNER_DEVICE_ID)); - } - if (tree) { - proto_tree_add_item(pagp_tree, hf_pagp_flush_partner_device_id, tvb, - PAGP_FLUSH_PARTNER_DEVICE_ID, 6, ENC_NA); - } + + proto_tree_add_item(pagp_tree, hf_pagp_flush_partner_device_id, tvb, + PAGP_FLUSH_PARTNER_DEVICE_ID, 6, ENC_NA); raw_word = tvb_get_ntohl(tvb, PAGP_FLUSH_TRANSACTION_ID); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, - "; Transaction ID: 0x%x ", raw_word); - } - if (tree) { - proto_tree_add_uint(pagp_tree, hf_pagp_flush_transaction_id, tvb, - PAGP_FLUSH_TRANSACTION_ID, 4, raw_word); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "; Transaction ID: 0x%x ", raw_word); + + proto_tree_add_uint(pagp_tree, hf_pagp_flush_transaction_id, tvb, + PAGP_FLUSH_TRANSACTION_ID, 4, raw_word); return; } /* Info PDU */ flags = tvb_get_guint8(tvb, PAGP_FLAGS); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, "; Flags 0x%x", flags); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "; Flags 0x%x", flags); if (tree) { flags_item = proto_tree_add_uint(pagp_tree, hf_pagp_flags, tvb, @@ -263,14 +249,11 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, "; Local DevID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, "; Local DevID: %s", tvb_ether_to_str(tvb, PAGP_LOCAL_DEVICE_ID)); - } - if (tree) { - proto_tree_add_item(pagp_tree, hf_pagp_local_device_id, tvb, + + proto_tree_add_item(pagp_tree, hf_pagp_local_device_id, tvb, PAGP_LOCAL_DEVICE_ID, 6, ENC_NA); - } if (tree) { raw_octet = tvb_get_guint8(tvb, PAGP_LOCAL_LEARN_CAP); @@ -294,14 +277,11 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) PAGP_LOCAL_GROUP_IFINDEX, 4, raw_word); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Partner DevID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Partner DevID: %s", tvb_ether_to_str(tvb, PAGP_PARTNER_DEVICE_ID)); - } - if (tree) { - proto_tree_add_item(pagp_tree, hf_pagp_partner_device_id, tvb, + + proto_tree_add_item(pagp_tree, hf_pagp_partner_device_id, tvb, PAGP_PARTNER_DEVICE_ID, 6, ENC_NA); - } if (tree) { raw_octet = tvb_get_guint8(tvb, PAGP_PARTNER_LEARN_CAP); diff --git a/epan/dissectors/packet-pana.c b/epan/dissectors/packet-pana.c index e6b937c57c..0504c9043b 100644 --- a/epan/dissectors/packet-pana.c +++ b/epan/dissectors/packet-pana.c @@ -518,11 +518,9 @@ dissect_pana_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) seq_num = tvb_get_ntohl(tvb, 12); avp_length = msg_length - 16; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Type %s-%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "Type %s-%s", val_to_str(msg_type, msg_type_names, "Unknown (%d)"), val_to_str(flags & PANA_FLAG_R, msg_subtype_names, "Unknown (%d)")); - } /* Make the protocol tree */ if (tree) { diff --git a/epan/dissectors/packet-pcep.c b/epan/dissectors/packet-pcep.c index 1342464ccb..39c109e0ee 100644 --- a/epan/dissectors/packet-pcep.c +++ b/epan/dissectors/packet-pcep.c @@ -2579,9 +2579,7 @@ dissect_pcep_msg_tree(tvbuff_t *tvb, proto_tree *tree, guint tree_mode, packet_i message_type = tvb_get_guint8(tvb, 1); msg_length = tvb_get_ntohs(tvb, 2); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(message_type, message_type_vals, "Unknown Message (%u). ")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(message_type, message_type_vals, "Unknown Message (%u). ")); ti = proto_tree_add_item(tree, proto_pcep, tvb, offset, msg_length, ENC_NA); pcep_tree = proto_item_add_subtree(ti, tree_mode); diff --git a/epan/dissectors/packet-pcli.c b/epan/dissectors/packet-pcli.c index ea6542b357..6526a9224f 100644 --- a/epan/dissectors/packet-pcli.c +++ b/epan/dissectors/packet-pcli.c @@ -80,9 +80,7 @@ dissect_pcli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { cccid = tvb_get_ntohl(tvb,0); /* Set the info column */ - if(check_col(pinfo->cinfo,COL_INFO)){ - col_add_fstr(pinfo->cinfo, COL_INFO, "CCCID: %u",cccid); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "CCCID: %u",cccid); /* *If we have a non-null tree (ie we are building the proto_tree diff --git a/epan/dissectors/packet-pflog.c b/epan/dissectors/packet-pflog.c index 89036b4014..0b351531c7 100644 --- a/epan/dissectors/packet-pflog.c +++ b/epan/dissectors/packet-pflog.c @@ -299,12 +299,10 @@ dissect_pflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_prepend_fstr(pinfo->cinfo, COL_INFO, "[%s %s/%u] ", + col_prepend_fstr(pinfo->cinfo, COL_INFO, "[%s %s/%u] ", val_to_str(action, pflog_action_vals, "unknown (%u)"), ifname, rulenr); - } } void @@ -489,12 +487,11 @@ dissect_old_pflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat break; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_prepend_fstr(pinfo->cinfo, COL_INFO, "[%s %s/#%d] ", + col_prepend_fstr(pinfo->cinfo, COL_INFO, "[%s %s/#%d] ", val_to_str(action, pflog_action_vals, "unknown (%u)"), ifname, rnr); - } + return offset; } diff --git a/epan/dissectors/packet-pgm.c b/epan/dissectors/packet-pgm.c index 41d92d026f..99ad81b426 100644 --- a/epan/dissectors/packet-pgm.c +++ b/epan/dissectors/packet-pgm.c @@ -825,13 +825,11 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "PGM"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_clear(pinfo->cinfo, COL_INFO); - if (tvb_reported_length_remaining(tvb, 0) < 18) { - col_set_str(pinfo->cinfo, COL_INFO, + col_clear(pinfo->cinfo, COL_INFO); + if (tvb_reported_length_remaining(tvb, 0) < 18) { + col_set_str(pinfo->cinfo, COL_INFO, "Packet too small"); - return; - } + return; } pinfo->srcport = pgmhdr_sport = tvb_get_ntohs(tvb, 0); @@ -853,30 +851,25 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case PGM_NCF_PCKT: case PGM_POLR_PCKT: case PGM_ACK_PCKT: - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "%-5s sqn 0x%x gsi %s", pktname, sqn, gsi); - } break; case PGM_RDATA_PCKT: case PGM_ODATA_PCKT: - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "%-5s sqn 0x%x gsi %s tsdulen %d", pktname, sqn, gsi, pgmhdr_tsdulen); - } + isdata = TRUE; break; case PGM_POLL_PCKT: { guint16 poll_stype = tvb_get_ntohs(tvb, 22); pollstname = val_to_str(poll_stype, poll_subtype_vals, "Unknown (0x%02x)"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "%-5s sqn 0x%x gsi %s subtype %s", pktname, sqn, gsi, pollstname); } - } break; default: return; diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c index 49245bdcbd..0113e4aa86 100644 --- a/epan/dissectors/packet-pim.c +++ b/epan/dissectors/packet-pim.c @@ -196,8 +196,7 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 1; pim_type = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(pim_type, type1vals, "Unknown (%u)")); proto_tree_add_uint(pim_tree, hf_pim_code, tvb, offset, 1, pim_type); @@ -708,12 +707,9 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { break; } - if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "PIMv%d", + col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "PIMv%d", PIM_VER(pim_typever)); - } - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, typestr); + col_add_str(pinfo->cinfo, COL_INFO, typestr); ti = proto_tree_add_item(tree, proto_pim, tvb, offset, -1, ENC_NA); pim_tree = proto_item_add_subtree(ti, ett_pim); diff --git a/epan/dissectors/packet-pingpongprotocol.c b/epan/dissectors/packet-pingpongprotocol.c index 38520ede50..638a1cfd40 100644 --- a/epan/dissectors/packet-pingpongprotocol.c +++ b/epan/dissectors/packet-pingpongprotocol.c @@ -121,9 +121,8 @@ dissect_pingpongprotocol_message(tvbuff_t *message_tvb, packet_info *pinfo, prot guint8 type; type = tvb_get_guint8(message_tvb, MESSAGE_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(type, message_type_values, "Unknown PingPongProtocol type")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(type, message_type_values, "Unknown PingPongProtocol type")); + proto_tree_add_item(pingpongprotocol_tree, hf_message_type, message_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, ENC_BIG_ENDIAN); proto_tree_add_item(pingpongprotocol_tree, hf_message_flags, message_tvb, MESSAGE_FLAGS_OFFSET, MESSAGE_FLAGS_LENGTH, ENC_BIG_ENDIAN); proto_tree_add_item(pingpongprotocol_tree, hf_message_length, message_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-pktc.c b/epan/dissectors/packet-pktc.c index b31dc4124a..f829be2f5f 100644 --- a/epan/dissectors/packet-pktc.c +++ b/epan/dissectors/packet-pktc.c @@ -487,8 +487,7 @@ dissect_pktc_mtafqdn_krbsafeuserdata(packet_info *pinfo, tvbuff_t *tvb, proto_tr proto_tree_add_uint(tree, hf_pktc_mtafqdn_msgtype, tvb, offset, 1, msgtype); offset+=1; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(msgtype, pktc_mtafqdn_msgtype_vals, "MsgType %u")); /* enterprise */ @@ -556,11 +555,8 @@ dissect_pktc_mtafqdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pktc_mtafqdn_tree = proto_item_add_subtree(item, ett_pktc_mtafqdn); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "MTA FQDN %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "MTA FQDN %s", pinfo->srcport == pinfo->match_uint ? "Reply":"Request"); - } - /* KRB_AP_RE[QP] */ pktc_mtafqdn_tvb = tvb_new_subset_remaining(tvb, offset); @@ -609,12 +605,10 @@ dissect_pktc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset+=1; /* fill COL_INFO */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(kmmid, kmmid_types, "Unknown KMMID %#x")); col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", val_to_str(doi, doi_types, "Unknown DOI %#x")); - } switch(kmmid){ case KMMID_WAKEUP: diff --git a/epan/dissectors/packet-pktgen.c b/epan/dissectors/packet-pktgen.c index deee954768..131e4b0ac8 100644 --- a/epan/dissectors/packet-pktgen.c +++ b/epan/dissectors/packet-pktgen.c @@ -77,9 +77,7 @@ static gboolean dissect_pktgen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKTGEN"); - if(check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "Seq: %u", tvb_get_ntohl(tvb, 4)); - } if(tree) { diff --git a/epan/dissectors/packet-pop.c b/epan/dissectors/packet-pop.c index 6dc722e5ea..d31193824b 100644 --- a/epan/dissectors/packet-pop.c +++ b/epan/dissectors/packet-pop.c @@ -194,22 +194,20 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) is_continuation = response_is_continuation(line); } - if (check_col(pinfo->cinfo, COL_INFO)) { - /* - * Put the first line from the buffer into the summary - * if it's a POP request or reply (but leave out the - * line terminator). - * Otherwise, just call it a continuation. - */ - if (is_continuation) { - length_remaining = tvb_length_remaining(tvb, offset); - col_add_fstr(pinfo->cinfo, COL_INFO, "S: DATA fragment, %d byte%s", + /* + * Put the first line from the buffer into the summary + * if it's a POP request or reply (but leave out the + * line terminator). + * Otherwise, just call it a continuation. + */ + if (is_continuation) { + length_remaining = tvb_length_remaining(tvb, offset); + col_add_fstr(pinfo->cinfo, COL_INFO, "S: DATA fragment, %d byte%s", length_remaining, plurality (length_remaining, "", "s")); - } - else - col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", is_request ? "C" : "S", - format_text(line, linelen)); } + else + col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", is_request ? "C" : "S", + format_text(line, linelen)); ti = proto_tree_add_item(tree, proto_pop, tvb, offset, -1, ENC_NA); pop_tree = proto_item_add_subtree(ti, ett_pop); diff --git a/epan/dissectors/packet-portmap.c b/epan/dissectors/packet-portmap.c index e9bfbb0d65..a8d6bf7997 100644 --- a/epan/dissectors/packet-portmap.c +++ b/epan/dissectors/packet-portmap.c @@ -95,20 +95,17 @@ dissect_getport_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree_add_uint_format(tree, hf_portmap_prog, tvb, offset, 4, prog, "Program: %s (%u)", prog_name, prog); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s(%u)", prog_name, prog); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s(%u)", prog_name, prog); - } proto_item_append_text(tree, " GETPORT Call %s(%u)", prog_name, prog); /* version */ version = tvb_get_ntohl(tvb, offset+4); proto_tree_add_item(tree, hf_portmap_version, tvb, offset+4, 4, ENC_BIG_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " V:%d", version); + col_append_fstr(pinfo->cinfo, COL_INFO, " V:%d", version); + - } proto_item_append_text(tree, " Version:%d", version); @@ -117,10 +114,8 @@ dissect_getport_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_name = ipprotostr(proto); proto_tree_add_uint_format(tree, hf_portmap_proto, tvb, offset+8, 4, proto, "Proto: %s (%u)", proto_name, proto); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", proto_name); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", proto_name); - } proto_item_append_text(tree, " %s", proto_name); /* port */ @@ -159,9 +154,7 @@ dissect_getport_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, offset); proto_item_append_text(tree, " GETPORT Reply Port:%d", portx); if(portx){ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " Port:%d", portx); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " Port:%d", portx); proto_item_append_text(tree, " Port:%d", portx); } else { col_append_str(pinfo->cinfo, COL_INFO, " PROGRAM_NOT_AVAILABLE"); diff --git a/epan/dissectors/packet-ppi-antenna.c b/epan/dissectors/packet-ppi-antenna.c index b32b0d3ca5..23c2d56048 100644 --- a/epan/dissectors/packet-ppi-antenna.c +++ b/epan/dissectors/packet-ppi-antenna.c @@ -137,8 +137,7 @@ dissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { present = tvb_get_letohl(tvb, offset+4); /* Setup basic column info */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "PPI Antenna info v%u, Length %u", + col_add_fstr(pinfo->cinfo, COL_INFO, "PPI Antenna info v%u, Length %u", version, length); diff --git a/epan/dissectors/packet-ppi-gps.c b/epan/dissectors/packet-ppi-gps.c index 95aeca93bf..a161b619c2 100644 --- a/epan/dissectors/packet-ppi-gps.c +++ b/epan/dissectors/packet-ppi-gps.c @@ -162,8 +162,7 @@ dissect_ppi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { present = tvb_get_letohl(tvb, offset+4); /* Setup basic column info */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "PPI_GPS Capture v%u, Length %u", version, length); + col_add_fstr(pinfo->cinfo, COL_INFO, "PPI_GPS Capture v%u, Length %u", version, length); /* Create the basic dissection tree*/ if (tree) { diff --git a/epan/dissectors/packet-ppi-sensor.c b/epan/dissectors/packet-ppi-sensor.c index 7b9ae480bc..c40357baee 100644 --- a/epan/dissectors/packet-ppi-sensor.c +++ b/epan/dissectors/packet-ppi-sensor.c @@ -190,17 +190,15 @@ dissect_ppi_sensor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Clear out stuff in the info column */ - if (check_col(pinfo->cinfo,COL_INFO)) { - col_clear(pinfo->cinfo,COL_INFO); - } + col_clear(pinfo->cinfo,COL_INFO); + /* pull out the first three fields of the BASE-GEOTAG-HEADER */ version = tvb_get_guint8(tvb, offset); length = tvb_get_letohs(tvb, offset+2); present = tvb_get_letohl(tvb, offset+4); /* Setup basic column info */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "PPI Sensor info v%u, Length %u ", + col_add_fstr(pinfo->cinfo, COL_INFO, "PPI Sensor info v%u, Length %u ", version, length); /* Create the basic dissection tree*/ diff --git a/epan/dissectors/packet-ppi-vector.c b/epan/dissectors/packet-ppi-vector.c index 2a1da5dc41..7835ac2dce 100644 --- a/epan/dissectors/packet-ppi-vector.c +++ b/epan/dissectors/packet-ppi-vector.c @@ -972,8 +972,7 @@ dissect_ppi_vector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) length = tvb_get_letohs(tvb, offset+2); /* Setup basic column info */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "PPI_Vector Capture v%u, Length %u", + col_add_fstr(pinfo->cinfo, COL_INFO, "PPI_Vector Capture v%u, Length %u", version, length); /* Create the basic dissection tree*/ diff --git a/epan/dissectors/packet-ppi.c b/epan/dissectors/packet-ppi.c index 27cd3b54b1..7faf954efc 100644 --- a/epan/dissectors/packet-ppi.c +++ b/epan/dissectors/packet-ppi.c @@ -504,18 +504,14 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of rate_kbps / 1000.0); if (rate_kbps == 0) proto_item_append_text(ti, " [invalid]"); - if (check_col(pinfo->cinfo, COL_TX_RATE)) { - col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%.1f Mbps", rate_kbps / 1000.0); - } + col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%.1f Mbps", rate_kbps / 1000.0); ptvcursor_advance(csr, 2); common_frequency = tvb_get_letohs(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr)); chan_str = ieee80211_mhz_to_str(common_frequency); proto_tree_add_uint_format(ptvcursor_tree(csr), hf_80211_common_chan_freq, ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr), 2, common_frequency, "Channel frequency: %s", chan_str); - if (check_col(pinfo->cinfo, COL_FREQ_CHAN)) { - col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%s", chan_str); - } + col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%s", chan_str); g_free(chan_str); ptvcursor_advance(csr, 2); @@ -535,10 +531,9 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of ptvcursor_add(csr, hf_80211_common_fhss_hopset, 1, ENC_LITTLE_ENDIAN); ptvcursor_add(csr, hf_80211_common_fhss_pattern, 1, ENC_LITTLE_ENDIAN); - if (check_col(pinfo->cinfo, COL_RSSI)) { - col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", + col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", (gint8) tvb_get_guint8(tvb, ptvcursor_current_offset(csr))); - } + ptvcursor_add_invalid_check(csr, hf_80211_common_dbm_antsignal, 1, 0x80); /* -128 */ ptvcursor_add_invalid_check(csr, hf_80211_common_dbm_antnoise, 1, 0x80); diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index 117d7a90a3..0a256b3e21 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -4183,11 +4183,9 @@ dissect_bcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) mac_type = tvb_get_guint8(tvb, offset); if (!(flags & BCP_IS_BCONTROL)) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(mac_type, bcp_mac_type_vals, "Unknown MAC type %u")); - } } if (tree) { proto_tree_add_uint(bcp_tree, hf_bcp_mac_type, tvb, offset, 1, diff --git a/epan/dissectors/packet-pppoe.c b/epan/dissectors/packet-pppoe.c index bd34c6b7e2..66d6efdf97 100644 --- a/epan/dissectors/packet-pppoe.c +++ b/epan/dissectors/packet-pppoe.c @@ -481,11 +481,8 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr proto_tree_add_item(pppoe_tree, hf_pppoed_tag_ac_name, tvb, tagstart+4, poe_tag_length, ENC_ASCII|ENC_NA); /* Show AC-Name in info column */ - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " AC-Name='%s'", + col_append_fstr(pinfo->cinfo, COL_INFO, " AC-Name='%s'", tvb_get_ephemeral_string(tvb, tagstart+4, poe_tag_length)); - } break; case PPPOE_TAG_HOST_UNIQ: proto_tree_add_item(pppoe_tree, hf_pppoed_tag_host_uniq, tvb, @@ -706,10 +703,7 @@ static void dissect_pppoed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Start Decoding Here. */ pppoe_code = tvb_get_guint8(tvb, 1); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(pppoe_code, code_vals, "Unknown")); - } + col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(pppoe_code, code_vals, "Unknown")); /* Read length of payload */ reported_payload_length = tvb_get_ntohs(tvb, 4); @@ -1069,11 +1063,8 @@ static void dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Start Decoding Here. */ pppoe_code = tvb_get_guint8(tvb, 1); - if (check_col(pinfo->cinfo,COL_INFO)) - { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(pppoe_code, code_vals, "Unknown")); - } reported_payload_length = tvb_get_ntohs(tvb, 4); actual_payload_length = tvb_reported_length_remaining(tvb, 6); diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c index 0e7e3f8636..59b1ef93ac 100644 --- a/epan/dissectors/packet-ptp.c +++ b/epan/dissectors/packet-ptp.c @@ -1633,12 +1633,10 @@ dissect_ptp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } case PTP_MANAGEMENT_MESSAGE:{ - if (check_col(pinfo->cinfo, COL_INFO)){ - col_add_fstr(pinfo->cinfo, COL_INFO, "Management Message (%s)", + col_add_fstr(pinfo->cinfo, COL_INFO, "Management Message (%s)", val_to_str(ptp_mm_messagekey, ptp_managementMessageKey_infocolumn_vals, "Unknown message key %u")); - } break; } default:{ @@ -2337,41 +2335,38 @@ dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ptp_v2_messageid = 0x0F & tvb_get_guint8 (tvb, PTP_V2_TRANSPORT_SPECIFIC_MESSAGE_ID_OFFSET); /* Extend Info column with managementId */ - if (check_col(pinfo->cinfo, COL_INFO)) + /* Create and set the string for "Info" column */ + if ( ptp_v2_messageid == PTP_V2_MANAGEMENT_MESSAGE ) { - /* Create and set the string for "Info" column */ - if ( ptp_v2_messageid == PTP_V2_MANAGEMENT_MESSAGE ) - { - guint16 tlv_type; - /* Get TLV Type */ - tlv_type = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_TYPE_OFFSET); - /* For management there are PTP_V2_TLV_TYPE_MANAGEMENT and PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS TLVs */ - switch(tlv_type) - { - case PTP_V2_TLV_TYPE_MANAGEMENT: - /* Get the managementId */ - ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTID_OFFSET); - ptp_v2_management_action = 0x0F & tvb_get_guint8(tvb, PTP_V2_MM_ACTION_OFFSET); - col_add_fstr(pinfo->cinfo, COL_INFO, "Management (%s) %s", - val_to_str(ptp_v2_mm_managementId, ptp_v2_managementID_infocolumn_vals, "Unknown management Id %u"), - val_to_str(ptp_v2_management_action, ptp_v2_mm_action_vals, "Unknown Action %u")); - break; - case PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS: - /* Get the managementErrorId */ - ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET); - col_add_fstr(pinfo->cinfo, COL_INFO, "Management Error Message (%s)", val_to_str(ptp_v2_mm_managementId, - ptp2_managementErrorId_vals, "Unknown Error Id %u")); - break; - default: - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(ptp_v2_messageid, ptp_v2_messageid_vals, "Unknown PTP Message (%u)")); - break; - } - } - else + guint16 tlv_type; + /* Get TLV Type */ + tlv_type = tvb_get_ntohs (tvb, PTP_V2_MM_TLV_TYPE_OFFSET); + /* For management there are PTP_V2_TLV_TYPE_MANAGEMENT and PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS TLVs */ + switch(tlv_type) { - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(ptp_v2_messageid, ptp_v2_messageid_vals, "Unknown PTP Message (%u)")); + case PTP_V2_TLV_TYPE_MANAGEMENT: + /* Get the managementId */ + ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTID_OFFSET); + ptp_v2_management_action = 0x0F & tvb_get_guint8(tvb, PTP_V2_MM_ACTION_OFFSET); + col_add_fstr(pinfo->cinfo, COL_INFO, "Management (%s) %s", + val_to_str(ptp_v2_mm_managementId, ptp_v2_managementID_infocolumn_vals, "Unknown management Id %u"), + val_to_str(ptp_v2_management_action, ptp_v2_mm_action_vals, "Unknown Action %u")); + break; + case PTP_V2_TLV_TYPE_MANAGEMENT_ERROR_STATUS: + /* Get the managementErrorId */ + ptp_v2_mm_managementId = tvb_get_ntohs(tvb, PTP_V2_MM_TLV_MANAGEMENTERRORID_OFFSET); + col_add_fstr(pinfo->cinfo, COL_INFO, "Management Error Message (%s)", val_to_str(ptp_v2_mm_managementId, + ptp2_managementErrorId_vals, "Unknown Error Id %u")); + break; + default: + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(ptp_v2_messageid, ptp_v2_messageid_vals, "Unknown PTP Message (%u)")); + break; } } + else + { + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(ptp_v2_messageid, ptp_v2_messageid_vals, "Unknown PTP Message (%u)")); + } if (tree) { diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c index 352437104f..f912c6a59f 100644 --- a/epan/dissectors/packet-pvfs2.c +++ b/epan/dissectors/packet-pvfs2.c @@ -545,7 +545,7 @@ dissect_pvfs2_error(tvbuff_t *tvb, proto_tree *tree, int offset, proto_tree_add_uint(tree, hf_pvfs_error, tvb, offset, 4, -err); offset += 4; - if ((err != 0) && check_col(pinfo->cinfo, COL_INFO)) + if (err != 0) { errmsg = val_to_str(-err, names_pvfs_error, "Unknown error: %u"); col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", errmsg); diff --git a/epan/dissectors/packet-pw-atm.c b/epan/dissectors/packet-pw-atm.c index eb3ffb1473..b6f3cc711b 100644 --- a/epan/dissectors/packet-pw-atm.c +++ b/epan/dissectors/packet-pw-atm.c @@ -600,11 +600,8 @@ dissect_11_or_aal5_pdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { /* sub-dissectors _may_ overwrite columns in aal5_pdu mode */ col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_name_column); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_clear(pinfo->cinfo, COL_INFO); - col_append_pw_info(pinfo, payload_size, cells, 0); - } + col_clear(pinfo->cinfo, COL_INFO); + col_append_pw_info(pinfo, payload_size, cells, 0); } { @@ -679,11 +676,8 @@ dissect_11_or_aal5_pdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { /* overwrite everything written by sub-dissectors in 1:1 modes*/ col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_name_column); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_clear(pinfo->cinfo, COL_INFO); - col_append_pw_info(pinfo, payload_size, cells, 0); - } + col_clear(pinfo->cinfo, COL_INFO); + col_append_pw_info(pinfo, payload_size, cells, 0); } pinfo->private_data = pd_save; @@ -829,20 +823,14 @@ dissect_aal5_sdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) } /* fill columns in Packet List */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_name_column); + if (PWATM_SUBMODE_ADMIN_CELL == pd.submode) { - col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_name_column); - if (PWATM_SUBMODE_ADMIN_CELL == pd.submode) - { - col_append_str(pinfo->cinfo, COL_PROTOCOL, ", OAM cell"); - } + col_append_str(pinfo->cinfo, COL_PROTOCOL, ", OAM cell"); } - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_clear(pinfo->cinfo, COL_INFO); - col_append_pw_info(pinfo, payload_size, cells, padding_size); - } + col_clear(pinfo->cinfo, COL_INFO); + col_append_pw_info(pinfo, payload_size, cells, padding_size); { proto_item* item; @@ -1060,11 +1048,8 @@ dissect_n1_cw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* overwrite everything written by sub-dissectors */ col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_name_column); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_clear(pinfo->cinfo, COL_INFO); - col_append_pw_info(pinfo, payload_size, cells, padding_size); - } + col_clear(pinfo->cinfo, COL_INFO); + col_append_pw_info(pinfo, payload_size, cells, padding_size); pinfo->private_data = pd_save; return; @@ -1132,11 +1117,8 @@ dissect_n1_nocw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* overwrite everything written by sub-dissectors */ col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_name_column); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_clear(pinfo->cinfo, COL_INFO); - col_append_pw_info(pinfo, payload_size, cells, 0); - } + col_clear(pinfo->cinfo, COL_INFO); + col_append_pw_info(pinfo, payload_size, cells, 0); pinfo->private_data = pd_save; return; diff --git a/epan/dissectors/packet-pw-cesopsn.c b/epan/dissectors/packet-pw-cesopsn.c index c5f7218465..4ba386d7b6 100644 --- a/epan/dissectors/packet-pw-cesopsn.c +++ b/epan/dissectors/packet-pw-cesopsn.c @@ -221,29 +221,26 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original /* fill up columns*/ col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname); - if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + if (properties & PWC_ANYOF_CW_BAD) { - col_clear(pinfo->cinfo, COL_INFO); - if (properties & PWC_ANYOF_CW_BAD) - { - col_append_str(pinfo->cinfo, COL_INFO, "CW:Bad, "); - } - else if (properties & PWC_ANYOF_CW_SUSPECT) - { - col_append_str(pinfo->cinfo, COL_INFO, "CW:Suspect, "); - } + col_append_str(pinfo->cinfo, COL_INFO, "CW:Bad, "); + } + else if (properties & PWC_ANYOF_CW_SUSPECT) + { + col_append_str(pinfo->cinfo, COL_INFO, "CW:Suspect, "); + } - if (properties & PWC_PAY_SIZE_BAD) - { - col_append_str(pinfo->cinfo, COL_INFO, "Payload size:Bad, "); - } + if (properties & PWC_PAY_SIZE_BAD) + { + col_append_str(pinfo->cinfo, COL_INFO, "Payload size:Bad, "); + } - col_append_fstr(pinfo->cinfo, COL_INFO, "TDM octets:%d", (int)payload_size); + col_append_fstr(pinfo->cinfo, COL_INFO, "TDM octets:%d", (int)payload_size); - if (padding_size != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Padding:%d", (int)padding_size); - } + if (padding_size != 0) + { + col_append_fstr(pinfo->cinfo, COL_INFO, ", Padding:%d", (int)padding_size); } { diff --git a/epan/dissectors/packet-pw-fr.c b/epan/dissectors/packet-pw-fr.c index 9bbbe50de6..e12175edd8 100644 --- a/epan/dissectors/packet-pw-fr.c +++ b/epan/dissectors/packet-pw-fr.c @@ -163,19 +163,16 @@ dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree ) } col_set_str(pinfo->cinfo, COL_PROTOCOL, "FR PW"); - if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + if (packet_quality & PQ_CW_BAD) { - col_clear(pinfo->cinfo, COL_INFO); - if (packet_quality & PQ_CW_BAD) - { - col_append_str(pinfo->cinfo, COL_INFO, "CW:Malformed, "); - } - col_append_fstr(pinfo->cinfo, COL_INFO, "%d payload octets", (int)payload_size); + col_append_str(pinfo->cinfo, COL_INFO, "CW:Malformed, "); + } + col_append_fstr(pinfo->cinfo, COL_INFO, "%d payload octets", (int)payload_size); - if (payload_padding != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %d padding", (int)payload_padding); - } + if (payload_padding != 0) + { + col_append_fstr(pinfo->cinfo, COL_INFO, ", %d padding", (int)payload_padding); } { diff --git a/epan/dissectors/packet-pw-satop.c b/epan/dissectors/packet-pw-satop.c index 0e2fa67940..332337e345 100644 --- a/epan/dissectors/packet-pw-satop.c +++ b/epan/dissectors/packet-pw-satop.c @@ -220,27 +220,24 @@ void dissect_pw_satop(tvbuff_t * tvb_original /* fill up columns*/ col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname); - if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + if (properties & PWC_ANYOF_CW_BAD) { - col_clear(pinfo->cinfo, COL_INFO); - if (properties & PWC_ANYOF_CW_BAD) - { - col_append_str(pinfo->cinfo, COL_INFO, "CW:Bad, "); - } + col_append_str(pinfo->cinfo, COL_INFO, "CW:Bad, "); + } - if (properties & PWC_PAY_SIZE_BAD) - { - col_append_str(pinfo->cinfo, COL_INFO, "Payload size:0 (Bad)"); - } - else - { - col_append_fstr(pinfo->cinfo, COL_INFO, "TDM octets:%d", (int)payload_size); - } + if (properties & PWC_PAY_SIZE_BAD) + { + col_append_str(pinfo->cinfo, COL_INFO, "Payload size:0 (Bad)"); + } + else + { + col_append_fstr(pinfo->cinfo, COL_INFO, "TDM octets:%d", (int)payload_size); + } - if (padding_size != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Padding:%d", (int)padding_size); - } + if (padding_size != 0) + { + col_append_fstr(pinfo->cinfo, COL_INFO, ", Padding:%d", (int)padding_size); } diff --git a/epan/dissectors/packet-q2931.c b/epan/dissectors/packet-q2931.c index 1bdd30de3e..34f2909d55 100644 --- a/epan/dissectors/packet-q2931.c +++ b/epan/dissectors/packet-q2931.c @@ -2056,11 +2056,10 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += call_ref_len; } message_type = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(message_type, q2931_message_type_vals, "Unknown message type (0x%02X)")); - } + if (q2931_tree != NULL) proto_tree_add_uint(q2931_tree, hf_q2931_message_type, tvb, offset, 1, message_type); offset += 1; diff --git a/epan/dissectors/packet-q931.c b/epan/dissectors/packet-q931.c index b6ea896ead..6389c367a0 100644 --- a/epan/dissectors/packet-q931.c +++ b/epan/dissectors/packet-q931.c @@ -2626,15 +2626,13 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if(have_valid_q931_pi) { q931_pi->message_type = message_type; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, get_message_name(prot_discr, message_type)); - } - if (q931_tree != NULL){ - if (prot_discr == NLPID_DMS) - proto_tree_add_item(q931_tree, hf_q931_maintenance_message_type, tvb, offset, 1, ENC_BIG_ENDIAN); - else - proto_tree_add_item(q931_tree, hf_q931_message_type, tvb, offset, 1, ENC_BIG_ENDIAN); - } + col_add_str(pinfo->cinfo, COL_INFO, get_message_name(prot_discr, message_type)); + + if (prot_discr == NLPID_DMS) + proto_tree_add_item(q931_tree, hf_q931_maintenance_message_type, tvb, offset, 1, ENC_BIG_ENDIAN); + else + proto_tree_add_item(q931_tree, hf_q931_message_type, tvb, offset, 1, ENC_BIG_ENDIAN); + offset += 1; /* @@ -2662,10 +2660,9 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, first_frag = (tvb_get_guint8(tvb, offset + 2) & 0x80) != 0; more_frags = (tvb_get_guint8(tvb, offset + 2) & 0x7F) != 0; segmented_message_type = tvb_get_guint8(tvb, offset + 3); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " of %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " of %s", val_to_str_ext(segmented_message_type, &q931_message_type_vals_ext, "Unknown message type (0x%02X)")); - } + offset += 1 + 1 + info_element_len; /* Reassembly */ frag_len = tvb_reported_length_remaining(tvb, offset); @@ -2689,10 +2686,10 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { /* only 1 segment */ next_tvb = tvb_new_subset_remaining(tvb, offset); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s [reassembled]", + + col_add_fstr(pinfo->cinfo, COL_INFO, "%s [reassembled]", val_to_str_ext(segmented_message_type, &q931_message_type_vals_ext, "Unknown message type (0x%02X)")); - } + } else { if (tree) proto_tree_add_uint(q931_tree, hf_q931_reassembled_in, tvb, offset, frag_len, fd_head->reassembled_in); } @@ -2938,10 +2935,9 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, if (((codeset << 8) | info_element) == (CS0 | Q931_IE_SEGMENTED_MESSAGE)) { dissect_q931_segmented_message_ie(tvb, offset + 2, info_element_len, ie_tree); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " of %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " of %s", val_to_str_ext(tvb_get_guint8(tvb, offset + 3), &q931_message_type_vals_ext, "Unknown message type (0x%02X)")); - } + if (tvb_get_guint8(tvb, offset + 2) & 0x80) { /* the 1st segment */ first_segment = TRUE; } else { /* not the 1st segment */ diff --git a/epan/dissectors/packet-qllc.c b/epan/dissectors/packet-qllc.c index 3e43cbae74..1c2c32794b 100644 --- a/epan/dissectors/packet-qllc.c +++ b/epan/dissectors/packet-qllc.c @@ -140,15 +140,12 @@ dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { /* Non-ambiguous control field value */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(ctrl, qllc_control_vals, "Control Field: 0x%02x (unknown)")); - } - if (tree) { - proto_tree_add_uint(qllc_tree, hf_qllc_control, tvb, + + proto_tree_add_uint(qllc_tree, hf_qllc_control, tvb, 1, 1, ctrl); - } } /* Do we have an I field ? */ diff --git a/epan/dissectors/packet-quake.c b/epan/dissectors/packet-quake.c index b02574492a..6c368fdeaf 100644 --- a/epan/dissectors/packet-quake.c +++ b/epan/dissectors/packet-quake.c @@ -365,11 +365,9 @@ dissect_quake_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) command = tvb_get_guint8(tvb, 0); direction = (command & 0x80) ? CCREP : CCREQ; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", val_to_str(command,names_control_command, "%u"), val_to_str(direction,names_control_direction,"%u")); - } if (tree) { proto_item *control_item; @@ -475,13 +473,9 @@ dissect_quake(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } sequence = tvb_get_ntohl(tvb, 4); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "seq 0x%x", sequence); - } - if (quake_tree) { - proto_tree_add_uint(quake_tree, hf_quake_header_sequence, + col_add_fstr(pinfo->cinfo, COL_INFO, "seq 0x%x", sequence); + proto_tree_add_uint(quake_tree, hf_quake_header_sequence, tvb, 4, 4, sequence); - } rest_length = tvb_reported_length(tvb) - 8; next_tvb = tvb_new_subset(tvb, 8, rest_length , rest_length); diff --git a/epan/dissectors/packet-quake2.c b/epan/dissectors/packet-quake2.c index 968d1851a0..bcacd1c536 100644 --- a/epan/dissectors/packet-quake2.c +++ b/epan/dissectors/packet-quake2.c @@ -685,8 +685,7 @@ dissect_quake2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) DIR_C2S : DIR_S2C; col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKE2"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(direction, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(direction, names_direction, "%u")); if (tree) { diff --git a/epan/dissectors/packet-quake3.c b/epan/dissectors/packet-quake3.c index 36dad68960..e8bc42be93 100644 --- a/epan/dissectors/packet-quake3.c +++ b/epan/dissectors/packet-quake3.c @@ -501,8 +501,7 @@ dissect_quake3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) val_to_str(direction, names_direction, "%u")); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_str(pinfo->cinfo, COL_INFO, val_to_str(direction, + col_append_str(pinfo->cinfo, COL_INFO, val_to_str(direction, names_direction, "%u")); } diff --git a/epan/dissectors/packet-quakeworld.c b/epan/dissectors/packet-quakeworld.c index dcd1fa4acd..c3213e413b 100644 --- a/epan/dissectors/packet-quakeworld.c +++ b/epan/dissectors/packet-quakeworld.c @@ -532,11 +532,9 @@ dissect_quakeworld_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo, } } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", command); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", command); - if (text_tree && !command_finished) { + if (!command_finished) { proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command, tvb, offset, command_len, command); } @@ -676,8 +674,7 @@ dissect_quakeworld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) DIR_C2S : DIR_S2C; col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKEWORLD"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(direction, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(direction, names_direction, "%u")); if (tree) { diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index d62601dcf7..4d2e935155 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -1386,12 +1386,9 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ rad_info->ident = rh.rh_ident; tap_queue_packet(radius_tap, pinfo, rad_info); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_fstr(pinfo->cinfo,COL_INFO,"%s(%d) (id=%d, l=%d)", + col_add_fstr(pinfo->cinfo,COL_INFO,"%s(%d) (id=%d, l=%d)", val_to_str_ext_const(rh.rh_code, &radius_pkt_type_codes_ext, "Unknown Packet"), rh.rh_code, rh.rh_ident, rh.rh_pktlength); - } if (tree) { @@ -1493,11 +1490,9 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ /* No, so it's a duplicate request. Mark it as such. */ rad_info->is_duplicate = TRUE; rad_info->req_num = radius_call->req_num; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", Duplicate Request ID:%u", rh.rh_ident); - } + if (tree) { proto_item* item; @@ -1632,11 +1627,9 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ { /* No, so it's a duplicate response. Mark it as such. */ rad_info->is_duplicate = TRUE; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", Duplicate Response ID:%u", rh.rh_ident); - } + if (tree) { proto_item* item; diff --git a/epan/dissectors/packet-retix-bpdu.c b/epan/dissectors/packet-retix-bpdu.c index 1c3f3b79c9..6b8a7d7cf5 100644 --- a/epan/dissectors/packet-retix-bpdu.c +++ b/epan/dissectors/packet-retix-bpdu.c @@ -62,10 +62,7 @@ dissect_retix_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "R-STP"); col_clear(pinfo->cinfo, COL_INFO); - if (check_col(pinfo->cinfo, COL_INFO)){ - col_add_fstr(pinfo->cinfo, COL_INFO, "Bridge MAC %s", tvb_ether_to_str(tvb, 10)); - } - + col_add_fstr(pinfo->cinfo, COL_INFO, "Bridge MAC %s", tvb_ether_to_str(tvb, 10)); retix_bpdu_tree = NULL; diff --git a/epan/dissectors/packet-rgmp.c b/epan/dissectors/packet-rgmp.c index 9a5eeb11e8..641a0d44fc 100644 --- a/epan/dissectors/packet-rgmp.c +++ b/epan/dissectors/packet-rgmp.c @@ -79,10 +79,8 @@ dissect_rgmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int off col_clear(pinfo->cinfo, COL_INFO); type = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, rgmp_types, "Unknown Type: 0x%02x")); - } proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type); offset += 1; diff --git a/epan/dissectors/packet-rip.c b/epan/dissectors/packet-rip.c index 0897b236e3..45df9b9d2e 100644 --- a/epan/dissectors/packet-rip.c +++ b/epan/dissectors/packet-rip.c @@ -124,11 +124,9 @@ dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) command = tvb_get_guint8(tvb, 0); version = tvb_get_guint8(tvb, 1); - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_add_str(pinfo->cinfo, COL_PROTOCOL, + col_add_str(pinfo->cinfo, COL_PROTOCOL, val_to_str_const(version, version_vals, "RIP")); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(command, command_vals, "Unknown command (%u)")); if (tree) { diff --git a/epan/dissectors/packet-ripng.c b/epan/dissectors/packet-ripng.c index 3f99ff2b71..c6c1b4170f 100644 --- a/epan/dissectors/packet-ripng.c +++ b/epan/dissectors/packet-ripng.c @@ -66,12 +66,10 @@ dissect_ripng(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti, *rte_ti; col_set_str(pinfo->cinfo, COL_PROTOCOL, "RIPng"); - if (check_col(pinfo->cinfo, COL_INFO)) { col_clear(pinfo->cinfo, COL_INFO); col_add_fstr(pinfo->cinfo, COL_INFO," Command %s, Version %u", val_to_str(tvb_get_guint8(tvb, offset), cmdvals, "Unknown (%u)"), tvb_get_guint8(tvb, offset +1)); - } if (tree) { ti = proto_tree_add_item(tree, proto_ripng, tvb, offset, -1, ENC_NA); diff --git a/epan/dissectors/packet-rlogin.c b/epan/dissectors/packet-rlogin.c index 6a2b217c4e..8332f03096 100644 --- a/epan/dissectors/packet-rlogin.c +++ b/epan/dissectors/packet-rlogin.c @@ -225,11 +225,8 @@ static void rlogin_display(rlogin_hash_entry_t *hash_info, proto_tree_add_item(rlogin_tree, hf_control_message, tvb, urgent_offset, 1, ENC_BIG_ENDIAN); control_byte = tvb_get_guint8(tvb, urgent_offset); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", val_to_str_const(control_byte, control_message_vals, "Unknown")); - } offset = urgent_offset + 1; /* adjust offset */ } @@ -366,11 +363,8 @@ static void rlogin_display(rlogin_hash_entry_t *hash_info, offset += 2; /* Show setting highlights in info column */ - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " (rows=%u, cols=%u)", + col_append_fstr(pinfo->cinfo, COL_INFO, " (rows=%u, cols=%u)", rows, columns); - } } if (tvb_offset_exists(tvb, offset)) @@ -414,63 +408,60 @@ dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "Rlogin"); /* Set info column */ - if (check_col(pinfo->cinfo, COL_INFO)) + /* Show user-name if available */ + if (hash_info->user_name[0]) + { + col_add_fstr(pinfo->cinfo, COL_INFO, + "User name: %s, ", hash_info->user_name); + } + else { - /* Show user-name if available */ - if (hash_info->user_name[0]) + col_clear(pinfo->cinfo, COL_INFO); + } + + /* Work out packet content summary for display */ + length = tvb_length(tvb); + if (length != 0) + { + /* Initial NULL byte represents part of connection handshake */ + if (tvb_get_guint8(tvb, 0) == '\0') { - col_add_fstr(pinfo->cinfo, COL_INFO, - "User name: %s, ", hash_info->user_name); + col_append_str(pinfo->cinfo, COL_INFO, + (pinfo->destport == RLOGIN_PORT) ? + "Start Handshake" : + "Startup info received"); } else + if (tcpinfo->urgent && length >= tcpinfo->urgent_pointer) { - col_clear(pinfo->cinfo, COL_INFO); + /* Urgent pointer inside current data represents a control message */ + col_append_str(pinfo->cinfo, COL_INFO, "Control Message"); } - - /* Work out packet content summary for display */ - length = tvb_length(tvb); - if (length != 0) + else { - /* Initial NULL byte represents part of connection handshake */ - if (tvb_get_guint8(tvb, 0) == '\0') - { - col_append_str(pinfo->cinfo, COL_INFO, - (pinfo->destport == RLOGIN_PORT) ? - "Start Handshake" : - "Startup info received"); - } - else - if (tcpinfo->urgent && length >= tcpinfo->urgent_pointer) + /* Search for 2 consecutive ff bytes + (signifies window change control message) */ + ti_offset = tvb_find_guint8(tvb, 0, -1, 0xff); + if (ti_offset != -1 && + tvb_bytes_exist(tvb, ti_offset + 1, 1) && + tvb_get_guint8(tvb, ti_offset + 1) == 0xff) { - /* Urgent pointer inside current data represents a control message */ - col_append_str(pinfo->cinfo, COL_INFO, "Control Message"); + col_append_str(pinfo->cinfo, COL_INFO, "Terminal Info"); } else { - /* Search for 2 consecutive ff bytes - (signifies window change control message) */ - ti_offset = tvb_find_guint8(tvb, 0, -1, 0xff); - if (ti_offset != -1 && - tvb_bytes_exist(tvb, ti_offset + 1, 1) && - tvb_get_guint8(tvb, ti_offset + 1) == 0xff) + /* Show any text data in the frame */ + int bytes_to_copy = tvb_length(tvb); + if (bytes_to_copy > 128) { - col_append_str(pinfo->cinfo, COL_INFO, "Terminal Info"); - } - else - { - /* Show any text data in the frame */ - int bytes_to_copy = tvb_length(tvb); - if (bytes_to_copy > 128) - { - /* Truncate to 128 bytes for display */ - bytes_to_copy = 128; - } - - /* Add data into info column */ - col_append_fstr(pinfo->cinfo, COL_INFO, - "Data: %s", - tvb_format_text(tvb, 0, bytes_to_copy)); + /* Truncate to 128 bytes for display */ + bytes_to_copy = 128; } + + /* Add data into info column */ + col_append_fstr(pinfo->cinfo, COL_INFO, + "Data: %s", + tvb_format_text(tvb, 0, bytes_to_copy)); } } } diff --git a/epan/dissectors/packet-rmcp.c b/epan/dissectors/packet-rmcp.c index 2cbc28699c..8c8c443b12 100644 --- a/epan/dissectors/packet-rmcp.c +++ b/epan/dissectors/packet-rmcp.c @@ -109,8 +109,7 @@ dissect_rmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ return 0; /* unknown class value */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "RMCP"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s, Class: %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s, Class: %s", val_to_str(type, rmcp_type_vals, "Unknown (0x%02x)"), class_str); diff --git a/epan/dissectors/packet-rmi.c b/epan/dissectors/packet-rmi.c index 23def5bb47..2569bcbfc2 100644 --- a/epan/dissectors/packet-rmi.c +++ b/epan/dissectors/packet-rmi.c @@ -132,7 +132,6 @@ dissect_rmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) rmitype = get_rmi_type(tvb, offset, datalen); - if (check_col(pinfo->cinfo, COL_INFO)) { switch(rmitype) { case RMI_OUTPUTSTREAM: version = tvb_get_ntohs(tvb,4); @@ -169,7 +168,6 @@ dissect_rmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); break; } - } if (tree) { ti = proto_tree_add_item(tree, proto_rmi, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-rmp.c b/epan/dissectors/packet-rmp.c index ccdcbf7f01..82daf8b5dd 100644 --- a/epan/dissectors/packet-rmp.c +++ b/epan/dissectors/packet-rmp.c @@ -110,10 +110,8 @@ dissect_rmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) type = tvb_get_guint8(tvb, 0); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(type, rmp_type_vals, "Unknown Type")); - } if (tree) { ti = proto_tree_add_item(tree, proto_rmp, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-roofnet.c b/epan/dissectors/packet-roofnet.c index 942d31d4b6..fd1fbbd69f 100644 --- a/epan/dissectors/packet-roofnet.c +++ b/epan/dissectors/packet-roofnet.c @@ -199,8 +199,8 @@ static void dissect_roofnet_data(proto_tree *tree, tvbuff_t *tvb, packet_info * */ static void dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item * it= NULL; - proto_tree * roofnet_tree= NULL; + proto_item * it; + proto_tree * roofnet_tree; guint offset= 0; guint8 roofnet_msg_type= 0; @@ -211,15 +211,11 @@ static void dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) roofnet_msg_type = tvb_get_guint8(tvb, ROOFNET_OFFSET_TYPE); /* Clear out stuff in the info column */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %s", val_to_str(roofnet_msg_type, roofnet_pt_vals, "Unknown (%d)")); - } - if (tree) { - it = proto_tree_add_item(tree, proto_roofnet, tvb, offset, -1, ENC_NA); - roofnet_tree = proto_item_add_subtree(it, ett_roofnet); - } + it = proto_tree_add_item(tree, proto_roofnet, tvb, offset, -1, ENC_NA); + roofnet_tree = proto_item_add_subtree(it, ett_roofnet); dissect_roofnet_header(roofnet_tree, tvb, &offset); diff --git a/epan/dissectors/packet-rpcap.c b/epan/dissectors/packet-rpcap.c index c02fcf8d4c..fe6395535f 100644 --- a/epan/dissectors/packet-rpcap.c +++ b/epan/dissectors/packet-rpcap.c @@ -932,10 +932,8 @@ dissect_rpcap (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree) proto_tree_add_item (tree, hf_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - if (check_col (pinfo->cinfo, COL_INFO)) { - col_append_fstr (pinfo->cinfo, COL_INFO, "%s", + col_append_fstr (pinfo->cinfo, COL_INFO, "%s", val_to_str (msg_type, message_type, "Unknown: %d")); - } proto_item_append_text (ti, ", %s", val_to_str (msg_type, message_type, "Unknown: %d")); diff --git a/epan/dissectors/packet-rpl.c b/epan/dissectors/packet-rpl.c index 6238d5b266..ba2cda1c00 100644 --- a/epan/dissectors/packet-rpl.c +++ b/epan/dissectors/packet-rpl.c @@ -275,10 +275,9 @@ dissect_rpl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) rpl_len = tvb_get_ntohs(tvb, 0); rpl_type = tvb_get_ntohs(tvb, 2); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, + col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(rpl_type, rpl_type_vals, "Unknown Type")); - } + if (tree) { ti = proto_tree_add_item(tree, proto_rpl, tvb, 0, rpl_len, ENC_NA); diff --git a/epan/dissectors/packet-rsh.c b/epan/dissectors/packet-rsh.c index 18ee0cd34b..8aee371ca3 100644 --- a/epan/dissectors/packet-rsh.c +++ b/epan/dissectors/packet-rsh.c @@ -204,24 +204,22 @@ dissect_rsh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSH"); - if(check_col(pinfo->cinfo, COL_INFO)){ - /* First, clear the info column */ - col_clear(pinfo->cinfo, COL_INFO); + /* First, clear the info column */ + col_clear(pinfo->cinfo, COL_INFO); - /* Client username */ - if(hash_info->client_username && preference_info_show_client_username == TRUE){ - col_append_fstr(pinfo->cinfo, COL_INFO, "Client username:%s ", hash_info->client_username); - } + /* Client username */ + if(hash_info->client_username && preference_info_show_client_username == TRUE){ + col_append_fstr(pinfo->cinfo, COL_INFO, "Client username:%s ", hash_info->client_username); + } - /* Server username */ - if(hash_info->server_username && preference_info_show_server_username == TRUE){ - col_append_fstr(pinfo->cinfo, COL_INFO, "Server username:%s ", hash_info->server_username); - } + /* Server username */ + if(hash_info->server_username && preference_info_show_server_username == TRUE){ + col_append_fstr(pinfo->cinfo, COL_INFO, "Server username:%s ", hash_info->server_username); + } - /* Command */ - if(hash_info->command && preference_info_show_command == TRUE){ - col_append_fstr(pinfo->cinfo, COL_INFO, "Command:%s ", hash_info->command); - } + /* Command */ + if(hash_info->command && preference_info_show_command == TRUE){ + col_append_fstr(pinfo->cinfo, COL_INFO, "Command:%s ", hash_info->command); } /* create display subtree for the protocol */ diff --git a/epan/dissectors/packet-rtmpt.c b/epan/dissectors/packet-rtmpt.c index e8466a0575..db1a91368a 100644 --- a/epan/dissectors/packet-rtmpt.c +++ b/epan/dissectors/packet-rtmpt.c @@ -1671,9 +1671,9 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTMP"); - RTMPT_DEBUG("Dissect: frame=%u visited=%d len=%d col=%d tree=%p\n", + RTMPT_DEBUG("Dissect: frame=%u visited=%d len=%d tree=%p\n", pinfo->fd->num, pinfo->fd->flags.visited, - tvb_length_remaining(tvb, offset), check_col(pinfo->cinfo, COL_INFO), tree); + tvb_length_remaining(tvb, offset), tree); /* Clear any previous data in Info column (RTMP packets are protected by a "fence") */ col_clear(pinfo->cinfo, COL_INFO); @@ -1713,25 +1713,22 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t } } - if ((check_col(pinfo->cinfo, COL_INFO) || tree) && tp->id<=RTMPT_ID_MAX) + if (tree && tp->id<=RTMPT_ID_MAX) { sDesc = rtmpt_get_packet_desc(tvb, iBodyOffset, iBodyRemain, rconv, cdir, tp, &deschasopcode); } - if (check_col(pinfo->cinfo, COL_INFO)) - { - if (tp->id>RTMPT_ID_MAX) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s", - val_to_str(tp->id, rtmpt_handshake_vals, "Unknown (0x%01x)")); - col_set_fence(pinfo->cinfo, COL_INFO); - } else if (sDesc) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s", sDesc); - col_set_fence(pinfo->cinfo, COL_INFO); - } else { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s", - val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)")); - col_set_fence(pinfo->cinfo, COL_INFO); - } + if (tp->id>RTMPT_ID_MAX) { + col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s", + val_to_str(tp->id, rtmpt_handshake_vals, "Unknown (0x%01x)")); + col_set_fence(pinfo->cinfo, COL_INFO); + } else if (sDesc) { + col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s", sDesc); + col_set_fence(pinfo->cinfo, COL_INFO); + } else { + col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s", + val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)")); + col_set_fence(pinfo->cinfo, COL_INFO); } if (tree) diff --git a/epan/dissectors/packet-rtnet.c b/epan/dissectors/packet-rtnet.c index 84fcf2aa6b..5400862fc4 100644 --- a/epan/dissectors/packet-rtnet.c +++ b/epan/dissectors/packet-rtnet.c @@ -398,10 +398,8 @@ dissect_rtnet_tdma_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDMA-V1"); /* set the info column */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(msg, tdma_v1_msg_vals, "Unknown (0x%04x)")); - } if (root) { ti = proto_tree_add_item(root, proto_tdma, tvb, 0, -1, ENC_NA); @@ -515,10 +513,8 @@ dissect_rtnet_tdma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDMA"); /* Set the info column */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(msg, tdma_msg_vals, "Unknown (0x%04x)")); - } if (root) { ti = proto_tree_add_item(root, proto_tdma, tvb, 0, -1, ENC_NA); @@ -590,10 +586,8 @@ dissect_rtmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTmac"); /* set the info column */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_clear(pinfo->cinfo,COL_INFO); - col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown (0x%04x)",type); - } + col_clear(pinfo->cinfo,COL_INFO); + col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown (0x%04x)",type); if (rtmac_tree) { if (ver == 1) { @@ -682,10 +676,8 @@ dissect_rtcfg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { vers_id = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(vers_id, rtcfg_msg_vals, "Unknown (0x%04x)")); - } if( rtcfg_tree ) { diff --git a/epan/dissectors/packet-rtp-events.c b/epan/dissectors/packet-rtp-events.c index 70b8d7b583..62f28a5312 100644 --- a/epan/dissectors/packet-rtp-events.c +++ b/epan/dissectors/packet-rtp-events.c @@ -106,12 +106,9 @@ dissect_rtp_events( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) rtp_event_info.info_setup_frame_num = 0; - if ( check_col( pinfo->cinfo, COL_INFO) ) - { - col_add_fstr( pinfo->cinfo, COL_INFO, - "Payload type=RTP Event, %s", - val_to_str( rtp_evt, rtp_event_type_values, "Unknown (%u)" )); - } + col_add_fstr( pinfo->cinfo, COL_INFO, + "Payload type=RTP Event, %s", + val_to_str( rtp_evt, rtp_event_type_values, "Unknown (%u)" )); ti = proto_tree_add_item( tree, proto_rtp_events, tvb, offset, -1, ENC_NA ); rtp_events_tree = proto_item_add_subtree( ti, ett_rtp_events ); diff --git a/epan/dissectors/packet-rtse.c b/epan/dissectors/packet-rtse.c index 5c45daff92..35c33c9e9f 100644 --- a/epan/dissectors/packet-rtse.c +++ b/epan/dissectors/packet-rtse.c @@ -819,8 +819,7 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) fragment_length = tvb_length_remaining (tvb, offset); } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "[RTSE fragment, %u byte%s]", + col_append_fstr(pinfo->cinfo, COL_INFO, "[RTSE fragment, %u byte%s]", fragment_length, plurality(fragment_length, "", "s")); } else if (rtse_reassemble && session->spdu_type == SES_MAJOR_SYNC_POINT) { if (next_tvb) { diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index f6ccb39035..f669c3a21f 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -343,8 +343,7 @@ dissect_rtspinterleaved(tvbuff_t *tvb, int offset, packet_info *pinfo, } } - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Interleaved channel 0x%02x, %u bytes", rf_chan, rf_len); @@ -795,32 +794,29 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, } col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTSP"); - if (check_col(pinfo->cinfo, COL_INFO)) { - /* - * Put the first line from the buffer into the summary - * if it's an RTSP request or reply (but leave out the - * line terminator). - * Otherwise, just call it a continuation. - * - * Note that "tvb_find_line_end()" will return a value that - * is not longer than what's in the buffer, so the - * "tvb_get_ptr()" call won't throw an exception. - */ - if (is_request_or_reply) - if ( rtsp_type == RTSP_REPLY ) { - col_set_str(pinfo->cinfo, COL_INFO, "Reply: "); - col_append_str(pinfo->cinfo, COL_INFO, - format_text(line, first_linelen)); - } - else { - col_add_str(pinfo->cinfo, COL_INFO, - format_text(line, first_linelen)); - } - - else - col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); + /* + * Put the first line from the buffer into the summary + * if it's an RTSP request or reply (but leave out the + * line terminator). + * Otherwise, just call it a continuation. + * + * Note that "tvb_find_line_end()" will return a value that + * is not longer than what's in the buffer, so the + * "tvb_get_ptr()" call won't throw an exception. + */ + if (is_request_or_reply) + if ( rtsp_type == RTSP_REPLY ) { + col_set_str(pinfo->cinfo, COL_INFO, "Reply: "); + col_append_str(pinfo->cinfo, COL_INFO, + format_text(line, first_linelen)); + } + else { + col_add_str(pinfo->cinfo, COL_INFO, + format_text(line, first_linelen)); + } - } + else + col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); orig_offset = offset; if (tree) { diff --git a/epan/dissectors/packet-rx.c b/epan/dissectors/packet-rx.c index dd46df520a..44cdb7d990 100644 --- a/epan/dissectors/packet-rx.c +++ b/epan/dissectors/packet-rx.c @@ -196,8 +196,7 @@ dissect_rx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, guint32 version, tl; int old_offset=offset; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "RESPONSE " "Seq: %lu " "Call: %lu " @@ -208,7 +207,6 @@ dissect_rx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, get_udp_port(pinfo->srcport), get_udp_port(pinfo->destport) ); - } item = proto_tree_add_item(parent_tree, hf_rx_response, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_rx_response); @@ -251,8 +249,7 @@ dissect_rx_abort(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int proto_item *item; int old_offset=offset; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "ABORT " "Seq: %lu " "Call: %lu " @@ -263,7 +260,6 @@ dissect_rx_abort(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int get_udp_port(pinfo->srcport), get_udp_port(pinfo->destport) ); - } item = proto_tree_add_item(parent_tree, hf_rx_abort, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_rx_abort); @@ -285,8 +281,7 @@ dissect_rx_challenge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, guint32 version; int old_offset=offset; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "CHALLENGE " "Seq: %lu " "Call: %lu " @@ -297,7 +292,6 @@ dissect_rx_challenge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, get_udp_port(pinfo->srcport), get_udp_port(pinfo->destport) ); - } item = proto_tree_add_item(parent_tree, hf_rx_challenge, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_rx_challenge); @@ -327,8 +321,7 @@ dissect_rx_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int guint8 num; int old_offset = offset; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "ACK " "Seq: %lu " "Call: %lu " @@ -339,7 +332,6 @@ dissect_rx_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int get_udp_port(pinfo->srcport), get_udp_port(pinfo->destport) ); - } item = proto_tree_add_item(parent_tree, hf_rx_ack, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_rx_ack); @@ -550,8 +542,7 @@ dissect_rx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *dat break; case RX_PACKET_TYPE_ACKALL: /* does not contain any payload */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "ACKALL " "Seq: %lu " "Call: %lu " @@ -562,7 +553,6 @@ dissect_rx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *dat get_udp_port(pinfo->srcport), get_udp_port(pinfo->destport) ); - } break; case RX_PACKET_TYPE_CHALLENGE: dissect_rx_challenge(tvb, pinfo, tree, offset, seq, callnumber); diff --git a/epan/dissectors/packet-s5066.c b/epan/dissectors/packet-s5066.c index a70f89469d..fc165cf693 100644 --- a/epan/dissectors/packet-s5066.c +++ b/epan/dissectors/packet-s5066.c @@ -1299,9 +1299,7 @@ dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "S5066"); /* Clear out stuff in the info column, the add PDU type */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "PDU type %s", val_to_str(pdu_type, s5066_pdu_type, "Unknown (0x%02x)")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "PDU type %s", val_to_str(pdu_type, s5066_pdu_type, "Unknown (0x%02x)")); if (tree) { /* We are being asked for details */ proto_tree *s5066_tree = NULL; diff --git a/epan/dissectors/packet-sap.c b/epan/dissectors/packet-sap.c index ca8f1c7d6b..fb98c0c29b 100644 --- a/epan/dissectors/packet-sap.c +++ b/epan/dissectors/packet-sap.c @@ -137,10 +137,8 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) sap_version = (vers_flags&MCAST_SAP_VERSION_MASK)>>MCAST_SAP_VERSION_SHIFT; addr_len = (is_ipv6) ? (int)sizeof(struct e_in6_addr) : 4; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s (v%u)", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s (v%u)", (is_del) ? "Deletion" : "Announcement", sap_version); - } if (tree) { si = proto_tree_add_item(tree, proto_sap, tvb, offset, -1, ENC_NA); diff --git a/epan/dissectors/packet-sbus.c b/epan/dissectors/packet-sbus.c index 7861224186..f67276a507 100644 --- a/epan/dissectors/packet-sbus.c +++ b/epan/dissectors/packet-sbus.c @@ -750,138 +750,136 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ col_clear(pinfo->cinfo, COL_INFO); offset = 0; - if (check_col(pinfo->cinfo, COL_INFO)) { - switch (sbus_attribut){ - case SBUS_REQUEST: - sbus_cmd_code = tvb_get_guint8(tvb,10); - switch (sbus_cmd_code){ - case SBUS_WEB_SERVER_SERIAL_COMM: - /* Special treatment of web server request - * as is is very helpful to see more information in the packetlist */ - sbus_web_aid = tvb_get_guint8(tvb,12); - sbus_web_seq = tvb_get_guint8(tvb,13); - col_add_fstr(pinfo->cinfo, COL_INFO, - "Web Server Request: %s (Seq No: %d)", - val_to_str_const(sbus_web_aid, - webserver_aid_vals, "Unknown Request!"), - sbus_web_seq); - break; - case SBUS_RD_WR_PCD_BLOCK: - sbus_rdwr_type = tvb_get_guint8(tvb, 12); - col_add_fstr( pinfo->cinfo, COL_INFO, - "Request: %s", val_to_str_const( sbus_rdwr_type, rdwrblock_vals, - "This RD/WR block telegram is not implemented")); - /* Add name of file to be written in case of start of file stream */ - if (sbus_rdwr_type == SBUS_WR_START_OF_STREAM) { - sbus_rdwr_block_type = tvb_get_guint8(tvb, 14); - if ((sbus_rdwr_block_type == SBUS_RD_WR_CONFIGURATION_FILE) || - (sbus_rdwr_block_type == SBUS_RD_WR_PROGRAM_BLOCK_FILE)) { - sbus_quint8_helper0=0; - for (i=19; i<43; i++) { /*max length is 24 chars*/ - /*find zero-termination of string*/ - if ((tvb_get_guint8(tvb, i)) == 0x00) { - break; - } - sbus_quint8_helper0 += 1; + switch (sbus_attribut){ + case SBUS_REQUEST: + sbus_cmd_code = tvb_get_guint8(tvb,10); + switch (sbus_cmd_code){ + case SBUS_WEB_SERVER_SERIAL_COMM: + /* Special treatment of web server request + * as is is very helpful to see more information in the packetlist */ + sbus_web_aid = tvb_get_guint8(tvb,12); + sbus_web_seq = tvb_get_guint8(tvb,13); + col_add_fstr(pinfo->cinfo, COL_INFO, + "Web Server Request: %s (Seq No: %d)", + val_to_str_const(sbus_web_aid, + webserver_aid_vals, "Unknown Request!"), + sbus_web_seq); + break; + case SBUS_RD_WR_PCD_BLOCK: + sbus_rdwr_type = tvb_get_guint8(tvb, 12); + col_add_fstr( pinfo->cinfo, COL_INFO, + "Request: %s", val_to_str_const( sbus_rdwr_type, rdwrblock_vals, + "This RD/WR block telegram is not implemented")); + /* Add name of file to be written in case of start of file stream */ + if (sbus_rdwr_type == SBUS_WR_START_OF_STREAM) { + sbus_rdwr_block_type = tvb_get_guint8(tvb, 14); + if ((sbus_rdwr_block_type == SBUS_RD_WR_CONFIGURATION_FILE) || + (sbus_rdwr_block_type == SBUS_RD_WR_PROGRAM_BLOCK_FILE)) { + sbus_quint8_helper0=0; + for (i=19; i<43; i++) { /*max length is 24 chars*/ + /*find zero-termination of string*/ + if ((tvb_get_guint8(tvb, i)) == 0x00) { + break; } - tmp_string = tvb_get_ephemeral_string(tvb , 19, - sbus_quint8_helper0); - col_append_fstr(pinfo->cinfo, COL_INFO, - ": (File: %s)", tmp_string); - } - } else if (sbus_rdwr_type == SBUS_RD_BLOCK_START_OF_STREAM) { - sbus_rdwr_block_type = tvb_get_guint8(tvb, 14); - if ((sbus_rdwr_block_type == SBUS_RD_WR_CONFIGURATION_FILE) || - (sbus_rdwr_block_type == SBUS_RD_WR_PROGRAM_BLOCK_FILE)) { - sbus_quint8_helper0=0; - for (i=15; i<39; i++) { /*max length is 24 chars*/ - /*find zero-termination of string*/ - if ((tvb_get_guint8(tvb, i)) == 0x00) { - break; - } - sbus_quint8_helper0 += 1; + sbus_quint8_helper0 += 1; + } + tmp_string = tvb_get_ephemeral_string(tvb , 19, + sbus_quint8_helper0); + col_append_fstr(pinfo->cinfo, COL_INFO, + ": (File: %s)", tmp_string); + } + } else if (sbus_rdwr_type == SBUS_RD_BLOCK_START_OF_STREAM) { + sbus_rdwr_block_type = tvb_get_guint8(tvb, 14); + if ((sbus_rdwr_block_type == SBUS_RD_WR_CONFIGURATION_FILE) || + (sbus_rdwr_block_type == SBUS_RD_WR_PROGRAM_BLOCK_FILE)) { + sbus_quint8_helper0=0; + for (i=15; i<39; i++) { /*max length is 24 chars*/ + /*find zero-termination of string*/ + if ((tvb_get_guint8(tvb, i)) == 0x00) { + break; } - tmp_string = tvb_get_ephemeral_string(tvb , 15, - sbus_quint8_helper0); - col_append_fstr(pinfo->cinfo, COL_INFO, - ": (File: %s)", tmp_string); - } - } + sbus_quint8_helper0 += 1; + } + tmp_string = tvb_get_ephemeral_string(tvb , 15, + sbus_quint8_helper0); + col_append_fstr(pinfo->cinfo, COL_INFO, + ": (File: %s)", tmp_string); + } + } - break; + break; - default: - /* All other requests */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "Request: %s", val_to_str_const(sbus_cmd_code, - sbus_command_vals, "Unknown Command!")); - break; + default: + /* All other requests */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "Request: %s", val_to_str_const(sbus_cmd_code, + sbus_command_vals, "Unknown Command!")); + break; + } + /*mark retries*/ + if (request_val->retry_count>0) { + col_append_str(pinfo->cinfo, COL_INFO, + " (Retry)"); + } /*no retry number as it is not always correctly calculated*/ + break; + + case SBUS_RESPONSE: + /* Special treatment of web server request + * as is is very helpful to see more information in the packetlist */ + if (request_val && ((request_val->cmd_code) == SBUS_WEB_SERVER_SERIAL_COMM)) { + sbus_web_size = tvb_get_guint8(tvb,9); + sbus_web_aid = tvb_get_guint8(tvb,10); + col_add_fstr(pinfo->cinfo, COL_INFO, + "Response: %s", + val_to_str_const(sbus_web_aid, + webserver_aid_vals, "Unknown Request!")); + if (sbus_web_size > 1) { + sbus_web_seq = tvb_get_guint8(tvb,11); + col_append_fstr(pinfo->cinfo, COL_INFO, + " (Seq No: %d)", + sbus_web_seq); } - /*mark retries*/ - if (request_val->retry_count>0) { - col_append_str(pinfo->cinfo, COL_INFO, - " (Retry)"); - } /*no retry number as it is not always correctly calculated*/ - break; - - case SBUS_RESPONSE: - /* Special treatment of web server request - * as is is very helpful to see more information in the packetlist */ - if (request_val && ((request_val->cmd_code) == SBUS_WEB_SERVER_SERIAL_COMM)) { - sbus_web_size = tvb_get_guint8(tvb,9); - sbus_web_aid = tvb_get_guint8(tvb,10); - col_add_fstr(pinfo->cinfo, COL_INFO, - "Response: %s", - val_to_str_const(sbus_web_aid, - webserver_aid_vals, "Unknown Request!")); - if (sbus_web_size > 1) { - sbus_web_seq = tvb_get_guint8(tvb,11); - col_append_fstr(pinfo->cinfo, COL_INFO, - " (Seq No: %d)", - sbus_web_seq); - } - } else if (request_val && ((request_val->cmd_code) == SBUS_RD_WR_PCD_BLOCK)) { - /* Treat the ACK/NAK telgrams in a special way*/ - switch (request_val->block_tlg) { - case SBUS_WR_START_OF_STREAM: - case SBUS_WR_BLOCK_DATA_STREAM: - case SBUS_WR_BLOCK_END_OF_STREAM: - case SBUS_WR_ABORT_BLOCK_STREAM: - case SBUS_WR_BLOCK_DATA_BYTES: - case SBUS_DELETE_BLOCK: - case SBUS_RD_ABORT_BLOCK_STREAM: - sbus_rdwr_ack_nak = tvb_get_guint8(tvb, 10); - col_add_fstr( pinfo->cinfo, COL_INFO, - "Response: %s", val_to_str_const(sbus_rdwr_ack_nak, - rdwrblock_sts, "Unknown response!")); - break; - default: - sbus_rdwr_type = tvb_get_guint8(tvb, 9); - col_add_fstr( pinfo->cinfo, COL_INFO, - "Response: (%d byte)", sbus_rdwr_type); - break; - } - - } else { - col_set_str(pinfo->cinfo, COL_INFO, "Response"); + } else if (request_val && ((request_val->cmd_code) == SBUS_RD_WR_PCD_BLOCK)) { + /* Treat the ACK/NAK telgrams in a special way*/ + switch (request_val->block_tlg) { + case SBUS_WR_START_OF_STREAM: + case SBUS_WR_BLOCK_DATA_STREAM: + case SBUS_WR_BLOCK_END_OF_STREAM: + case SBUS_WR_ABORT_BLOCK_STREAM: + case SBUS_WR_BLOCK_DATA_BYTES: + case SBUS_DELETE_BLOCK: + case SBUS_RD_ABORT_BLOCK_STREAM: + sbus_rdwr_ack_nak = tvb_get_guint8(tvb, 10); + col_add_fstr( pinfo->cinfo, COL_INFO, + "Response: %s", val_to_str_const(sbus_rdwr_ack_nak, + rdwrblock_sts, "Unknown response!")); + break; + default: + sbus_rdwr_type = tvb_get_guint8(tvb, 9); + col_add_fstr( pinfo->cinfo, COL_INFO, + "Response: (%d byte)", sbus_rdwr_type); + break; } - break; - - case SBUS_ACKNAK: - sbus_ack_code = tvb_get_ntohs(tvb,9); - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s", val_to_str_const(sbus_ack_code, - sbus_ack_nak_vals, - "Unknown NAK response code!")); - break; - - default: - col_set_str(pinfo->cinfo, COL_INFO, "Unknown attribute"); - break; - } + } else { + col_set_str(pinfo->cinfo, COL_INFO, "Response"); + } + break; + + case SBUS_ACKNAK: + sbus_ack_code = tvb_get_ntohs(tvb,9); + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s", val_to_str_const(sbus_ack_code, + sbus_ack_nak_vals, + "Unknown NAK response code!")); + break; + + default: + col_set_str(pinfo->cinfo, COL_INFO, "Unknown attribute"); + break; } + /* create display subtree for the protocol */ if (tree) { diff --git a/epan/dissectors/packet-scriptingservice.c b/epan/dissectors/packet-scriptingservice.c index 2af1000b56..4340a1c439 100644 --- a/epan/dissectors/packet-scriptingservice.c +++ b/epan/dissectors/packet-scriptingservice.c @@ -118,9 +118,8 @@ dissect_ssprotocol_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree guint total_length; type = tvb_get_guint8(message_tvb, MESSAGE_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(type, message_type_values, "Unknown SSP type: %u")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(type, message_type_values, "Unknown SSP type: %u")); + proto_tree_add_item(ssprotocol_tree, hf_message_type, message_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, ENC_BIG_ENDIAN); flags_item = proto_tree_add_item(ssprotocol_tree, hf_message_flags, message_tvb, MESSAGE_FLAGS_OFFSET, MESSAGE_FLAGS_LENGTH, ENC_BIG_ENDIAN); proto_tree_add_item(ssprotocol_tree, hf_message_length, message_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c index 2e566bbf39..2463001bbd 100644 --- a/epan/dissectors/packet-scsi-osd.c +++ b/epan/dissectors/packet-scsi-osd.c @@ -2672,10 +2672,9 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset+=2; - if(check_col(pinfo->cinfo, COL_INFO)){ - col_append_str(pinfo->cinfo, COL_INFO, + col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Serviceaction")); - } + dissector=find_svcaction_dissector(svcaction); if(dissector){ (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata, conv_info, lun_info); @@ -2690,10 +2689,9 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_osd_extra_data_t *extra_data=(scsi_osd_extra_data_t *)cdata->itlq->extra_data; svcaction=extra_data->svcaction; } - if(check_col(pinfo->cinfo, COL_INFO)){ - col_append_str(pinfo->cinfo, COL_INFO, + col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Serviceaction")); - } + if(svcaction){ proto_item *it; it=proto_tree_add_uint_format(tree, hf_scsi_osd_svcaction, tvb, 0, 0, svcaction, "Service Action: 0x%04x", svcaction); diff --git a/epan/dissectors/packet-scsi-sbc.c b/epan/dissectors/packet-scsi-sbc.c index 4e45b775e6..3cb97d91e8 100644 --- a/epan/dissectors/packet-scsi-sbc.c +++ b/epan/dissectors/packet-scsi-sbc.c @@ -224,8 +224,7 @@ dissect_sbc_read6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)", + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)", tvb_get_ntoh24 (tvb, offset), tvb_get_guint8 (tvb, offset+3)); } @@ -244,10 +243,9 @@ dissect_sbc_write6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)", - tvb_get_ntoh24 (tvb, offset), - tvb_get_guint8 (tvb, offset+3)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)", + tvb_get_ntoh24 (tvb, offset), + tvb_get_guint8 (tvb, offset+3)); } if (tree && isreq && iscdb) { @@ -270,10 +268,9 @@ dissect_sbc_prefetch10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -300,10 +297,9 @@ dissect_sbc_synchronizecache10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -330,10 +326,9 @@ dissect_sbc_synchronizecache16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", - tvb_get_ntoh64 (tvb, offset+1), - tvb_get_ntohl (tvb, offset+9)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (tree && isreq && iscdb) { @@ -359,10 +354,9 @@ dissect_sbc_prefetch16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", - tvb_get_ntoh64 (tvb, offset+1), - tvb_get_ntohl (tvb, offset+9)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (tree && isreq && iscdb) { @@ -391,10 +385,9 @@ dissect_sbc_read10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -420,10 +413,9 @@ dissect_sbc_xdread10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -453,10 +445,9 @@ dissect_sbc_xdwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -487,10 +478,9 @@ dissect_sbc_xdwriteread10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -519,10 +509,9 @@ dissect_sbc_xpwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -551,10 +540,9 @@ dissect_sbc_write10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -582,10 +570,9 @@ dissect_sbc_read12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohl (tvb, offset+5)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohl (tvb, offset+5)); } if (tree && isreq && iscdb) { @@ -613,10 +600,9 @@ dissect_sbc_write12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohl (tvb, offset+5)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohl (tvb, offset+5)); } if (tree && isreq && iscdb) { @@ -644,10 +630,9 @@ dissect_sbc_read16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", - tvb_get_ntoh64 (tvb, offset+1), - tvb_get_ntohl (tvb, offset+9)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (tree && isreq && iscdb) { @@ -674,10 +659,9 @@ dissect_sbc_write16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", - tvb_get_ntoh64 (tvb, offset+1), - tvb_get_ntohl (tvb, offset+9)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (tree && isreq && iscdb) { @@ -705,10 +689,9 @@ dissect_sbc_orwrite (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", - tvb_get_ntoh64 (tvb, offset+1), - tvb_get_ntohl (tvb, offset+9)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (tree && isreq && iscdb) { @@ -736,10 +719,9 @@ dissect_sbc_comparenwrite (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", - tvb_get_ntoh64 (tvb, offset+1), - tvb_get_ntohl (tvb, offset+9)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (tree && isreq && iscdb) { @@ -826,10 +808,9 @@ dissect_sbc_verify10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -857,10 +838,9 @@ dissect_sbc_verify12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohl (tvb, offset+5)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohl (tvb, offset+5)); } if (isreq && iscdb) { @@ -888,10 +868,9 @@ dissect_sbc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", - tvb_get_ntoh64 (tvb, offset+1), - tvb_get_ntohl (tvb, offset+9)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (isreq && iscdb) { @@ -921,10 +900,9 @@ dissect_sbc_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohs (tvb, offset+6)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { @@ -952,10 +930,9 @@ dissect_sbc_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+1), - tvb_get_ntohl (tvb, offset+5)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohl (tvb, offset+5)); } if (tree && isreq && iscdb) { @@ -983,10 +960,9 @@ dissect_sbc_wrverify16 (tvbuff_t *tvb, packet_info *pinfo _U_, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", - tvb_get_ntoh64 (tvb, offset+1), - tvb_get_ntohl (tvb, offset+9)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)", + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (tree && isreq && iscdb) { diff --git a/epan/dissectors/packet-scsi-ssc.c b/epan/dissectors/packet-scsi-ssc.c index ef1a5a27fa..f3944be948 100644 --- a/epan/dissectors/packet-scsi-ssc.c +++ b/epan/dissectors/packet-scsi-ssc.c @@ -108,9 +108,8 @@ dissect_ssc_read6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -134,9 +133,8 @@ dissect_ssc_recoverbuffereddata (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -160,9 +158,8 @@ dissect_ssc_reportdensitysupport (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if(!tree) @@ -192,9 +189,8 @@ dissect_ssc_readreverse6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -218,9 +214,8 @@ dissect_ssc_read16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -247,9 +242,8 @@ dissect_ssc_write16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -276,9 +270,8 @@ dissect_ssc_writefilemarks16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -305,9 +298,8 @@ dissect_ssc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -334,9 +326,8 @@ dissect_ssc_verify6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -361,9 +352,8 @@ dissect_ssc_readreverse16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -388,9 +378,8 @@ dissect_ssc_write6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -413,9 +402,8 @@ dissect_ssc_writefilemarks6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * }; if (isreq) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", - tvb_get_ntoh24 (tvb, offset+1)); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)", + tvb_get_ntoh24 (tvb, offset+1)); } if (tree && isreq && iscdb) { @@ -445,9 +433,8 @@ dissect_ssc_loadunload (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Immed: %u)", - tvb_get_guint8 (tvb, offset) & 0x01); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Immed: %u)", + tvb_get_guint8 (tvb, offset) & 0x01); } if (!tree) @@ -505,9 +492,8 @@ dissect_ssc_rewind (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, return; if (isreq && iscdb) { - if (check_col (pinfo->cinfo, COL_INFO)) - col_append_fstr (pinfo->cinfo, COL_INFO, "(Immed: %u)", - tvb_get_guint8 (tvb, offset) & 0x01); + col_append_fstr (pinfo->cinfo, COL_INFO, "(Immed: %u)", + tvb_get_guint8 (tvb, offset) & 0x01); proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags, ett_scsi_read6, rewind_fields, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, -- cgit v1.2.3