diff options
Diffstat (limited to 'epan')
83 files changed, 607 insertions, 929 deletions
diff --git a/epan/dissectors/packet-clique-rm.c b/epan/dissectors/packet-clique-rm.c index 37f7f43841..1fd0da1df1 100644 --- a/epan/dissectors/packet-clique-rm.c +++ b/epan/dissectors/packet-clique-rm.c @@ -310,8 +310,7 @@ dissect_clique_rm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat ENC_BIG_ENDIAN); offset++; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", sender: 0x%x", + col_append_fstr(pinfo->cinfo, COL_INFO, ", sender: 0x%x", tvb_get_ntohl(tvb, offset)); proto_tree_add_item(clique_rm_tree, hf_clique_rm_sender, tvb, offset, @@ -319,8 +318,7 @@ dissect_clique_rm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat offset += 4; if (IS_RELIABLE(type)) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", id: 0x%x", + col_append_fstr(pinfo->cinfo, COL_INFO, ", id: 0x%x", tvb_get_ntohl(tvb, offset)); dissect_reliable_packet(clique_rm_tree, type, tvb, offset); diff --git a/epan/dissectors/packet-dpnss.c b/epan/dissectors/packet-dpnss.c index cc735e4cdb..bfd803a869 100644 --- a/epan/dissectors/packet-dpnss.c +++ b/epan/dissectors/packet-dpnss.c @@ -1173,8 +1173,7 @@ dissect_dpnss_LbL_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(tree, hf_dpnss_LbL_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN); octet = tvb_get_guint8(tvb,offset)&0x0f; offset++; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(octet, dpnss_LbL_msg_short_type_vals, "Unknown (%d)" )); if (tree) { switch (octet) { @@ -1269,8 +1268,7 @@ dissect_dpnss_e2e_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(tree, hf_dpnss_e2e_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN); octet = tvb_get_guint8(tvb,offset)&0x0f; offset++; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(octet, dpnss_e2e_msg_short_type_vals, "Unknown (%d)" )); if (tree) { switch (octet) { @@ -1366,8 +1364,7 @@ dissect_dpnss_cc_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(tree, hf_dpnss_cc_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN); octet = tvb_get_guint8(tvb,offset)&0x0f; offset++; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(octet, dpnss_cc_msg_short_type_vals, "Unknown (%d)" )); if (tree) { diff --git a/epan/dissectors/packet-dsi.c b/epan/dissectors/packet-dsi.c index e765e68667..4b7f59fb5a 100644 --- a/epan/dissectors/packet-dsi.c +++ b/epan/dissectors/packet-dsi.c @@ -512,13 +512,10 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 dsi_length; guint32 dsi_reserved; struct aspinfo aspinfo; - gint col_info; col_set_str(pinfo->cinfo, COL_PROTOCOL, "DSI"); - col_info = check_col(pinfo->cinfo, COL_INFO); - if (col_info) - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); dsi_flags = tvb_get_guint8(tvb, 0); dsi_command = tvb_get_guint8(tvb, 1); @@ -527,15 +524,12 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dsi_length = tvb_get_ntohl(tvb, 8); dsi_reserved = tvb_get_ntohl(tvb, 12); - if (col_info) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s (%u)", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s (%u)", val_to_str(dsi_flags, flag_vals, "Unknown flag (0x%02x)"), val_to_str_ext(dsi_command, &func_vals_ext, "Unknown function (0x%02x)"), dsi_requestid); - } - if (tree) { ti = proto_tree_add_item(tree, proto_dsi, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-dtpt.c b/epan/dissectors/packet-dtpt.c index e00734d054..e33bb69cd8 100644 --- a/epan/dissectors/packet-dtpt.c +++ b/epan/dissectors/packet-dtpt.c @@ -723,8 +723,7 @@ dissect_dtpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ } col_set_str(pinfo->cinfo, COL_PROTOCOL, "DTPT"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(message_type, names_message_type, "Unknown (%d)")); + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(message_type, names_message_type, "Unknown (%d)")); if (message_type == LookupBeginRequest) { conversation_t *c; diff --git a/epan/dissectors/packet-dua.c b/epan/dissectors/packet-dua.c index e1905b9f07..f4975ca4f7 100644 --- a/epan/dissectors/packet-dua.c +++ b/epan/dissectors/packet-dua.c @@ -684,8 +684,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, + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "Unknown")); diff --git a/epan/dissectors/packet-dvmrp.c b/epan/dissectors/packet-dvmrp.c index 2fd819b416..8e74426b14 100644 --- a/epan/dissectors/packet-dvmrp.c +++ b/epan/dissectors/packet-dvmrp.c @@ -336,11 +336,9 @@ dissect_dvmrp_v3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int code = tvb_get_guint8(tvb, offset); proto_tree_add_uint(parent_tree, hf_code_v3, tvb, offset, 1, code); offset += 1; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "V%d %s",3 ,val_to_str(code, code_v3, "Unknown Type:0x%02x")); - } /* checksum */ igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0); @@ -528,11 +526,9 @@ dissect_dvmrp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int code = tvb_get_guint8(tvb, offset); proto_tree_add_uint(parent_tree, hf_code_v1, tvb, offset, 1, code); offset += 1; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "V%d %s",1 ,val_to_str(code, code_v1, "Unknown Type:0x%02x")); - } /* checksum */ igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0); diff --git a/epan/dissectors/packet-eap.c b/epan/dissectors/packet-eap.c index 7ee34494b2..09f6975461 100644 --- a/epan/dissectors/packet-eap.c +++ b/epan/dissectors/packet-eap.c @@ -649,8 +649,7 @@ dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) eap_code = 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(eap_code, eap_code_vals, "Unknown code (0x%02X)")); /* @@ -742,8 +741,7 @@ dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) case EAP_RESPONSE: eap_type = tvb_get_guint8(tvb, 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_ext(eap_type, &eap_type_vals_ext, "Unknown type (0x%02x)")); if (tree) diff --git a/epan/dissectors/packet-eapol.c b/epan/dissectors/packet-eapol.c index 5ddb0fc75e..c14c1d1af3 100644 --- a/epan/dissectors/packet-eapol.c +++ b/epan/dissectors/packet-eapol.c @@ -177,8 +177,7 @@ dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) eapol_type = tvb_get_guint8(tvb, offset); if (tree) proto_tree_add_item(eapol_tree, hf_eapol_type, tvb, offset, 1, ENC_BIG_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(eapol_type, eapol_type_vals, "Unknown Type (0x%02X)")); offset++; @@ -205,60 +204,58 @@ dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; if (keydesc_type == EAPOL_WPA_KEY || keydesc_type == EAPOL_RSN_KEY) { keyinfo = tvb_get_ntohs(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - if (keyinfo & KEY_INFO_REQUEST_MASK) { - col_set_str(pinfo->cinfo, COL_INFO, "Key (Request)"); - if (keyinfo & KEY_INFO_ERROR_MASK) - col_set_str(pinfo->cinfo, COL_INFO, "Key (Request, Error)"); - } else if (keyinfo & KEY_INFO_KEY_TYPE_MASK) { - guint16 masked; - masked = keyinfo & - (KEY_INFO_INSTALL_MASK | KEY_INFO_KEY_ACK_MASK | - KEY_INFO_KEY_MIC_MASK | KEY_INFO_SECURE_MASK); - - if (keydesc_type == EAPOL_WPA_KEY) { - switch (masked) { - case KEY_INFO_KEY_ACK_MASK: - col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 1 of 4)"); - break; - case KEY_INFO_KEY_MIC_MASK: - counter = tvb_get_guint8(tvb, offset+11); - if (!counter) - col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 2 of 4)"); - else - col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 4 of 4)"); - break; - case (KEY_INFO_INSTALL_MASK | KEY_INFO_KEY_ACK_MASK | - KEY_INFO_KEY_MIC_MASK): - col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 3 of 4)"); - break; - } - } - - if (keydesc_type == EAPOL_RSN_KEY) { - switch (masked) { - case KEY_INFO_KEY_ACK_MASK: - col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 1 of 4)"); - break; - case KEY_INFO_KEY_MIC_MASK: - col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 2 of 4)"); - break; - case (KEY_INFO_INSTALL_MASK | KEY_INFO_KEY_ACK_MASK | - KEY_INFO_KEY_MIC_MASK | KEY_INFO_SECURE_MASK): - col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 3 of 4)"); - break; - case (KEY_INFO_KEY_MIC_MASK | KEY_INFO_SECURE_MASK): - col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 4 of 4)"); - break; - } - } - - } else { - if (keyinfo & KEY_INFO_KEY_ACK_MASK) - col_set_str(pinfo->cinfo, COL_INFO, "Key (Group Message 1 of 2)"); - else - col_set_str(pinfo->cinfo, COL_INFO, "Key (Group Message 2 of 2)"); - } + if (keyinfo & KEY_INFO_REQUEST_MASK) { + col_set_str(pinfo->cinfo, COL_INFO, "Key (Request)"); + if (keyinfo & KEY_INFO_ERROR_MASK) + col_set_str(pinfo->cinfo, COL_INFO, "Key (Request, Error)"); + } else if (keyinfo & KEY_INFO_KEY_TYPE_MASK) { + guint16 masked; + masked = keyinfo & + (KEY_INFO_INSTALL_MASK | KEY_INFO_KEY_ACK_MASK | + KEY_INFO_KEY_MIC_MASK | KEY_INFO_SECURE_MASK); + + if (keydesc_type == EAPOL_WPA_KEY) { + switch (masked) { + case KEY_INFO_KEY_ACK_MASK: + col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 1 of 4)"); + break; + case KEY_INFO_KEY_MIC_MASK: + counter = tvb_get_guint8(tvb, offset+11); + if (!counter) + col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 2 of 4)"); + else + col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 4 of 4)"); + break; + case (KEY_INFO_INSTALL_MASK | KEY_INFO_KEY_ACK_MASK | + KEY_INFO_KEY_MIC_MASK): + col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 3 of 4)"); + break; + } + } + + if (keydesc_type == EAPOL_RSN_KEY) { + switch (masked) { + case KEY_INFO_KEY_ACK_MASK: + col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 1 of 4)"); + break; + case KEY_INFO_KEY_MIC_MASK: + col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 2 of 4)"); + break; + case (KEY_INFO_INSTALL_MASK | KEY_INFO_KEY_ACK_MASK | + KEY_INFO_KEY_MIC_MASK | KEY_INFO_SECURE_MASK): + col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 3 of 4)"); + break; + case (KEY_INFO_KEY_MIC_MASK | KEY_INFO_SECURE_MASK): + col_set_str(pinfo->cinfo, COL_INFO, "Key (Message 4 of 4)"); + break; + } + } + + } else { + if (keyinfo & KEY_INFO_KEY_ACK_MASK) + col_set_str(pinfo->cinfo, COL_INFO, "Key (Group Message 1 of 2)"); + else + col_set_str(pinfo->cinfo, COL_INFO, "Key (Group Message 2 of 2)"); } keyinfo_item = proto_tree_add_item(eapol_tree, hf_eapol_wpa_keydes_keyinfo, tvb, diff --git a/epan/dissectors/packet-echo.c b/epan/dissectors/packet-echo.c index a544f71baf..c3602b2b87 100644 --- a/epan/dissectors/packet-echo.c +++ b/epan/dissectors/packet-echo.c @@ -57,10 +57,8 @@ static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "ECHO"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, + col_set_str(pinfo->cinfo, COL_INFO, (request) ? "Request" : "Response"); - } if (tree) { proto_tree *echo_tree; diff --git a/epan/dissectors/packet-egd.c b/epan/dissectors/packet-egd.c index 4358f01c35..21c7f90a15 100644 --- a/epan/dissectors/packet-egd.c +++ b/epan/dissectors/packet-egd.c @@ -97,12 +97,9 @@ static void dissect_egd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "EGD"); /* Clear out stuff in the info column */ - if (check_col(pinfo->cinfo,COL_INFO)) - { - col_clear(pinfo->cinfo, COL_INFO); - col_add_fstr(pinfo->cinfo, COL_INFO, "Data Msg: ExchangeID=0x%08X, RequestID=%05u", + col_clear(pinfo->cinfo, COL_INFO); + col_add_fstr(pinfo->cinfo, COL_INFO, "Data Msg: ExchangeID=0x%08X, RequestID=%05u", tvb_get_letohl(tvb, 8), tvb_get_letohs(tvb, 2)); - } if (tree) { diff --git a/epan/dissectors/packet-elcom.c b/epan/dissectors/packet-elcom.c index 0870ba1f99..4dd8b73409 100644 --- a/epan/dissectors/packet-elcom.c +++ b/epan/dissectors/packet-elcom.c @@ -429,14 +429,14 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) is_request = (pinfo->match_port == pinfo->destport); elcom_len = tvb_get_ntohs(tvb, 0); length_ok = (tvb_reported_length(tvb) == (elcom_len+2)); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s Len=%d%s", + + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Len=%d%s", is_request ? "Request" : "Response", elcom_len, length_ok ? "" : " (incorrect)"); - elcom_msg_type = tvb_get_guint8(tvb, 2); - switch (elcom_msg_type) { + elcom_msg_type = tvb_get_guint8(tvb, 2); + switch (elcom_msg_type) { case P_CONRQ: case P_CONRS: @@ -474,7 +474,6 @@ dissect_elcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case P_RELRS: col_append_str(pinfo->cinfo, COL_INFO, " Response"); break; - } } if (!tree) diff --git a/epan/dissectors/packet-enttec.c b/epan/dissectors/packet-enttec.c index f49dfbe034..048b0e1195 100644 --- a/epan/dissectors/packet-enttec.c +++ b/epan/dissectors/packet-enttec.c @@ -353,10 +353,8 @@ dissect_enttec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ head = tvb_get_ntohl(tvb, offset); /* Clear out stuff in the info column */ - if (check_col(pinfo->cinfo,COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(head, enttec_head_vals, "Unknown (0x%08x)")); - } if (tree) { ti = proto_tree_add_item(tree, proto_enttec, tvb, offset, -1, ENC_NA); diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c index 84322e4de1..34fdd3a0eb 100644 --- a/epan/dissectors/packet-epl.c +++ b/epan/dissectors/packet-epl.c @@ -715,48 +715,44 @@ dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) epl_src = tvb_get_guint8(tvb, EPL_SRC_OFFSET); src_str = decode_epl_address(epl_src); - if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + /* Choose the right string for "Info" column (message type) */ + switch (epl_mtyp) { - col_clear(pinfo->cinfo, COL_INFO); + case EPL_SOC: + /* source and destination NodeID are fixed according to the spec */ + col_set_str(pinfo->cinfo, COL_INFO, "SoC "); + break; - /* Choose the right string for "Info" column (message type) */ - switch (epl_mtyp) - { - case EPL_SOC: - /* source and destination NodeID are fixed according to the spec */ - col_set_str(pinfo->cinfo, COL_INFO, "SoC "); - break; - - case EPL_PREQ: - /* show only destination NodeID, because source is always 240 (MN) */ - col_add_fstr(pinfo->cinfo, COL_INFO, "PReq dst = %3d ", epl_dest); - break; - - case EPL_PRES: - /* show only source NodeID, because destination is always 255 (broadcast) */ - col_add_fstr(pinfo->cinfo, COL_INFO, "PRes src = %3d ", epl_src); - break; - - case EPL_SOA: - /* source and destination NodeID are fixed according to the spec */ - col_set_str(pinfo->cinfo, COL_INFO, "SoA "); - break; - - case EPL_ASND: - if (udpencap) - { - col_set_str(pinfo->cinfo, COL_INFO, "ASnd "); - } - else - { - col_add_fstr(pinfo->cinfo, COL_INFO, "ASnd src = %3d dst = %3d ", epl_src, epl_dest); - } - break; - - default: /* no valid EPL packet */ - return FALSE; + case EPL_PREQ: + /* show only destination NodeID, because source is always 240 (MN) */ + col_add_fstr(pinfo->cinfo, COL_INFO, "PReq dst = %3d ", epl_dest); + break; - } + case EPL_PRES: + /* show only source NodeID, because destination is always 255 (broadcast) */ + col_add_fstr(pinfo->cinfo, COL_INFO, "PRes src = %3d ", epl_src); + break; + + case EPL_SOA: + /* source and destination NodeID are fixed according to the spec */ + col_set_str(pinfo->cinfo, COL_INFO, "SoA "); + break; + + case EPL_ASND: + if (udpencap) + { + col_set_str(pinfo->cinfo, COL_INFO, "ASnd "); + } + else + { + col_add_fstr(pinfo->cinfo, COL_INFO, "ASnd src = %3d dst = %3d ", epl_src, epl_dest); + } + break; + + default: /* no valid EPL packet */ + return FALSE; } @@ -858,7 +854,7 @@ dissect_epl_soc(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint of } offset += 2; - if (show_soc_flags && check_col(pinfo->cinfo, COL_INFO)) + if (show_soc_flags) { col_append_fstr(pinfo->cinfo, COL_INFO, "MC = %d PS = %d", ((EPL_SOC_MC_MASK & flags) >> 7), ((EPL_SOC_PS_MASK & flags) >> 6)); @@ -920,11 +916,8 @@ dissect_epl_preq(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint o } offset += len; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "RD = %d size = %d ver = %d.%d", + col_append_fstr(pinfo->cinfo, COL_INFO, "RD = %d size = %d ver = %d.%d", (EPL_PDO_RD_MASK & flags), len, hi_nibble(pdoversion), lo_nibble(pdoversion)); - } return offset; } @@ -989,11 +982,8 @@ dissect_epl_pres(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 } offset += len; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "RD = %d size = %d ver = %d.%d", + col_append_fstr(pinfo->cinfo, COL_INFO, "RD = %d size = %d ver = %d.%d", (EPL_PDO_RD_MASK & flags), len, hi_nibble(pdoversion), lo_nibble(pdoversion)); - } return offset; } @@ -1040,7 +1030,7 @@ dissect_epl_soa(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 } offset += 1; - if (svid != EPL_SOA_NOSERVICE && check_col(pinfo->cinfo, COL_INFO)) + if (svid != EPL_SOA_NOSERVICE) { col_append_fstr(pinfo->cinfo, COL_INFO, "tgt = %3d %s", target, val_to_str(svid, soa_svid_vals, "Unknown (%d)")); @@ -1073,11 +1063,8 @@ dissect_epl_asnd(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 offset += 1; - 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(svid, asnd_svid_vals, "Unknown (%d)")); - } switch (svid) { @@ -1125,11 +1112,8 @@ dissect_epl_asnd_nmtreq(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_str(pinfo->cinfo, COL_INFO, + col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext(rcid, &asnd_cid_vals_ext, "Unknown (%d)")); - } return offset; } @@ -1166,11 +1150,8 @@ dissect_epl_asnd_nmtcmd(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(epl_tree, hf_epl_asnd_nmtcommand_cdat, tvb, offset, -1, ENC_NA); } - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_str(pinfo->cinfo, COL_INFO, + col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext(epl_asnd_nmtcommand_cid, &asnd_cid_vals_ext, "Unknown (%d)")); - } return offset; } @@ -1296,10 +1277,7 @@ dissect_epl_asnd_ires(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, g proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_vex2, tvb, offset, 48, ENC_NA); offset += 48; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_str(pinfo->cinfo, COL_INFO, val_to_str(profile, epl_device_profiles, "Device Profile %d")); - } + col_append_str(pinfo->cinfo, COL_INFO, val_to_str(profile, epl_device_profiles, "Device Profile %d")); return offset; } @@ -1330,10 +1308,7 @@ dissect_epl_asnd_sres(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, g } nmt_state = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(nmt_state, epl_nmt_cs_vals, "Unknown (%d)")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(nmt_state, epl_nmt_cs_vals, "Unknown (%d)")); if (epl_src != EPL_MN_NODEID) /* check if CN or MN */ { @@ -1451,19 +1426,16 @@ dissect_epl_sdo_sequence(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo } offset += 3; - if (check_col(pinfo->cinfo, COL_INFO)) + seq_recv &= EPL_ASND_SDO_SEQ_CON_MASK; + seq_send &= EPL_ASND_SDO_SEQ_CON_MASK; + if ((seq_recv == 0x00) && (seq_send == 0x00)) + { /* Sequence layer will be closed */ + col_append_str(pinfo->cinfo, COL_INFO, "Close "); + } + else if ((seq_recv < 0x02) || (seq_send < 0x02)) { - seq_recv &= EPL_ASND_SDO_SEQ_CON_MASK; - seq_send &= EPL_ASND_SDO_SEQ_CON_MASK; - if ((seq_recv == 0x00) && (seq_send == 0x00)) - { /* Sequence layer will be closed */ - col_append_str(pinfo->cinfo, COL_INFO, "Close "); - } - else if ((seq_recv < 0x02) || (seq_send < 0x02)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "Init=%d%d ", - seq_recv, seq_send); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "Init=%d%d ", + seq_recv, seq_send); } return offset; @@ -1536,10 +1508,8 @@ dissect_epl_sdo_command(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, { proto_tree_add_uint(epl_tree, hf_epl_asnd_sdo_cmd_abort_code, tvb, offset, 4, abort_code); } - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "Abort = 0x%08X", abort_code); - } + + col_append_fstr(pinfo->cinfo, COL_INFO, "Abort = 0x%08X", abort_code); } else { @@ -1590,16 +1560,11 @@ dissect_epl_sdo_command_write_by_index(proto_tree *epl_tree, tvbuff_t *tvb, pack } offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "Write 0x%04X/%d", indx, subindx); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "Write 0x%04X/%d", indx, subindx); } - else if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "Requ. %s", + + col_append_fstr(pinfo->cinfo, COL_INFO, "Requ. %s", val_to_str(segmented, epl_sdo_asnd_cmd_segmentation, "Unknown (%d)")); - } size = tvb_reported_length_remaining(tvb, offset); item = proto_tree_add_item(epl_tree, hf_epl_asnd_sdo_cmd_write_by_index_data, tvb, offset, size, ENC_NA); @@ -1657,19 +1622,13 @@ dissect_epl_sdo_command_read_by_index(proto_tree *epl_tree, tvbuff_t *tvb, packe } offset += 1; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "Read 0x%04X/%d", indx, subindx); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "Read 0x%04X/%d", indx, subindx); } else { /* response */ - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, "Resp. %s", + col_append_fstr(pinfo->cinfo, COL_INFO, "Resp. %s", val_to_str(segmented, epl_sdo_asnd_cmd_segmentation, "Unknown (%d)")); - } size = tvb_reported_length_remaining(tvb, offset); item = proto_tree_add_item(epl_tree, hf_epl_asnd_sdo_cmd_read_by_index_data, tvb, offset, size, ENC_NA); diff --git a/epan/dissectors/packet-erf.c b/epan/dissectors/packet-erf.c index 8c6c68e868..ae3cc2c1e7 100644 --- a/epan/dissectors/packet-erf.c +++ b/epan/dissectors/packet-erf.c @@ -1203,10 +1203,8 @@ dissect_erf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "ERF"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(erf_type, erf_type_vals, "Unknown type %u")); - } if (tree) { proto_item *erf_item; diff --git a/epan/dissectors/packet-esio.c b/epan/dissectors/packet-esio.c index fc82d8eae2..30f8d308b3 100644 --- a/epan/dissectors/packet-esio.c +++ b/epan/dissectors/packet-esio.c @@ -145,34 +145,33 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESIO"); col_clear(pinfo->cinfo, COL_INFO); esio_telegram_type = tvb_get_guint8(tvb,5); - if (check_col(pinfo->cinfo, COL_INFO)) { - switch (esio_telegram_type) { - case ESIO_TRANSFER: - esio_src_id = tvb_get_ntohl(tvb,16); - esio_nbr_data_transfers = tvb_get_guint8(tvb, 20); - esio_dst_id = tvb_get_ntohl(tvb,26); - col_add_fstr( pinfo->cinfo, COL_INFO, - "Data transfer: Src ID: %d, Dst ID(s): %d", - esio_src_id, esio_dst_id); - if (esio_nbr_data_transfers > 1) { - col_append_fstr( pinfo->cinfo, COL_INFO, - " ..."); - } - break; - case ESIO_STATUS: - esio_src_id = tvb_get_ntohl(tvb,16); - col_add_fstr( pinfo->cinfo, COL_INFO, - "Status/diag telegram: Src ID: %d", - esio_src_id); - break; - default: - /* All other telegrams */ - col_set_str( pinfo->cinfo, COL_INFO, - "Unknown telegram"); - break; - } - + + switch (esio_telegram_type) { + case ESIO_TRANSFER: + esio_src_id = tvb_get_ntohl(tvb,16); + esio_nbr_data_transfers = tvb_get_guint8(tvb, 20); + esio_dst_id = tvb_get_ntohl(tvb,26); + col_add_fstr( pinfo->cinfo, COL_INFO, + "Data transfer: Src ID: %d, Dst ID(s): %d", + esio_src_id, esio_dst_id); + if (esio_nbr_data_transfers > 1) { + col_append_fstr( pinfo->cinfo, COL_INFO, + " ..."); + } + break; + case ESIO_STATUS: + esio_src_id = tvb_get_ntohl(tvb,16); + col_add_fstr( pinfo->cinfo, COL_INFO, + "Status/diag telegram: Src ID: %d", + esio_src_id); + break; + default: + /* All other telegrams */ + col_set_str( pinfo->cinfo, COL_INFO, + "Unknown telegram"); + break; } + /* create display subtree for the protocol */ offset = 0; ti = proto_tree_add_item(tree, proto_esio, tvb, offset, -1, ENC_NA); diff --git a/epan/dissectors/packet-esis.c b/epan/dissectors/packet-esis.c index 698de81fbe..e6c96c678c 100644 --- a/epan/dissectors/packet-esis.c +++ b/epan/dissectors/packet-esis.c @@ -361,11 +361,9 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { * here. First, dump the name into info column, and THEN * dispatch the sub-type. */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str( ehdr.esis_type&OSI_PDU_TYPE_MASK, esis_vals, "Unknown (0x%x)" ) ); - } variable_len = ehdr.esis_length - ESIS_HDR_FIXED_LENGTH; diff --git a/epan/dissectors/packet-exec.c b/epan/dissectors/packet-exec.c index 8ada741f06..859ec85fdb 100644 --- a/epan/dissectors/packet-exec.c +++ b/epan/dissectors/packet-exec.c @@ -199,19 +199,17 @@ dissect_exec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "EXEC"); - if(check_col(pinfo->cinfo, COL_INFO)){ - /* First, clear the info column */ - col_clear(pinfo->cinfo, COL_INFO); + /* First, clear the info column */ + col_clear(pinfo->cinfo, COL_INFO); - /*username */ - if(hash_info->username && preference_info_show_username == TRUE){ - col_append_fstr(pinfo->cinfo, COL_INFO, "Username:%s ", hash_info->username); - } + /*username */ + if(hash_info->username && preference_info_show_username == TRUE){ + col_append_fstr(pinfo->cinfo, COL_INFO, "Username:%s ", hash_info->username); + } - /* Command */ - if(hash_info->command && preference_info_show_command == TRUE){ - col_append_fstr(pinfo->cinfo, COL_INFO, "Command:%s ", hash_info->command); - } + /* Command */ + if(hash_info->command && preference_info_show_command == TRUE){ + col_append_fstr(pinfo->cinfo, COL_INFO, "Command:%s ", hash_info->command); } /* create display subtree for the protocol */ diff --git a/epan/dissectors/packet-extreme.c b/epan/dissectors/packet-extreme.c index 1826b82a3f..321710f078 100644 --- a/epan/dissectors/packet-extreme.c +++ b/epan/dissectors/packet-extreme.c @@ -596,8 +596,7 @@ dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, prot return offset; } vlan_id = tvb_get_ntohs(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "%d", vlan_id); + col_append_fstr(pinfo->cinfo, COL_INFO, "%d", vlan_id); proto_item_append_text(vlan_item, ": ID %d", vlan_id); proto_tree_add_uint(vlan_tree, hf_edp_vlan_id, tvb, offset, 2, vlan_id); @@ -759,8 +758,7 @@ dissect_eaps_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length _U_, offset += 38; col_set_str(pinfo->cinfo, COL_PROTOCOL, "EAPS"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " ID: %d, MAC: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " ID: %d, MAC: %s", ctrlvlanid, sysmac_str); return offset; @@ -876,8 +874,7 @@ dissect_esl_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto offset += length; col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESL"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " ID: %d, MAC: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " ID: %d, MAC: %s", ctrlvlanid, sysmac_str); return offset; @@ -894,8 +891,7 @@ dissect_elsm_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, type = tvb_get_guint8(tvb, offset + 4); subtype = tvb_get_guint8(tvb, offset + 4 + 1); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " %s%s (#%d)", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s%s (#%d)", val_to_str(type, elsm_type_vals, "Unknown (0x%02x)"), val_to_str(subtype, elsm_subtype_vals, " Unknown (0x%02x)"), seqno); @@ -1074,8 +1070,7 @@ dissect_edp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "TLV with invalid length: %u", tlv_length); break; } - if (check_col(pinfo->cinfo, COL_INFO) && - tlv_type != EDP_TYPE_NULL) + if (tlv_type != EDP_TYPE_NULL) col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(tlv_type, edp_type_vals, "[0x%02x]")); diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index d846dea167..828d739201 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -852,16 +852,14 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean ftype = fc_get_ftype (fchdr.r_ctl, fchdr.type); - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_str (pinfo->cinfo, COL_INFO, val_to_str (ftype, fc_ftype_vals, - "Unknown Type (0x%x)")); - - if (ftype == FC_FTYPE_LINKCTL) - col_append_fstr (pinfo->cinfo, COL_INFO, ", %s", - val_to_str ((fchdr.r_ctl & 0x0F), - fc_lctl_proto_val, - "LCTL 0x%x")); - } + col_add_str (pinfo->cinfo, COL_INFO, val_to_str (ftype, fc_ftype_vals, + "Unknown Type (0x%x)")); + + if (ftype == FC_FTYPE_LINKCTL) + col_append_fstr (pinfo->cinfo, COL_INFO, ", %s", + val_to_str ((fchdr.r_ctl & 0x0F), + fc_lctl_proto_val, + "LCTL 0x%x")); if (vft_offset >= 0) { dissect_fc_vft(fc_tree, tvb, vft_offset); diff --git a/epan/dissectors/packet-fcct.c b/epan/dissectors/packet-fcct.c index 89b6ceb5de..9a536c09b3 100644 --- a/epan/dissectors/packet-fcct.c +++ b/epan/dissectors/packet-fcct.c @@ -163,20 +163,18 @@ dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) cthdr.opcode = g_ntohs (cthdr.opcode); cthdr.maxres_size = g_ntohs (cthdr.maxres_size); - if (check_col (pinfo->cinfo, COL_INFO)) { - if (cthdr.opcode < FCCT_MSG_REQ_MAX) { - col_append_str (pinfo->cinfo, COL_INFO, " Request"); - } - else if (cthdr.opcode == FCCT_MSG_ACC) { - col_append_str (pinfo->cinfo, COL_INFO, " Accept"); - } - else if (cthdr.opcode == FCCT_MSG_RJT) { - col_append_fstr (pinfo->cinfo, COL_INFO, " Reject (%s)", - val_to_str (cthdr.rjt_code, fc_ct_rjt_code_vals, "0x%x")); - } - else { - col_append_str (pinfo->cinfo, COL_INFO, " Reserved"); - } + if (cthdr.opcode < FCCT_MSG_REQ_MAX) { + col_append_str (pinfo->cinfo, COL_INFO, " Request"); + } + else if (cthdr.opcode == FCCT_MSG_ACC) { + col_append_str (pinfo->cinfo, COL_INFO, " Accept"); + } + else if (cthdr.opcode == FCCT_MSG_RJT) { + col_append_fstr (pinfo->cinfo, COL_INFO, " Reject (%s)", + val_to_str (cthdr.rjt_code, fc_ct_rjt_code_vals, "0x%x")); + } + else { + col_append_str (pinfo->cinfo, COL_INFO, " Reserved"); } in_id = cthdr.in_id; diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c index 6b754d2236..0039262e7c 100644 --- a/epan/dissectors/packet-fcdns.c +++ b/epan/dissectors/packet-fcdns.c @@ -1462,12 +1462,10 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) cthdr.maxres_size = g_ntohs (cthdr.maxres_size); /* Determine the type of server the request/response is for */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) - col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS"); - else - col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS"); - } + if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) + col_set_str (pinfo->cinfo, COL_PROTOCOL, "dNS"); + else + col_set_str (pinfo->cinfo, COL_PROTOCOL, "Unzoned NS"); if (tree) { if (cthdr.gstype == FCCT_GSTYPE_DIRSVC) { @@ -1514,10 +1512,8 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) g_hash_table_insert (fcdns_req_hash, req_key, cdata); } - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val, + col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val, "0x%x")); - } } else { /* Opcode is ACC or RJT */ @@ -1526,12 +1522,10 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->rxid, NO_PORT2); isreq = 0; if (!conversation) { - if (tree && (opcode == FCCT_MSG_ACC)) { - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_str (pinfo->cinfo, COL_INFO, + if (opcode == FCCT_MSG_ACC) { + col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_dns_opcode_val, "0x%x")); - } /* No record of what this accept is for. Can't decode */ proto_tree_add_text (fcdns_tree, tvb, 0, -1, "No record of Exchg. Unable to decode MSG_ACC/RJT"); @@ -1551,18 +1545,16 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) failed_opcode = cdata->opcode; } - if (check_col (pinfo->cinfo, COL_INFO)) { - if (opcode != FCCT_MSG_RJT) { - col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)", - val_to_str (opcode, fc_dns_opcode_val, - "0x%x")); - } - else { - col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)", - val_to_str (failed_opcode, - fc_dns_opcode_val, - "0x%x")); - } + if (opcode != FCCT_MSG_RJT) { + col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)", + val_to_str (opcode, fc_dns_opcode_val, + "0x%x")); + } + else { + col_add_fstr (pinfo->cinfo, COL_INFO, "RJT (%s)", + val_to_str (failed_opcode, + fc_dns_opcode_val, + "0x%x")); } if (tree) { diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c index eba442d25a..8e0d7fb307 100644 --- a/epan/dissectors/packet-fcels.c +++ b/epan/dissectors/packet-fcels.c @@ -2109,19 +2109,17 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - if (check_col (pinfo->cinfo, COL_INFO)) { - if (isreq == FC_ELS_REQ) { - col_add_str (pinfo->cinfo, COL_INFO, - val_to_str (opcode, fc_els_proto_val, "0x%x")); - } - else if (opcode == FC_ELS_LSRJT) { - col_add_fstr (pinfo->cinfo, COL_INFO, "LS_RJT (%s)", - val_to_str (failed_opcode, fc_els_proto_val, "0x%x")); - } - else { - col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)", - val_to_str (opcode, fc_els_proto_val, "0x%x")); - } + if (isreq == FC_ELS_REQ) { + col_add_str (pinfo->cinfo, COL_INFO, + val_to_str (opcode, fc_els_proto_val, "0x%x")); + } + else if (opcode == FC_ELS_LSRJT) { + col_add_fstr (pinfo->cinfo, COL_INFO, "LS_RJT (%s)", + val_to_str (failed_opcode, fc_els_proto_val, "0x%x")); + } + else { + col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)", + val_to_str (opcode, fc_els_proto_val, "0x%x")); } switch (opcode) { diff --git a/epan/dissectors/packet-fcfcs.c b/epan/dissectors/packet-fcfcs.c index d3cb2db466..b486ae8ed1 100644 --- a/epan/dissectors/packet-fcfcs.c +++ b/epan/dissectors/packet-fcfcs.c @@ -825,10 +825,8 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) g_hash_table_insert (fcfcs_req_hash, req_key, cdata); } - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_str (pinfo->cinfo, COL_INFO, + col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_fcs_opcode_abbrev_val, "0x%x")); - } } else { /* Opcode is ACC or RJT */ @@ -837,12 +835,10 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->rxid, NO_PORT2); isreq = 0; if (!conversation) { - if (tree && (opcode == FCCT_MSG_ACC)) { - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_str (pinfo->cinfo, COL_INFO, + if (opcode == FCCT_MSG_ACC) { + col_add_str (pinfo->cinfo, COL_INFO, val_to_str (opcode, fc_fcs_opcode_abbrev_val, "0x%x")); - } /* No record of what this accept is for. Can't decode */ proto_tree_add_text (fcfcs_tree, tvb, 0, tvb_length (tvb), "No record of Exchg. Unable to decode MSG_ACC/RJT"); @@ -862,18 +858,16 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) failed_opcode = cdata->opcode; } - if (check_col (pinfo->cinfo, COL_INFO)) { - if (opcode != FCCT_MSG_RJT) { - col_add_fstr (pinfo->cinfo, COL_INFO, "MSG_ACC (%s)", - val_to_str (opcode, fc_fcs_opcode_abbrev_val, - "0x%x")); - } - else { - col_add_fstr (pinfo->cinfo, COL_INFO, "MSG_RJT (%s)", - val_to_str (failed_opcode, - fc_fcs_opcode_abbrev_val, - "0x%x")); - } + if (opcode != FCCT_MSG_RJT) { + col_add_fstr (pinfo->cinfo, COL_INFO, "MSG_ACC (%s)", + val_to_str (opcode, fc_fcs_opcode_abbrev_val, + "0x%x")); + } + else { + col_add_fstr (pinfo->cinfo, COL_INFO, "MSG_RJT (%s)", + val_to_str (failed_opcode, + fc_fcs_opcode_abbrev_val, + "0x%x")); } if (tree) { diff --git a/epan/dissectors/packet-fcfzs.c b/epan/dissectors/packet-fcfzs.c index 030200134f..140ac562d0 100644 --- a/epan/dissectors/packet-fcfzs.c +++ b/epan/dissectors/packet-fcfzs.c @@ -665,10 +665,9 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) g_hash_table_insert(fcfzs_req_hash, req_key, cdata); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, fc_fzs_opcode_val, + + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, fc_fzs_opcode_val, "0x%x")); - } } else { /* Opcode is ACC or RJT */ @@ -677,12 +676,10 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->rxid, NO_PORT2); isreq = FALSE; if (!conversation) { - if (tree && (opcode == FCCT_MSG_ACC)) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + if (opcode == FCCT_MSG_ACC) { + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, fc_fzs_opcode_val, "0x%x")); - } /* No record of what this accept is for. Can't decode */ proto_tree_add_text(fcfzs_tree, tvb, 0, tvb_length(tvb), "No record of Exchg. Unable to decode MSG_ACC"); @@ -701,26 +698,22 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) failed_opcode = cdata->opcode; } - if (check_col(pinfo->cinfo, COL_INFO)) { - if (opcode != FCCT_MSG_RJT) { - col_add_fstr(pinfo->cinfo, COL_INFO, "MSG_ACC (%s)", - val_to_str(opcode, - fc_fzs_opcode_val, "0x%x")); - } - else { - col_add_fstr(pinfo->cinfo, COL_INFO, "MSG_RJT (%s)", - val_to_str(failed_opcode, - fc_fzs_opcode_val, "0x%x")); - } + if (opcode != FCCT_MSG_RJT) { + col_add_fstr(pinfo->cinfo, COL_INFO, "MSG_ACC (%s)", + val_to_str(opcode, + fc_fzs_opcode_val, "0x%x")); + } + else { + col_add_fstr(pinfo->cinfo, COL_INFO, "MSG_RJT (%s)", + val_to_str(failed_opcode, + fc_fzs_opcode_val, "0x%x")); } - if (tree) { - if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) { - /* No record of what this accept is for. Can't decode */ - proto_tree_add_text(fcfzs_tree, tvb, 0, tvb_length(tvb), - "No record of Exchg. Unable to decode MSG_ACC/RJT"); - return; - } + if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) { + /* No record of what this accept is for. Can't decode */ + proto_tree_add_text(fcfzs_tree, tvb, 0, tvb_length(tvb), + "No record of Exchg. Unable to decode MSG_ACC/RJT"); + return; } } } diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c index d8b25c2c7a..9808b7ed48 100644 --- a/epan/dissectors/packet-fcp.c +++ b/epan/dissectors/packet-fcp.c @@ -522,10 +522,8 @@ dissect_fcp_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, prot status = tvb_get_guint8(tvb, offset+11); - 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(status, scsi_status_val, "0x%x")); - } /* Save the response frame */ if (request_data != NULL) @@ -685,20 +683,16 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) els = (r_ctl & 0xf0) == FC_RCTL_LINK_DATA; r_ctl &= 0xF; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(r_ctl, els ? fcp_els_iu_val : fcp_iu_val, "0x%x")); - } - if (tree) { - ti = proto_tree_add_protocol_format(tree, proto_fcp, tvb, 0, -1, + ti = proto_tree_add_protocol_format(tree, proto_fcp, tvb, 0, -1, "FCP: %s", val_to_str(r_ctl, els ? fcp_els_iu_val : fcp_iu_val, "Unknown 0x%02x")); - fcp_tree = proto_item_add_subtree(ti, ett_fcp); - } + fcp_tree = proto_item_add_subtree(ti, ett_fcp); fc_conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, diff --git a/epan/dissectors/packet-fcsb3.c b/epan/dissectors/packet-fcsb3.c index 092166f24d..ef7988213f 100644 --- a/epan/dissectors/packet-fcsb3.c +++ b/epan/dissectors/packet-fcsb3.c @@ -732,10 +732,8 @@ dissect_fc_sbccs_sb3_iu_hdr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* Decode the basic SB3 and IU header and determine type of frame */ type = get_fc_sbccs_iu_type (tvb, offset); - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_str (pinfo->cinfo, COL_INFO, val_to_str (type, fc_sbccs_iu_val, + col_add_str (pinfo->cinfo, COL_INFO, val_to_str (type, fc_sbccs_iu_val, "0x%x")); - } if (tree) { /* Dissect SB3 header first */ @@ -780,12 +778,10 @@ static void dissect_fc_sbccs_dib_cmd_hdr (tvbuff_t *tvb, packet_info *pinfo, { guint8 flags; - 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 (tvb_get_guint8 (tvb, offset), fc_sbccs_dib_cmd_val, "0x%x")); - } if (tree) { proto_tree_add_item (tree, hf_sbccs_dib_ccw_cmd, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -858,13 +854,12 @@ static void dissect_fc_sbccs_dib_ctl_hdr (tvbuff_t *tvb, packet_info *pinfo, guint8 ctlfn; ctlfn = tvb_get_guint8 (tvb, offset); - if (check_col (pinfo->cinfo, COL_INFO)) { - col_append_fstr (pinfo->cinfo, COL_INFO, + col_append_fstr (pinfo->cinfo, COL_INFO, ": %s", val_to_str (ctlfn, fc_sbccs_dib_ctl_fn_val, "0x%x")); - } + if (tree) { proto_tree_add_item (tree, hf_sbccs_dib_ctlfn, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -906,13 +901,11 @@ static void dissect_fc_sbccs_dib_link_hdr (tvbuff_t *tvb, packet_info *pinfo, guint16 ctl_info; guint link_payload_len, i; - 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 (tvb_get_guint8 (tvb, offset+1), fc_sbccs_dib_link_ctl_fn_val, "0x%x")); - } if (tree) { link_ctl = tvb_get_guint8 (tvb, offset+1); @@ -988,10 +981,8 @@ static void dissect_fc_sbccs (tvbuff_t *tvb, packet_info *pinfo, type = get_fc_sbccs_iu_type (tvb, offset); get_fc_sbccs_conv_data (tvb, offset, &ch_cu_id, &dev_addr, &ccw); - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_str (pinfo->cinfo, COL_INFO, val_to_str (type, fc_sbccs_iu_val, + col_add_str (pinfo->cinfo, COL_INFO, val_to_str (type, fc_sbccs_iu_val, "0x%x")); - } /* Retrieve conversation state to determine expected payload */ conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, diff --git a/epan/dissectors/packet-fcsp.c b/epan/dissectors/packet-fcsp.c index be3cf245e7..20bdf064de 100644 --- a/epan/dissectors/packet-fcsp.c +++ b/epan/dissectors/packet-fcsp.c @@ -388,10 +388,8 @@ static void dissect_fcsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Make entry in the Info column on summary display */ opcode = tvb_get_guint8(tvb, 2); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, fcauth_msgcode_vals, "0x%x")); - } if (tree) { ti = proto_tree_add_protocol_format(tree, proto_fcsp, tvb, 0, diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index 0547c59622..d9fbc25aa0 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -1852,19 +1852,17 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - if (check_col(pinfo->cinfo, COL_INFO)) { - if (isreq == FC_SWILS_REQ) { - col_add_str(pinfo->cinfo, COL_INFO, + if (isreq == FC_SWILS_REQ) { + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(opcode, fc_swils_opcode_key_val, "0x%x")); + } + else if (opcode == FC_SWILS_SWRJT) { + col_add_fstr(pinfo->cinfo, COL_INFO, "SW_RJT (%s)", + val_to_str(failed_opcode, fc_swils_opcode_key_val, "0x%x")); + } + else { + col_add_fstr(pinfo->cinfo, COL_INFO, "SW_ACC (%s)", val_to_str(opcode, fc_swils_opcode_key_val, "0x%x")); - } - else if (opcode == FC_SWILS_SWRJT) { - col_add_fstr(pinfo->cinfo, COL_INFO, "SW_RJT (%s)", - val_to_str(failed_opcode, fc_swils_opcode_key_val, "0x%x")); - } - else { - col_add_fstr(pinfo->cinfo, COL_INFO, "SW_ACC (%s)", - val_to_str(opcode, fc_swils_opcode_key_val, "0x%x")); - } } if (tree) { diff --git a/epan/dissectors/packet-fefd.c b/epan/dissectors/packet-fefd.c index e7fa6e64fb..fe75ae2e8e 100644 --- a/epan/dissectors/packet-fefd.c +++ b/epan/dissectors/packet-fefd.c @@ -147,8 +147,7 @@ dissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case TYPE_DEVICE_ID: /* Device ID */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Device ID: %s", tvb_format_stringzpad(tvb, offset + 4, length - 4)); @@ -181,8 +180,7 @@ dissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) real_length = length + 3; } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Port ID: %s", tvb_format_stringzpad(tvb, offset + 4, real_length - 4)); diff --git a/epan/dissectors/packet-ff.c b/epan/dissectors/packet-ff.c index 46deb7fe5e..40465718b2 100644 --- a/epan/dissectors/packet-ff.c +++ b/epan/dissectors/packet-ff.c @@ -11660,8 +11660,7 @@ dissect_ff_msg_body(tvbuff_t *tvb, gint offset, guint32 length, break; default: - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Service (Protocol Id: %u, Confirmed Msg Type: %u) " "(%s Service Id = %u)", (ProtocolAndType & PROTOCOL_MASK) >> 2, @@ -11669,7 +11668,6 @@ dissect_ff_msg_body(tvbuff_t *tvb, gint offset, guint32 length, (Service & SERVICE_CONFIRMED_FLAG_MASK)? "Confirmed": "Unconfirmed", Service & SERVICE_SERVICE_ID_MASK); - } if (length) { proto_tree_add_text(tree, tvb, offset, length, diff --git a/epan/dissectors/packet-fix.c b/epan/dissectors/packet-fix.c index b4044c43d0..2b33b55c37 100644 --- a/epan/dissectors/packet-fix.c +++ b/epan/dissectors/packet-fix.c @@ -230,6 +230,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) char *value; char *tag_str; fix_parameter *tag; + const char *msg_type; /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "FIX"); @@ -268,13 +269,9 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return; } - if (check_col(pinfo->cinfo, COL_INFO)) { - const char *msg_type; - - value = tvb_get_ephemeral_string(tvb, tag->value_offset, tag->value_len); - msg_type = str_to_str(value, messages_val, "FIX Message (%s)"); - col_add_str(pinfo->cinfo, COL_INFO, msg_type); - } + value = tvb_get_ephemeral_string(tvb, tag->value_offset, tag->value_len); + msg_type = str_to_str(value, messages_val, "FIX Message (%s)"); + col_add_str(pinfo->cinfo, COL_INFO, msg_type); /* 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-foundry.c b/epan/dissectors/packet-foundry.c index d24938b67c..0fd7bbf415 100644 --- a/epan/dissectors/packet-foundry.c +++ b/epan/dissectors/packet-foundry.c @@ -306,8 +306,7 @@ dissect_fdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } type_string = val_to_str(tlv_type, fdp_type_vals, "[%u]"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", type_string); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", type_string); switch (tlv_type) { case FDP_TYPE_NAME: diff --git a/epan/dissectors/packet-fp_hint.c b/epan/dissectors/packet-fp_hint.c index b098410c4e..514282be6b 100644 --- a/epan/dissectors/packet-fp_hint.c +++ b/epan/dissectors/packet-fp_hint.c @@ -491,8 +491,7 @@ static void dissect_fp_hint(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *ti; proto_tree *fph_tree = NULL; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, "FP Hint"); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "FP Hint"); hdrlen = tvb_get_letohs(tvb, 0); frame_type = tvb_get_guint8(tvb, 2); diff --git a/epan/dissectors/packet-fr.c b/epan/dissectors/packet-fr.c index cda4b18c13..46d7bd9d1a 100644 --- a/epan/dissectors/packet-fr.c +++ b/epan/dissectors/packet-fr.c @@ -550,9 +550,7 @@ dissect_fr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pinfo->ctype = CT_DLCI; pinfo->circuit_id = addr; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "DLCI %u", addr); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "DLCI %u", addr); } switch (fr_encap) { diff --git a/epan/dissectors/packet-fractalgeneratorprotocol.c b/epan/dissectors/packet-fractalgeneratorprotocol.c index 729e877daa..9615e96d14 100644 --- a/epan/dissectors/packet-fractalgeneratorprotocol.c +++ b/epan/dissectors/packet-fractalgeneratorprotocol.c @@ -149,9 +149,8 @@ dissect_fractalgeneratorprotocol_message(tvbuff_t *message_tvb, packet_info *pin guint8 type; type = tvb_get_guint8(message_tvb, MESSAGE_TYPE_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(type, message_type_values, "Unknown FractalGeneratorProtocol type")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(type, message_type_values, "Unknown FractalGeneratorProtocol type")); + proto_tree_add_item(fractalgeneratorprotocol_tree, hf_message_type, message_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, ENC_BIG_ENDIAN); proto_tree_add_item(fractalgeneratorprotocol_tree, hf_message_flags, message_tvb, MESSAGE_FLAGS_OFFSET, MESSAGE_FLAGS_LENGTH, ENC_BIG_ENDIAN); proto_tree_add_item(fractalgeneratorprotocol_tree, hf_message_length, message_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-fw1.c b/epan/dissectors/packet-fw1.c index 4b904ab814..231ed1683a 100644 --- a/epan/dissectors/packet-fw1.c +++ b/epan/dissectors/packet-fw1.c @@ -188,8 +188,7 @@ dissect_fw1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - if (check_col(pinfo->cinfo, COL_IF_DIR)) - col_add_str(pinfo->cinfo, COL_IF_DIR, header->str + sizeof(fw1_header) + 1); + col_add_str(pinfo->cinfo, COL_IF_DIR, header->str + sizeof(fw1_header) + 1); if (tree) { if (!fw1_summary_in_tree) diff --git a/epan/dissectors/packet-gdsdb.c b/epan/dissectors/packet-gdsdb.c index d9aef20b3c..eba4fcb59c 100644 --- a/epan/dissectors/packet-gdsdb.c +++ b/epan/dissectors/packet-gdsdb.c @@ -425,12 +425,10 @@ gdsdb_connect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_length(tvb) < 16) { return 0; } - if (check_col(pinfo->cinfo, COL_INFO)){ - col_append_str(pinfo->cinfo, COL_INFO, ": "); - col_append_str(pinfo->cinfo, COL_INFO, + col_append_str(pinfo->cinfo, COL_INFO, ": "); + col_append_str(pinfo->cinfo, COL_INFO, tvb_format_text(tvb, 20, tvb_get_ntohl(tvb, 16))); - } if (tree) { offset = 4; proto_tree_add_item(tree, hf_gdsdb_connect_operation, tvb, @@ -538,13 +536,13 @@ gdsdb_attach(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) if (tvb_length(tvb) < 20) { return 0; } - if (check_col(pinfo->cinfo, COL_INFO)){ - col_append_str(pinfo->cinfo, COL_INFO, ": "); - col_append_str(pinfo->cinfo, COL_INFO, + + col_append_str(pinfo->cinfo, COL_INFO, ": "); + col_append_str(pinfo->cinfo, COL_INFO, tvb_format_text(tvb, 12, tvb_get_ntohl(tvb, 8))); - } - if (tree) { + + if (tree) { offset = 4; proto_tree_add_item(tree, hf_gdsdb_attach_database, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -1020,13 +1018,12 @@ gdsdb_prepare(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) if (tvb_length(tvb) < 32) { return 0; } - if (check_col(pinfo->cinfo, COL_INFO)){ - col_append_str(pinfo->cinfo, COL_INFO, ": "); - col_append_str(pinfo->cinfo, COL_INFO, + col_append_str(pinfo->cinfo, COL_INFO, ": "); + col_append_str(pinfo->cinfo, COL_INFO, tvb_format_text(tvb, 20, tvb_get_ntohl(tvb, 16))); - } - if(tree) { + + if(tree) { offset = 4; proto_tree_add_item(tree, hf_gdsdb_prepare_transaction, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -1261,8 +1258,7 @@ dissect_gdsdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U col_set_str(pinfo->cinfo, COL_PROTOCOL, "GDS DB"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, gdsdb_opcode, "Unknown opcode %u")); if (tree) { diff --git a/epan/dissectors/packet-gift.c b/epan/dissectors/packet-gift.c index bbebaa1847..68c68ee236 100644 --- a/epan/dissectors/packet-gift.c +++ b/epan/dissectors/packet-gift.c @@ -67,8 +67,7 @@ dissect_gift(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) line = tvb_get_ptr(tvb, offset, linelen); /* set "Info" column text */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", is_request ? "Request" : "Response", format_text(line, linelen)); diff --git a/epan/dissectors/packet-gnutella.c b/epan/dissectors/packet-gnutella.c index d9ff2e547b..8c1e794f14 100644 --- a/epan/dissectors/packet-gnutella.c +++ b/epan/dissectors/packet-gnutella.c @@ -385,8 +385,7 @@ static void dissect_gnutella_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree * break; } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", payload_descriptor_text); if (tree) { diff --git a/epan/dissectors/packet-h1.c b/epan/dissectors/packet-h1.c index 5e59083512..80ae24e84c 100644 --- a/epan/dissectors/packet-h1.c +++ b/epan/dissectors/packet-h1.c @@ -149,12 +149,10 @@ static gboolean dissect_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset + position + 2, 1, tvb_get_guint8(tvb,offset + position + 2)); } - if (check_col (pinfo->cinfo, COL_INFO)) - { + col_append_str (pinfo->cinfo, COL_INFO, val_to_str (tvb_get_guint8(tvb,offset + position + 2), opcode_vals,"Unknown Opcode (0x%2.2x)")); - } break; case REQUEST_BLOCK: if (h1_tree) @@ -180,8 +178,6 @@ static gboolean dissect_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset + position + 6, 2, tvb_get_ntohs(tvb,offset+position+6)); } - if (check_col (pinfo->cinfo, COL_INFO)) - { col_append_fstr (pinfo->cinfo, COL_INFO, " %s %d", val_to_str (tvb_get_guint8(tvb,offset + position + 2), org_vals,"Unknown Type (0x%2.2x)"), @@ -190,7 +186,6 @@ static gboolean dissect_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvb_get_ntohs(tvb,offset+position+4)); col_append_fstr (pinfo->cinfo, COL_INFO, " Count %d", tvb_get_ntohs(tvb,offset+position+6)); - } break; case RESPONSE_BLOCK: if (h1_tree) @@ -207,12 +202,9 @@ static gboolean dissect_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset + position + 2, 1, tvb_get_guint8(tvb,offset + position+2)); } - if (check_col (pinfo->cinfo, COL_INFO)) - { col_append_fstr (pinfo->cinfo, COL_INFO, " %s", val_to_str (tvb_get_guint8(tvb,offset + position + 2), returncode_vals,"Unknown Returncode (0x%2.2x")); - } break; case EMPTY_BLOCK: if (h1_tree) diff --git a/epan/dissectors/packet-homeplug-av.c b/epan/dissectors/packet-homeplug-av.c index 96ba0ccfd0..64e87d3f4e 100644 --- a/epan/dissectors/packet-homeplug-av.c +++ b/epan/dissectors/packet-homeplug-av.c @@ -3212,10 +3212,8 @@ dissect_homeplug_av(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_homeplug_av_mmhdr(cursor, &homeplug_av_mmver, &homeplug_av_mmtype); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", + col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", val_to_str_ext(homeplug_av_mmtype, &homeplug_av_mmtype_vals_ext, "Unknown 0x%x")); - } dissect_homeplug_av_mme(cursor, homeplug_av_mmver, homeplug_av_mmtype); } diff --git a/epan/dissectors/packet-homeplug.c b/epan/dissectors/packet-homeplug.c index 61004f1ce0..dd621c3b9c 100644 --- a/epan/dissectors/packet-homeplug.c +++ b/epan/dissectors/packet-homeplug.c @@ -1021,8 +1021,7 @@ static void dissect_homeplug_ns(ptvcursor_t * cursor, packet_info * pinfo) proto_item * ti; /* Append Basic/Extender specifier to info column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_str(pinfo->cinfo, COL_INFO, extended ? " Extended" : " Basic"); + col_append_str(pinfo->cinfo, COL_INFO, extended ? " Extended" : " Basic"); if (!ptvcursor_tree(cursor)) return; @@ -1171,8 +1170,7 @@ static void dissect_homeplug_bc(ptvcursor_t * cursor, packet_info * pinfo) & HOMEPLUG_BC_NETWORK; /* Append Network/Local specifier to info column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_str(pinfo->cinfo, COL_INFO, network ? " Network" : " Local"); + col_append_str(pinfo->cinfo, COL_INFO, network ? " Network" : " Local"); /* Call specific dissector */ if (network) @@ -1221,10 +1219,8 @@ static void dissect_homeplug_unknown(ptvcursor_t * cursor) static void dissect_homeplug_mme(ptvcursor_t * cursor, packet_info * pinfo) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", + col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", val_to_str(homeplug_metype, homeplug_metype_vals, "Unknown 0x%x")); - } switch(homeplug_metype) { case HOMEPLUG_MME_RCE: diff --git a/epan/dissectors/packet-hpext.c b/epan/dissectors/packet-hpext.c index 4aa01df984..40ee047806 100644 --- a/epan/dissectors/packet-hpext.c +++ b/epan/dissectors/packet-hpext.c @@ -74,8 +74,7 @@ dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) 2, sxsap); } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "; HPEXT; DXSAP %s, SXSAP %s", val_to_str(dxsap, xsap_vals, "%04x"), val_to_str(sxsap, xsap_vals, "%04x")); diff --git a/epan/dissectors/packet-hsrp.c b/epan/dissectors/packet-hsrp.c index c455b54674..a3390f862e 100644 --- a/epan/dissectors/packet-hsrp.c +++ b/epan/dissectors/packet-hsrp.c @@ -347,22 +347,17 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ col_set_str(pinfo->cinfo, COL_PROTOCOL, "HSRP"); opcode = tvb_get_guint8(tvb, 1); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(opcode, hsrp_opcode_vals, "Unknown")); - } + if (opcode < 3) { state = tvb_get_guint8(tvb, 2); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " (state %s)", + col_append_fstr(pinfo->cinfo, COL_INFO, " (state %s)", val_to_str_const(state, hsrp_state_vals, "Unknown")); - } } else if (opcode == 3) { state = tvb_get_guint8(tvb, 6); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " (state %s)", + col_append_fstr(pinfo->cinfo, COL_INFO, " (state %s)", val_to_str_const(state, hsrp_adv_state_vals, "Unknown")); - } } if (tree) { @@ -463,16 +458,12 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ offset+=2; opcode = tvb_get_guint8(tvb, offset+1); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(opcode, hsrp2_opcode_vals, "Unknown")); - } state = tvb_get_guint8(tvb, offset+2); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " (state %s)", + col_append_fstr(pinfo->cinfo, COL_INFO, " (state %s)", val_to_str_const(state, hsrp2_state_vals, "Unknown")); - } if (tree) { /* Making Group State TLV subtree. */ @@ -525,9 +516,7 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ active = tvb_get_ntohs(tvb, offset+2); passive = tvb_get_ntohs(tvb, offset+4); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Interface State TLV (Act=%d Pass=%d)",active,passive); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "Interface State TLV (Act=%d Pass=%d)",active,passive); if (tree) { proto_tree *interface_state_tlv; diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 80a102278a..036315eaa4 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -766,26 +766,23 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo, break; } - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_tag); - if (check_col(pinfo->cinfo, COL_INFO)) { - /* - * Put the first line from the buffer into the summary - * if it's an HTTP request or reply (but leave out the - * line terminator). - * Otherwise, just call it a continuation. - * - * Note that "tvb_find_line_end()" will return a value that - * is not longer than what's in the buffer, so the - * "tvb_get_ptr()" call won't throw an exception. - */ - if (is_request_or_reply) { - line = tvb_get_ptr(tvb, offset, first_linelen); - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", format_text(line, first_linelen)); - } - else - col_set_str(pinfo->cinfo, COL_INFO, "Continuation or non-HTTP traffic"); + col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_tag); + /* + * Put the first line from the buffer into the summary + * if it's an HTTP request or reply (but leave out the + * line terminator). + * Otherwise, just call it a continuation. + * + * Note that "tvb_find_line_end()" will return a value that + * is not longer than what's in the buffer, so the + * "tvb_get_ptr()" call won't throw an exception. + */ + if (is_request_or_reply) { + line = tvb_get_ptr(tvb, offset, first_linelen); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", format_text(line, first_linelen)); } + else + col_set_str(pinfo->cinfo, COL_INFO, "Continuation or non-HTTP traffic"); orig_offset = offset; if (tree) { @@ -2650,8 +2647,7 @@ dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * first HTTP message; set a fence so that subsequent * HTTP messages don't overwrite the Info column. */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_set_fence(pinfo->cinfo, COL_INFO); + col_set_fence(pinfo->cinfo, COL_INFO); } } } diff --git a/epan/dissectors/packet-hyperscsi.c b/epan/dissectors/packet-hyperscsi.c index 6833435846..89247e9a5d 100644 --- a/epan/dissectors/packet-hyperscsi.c +++ b/epan/dissectors/packet-hyperscsi.c @@ -137,10 +137,8 @@ dissect_hyperscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hs_cmd &= OPCODE_MASK; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_str(pinfo->cinfo, COL_INFO, + col_append_str(pinfo->cinfo, COL_INFO, val_to_str(hs_cmd, hscsi_opcodes, "Unknown HyperSCSI Request or Response (%u)")); - } if (tree) { ti = proto_tree_add_text(hs_tree, tvb, 3, -1, "HyperSCSI PDU"); diff --git a/epan/dissectors/packet-i2c.c b/epan/dissectors/packet-i2c.c index ffb264143d..403ad80318 100644 --- a/epan/dissectors/packet-i2c.c +++ b/epan/dissectors/packet-i2c.c @@ -203,33 +203,25 @@ dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->ptype = PT_I2C; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - if (is_event) - col_set_str(pinfo->cinfo, COL_PROTOCOL, "I2C Event"); - else - col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "I2C %s", - (flags & I2C_FLAG_RD) ? "Read" : "Write"); - } - - if (check_col(pinfo->cinfo, COL_DEF_SRC)) { - col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "I2C-%d", bus); - } - - if (check_col(pinfo->cinfo, COL_DEF_DST)) { - if (is_event) - col_add_fstr(pinfo->cinfo, COL_DEF_DST, "----"); - else - col_add_fstr(pinfo->cinfo, COL_DEF_DST, "0x%02x", addr); - } - - if (check_col(pinfo->cinfo, COL_INFO)) { - if (is_event) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", - i2c_get_event_desc(flags)); - else - col_add_fstr(pinfo->cinfo, COL_INFO, "I2C %s, %d bytes", + if (is_event) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "I2C Event"); + else + col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "I2C %s", + (flags & I2C_FLAG_RD) ? "Read" : "Write"); + + col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "I2C-%d", bus); + + if (is_event) + col_add_fstr(pinfo->cinfo, COL_DEF_DST, "----"); + else + col_add_fstr(pinfo->cinfo, COL_DEF_DST, "0x%02x", addr); + + if (is_event) + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", + i2c_get_event_desc(flags)); + else + col_add_fstr(pinfo->cinfo, COL_INFO, "I2C %s, %d bytes", (flags & I2C_FLAG_RD) ? "Read" : "Write", len); - } if (tree) { ti = proto_tree_add_protocol_format(tree, proto_i2c, tvb, 0, -1, diff --git a/epan/dissectors/packet-iapp.c b/epan/dissectors/packet-iapp.c index 52e101b04c..660edded1b 100644 --- a/epan/dissectors/packet-iapp.c +++ b/epan/dissectors/packet-iapp.c @@ -415,11 +415,8 @@ dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ia_version = (int)ih.ia_version; ia_type = (int)ih.ia_type; codestrval = val_to_str_const(ia_type, iapp_vals, "Unknown Packet"); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s(%d) (version=%d)", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s(%d) (version=%d)", codestrval, ia_type, ia_version); - } if (tree) { diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index c995a3b67b..4c37f0e10a 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -1005,8 +1005,7 @@ static void iax2_populate_pinfo_from_packet_data(packet_info *pinfo, const iax_ pinfo -> circuit_id = (guint32)p->call_data->forward_circuit_ids[0]; pinfo -> p2p_dir = p->reversed?P2P_DIR_RECV:P2P_DIR_SENT; - if (check_col(pinfo->cinfo, COL_IF_DIR)) - col_set_str(pinfo->cinfo, COL_IF_DIR, p->reversed ? "rev" : "fwd"); + col_set_str(pinfo->cinfo, COL_IF_DIR, p->reversed ? "rev" : "fwd"); } } @@ -1482,8 +1481,7 @@ static guint32 dissect_iax2_command(tvbuff_t *tvb, guint32 offset, ti = proto_tree_add_uint(tree, hf_iax2_iax_csub, tvb, offset, 1, csub); 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_ext(csub, &iax_iax_subclasses_ext, "unknown (0x%02x)")); if (offset >= tvb_reported_length(tvb)) @@ -1642,11 +1640,10 @@ dissect_fullpacket(tvbuff_t *tvb, guint32 offset, /* add frame type to info line */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s, source call# %d, timestamp %ums", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s, source call# %d, timestamp %ums", val_to_str_ext(type, &iax_frame_types_ext, "Unknown (0x%02x)"), scallno, ts); - } + iax2_info->messageName = val_to_str_ext(type, &iax_frame_types_ext, "Unknown (0x%02x)"); switch (type) { @@ -1661,8 +1658,7 @@ dissect_fullpacket(tvbuff_t *tvb, guint32 offset, proto_tree_add_item(packet_type_tree, hf_iax2_dtmf_csub, tvb, offset+9, 1, ENC_ASCII|ENC_NA); offset += 10; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " digit %c", csub); + col_append_fstr(pinfo->cinfo, COL_INFO, " digit %c", csub); break; case AST_FRAME_CONTROL: @@ -1671,8 +1667,7 @@ dissect_fullpacket(tvbuff_t *tvb, guint32 offset, offset+9, 1, csub); offset += 10; - 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(csub, &iax_cmd_subclasses_ext, "unknown (0x%02x)")); iax2_info->messageName = val_to_str_ext (csub, &iax_cmd_subclasses_ext, "unknown (0x%02x)"); if (csub < NUM_TAP_CMD_VOIP_STATES) iax2_info->callState = tap_cmd_voip_state[csub]; @@ -1736,8 +1731,7 @@ dissect_fullpacket(tvbuff_t *tvb, guint32 offset, proto_tree_add_item(packet_type_tree, hf_iax2_modem_csub, tvb, offset+9, 1, ENC_BIG_ENDIAN); offset += 10; - 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(csub, iax_modem_subclasses, "unknown (0x%02x)")); break; @@ -1748,8 +1742,7 @@ dissect_fullpacket(tvbuff_t *tvb, guint32 offset, 1, csub); offset += 10; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " subclass %d", csub); + col_append_fstr(pinfo->cinfo, COL_INFO, " subclass %d", csub); break; } @@ -1825,8 +1818,7 @@ static guint32 dissect_minivideopacket(tvbuff_t *tvb, guint32 offset, offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Mini video packet, source call# %d, timestamp %ums%s", scallno, ts, rtp_marker?", Mark":""); @@ -1868,8 +1860,7 @@ static guint32 dissect_minipacket(tvbuff_t *tvb, guint32 offset, guint16 scallno offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Mini packet, source call# %d, timestamp %ums", scallno, ts); @@ -2303,8 +2294,7 @@ static void dissect_payload(tvbuff_t *tvb, guint32 offset, /* XXX shouldn't pass through out-of-order packets. */ - if (check_col(pinfo->cinfo, COL_INFO)) { - if (!video && iax_call && iax_call -> dataformat != 0) { + if (!video && iax_call && iax_call -> dataformat != 0) { col_append_fstr(pinfo->cinfo, COL_INFO, ", data, format %s", val_to_str(iax_call -> dataformat, iax_dataformats, "unknown (0x%02x)")); @@ -2312,10 +2302,9 @@ static void dissect_payload(tvbuff_t *tvb, guint32 offset, if (out_of_order) col_append_str(pinfo->cinfo, COL_INFO, " (out-of-order packet)"); #endif - } else { + } else { col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_ext(codec, &codec_types_ext, "unknown (0x%02x)")); - } } nbytes = tvb_reported_length(sub_tvb); diff --git a/epan/dissectors/packet-icap.c b/epan/dissectors/packet-icap.c index 0a70c2b934..fa60c1d1ca 100644 --- a/epan/dissectors/packet-icap.c +++ b/epan/dissectors/packet-icap.c @@ -72,27 +72,24 @@ dissect_icap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "ICAP"); - if (check_col(pinfo->cinfo, COL_INFO)) { - /* - * Put the first line from the buffer into the summary - * if it's an ICAP header (but leave out the - * line terminator). - * Otherwise, just call it a continuation. - * - * Note that "tvb_find_line_end()" will return a value that - * is not longer than what's in the buffer, so the - * "tvb_get_ptr()" call won't throw an exception. - */ - linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, - FALSE); - line = tvb_get_ptr(tvb, offset, linelen); - icap_type = ICAP_OTHER; /* type not known yet */ - if (is_icap_message(line, linelen, &icap_type)) - col_add_str(pinfo->cinfo, COL_INFO, - format_text(line, linelen)); - else - col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); - } + /* + * Put the first line from the buffer into the summary + * if it's an ICAP header (but leave out the + * line terminator). + * Otherwise, just call it a continuation. + * + * Note that "tvb_find_line_end()" will return a value that + * is not longer than what's in the buffer, so the + * "tvb_get_ptr()" call won't throw an exception. + */ + linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); + line = tvb_get_ptr(tvb, offset, linelen); + icap_type = ICAP_OTHER; /* type not known yet */ + if (is_icap_message(line, linelen, &icap_type)) + col_add_str(pinfo->cinfo, COL_INFO, + format_text(line, linelen)); + else + col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); if (tree) { ti = proto_tree_add_item(tree, proto_icap, tvb, offset, -1, diff --git a/epan/dissectors/packet-icp.c b/epan/dissectors/packet-icp.c index 5624a4dc99..7e316d69ed 100644 --- a/epan/dissectors/packet-icp.c +++ b/epan/dissectors/packet-icp.c @@ -155,12 +155,9 @@ static void dissect_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_length=tvb_get_ntohs(tvb, 2); request_number=tvb_get_ntohl(tvb, 4); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_fstr(pinfo->cinfo,COL_INFO,"Opcode: %s (%u), Req Nr: %u", - val_to_str_const(opcode, opcode_vals, "Unknown"), opcode, - request_number); - } + col_add_fstr(pinfo->cinfo,COL_INFO,"Opcode: %s (%u), Req Nr: %u", + val_to_str_const(opcode, opcode_vals, "Unknown"), opcode, + request_number); if (tree) { diff --git a/epan/dissectors/packet-icq.c b/epan/dissectors/packet-icq.c index 5eb13f77bf..b9af2e78e5 100644 --- a/epan/dissectors/packet-icq.c +++ b/epan/dissectors/packet-icq.c @@ -1493,8 +1493,7 @@ dissect_icqv5Client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) cmd = tvb_get_letohs(decr_tvb, ICQ5_CL_CMD); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "ICQv5 %s", findClientCmd(cmd)); + col_add_fstr(pinfo->cinfo, COL_INFO, "ICQv5 %s", findClientCmd(cmd)); if (tree) { ti = proto_tree_add_protocol_format(tree, proto_icq, tvb, 0, -1, @@ -1590,7 +1589,7 @@ dissect_icqv5Server(tvbuff_t *tvb, int offset, packet_info *pinfo, guint16 cmd; cmd = tvb_get_letohs(tvb, offset + ICQ5_SRV_CMD); - if (changeCol && check_col(pinfo->cinfo, COL_INFO)) + if (changeCol) col_add_fstr(pinfo->cinfo, COL_INFO, "ICQv5 %s", findServerCmd(cmd)); if (pktsize == -1) diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index 130189005a..d64bb2dcb5 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -411,8 +411,8 @@ dissect_ieee802154_fcf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ieee packet->src_addr_mode = (fcf & IEEE802154_FCF_SADDR_MASK) >> 14; /* Display the frame type. */ - if (tree) proto_item_append_text(tree, " %s", val_to_str_const(packet->frame_type, ieee802154_frame_types, "Reserved")); - if (check_col(pinfo->cinfo, COL_INFO)) col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet->frame_type, ieee802154_frame_types, "Reserved")); + proto_item_append_text(tree, " %s", val_to_str_const(packet->frame_type, ieee802154_frame_types, "Reserved")); + col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet->frame_type, ieee802154_frame_types, "Reserved")); /* Add the FCF to the protocol tree. */ if (tree) { @@ -470,10 +470,8 @@ dissect_ieee802154_nonask_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre /* Add the protocol name. */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IEEE 802.15.4 non-ASK PHY"); /* Add the packet length. */ - if(check_col(pinfo->cinfo, COL_PACKET_LENGTH)){ - col_clear(pinfo->cinfo, COL_PACKET_LENGTH); - col_add_fstr(pinfo->cinfo, COL_PACKET_LENGTH, "%i", tvb_length(tvb)); - } + col_clear(pinfo->cinfo, COL_PACKET_LENGTH); + col_add_fstr(pinfo->cinfo, COL_PACKET_LENGTH, "%i", tvb_length(tvb)); preamble=tvb_get_letohl(tvb,offset); sfd=tvb_get_guint8(tvb,offset+4); @@ -645,10 +643,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g /* Add the protocol name. */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IEEE 802.15.4"); /* Add the packet length. */ - if(check_col(pinfo->cinfo, COL_PACKET_LENGTH)){ - col_clear(pinfo->cinfo, COL_PACKET_LENGTH); - col_add_fstr(pinfo->cinfo, COL_PACKET_LENGTH, "%i", tvb_length(tvb)); - } + col_clear(pinfo->cinfo, COL_PACKET_LENGTH); + col_add_fstr(pinfo->cinfo, COL_PACKET_LENGTH, "%i", tvb_length(tvb)); /* Add the packet length to the filter field */ hidden_item = proto_tree_add_uint(tree, hf_ieee802154_frame_length, NULL, 0, 0, tvb_reported_length(tvb)); @@ -723,9 +719,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g proto_item_append_text(proto_root, ", Dst: %s", dst_addr); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst: %s", dst_addr); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst: %s", dst_addr); offset += 2; } else if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_EXT) { @@ -748,9 +742,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g proto_tree_add_item(ieee802154_tree, hf_ieee802154_dst64, tvb, offset, 8, ENC_LITTLE_ENDIAN); proto_item_append_text(proto_root, ", Dst: %s", get_eui64_name(packet->dst64)); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst: %s", get_eui64_name(packet->dst64)); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst: %s", get_eui64_name(packet->dst64)); offset += 8; } else if (packet->dst_addr_mode != IEEE802154_FCF_ADDR_NONE) { @@ -835,9 +827,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g } } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: %s", src_addr); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: %s", src_addr); + offset += 2; } else if (packet->src_addr_mode == IEEE802154_FCF_ADDR_EXT) { @@ -861,9 +852,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g proto_item_append_text(proto_root, ", Src: %s", get_eui64_name(packet->src64)); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: %s", get_eui64_name(packet->src64)); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: %s", get_eui64_name(packet->src64)); offset += 8; } else if (packet->src_addr_mode != IEEE802154_FCF_ADDR_NONE) { @@ -976,9 +965,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g offset++; /* Display the command identifier in the info column. */ - if(check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet->command_id, ieee802154_cmd_names, "Unknown Command")); - } + col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet->command_id, ieee802154_cmd_names, "Unknown Command")); } /* No other frame types have nonpayload fields. */ @@ -1534,21 +1521,19 @@ dissect_ieee802154_assoc_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree offset += 1; /* Update the info column. */ - if (check_col(pinfo->cinfo, COL_INFO)) { - if (status == IEEE802154_CMD_ASRSP_AS_SUCCESS) { - /* Association was successful. */ - if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", PAN: 0x%04x", packet->dst_pan); - } - if (short_addr != IEEE802154_NO_ADDR16) { - col_append_fstr(pinfo->cinfo, COL_INFO, " Addr: 0x%04x", short_addr); - } + if (status == IEEE802154_CMD_ASRSP_AS_SUCCESS) { + /* Association was successful. */ + if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) { + col_append_fstr(pinfo->cinfo, COL_INFO, ", PAN: 0x%04x", packet->dst_pan); } - else { - /* Association was unsuccessful. */ - col_append_fstr(pinfo->cinfo, COL_INFO, ", Unsuccessful"); + if (short_addr != IEEE802154_NO_ADDR16) { + col_append_fstr(pinfo->cinfo, COL_INFO, " Addr: 0x%04x", short_addr); } } + else { + /* Association was unsuccessful. */ + col_append_fstr(pinfo->cinfo, COL_INFO, ", Unsuccessful"); + } /* Update the address table. */ if ((status == IEEE802154_CMD_ASRSP_AS_SUCCESS) && (short_addr != IEEE802154_NO_ADDR16)) { @@ -1657,27 +1642,26 @@ dissect_ieee802154_realign(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Get and display the command PAN ID. */ pan_id = tvb_get_letohs(tvb, offset); - if (tree) proto_tree_add_uint(subtree, hf_ieee802154_realign_pan, tvb, offset, 2, pan_id); - if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", PAN: 0x%04x", pan_id); + proto_tree_add_uint(subtree, hf_ieee802154_realign_pan, tvb, offset, 2, pan_id); + col_append_fstr(pinfo->cinfo, COL_INFO, ", PAN: 0x%04x", pan_id); offset += 2; /* Get and display the coordinator address. */ coord_addr = tvb_get_letohs(tvb, offset); - if (tree) proto_tree_add_uint(subtree, hf_ieee802154_realign_caddr, tvb, offset, 2, coord_addr); - if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", Coordinator: 0x%04x", coord_addr); + proto_tree_add_uint(subtree, hf_ieee802154_realign_caddr, tvb, offset, 2, coord_addr); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Coordinator: 0x%04x", coord_addr); offset += 2; /* Get and display the channel. */ channel = tvb_get_guint8(tvb, offset); - if (tree) proto_tree_add_uint(subtree, hf_ieee802154_realign_channel, tvb, offset, 1, channel); - if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", Channel: %u", channel); + proto_tree_add_uint(subtree, hf_ieee802154_realign_channel, tvb, offset, 1, channel); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Channel: %u", channel); offset += 1; /* Get and display the short address. */ short_addr = tvb_get_letohs(tvb, offset); if (tree) proto_tree_add_uint(subtree, hf_ieee802154_realign_addr, tvb, offset, 2, short_addr); - if ( (check_col(pinfo->cinfo, COL_INFO)) - && (packet->dst_addr_mode == IEEE802154_FCF_ADDR_EXT) + if ((packet->dst_addr_mode == IEEE802154_FCF_ADDR_EXT) && (short_addr != IEEE802154_NO_ADDR16)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Addr: 0x%04x", short_addr); } diff --git a/epan/dissectors/packet-ieee8021ah.c b/epan/dissectors/packet-ieee8021ah.c index f9c178f76c..499647ed33 100644 --- a/epan/dissectors/packet-ieee8021ah.c +++ b/epan/dissectors/packet-ieee8021ah.c @@ -122,11 +122,9 @@ dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo, tci = tvb_get_ntohs( tvb, 0 ); - if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "PRI: %d DROP: %d ID: %d", (tci >> 13), ((tci >> 12) & 1), (tci & 0xFFF)); - } /* create the protocol tree */ ieee8021ad_tree = NULL; @@ -227,12 +225,10 @@ dissect_ieee8021ah_common(tvbuff_t *tvb, packet_info *pinfo, tci = tvb_get_ntohl( tvb, 0 ); - if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "PRI: %d Drop: %d NCA: %d Res1: %d Res2: %d I-SID: %d", (tci >> 29), ((tci >> 28) & 1), ((tci >> 27) & 1), ((tci >> 26) & 1), ((tci >> 24) & 3), tci & IEEE8021AH_ISIDMASK); - } /* create the protocol tree */ ptree = NULL; @@ -313,12 +309,10 @@ dissect_ieee8021ah(tvbuff_t *tvb, packet_info *pinfo, tci = tvb_get_ntohl( tvb, 0 ); - if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "PRI: %d Drop: %d NCA: %d Res1: %d Res2: %d I-SID: %d", (tci >> 29), ((tci >> 28) & 1), ((tci >> 27) & 1), ((tci >> 26) & 1), ((tci >> 24) & 3), (tci & 0x00FFFFFF)); - } /* create the protocol tree */ ieee8021ah_tree = NULL; diff --git a/epan/dissectors/packet-ieee802a.c b/epan/dissectors/packet-ieee802a.c index d2225cfa48..78b6985b10 100644 --- a/epan/dissectors/packet-ieee802a.c +++ b/epan/dissectors/packet-ieee802a.c @@ -99,15 +99,12 @@ dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) oui = tvb_get_ntoh24(tvb, 0); pid = tvb_get_ntohs(tvb, 3); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "OUI 0x%06X (%s), PID 0x%04X", oui, val_to_str_const(oui, oui_vals, "Unknown"), pid); - } - if (tree) { - proto_tree_add_uint(ieee802a_tree, hf_ieee802a_oui, + + proto_tree_add_uint(ieee802a_tree, hf_ieee802a_oui, tvb, 0, 3, oui); - } /* * Do we have information for this OUI? diff --git a/epan/dissectors/packet-igap.c b/epan/dissectors/packet-igap.c index 321e9f20cf..a83c62765e 100644 --- a/epan/dissectors/packet-igap.c +++ b/epan/dissectors/packet-igap.c @@ -148,10 +148,8 @@ dissect_igap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int off col_clear(pinfo->cinfo, COL_INFO); type = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, igap_types, "Unknown Type: 0x%02x")); - } proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type); offset += 1; diff --git a/epan/dissectors/packet-igmp.c b/epan/dissectors/packet-igmp.c index c411fa5c29..59dc37b4e7 100644 --- a/epan/dissectors/packet-igmp.c +++ b/epan/dissectors/packet-igmp.c @@ -551,10 +551,9 @@ dissect_v3_group_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr /* source addresses */ while(num--){ - 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", tvb_ip_to_str(tvb, offset), (num?", ":"}")); - } + proto_tree_add_item(tree, hf_saddr, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } @@ -644,8 +643,7 @@ dissect_igmp_v3_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int t offset += 2; while(num--){ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s", tvb_ip_to_str(tvb, offset), (num?", ":"}")); + col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s", tvb_ip_to_str(tvb, offset), (num?", ":"}")); proto_tree_add_item(tree, hf_saddr, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } diff --git a/epan/dissectors/packet-igrp.c b/epan/dissectors/packet-igrp.c index 23a104d00e..f99df1cabe 100644 --- a/epan/dissectors/packet-igrp.c +++ b/epan/dissectors/packet-igrp.c @@ -65,17 +65,15 @@ static void dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ver_and_opcode = tvb_get_guint8(tvb,0); - if (check_col(pinfo->cinfo, COL_INFO)) { - switch (ver_and_opcode) { - case 0x11: + switch (ver_and_opcode) { + case 0x11: col_set_str(pinfo->cinfo, COL_INFO, "Response" ); break; - case 0x12: - col_set_str(pinfo->cinfo, COL_INFO, "Request" ); - break; - default: - col_set_str(pinfo->cinfo, COL_INFO, "Unknown version or opcode"); - } + case 0x12: + col_set_str(pinfo->cinfo, COL_INFO, "Request" ); + break; + default: + col_set_str(pinfo->cinfo, COL_INFO, "Unknown version or opcode"); } diff --git a/epan/dissectors/packet-image-gif.c b/epan/dissectors/packet-image-gif.c index b1cde11769..0350d59b1d 100644 --- a/epan/dissectors/packet-image-gif.c +++ b/epan/dissectors/packet-image-gif.c @@ -166,8 +166,7 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) DISSECTOR_ASSERT(version); /* Add summary to INFO column if it is enabled */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", str); + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", str); /* In order to speed up dissection, do not add items to the protocol tree * if it is not visible. However, compute the values that are needed for diff --git a/epan/dissectors/packet-image-jfif.c b/epan/dissectors/packet-image-jfif.c index 8a2e577987..1994e3befc 100644 --- a/epan/dissectors/packet-image-jfif.c +++ b/epan/dissectors/packet-image-jfif.c @@ -772,14 +772,11 @@ dissect_jfif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ return 0; /* Add summary to INFO column if it is enabled */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "(JPEG JFIF image)"); + col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "(JPEG JFIF image)"); - if (tree) { - ti = proto_tree_add_item(tree, proto_jfif, - tvb, 0, -1, ENC_NA); - subtree = proto_item_add_subtree(ti, ett_jfif); - } + ti = proto_tree_add_item(tree, proto_jfif, + tvb, 0, -1, ENC_NA); + subtree = proto_item_add_subtree(ti, ett_jfif); for (; ; ) { const char *str; diff --git a/epan/dissectors/packet-imap.c b/epan/dissectors/packet-imap.c index 5bfdc513a4..cb7247458e 100644 --- a/epan/dissectors/packet-imap.c +++ b/epan/dissectors/packet-imap.c @@ -94,18 +94,16 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else is_request = FALSE; - if (check_col(pinfo->cinfo, COL_INFO)) { - /* - * Put the first line from the buffer into the summary - * (but leave out the line terminator). - */ - linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); - line = tvb_get_ptr(tvb, offset, linelen); - - col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", + /* + * Put the first line from the buffer into the summary + * (but leave out the line terminator). + */ + linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); + line = tvb_get_ptr(tvb, offset, linelen); + + col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", is_request ? "Request" : "Response", format_text(line, linelen)); - } if (tree) { ti = proto_tree_add_item(tree, proto_imap, tvb, offset, -1, ENC_NA); diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index b219da2fbf..279074e2ab 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -770,7 +770,7 @@ dissect_imf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* remove 2 bytes to take off the final CRLF to make things a little prettier */ item = proto_tree_add_item(tree, hf_id, tvb, value_offset, end_offset - value_offset - 2, ENC_ASCII|ENC_NA); } - if(f_info->add_to_col_info && check_col(pinfo->cinfo, COL_INFO)) { + if(f_info->add_to_col_info) { col_append_fstr(pinfo->cinfo, COL_INFO, "%s: %s, ", f_info->name, tvb_format_text(tvb, value_offset, end_offset - value_offset - 2)); diff --git a/epan/dissectors/packet-ipdc.c b/epan/dissectors/packet-ipdc.c index 9b23b12ccb..19ddbf55dd 100644 --- a/epan/dissectors/packet-ipdc.c +++ b/epan/dissectors/packet-ipdc.c @@ -748,14 +748,11 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return; /* clear info column and display send/receive sequence numbers */ - if (check_col(pinfo->cinfo, COL_INFO)) { - if (new_packet == TRUE) { - col_clear(pinfo->cinfo, COL_INFO); - new_packet = FALSE; - } - col_append_fstr(pinfo->cinfo, COL_INFO, "r=%u s=%u ", - nr, ns); + if (new_packet == TRUE) { + col_clear(pinfo->cinfo, COL_INFO); + new_packet = FALSE; } + col_append_fstr(pinfo->cinfo, COL_INFO, "r=%u s=%u ", nr, ns); if (payload_len == 4) { if (!tree) @@ -777,8 +774,7 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_code = tvb_get_ntohs(tvb,6+trans_id_size); offset = 6 + trans_id_size + 2; /* past message_code */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "TID=%x %s ", trans_id, val_to_str_const(message_code, message_code_vals, diff --git a/epan/dissectors/packet-ipmi-session.c b/epan/dissectors/packet-ipmi-session.c index f471be97a2..a51c25b396 100644 --- a/epan/dissectors/packet-ipmi-session.c +++ b/epan/dissectors/packet-ipmi-session.c @@ -157,20 +157,16 @@ dissect_ipmi_session(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * } /* Later it will be overridden with sub-dissector, if any */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - if (authtype == IPMI_AUTH_RMCPP) { - col_set_str(pinfo->cinfo, COL_PROTOCOL, "RMCP+"); - } else { - col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPMI"); - } + if (authtype == IPMI_AUTH_RMCPP) { + col_set_str(pinfo->cinfo, COL_PROTOCOL, "RMCP+"); + } else { + col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPMI"); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Session ID 0x%x", session_id); - if (authtype == IPMI_AUTH_RMCPP) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", payload type: %s", - val_to_str_const(payloadtype, ipmi_payload_vals, "Unknown")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "Session ID 0x%x", session_id); + if (authtype == IPMI_AUTH_RMCPP) { + col_append_fstr(pinfo->cinfo, COL_INFO, ", payload type: %s", + val_to_str_const(payloadtype, ipmi_payload_vals, "Unknown")); } if (tree) { diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index 8454c7898e..37fc7393b4 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -889,10 +889,8 @@ dissect_ah_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvb_memcpy(tvb, (guint8 *)&ah, 0, sizeof(ah)); advance = (int)sizeof(ah) + ((ah.ah_len - 1) << 2); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "AH (SPI=0x%08x)", + col_add_fstr(pinfo->cinfo, COL_INFO, "AH (SPI=0x%08x)", (guint32)g_ntohl(ah.ah_spi)); - } if (tree) { /* !!! specify length */ @@ -1089,10 +1087,8 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_memcpy(tvb, (guint8 *)&esp, 0, sizeof(esp)); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "ESP (SPI=0x%08x)", - (guint32)g_ntohl(esp.esp_spi)); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "ESP (SPI=0x%08x)", + (guint32)g_ntohl(esp.esp_spi)); /* @@ -1966,13 +1962,11 @@ dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_memcpy(tvb, (guint8 *)&ipcomp, 0, sizeof(ipcomp)); - if (check_col(pinfo->cinfo, COL_INFO)) { - p = try_val_to_str(g_ntohs(ipcomp.comp_cpi), cpi2val); - if (p == NULL) { - col_add_fstr(pinfo->cinfo, COL_INFO, "IPComp (CPI=0x%04x)", - g_ntohs(ipcomp.comp_cpi)); - } else - col_add_fstr(pinfo->cinfo, COL_INFO, "IPComp (CPI=%s)", p); + p = try_val_to_str(g_ntohs(ipcomp.comp_cpi), cpi2val); + if (p == NULL) { + col_add_fstr(pinfo->cinfo, COL_INFO, "IPComp (CPI=0x%04x)", g_ntohs(ipcomp.comp_cpi)); + } else { + col_add_fstr(pinfo->cinfo, COL_INFO, "IPComp (CPI=%s)", p); } /* diff --git a/epan/dissectors/packet-ipsi-ctl.c b/epan/dissectors/packet-ipsi-ctl.c index ef3680679b..78fe4019e4 100644 --- a/epan/dissectors/packet-ipsi-ctl.c +++ b/epan/dissectors/packet-ipsi-ctl.c @@ -181,15 +181,13 @@ static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (haspdus) { - if (check_col(pinfo->cinfo, COL_INFO)) { - if (last_sequence==-1) - { - col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x", - pdu,first_sequence); - }else{ - col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x-0x%04x", - pdu,first_sequence,last_sequence); - } + if (last_sequence==-1) + { + col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x", + pdu,first_sequence); + }else{ + col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x-0x%04x", + pdu,first_sequence,last_sequence); } }else{ col_set_str(pinfo->cinfo, COL_INFO, "Initialization"); diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 3bbf85ff03..31511c5245 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -821,12 +821,11 @@ dissect_frag6(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, frag.ip6f_ident = g_ntohl(frag.ip6f_ident); *offlg = frag.ip6f_offlg; *ident = frag.ip6f_ident; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "IPv6 fragment (nxt=%s (%u) off=%u id=0x%x)", ipprotostr(frag.ip6f_nxt), frag.ip6f_nxt, (frag.ip6f_offlg & IP6F_OFF_MASK) >> IP6F_OFF_SHIFT, frag.ip6f_ident); - } + if (tree) { ti = proto_tree_add_text(tree, tvb, offset, len, "Fragmentation Header"); @@ -2076,7 +2075,6 @@ again: /* Unknown protocol. Handle "no next header" specially. */ if (nxt == IP_PROTO_NONE) { - if (check_col(pinfo->cinfo, COL_INFO)) { /* If we had an Authentication Header, the AH dissector already put something in the Info column; leave it there. */ if (!ah) { @@ -2106,9 +2104,7 @@ again: } else col_set_str(pinfo->cinfo, COL_INFO, "IPv6 no next header"); } - } } else { - if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "%s (%u)", ipprotostr(nxt), nxt); } call_dissector(data_handle, next_tvb, pinfo, tree); diff --git a/epan/dissectors/packet-ipx.c b/epan/dissectors/packet-ipx.c index 0c3bb90624..182df5b5e3 100644 --- a/epan/dissectors/packet-ipx.c +++ b/epan/dissectors/packet-ipx.c @@ -282,8 +282,7 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) SET_ADDRESS(&pinfo->dst, AT_IPX, 10, dst_net_node); SET_ADDRESS(&ipxh->ipx_dst, AT_IPX, 10, dst_net_node); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s (0x%04x)", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s (0x%04x)", socket_text(ipxh->ipx_dsocket), ipxh->ipx_dsocket); if (tree) { @@ -592,8 +591,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) conn_ctrl = tvb_get_guint8(tvb, 0); spx_msg_string = spx_conn_ctrl(conn_ctrl); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spx_msg_string); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spx_msg_string); if (tree) { ti = proto_tree_add_uint_format(spx_tree, hf_spx_connection_control, tvb, 0, 1, conn_ctrl, @@ -613,8 +611,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) datastream_type = tvb_get_guint8(tvb, 1); datastream_type_string = spx_datastream(datastream_type); if (datastream_type_string != NULL) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", datastream_type_string); } if (tree) { @@ -751,11 +748,10 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * subdissector. */ if (spx_rexmit_info_p != NULL) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "[Retransmission] Original Packet %u", spx_rexmit_info_p->num); - } + if (tree) { proto_tree_add_uint_format(spx_tree, hf_spx_rexmt_frame, tvb, 0, 0, spx_rexmit_info_p->num, @@ -837,11 +833,9 @@ dissect_ipxmsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) conn_number = tvb_get_guint8(tvb, 0); sig_char = tvb_get_guint8(tvb, 1); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "%s, Connection %d", val_to_str_const(sig_char, ipxmsg_sigchar_vals, "Unknown Signature Char"), conn_number); - } if (tree) { ti = proto_tree_add_item(tree, proto_ipxmsg, tvb, 0, -1, ENC_NA); @@ -873,10 +867,8 @@ dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) operation = tvb_get_ntohs(tvb, 0) - 1; - if (check_col(pinfo->cinfo, COL_INFO)) { - /* rip_types 0 and 1 are valid, anything else becomes 2 or "Unknown" */ - col_set_str(pinfo->cinfo, COL_INFO, rip_type[MIN(operation, 2)]); - } + /* rip_types 0 and 1 are valid, anything else becomes 2 or "Unknown" */ + col_set_str(pinfo->cinfo, COL_INFO, rip_type[MIN(operation, 2)]); if (tree) { ti = proto_tree_add_item(tree, proto_ipxrip, tvb, 0, -1, ENC_NA); @@ -945,15 +937,11 @@ dissect_serialization(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ser_tree = proto_item_add_subtree(ti, ett_serialization); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Serial number %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "Serial number %s", tvb_bytes_to_str(tvb, 0, 6)); - } - if (tree) { - proto_tree_add_text(ser_tree, tvb, 0, 6, + proto_tree_add_text(ser_tree, tvb, 0, 6, "Serial number: %s", tvb_bytes_to_str(tvb, 0, 6)); - } } /* @@ -1215,13 +1203,11 @@ dissect_ipxsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) query.query_type = tvb_get_ntohs(tvb, 0); query.server_type = tvb_get_ntohs(tvb, 2); - if (check_col(pinfo->cinfo, COL_INFO)) { - if (query.query_type >= 1 && query.query_type <= 4) { - col_set_str(pinfo->cinfo, COL_INFO, sap_type[query.query_type - 1]); - } - else { - col_set_str(pinfo->cinfo, COL_INFO, "Unknown Packet Type"); - } + if (query.query_type >= 1 && query.query_type <= 4) { + col_set_str(pinfo->cinfo, COL_INFO, sap_type[query.query_type - 1]); + } + else { + col_set_str(pinfo->cinfo, COL_INFO, "Unknown Packet Type"); } if (tree) { diff --git a/epan/dissectors/packet-ipxwan.c b/epan/dissectors/packet-ipxwan.c index 99c0db057f..7fd72c8ab9 100644 --- a/epan/dissectors/packet-ipxwan.c +++ b/epan/dissectors/packet-ipxwan.c @@ -154,12 +154,11 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } offset += 4; packet_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(packet_type, ipxwan_packet_type_vals, "Unknown packet type %u")); - } - if (tree) { + + if (tree) { proto_tree_add_uint(ipxwan_tree, hf_ipxwan_packet_type, tvb, offset, 1, packet_type); offset += 1; diff --git a/epan/dissectors/packet-irc.c b/epan/dissectors/packet-irc.c index bfc04c7d19..52b5b1ab9c 100644 --- a/epan/dissectors/packet-irc.c +++ b/epan/dissectors/packet-irc.c @@ -452,11 +452,8 @@ dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "IRC"); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_set_str(pinfo->cinfo, COL_INFO, - (pinfo->match_uint == pinfo->destport) ? "Request" : "Response"); - } + col_set_str(pinfo->cinfo, COL_INFO, + (pinfo->match_uint == pinfo->destport) ? "Request" : "Response"); ti = proto_tree_add_item(tree, proto_irc, tvb, 0, -1, ENC_NA); irc_tree = proto_item_add_subtree(ti, ett_irc); diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c index 3061b41bfc..0457c66b17 100644 --- a/epan/dissectors/packet-isakmp.c +++ b/epan/dissectors/packet-isakmp.c @@ -3832,8 +3832,7 @@ dissect_cisco_fragmentation(tvbuff_t *tvb, int offset, int length, proto_tree *t if (defrag_isakmp_tvb) { /* take it all */ dissect_isakmp(defrag_isakmp_tvb, pinfo, ptree); } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, " (%sMessage fragment %u%s)", (frag_msg ? "Reassembled + " : ""), seq, (last ? " - last" : "")); diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index dfb287672a..5c01507896 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -827,59 +827,57 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off } - if (check_col(pinfo->cinfo, COL_INFO)) { - if (opcode != ISCSI_OPCODE_SCSI_COMMAND) { + if (opcode != ISCSI_OPCODE_SCSI_COMMAND) { - col_append_str(pinfo->cinfo, COL_INFO, opcode_str); + col_append_str(pinfo->cinfo, COL_INFO, opcode_str); - if (opcode == ISCSI_OPCODE_SCSI_RESPONSE || - (opcode == ISCSI_OPCODE_SCSI_DATA_IN && - (tvb_get_guint8(tvb, offset + 1) & ISCSI_SCSI_DATA_FLAG_S))) { - col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", - val_to_str (scsi_status, scsi_status_val, "0x%x")); - } - else if (opcode == ISCSI_OPCODE_LOGIN_RESPONSE) { - guint16 login_status = tvb_get_ntohs(tvb, offset+36); - col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", - val_to_str (login_status, iscsi_login_status, "0x%x")); - } - else if (opcode == ISCSI_OPCODE_LOGOUT_COMMAND) { - guint8 logoutReason; - if(iscsi_protocol_version == ISCSI_PROTOCOL_DRAFT08) { - logoutReason = tvb_get_guint8(tvb, offset+11); - } else if(iscsi_protocol_version >= ISCSI_PROTOCOL_DRAFT13) { - logoutReason = tvb_get_guint8(tvb, offset+1) & 0x7f; - } - else { - logoutReason = tvb_get_guint8(tvb, offset+23); - } - col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", - val_to_str (logoutReason, iscsi_logout_reasons, "0x%x")); - } - else if (opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION) { - guint8 tmf = tvb_get_guint8(tvb, offset + 1) & 0x7f; - col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", - val_to_str (tmf, iscsi_task_management_functions, "0x%x")); - } - else if (opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION_RESPONSE) { - guint8 resp = tvb_get_guint8(tvb, offset + 2); - col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", - val_to_str (resp, iscsi_task_management_responses, "0x%x")); - } - else if (opcode == ISCSI_OPCODE_REJECT) { - guint8 reason = tvb_get_guint8(tvb, offset + 2); - col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", - val_to_str (reason, iscsi_reject_reasons, "0x%x")); + if (opcode == ISCSI_OPCODE_SCSI_RESPONSE || + (opcode == ISCSI_OPCODE_SCSI_DATA_IN && + (tvb_get_guint8(tvb, offset + 1) & ISCSI_SCSI_DATA_FLAG_S))) { + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (scsi_status, scsi_status_val, "0x%x")); + } + else if (opcode == ISCSI_OPCODE_LOGIN_RESPONSE) { + guint16 login_status = tvb_get_ntohs(tvb, offset+36); + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (login_status, iscsi_login_status, "0x%x")); + } + else if (opcode == ISCSI_OPCODE_LOGOUT_COMMAND) { + guint8 logoutReason; + if(iscsi_protocol_version == ISCSI_PROTOCOL_DRAFT08) { + logoutReason = tvb_get_guint8(tvb, offset+11); + } else if(iscsi_protocol_version >= ISCSI_PROTOCOL_DRAFT13) { + logoutReason = tvb_get_guint8(tvb, offset+1) & 0x7f; } - else if (opcode == ISCSI_OPCODE_ASYNC_MESSAGE) { - guint8 asyncEvent = tvb_get_guint8(tvb, offset + 36); - col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", - val_to_str (asyncEvent, iscsi_asyncevents, "0x%x")); + else { + logoutReason = tvb_get_guint8(tvb, offset+23); } + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (logoutReason, iscsi_logout_reasons, "0x%x")); + } + else if (opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION) { + guint8 tmf = tvb_get_guint8(tvb, offset + 1) & 0x7f; + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (tmf, iscsi_task_management_functions, "0x%x")); + } + else if (opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION_RESPONSE) { + guint8 resp = tvb_get_guint8(tvb, offset + 2); + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (resp, iscsi_task_management_responses, "0x%x")); + } + else if (opcode == ISCSI_OPCODE_REJECT) { + guint8 reason = tvb_get_guint8(tvb, offset + 2); + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (reason, iscsi_reject_reasons, "0x%x")); + } + else if (opcode == ISCSI_OPCODE_ASYNC_MESSAGE) { + guint8 asyncEvent = tvb_get_guint8(tvb, offset + 36); + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (asyncEvent, iscsi_asyncevents, "0x%x")); } } - + /* In the interest of speed, if "tree" is NULL, don't do any work not necessary to generate protocol tree items. */ if (tree) { @@ -1618,9 +1616,8 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off } dissect_scsi_cdb(cdb_tvb, pinfo, tree, SCSI_DEV_UNKNOWN, &cdata->itlq, itl); /* we dont want the immediata below to overwrite our CDB info */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_fence(pinfo->cinfo, COL_INFO); - } + col_set_fence(pinfo->cinfo, COL_INFO); + /* where there any ImmediateData ? */ if(immediate_data_length){ /* Immediate Data TVB */ @@ -2423,12 +2420,10 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec } } - if(check_col(pinfo->cinfo, COL_INFO)) { - if(iSCSIPdusDissected == 0) - col_set_str(pinfo->cinfo, COL_INFO, ""); - else - col_append_str(pinfo->cinfo, COL_INFO, ", "); - } + if(iSCSIPdusDissected == 0) + col_set_str(pinfo->cinfo, COL_INFO, ""); + else + col_append_str(pinfo->cinfo, COL_INFO, ", "); dissect_iscsi_pdu(tvb, pinfo, tree, offset, opcode, opcode_str, data_segment_len, iscsi_session, conversation); if(pduLen > available_bytes) diff --git a/epan/dissectors/packet-isis-hello.c b/epan/dissectors/packet-isis-hello.c index 1376fa9958..26fbc89959 100644 --- a/epan/dissectors/packet-isis-hello.c +++ b/epan/dissectors/packet-isis-hello.c @@ -1037,10 +1037,9 @@ isis_dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int "System-ID {Sender of PDU} : %s", print_system_id( source_id, id_length ) ); } - 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", print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ) ); - } + offset += id_length; if (tree) { diff --git a/epan/dissectors/packet-isis-lsp.c b/epan/dissectors/packet-isis-lsp.c index 100b13762b..0247e68d32 100644 --- a/epan/dissectors/packet-isis-lsp.c +++ b/epan/dissectors/packet-isis-lsp.c @@ -2708,21 +2708,18 @@ isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o value, "LSP-ID: %s", value); } - 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", print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) ); - } + offset += id_length + 2; - if (tree) { - proto_tree_add_item(lsp_tree, hf_isis_lsp_sequence_number, + proto_tree_add_item(lsp_tree, hf_isis_lsp_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN); - } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: 0x%08x, Lifetime: %5us", + + col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: 0x%08x, Lifetime: %5us", tvb_get_ntohl(tvb, offset), tvb_get_ntohs(tvb, offset - (id_length+2+2))); - } + offset += 4; if (tree) { diff --git a/epan/dissectors/packet-isis.c b/epan/dissectors/packet-isis.c index a13c428067..c476c50e4a 100644 --- a/epan/dissectors/packet-isis.c +++ b/epan/dissectors/packet-isis.c @@ -124,21 +124,17 @@ dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) isis_version = tvb_get_guint8(tvb, 2); if (isis_version != ISIS_REQUIRED_VERSION){ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ISIS version (%u vs %u)", isis_version, ISIS_REQUIRED_VERSION ); - } isis_dissect_unknown(tvb, tree, 0, "Unknown ISIS version (%d vs %d)", isis_version, ISIS_REQUIRED_VERSION); return; } - if (tree) { - ti = proto_tree_add_item(tree, proto_isis, tvb, 0, -1, ENC_NA); - isis_tree = proto_item_add_subtree(ti, ett_isis); - } + ti = proto_tree_add_item(tree, proto_isis, tvb, 0, -1, ENC_NA); + isis_tree = proto_item_add_subtree(ti, ett_isis); if (tree) { proto_tree_add_item(isis_tree, hf_isis_irpd, tvb, offset, 1, @@ -168,19 +164,17 @@ dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) isis_type_reserved = tvb_get_guint8(tvb, offset); isis_type = isis_type_reserved & ISIS_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 ( isis_type, isis_vals, "Unknown (0x%x)" ) ); - } - if (tree) { - proto_tree_add_uint_format(isis_tree, hf_isis_type, tvb, + + proto_tree_add_uint_format(isis_tree, hf_isis_type, tvb, offset, 1, isis_type, "PDU Type : %s (R:%s%s%s)", val_to_str(isis_type, isis_vals, "Unknown (0x%x)"), (isis_type_reserved & ISIS_R8_MASK) ? "1" : "0", (isis_type_reserved & ISIS_R7_MASK) ? "1" : "0", (isis_type_reserved & ISIS_R6_MASK) ? "1" : "0"); - } + offset += 1; if (tree) { diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c index 5bc37b7ce5..fc235b976f 100644 --- a/epan/dissectors/packet-isns.c +++ b/epan/dissectors/packet-isns.c @@ -558,7 +558,6 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) function_id = tvb_get_ntohs(tvb, offset + 2); /* Add the function name in the info col */ - if (check_col(pinfo->cinfo, COL_INFO)) col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext(function_id, &isns_function_ids_ext, "Unknown function ID 0x%04x")); diff --git a/epan/dissectors/packet-itdm.c b/epan/dissectors/packet-itdm.c index eb84e4ec06..81c3911d7a 100644 --- a/epan/dissectors/packet-itdm.c +++ b/epan/dissectors/packet-itdm.c @@ -194,25 +194,22 @@ dissect_itdm_125usec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ackbit = (chcmd & 0x20) ? 1 : 0; chcmd = chcmd & 0x0f; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Flow %d Chan %d ACT %d ACK %d %s", flowid, chanid, actbit, ackbit, val_to_str_const(chcmd, chcmd_vals, "Reserved")); - if (chcmd == ITDM_CMD_NEW_CHAN || - chcmd == ITDM_CMD_CLOSE_CHAN || - chcmd == ITDM_CMD_CYCLIC_REAF) - { - col_append_fstr(pinfo->cinfo, COL_INFO, + if (chcmd == ITDM_CMD_NEW_CHAN || + chcmd == ITDM_CMD_CLOSE_CHAN || + chcmd == ITDM_CMD_CYCLIC_REAF) + { + col_append_fstr(pinfo->cinfo, COL_INFO, " Loc1 %d", chloc1); - } - else if (chcmd == ITDM_CMD_RELOC_CHAN) - { - chloc2 = tvb_get_ntohs(tvb, ITDM_CHLOC2_OFFSET); - col_append_fstr(pinfo->cinfo, COL_INFO, - " Loc1 %d Loc2 %d", chloc1, chloc2); - } + } + else if (chcmd == ITDM_CMD_RELOC_CHAN) + { + chloc2 = tvb_get_ntohs(tvb, ITDM_CHLOC2_OFFSET); + col_append_fstr(pinfo->cinfo, COL_INFO, + " Loc1 %d Loc2 %d", chloc1, chloc2); } offset = 0; @@ -289,25 +286,22 @@ dissect_itdm_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) trans_id = tvb_get_ntohl(tvb, ITDM_CTL_TRANSID_OFFSET); paired_trans_id = tvb_get_ntohl(tvb, ITDM_CTL_PAIRED_TRANSID_OFFSET); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Flow %d Command %s ", flowid, val_to_str_const(command, itdm_ctl_command_vals, "Reserved")); - if (command != ITDM_CTL_CMD_AFI_REQ ) - { - col_append_fstr(pinfo->cinfo, COL_INFO, + if (command != ITDM_CTL_CMD_AFI_REQ ) + { + col_append_fstr(pinfo->cinfo, COL_INFO, " Alloc'd FlowID %d", allocd_flowid); - } + } - col_append_fstr(pinfo->cinfo, COL_INFO, " TransID 0x%x ", trans_id); + col_append_fstr(pinfo->cinfo, COL_INFO, " TransID 0x%x ", trans_id); - if (command != ITDM_CTL_CMD_AFI_REQ ) - { - col_append_fstr(pinfo->cinfo, COL_INFO, + if (command != ITDM_CTL_CMD_AFI_REQ ) + { + col_append_fstr(pinfo->cinfo, COL_INFO, " Paired TransID 0x%x", paired_trans_id); - } } offset = 0; diff --git a/epan/dissectors/packet-iwarp-ddp-rdmap.c b/epan/dissectors/packet-iwarp-ddp-rdmap.c index ef16ee6328..0d12b6a6be 100644 --- a/epan/dissectors/packet-iwarp-ddp-rdmap.c +++ b/epan/dissectors/packet-iwarp-ddp-rdmap.c @@ -270,11 +270,9 @@ ddp_rdma_packetlist(packet_info *pinfo, gboolean ddp_last_flag, ddp_fragment_state = "[more DDP segments]"; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%d > %d %s %s", pinfo->srcport, + col_add_fstr(pinfo->cinfo, COL_INFO, "%d > %d %s %s", pinfo->srcport, pinfo->destport, val_to_str(rdma_msg_opcode, rdmap_messages, "Unknown %d"), ddp_fragment_state); - } } /* dissects RDMA Read Request and Terminate message header */ diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c index b7f6035cde..87761d665e 100644 --- a/epan/dissectors/packet-iwarp-mpa.c +++ b/epan/dissectors/packet-iwarp-mpa.c @@ -452,12 +452,10 @@ mpa_packetlist(packet_info *pinfo, gint message_type) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPA"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "%d > %d %s", pinfo->srcport, pinfo->destport, val_to_str(message_type, mpa_messages, "Unknown %d")); - } } /* dissects MPA REQUEST or MPA REPLY */ diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index f8e6bfcb48..6b23049533 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -857,10 +857,8 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_peerid, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII|ENC_NA); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_str(pinfo->cinfo, COL_INFO, (initiator ? " -> " : " <- ") ); - col_append_str(pinfo->cinfo, COL_INFO, *current_token); - } + col_append_str(pinfo->cinfo, COL_INFO, (initiator ? " -> " : " <- ") ); + col_append_str(pinfo->cinfo, COL_INFO, *current_token); if (NULL != found_addr) { found_addr->type = AT_URI; @@ -1289,16 +1287,14 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree col_set_str(pinfo->cinfo, COL_PROTOCOL, "JXTA"); - if (check_col(pinfo->cinfo, COL_INFO)) { - if( complete_messages > 1 ) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%d Messages, %s -> %s", complete_messages, src_addr->str, dst_addr->str); - } else { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message, %s -> %s", src_addr->str, dst_addr->str); - } - - col_set_writable(pinfo->cinfo, FALSE); + if( complete_messages > 1 ) { + col_add_fstr(pinfo->cinfo, COL_INFO, "%d Messages, %s -> %s", complete_messages, src_addr->str, dst_addr->str); + } else { + col_add_fstr(pinfo->cinfo, COL_INFO, "Message, %s -> %s", src_addr->str, dst_addr->str); } + col_set_writable(pinfo->cinfo, FALSE); + while( tree && (complete_messages > 0) ) { proto_item *jxta_msg_tree_item = NULL; proto_tree *jxta_msg_tree = NULL; diff --git a/epan/dissectors/packet-kdp.c b/epan/dissectors/packet-kdp.c index d6a83786be..a7f73f7f82 100644 --- a/epan/dissectors/packet-kdp.c +++ b/epan/dissectors/packet-kdp.c @@ -229,10 +229,9 @@ static void dissect_kdp(tvbuff_t *tvb, } /* Now that we know sequence number and optional ack number, we can print more detailed summary info */ - if (check_col(pinfo->cinfo, COL_INFO)) { - if (version != 2) { + if (version != 2) { col_set_str(pinfo->cinfo, COL_INFO, "SDDP message"); - } else { + } else { char ack_string[BUFFER_SIZE]; char seq_num_string[BUFFER_SIZE]; char src_flowid_string[BUFFER_SIZE]; @@ -262,7 +261,6 @@ static void dissect_kdp(tvbuff_t *tvb, seq_num_string, src_flowid_string, packet_errors); - } } } diff --git a/epan/dissectors/packet-kink.c b/epan/dissectors/packet-kink.c index 110e0b3e19..4274b81f66 100644 --- a/epan/dissectors/packet-kink.c +++ b/epan/dissectors/packet-kink.c @@ -211,14 +211,11 @@ dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ col_set_str(pinfo->cinfo, COL_PROTOCOL, "KINK"); /* It shows kink type by the type value. */ - if(check_col(pinfo->cinfo, COL_INFO)){ - col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(type, kink_type_vals, "unknown")); - } + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(type, kink_type_vals, "unknown")); + /* Make the kink tree */ - if(tree){ - ti = proto_tree_add_item(tree, proto_kink, tvb, offset, -1, ENC_NA); - kink_tree = proto_item_add_subtree(ti, ett_kink); - } + ti = proto_tree_add_item(tree, proto_kink, tvb, offset, -1, ENC_NA); + kink_tree = proto_item_add_subtree(ti, ett_kink); proto_tree_add_uint(kink_tree, hf_kink_type, tvb, offset, 1, type); offset++; diff --git a/epan/dissectors/packet-kismet.c b/epan/dissectors/packet-kismet.c index 24d504fa03..352edd3a29 100644 --- a/epan/dissectors/packet-kismet.c +++ b/epan/dissectors/packet-kismet.c @@ -112,20 +112,18 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * da is_continuation = response_is_continuation (line); } - if (check_col(pinfo->cinfo, COL_INFO)) { - /* - * Put the first line from the buffer into the summary - * if it's a kismet request or reply (but leave out the - * line terminator). - * Otherwise, just call it a continuation. - */ - if (is_continuation) - col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); - else - col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", + /* + * Put the first line from the buffer into the summary + * if it's a kismet request or reply (but leave out the + * line terminator). + * Otherwise, just call it a continuation. + */ + if (is_continuation) + col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); + else + col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", is_request ? "Request" : "Response", format_text(line, linelen)); - } if (tree) { ti = proto_tree_add_item(tree, proto_kismet, tvb, offset, -1, ENC_NA); |