static void dissect_task_mgmt_flags(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset) { proto_item *item; static const int * mgmt_flags[] = { &hf_fcp_mgmt_flags_obsolete, &hf_fcp_mgmt_flags_clear_aca, &hf_fcp_mgmt_flags_target_reset, &hf_fcp_mgmt_flags_lu_reset, &hf_fcp_mgmt_flags_rsvd, &hf_fcp_mgmt_flags_clear_task_set, &hf_fcp_mgmt_flags_abort_task_set, NULL }; guint8 flags; flags = tvb_get_guint8(tvb, offset); item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_fcp_taskmgmt, ett_fcp_taskmgmt, mgmt_flags, ENC_NA, BMT_NO_FALSE|BMT_NO_TFS); if (!flags) proto_item_append_text(item, " (No values set)"); if (flags & 0x80) { col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP OBSOLETE] "); } if (flags & 0x40) { col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP CLEAR_ACA] "); } if (flags & 0x20) { col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP TARGET_RESET] "); } if (flags & 0x10) { col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP LU_RESET] "); } if (flags & 0x08) { col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP RSVD] "); } if (flags & 0x04) { col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP CLEAR_TASK_SET] "); } if (flags & 0x02) { col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP ABORT_TASK_SET] "); } }
static void dissect_task_mgmt_flags(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset) { proto_item *item = NULL; proto_tree *tree = NULL; guint8 flags; if (parent_tree) { item = proto_tree_add_item(parent_tree, hf_fcp_taskmgmt, tvb, offset, 1, ENC_LITTLE_ENDIAN); tree = proto_item_add_subtree(item, ett_fcp_taskmgmt); } flags = tvb_get_guint8(tvb, offset); if (!flags) proto_item_append_text(item, " (No values set)"); proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_obsolete, tvb, offset, 1, flags); if (flags & 0x80) { proto_item_append_text(item, " OBSOLETE"); col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP OBSOLETE] "); } flags &= (~( 0x80 )); proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_clear_aca, tvb, offset, 1, flags); if (flags & 0x40) { proto_item_append_text(item, " CLEAR ACA"); col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP CLEAR_ACA] "); } flags &= (~( 0x40 )); proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_target_reset, tvb, offset, 1, flags); if (flags & 0x20) { proto_item_append_text(item, " TARGET RESET"); col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP TARGET_RESET] "); } flags &= (~( 0x20 )); proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_lu_reset, tvb, offset, 1, flags); if (flags & 0x10) { proto_item_append_text(item, " LU RESET"); col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP LU_RESET] "); } flags &= (~( 0x10 )); proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_rsvd, tvb, offset, 1, flags); if (flags & 0x08) { proto_item_append_text(item, " RSVD"); col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP RSVD] "); } flags &= (~( 0x08 )); proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_clear_task_set, tvb, offset, 1, flags); if (flags & 0x04) { proto_item_append_text(item, " CLEAR TASK SET"); col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP CLEAR_TASK_SET] "); } flags &= (~( 0x04 )); proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_abort_task_set, tvb, offset, 1, flags); if (flags & 0x02) { proto_item_append_text(item, " ABORT TASK SET"); col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP ABORT_TASK_SET] "); } flags &= (~( 0x02 )); if (flags) { proto_item_append_text(item, " Unknown bitmap value 0x%x", flags); } }
void add35records(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *ns_tree) { tvbuff_t *next_tvb_eth_client; guint nsheaderlen=0; guint8 ssl_internal=0; guint offset; int morerecs=1; int loopcount=0; static const int * cluster_flags[] = { &hf_ns_clu_clflags_fp, &hf_ns_clu_clflags_fr, &hf_ns_clu_clflags_dfd, &hf_ns_clu_clflags_rss, &hf_ns_clu_clflags_rssh, &hf_ns_clu_clflags_res, NULL, }; int cur_record=tvb_get_guint8(tvb,NSHDR_OFFSET_35(fp_nextrecord)); nsheaderlen = tvb_get_letohs(tvb, NSHDR_OFFSET_35(fp_headerlen)); offset = sizeof(nspr_pktracefull_v35_t); do{ switch(cur_record){ /* Add a case statement here for each record */ case NSREC_ETHERNET: /* Call Ethernet dissector */ next_tvb_eth_client = tvb_new_subset_remaining(tvb, offset); call_dissector(eth_withoutfcs_handle, next_tvb_eth_client, pinfo, tree); if(ssl_internal){ col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[NS_INTERNAL_SSL]"); } morerecs=0; break; case NSREC_HTTP: /* Call HTTP dissector */ { dissector_handle_t http_handle; tvbuff_t *next_tvb_http_client; morerecs=0; http_handle = find_dissector("http"); next_tvb_http_client = tvb_new_subset_remaining(tvb, offset); call_dissector(http_handle, next_tvb_http_client, pinfo, tree); } break; case NSREC_TCPDEBUG: { proto_item *tcpdbgItem=NULL; proto_tree *tcpdbgTree=NULL; int reclen = tvb_get_letohs(tvb,offset+NSHDR_RECOFFSET_35(rec_len)); int nextrec = tvb_get_guint8(tvb,offset+NSHDR_RECOFFSET_35(nextrec_type)); /* Add tcpdebug subtree */ tcpdbgItem = proto_tree_add_item(ns_tree, hf_ns_tcpdbg, tvb, offset, reclen, ENC_NA); tcpdbgTree = proto_item_add_subtree(tcpdbgItem, ett_ns_tcpdebug); proto_tree_add_item(tcpdbgTree, hf_ns_tcpdbg_cwnd, tvb, offset+TCPRECOFFSET(snd_cwnd), 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(tcpdbgTree, hf_ns_tcpdbg_rtrtt, tvb, offset+TCPRECOFFSET(real_time_rtt), 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(tcpdbgTree, hf_ns_tcpdbg_tsrecent, tvb, offset+TCPRECOFFSET(ts_recent), 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(tcpdbgTree, hf_ns_tcpdbg_httpabort, tvb, offset+TCPRECOFFSET(http_abort_reason), 1, ENC_LITTLE_ENDIAN); offset += reclen; cur_record = nextrec; } break; case NSREC_INFO: { proto_item *infoItem=NULL; proto_tree *infoTree=NULL; int reclen = tvb_get_letohs(tvb,offset+NSHDR_RECOFFSET_35(rec_len)); int nextrec = tvb_get_guint8(tvb,offset+NSHDR_RECOFFSET_35(nextrec_type)); infoItem = proto_tree_add_item(ns_tree, hf_ns_inforec, tvb, offset, reclen, ENC_NA); infoTree = proto_item_add_subtree(infoItem, ett_ns_inforec); proto_tree_add_item(infoTree, hf_ns_inforec_info, tvb, offset+(guint)sizeof(nspr_rec_info_t), reclen-3, ENC_ASCII|ENC_NA); offset += reclen; cur_record = nextrec; } break; case NSREC_SSL: { proto_item *sslItem=NULL; proto_tree *sslTree=NULL; int reclen = tvb_get_letohs(tvb,offset+NSHDR_RECOFFSET_35(rec_len)); int nextrec = tvb_get_guint8(tvb,offset+NSHDR_RECOFFSET_35(nextrec_type)); sslItem = proto_tree_add_item(ns_tree, hf_ns_sslrec, tvb, offset, reclen, ENC_NA); sslTree = proto_item_add_subtree(sslItem, ett_ns_sslrec); proto_tree_add_item(sslTree, hf_ns_sslrec_seq, tvb, offset+SSLRECOFFSET(seq), 4, ENC_LITTLE_ENDIAN); ssl_internal=1; offset += reclen; cur_record = nextrec; } break; case NSREC_MPTCP: { proto_item *mptcpItem=NULL; proto_tree *mptcpTree=NULL; int reclen = tvb_get_letohs(tvb,offset+NSHDR_RECOFFSET_35(rec_len)); int nextrec = tvb_get_guint8(tvb,offset+NSHDR_RECOFFSET_35(nextrec_type)); mptcpItem = proto_tree_add_item(ns_tree, hf_ns_mptcprec, tvb, offset, reclen, ENC_NA); mptcpTree = proto_item_add_subtree(mptcpItem, ett_ns_mptcprec); proto_tree_add_item(mptcpTree, hf_ns_mptcprec_subflowid, tvb, offset+MPTCPRECOFFSET(subflowid), 1, ENC_LITTLE_ENDIAN); offset += reclen; cur_record = nextrec; } break; case NSREC_VMNAMES: { proto_item *vmnameItem=NULL; proto_tree *vmnameTree=NULL; gint reclen = tvb_get_letohs(tvb,offset+NSHDR_RECOFFSET_35(rec_len)); gint nextrec = tvb_get_guint8(tvb,offset+NSHDR_RECOFFSET_35(nextrec_type)); gint srcvmnamelen = tvb_get_guint8(tvb,offset+VMNAMERECOFFSET(src_vmname_len)); gint dstvmnamelen = tvb_get_guint8(tvb,offset+VMNAMERECOFFSET(dst_vmname_len)); vmnameItem = proto_tree_add_item(ns_tree, hf_ns_vmnamerec, tvb, offset, reclen, ENC_NA); vmnameTree = proto_item_add_subtree(vmnameItem, ett_ns_vmnamerec); proto_tree_add_item(vmnameTree, hf_ns_vmnamerec_srcvmname, tvb, offset+(guint)sizeof(nspr_rec_vmname_t), srcvmnamelen, ENC_ASCII|ENC_NA); proto_tree_add_item(vmnameTree, hf_ns_vmnamerec_dstvmname, tvb, offset+(guint)sizeof(nspr_rec_vmname_t)+srcvmnamelen, dstvmnamelen, ENC_ASCII|ENC_NA); offset += reclen; cur_record = nextrec; } break; case NSREC_CLUSTER: { proto_item *clusterItem=NULL; proto_tree *clusterTree=NULL; gint reclen = tvb_get_letohs(tvb,offset+NSHDR_RECOFFSET_35(rec_len)); gint nextrec = tvb_get_guint8(tvb,offset+NSHDR_RECOFFSET_35(nextrec_type)); clusterItem = proto_tree_add_item(ns_tree, hf_ns_clusterrec, tvb, offset, reclen, ENC_NA); clusterTree = proto_item_add_subtree(clusterItem, ett_ns_clusterrec); proto_tree_add_item(clusterTree, hf_ns_clu_snode, tvb, offset+CLUSTERRECOFFSET(fp_srcNodeId), 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(clusterTree, hf_ns_clu_dnode, tvb, offset+CLUSTERRECOFFSET(fp_destNodeId), 2, ENC_LITTLE_ENDIAN); proto_tree_add_bitmask(clusterTree,tvb, offset+CLUSTERRECOFFSET(fp_clFlags),hf_ns_clu_clflags,ett_ns_flags,cluster_flags,ENC_NA); offset += reclen; cur_record = nextrec; } break; case NSREC_NULL: morerecs = 0; break; default: /* This will end up in an infinite loop if the file is corrupt */ { proto_item *unknownItem=NULL; proto_tree *unknownTree=NULL; int reclen = tvb_get_letohs(tvb,offset+NSHDR_RECOFFSET_35(rec_len)); int nextrec = tvb_get_guint8(tvb,offset+NSHDR_RECOFFSET_35(nextrec_type)); loopcount++; unknownItem = proto_tree_add_item(ns_tree, hf_ns_unknownrec, tvb, offset, reclen, ENC_NA); unknownTree = proto_item_add_subtree(unknownItem, ett_ns_unknownrec); proto_tree_add_item(unknownTree, hf_ns_unknowndata, tvb, offset+3, reclen-3, ENC_NA); if(cur_record == UNKNOWN_LAST){ morerecs=0; }else{ offset += reclen; cur_record = nextrec; } } } }while( morerecs && loopcount < (MAX_UNKNOWNREC_LOOP) && /* additional checks to prevent infinite loops */ offset<=nsheaderlen); }