diff options
72 files changed, 719 insertions, 1125 deletions
diff --git a/epan/dissectors/packet-enrp.c b/epan/dissectors/packet-enrp.c index 82f15d5797..132721324d 100644 --- a/epan/dissectors/packet-enrp.c +++ b/epan/dissectors/packet-enrp.c @@ -942,7 +942,7 @@ dissect_enrp_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *enrp type = tvb_get_guint8(message_tvb, MESSAGE_TYPE_OFFSET); /* pinfo is NULL only if dissect_enrp_message is called via dissect_error_cause */ - if (pinfo && (check_col(pinfo->cinfo, COL_INFO))) + if (pinfo) col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(type, message_type_values, "Unknown ENRP Type")); if (enrp_tree) { diff --git a/epan/dissectors/packet-hci_h1.c b/epan/dissectors/packet-hci_h1.c index d5f9dc1239..cd61094f04 100644 --- a/epan/dissectors/packet-hci_h1.c +++ b/epan/dissectors/packet-hci_h1.c @@ -95,19 +95,17 @@ dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Unknown 0x%02x")); } - if(check_col(pinfo->cinfo, COL_INFO)){ - if(pinfo->p2p_dir == P2P_DIR_SENT || - pinfo->p2p_dir == P2P_DIR_RECV) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", - val_to_str(pinfo->p2p_dir, - hci_h1_direction_vals, "Unknown: %d"), + if(pinfo->p2p_dir == P2P_DIR_SENT || + pinfo->p2p_dir == P2P_DIR_RECV) + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", + val_to_str(pinfo->p2p_dir, + hci_h1_direction_vals, "Unknown: %d"), val_to_str(type, hci_h1_type_vals, - "Unknown 0x%02x")); - else - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", - val_to_str(type, hci_h1_type_vals, - "Unknown 0x%02x")); - } + "Unknown 0x%02x")); + else + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", + val_to_str(type, hci_h1_type_vals, + "Unknown 0x%02x")); pd_save = pinfo->private_data; hci_data = wmem_new(wmem_packet_scope(),hci_data_t); diff --git a/epan/dissectors/packet-isis-snp.c b/epan/dissectors/packet-isis-snp.c index 08c0edeef7..9f2f45fc3a 100644 --- a/epan/dissectors/packet-isis-snp.c +++ b/epan/dissectors/packet-isis-snp.c @@ -294,32 +294,25 @@ isis_dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int "Source-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length+1), id_length+1 ) ); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length+1), id_length+1 ) ); - } + offset += id_length + 1; - if (tree) { - proto_tree_add_text(csnp_tree, tvb, offset, id_length + 2, - "Start LSP-ID: %s", - print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) ); - } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP-ID: %s", + proto_tree_add_text(csnp_tree, tvb, offset, id_length + 2, "Start LSP-ID: %s", + print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) ); + + col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) ); - } + offset += id_length + 2; - if (tree) { - proto_tree_add_text(csnp_tree, tvb, offset, id_length + 2, - "End LSP-ID: %s", - print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) ); - } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP-ID: %s", + proto_tree_add_text(csnp_tree, tvb, offset, id_length + 2, "End LSP-ID: %s", + print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) ); + + col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) ); - } + offset += id_length + 2; len = pdu_length - header_length; @@ -378,15 +371,12 @@ isis_dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int } offset += 2; - if (tree) { - proto_tree_add_text(psnp_tree, tvb, offset, id_length + 1, - "Source-ID: %s", + proto_tree_add_text(psnp_tree, tvb, offset, id_length + 1, "Source-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length+1), id_length + 1 ) ); - } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", + + col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length+1), id_length+1 ) ); - } + offset += id_length + 1; len = pdu_length - header_length; diff --git a/epan/dissectors/packet-ismacryp.c b/epan/dissectors/packet-ismacryp.c index aee049fb21..502d11a159 100644 --- a/epan/dissectors/packet-ismacryp.c +++ b/epan/dissectors/packet-ismacryp.c @@ -258,26 +258,20 @@ static void dissect_ismacryp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tre } if (set_version == V11){ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_11); + col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_11); /* display mode */ if (pref_user_mode == FALSE){ - if (check_col( pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",val_to_str_const(mode, modetypenames, "user mode")); - } - if (pref_user_mode == TRUE){ - if ( check_col( pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s","user mode"); + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",val_to_str_const(mode, modetypenames, "user mode")); + } else { + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s","user mode"); } user_mode = pref_user_mode; } if (set_version == V20){ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_20); + col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_20); user_mode = TRUE; /* display mode */ - if (check_col( pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s","user mode"); + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s","user mode"); } /* select correct AU values depending on version & selected mode in preferences menu if not in user_mode */ if (user_mode == TRUE){ /* use values set in preference menu */ @@ -573,10 +567,9 @@ static offset_struct* dissect_auheader( tvbuff_t *tvb, offset_struct *poffset, p { ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_iv, tvb, poffset->offset_bytes, iv_length, ENC_NA); proto_item_append_text(ismacryp_item, ": Length=%d bytes",iv_length); /* add IV info */ - if ( check_col( pinfo->cinfo, COL_INFO) ) { - col_append_fstr( pinfo->cinfo, COL_INFO, + col_append_fstr( pinfo->cinfo, COL_INFO, ", IV=0x%s", tvb_bytes_to_str_punct(tvb, poffset->offset_bytes, iv_length,' ')); - } + poffset->offset_bytes+=iv_length; /* add IV length to offset_bytes */ } /*Delta IV */ @@ -585,10 +578,8 @@ static offset_struct* dissect_auheader( tvbuff_t *tvb, offset_struct *poffset, p ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_delta_iv, tvb, poffset->offset_bytes, delta_iv_length, ENC_NA); proto_item_append_text(ismacryp_item, ": Length=%d bytes",delta_iv_length); /* add delta IV info */ - if ( check_col( pinfo->cinfo, COL_INFO) ) { - col_append_fstr( pinfo->cinfo, COL_INFO, + col_append_fstr( pinfo->cinfo, COL_INFO, ", Delta IV=0x%s", tvb_bytes_to_str_punct(tvb, poffset->offset_bytes, delta_iv_length,' ')); - } poffset->offset_bytes+=iv_length; /* add IV length to offset_bytes */ } /* Key Indicator */ @@ -598,10 +589,8 @@ static offset_struct* dissect_auheader( tvbuff_t *tvb, offset_struct *poffset, p ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_key_indicator, tvb, poffset->offset_bytes, key_indicator_length, ENC_NA); proto_item_append_text(ismacryp_item,": Length=%d bytes",key_indicator_length); /* add KI info */ - if ( check_col( pinfo->cinfo, COL_INFO) ) { - col_append_fstr( pinfo->cinfo, COL_INFO, + col_append_fstr( pinfo->cinfo, COL_INFO, ", KI=0x%s", tvb_bytes_to_str_punct(tvb, poffset->offset_bytes, key_indicator_length,' ')); - } poffset->offset_bytes+=key_indicator_length; /* add KI length to offset_bytes */ } /* AU size */ diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c index 90000c23d9..e99687e885 100644 --- a/epan/dissectors/packet-kerberos.c +++ b/epan/dissectors/packet-kerberos.c @@ -1674,7 +1674,7 @@ static int dissect_krb5_error_code(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_error_code, &krb5_errorcode); - if(krb5_errorcode && check_col(actx->pinfo->cinfo, COL_INFO)) { + if(krb5_errorcode) { col_add_fstr(actx->pinfo->cinfo, COL_INFO, "KRB Error: %s", val_to_str(krb5_errorcode, krb5_error_codes, @@ -1916,7 +1916,7 @@ dissect_krb5_msg_type(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *a offset=dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_krb_msg_type, &msgtype); - if (gbl_do_col_info & check_col(actx->pinfo->cinfo, COL_INFO)) { + if (gbl_do_col_info) { col_add_str(actx->pinfo->cinfo, COL_INFO, val_to_str(msgtype, krb5_msg_types, "Unknown msg type %#x")); @@ -2295,7 +2295,7 @@ dissect_krb5_PW_SALT(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *ac */ proto_tree_add_item(tree, hf_krb_smb_nt_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); nt_status=tvb_get_letohl(tvb, offset); - if(nt_status && check_col(actx->pinfo->cinfo, COL_INFO)) { + if(nt_status) { col_append_fstr(actx->pinfo->cinfo, COL_INFO, " NT Status: %s", val_to_str(nt_status, NT_errors, diff --git a/epan/dissectors/packet-kerberos4.c b/epan/dissectors/packet-kerberos4.c index 036bb0e6f4..690717ed1a 100644 --- a/epan/dissectors/packet-kerberos4.c +++ b/epan/dissectors/packet-kerberos4.c @@ -263,8 +263,7 @@ dissect_krb4_auth_msg_type(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t /* m_type */ proto_tree_add_item(tree, hf_krb4_m_type, tvb, offset, 1, ENC_BIG_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s", + col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s", (version==TRANSARC_SPECIAL_VERSION)?"TRANSARC-":"", val_to_str(auth_msg_type>>1, m_type_vals, "Unknown (0x%04x)")); proto_item_append_text(item, " %s%s", diff --git a/epan/dissectors/packet-kpasswd.c b/epan/dissectors/packet-kpasswd.c index 053572700c..ac6ec418b4 100644 --- a/epan/dissectors/packet-kpasswd.c +++ b/epan/dissectors/packet-kpasswd.c @@ -139,9 +139,8 @@ dissect_kpasswd_user_data_reply(packet_info *pinfo, tvbuff_t *tvb, proto_tree *t result = tvb_get_ntohs(tvb, offset); proto_tree_add_uint(tree, hf_kpasswd_result, tvb, offset, 2, result); offset+=2; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, - val_to_str(result, kpasswd_result_types, "Result: %u")); + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(result, kpasswd_result_types, "Result: %u")); /* optional result string */ @@ -233,8 +232,7 @@ dissect_kpasswd_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboo proto_tree_add_uint(kpasswd_tree, hf_kpasswd_message_len, tvb, offset, 2, message_len); proto_tree_add_uint(kpasswd_tree, hf_kpasswd_version, tvb, offset+2, 2, version); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(version, vers_vals, "Unknown command")); + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(version, vers_vals, "Unknown command")); proto_tree_add_uint(kpasswd_tree, hf_kpasswd_ap_req_len, tvb, offset+4, 2, ap_req_len); offset+=6; diff --git a/epan/dissectors/packet-l1-events.c b/epan/dissectors/packet-l1-events.c index cb03819b87..f1b1fd4284 100644 --- a/epan/dissectors/packet-l1-events.c +++ b/epan/dissectors/packet-l1-events.c @@ -71,17 +71,13 @@ dissect_l1_events(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } col_set_str(pinfo->cinfo, COL_PROTOCOL, "Layer1"); - if (check_col(pinfo->cinfo, COL_DEF_SRC)) - col_set_str(pinfo->cinfo, COL_DEF_SRC, + col_set_str(pinfo->cinfo, COL_DEF_SRC, pinfo->pseudo_header->l1event.uton? "TE" : "NT"); - if (check_col(pinfo->cinfo, COL_INFO)) { - len = tvb_find_line_end(tvb, 0, - tvb_ensure_length_remaining(tvb, 0), + len = tvb_find_line_end(tvb, 0, tvb_ensure_length_remaining(tvb, 0), &next_offset, FALSE); - if(len>0) - col_add_str(pinfo->cinfo, COL_INFO, - tvb_format_text(tvb, 0, len)); - } + if(len>0) + col_add_str(pinfo->cinfo, COL_INFO, tvb_format_text(tvb, 0, len)); + if (tree) { ti = proto_tree_add_item(tree, proto_l1_events, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index 3459f8227e..e601d60ea2 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -2033,11 +2033,9 @@ process_l2tpv3_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (cookie_len == -1) cookie_len = L2TPv3_COOKIE_DEFAULT; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo,COL_INFO, - "%s (session id=%u)", - data_msg, sid); - } + col_add_fstr(pinfo->cinfo,COL_INFO, + "%s (session id=%u)", + data_msg, sid); if (tree) { proto_tree_add_item(l2tp_tree, hf_l2tp_sid, tvb, idx-4, 4, ENC_BIG_ENDIAN); @@ -2270,42 +2268,40 @@ process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int ccid = tvb_get_ntohl(tvb, idx); idx += 4; - if (check_col(pinfo->cinfo, COL_INFO)) { - tmp_idx = idx; + tmp_idx = idx; - if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s - ZLB (tunnel id=%u)", - control_msg , ccid); - else - { - if (SEQUENCE_BIT(control)) { - tmp_idx += 4; - } + if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s - ZLB (tunnel id=%u)", + control_msg , ccid); + else + { + if (SEQUENCE_BIT(control)) { + tmp_idx += 4; + } - tmp_idx+=4; + tmp_idx+=4; - avp_type = tvb_get_ntohs(tvb, tmp_idx); - tmp_idx += 2; + avp_type = tvb_get_ntohs(tvb, tmp_idx); + tmp_idx += 2; - if (avp_type == CONTROL_MESSAGE) { - /* We print message type */ - msg_type = tvb_get_ntohs(tvb, tmp_idx); - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s - %s (tunnel id=%u)", - control_msg , - val_to_str(msg_type, l2tp_message_type_short_str_vals, "Unknown (%u)"), - ccid); - } - else { - /* - * This is not a control message. - * We never pass here except in case of bad l2tp packet! - */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s (tunnel id=%u)", - control_msg, ccid); - } + if (avp_type == CONTROL_MESSAGE) { + /* We print message type */ + msg_type = tvb_get_ntohs(tvb, tmp_idx); + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s - %s (tunnel id=%u)", + control_msg , + val_to_str(msg_type, l2tp_message_type_short_str_vals, "Unknown (%u)"), + ccid); + } + else { + /* + * This is not a control message. + * We never pass here except in case of bad l2tp packet! + */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s (tunnel id=%u)", + control_msg, ccid); } } @@ -2492,53 +2488,51 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data idx += 2; cid = tvb_get_ntohs(tvb, idx); - if (check_col(pinfo->cinfo, COL_INFO)) { - if (CONTROL_BIT(control)) { - /* CONTROL MESSAGE */ - tmp_idx = idx; + if (CONTROL_BIT(control)) { + /* CONTROL MESSAGE */ + tmp_idx = idx; - if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s - ZLB (tunnel id=%d, session id=%u)", - control_msg, tid, cid); - else - { - if (SEQUENCE_BIT(control)) { - tmp_idx += 4; - } + if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s - ZLB (tunnel id=%d, session id=%u)", + control_msg, tid, cid); + else + { + if (SEQUENCE_BIT(control)) { + tmp_idx += 4; + } - tmp_idx+=4; + tmp_idx+=4; - avp_type = tvb_get_ntohs(tvb, (tmp_idx+=2)); + avp_type = tvb_get_ntohs(tvb, (tmp_idx+=2)); - if (avp_type == CONTROL_MESSAGE) { - /* We print message type */ - msg_type = tvb_get_ntohs(tvb, tmp_idx+2); - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s - %s (tunnel id=%u, session id=%u)", - control_msg, - val_to_str(msg_type, l2tp_message_type_short_str_vals, "Unknown (%u)"), - tid, cid); - } - else - { - /* - * This is not a control message. - * We never pass here except in case of bad l2tp packet! - */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s (tunnel id=%u, session id=%u)", - control_msg, tid, cid); + if (avp_type == CONTROL_MESSAGE) { + /* We print message type */ + msg_type = tvb_get_ntohs(tvb, tmp_idx+2); + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s - %s (tunnel id=%u, session id=%u)", + control_msg, + val_to_str(msg_type, l2tp_message_type_short_str_vals, "Unknown (%u)"), + tid, cid); + } + else + { + /* + * This is not a control message. + * We never pass here except in case of bad l2tp packet! + */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s (tunnel id=%u, session id=%u)", + control_msg, tid, cid); - } } } - else { - /* DATA Message */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s (tunnel id=%u, session id=%u)", - data_msg, tid, cid); - } + } + else { + /* DATA Message */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s (tunnel id=%u, session id=%u)", + data_msg, tid, cid); } if (LENGTH_BIT(control)) { diff --git a/epan/dissectors/packet-lanforge.c b/epan/dissectors/packet-lanforge.c index f72c4876cc..20273fc5af 100644 --- a/epan/dissectors/packet-lanforge.c +++ b/epan/dissectors/packet-lanforge.c @@ -89,9 +89,7 @@ static gboolean dissect_lanforge(tvbuff_t *tvb, packet_info *pinfo, proto_tree * col_set_str(pinfo->cinfo, COL_PROTOCOL, "LANforge"); - if(check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Seq: %u", tvb_get_ntohl(tvb, 16)); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "Seq: %u", tvb_get_ntohl(tvb, 16)); if(tree) { diff --git a/epan/dissectors/packet-lapd.c b/epan/dissectors/packet-lapd.c index a5b730308b..53d4ba8b7d 100644 --- a/epan/dissectors/packet-lapd.c +++ b/epan/dissectors/packet-lapd.c @@ -435,8 +435,7 @@ dissect_lapd_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean sapi = (addr & LAPD_SAPI) >> LAPD_SAPI_SHIFT; lapd_header_len = 2; /* addr */ - if (check_col(pinfo->cinfo, COL_TEI)) - col_add_fstr(pinfo->cinfo, COL_TEI, "%u", tei); + col_add_fstr(pinfo->cinfo, COL_TEI, "%u", tei); /* Append TEI to info field */ col_append_fstr(pinfo->cinfo, COL_INFO, "TEI:%02u ", tei); diff --git a/epan/dissectors/packet-laplink.c b/epan/dissectors/packet-laplink.c index aa11be1767..50beae0c75 100644 --- a/epan/dissectors/packet-laplink.c +++ b/epan/dissectors/packet-laplink.c @@ -93,8 +93,7 @@ dissect_laplink_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Laplink"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, udp_ident_string); + col_add_str(pinfo->cinfo, COL_INFO, udp_ident_string); if (tree){ ti = proto_tree_add_item(tree, proto_laplink, tvb, 0, -1, ENC_NA); @@ -122,10 +121,8 @@ dissect_laplink_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "Laplink"); tcp_ident = tvb_get_ntohl(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(tcp_ident, laplink_tcp_magic, "TCP TBA (%u)")); - } if (tree){ ti = proto_tree_add_item(tree, proto_laplink, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-lapsat.c b/epan/dissectors/packet-lapsat.c index e4e989df99..f614b0ce6f 100644 --- a/epan/dissectors/packet-lapsat.c +++ b/epan/dissectors/packet-lapsat.c @@ -345,8 +345,7 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int is_ } /* Add info */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, info); + col_add_str(pinfo->cinfo, COL_INFO, info); /* Create item & subtree */ ctl_ti = proto_tree_add_uint_format_value( diff --git a/epan/dissectors/packet-ldp.c b/epan/dissectors/packet-ldp.c index 8dcdf464a9..3eae7e9b09 100644 --- a/epan/dissectors/packet-ldp.c +++ b/epan/dissectors/packet-ldp.c @@ -2581,17 +2581,15 @@ dissect_msg(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree) rem -= 4; length = MIN(length, rem); /* Don't go haywire if a problem ... */ - if( check_col(pinfo->cinfo, COL_INFO) ){ - switch (type) { - case LDP_VENDOR_PRIVATE_START: - col_append_fstr(pinfo->cinfo, COL_INFO, "Vendor-Private Message (0x%04X) ", typebak); - break; - case LDP_EXPERIMENTAL_MESSAGE_START: - col_append_fstr(pinfo->cinfo, COL_INFO, "Experimental Message (0x%04X) ", typebak); - break; - default: - col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(type, ldp_message_types, "Unknown Message (0x%04X)")); - } + switch (type) { + case LDP_VENDOR_PRIVATE_START: + col_append_fstr(pinfo->cinfo, COL_INFO, "Vendor-Private Message (0x%04X) ", typebak); + break; + case LDP_EXPERIMENTAL_MESSAGE_START: + col_append_fstr(pinfo->cinfo, COL_INFO, "Experimental Message (0x%04X) ", typebak); + break; + default: + col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(type, ldp_message_types, "Unknown Message (0x%04X)")); } if (tree) { diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c index 90db41e304..39ffc7469a 100644 --- a/epan/dissectors/packet-ldss.c +++ b/epan/dissectors/packet-ldss.c @@ -324,11 +324,9 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) packet_detail = val_to_str_const(messageDetail, ldss_inferred_info, "unknown"); /* Set the info column */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "LDSS Broadcast (%s%s)", + col_add_fstr(pinfo->cinfo, COL_INFO, "LDSS Broadcast (%s%s)", packet_type, packet_detail); - } /* If we have a non-null tree (ie we are building the proto_tree * instead of just filling out the columns), then give more detail. */ @@ -680,12 +678,10 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) transfer_info->resp_num = pinfo->fd->num; transfer_info->resp_ts = pinfo->fd->abs_ts; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "LDSS File Transfer (Sending file - %s)", + col_add_fstr(pinfo->cinfo, COL_INFO, "LDSS File Transfer (Sending file - %s)", transfer_info->broadcast->message_id == MESSAGE_ID_WILLSEND ? "pull" : "push"); - } if (tree) { ti = proto_tree_add_item(tree, proto_ldss, diff --git a/epan/dissectors/packet-llc.c b/epan/dissectors/packet-llc.c index 65c761941e..edf7994566 100644 --- a/epan/dissectors/packet-llc.c +++ b/epan/dissectors/packet-llc.c @@ -440,20 +440,17 @@ dissect_basicxid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(xid_tree, hf_llc_xid_types, tvb, 1, 1, types & TYPES_MASK); } - 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(types & TYPES_MASK, type_vals, "0x%02x") ); - } + wsize = tvb_get_guint8(tvb, 2); if (tree) { proto_tree_add_uint(xid_tree, hf_llc_xid_wsize, tvb, 2, 1, (wsize & 0xFE) >> 1); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "; Window Size %d", (wsize & 0xFE) >> 1); - } } static void @@ -515,8 +512,7 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf_llc_oui, hf_llc_type, hf_llc_pid, 2); } else { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "; DSAP %s %s, SSAP %s %s", val_to_str(dsap & SAP_MASK, sap_vals, "0x%02x"), dsap & DSAP_GI_BIT ? @@ -525,7 +521,6 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ssap & SSAP_CR_BIT ? "Response" : "Command" ); - } if (tvb_length_remaining(tvb, llc_header_len) > 0) { next_tvb = tvb_new_subset_remaining(tvb, llc_header_len); @@ -591,14 +586,11 @@ dissect_snap(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, oui = tvb_get_ntoh24(tvb, offset); etype = tvb_get_ntohs(tvb, offset+3); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "; SNAP, OUI 0x%06X (%s), PID 0x%04X", oui, val_to_str_const(oui, oui_vals, "Unknown"), etype); - } - if (tree) { - proto_tree_add_uint(snap_tree, hf_oui, tvb, offset, 3, oui); - } + + proto_tree_add_uint(snap_tree, hf_oui, tvb, offset, 3, oui); switch (oui) { diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index e395699a00..08e1a6ce00 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -824,8 +824,7 @@ dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui return -1; } - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "Chassis Id = %s ", strPtr); + col_add_fstr(pinfo->cinfo, COL_INFO, "Chassis Id = %s ", strPtr); if (tree) { @@ -950,8 +949,7 @@ dissect_lldp_port_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint3 } } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "Port Id = %s ", strPtr); + col_append_fstr(pinfo->cinfo, COL_INFO, "Port Id = %s ", strPtr); if (tree) { @@ -1024,8 +1022,7 @@ dissect_lldp_time_to_live(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g tempLen = TLV_INFO_LEN(tempShort); tempShort = tvb_get_ntohs(tvb, (offset+2)); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "TTL = %u ", tempShort); + col_append_fstr(pinfo->cinfo, COL_INFO, "TTL = %u ", tempShort); if (tree) { @@ -1134,8 +1131,7 @@ dissect_lldp_system_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree /* Set system name tree */ if (tempType == SYSTEM_NAME_TLV_TYPE) { tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "System Name = %s", strPtr); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "System Name = %s ", strPtr); + col_append_fstr(pinfo->cinfo, COL_INFO, "System Name = %s ", strPtr); } else tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "System Description = %s", strPtr); system_name_tree = proto_item_add_subtree(tf, ett_system_name); diff --git a/epan/dissectors/packet-llt.c b/epan/dissectors/packet-llt.c index 2ec3c09c1c..3a32c7b9ce 100644 --- a/epan/dissectors/packet-llt.c +++ b/epan/dissectors/packet-llt.c @@ -59,8 +59,8 @@ static void dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Set up structures needed to add the protocol subtree and manage it */ - proto_item *ti=NULL; - proto_tree *llt_tree=NULL; + proto_item *ti; + proto_tree *llt_tree; guint8 message_type; /* Make entries in Protocol column and Info column on summary display */ @@ -68,14 +68,10 @@ dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_type = tvb_get_guint8(tvb, 3); - if(check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message type: %s", val_to_str(message_type, message_type_vs, "Unknown (0x%02x)")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "Message type: %s", val_to_str(message_type, message_type_vs, "Unknown (0x%02x)")); - if (tree) { - ti = proto_tree_add_item(tree, proto_llt, tvb, 0, -1, ENC_NA); - llt_tree = proto_item_add_subtree(ti, ett_llt); - } + ti = proto_tree_add_item(tree, proto_llt, tvb, 0, -1, ENC_NA); + llt_tree = proto_item_add_subtree(ti, ett_llt); proto_tree_add_item(llt_tree, hf_llt_cluster_num, tvb, 2, 1, ENC_BIG_ENDIAN); proto_tree_add_item(llt_tree, hf_llt_message_type, tvb, 3, 1, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-lmi.c b/epan/dissectors/packet-lmi.c index 304ea4d6de..12061aed54 100644 --- a/epan/dissectors/packet-lmi.c +++ b/epan/dissectors/packet-lmi.c @@ -151,10 +151,9 @@ dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(lmi_tree, hf_lmi_call_ref, tvb, 0, 1, ENC_BIG_ENDIAN); } msg_type = 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(msg_type, msg_type_str, "Unknown message type (0x%02x)")); - } + if (tree) { proto_tree_add_uint(lmi_tree, hf_lmi_msg_type, tvb, 1, 1, msg_type); diff --git a/epan/dissectors/packet-lon.c b/epan/dissectors/packet-lon.c index 000ab922c4..76aeab616d 100644 --- a/epan/dissectors/packet-lon.c +++ b/epan/dissectors/packet-lon.c @@ -206,22 +206,19 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) proto_tree *ti; proto_item *pi; proto_tree *lon_tree; + gint npdu, type; col_set_str(pinfo->cinfo, COL_PROTOCOL, "LON"); col_clear(pinfo->cinfo, COL_INFO); - if (check_col(pinfo->cinfo, COL_INFO)) { - gint npdu, type; - npdu = tvb_get_guint8(tvb, 0); - type = tvb_get_guint8(tvb, 1); - type = (type&0x30)>>4; - col_add_fstr(pinfo->cinfo, COL_INFO, + npdu = tvb_get_guint8(tvb, 0); + type = tvb_get_guint8(tvb, 1); + type = (type&0x30)>>4; + col_add_fstr(pinfo->cinfo, COL_INFO, "%sDelta_BL: %i Type: %s", npdu&0x80?"Priority ":"", npdu&0x3F, val_to_str_const(type, pdu_fmt_vs, "Unknown")); - } - ti = proto_tree_add_item(tree, proto_lon, tvb, offset, -1, ENC_NA); lon_tree = proto_item_add_subtree(ti, ett_lon); diff --git a/epan/dissectors/packet-loop.c b/epan/dissectors/packet-loop.c index 6fa0d04315..c45b6411a0 100644 --- a/epan/dissectors/packet-loop.c +++ b/epan/dissectors/packet-loop.c @@ -78,12 +78,10 @@ dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) do { function = tvb_get_letohs(tvb, offset); if (offset == skip_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(function, function_vals, "Unknown function (%u)")); - } - if (tree) - proto_tree_add_text(loop_tree, tvb, offset, 2, "Relevant function:"); + + proto_tree_add_text(loop_tree, tvb, offset, 2, "Relevant function:"); set_info = FALSE; } if (tree) diff --git a/epan/dissectors/packet-lpd.c b/epan/dissectors/packet-lpd.c index d726f9d2b1..48f94f511c 100644 --- a/epan/dissectors/packet-lpd.c +++ b/epan/dissectors/packet-lpd.c @@ -88,16 +88,14 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) lpr_packet_type = unknown; } - if (check_col(pinfo->cinfo, COL_INFO)) { - if (lpr_packet_type == request && code !=0) { - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(code, lpd_client_code, "Unknown client code: %u")); - } - else if (lpr_packet_type == response) { - col_set_str(pinfo->cinfo, COL_INFO, "LPD response"); - } - else { - col_set_str(pinfo->cinfo, COL_INFO, "LPD continuation"); - } + if (lpr_packet_type == request && code !=0) { + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(code, lpd_client_code, "Unknown client code: %u")); + } + else if (lpr_packet_type == response) { + col_set_str(pinfo->cinfo, COL_INFO, "LPD response"); + } + else { + col_set_str(pinfo->cinfo, COL_INFO, "LPD continuation"); } if (tree) { diff --git a/epan/dissectors/packet-lsc.c b/epan/dissectors/packet-lsc.c index 485edf72f5..4b6bf2d8d1 100644 --- a/epan/dissectors/packet-lsc.c +++ b/epan/dissectors/packet-lsc.c @@ -196,16 +196,14 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Display the op code in the summary */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s, session %.8u", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s, session %.8u", val_to_str(op_code, op_code_vals, "Unknown op code (0x%x)"), stream); - if (tvb_length(tvb) < expected_len) - col_append_str(pinfo->cinfo, COL_INFO, " [Too short]"); - else if (tvb_length(tvb) > expected_len) - col_append_str(pinfo->cinfo, COL_INFO, " [Too long]"); - } + if (tvb_length(tvb) < expected_len) + col_append_str(pinfo->cinfo, COL_INFO, " [Too short]"); + else if (tvb_length(tvb) > expected_len) + col_append_str(pinfo->cinfo, COL_INFO, " [Too long]"); if (tree) { /* Create display subtree for the protocol */ diff --git a/epan/dissectors/packet-lwapp.c b/epan/dissectors/packet-lwapp.c index de7fd75217..06423ae988 100644 --- a/epan/dissectors/packet-lwapp.c +++ b/epan/dissectors/packet-lwapp.c @@ -279,10 +279,8 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, */ header.length = g_ntohs(header.length); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_str(pinfo->cinfo, COL_INFO, - val_to_str_ext(header.type, &control_msg_vals_ext, "Bad Type: 0x%02x")); - } + col_append_str(pinfo->cinfo, COL_INFO, + val_to_str_ext(header.type, &control_msg_vals_ext, "Bad Type: 0x%02x")); /* In the interest of speed, if "tree" is NULL, don't do any work not necessary to generate protocol tree items. */ @@ -396,14 +394,12 @@ dissect_lwapp(tvbuff_t *tvb, packet_info *pinfo, version = (header.flags & 0xc0) >> 6; slotId = (header.flags & 0x38) >> 3; - if (check_col(pinfo->cinfo, COL_INFO)) { - if ((header.flags & LWAPP_FLAGS_T) != 0) - col_append_str(pinfo->cinfo, COL_INFO, - " Control Packet"); - else - col_append_str(pinfo->cinfo, COL_INFO, - " 802.11 Packet"); - } + if ((header.flags & LWAPP_FLAGS_T) != 0) + col_append_str(pinfo->cinfo, COL_INFO, + " Control Packet"); + else + col_append_str(pinfo->cinfo, COL_INFO, + " 802.11 Packet"); /* In the interest of speed, if "tree" is NULL, don't do any work not necessary to generate protocol tree items. */ diff --git a/epan/dissectors/packet-lwres.c b/epan/dissectors/packet-lwres.c index 532ee766fe..600c2e8b8b 100644 --- a/epan/dissectors/packet-lwres.c +++ b/epan/dissectors/packet-lwres.c @@ -907,26 +907,24 @@ dissect_lwres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_type = (flags & LWRES_LWPACKETFLAG_RESPONSE) ? 2 : 1; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); - if(flags & LWRES_LWPACKETFLAG_RESPONSE) - { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s, opcode=%s, serial=0x%x, result=%s", - val_to_str_const((guint32)message_type,message_types_values,"unknown"), - val_to_str_const(opcode, opcode_values, "unknown"), - serial, - val_to_str_const(result,result_values,"unknown")); - } - else - { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s, opcode=%s, serial=0x%x", - val_to_str_const((guint32)message_type,message_types_values,"unknown"), - val_to_str_const(opcode, opcode_values, "unknown"), - serial); - } + if(flags & LWRES_LWPACKETFLAG_RESPONSE) + { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s, opcode=%s, serial=0x%x, result=%s", + val_to_str_const((guint32)message_type,message_types_values,"unknown"), + val_to_str_const(opcode, opcode_values, "unknown"), + serial, + val_to_str_const(result,result_values,"unknown")); + } + else + { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s, opcode=%s, serial=0x%x", + val_to_str_const((guint32)message_type,message_types_values,"unknown"), + val_to_str_const(opcode, opcode_values, "unknown"), + serial); } if(tree) diff --git a/epan/dissectors/packet-m2pa.c b/epan/dissectors/packet-m2pa.c index 06bf68523c..240abc6780 100644 --- a/epan/dissectors/packet-m2pa.c +++ b/epan/dissectors/packet-m2pa.c @@ -160,8 +160,7 @@ dissect_v2_header(tvbuff_t *header_tvb, packet_info *pinfo, proto_tree *m2pa_tre message_type = tvb_get_ntohs(header_tvb, V2_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_type, v2_message_type_values, "reserved")); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_type, v2_message_type_values, "reserved")); if (m2pa_tree) { proto_tree_add_item(m2pa_tree, hf_version, header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN); @@ -178,8 +177,7 @@ dissect_v8_header(tvbuff_t *header_tvb, packet_info *pinfo, proto_tree *m2pa_tre message_type = tvb_get_guint8(header_tvb, V8_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_type, v8_message_type_values, "Unknown")); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_type, v8_message_type_values, "Unknown")); if (m2pa_tree) { proto_tree_add_item(m2pa_tree, hf_version, header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN); @@ -201,8 +199,7 @@ dissect_header(tvbuff_t *header_tvb, packet_info *pinfo, proto_tree *m2pa_tree) message_type = tvb_get_guint8(header_tvb, V8_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_type, v8_message_type_values, "Unknown")); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_type, v8_message_type_values, "Unknown")); if (m2pa_tree) { proto_tree_add_item(m2pa_tree, hf_version, header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN); @@ -318,10 +315,8 @@ static const value_string v2_link_status_values[] = { static void dissect_v2_link_status_message(tvbuff_t *message_data_tvb, packet_info *pinfo, proto_tree *m2pa_tree) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), v2_link_status_values, "Unknown")); - if (m2pa_tree) - proto_tree_add_item(m2pa_tree, hf_v2_status, message_data_tvb, STATUS_OFFSET, STATUS_LENGTH, ENC_BIG_ENDIAN); + col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), v2_link_status_values, "Unknown")); + proto_tree_add_item(m2pa_tree, hf_v2_status, message_data_tvb, STATUS_OFFSET, STATUS_LENGTH, ENC_BIG_ENDIAN); } static const value_string v8_link_status_values[] = { @@ -341,8 +336,7 @@ dissect_v8_link_status_message(tvbuff_t *message_data_tvb, packet_info *pinfo, p { guint16 filler_length; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), v8_link_status_values, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), v8_link_status_values, "Unknown")); filler_length = tvb_length(message_data_tvb) - STATUS_LENGTH; @@ -368,8 +362,7 @@ dissect_link_status_message(tvbuff_t *message_data_tvb, packet_info *pinfo, prot { guint16 filler_length; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), link_status_values, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), link_status_values, "Unknown")); filler_length = tvb_length(message_data_tvb) - STATUS_LENGTH; @@ -518,26 +511,20 @@ dissect_m2pa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *m2pa_item; proto_tree *m2pa_tree; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - switch(m2pa_version) { - case M2PA_V02: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2PA (ID 02)"); - break; - case M2PA_V08: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2PA (ID 08)"); - break; - case M2PA_RFC4165: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2PA"); - break; - }; + switch(m2pa_version) { + case M2PA_V02: + col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2PA (ID 02)"); + break; + case M2PA_V08: + col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2PA (ID 08)"); + break; + case M2PA_RFC4165: + col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2PA"); + break; + }; - if (tree) { - m2pa_item = proto_tree_add_item(tree, proto_m2pa, tvb, 0, -1, ENC_NA); - m2pa_tree = proto_item_add_subtree(m2pa_item, ett_m2pa); - } else { - m2pa_item = NULL; - m2pa_tree = NULL; - } + m2pa_item = proto_tree_add_item(tree, proto_m2pa, tvb, 0, -1, ENC_NA); + m2pa_tree = proto_item_add_subtree(m2pa_item, ett_m2pa); switch(m2pa_version) { case M2PA_V02: diff --git a/epan/dissectors/packet-m2tp.c b/epan/dissectors/packet-m2tp.c index 14339b0a3f..e82884dab8 100644 --- a/epan/dissectors/packet-m2tp.c +++ b/epan/dissectors/packet-m2tp.c @@ -269,8 +269,7 @@ dissect_m2tp_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, prot message_type = tvb_get_guint8(common_header_tvb, MESSAGE_TYPE_OFFSET); message_length = tvb_get_ntohl (common_header_tvb, MESSAGE_LENGTH_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, m2tp_message_class_type_acro_values, "reserved")); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, m2tp_message_class_type_acro_values, "reserved")); if (m2tp_tree) { /* add the components of the common header to the protocol tree */ diff --git a/epan/dissectors/packet-m2ua.c b/epan/dissectors/packet-m2ua.c index 5490f2a39e..a25d1b1d15 100644 --- a/epan/dissectors/packet-m2ua.c +++ b/epan/dissectors/packet-m2ua.c @@ -240,8 +240,7 @@ dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tre message_class = tvb_get_guint8(common_header_tvb, MESSAGE_CLASS_OFFSET); message_type = tvb_get_guint8(common_header_tvb, MESSAGE_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "reserved")); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "reserved")); if (m2ua_tree) { /* add the components of the common header to the protocol tree */ diff --git a/epan/dissectors/packet-m3ua.c b/epan/dissectors/packet-m3ua.c index db852997cf..6f72788825 100644 --- a/epan/dissectors/packet-m3ua.c +++ b/epan/dissectors/packet-m3ua.c @@ -338,8 +338,7 @@ dissect_v5_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_ message_class = tvb_get_guint8(common_header_tvb, MESSAGE_CLASS_OFFSET); message_type = tvb_get_guint8(common_header_tvb, MESSAGE_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, v5_message_class_type_acro_values, "reserved")); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, v5_message_class_type_acro_values, "reserved")); if (m3ua_tree) { /* add the components of the common header to the protocol tree */ @@ -361,8 +360,7 @@ dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tre message_class = tvb_get_guint8(common_header_tvb, MESSAGE_CLASS_OFFSET); message_type = tvb_get_guint8(common_header_tvb, MESSAGE_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO,"%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "reserved")); + col_add_fstr(pinfo->cinfo, COL_INFO,"%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "reserved")); if (m3ua_tree) { /* add the components of the common header to the protocol tree */ @@ -2008,8 +2006,7 @@ dissect_m3ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree) /* make entry in the Protocol column on summary display */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - switch(version) { + switch(version) { case M3UA_V5: col_set_str(pinfo->cinfo, COL_PROTOCOL, "M3UA (ID 05)"); break; @@ -2022,21 +2019,14 @@ dissect_m3ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree) case M3UA_RFC: col_set_str(pinfo->cinfo, COL_PROTOCOL, "M3UA (RFC 4666)"); break; - }; - - /* In the interest of speed, if "tree" is NULL, don't do any work not - necessary to generate protocol tree items. */ - if (tree) { - /* create the m3ua protocol tree */ - m3ua_item = proto_tree_add_item(tree, proto_m3ua, message_tvb, 0, -1, ENC_NA); - m3ua_tree = proto_item_add_subtree(m3ua_item, ett_m3ua); - } else { - m3ua_tree = NULL; }; + /* create the m3ua protocol tree */ + m3ua_item = proto_tree_add_item(tree, proto_m3ua, message_tvb, 0, -1, ENC_NA); + m3ua_tree = proto_item_add_subtree(m3ua_item, ett_m3ua); + /* dissect the message */ dissect_message(message_tvb, pinfo, tree, m3ua_tree); - } /* Register the protocol with Wireshark */ diff --git a/epan/dissectors/packet-mactelnet.c b/epan/dissectors/packet-mactelnet.c index b0613f1dc1..1ea09b6166 100644 --- a/epan/dissectors/packet-mactelnet.c +++ b/epan/dissectors/packet-mactelnet.c @@ -147,14 +147,12 @@ dissect_mactelnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_MACTELNET); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s > %s Direction: %s Type: %s", - tvb_ether_to_str(tvb, 2), - tvb_ether_to_str(tvb, 8), - ((foundclient >= 0) || (type == 4) ? "Client->Server" : "Server->Client" ), - val_to_str(type, packettypenames, "Unknown Type:0x%02x") - ); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s > %s Direction: %s Type: %s", + tvb_ether_to_str(tvb, 2), + tvb_ether_to_str(tvb, 8), + ((foundclient >= 0) || (type == 4) ? "Client->Server" : "Server->Client" ), + val_to_str(type, packettypenames, "Unknown Type:0x%02x") + ); if (tree) { guint32 offset = 0; diff --git a/epan/dissectors/packet-mbtcp.c b/epan/dissectors/packet-mbtcp.c index d5b04cacd5..8948e678c5 100644 --- a/epan/dissectors/packet-mbtcp.c +++ b/epan/dissectors/packet-mbtcp.c @@ -393,52 +393,49 @@ dissect_mbtcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* "Request" or "Response" */ packet_type = classify_mbtcp_packet(pinfo); - if (check_col(pinfo->cinfo, COL_INFO)) - { - switch ( packet_type ) { - case QUERY_PACKET : - pkt_type_str="Query"; - break; - case RESPONSE_PACKET : - pkt_type_str="Response"; - break; - case CANNOT_CLASSIFY : - err_str="Unable to classify as query or response."; - pkt_type_str="unknown"; - break; - default : - break; + switch ( packet_type ) { + case QUERY_PACKET : + pkt_type_str="Query"; + break; + case RESPONSE_PACKET : + pkt_type_str="Response"; + break; + case CANNOT_CLASSIFY : + err_str="Unable to classify as query or response."; + pkt_type_str="unknown"; + break; + default : + break; + } + if ( exception_code != 0 ) + err_str="Exception returned "; + + if (subfunction_code == 0) { + if (strlen(err_str) > 0) { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%8s: Trans: %5u; Unit: %3u, Func: %3u: %s. %s", + pkt_type_str, transaction_id, unit_id, + function_code, func_string, err_str); } - if ( exception_code != 0 ) - err_str="Exception returned "; - - if (subfunction_code == 0) { - if (strlen(err_str) > 0) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%8s: Trans: %5u; Unit: %3u, Func: %3u: %s. %s", - pkt_type_str, transaction_id, unit_id, - function_code, func_string, err_str); - } - else { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%8s: Trans: %5u; Unit: %3u, Func: %3u: %s", - pkt_type_str, transaction_id, unit_id, - function_code, func_string); - } + else { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%8s: Trans: %5u; Unit: %3u, Func: %3u: %s", + pkt_type_str, transaction_id, unit_id, + function_code, func_string); + } + } + else { + if (strlen(err_str) > 0) { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%8s: Trans: %5u; Unit: %3u, Func: %3u/%3u: %s. %s", + pkt_type_str, transaction_id, unit_id, + function_code, subfunction_code, func_string, err_str); } else { - if (strlen(err_str) > 0) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%8s: Trans: %5u; Unit: %3u, Func: %3u/%3u: %s. %s", - pkt_type_str, transaction_id, unit_id, - function_code, subfunction_code, func_string, err_str); - } - else { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%8s: Trans: %5u; Unit: %3u, Func: %3u/%3u: %s", - pkt_type_str, transaction_id, unit_id, - function_code, subfunction_code, func_string); - } + col_add_fstr(pinfo->cinfo, COL_INFO, + "%8s: Trans: %5u; Unit: %3u, Func: %3u/%3u: %s", + pkt_type_str, transaction_id, unit_id, + function_code, subfunction_code, func_string); } } @@ -528,52 +525,49 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* "Request" or "Response" */ packet_type = classify_mbrtu_packet(pinfo); - if (check_col(pinfo->cinfo, COL_INFO)) - { - switch ( packet_type ) { - case QUERY_PACKET : - pkt_type_str="Query"; - break; - case RESPONSE_PACKET : - pkt_type_str="Response"; - break; - case CANNOT_CLASSIFY : - err_str="Unable to classify as query or response."; - pkt_type_str="unknown"; - break; - default : - break; + switch ( packet_type ) { + case QUERY_PACKET : + pkt_type_str="Query"; + break; + case RESPONSE_PACKET : + pkt_type_str="Response"; + break; + case CANNOT_CLASSIFY : + err_str="Unable to classify as query or response."; + pkt_type_str="unknown"; + break; + default : + break; + } + if ( exception_code != 0 ) + err_str="Exception returned "; + + if (subfunction_code == 0) { + if (strlen(err_str) > 0) { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%8s: Unit: %3u, Func: %3u: %s. %s", + pkt_type_str, unit_id, + function_code, func_string, err_str); } - if ( exception_code != 0 ) - err_str="Exception returned "; - - if (subfunction_code == 0) { - if (strlen(err_str) > 0) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%8s: Unit: %3u, Func: %3u: %s. %s", - pkt_type_str, unit_id, - function_code, func_string, err_str); - } - else { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%8s: Unit: %3u, Func: %3u: %s", - pkt_type_str, unit_id, - function_code, func_string); - } + else { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%8s: Unit: %3u, Func: %3u: %s", + pkt_type_str, unit_id, + function_code, func_string); + } + } + else { + if (strlen(err_str) > 0) { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%8s: Unit: %3u, Func: %3u/%3u: %s. %s", + pkt_type_str, unit_id, + function_code, subfunction_code, func_string, err_str); } else { - if (strlen(err_str) > 0) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%8s: Unit: %3u, Func: %3u/%3u: %s. %s", - pkt_type_str, unit_id, - function_code, subfunction_code, func_string, err_str); - } - else { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%8s: Unit: %3u, Func: %3u/%3u: %s", - pkt_type_str, unit_id, - function_code, subfunction_code, func_string); - } + col_add_fstr(pinfo->cinfo, COL_INFO, + "%8s: Unit: %3u, Func: %3u/%3u: %s", + pkt_type_str, unit_id, + function_code, subfunction_code, func_string); } } diff --git a/epan/dissectors/packet-media.c b/epan/dissectors/packet-media.c index dd118a3578..a4c80310d4 100644 --- a/epan/dissectors/packet-media.c +++ b/epan/dissectors/packet-media.c @@ -52,9 +52,7 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree) } /* Add media type to the INFO column if it is visible */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", (pinfo->match_string) ? pinfo->match_string : ""); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", (pinfo->match_string) ? pinfo->match_string : ""); if (tree) { if ( (bytes = tvb_length(tvb)) > 0 ) diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index f4efa1a30b..423d50aa69 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -580,8 +580,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!first) { col_append_str(pinfo->cinfo, COL_INFO, " "); } - if (check_col(pinfo->cinfo, COL_INFO) ) - col_append_fstr(pinfo->cinfo, COL_INFO, "%s TransactionResponseAck", + col_append_fstr(pinfo->cinfo, COL_INFO, "%s TransactionResponseAck", tvb_format_text(tvb,tvb_previous_offset,len)); if(tree) @@ -614,8 +613,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!first) { col_append_str(pinfo->cinfo, COL_INFO, " "); } - if (check_col(pinfo->cinfo, COL_INFO) ) - col_append_fstr(pinfo->cinfo, COL_INFO, "%s Pending", + col_append_fstr(pinfo->cinfo, COL_INFO, "%s Pending", tvb_format_text(tvb,tvb_offset,len)); if(tree) @@ -642,8 +640,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_current_offset = megaco_tvb_skip_wsp_return(tvb, tvb_LBRKT-1); len = tvb_current_offset - tvb_offset; - if (check_col(pinfo->cinfo, COL_INFO) ) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s Reply ", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Reply ", tvb_format_text(tvb,tvb_offset,len)); trx_id = (guint)strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); @@ -679,8 +676,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!first) { col_append_str(pinfo->cinfo, COL_INFO, " "); } - if (check_col(pinfo->cinfo, COL_INFO) ) - col_append_fstr(pinfo->cinfo, COL_INFO, "%s Request", + col_append_fstr(pinfo->cinfo, COL_INFO, "%s Request", tvb_format_text(tvb,tvb_offset,len)); trx_id = (guint)strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); if(tree) @@ -768,8 +764,7 @@ nextcontext: tokenlen)); ctx_id = (guint)strtoul(tvb_format_text(tvb, tvb_previous_offset, tokenlen),NULL,10); - if (check_col(pinfo->cinfo, COL_INFO) ) - col_append_fstr(pinfo->cinfo, COL_INFO, " |=%s",tvb_format_text(tvb, tvb_previous_offset,tokenlen)); + col_append_fstr(pinfo->cinfo, COL_INFO, " |=%s",tvb_format_text(tvb, tvb_previous_offset,tokenlen)); } ctx = gcp_ctx(msg,trx,ctx_id,keep_persistent_data); @@ -1218,8 +1213,7 @@ nextcontext: tvb_command_start_offset, tokenlen, tvb_format_text(tvb, tvb_command_start_offset, tokenlen)); - 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 (cmd_type == GCP_CMD_NONE && trx_type == GCP_TRX_REPLY) { @@ -1312,8 +1306,7 @@ nextcontext: gcp_cmd_add_term(msg, trx, cmd, term, wild_term, keep_persistent_data); - if (check_col(pinfo->cinfo, COL_INFO) ) - col_append_fstr(pinfo->cinfo, COL_INFO, "=%s",tvb_format_text(tvb, tvb_offset,tokenlen)); + col_append_fstr(pinfo->cinfo, COL_INFO, "=%s",tvb_format_text(tvb, tvb_offset,tokenlen)); break; } @@ -2101,8 +2094,7 @@ dissect_megaco_signaldescriptor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *m tvb_current_offset = tvb_LBRKT; tvb_next_offset = megaco_tvb_skip_wsp(tvb, tvb_current_offset+1); - if (check_col(pinfo->cinfo, COL_INFO) ) - col_append_fstr(pinfo->cinfo, COL_INFO, " (Signal:%s)",tvb_format_text(tvb, tvb_current_offset,tokenlen-tvb_current_offset+tvb_previous_offset)); + col_append_fstr(pinfo->cinfo, COL_INFO, " (Signal:%s)",tvb_format_text(tvb, tvb_current_offset,tokenlen-tvb_current_offset+tvb_previous_offset)); if ( tvb_current_offset < tvb_signals_end_offset && tvb_current_offset != -1 && tvb_next_offset != tvb_signals_end_offset){ @@ -3146,8 +3138,7 @@ dissect_megaco_LocalControldescriptor(tvbuff_t *tvb, proto_tree *megaco_mediades tvb_current_offset, tokenlen, tvb_format_text(tvb, tvb_current_offset, tokenlen)); - if (check_col(pinfo->cinfo, COL_INFO) ) - col_append_fstr(pinfo->cinfo, COL_INFO, " (Mode:%s)",tvb_format_text(tvb, tvb_current_offset,tokenlen)); + col_append_fstr(pinfo->cinfo, COL_INFO, " (Mode:%s)",tvb_format_text(tvb, tvb_current_offset,tokenlen)); tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_offset +1); break; diff --git a/epan/dissectors/packet-mikey.c b/epan/dissectors/packet-mikey.c index ed54705349..4e4b4bb491 100644 --- a/epan/dissectors/packet-mikey.c +++ b/epan/dissectors/packet-mikey.c @@ -1419,8 +1419,7 @@ dissect_mikey(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U col_append_str(pinfo->cinfo, COL_PROTOCOL, "/MIKEY"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", Mikey: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Mikey: %s", val_to_str_ext_const(mikey->type, &data_type_vals_ext, "Unknown")); /* Return the amount of data this dissector was able to dissect */ diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index aacebaf1fa..af0dc3a7d4 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -666,10 +666,8 @@ dissect_mmse_standalone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MMSE"); - if (check_col(pinfo->cinfo, COL_INFO)) { col_clear(pinfo->cinfo, COL_INFO); col_add_fstr(pinfo->cinfo, COL_INFO, "MMS %s", message_type); - } dissect_mmse(tvb, pinfo, tree, pdut, message_type); } @@ -687,10 +685,8 @@ dissect_mmse_encapsulated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_type = val_to_str(pdut, vals_message_type, "Unknown type %u"); /* Make entries in Info column on summary display */ - if (check_col(pinfo->cinfo, COL_INFO)) { col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "(MMS %s)", message_type); - } dissect_mmse(tvb, pinfo, tree, pdut, message_type); } diff --git a/epan/dissectors/packet-mount.c b/epan/dissectors/packet-mount.c index fa23916462..5a02d56e2f 100644 --- a/epan/dissectors/packet-mount.c +++ b/epan/dissectors/packet-mount.c @@ -142,12 +142,10 @@ dissect_fhstatus(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree break; default: /* void */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr( + col_append_fstr( pinfo->cinfo, COL_INFO, " Error:%s", val_to_str(status, mount3_mountstat3, "Unknown (0x%08X)")); - } break; } @@ -189,10 +187,7 @@ dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, } offset = dissect_rpc_string(tvb,tree,hf_mount_path,offset,&mountpoint); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO," %s", mountpoint); - } - + col_append_fstr(pinfo->cinfo, COL_INFO," %s", mountpoint); return offset; } @@ -530,12 +525,10 @@ dissect_mountstat3(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, int offs mountstat3 = tvb_get_ntohl(tvb, offset); if(mountstat3){ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr( + col_append_fstr( pinfo->cinfo, COL_INFO, " Error:%s", val_to_str(mountstat3, mount3_mountstat3, "Unknown (0x%08X)")); - } } offset = dissect_rpc_uint32(tvb,tree,hfindex,offset); diff --git a/epan/dissectors/packet-mpls-echo.c b/epan/dissectors/packet-mpls-echo.c index 85ec2bf8b9..8a2bf5e5e3 100644 --- a/epan/dissectors/packet-mpls-echo.c +++ b/epan/dissectors/packet-mpls-echo.c @@ -1705,9 +1705,8 @@ dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat return 0; } - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, - val_to_str(msgtype, mpls_echo_msgtype, "Unknown Message Type (0x%02X)")); + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(msgtype, mpls_echo_msgtype, "Unknown Message Type (0x%02X)")); if (tree) { diff --git a/epan/dissectors/packet-mpls-y1711.c b/epan/dissectors/packet-mpls-y1711.c index f4d356dfee..2d26544b3c 100644 --- a/epan/dissectors/packet-mpls-y1711.c +++ b/epan/dissectors/packet-mpls-y1711.c @@ -114,14 +114,12 @@ dissect_mpls_y1711(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da 0x00, 0x00, 0x00, 0x00, 0x00 }; functype = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " (Y.1711: %s)", - (functype == 0x01) ? "CV" : - (functype == 0x02) ? "FDI" : - (functype == 0x03) ? "BDI" : - (functype == 0x07) ? "FDD" : - "reserved/unknown"); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " (Y.1711: %s)", + (functype == 0x01) ? "CV" : + (functype == 0x02) ? "FDI" : + (functype == 0x03) ? "BDI" : + (functype == 0x07) ? "FDD" : + "reserved/unknown"); /* sanity checks */ if (tvb_reported_length(tvb) < 44) { diff --git a/epan/dissectors/packet-mq-pcf.c b/epan/dissectors/packet-mq-pcf.c index 425bc0cfa6..147999a8df 100644 --- a/epan/dissectors/packet-mq-pcf.c +++ b/epan/dissectors/packet-mq-pcf.c @@ -221,10 +221,7 @@ dissect_mqpcf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint iSizeMQCFH = 36; guint32 iCommand = tvb_get_guint32_endian(tvb, offset + 12, bLittleEndian); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_str(pinfo->cinfo, COL_INFO, val_to_str(iCommand, mqpcf_opcode_vals, "Unknown (0x%02x)")); - } + col_append_str(pinfo->cinfo, COL_INFO, val_to_str(iCommand, mqpcf_opcode_vals, "Unknown (0x%02x)")); if (tree) { diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c index 4ae68cc731..2067312f39 100644 --- a/epan/dissectors/packet-mq.c +++ b/epan/dissectors/packet-mq.c @@ -1129,14 +1129,11 @@ dissect_mq_gmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint int_rep if (iSizeGMO != 0 && tvb_length_remaining(tvb, offset) >= iSizeGMO) { - if (check_col(pinfo->cinfo, COL_INFO)) + guint8* sQueue; + sQueue = tvb_get_ephemeral_string_enc(tvb, offset + 24, 48, string_rep); + if (strip_trailing_blanks(sQueue, 48) != 0) { - guint8* sQueue; - sQueue = tvb_get_ephemeral_string_enc(tvb, offset + 24, 48, string_rep); - if (strip_trailing_blanks(sQueue, 48) != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " Q=%s", sQueue); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " Q=%s", sQueue); } if (tree) @@ -1199,20 +1196,17 @@ dissect_mq_pmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint int_rep { gint iNbrRecords = 0; guint32 iRecFlags = 0; + guint8* sQueue; if (iVersionPMO >= 2) { iNbrRecords = tvb_get_guint32_endian(tvb, offset + 128, int_rep); iRecFlags = tvb_get_guint32_endian(tvb, offset + 132, int_rep); } - if (check_col(pinfo->cinfo, COL_INFO)) + sQueue = tvb_get_ephemeral_string_enc(tvb, offset + 32, 48, string_rep); + if (strip_trailing_blanks(sQueue, 48) != 0) { - guint8* sQueue; - sQueue = tvb_get_ephemeral_string_enc(tvb, offset + 32, 48, string_rep); - if (strip_trailing_blanks(sQueue, 48) != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " Q=%s", sQueue); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " Q=%s", sQueue); } if (tree) @@ -1345,12 +1339,9 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int_rep = (tvb_get_guint8(tvb, offset + iSizeMultiplexFields + 8) == MQ_LITTLE_ENDIAN ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); iControlFlags = tvb_get_guint8(tvb, offset + iSizeMultiplexFields + 10); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_clear(pinfo->cinfo, COL_INFO); - col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", val_to_str_ext(opcode, &mq_opcode_vals_ext, "Unknown (0x%02x)")); - col_set_fence(pinfo->cinfo, COL_INFO); - } + col_clear(pinfo->cinfo, COL_INFO); + col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", val_to_str_ext(opcode, &mq_opcode_vals_ext, "Unknown (0x%02x)")); + col_set_fence(pinfo->cinfo, COL_INFO); if (tree) { @@ -1412,11 +1403,8 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint32 iReturnCode = 0; iReturnCode = tvb_get_guint32_endian(tvb, offset + 8, int_rep); - if (check_col(pinfo->cinfo, COL_INFO)) - { - if (iReturnCode != 0) - col_append_fstr(pinfo->cinfo, COL_INFO, " [RC=%d]", iReturnCode); - } + if (iReturnCode != 0) + col_append_fstr(pinfo->cinfo, COL_INFO, " [RC=%d]", iReturnCode); if (tree) { @@ -1459,11 +1447,9 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_length_remaining(tvb, offset) >= iStatusLength) { - if (check_col(pinfo->cinfo, COL_INFO)) - { - if (iStatus != 0) - col_append_fstr(pinfo->cinfo, COL_INFO, ": Code=%s", val_to_str(iStatus, mq_status_vals, "Unknown (0x%08x)")); - } + if (iStatus != 0) + col_append_fstr(pinfo->cinfo, COL_INFO, ": Code=%s", val_to_str(iStatus, mq_status_vals, "Unknown (0x%08x)")); + if (tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, 8, MQ_TEXT_STAT); @@ -1514,22 +1500,18 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (iSizeCONN != 0 && tvb_length_remaining(tvb, offset) >= iSizeCONN) { - if (check_col(pinfo->cinfo, COL_INFO)) + guint8* sApplicationName; + guint8* sQueueManager; + sApplicationName = tvb_get_ephemeral_string_enc(tvb, offset + 48, 28, string_rep); + if (strip_trailing_blanks(sApplicationName, 28) != 0) { - guint8* sApplicationName; - guint8* sQueueManager; - sApplicationName = tvb_get_ephemeral_string_enc(tvb, offset + 48, 28, string_rep); - if (strip_trailing_blanks(sApplicationName, 28) != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, ": App=%s", sApplicationName); - } - sQueueManager = tvb_get_ephemeral_string_enc(tvb, offset, 48, string_rep); - if (strip_trailing_blanks(sQueueManager, 48) != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " QM=%s", sQueueManager); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ": App=%s", sApplicationName); + } + sQueueManager = tvb_get_ephemeral_string_enc(tvb, offset, 48, string_rep); + if (strip_trailing_blanks(sQueueManager, 48) != 0) + { + col_append_fstr(pinfo->cinfo, COL_INFO, " QM=%s", sQueueManager); } - if (tree) { @@ -1616,10 +1598,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 iSpiVerb = 0; iSpiVerb = tvb_get_guint32_endian(tvb, offset, int_rep); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", val_to_str(iSpiVerb, mq_spi_verbs_vals, "Unknown (0x%08x)")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", val_to_str(iSpiVerb, mq_spi_verbs_vals, "Unknown (0x%08x)")); if (tree) { @@ -1865,14 +1844,11 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (iSizeID != 0 && tvb_length_remaining(tvb, offset) >= iSizeID) { - if (check_col(pinfo->cinfo, COL_INFO)) + guint8* sChannel; + sChannel = tvb_get_ephemeral_string_enc(tvb, offset + 24, 20, string_rep); + if (strip_trailing_blanks(sChannel, 20) != 0) { - guint8* sChannel; - sChannel = tvb_get_ephemeral_string_enc(tvb, offset + 24, 20, string_rep); - if (strip_trailing_blanks(sChannel, 20) != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, ": CHL=%s", sChannel); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ": CHL=%s", sChannel); } if (tree) @@ -1931,14 +1907,11 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (iVersionID >= 4) { - if (check_col(pinfo->cinfo, COL_INFO)) + guint8* sQueueManager; + sQueueManager = tvb_get_ephemeral_string_enc(tvb, offset + 48, 48, string_rep); + if (strip_trailing_blanks(sQueueManager,48) != 0) { - guint8* sQueueManager; - sQueueManager = tvb_get_ephemeral_string_enc(tvb, offset + 48, 48, string_rep); - if (strip_trailing_blanks(sQueueManager,48) != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " QM=%s", sQueueManager); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " QM=%s", sQueueManager); } if (tree) @@ -1965,14 +1938,11 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (iSizeUID != 0 && tvb_length_remaining(tvb, offset) >= iSizeUID) { - if (check_col(pinfo->cinfo, COL_INFO)) + guint8* sUserId; + sUserId = tvb_get_ephemeral_string_enc(tvb, offset + 4, 12, string_rep); + if (strip_trailing_blanks(sUserId, 12) != 0) { - guint8* sUserId; - sUserId = tvb_get_ephemeral_string_enc(tvb, offset + 4, 12, string_rep); - if (strip_trailing_blanks(sUserId, 12) != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, ": User=%s", sUserId); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ": User=%s", sUserId); } if (tree) @@ -2013,17 +1983,14 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (iSizeOD != 0 && tvb_length_remaining(tvb, offset) >= iSizeOD) { gint iNbrRecords = 0; + guint8* sQueue; if (iVersionOD >= 2) iNbrRecords = tvb_get_guint32_endian(tvb, offset + 168, int_rep); - if (check_col(pinfo->cinfo, COL_INFO)) + sQueue = tvb_get_ephemeral_string_enc(tvb, offset + 12, 48, string_rep); + if (strip_trailing_blanks(sQueue,48) != 0) { - guint8* sQueue; - sQueue = tvb_get_ephemeral_string_enc(tvb, offset + 12, 48, string_rep); - if (strip_trailing_blanks(sQueue,48) != 0) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " Obj=%s", sQueue); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " Obj=%s", sQueue); } if (tree) @@ -2122,8 +2089,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (iDistributionListSize > 0) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " (Distribution List, Size=%d)", iDistributionListSize); + col_append_fstr(pinfo->cinfo, COL_INFO, " (Distribution List, Size=%d)", iDistributionListSize); } if (bPayload == TRUE) { @@ -2333,10 +2299,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) PROTO_ITEM_SET_HIDDEN(hidden_item); } } - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, " (%d bytes)", iSizePayload - iHeadersLength); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " (%d bytes)", iSizePayload - iHeadersLength); { /* Call subdissector for the payload */ @@ -2449,8 +2412,7 @@ reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Reassembly in progress */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MQ"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s [Reassembled MQ]", val_to_str(opcode, mq_opcode_vals, "Unknown (0x%02x)")); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s [Reassembled MQ]", val_to_str(opcode, mq_opcode_vals, "Unknown (0x%02x)")); if (tree) { proto_item* ti = NULL; diff --git a/epan/dissectors/packet-mrdisc.c b/epan/dissectors/packet-mrdisc.c index bf1fc86d9d..260cbd37cd 100644 --- a/epan/dissectors/packet-mrdisc.c +++ b/epan/dissectors/packet-mrdisc.c @@ -204,11 +204,9 @@ dissect_mrdisc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int o 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(type, mrdisc_types, "Unknown Type:0x%02x")); - } /* type of command */ proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type); diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c index 6791f63083..b697457602 100644 --- a/epan/dissectors/packet-msdp.c +++ b/epan/dissectors/packet-msdp.c @@ -181,8 +181,7 @@ dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSDP"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(tvb, 0), + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(tvb, 0), msdp_types, "<Unknown MSDP message type>")); diff --git a/epan/dissectors/packet-msn-messenger.c b/epan/dissectors/packet-msn-messenger.c index 5b1450f8d4..a89dd4688d 100644 --- a/epan/dissectors/packet-msn-messenger.c +++ b/epan/dissectors/packet-msn-messenger.c @@ -84,13 +84,11 @@ dissect_msnms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) line = tvb_get_ptr(tvb, offset, linelen); - if (check_col(pinfo->cinfo, COL_INFO)) { - /* - * Put the first line from the buffer into the summary. - */ - col_add_str(pinfo->cinfo, COL_INFO, + /* + * Put the first line from the buffer into the summary. + */ + col_add_str(pinfo->cinfo, COL_INFO, format_text(line, linelen)); - } if (tree) { ti = proto_tree_add_item(tree, proto_msnms, tvb, offset, -1, diff --git a/epan/dissectors/packet-msnip.c b/epan/dissectors/packet-msnip.c index d934c14f0b..6632e75170 100644 --- a/epan/dissectors/packet-msnip.c +++ b/epan/dissectors/packet-msnip.c @@ -234,11 +234,9 @@ dissect_msnip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int of 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(type, msnip_types, "Unknown Type:0x%02x")); - } /* type of command */ proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type); diff --git a/epan/dissectors/packet-msproxy.c b/epan/dissectors/packet-msproxy.c index c0dbb7970e..36c7c9e6a2 100644 --- a/epan/dissectors/packet-msproxy.c +++ b/epan/dissectors/packet-msproxy.c @@ -214,8 +214,7 @@ static void msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo, col_set_str(pinfo->cinfo, COL_PROTOCOL, "MS Proxy"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_set_str(pinfo->cinfo, COL_INFO, + col_set_str(pinfo->cinfo, COL_INFO, (( redirect_info->proto == PT_TCP) ? "TCP stream" : "UDP packets")); @@ -1075,7 +1074,7 @@ static void dissect_msproxy_response(tvbuff_t *tvb, packet_info *pinfo, static void dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *msproxy_tree = NULL; + proto_tree *msproxy_tree; proto_item *ti; unsigned int cmd; @@ -1095,25 +1094,17 @@ static void dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hash_info); } - if (check_col(pinfo->cinfo, COL_INFO)){ + cmd = tvb_get_ntohs( tvb, 36); - cmd = tvb_get_ntohs( tvb, 36); - - if ( pinfo->srcport == UDP_PORT_MSPROXY) - col_add_fstr( pinfo->cinfo, COL_INFO, "Server message: %s", - get_msproxy_cmd_name( cmd, FROM_SERVER)); - else - col_add_fstr(pinfo->cinfo, COL_INFO, "Client message: %s", - get_msproxy_cmd_name( cmd, FROM_CLIENT)); - - } - - if (tree) { /* if proto tree, decode data */ - ti = proto_tree_add_item( tree, proto_msproxy, tvb, 0, -1, - ENC_NA ); + if ( pinfo->srcport == UDP_PORT_MSPROXY) + col_add_fstr( pinfo->cinfo, COL_INFO, "Server message: %s", + get_msproxy_cmd_name( cmd, FROM_SERVER)); + else + col_add_fstr(pinfo->cinfo, COL_INFO, "Client message: %s", + get_msproxy_cmd_name( cmd, FROM_CLIENT)); - msproxy_tree = proto_item_add_subtree(ti, ett_msproxy); - } + ti = proto_tree_add_item( tree, proto_msproxy, tvb, 0, -1, ENC_NA ); + msproxy_tree = proto_item_add_subtree(ti, ett_msproxy); if ( pinfo->srcport == UDP_PORT_MSPROXY) dissect_msproxy_response( tvb, pinfo, msproxy_tree, hash_info); diff --git a/epan/dissectors/packet-mstp.c b/epan/dissectors/packet-mstp.c index 2adac4d60e..56a1e4f6bd 100644 --- a/epan/dissectors/packet-mstp.c +++ b/epan/dissectors/packet-mstp.c @@ -175,10 +175,9 @@ dissect_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_set_str(pinfo->cinfo, COL_INFO, "BACnet MS/TP"); mstp_frame_type = tvb_get_guint8(tvb, offset); mstp_frame_pdu_len = tvb_get_ntohs(tvb, offset+3); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", mstp_frame_type_text(mstp_frame_type)); - } + /* Add the items to the tree */ proto_tree_add_item(subtree, hf_mstp_frame_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c index d87efe9fba..bae91ad2ba 100644 --- a/epan/dissectors/packet-mysql.c +++ b/epan/dissectors/packet-mysql.c @@ -840,23 +840,19 @@ mysql_dissect_greeting(tvbuff_t *tvb, packet_info *pinfo, int offset, conn_data->state= LOGIN; - if (tree) { - tf = proto_tree_add_item(tree, hf_mysql_server_greeting, tvb, offset, -1, ENC_NA); - greeting_tree = proto_item_add_subtree(tf, ett_server_greeting); - } + tf = proto_tree_add_item(tree, hf_mysql_server_greeting, tvb, offset, -1, ENC_NA); + greeting_tree = proto_item_add_subtree(tf, ett_server_greeting); + + col_append_fstr(pinfo->cinfo, COL_INFO, " proto=%d", protocol) ; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " proto=%d", protocol) ; - } proto_tree_add_item(greeting_tree, hf_mysql_protocol, tvb, offset, 1, ENC_NA); offset += 1; /* version string */ lenstr = tvb_strsize(tvb,offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " version=%s", tvb_get_ephemeral_string(tvb, offset, lenstr)); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " version=%s", tvb_get_ephemeral_string(tvb, offset, lenstr)); + proto_tree_add_item(greeting_tree, hf_mysql_version, tvb, offset, lenstr, ENC_ASCII|ENC_NA); conn_data->major_version = 0; for (ver_offset = 0; ver_offset < lenstr; ver_offset++) { @@ -942,9 +938,7 @@ mysql_dissect_login(tvbuff_t *tvb, packet_info *pinfo, int offset, /* User name */ lenstr = my_tvb_strsize(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " user=%s", tvb_get_ephemeral_string(tvb, offset, lenstr)); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " user=%s", tvb_get_ephemeral_string(tvb, offset, lenstr)); proto_tree_add_item(login_tree, hf_mysql_user, tvb, offset, lenstr, ENC_ASCII|ENC_NA); offset += lenstr; @@ -971,9 +965,8 @@ mysql_dissect_login(tvbuff_t *tvb, packet_info *pinfo, int offset, return offset; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " db=%s", tvb_get_ephemeral_string(tvb, offset, lenstr)); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " db=%s", tvb_get_ephemeral_string(tvb, offset, lenstr)); + proto_tree_add_item(login_tree, hf_mysql_schema, tvb, offset, lenstr, ENC_ASCII|ENC_NA); offset += lenstr; } @@ -1182,9 +1175,8 @@ mysql_dissect_request(tvbuff_t *tvb,packet_info *pinfo, int offset, } opcode = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(opcode, mysql_command_vals, "Unknown (%u)")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(opcode, mysql_command_vals, "Unknown (%u)")); + proto_tree_add_item(req_tree, hf_mysql_command, tvb, offset, 1, ENC_NA); proto_item_append_text(tf, " %s", val_to_str(opcode, mysql_command_vals, "Unknown (%u)")); offset += 1; @@ -1221,8 +1213,7 @@ mysql_dissect_request(tvbuff_t *tvb,packet_info *pinfo, int offset, lenstr = my_tvb_strsize(tvb, offset); proto_tree_add_item(req_tree, hf_mysql_query, tvb, offset, lenstr, ENC_ASCII|ENC_NA); if (mysql_showquery) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " { %s } ", tvb_get_ephemeral_string(tvb, offset, lenstr)); + col_append_fstr(pinfo->cinfo, COL_INFO, " { %s } ", tvb_get_ephemeral_string(tvb, offset, lenstr)); } offset += lenstr; conn_data->state = RESPONSE_TABULAR; @@ -1546,9 +1537,8 @@ static int mysql_dissect_error_packet(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " Error %d", tvb_get_letohs(tvb, offset)); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " Error %d", tvb_get_letohs(tvb, offset)); + proto_tree_add_item(tree, hf_mysql_error_code, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; diff --git a/epan/dissectors/packet-nasdaq-soup.c b/epan/dissectors/packet-nasdaq-soup.c index a8f0d90f5b..03095dc94c 100644 --- a/epan/dissectors/packet-nasdaq-soup.c +++ b/epan/dissectors/packet-nasdaq-soup.c @@ -157,10 +157,8 @@ dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int linelen; gint next_offset; int offset = 0; - gint col_info; gint counter = 0; - col_info = check_col(pinfo->cinfo, COL_INFO); while (tvb_offset_exists(tvb, offset)) { /* there's only a \n no \r */ linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, nasdaq_soup_desegment && pinfo->can_desegment); @@ -180,21 +178,18 @@ dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) nasdaq_soup_type = tvb_get_guint8(tvb, offset); if (counter == 0) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "Nasdaq-SOUP"); - if (col_info) - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); } - if (col_info ) { - if (counter) { - col_append_str(pinfo->cinfo, COL_INFO, "; "); - col_set_fence(pinfo->cinfo, COL_INFO); - } - col_append_str(pinfo->cinfo, COL_INFO, val_to_str(nasdaq_soup_type, message_types_val, "Unknown packet type (0x%02x)")); + if (counter) { + col_append_str(pinfo->cinfo, COL_INFO, "; "); + col_set_fence(pinfo->cinfo, COL_INFO); } + col_append_str(pinfo->cinfo, COL_INFO, val_to_str(nasdaq_soup_type, message_types_val, "Unknown packet type (0x%02x)")); + counter++; - if (tree) { - ti = proto_tree_add_item(tree, proto_nasdaq_soup, tvb, offset, linelen +1, ENC_NA); - nasdaq_soup_tree = proto_item_add_subtree(ti, ett_nasdaq_soup); - } + ti = proto_tree_add_item(tree, proto_nasdaq_soup, tvb, offset, linelen +1, ENC_NA); + nasdaq_soup_tree = proto_item_add_subtree(ti, ett_nasdaq_soup); + dissect_nasdaq_soup_packet(tvb, pinfo, tree, nasdaq_soup_tree, offset, linelen); offset = next_offset; } diff --git a/epan/dissectors/packet-nbd.c b/epan/dissectors/packet-nbd.c index 3ca16d287a..ccc6e64f1f 100644 --- a/epan/dissectors/packet-nbd.c +++ b/epan/dissectors/packet-nbd.c @@ -332,18 +332,16 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_item(tree, hf_nbd_len, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; - if(check_col(pinfo->cinfo, COL_INFO)){ - switch(nbd_trans->type){ - case NBD_CMD_WRITE: - col_add_fstr(pinfo->cinfo, COL_INFO, "Write Request Offset:0x%" G_GINT64_MODIFIER "x Length:%d", from, nbd_trans->datalen); - break; - case NBD_CMD_READ: - col_add_fstr(pinfo->cinfo, COL_INFO, "Read Request Offset:0x%" G_GINT64_MODIFIER "x Length:%d", from, nbd_trans->datalen); - break; - case NBD_CMD_DISC: - col_set_str(pinfo->cinfo, COL_INFO, "Disconnect Request"); - break; - } + switch(nbd_trans->type){ + case NBD_CMD_WRITE: + col_add_fstr(pinfo->cinfo, COL_INFO, "Write Request Offset:0x%" G_GINT64_MODIFIER "x Length:%d", from, nbd_trans->datalen); + break; + case NBD_CMD_READ: + col_add_fstr(pinfo->cinfo, COL_INFO, "Read Request Offset:0x%" G_GINT64_MODIFIER "x Length:%d", from, nbd_trans->datalen); + break; + case NBD_CMD_DISC: + col_set_str(pinfo->cinfo, COL_INFO, "Disconnect Request"); + break; } if(nbd_trans->type==NBD_CMD_WRITE){ @@ -361,9 +359,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_item(tree, hf_nbd_handle, tvb, offset, 8, ENC_BIG_ENDIAN); offset+=8; - if(check_col(pinfo->cinfo, COL_INFO)){ - col_add_fstr(pinfo->cinfo, COL_INFO, "%s Response Error:%d", (nbd_trans->type==NBD_CMD_WRITE)?"Write":"Read", error); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Response Error:%d", (nbd_trans->type==NBD_CMD_WRITE)?"Write":"Read", error); if(nbd_trans->type==NBD_CMD_READ){ proto_tree_add_item(tree, hf_nbd_data, tvb, offset, nbd_trans->datalen, ENC_NA); diff --git a/epan/dissectors/packet-nbipx.c b/epan/dissectors/packet-nbipx.c index e83e87abc5..0e2923146e 100644 --- a/epan/dissectors/packet-nbipx.c +++ b/epan/dissectors/packet-nbipx.c @@ -300,11 +300,10 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case NBIPX_NAME_IN_USE: case NBIPX_DEREGISTER_NAME: name_type = get_netbios_name(tvb, offset+2, name, (NETBIOS_NAME_LEN - 1)*4 + 1); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s<%02x>", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s<%02x>", val_to_str_const(packet_type, nbipx_data_stream_type_vals, "Unknown"), name, name_type); - } + if (nbipx_tree) { tf = proto_tree_add_item(nbipx_tree, hf_nbipx_name_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN); name_type_flag_tree = proto_item_add_subtree(tf, ett_nbipx_name_type_flags); @@ -333,10 +332,9 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case NBIPX_SESSION_DATA: case NBIPX_SESSION_END: case NBIPX_SESSION_END_ACK: - 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(packet_type, nbipx_data_stream_type_vals, "Unknown")); - } + dissect_conn_control(tvb, offset, nbipx_tree); offset += 1; @@ -374,10 +372,9 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case NBIPX_DIRECTED_DATAGRAM: - 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(packet_type, nbipx_data_stream_type_vals, "Unknown")); - } + dissect_conn_control(tvb, offset, nbipx_tree); offset += 1; @@ -401,10 +398,8 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - 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(packet_type, nbipx_data_stream_type_vals, "Unknown")); - } /* * We don't know what the first byte is. @@ -739,55 +734,53 @@ dissect_nmpi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) name_type = get_netbios_name(tvb, offset+4, name, (NETBIOS_NAME_LEN - 1)*4 + 1); /*node_name_type = */get_netbios_name(tvb, offset+20, node_name, (NETBIOS_NAME_LEN - 1)*4 + 1); - if (check_col(pinfo->cinfo, COL_INFO)) { - switch (opcode) { + switch (opcode) { - case INAME_CLAIM: - col_add_fstr(pinfo->cinfo, COL_INFO, "Claim name %s<%02x>", + case INAME_CLAIM: + col_add_fstr(pinfo->cinfo, COL_INFO, "Claim name %s<%02x>", name, name_type); - break; + break; - case INAME_DELETE: - col_add_fstr(pinfo->cinfo, COL_INFO, "Delete name %s<%02x>", + case INAME_DELETE: + col_add_fstr(pinfo->cinfo, COL_INFO, "Delete name %s<%02x>", name, name_type); - break; + break; - case INAME_QUERY: - col_add_fstr(pinfo->cinfo, COL_INFO, "Query name %s<%02x>", + case INAME_QUERY: + col_add_fstr(pinfo->cinfo, COL_INFO, "Query name %s<%02x>", name, name_type); - break; + break; - case INAME_FOUND: - col_add_fstr(pinfo->cinfo, COL_INFO, "Name %s<%02x> found", + case INAME_FOUND: + col_add_fstr(pinfo->cinfo, COL_INFO, "Name %s<%02x> found", name, name_type); - break; + break; - case IMSG_HANGUP: - col_add_fstr(pinfo->cinfo, COL_INFO, + case IMSG_HANGUP: + col_add_fstr(pinfo->cinfo, COL_INFO, "Messenger hangup on %s<%02x>", name, name_type); - break; + break; - case IMSLOT_SEND: - col_add_fstr(pinfo->cinfo, COL_INFO, + case IMSLOT_SEND: + col_add_fstr(pinfo->cinfo, COL_INFO, "Mailslot write to %s<%02x>", name, name_type); - break; + break; - case IMSLOT_FIND: - col_add_fstr(pinfo->cinfo, COL_INFO, + case IMSLOT_FIND: + col_add_fstr(pinfo->cinfo, COL_INFO, "Find mailslot name %s<%02x>", name, name_type); - break; + break; - case IMSLOT_NAME: - col_add_fstr(pinfo->cinfo, COL_INFO, + case IMSLOT_NAME: + col_add_fstr(pinfo->cinfo, COL_INFO, "Mailslot name %s<%02x> found", name, name_type); - break; + break; - default: - col_add_fstr(pinfo->cinfo, COL_INFO, + default: + col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown NMPI op 0x%02x: name %s<%02x>", opcode, name, name_type); - break; - } + break; } if (tree) { diff --git a/epan/dissectors/packet-ncp-nmas.c b/epan/dissectors/packet-ncp-nmas.c index ab3f07c827..5849b47a98 100644 --- a/epan/dissectors/packet-ncp-nmas.c +++ b/epan/dissectors/packet-ncp-nmas.c @@ -300,10 +300,9 @@ dissect_nmas_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, nc /* Fill in the INFO column. */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NMAS"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "C NMAS - %s", - val_to_str(subfunc, nmas_func_enum, "Unknown (0x%02x)")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "C NMAS - %s", + val_to_str(subfunc, nmas_func_enum, "Unknown (0x%02x)")); + aitem = proto_tree_add_text(ncp_tree, tvb, foffset, -1, "Packet Type: %s", val_to_str(subfunc, nmas_func_enum, "Unknown (0x%02x)")); atree = proto_item_add_subtree(aitem, ett_nmas); @@ -334,10 +333,8 @@ dissect_nmas_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, nc } foffset += 4; msg_length -= 4; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", - val_to_str(subverb, nmas_subverb_enum, "Unknown subverb (%u)")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + val_to_str(subverb, nmas_subverb_enum, "Unknown subverb (%u)")); switch (subverb) { case 0: /* Fragmented Ping */ proto_tree_add_item(atree, hf_ping_version, tvb, foffset, 4, ENC_LITTLE_ENDIAN); @@ -362,10 +359,9 @@ dissect_nmas_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, nc } proto_tree_add_item(atree, hf_lsm_verb, tvb, foffset, 1, ENC_LITTLE_ENDIAN); foffset += 4; - 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(msgverb, nmas_lsmverb_enum, "Unknown (%u)")); - } + switch (msgverb) { case 1: @@ -404,10 +400,9 @@ dissect_nmas_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, nc proto_tree_add_item(atree, hf_msg_verb, tvb, foffset, 1, ENC_BIG_ENDIAN); foffset += 1; msg_length -= 12; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", - val_to_str(msgverb, nmas_msgverb_enum, "Unknown (%u)")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + val_to_str(msgverb, nmas_msgverb_enum, "Unknown (%u)")); + switch(msgverb) { case 1: @@ -634,9 +629,7 @@ dissect_nmas_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guin { expert_item = proto_tree_add_item(atree, hf_return_code, tvb, roffset, 4, ENC_LITTLE_ENDIAN); expert_add_info_format_text(pinfo, expert_item, &ei_return_error, "NMAS Error: 0x%08x is unknown", return_code); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "R Unknown NMAS Error - 0x%08x", return_code); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "R Unknown NMAS Error - 0x%08x", return_code); } } diff --git a/epan/dissectors/packet-ncp-sss.c b/epan/dissectors/packet-ncp-sss.c index dfadd074ed..bb8cfa66a8 100644 --- a/epan/dissectors/packet-ncp-sss.c +++ b/epan/dissectors/packet-ncp-sss.c @@ -540,9 +540,8 @@ dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp /* Fill in the PROTOCOL & INFO columns. */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NSSS"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "C SecretStore - %s", val_to_str(subfunc, sss_func_enum, "Unknown (%d)")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "C SecretStore - %s", val_to_str(subfunc, sss_func_enum, "Unknown (%d)")); + switch (subfunc) { case 1: aitem = proto_tree_add_text(ncp_tree, tvb, foffset, tvb_length_remaining(tvb, foffset), "Packet Type: %s", val_to_str(subfunc, sss_func_enum, "Unknown (%d)")); @@ -563,9 +562,8 @@ dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp foffset += 4; foffset += 12; /* Blank Context */ subverb = tvb_get_letohl(tvb, foffset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(subverb, sss_verb_enum, "Unknown (%d)")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(subverb, sss_verb_enum, "Unknown (%d)")); + aitem = proto_tree_add_item(ncp_tree, hf_verb, tvb, foffset, 4, ENC_LITTLE_ENDIAN); atree = proto_item_add_subtree(aitem, ett_sss); if (request_value) { @@ -642,10 +640,9 @@ dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp } else { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, "C SecretStore - fragment"); - proto_tree_add_text(ncp_tree, tvb, foffset, 4, "Fragment"); - } + col_set_str(pinfo->cinfo, COL_INFO, "C SecretStore - fragment"); + proto_tree_add_text(ncp_tree, tvb, foffset, 4, "Fragment"); + /* Fragments don't really carry a subverb so store 0xff as the subverb number */ if (request_value) { request_value->req_nds_flags=255; diff --git a/epan/dissectors/packet-ncp.c b/epan/dissectors/packet-ncp.c index 9f77a3fc8d..248523f961 100644 --- a/epan/dissectors/packet-ncp.c +++ b/epan/dissectors/packet-ncp.c @@ -460,10 +460,8 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tap_queue_packet(ncp_tap.hdr, pinfo, ncp_hdr); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, - val_to_str(header.type, ncp_type_vals, "Unknown type (0x%04x)")); - } + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(header.type, ncp_type_vals, "Unknown type (0x%04x)")); /* * Process the packet-type-specific header. @@ -643,13 +641,11 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 4; data_len -= 4; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s %d bytes starting at offset %d in file 0x%08x", - val_to_str(ncp_burst_command, - burst_command, "Unknown (0x%08x)"), - burst_len, burst_off, burst_file); - } + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s %d bytes starting at offset %d in file 0x%08x", + val_to_str(ncp_burst_command, + burst_command, "Unknown (0x%08x)"), + burst_len, burst_off, burst_file); break; } else { if (tvb_get_guint8(tvb, commhdr + 2) & 0x10) { diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c index 5b51fac8e4..28b28b9477 100644 --- a/epan/dissectors/packet-ndmp.c +++ b/epan/dissectors/packet-ndmp.c @@ -661,7 +661,7 @@ dissect_error(tvbuff_t *tvb, int offset, packet_info *pinfo, /* error */ err=tvb_get_ntohl(tvb, offset); proto_tree_add_item(tree, hf_ndmp_error, tvb, offset, 4, ENC_BIG_ENDIAN); - if(err && check_col(pinfo->cinfo, COL_INFO)) { + if(err) { col_append_fstr(pinfo->cinfo, COL_INFO, " NDMP Error:%s ", val_to_str(err, error_vals, @@ -2387,17 +2387,13 @@ dissect_file_name(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *par /* file */ offset = dissect_rpc_string(tvb, tree, hf_ndmp_file_name, offset, &name); - if (check_col(pinfo->cinfo, COL_INFO)){ - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); break; case NDMP_FS_NT: /* nt file */ offset = dissect_rpc_string(tvb, tree, hf_ndmp_nt_file_name, offset, &name); - if (check_col(pinfo->cinfo, COL_INFO)){ - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); /* dos file */ offset = dissect_rpc_string(tvb, tree, @@ -2407,15 +2403,11 @@ dissect_file_name(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *par /* file */ offset = dissect_rpc_string(tvb, tree, hf_ndmp_file_name, offset, &name); - if (check_col(pinfo->cinfo, COL_INFO)){ - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); } - 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_const(type, file_fs_type_vals, "Unknown type") ); - } proto_item_set_len(item, offset-old_offset); return offset; @@ -3031,12 +3023,10 @@ dissect_ndmp_header(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *p /* error */ offset=dissect_error(tvb, offset, pinfo, tree, nh->seq); - if (check_col(pinfo->cinfo, COL_INFO)){ - col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s ", + col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s ", val_to_str(nh->msg, msg_vals, "Unknown Message (0x%02x)"), val_to_str(nh->type, msg_type_vals, "Unknown Type (0x%02x)") ); - } return offset; } @@ -3266,10 +3256,8 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDMP"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_clear(pinfo->cinfo, COL_INFO); - col_append_fstr(pinfo->cinfo, COL_INFO, "[NDMP fragment] "); - } + col_clear(pinfo->cinfo, COL_INFO); + col_append_fstr(pinfo->cinfo, COL_INFO, "[NDMP fragment] "); /* * Add the record marker information to the tree diff --git a/epan/dissectors/packet-ndp.c b/epan/dissectors/packet-ndp.c index f62b341d5b..752eddb042 100644 --- a/epan/dissectors/packet-ndp.c +++ b/epan/dissectors/packet-ndp.c @@ -276,25 +276,22 @@ dissect_ndp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDP"); - if (check_col(pinfo->cinfo, COL_INFO)) { - hello_type = ""; - if (pinfo->dl_dst.type == AT_ETHER) { - const guint8 *dstmac = (const guint8 *)pinfo->dl_dst.data; + hello_type = ""; + if (pinfo->dl_dst.type == AT_ETHER) { + const guint8 *dstmac = (const guint8 *)pinfo->dl_dst.data; - switch (dstmac[5]) { + switch (dstmac[5]) { - case 0: - hello_type = "Segment "; - break; + case 0: + hello_type = "Segment "; + break; - case 1: - hello_type = "FlatNet "; - break; - } + case 1: + hello_type = "FlatNet "; + break; } - col_add_fstr(pinfo->cinfo, COL_INFO, "%sHello", - hello_type); } + col_add_fstr(pinfo->cinfo, COL_INFO, "%sHello", hello_type); if (tree) { ti = proto_tree_add_protocol_format(tree, proto_ndp, tvb, 0, 11, diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c index 63e416a555..7c404bf7ae 100644 --- a/epan/dissectors/packet-ndps.c +++ b/epan/dissectors/packet-ndps.c @@ -4231,11 +4231,9 @@ dissect_ndps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree) { proto_tree_add_item(ndps_tree, hf_spx_ndps_program, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_str(pinfo->cinfo, COL_INFO, (const gchar*) ndps_program_string); - col_append_str(pinfo->cinfo, COL_INFO, ", "); - } + col_append_str(pinfo->cinfo, COL_INFO, (const gchar*) ndps_program_string); + col_append_str(pinfo->cinfo, COL_INFO, ", "); + proto_tree_add_item(ndps_tree, hf_spx_ndps_version, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; ndps_func = tvb_get_ntohl(tvb, foffset); @@ -4275,8 +4273,7 @@ dissect_ndps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree) proto_tree_add_item(ndps_tree, ndps_hfname, tvb, foffset, 4, ENC_BIG_ENDIAN); if (ndps_func_string != NULL) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_str(pinfo->cinfo, COL_INFO, (const gchar*) ndps_func_string); + col_append_str(pinfo->cinfo, COL_INFO, (const gchar*) ndps_func_string); foffset += 4; proto_tree_add_item(ndps_tree, hf_ndps_auth_null, tvb, foffset, 16, ENC_NA); @@ -4426,25 +4423,20 @@ ndps_defrag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* This is either a beggining or middle fragment on second dissection */ next_tvb = tvb_new_subset_remaining(tvb, 0); - if (check_col(pinfo->cinfo, COL_INFO)) + if (!spx_info_p->eom) { - if (!spx_info_p->eom) - { - col_append_str(pinfo->cinfo, COL_INFO, "[NDPS Fragment]"); - } + col_append_str(pinfo->cinfo, COL_INFO, "[NDPS Fragment]"); } } } else { /* Fragment from first pass of dissection */ - if (check_col(pinfo->cinfo, COL_INFO)) + if (!spx_info_p->eom) { - if (!spx_info_p->eom) - { - col_append_str(pinfo->cinfo, COL_INFO, "[NDPS Fragment]"); - } + col_append_str(pinfo->cinfo, COL_INFO, "[NDPS Fragment]"); } + next_tvb = NULL; } } @@ -6940,7 +6932,7 @@ return_code(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffse expert_add_info_format_text(pinfo, expert_item, &ei_ndps_return_code, "Fault: %s", val_to_str(expert_status, ndps_error_types, "Unknown NDPS Error (0x%08x)")); } foffset += 4; - if (check_col(pinfo->cinfo, COL_INFO) && tvb_get_ntohl(tvb, foffset-4) != 0) + if (tvb_get_ntohl(tvb, foffset-4) != 0) col_set_str(pinfo->cinfo, COL_INFO, "R NDPS - Error"); if (tvb_get_ntohl(tvb, foffset-4) == 0) { @@ -7955,7 +7947,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int case 0x00000005: /* List Resources */ proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (check_col(pinfo->cinfo, COL_INFO) && tvb_get_ntohl(tvb, foffset-4) != 0) + if (tvb_get_ntohl(tvb, foffset-4) != 0) col_set_str(pinfo->cinfo, COL_INFO, "R NDPS - Error"); if (tvb_get_ntohl(tvb, foffset-4) != 0) { @@ -8209,7 +8201,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int case 0x00000006: /* Get Resource File */ proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (check_col(pinfo->cinfo, COL_INFO) && tvb_get_ntohl(tvb, foffset-4) != 0) + if (tvb_get_ntohl(tvb, foffset-4) != 0) col_set_str(pinfo->cinfo, COL_INFO, "R NDPS - Error"); if (tvb_get_ntohl(tvb, foffset-4) != 0) { @@ -8224,7 +8216,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int case 0x00000007: /* Get Resource File Date */ proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (check_col(pinfo->cinfo, COL_INFO) && tvb_get_ntohl(tvb, foffset-4) != 0) + if (tvb_get_ntohl(tvb, foffset-4) != 0) col_set_str(pinfo->cinfo, COL_INFO, "R NDPS - Error"); if (tvb_get_ntohl(tvb, foffset-4) != 0) { @@ -8248,7 +8240,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int case 0x0000000a: /* Set Resource Language Context */ proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (check_col(pinfo->cinfo, COL_INFO) && tvb_get_ntohl(tvb, foffset-4) != 0) + if (tvb_get_ntohl(tvb, foffset-4) != 0) col_set_str(pinfo->cinfo, COL_INFO, "R NDPS - Error"); if (tvb_get_ntohl(tvb, foffset-4) != 0) { @@ -8267,7 +8259,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int case 0x00000001: /* Delivery Bind */ proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (check_col(pinfo->cinfo, COL_INFO) && tvb_get_ntohl(tvb, foffset-4) != 0) + if (tvb_get_ntohl(tvb, foffset-4) != 0) col_set_str(pinfo->cinfo, COL_INFO, "R NDPS - Error"); break; case 0x00000002: /* Delivery Unbind */ @@ -8277,7 +8269,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int case 0x00000004: /* Delivery Send2 */ proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (check_col(pinfo->cinfo, COL_INFO) && tvb_get_ntohl(tvb, foffset-4) != 0) + if (tvb_get_ntohl(tvb, foffset-4) != 0) col_set_str(pinfo->cinfo, COL_INFO, "R NDPS - Error"); if (tvb_get_ntohl(tvb, foffset-4) != 0) { diff --git a/epan/dissectors/packet-netbios.c b/epan/dissectors/packet-netbios.c index abaf5f80b7..e774e7c91f 100644 --- a/epan/dissectors/packet-netbios.c +++ b/epan/dissectors/packet-netbios.c @@ -1099,28 +1099,24 @@ dissect_netbios(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* limit command so no table overflows */ command = MIN( command, sizeof( dissect_netb)/ sizeof(void *)); - if (check_col( pinfo->cinfo, COL_INFO)) { /* print command name */ - command_name = val_to_str(command, cmd_vals, "Unknown (0x%02x)"); - switch ( command ) { - case NB_NAME_QUERY: - name_type = get_netbios_name( tvb, offset + 12, name, (NETBIOS_NAME_LEN - 1)*4 + 1); - col_add_fstr( pinfo->cinfo, COL_INFO, "%s for %s<%02x>", - command_name, name, name_type); - break; - - case NB_NAME_RESP: - case NB_ADD_NAME: - case NB_ADD_GROUP: - name_type = get_netbios_name( tvb, offset + 28, name, (NETBIOS_NAME_LEN - 1)*4 + 1); - col_add_fstr( pinfo->cinfo, COL_INFO, "%s - %s<%02x>", - command_name, name, name_type); - break; + /* print command name */ + command_name = val_to_str(command, cmd_vals, "Unknown (0x%02x)"); + switch ( command ) { + case NB_NAME_QUERY: + name_type = get_netbios_name( tvb, offset + 12, name, (NETBIOS_NAME_LEN - 1)*4 + 1); + col_add_fstr( pinfo->cinfo, COL_INFO, "%s for %s<%02x>", command_name, name, name_type); + break; + + case NB_NAME_RESP: + case NB_ADD_NAME: + case NB_ADD_GROUP: + name_type = get_netbios_name( tvb, offset + 28, name, (NETBIOS_NAME_LEN - 1)*4 + 1); + col_add_fstr( pinfo->cinfo, COL_INFO, "%s - %s<%02x>", command_name, name, name_type); + break; default: - col_add_str( pinfo->cinfo, COL_INFO, - command_name); + col_add_str( pinfo->cinfo, COL_INFO, command_name); break; - } } if ( tree) { diff --git a/epan/dissectors/packet-netflow.c b/epan/dissectors/packet-netflow.c index 6d454d6103..f9a3d80e74 100644 --- a/epan/dissectors/packet-netflow.c +++ b/epan/dissectors/packet-netflow.c @@ -1664,25 +1664,23 @@ dissect_netflow(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* * set something interesting in the display now that we have info */ - if (check_col(pinfo->cinfo, COL_INFO)) { - if (ver == 9) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "total: %u (v%u) record%s", pdus, ver, - plurality(pdus, "", "s")); - } else if (ver == 10) { - gint remaining = tvb_reported_length_remaining(tvb, offset)+4; - - if(remaining == flow_len) - col_add_fstr(pinfo->cinfo, COL_INFO, "IPFIX flow (%d bytes)", flow_len); - else - col_add_fstr(pinfo->cinfo, COL_INFO, - "IPFIX partial flow (%u/%u bytes)", - remaining, flow_len); - } else { + if (ver == 9) { + col_add_fstr(pinfo->cinfo, COL_INFO, + "total: %u (v%u) record%s", pdus, ver, + plurality(pdus, "", "s")); + } else if (ver == 10) { + gint remaining = tvb_reported_length_remaining(tvb, offset)+4; + + if(remaining == flow_len) + col_add_fstr(pinfo->cinfo, COL_INFO, "IPFIX flow (%d bytes)", flow_len); + else col_add_fstr(pinfo->cinfo, COL_INFO, - "total: %u (v%u) flow%s", pdus, ver, - plurality(pdus, "", "s")); - } + "IPFIX partial flow (%u/%u bytes)", + remaining, flow_len); + } else { + col_add_fstr(pinfo->cinfo, COL_INFO, + "total: %u (v%u) flow%s", pdus, ver, + plurality(pdus, "", "s")); } /* diff --git a/epan/dissectors/packet-netperfmeter.c b/epan/dissectors/packet-netperfmeter.c index 269b7ac86d..c8ff627943 100644 --- a/epan/dissectors/packet-netperfmeter.c +++ b/epan/dissectors/packet-netperfmeter.c @@ -379,9 +379,7 @@ dissect_npmp_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *npmp guint8 type; type = tvb_get_guint8(message_tvb, offset_message_type); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(type, message_type_values, "Unknown NetPerfMeterProtocol type")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(type, message_type_values, "Unknown NetPerfMeterProtocol type")); ADD_FIELD_UINT(npmp_tree, message_type); ADD_FIELD_UINT(npmp_tree, message_flags); diff --git a/epan/dissectors/packet-nettl.c b/epan/dissectors/packet-nettl.c index 5e3ade0e15..87f890defd 100644 --- a/epan/dissectors/packet-nettl.c +++ b/epan/dissectors/packet-nettl.c @@ -281,11 +281,9 @@ dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, - "Unsupported nettl subsytem: %d (%s)", + col_add_fstr(pinfo->cinfo, COL_INFO, "Unsupported nettl subsytem: %d (%s)", pinfo->pseudo_header->nettl.subsys, - val_to_str_const(pinfo->pseudo_header->nettl.subsys, subsystem, "Unknown")); + val_to_str_const(pinfo->pseudo_header->nettl.subsys, subsystem, "Unknown")); call_dissector(data_handle, tvb, pinfo, tree); } } diff --git a/epan/dissectors/packet-nlm.c b/epan/dissectors/packet-nlm.c index cbdf52f3d3..aba8f53fd6 100644 --- a/epan/dissectors/packet-nlm.c +++ b/epan/dissectors/packet-nlm.c @@ -381,17 +381,13 @@ dissect_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int version, i offset = dissect_rpc_string(tvb,lock_tree, hf_nlm_lock_caller_name, offset, NULL); offset = dissect_nfs3_fh(tvb, offset, pinfo, lock_tree, "fh", &fh_hash); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " FH:0x%08x", fh_hash); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " FH:0x%08x", fh_hash); offset = dissect_rpc_data(tvb, lock_tree, hf_nlm_lock_owner, offset); svid = tvb_get_ntohl(tvb, offset); offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_svid, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " svid:%d", svid); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " svid:%d", svid); if (version == 4) { start_offset = tvb_get_ntohl(tvb, offset); @@ -406,9 +402,7 @@ dissect_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int version, i offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_l_len, offset); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " pos:%d-%d", start_offset, end_offset); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " pos:%d-%d", start_offset, end_offset); return offset; } @@ -644,9 +638,7 @@ dissect_nlm_share(tvbuff_t *tvb, int offset, packet_info *pinfo, hf_nlm_lock_caller_name, offset, NULL); offset = dissect_nfs3_fh(tvb, offset, pinfo, lock_tree, "fh", &fh_hash); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " FH:0x%08x", fh_hash); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " FH:0x%08x", fh_hash); offset = dissect_rpc_data(tvb, lock_tree, hf_nlm_lock_owner, offset); @@ -666,7 +658,7 @@ dissect_nlm_shareres(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset); nlm_stat = tvb_get_ntohl(tvb, offset); - if (nlm_stat && check_col(pinfo->cinfo, COL_INFO)) { + if (nlm_stat) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(nlm_stat, names_nlm_stats, "Unknown Status (%u)")); } @@ -685,7 +677,7 @@ dissect_nlm_freeall(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, hf_nlm_share_name, offset, NULL); nlm_stat = tvb_get_ntohl(tvb, offset); - if (nlm_stat && check_col(pinfo->cinfo, COL_INFO)) { + if (nlm_stat) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(nlm_stat, names_nlm_stats, "Unknown Status (%u)")); } @@ -727,7 +719,7 @@ dissect_nlm_gen_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset); nlm_stat = tvb_get_ntohl(tvb, offset); - if (nlm_stat && check_col(pinfo->cinfo, COL_INFO)) { + if (nlm_stat) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(nlm_stat, names_nlm_stats, "Unknown Status (%u)")); } diff --git a/epan/dissectors/packet-nlsp.c b/epan/dissectors/packet-nlsp.c index 913a9a75e1..f726aa4407 100644 --- a/epan/dissectors/packet-nlsp.c +++ b/epan/dissectors/packet-nlsp.c @@ -462,10 +462,9 @@ nlsp_dissect_nlsp_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, "Sending Router System ID: %s", tvb_ether_to_str(tvb, offset)); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", System ID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", System ID: %s", tvb_ether_to_str(tvb, offset)); - } + offset += 6; if (tree) { @@ -1023,47 +1022,38 @@ nlsp_dissect_nlsp_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP ID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP ID: %s", tvb_ether_to_str(tvb, offset)); - } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, + + proto_tree_add_text(tree, tvb, offset, 6, "LSP ID system ID: %s", tvb_ether_to_str(tvb, offset)); - } + offset += 6; /* XXX - append the pseudonode ID */ - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, + proto_tree_add_text(tree, tvb, offset, 1, "LSP ID pseudonode ID: %u", tvb_get_guint8(tvb, offset)); - } + offset += 1; - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, + proto_tree_add_text(tree, tvb, offset, 1, "LSP ID LSP number: %u", tvb_get_guint8(tvb, offset)); - } offset += 1; sequence_number = tvb_get_ntohl(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: 0x%08x, Lifetime: %us", sequence_number, remaining_lifetime); - } - if (tree) { - proto_tree_add_uint(tree, hf_nlsp_lsp_sequence_number, tvb, + + proto_tree_add_uint(tree, hf_nlsp_lsp_sequence_number, tvb, offset, 4, sequence_number); - } offset += 4; - if (tree) { - /* XXX -> we could validate the cksum here! */ - proto_tree_add_item(tree, hf_nlsp_lsp_checksum, tvb, - offset, 2, ENC_BIG_ENDIAN ); - } + /* XXX -> we could validate the cksum here! */ + proto_tree_add_item(tree, hf_nlsp_lsp_checksum, tvb, + offset, 2, ENC_BIG_ENDIAN ); + offset += 2; if (tree) { @@ -1258,70 +1248,49 @@ nlsp_dissect_nlsp_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Source ID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Source ID: %s", tvb_ether_to_str(tvb, offset)); - } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, + proto_tree_add_text(tree, tvb, offset, 6, "Source ID system ID: %s", tvb_ether_to_str(tvb, offset)); - } offset += 6; /* XXX - add the pseudonode ID */ - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, + proto_tree_add_text(tree, tvb, offset, 1, "Source ID pseudonode ID: %u", tvb_get_guint8(tvb, offset)); - } offset += 1; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP ID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP ID: %s", tvb_ether_to_str(tvb, offset)); - } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, + proto_tree_add_text(tree, tvb, offset, 6, "Start LSP ID source ID: %s", tvb_ether_to_str(tvb, offset)); - } offset += 6; /* XXX - append the pseudonode ID */ - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, + proto_tree_add_text(tree, tvb, offset, 1, "Start LSP ID pseudonode ID: %u", tvb_get_guint8(tvb, offset)); - } offset += 1; - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, + + proto_tree_add_text(tree, tvb, offset, 1, "Start LSP ID LSP number: %u", tvb_get_guint8(tvb, offset)); - } offset += 1; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP ID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP ID: %s", tvb_ether_to_str(tvb, offset)); - } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, + proto_tree_add_text(tree, tvb, offset, 6, "End LSP ID source ID: %s", tvb_ether_to_str(tvb, offset)); - } offset += 6; /* XXX - append the pseudonode ID */ - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, + proto_tree_add_text(tree, tvb, offset, 1, "End LSP ID pseudonode ID: %u", tvb_get_guint8(tvb, offset)); - } offset += 1; - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, + proto_tree_add_text(tree, tvb, offset, 1, "End LSP ID LSP number: %u", tvb_get_guint8(tvb, offset)); - } offset += 1; len = packet_length - header_length; @@ -1373,28 +1342,20 @@ nlsp_dissect_nlsp_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int len; packet_length = tvb_get_ntohs(tvb, offset); - if (tree) { - proto_tree_add_uint(tree, hf_nlsp_packet_length, tvb, + proto_tree_add_uint(tree, hf_nlsp_packet_length, tvb, offset, 2, packet_length); - } offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Source ID: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Source ID: %s", tvb_ether_to_str(tvb, offset)); - } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, + proto_tree_add_text(tree, tvb, offset, 6, "Source ID system ID: %s", tvb_ether_to_str(tvb, offset)); - } offset += 6; /* XXX - add the pseudonode ID */ - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, + proto_tree_add_text(tree, tvb, offset, 1, "Source ID pseudonode ID: %u", tvb_get_guint8(tvb, offset)); - } offset += 1; len = packet_length - header_length; @@ -1425,7 +1386,7 @@ static void dissect_nlsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; - proto_tree *nlsp_tree = NULL; + proto_tree *nlsp_tree; int offset = 0; guint8 nlsp_major_version; guint8 nlsp_header_length; @@ -1437,63 +1398,48 @@ dissect_nlsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) nlsp_major_version = tvb_get_guint8(tvb, 5); if (nlsp_major_version != 1){ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown NLSP version (%u vs 1)", nlsp_major_version); - } + nlsp_dissect_unknown(tvb, tree, 0, "Unknown NLSP version (%d vs 1)", nlsp_major_version, 1); return; } - if (tree) { - ti = proto_tree_add_item(tree, proto_nlsp, tvb, 0, -1, ENC_NA); - nlsp_tree = proto_item_add_subtree(ti, ett_nlsp); - } + ti = proto_tree_add_item(tree, proto_nlsp, tvb, 0, -1, ENC_NA); + nlsp_tree = proto_item_add_subtree(ti, ett_nlsp); - if (tree) { - proto_tree_add_item(nlsp_tree, hf_nlsp_irpd, tvb, offset, 1, + proto_tree_add_item(nlsp_tree, hf_nlsp_irpd, tvb, offset, 1, ENC_BIG_ENDIAN ); - } offset += 1; nlsp_header_length = tvb_get_guint8(tvb, 1); - if (tree) { - proto_tree_add_uint(nlsp_tree, hf_nlsp_header_length, tvb, + proto_tree_add_uint(nlsp_tree, hf_nlsp_header_length, tvb, offset, 1, nlsp_header_length ); - } offset += 1; - if (tree) { - proto_tree_add_item(nlsp_tree, hf_nlsp_minor_version, tvb, + proto_tree_add_item(nlsp_tree, hf_nlsp_minor_version, tvb, offset, 1, ENC_BIG_ENDIAN ); - } offset += 1; offset += 1; /* Reserved */ packet_type_flags = tvb_get_guint8(tvb, offset); packet_type = packet_type_flags & PACKET_TYPE_MASK; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(packet_type, nlsp_packet_type_vals, "Unknown (%u)")); - } - if (tree) { - if (packet_type == NLSP_TYPE_L1_LSP) { - proto_tree_add_boolean(nlsp_tree, hf_nlsp_nr, tvb, offset, 1, + if (packet_type == NLSP_TYPE_L1_LSP) { + proto_tree_add_boolean(nlsp_tree, hf_nlsp_nr, tvb, offset, 1, packet_type_flags ); - } - proto_tree_add_uint(nlsp_tree, hf_nlsp_type, tvb, offset, 1, - packet_type_flags ); } + proto_tree_add_uint(nlsp_tree, hf_nlsp_type, tvb, offset, 1, + packet_type_flags ); offset += 1; - if (tree) { - proto_tree_add_item(nlsp_tree, hf_nlsp_major_version, tvb, + proto_tree_add_item(nlsp_tree, hf_nlsp_major_version, tvb, offset, 1, ENC_BIG_ENDIAN ); - } offset += 1; offset += 2; /* Reserved */ diff --git a/epan/dissectors/packet-nntp.c b/epan/dissectors/packet-nntp.c index 0deb8bb2ae..977db1e048 100644 --- a/epan/dissectors/packet-nntp.c +++ b/epan/dissectors/packet-nntp.c @@ -54,20 +54,17 @@ dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "NNTP"); - if (check_col(pinfo->cinfo, COL_INFO)) { - /* - * Put the first line from the buffer into the summary - * (but leave out the line terminator). - * - * 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. - */ - linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, - FALSE); - col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", type, + /* + * Put the first line from the buffer into the summary + * (but leave out the line terminator). + * + * 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. + */ + linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", type, tvb_format_text(tvb, offset, linelen)); - } if (tree) { ti = proto_tree_add_item(tree, proto_nntp, tvb, offset, -1, diff --git a/epan/dissectors/packet-noe.c b/epan/dissectors/packet-noe.c index e4475206ec..885655530e 100644 --- a/epan/dissectors/packet-noe.c +++ b/epan/dissectors/packet-noe.c @@ -1075,8 +1075,7 @@ static void decode_evt(proto_tree *tree, proto_tree_add_item(tree, hf_noe_event, tvb, offset, 1, ENC_BIG_ENDIAN); /* add text to the frame "INFO" column */ - 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_ext_const(event, &val_str_event_ext, "Unknown")); /* update text of the main proto item */ proto_item_append_text(tree, ", %s", @@ -1120,9 +1119,7 @@ static void decode_evt(proto_tree *tree, g_snprintf(key_name, 30, "\"%s\"", decode_key_name((int)unicode_value)); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - key_name); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", key_name); /* update text of the main proto item */ proto_item_append_text(tree, ", %s", key_name); @@ -1212,8 +1209,7 @@ static void decode_mtd(proto_tree *tree, proto_tree_add_item(tree, hf_noe_class, tvb, offset, 1, ENC_BIG_ENDIAN); /* add text to the frame "INFO" column */ - 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_ext_const(noe_class, &val_str_class_ext, "Unknown")); /* update text of the main proto item */ proto_item_append_text(tree, ", %s", @@ -1291,8 +1287,7 @@ static void dissect_noe(tvbuff_t *tvb, server = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " - NOE Protocol (%s)", + col_append_fstr(pinfo->cinfo, COL_INFO, " - NOE Protocol (%s)", val_to_str_const(server, servers_short_vals, "Unknown")); proto_tree_add_uint(noe_tree, @@ -1326,8 +1321,7 @@ static void dissect_noe(tvbuff_t *tvb, return; /* add text to the frame "INFO" column */ - 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_const(method, methods_vals, "Unknown")); /* update text of the main proto item */ diff --git a/epan/dissectors/packet-nsip.c b/epan/dissectors/packet-nsip.c index c839a1d815..48cdecbdeb 100644 --- a/epan/dissectors/packet-nsip.c +++ b/epan/dissectors/packet-nsip.c @@ -307,11 +307,10 @@ decode_iei_cause(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { "Cause: %s (%#02x)", val_to_str_const(cause, tab_nsip_cause_values, "Unknown"), cause); - if (check_col(bi->pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, - "Cause: %s", - val_to_str(cause, tab_nsip_cause_values, "Unknown (0x%02x)")); - } + col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, + "Cause: %s", + val_to_str(cause, tab_nsip_cause_values, "Unknown (0x%02x)")); + proto_item_append_text(bi->ti, ", Cause: %s", val_to_str(cause, tab_nsip_cause_values, "Unknown (0x%02x)")); } @@ -329,10 +328,8 @@ decode_iei_ns_vci(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { bi->tvb, ie_start_offset, ie->total_length, ns_vci, "NS VCI: %#04x", ns_vci); - if (check_col(bi->pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, - "NS VCI: %#04x", ns_vci); - } + col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, + "NS VCI: %#04x", ns_vci); proto_item_append_text(bi->ti, ", NS VCI: %#04x", ns_vci); } bi->offset += ie->value_length; @@ -366,10 +363,9 @@ decode_iei_nsei(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { } bi->offset += ie->value_length; - if (check_col(bi->pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, + col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, "NSEI %u", nsei); - } + proto_item_append_text(bi->ti, ", NSEI %u", nsei); } @@ -383,10 +379,8 @@ decode_iei_bvci(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { } bi->offset += ie->value_length; - if (check_col(bi->pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, + col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, "BVCI %u", bvci); - } proto_item_append_text(bi->ti, ", BVCI %u", bvci); } @@ -536,10 +530,8 @@ decode_iei_reset_flag(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { bi->offset, 1, flag & NSIP_MASK_RESET_FLAG); if (flag & NSIP_MASK_RESET_FLAG) { - if (check_col(bi->pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, + col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, "Reset"); - } proto_item_append_text(bi->ti, ", Reset"); } proto_tree_add_uint(field_tree, hf_nsip_reset_flag_spare, @@ -590,10 +582,8 @@ decode_iei_transaction_id(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) id = tvb_get_guint8(bi->tvb, bi->offset); proto_tree_add_uint(bi->nsip_tree, hf_nsip_transaction_id, bi->tvb, ie_start_offset, ie->total_length, id); - if (check_col(bi->pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, + col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, "Transaction Id: %d", id); - } } bi->offset += 1; } @@ -651,16 +641,14 @@ decode_iei_control_bits(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { } bi->offset++; - if (check_col(bi->pinfo->cinfo, COL_INFO)) { - if (control_bits & NSIP_MASK_CONTROL_BITS_R) { - col_append_sep_str(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, "Req CF"); - proto_item_append_text(bi->ti, ", Request Change Flow"); - } + if (control_bits & NSIP_MASK_CONTROL_BITS_R) { + col_append_sep_str(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, "Req CF"); + proto_item_append_text(bi->ti, ", Request Change Flow"); + } - if (control_bits & NSIP_MASK_CONTROL_BITS_C) { - col_append_sep_str(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, "Conf CF"); - proto_item_append_text(bi->ti, ", Confirm Change Flow"); - } + if (control_bits & NSIP_MASK_CONTROL_BITS_C) { + col_append_sep_str(bi->pinfo->cinfo, COL_INFO, NSIP_SEP, "Conf CF"); + proto_item_append_text(bi->ti, ", Confirm Change Flow"); } } diff --git a/epan/dissectors/packet-pgsql.c b/epan/dissectors/packet-pgsql.c index 831738d77f..cea56b79f7 100644 --- a/epan/dissectors/packet-pgsql.c +++ b/epan/dissectors/packet-pgsql.c @@ -172,8 +172,7 @@ dissect_pgsql(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* cv = find_or_create_conversation(pinfo); */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "PGSQL"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_set_str(pinfo->cinfo, COL_INFO, + col_set_str(pinfo->cinfo, COL_INFO, (pinfo->match_uint == pinfo->destport) ? ">" : "<"); diff --git a/epan/dissectors/packet-q933.c b/epan/dissectors/packet-q933.c index 664017d5e9..99e75067f2 100644 --- a/epan/dissectors/packet-q933.c +++ b/epan/dissectors/packet-q933.c @@ -1926,13 +1926,11 @@ dissect_q933(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, q933_message_type_vals, "Unknown message type (0x%02X)")); - } - if (q933_tree != NULL) - proto_tree_add_uint(q933_tree, hf_q933_message_type, tvb, offset, 1, message_type); + + proto_tree_add_uint(q933_tree, hf_q933_message_type, tvb, offset, 1, message_type); offset += 1; /* diff --git a/epan/dissectors/packet-starteam.c b/epan/dissectors/packet-starteam.c index 1be3219c11..c23e8ea1cc 100644 --- a/epan/dissectors/packet-starteam.c +++ b/epan/dissectors/packet-starteam.c @@ -504,9 +504,8 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ /* This packet is a response */ bRequest = FALSE; - if(check_col(pinfo->cinfo, COL_INFO)){ - col_append_fstr(pinfo->cinfo, COL_INFO, "Reply: %d bytes", tvb_length(tvb)); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "Reply: %d bytes", tvb_length(tvb)); + } else if(tvb_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){ /* This packet is a request */ bRequest = TRUE; diff --git a/epan/dissectors/packet-tr.c b/epan/dissectors/packet-tr.c index de8c8dd4e0..0eb241805c 100644 --- a/epan/dissectors/packet-tr.c +++ b/epan/dissectors/packet-tr.c @@ -381,8 +381,7 @@ dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) frame_type = (trh->fc & 192) >> 6; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "Token-Ring %s", fc[frame_type]); + col_add_fstr(pinfo->cinfo, COL_INFO, "Token-Ring %s", fc[frame_type]); trn_rif_bytes = tvb_get_guint8(tr_tvb, 14) & 31; diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index 93145c3e4e..b6d53049d9 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -1902,10 +1902,8 @@ dissect_usb_setup_get_descriptor_request(packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN); usb_trans_info->u.get_descriptor.type = tvb_get_guint8(tvb, offset); offset += 1; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - val_to_str_ext(usb_trans_info->u.get_descriptor.type, &descriptor_type_vals_ext, "Unknown type %u")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + val_to_str_ext(usb_trans_info->u.get_descriptor.type, &descriptor_type_vals_ext, "Unknown type %u")); /* language id */ proto_tree_add_item(tree, hf_usb_language_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -1926,10 +1924,9 @@ dissect_usb_setup_get_descriptor_response(packet_info *pinfo, proto_tree *tree, guint bus_id, guint device_address) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - val_to_str_ext(usb_trans_info->u.get_descriptor.type, &descriptor_type_vals_ext, "Unknown type %u")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + val_to_str_ext(usb_trans_info->u.get_descriptor.type, &descriptor_type_vals_ext, "Unknown type %u")); + switch(usb_trans_info->u.get_descriptor.type) { case USB_DT_DEVICE: offset = dissect_usb_device_descriptor(pinfo, tree, tvb, offset, usb_trans_info, bus_id, device_address); @@ -2400,13 +2397,11 @@ dissect_linux_usb_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t isprint(type) ? type : '.'); proto_tree_add_item(tree, hf_usb_transfer_type, tvb, 9, 1, ENC_BIG_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO)) { - transfer_type = tvb_get_guint8(tvb, 9); - endpoint_number = tvb_get_guint8(tvb, 10); - transfer_type_and_direction = (transfer_type & 0x7F) | (endpoint_number & 0x80); - col_append_str(pinfo->cinfo, COL_INFO, - val_to_str(transfer_type_and_direction, usb_transfer_type_and_direction_vals, "Unknown type %x")); - } + transfer_type = tvb_get_guint8(tvb, 9); + endpoint_number = tvb_get_guint8(tvb, 10); + transfer_type_and_direction = (transfer_type & 0x7F) | (endpoint_number & 0x80); + col_append_str(pinfo->cinfo, COL_INFO, + val_to_str(transfer_type_and_direction, usb_transfer_type_and_direction_vals, "Unknown type %x")); proto_tree_add_bitmask(tree, tvb, 10, hf_usb_endpoint_number, ett_usb_endpoint, usb_endpoint_fields, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_usb_device_address, tvb, 11, 1, ENC_BIG_ENDIAN); @@ -2828,10 +2823,8 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, proto_tree_add_item(setup_tree, hf_usb_request, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s Request", - val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Request", + val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x")); dissector = NULL; for(tmp = setup_request_dissectors;tmp->dissector;tmp++) { @@ -3010,11 +3003,9 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, * This is a standard response which is managed by this * dissector */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s Response", - val_to_str(usb_conv_info->usb_trans_info->setup.request, - setup_request_names_vals, "Unknown type %x")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Response", + val_to_str(usb_conv_info->usb_trans_info->setup.request, + setup_request_names_vals, "Unknown type %x")); dissector = NULL; for(tmp = setup_response_dissectors;tmp->dissector;tmp++) { diff --git a/epan/dissectors/packet-vines.c b/epan/dissectors/packet-vines.c index bef0fada79..3a187a4ec9 100644 --- a/epan/dissectors/packet-vines.c +++ b/epan/dissectors/packet-vines.c @@ -390,8 +390,7 @@ dissect_vines_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); ptype = 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(ptype, vines_llc_ptype_vals, "Unknown protocol 0x%02x")); if (tree) { @@ -488,11 +487,9 @@ dissect_vines_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) vip_tctl = tvb_get_guint8(tvb, offset+3); vip_proto = tvb_get_guint8(tvb, offset+4); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s (0x%02x)", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s (0x%02x)", val_to_str_const(vip_tctl, proto_vals, "Unknown VIP protocol"), vip_tctl); - } src_addr = tvb_get_ptr(tvb, offset+12, VINES_ADDR_LEN); SET_ADDRESS(&pinfo->net_src, AT_VINES, VINES_ADDR_LEN, src_addr); @@ -758,19 +755,18 @@ dissect_vines_ipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) viph.vipc_err_len = g_ntohs(viph.vipc_err_len); col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines IPC"); - if (check_col(pinfo->cinfo, COL_INFO)) { - switch (viph.vipc_pkttype) { + switch (viph.vipc_pkttype) { - case PKTTYPE_DGRAM: - col_add_fstr(pinfo->cinfo, COL_INFO, + case PKTTYPE_DGRAM: + col_add_fstr(pinfo->cinfo, COL_INFO, "%s D=%04x S=%04x", val_to_str(viph.vipc_pkttype, pkttype_vals, "Unknown packet type (0x%02x)"), viph.vipc_dport, viph.vipc_sport); - break; + break; - case PKTTYPE_ERR: - col_add_fstr(pinfo->cinfo, COL_INFO, + case PKTTYPE_ERR: + col_add_fstr(pinfo->cinfo, COL_INFO, "%s NS=%u NR=%u Err=%s RID=%04x LID=%04x D=%04x S=%04x", val_to_str(viph.vipc_pkttype, pkttype_vals, "Unknown packet type (0x%02x)"), @@ -779,10 +775,10 @@ dissect_vines_ipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) vipc_err_vals, "Unknown (%u)"), viph.vipc_rmtid, viph.vipc_lclid, viph.vipc_dport, viph.vipc_sport); - break; + break; - default: - col_add_fstr(pinfo->cinfo, COL_INFO, + default: + col_add_fstr(pinfo->cinfo, COL_INFO, "%s NS=%u NR=%u Len=%u RID=%04x LID=%04x D=%04x S=%04x", val_to_str(viph.vipc_pkttype, pkttype_vals, "Unknown packet type (0x%02x)"), @@ -790,8 +786,7 @@ dissect_vines_ipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) viph.vipc_err_len, viph.vipc_rmtid, viph.vipc_lclid, viph.vipc_dport, viph.vipc_sport); - break; - } + break; } ti = proto_tree_add_item(tree, proto_vines_ipc, tvb, offset, @@ -975,8 +970,7 @@ dissect_vines_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) viph.vspp_win = g_ntohs(viph.vspp_win); col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines SPP"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "%s NS=%u NR=%u Window=%u RID=%04x LID=%04x D=%04x S=%04x", val_to_str(viph.vspp_pkttype, pkttype_vals, "Unknown packet type (0x%02x)"), @@ -1182,31 +1176,25 @@ dissect_vines_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Vines SARP"); packet_type = 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(packet_type, vines_arp_packet_type_vals, "Unknown (0x%02x)")); - } - if (tree) { - proto_tree_add_text(vines_arp_tree, tvb, 1, 1, + + proto_tree_add_text(vines_arp_tree, tvb, 1, 1, "Packet Type: %s (0x%02x)", val_to_str_const(packet_type, vines_arp_packet_type_vals, "Unknown"), packet_type); - } + if (packet_type == VARP_ASSIGNMENT_RESP) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", Address = %s", tvb_vines_addr_to_str(tvb, 2)); - } - if (tree) { - proto_tree_add_text(vines_arp_tree, tvb, 2, + proto_tree_add_text(vines_arp_tree, tvb, 2, VINES_ADDR_LEN, "Address: %s", tvb_vines_addr_to_str(tvb, 2)); - } } if (tree) { proto_tree_add_text(vines_arp_tree, tvb, @@ -1224,31 +1212,25 @@ dissect_vines_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Non-sequenced ARP. */ packet_type = (guint8) tvb_get_ntohs(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(packet_type, vines_arp_packet_type_vals, "Unknown (0x%02x)")); - } - if (tree) { - proto_tree_add_text(vines_arp_tree, tvb, 0, 2, + proto_tree_add_text(vines_arp_tree, tvb, 0, 2, "Packet Type: %s (0x%04x)", val_to_str_const(packet_type, vines_arp_packet_type_vals, "Unknown"), packet_type); - } + if (packet_type == VARP_ASSIGNMENT_RESP) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", Address = %s", tvb_vines_addr_to_str(tvb, 2)); - } - if (tree) { - proto_tree_add_text(vines_arp_tree, tvb, 2, + + proto_tree_add_text(vines_arp_tree, tvb, 2, VINES_ADDR_LEN, "Address: %s", tvb_vines_addr_to_str(tvb, 2)); - } } } } @@ -1356,11 +1338,10 @@ dissect_vines_rtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Non-sequenced RTP. */ operation_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(operation_type, vines_rtp_operation_type_vals, "Unknown (0x%02x)")); - } + if (tree) { proto_tree_add_text(vines_rtp_tree, tvb, offset, 1, "Operation Type: %s (0x%02x)", @@ -1450,11 +1431,10 @@ dissect_vines_rtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } offset += 2; operation_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(operation_type, vines_rtp_operation_type_vals, "Unknown (0x%02x)")); - } + if (tree) { proto_tree_add_text(vines_rtp_tree, tvb, offset, 1, "Operation Type: %s (0x%02x)", @@ -1894,50 +1874,39 @@ dissect_vines_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } packet_type = tvb_get_ntohs(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(packet_type, vines_icp_packet_type_vals, "Unknown (0x%02x)")); - } - if (tree) { - proto_tree_add_text(vines_icp_tree, tvb, offset, 2, + + proto_tree_add_text(vines_icp_tree, tvb, offset, 2, "Packet Type: %s (0x%04x)", val_to_str_const(packet_type, vines_icp_packet_type_vals, "Unknown"), packet_type); - } offset += 2; switch (packet_type) { case VICP_EXCEPTION_NOTIFICATION: exception_code = tvb_get_ntohs(tvb, 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(exception_code, vipc_err_vals, "Unknown exception code (%u)")); - } - if (tree) { - proto_tree_add_text(vines_icp_tree, tvb, offset, 2, + proto_tree_add_text(vines_icp_tree, tvb, offset, 2, "Exception Code: %s (%u)", val_to_str_const(exception_code, vipc_err_vals, "Unknown"), exception_code); - } break; case VICP_METRIC_NOTIFICATION: metric = tvb_get_ntohs(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", metric %u", + col_append_fstr(pinfo->cinfo, COL_INFO, ", metric %u", metric); - } - if (tree) { - proto_tree_add_text(vines_icp_tree, tvb, offset, 2, + proto_tree_add_text(vines_icp_tree, tvb, offset, 2, "Metric: %u", metric); - } break; } offset += 2; diff --git a/epan/dissectors/packet-wol.c b/epan/dissectors/packet-wol.c index 9d69b6b6bf..c531d1f406 100644 --- a/epan/dissectors/packet-wol.c +++ b/epan/dissectors/packet-wol.c @@ -153,10 +153,6 @@ dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) at the list of packets can tell what type of packet it is. See section 1.5 for more information. - Before changing the contents of a column you should make sure the column is - active by calling "check_col(pinfo->cinfo, COL_*)". If it is not active - don't bother setting it. - If you are setting the column to a constant string, use "col_set_str()", as it's more efficient than the other "col_set_XXX()" calls. @@ -178,18 +174,15 @@ dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) */ - if ( check_col(pinfo->cinfo, COL_INFO) ) - { - col_add_fstr(pinfo->cinfo, COL_INFO, "MagicPacket for %s (%s)", - get_ether_name(mac), ether_to_str(mac)); + col_add_fstr(pinfo->cinfo, COL_INFO, "MagicPacket for %s (%s)", + get_ether_name(mac), ether_to_str(mac)); - /* NOTE: ether-wake uses a dotted-decimal format for specifying a - * 4-byte password or an Ethernet mac address format for specifying - * a 6-byte password, so display them in that format, even if the - * password isn't really an IP or MAC address. */ - if ( passwd ) - col_append_fstr(pinfo->cinfo, COL_INFO, ", password %s", passwd); - } + /* NOTE: ether-wake uses a dotted-decimal format for specifying a + * 4-byte password or an Ethernet mac address format for specifying + * a 6-byte password, so display them in that format, even if the + * password isn't really an IP or MAC address. */ + if ( passwd ) + col_append_fstr(pinfo->cinfo, COL_INFO, ", password %s", passwd); /* A protocol dissector can be called in 2 different ways: |