diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2006-12-10 13:04:37 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2006-12-10 13:04:37 +0000 |
commit | 43bdbd0a78661a12dbbd1732b75c863bd9d95d97 (patch) | |
tree | 03e556b28412a32664011fe1c6f2daddf5000878 /epan/dissectors/packet-scsi-sbc.c | |
parent | f53a3fb764b525e09f4ff8be8ae517cea663fdff (diff) |
fix the WRVERIFY commands
svn path=/trunk/; revision=20098
Diffstat (limited to 'epan/dissectors/packet-scsi-sbc.c')
-rw-r--r-- | epan/dissectors/packet-scsi-sbc.c | 105 |
1 files changed, 61 insertions, 44 deletions
diff --git a/epan/dissectors/packet-scsi-sbc.c b/epan/dissectors/packet-scsi-sbc.c index fecfecbd01..db641db934 100644 --- a/epan/dissectors/packet-scsi-sbc.c +++ b/epan/dissectors/packet-scsi-sbc.c @@ -68,7 +68,6 @@ static int hf_scsi_sbc_verify_lba = -1; static int hf_scsi_sbc_verify_lba64 = -1; static int hf_scsi_sbc_verify_vlen = -1; static int hf_scsi_sbc_verify_vlen32 = -1; -static int hf_scsi_sbc_wrverify_ebp = -1; static int hf_scsi_sbc_wrverify_lba = -1; static int hf_scsi_sbc_wrverify_xferlen = -1; static int hf_scsi_sbc_wrverify_lba64 = -1; @@ -108,6 +107,7 @@ static int hf_scsi_sbc_synccache_sync_nv = -1; static int hf_scsi_sbc_vrprotect = -1; static int hf_scsi_sbc_verify_flags = -1; static int hf_scsi_sbc_wrprotect = -1; +static int hf_scsi_sbc_wrverify_flags = -1; static gint ett_scsi_format_unit = -1; static gint ett_scsi_prefetch = -1; @@ -120,6 +120,7 @@ static gint ett_scsi_ssu_immed = -1; static gint ett_scsi_ssu_pwr = -1; static gint ett_scsi_synccache = -1; static gint ett_scsi_verify = -1; +static gint ett_scsi_wrverify = -1; @@ -744,32 +745,37 @@ dissect_sbc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, static void -dissect_sbc2_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_, +dissect_sbc_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_) { guint8 flags; + static const int *wrverify10_fields[] = { + &hf_scsi_sbc_wrprotect, + &hf_scsi_sbc_dpo, + &hf_scsi_sbc_bytchk, + NULL + }; if (isreq && iscdb) { if (check_col (pinfo->cinfo, COL_INFO)) col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+2), - tvb_get_ntohs (tvb, offset+7)); + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohs (tvb, offset+6)); } if (tree && isreq && iscdb) { - proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_ebp, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_bytchk, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1, - 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+2, 4, 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen, tvb, offset+7, + proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags, ett_scsi_wrverify, wrverify10_fields, FALSE); + + proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+1, 4, 0); + proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0); + + proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen, tvb, offset+6, 2, 0); - flags = tvb_get_guint8 (tvb, offset+9); - proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+9, 1, + flags = tvb_get_guint8 (tvb, offset+8); + proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1, flags, "Vendor Unique = %u, NACA = %u, Link = %u", flags & 0xC0, flags & 0x4, flags & 0x1); @@ -777,31 +783,36 @@ dissect_sbc2_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_, } static void -dissect_sbc2_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_, +dissect_sbc_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_) { guint8 flags; + static const int *wrverify12_fields[] = { + &hf_scsi_sbc_wrprotect, + &hf_scsi_sbc_dpo, + &hf_scsi_sbc_bytchk, + NULL + }; if (isreq && iscdb) { if (check_col (pinfo->cinfo, COL_INFO)) col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)", - tvb_get_ntohl (tvb, offset+2), - tvb_get_ntohl (tvb, offset+6)); + tvb_get_ntohl (tvb, offset+1), + tvb_get_ntohl (tvb, offset+5)); } if (tree && isreq && iscdb) { - proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_ebp, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_bytchk, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1, - 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+2, 4, 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+6, + proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags, ett_scsi_wrverify, wrverify12_fields, FALSE); + + proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+1, 4, 0); + proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+5, 4, 0); - flags = tvb_get_guint8 (tvb, offset+11); - proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+11, 1, + proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, 0); + + flags = tvb_get_guint8 (tvb, offset+10); + proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1, flags, "Vendor Unique = %u, NACA = %u, Link = %u", flags & 0xC0, flags & 0x4, flags & 0x1); @@ -809,31 +820,36 @@ dissect_sbc2_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_, } static void -dissect_sbc2_wrverify16 (tvbuff_t *tvb, packet_info *pinfo _U_, +dissect_sbc_wrverify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_) { guint8 flags; + static const int *wrverify16_fields[] = { + &hf_scsi_sbc_wrprotect, + &hf_scsi_sbc_dpo, + &hf_scsi_sbc_bytchk, + NULL + }; if (isreq && iscdb) { if (check_col (pinfo->cinfo, COL_INFO)) col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)", - tvb_get_ntoh64 (tvb, offset+2), - tvb_get_ntohl (tvb, offset+10)); + tvb_get_ntoh64 (tvb, offset+1), + tvb_get_ntohl (tvb, offset+9)); } if (tree && isreq && iscdb) { - proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_ebp, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_bytchk, tvb, offset+1, 1, 0); - proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1, - 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba64, tvb, offset+2, 8, 0); - proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+10, + proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags, ett_scsi_wrverify, wrverify16_fields, FALSE); + + proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba64, tvb, offset+1, 8, 0); + proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+9, 4, 0); - flags = tvb_get_guint8 (tvb, offset+15); - proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+15, 1, + proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0); + + flags = tvb_get_guint8 (tvb, offset+14); + proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1, flags, "Vendor Unique = %u, NACA = %u, Link = %u", flags & 0xC0, flags & 0x4, flags & 0x1); @@ -1238,7 +1254,7 @@ scsi_cdb_table_t scsi_sbc_table[256] = { /*SBC 0x2b*/{NULL}, /*SBC 0x2c*/{NULL}, /*SBC 0x2d*/{NULL}, -/*SBC 0x2e*/{dissect_sbc2_wrverify10}, +/*SBC 0x2e*/{dissect_sbc_wrverify10}, /*SBC 0x2f*/{dissect_sbc_verify10}, /*SBC 0x30*/{NULL}, /*SBC 0x31*/{NULL}, @@ -1334,7 +1350,7 @@ scsi_cdb_table_t scsi_sbc_table[256] = { /*SBC 0x8b*/{NULL}, /*SBC 0x8c*/{NULL}, /*SBC 0x8d*/{NULL}, -/*SBC 0x8e*/{dissect_sbc2_wrverify16}, +/*SBC 0x8e*/{dissect_sbc_wrverify16}, /*SBC 0x8f*/{dissect_sbc_verify16}, /*SBC 0x90*/{dissect_sbc_prefetch16}, /*SBC 0x91*/{dissect_sbc_synchronizecache16}, @@ -1366,7 +1382,7 @@ scsi_cdb_table_t scsi_sbc_table[256] = { /*SBC 0xab*/{NULL}, /*SBC 0xac*/{NULL}, /*SBC 0xad*/{NULL}, -/*SBC 0xae*/{dissect_sbc2_wrverify12}, +/*SBC 0xae*/{dissect_sbc_wrverify12}, /*SBC 0xaf*/{dissect_sbc_verify12}, /*SBC 0xb0*/{NULL}, /*SBC 0xb1*/{NULL}, @@ -1518,9 +1534,6 @@ proto_register_scsi_sbc(void) { &hf_scsi_sbc_verify_vlen32, {"Verification Length", "scsi.sbc.verify.vlen32", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}}, - { &hf_scsi_sbc_wrverify_ebp, - {"EBP", "scsi.sbc.wrverify.ebp", FT_BOOLEAN, 8, NULL, 0x4, "", - HFILL}}, { &hf_scsi_sbc_wrverify_lba, {"LBA", "scsi.sbc.wrverify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}}, @@ -1644,6 +1657,9 @@ proto_register_scsi_sbc(void) { &hf_scsi_sbc_wrprotect, {"WRPROTECT", "scsi.sbc.wrprotect", FT_UINT8, BASE_HEX, NULL, 0xe0, "", HFILL}}, + { &hf_scsi_sbc_wrverify_flags, + {"Flags", "scsi.sbc.wrverify_flags", FT_UINT8, BASE_HEX, + NULL, 0, "", HFILL}}, }; @@ -1659,7 +1675,8 @@ proto_register_scsi_sbc(void) &ett_scsi_ssu_immed, &ett_scsi_ssu_pwr, &ett_scsi_synccache, - &ett_scsi_verify + &ett_scsi_verify, + &ett_scsi_wrverify }; /* Register the protocol name and description */ |