Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-scsi-sbc.c
blob533ef2829fa6a3e5253f55f9c34d4fcc9e8ed37c
1 /* This dissector is based on the SBC2 specification.
2 * TODO
3 * parts of opcodes
4 * 0x7f
5 * 0xa3
6 * 0xa4
7 * 0x9e
8 * are still missing.
9 * Some DATA IN/OUT PDUs are missing as well.
11 /* packet-scsi-sbc.c
12 * Dissector for the SCSI SBC commandset
13 * Extracted from packet-scsi.c
15 * Dinesh G Dutt (ddutt@cisco.com)
16 * Ronnie sahlberg 2006
18 * Wireshark - Network traffic analyzer
19 * By Gerald Combs <gerald@wireshark.org>
20 * Copyright 2002 Gerald Combs
22 * SPDX-License-Identifier: GPL-2.0-or-later
25 #include "config.h"
27 #include <epan/packet.h>
28 #include <epan/tfs.h>
29 #include <wsutil/array.h>
30 #include "packet-scsi.h"
31 #include "packet-scsi-sbc.h"
33 void proto_register_scsi_sbc(void);
35 static int proto_scsi_sbc;
37 int hf_scsi_sbc_opcode;
38 static int hf_scsi_sbc_service_action;
39 static int hf_scsi_sbc_formatunit_flags;
40 static int hf_scsi_sbc_defect_list_format;
41 static int hf_scsi_sbc_formatunit_vendor;
42 static int hf_scsi_sbc_formatunit_interleave;
43 static int hf_scsi_sbc_rdwr6_lba;
44 static int hf_scsi_sbc_rdwr6_xferlen;
45 static int hf_scsi_sbc_rdwr10_lba;
46 static int hf_scsi_sbc_rdwr10_xferlen;
47 static int hf_scsi_sbc_rdwr12_xferlen;
48 static int hf_scsi_sbc_rdwr16_lba;
49 static int hf_scsi_sbc_read_capacity;
50 static int hf_scsi_sbc_ssu_immed_flags;
51 static int hf_scsi_sbc_ssu_immed;
52 static int hf_scsi_sbc_ssu_pwr_flags;
53 static int hf_scsi_sbc_ssu_pwr_cond;
54 static int hf_scsi_sbc_ssu_loej;
55 static int hf_scsi_sbc_ssu_start;
56 static int hf_scsi_sbc_bytchk;
57 /* static int hf_scsi_sbc_verify_reladdr; */
58 static int hf_scsi_sbc_verify_lba;
59 static int hf_scsi_sbc_verify_lba64;
60 static int hf_scsi_sbc_verify_vlen;
61 static int hf_scsi_sbc_verify_vlen32;
62 static int hf_scsi_sbc_wrverify_lba;
63 static int hf_scsi_sbc_wrverify_xferlen;
64 static int hf_scsi_sbc_wrverify_lba64;
65 static int hf_scsi_sbc_wrverify_xferlen32;
66 /* static int hf_scsi_sbc_readcapacity_flags; */
67 static int hf_scsi_sbc_readdefdata_flags;
68 static int hf_scsi_sbc_reassignblks_flags;
69 static int hf_scsi_sbc_read_flags;
70 static int hf_scsi_sbc_alloclen32;
71 static int hf_scsi_sbc_alloclen16;
72 static int hf_scsi_sbc_lba64_address;
73 static int hf_scsi_sbc_fuflags_fmtpinfo;
74 static int hf_scsi_sbc_fuflags_rto_req;
75 static int hf_scsi_sbc_fuflags_longlist;
76 static int hf_scsi_sbc_fuflags_fmtdata;
77 static int hf_scsi_sbc_fuflags_cmplist;
78 static int hf_scsi_sbc_prefetch_flags;
79 static int hf_scsi_sbc_prefetch_immed;
80 static int hf_scsi_sbc_group;
81 static int hf_scsi_sbc_rdprotect;
82 static int hf_scsi_sbc_dpo;
83 static int hf_scsi_sbc_fua;
84 static int hf_scsi_sbc_fua_nv;
85 static int hf_scsi_sbc_blocksize;
86 static int hf_scsi_sbc_returned_lba;
87 static int hf_scsi_sbc_req_plist;
88 static int hf_scsi_sbc_req_glist;
89 static int hf_scsi_sbc_corrct_flags;
90 static int hf_scsi_sbc_corrct;
91 static int hf_scsi_sbc_reassignblocks_longlba;
92 static int hf_scsi_sbc_reassignblocks_longlist;
93 static int hf_scsi_sbc_synccache_flags;
94 static int hf_scsi_sbc_synccache_immed;
95 static int hf_scsi_sbc_synccache_sync_nv;
96 static int hf_scsi_sbc_vrprotect;
97 static int hf_scsi_sbc_verify_flags;
98 static int hf_scsi_sbc_wrprotect;
99 static int hf_scsi_sbc_wrverify_flags;
100 static int hf_scsi_sbc_writesame_flags;
101 static int hf_scsi_sbc_anchor;
102 static int hf_scsi_sbc_unmap;
103 static int hf_scsi_sbc_pbdata;
104 static int hf_scsi_sbc_lbdata;
105 static int hf_scsi_sbc_xdread_flags;
106 static int hf_scsi_sbc_xorpinfo;
107 static int hf_scsi_sbc_disable_write;
108 static int hf_scsi_sbc_xdwrite_flags;
109 static int hf_scsi_sbc_xdwriteread_flags;
110 static int hf_scsi_sbc_xpwrite_flags;
111 static int hf_scsi_sbc_unmap_flags;
112 static int hf_scsi_sbc_unmap_anchor;
113 static int hf_scsi_sbc_unmap_data_length;
114 static int hf_scsi_sbc_unmap_block_descriptor_data_length;
115 static int hf_scsi_sbc_unmap_lba;
116 static int hf_scsi_sbc_unmap_num_blocks;
117 static int hf_scsi_sbc_ptype;
118 static int hf_scsi_sbc_prot_en;
119 static int hf_scsi_sbc_p_i_exponent;
120 static int hf_scsi_sbc_lbppbe;
121 static int hf_scsi_sbc_lbpme;
122 static int hf_scsi_sbc_lbprz;
123 static int hf_scsi_sbc_lalba;
124 static int hf_scsi_sbc_get_lba_status_lba;
125 static int hf_scsi_sbc_get_lba_status_data_length;
126 static int hf_scsi_sbc_get_lba_status_num_blocks;
127 static int hf_scsi_sbc_get_lba_status_provisioning_status;
128 static int hf_scsi_sbc_sanitize_flags;
129 static int hf_scsi_sbc_sanitize_immed;
130 static int hf_scsi_sbc_sanitize_ause;
131 static int hf_scsi_sbc_sanitize_sa;
132 static int hf_scsi_sbc_sanitize_overwrite_flags;
133 static int hf_scsi_sbc_sanitize_invert;
134 static int hf_scsi_sbc_sanitize_test;
135 static int hf_scsi_sbc_sanitize_owcount;
136 static int hf_scsi_sbc_sanitize_pattern_length;
137 static int hf_scsi_sbc_sanitize_pattern;
139 static int ett_scsi_format_unit;
140 static int ett_scsi_prefetch;
141 static int ett_scsi_rdwr;
142 static int ett_scsi_xdread;
143 static int ett_scsi_xdwrite;
144 static int ett_scsi_xdwriteread;
145 static int ett_scsi_xpwrite;
146 static int ett_scsi_defectdata;
147 static int ett_scsi_corrct;
148 static int ett_scsi_reassign_blocks;
149 static int ett_scsi_ssu_immed;
150 static int ett_scsi_ssu_pwr;
151 static int ett_scsi_synccache;
152 static int ett_scsi_verify;
153 static int ett_scsi_wrverify;
154 static int ett_scsi_writesame;
155 static int ett_scsi_unmap;
156 static int ett_scsi_unmap_block_descriptor;
157 static int ett_scsi_lba_status_descriptor;
158 static int ett_scsi_sanitize;
159 static int ett_scsi_sanitize_overwrite;
161 static const true_false_string dpo_tfs = {
162 "Disable Page Out (don't cache this data)",
163 "Disable page out is DISABLED (cache this data)"
165 static const true_false_string fua_tfs = {
166 "Read from the medium, not cache",
167 "Read from cache if possible"
169 static const true_false_string fua_nv_tfs = {
170 "Read from volatile cache is NOT permitted",
171 "Read from volatile or non-volatile cache permitted"
173 #if 0
174 static const true_false_string pmi_tfs = {
175 "PMI is SET",
176 "Pmi is CLEAR"
178 #endif
180 static void
181 dissect_sbc_formatunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
182 unsigned offset, bool isreq, bool iscdb,
183 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
185 static int * const fuflags_fields[] = {
186 &hf_scsi_sbc_fuflags_fmtpinfo,
187 &hf_scsi_sbc_fuflags_rto_req,
188 &hf_scsi_sbc_fuflags_longlist,
189 &hf_scsi_sbc_fuflags_fmtdata,
190 &hf_scsi_sbc_fuflags_cmplist,
191 &hf_scsi_sbc_defect_list_format,
192 NULL
195 if (!tree)
196 return;
198 if (isreq && iscdb) {
199 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_formatunit_flags,
200 ett_scsi_format_unit, fuflags_fields, ENC_BIG_ENDIAN);
201 proto_tree_add_item (tree, hf_scsi_sbc_formatunit_vendor, tvb, offset+1, 1, ENC_BIG_ENDIAN);
202 proto_tree_add_item (tree, hf_scsi_sbc_formatunit_interleave, tvb, offset+2, 2, ENC_BIG_ENDIAN);
203 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
204 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
206 /* TODO : add dissection of DATA */
209 static void
210 dissect_sbc_read6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
211 unsigned offset, bool isreq, bool iscdb,
212 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
214 if (isreq && iscdb) {
215 col_append_fstr (pinfo->cinfo, COL_INFO, "%u bytes (%u blocks) at LBA: 0x%06x ",
216 cdata->itlq->data_length,
217 tvb_get_uint8(tvb, offset+3),
218 tvb_get_ntoh24(tvb, offset));
221 if (tree && isreq && iscdb) {
222 proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_lba, tvb, offset, 3, ENC_BIG_ENDIAN);
223 proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_xferlen, tvb, offset+3, 1, ENC_BIG_ENDIAN);
224 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
225 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
229 static void
230 dissect_sbc_write6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
231 unsigned offset, bool isreq, bool iscdb,
232 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
234 if (isreq && iscdb) {
235 col_append_fstr (pinfo->cinfo, COL_INFO, "%u bytes (%u blocks) at LBA: 0x%06x ",
236 cdata->itlq->data_length,
237 tvb_get_uint8(tvb, offset+3),
238 tvb_get_ntoh24(tvb, offset));
241 if (tree && isreq && iscdb) {
242 proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_lba, tvb, offset, 3, ENC_BIG_ENDIAN);
243 proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_xferlen, tvb, offset+3, 1, ENC_BIG_ENDIAN);
244 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
245 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
249 static void
250 dissect_sbc_prefetch10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
251 unsigned offset, bool isreq, bool iscdb,
252 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
255 static int * const prefetch_fields[] = {
256 &hf_scsi_sbc_prefetch_immed,
257 NULL
260 if (isreq && iscdb) {
261 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
262 tvb_get_ntohl (tvb, offset+1),
263 tvb_get_ntohs (tvb, offset+6));
266 if (tree && isreq && iscdb) {
267 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_prefetch_flags,
268 ett_scsi_prefetch, prefetch_fields, ENC_BIG_ENDIAN);
269 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
270 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
271 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
272 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
273 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
277 static void
278 dissect_sbc_synchronizecache10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
279 unsigned offset, bool isreq, bool iscdb,
280 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
283 static int * const sync_fields[] = {
284 &hf_scsi_sbc_synccache_sync_nv,
285 &hf_scsi_sbc_synccache_immed,
286 NULL
289 if (isreq && iscdb) {
290 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
291 tvb_get_ntohl (tvb, offset+1),
292 tvb_get_ntohs (tvb, offset+6));
295 if (tree && isreq && iscdb) {
296 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_synccache_flags,
297 ett_scsi_synccache, sync_fields, ENC_BIG_ENDIAN);
298 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
299 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
300 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
301 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
302 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
306 static void
307 dissect_sbc_synchronizecache16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
308 unsigned offset, bool isreq, bool iscdb,
309 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
312 static int * const sync_fields[] = {
313 &hf_scsi_sbc_synccache_sync_nv,
314 &hf_scsi_sbc_synccache_immed,
315 NULL
318 if (isreq && iscdb) {
319 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
320 tvb_get_ntoh64 (tvb, offset+1),
321 tvb_get_ntohl (tvb, offset+9));
324 if (tree && isreq && iscdb) {
325 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_synccache_flags,
326 ett_scsi_synccache, sync_fields, ENC_BIG_ENDIAN);
327 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
328 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
329 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
330 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
331 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
335 static void
336 dissect_sbc_prefetch16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
337 unsigned offset, bool isreq, bool iscdb,
338 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
341 static int * const prefetch_fields[] = {
342 &hf_scsi_sbc_prefetch_immed,
343 NULL
346 if (isreq && iscdb) {
347 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
348 tvb_get_ntoh64 (tvb, offset+1),
349 tvb_get_ntohl (tvb, offset+9));
352 if (tree && isreq && iscdb) {
353 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_prefetch_flags,
354 ett_scsi_prefetch, prefetch_fields, ENC_BIG_ENDIAN);
355 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
356 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
357 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
358 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
359 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
363 void
364 dissect_sbc_read10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
365 unsigned offset, bool isreq, bool iscdb,
366 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
368 static int * const rdwr10_fields[] = {
369 &hf_scsi_sbc_rdprotect,
370 &hf_scsi_sbc_dpo,
371 &hf_scsi_sbc_fua,
372 &hf_scsi_sbc_fua_nv,
373 NULL
376 if (isreq && iscdb) {
377 col_append_fstr (pinfo->cinfo, COL_INFO, "%u bytes (%u blocks) at LBA: 0x%08x ",
378 cdata->itlq->data_length,
379 tvb_get_ntohs(tvb, offset+6),
380 tvb_get_ntohl(tvb, offset+1));
383 if (tree && isreq && iscdb) {
384 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
385 ett_scsi_rdwr, rdwr10_fields, ENC_BIG_ENDIAN);
386 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
387 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
388 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
389 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
390 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
394 static void
395 dissect_sbc_xdread10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
396 unsigned offset, bool isreq, bool iscdb,
397 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
400 static int * const xdread10_fields[] = {
401 &hf_scsi_sbc_xorpinfo,
402 NULL
405 if (isreq && iscdb) {
406 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
407 tvb_get_ntohl (tvb, offset+1),
408 tvb_get_ntohs (tvb, offset+6));
411 if (tree && isreq && iscdb) {
412 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdread_flags,
413 ett_scsi_xdread, xdread10_fields, ENC_BIG_ENDIAN);
414 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
415 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
416 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
417 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
418 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
422 static void
423 dissect_sbc_xdwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
424 unsigned offset, bool isreq, bool iscdb,
425 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
428 static int * const xdwrite10_fields[] = {
429 &hf_scsi_sbc_wrprotect,
430 &hf_scsi_sbc_dpo,
431 &hf_scsi_sbc_fua,
432 &hf_scsi_sbc_disable_write,
433 &hf_scsi_sbc_fua_nv,
434 NULL
437 if (isreq && iscdb) {
438 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
439 tvb_get_ntohl (tvb, offset+1),
440 tvb_get_ntohs (tvb, offset+6));
443 if (tree && isreq && iscdb) {
444 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdwrite_flags,
445 ett_scsi_xdwrite, xdwrite10_fields, ENC_BIG_ENDIAN);
446 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
447 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
448 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
449 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
450 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
454 static void
455 dissect_sbc_xdwriteread10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
456 unsigned offset, bool isreq, bool iscdb,
457 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
460 static int * const xdwriteread10_fields[] = {
461 &hf_scsi_sbc_wrprotect,
462 &hf_scsi_sbc_dpo,
463 &hf_scsi_sbc_fua,
464 &hf_scsi_sbc_disable_write,
465 &hf_scsi_sbc_fua_nv,
466 &hf_scsi_sbc_xorpinfo,
467 NULL
470 if (isreq && iscdb) {
471 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
472 tvb_get_ntohl (tvb, offset+1),
473 tvb_get_ntohs (tvb, offset+6));
476 if (tree && isreq && iscdb) {
477 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdwriteread_flags,
478 ett_scsi_xdwriteread, xdwriteread10_fields, ENC_BIG_ENDIAN);
479 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
480 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
481 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
482 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
483 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
487 static void
488 dissect_sbc_xpwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
489 unsigned offset, bool isreq, bool iscdb,
490 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
493 static int * const xpwrite10_fields[] = {
494 &hf_scsi_sbc_dpo,
495 &hf_scsi_sbc_fua,
496 &hf_scsi_sbc_fua_nv,
497 &hf_scsi_sbc_xorpinfo,
498 NULL
501 if (isreq && iscdb) {
502 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
503 tvb_get_ntohl (tvb, offset+1),
504 tvb_get_ntohs (tvb, offset+6));
507 if (tree && isreq && iscdb) {
508 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xpwrite_flags,
509 ett_scsi_xpwrite, xpwrite10_fields, ENC_BIG_ENDIAN);
510 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
511 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
512 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
513 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
514 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
518 void
519 dissect_sbc_write10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
520 unsigned offset, bool isreq, bool iscdb,
521 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
523 static int * const rdwr10_fields[] = {
524 &hf_scsi_sbc_wrprotect,
525 &hf_scsi_sbc_dpo,
526 &hf_scsi_sbc_fua,
527 &hf_scsi_sbc_fua_nv,
528 NULL
531 if (isreq && iscdb) {
532 col_append_fstr (pinfo->cinfo, COL_INFO, "%u bytes (%u blocks) at LBA: 0x%08x ",
533 cdata->itlq->data_length,
534 tvb_get_ntohs(tvb, offset+6),
535 tvb_get_ntohl(tvb, offset+1));
538 if (tree && isreq && iscdb) {
539 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
540 ett_scsi_rdwr, rdwr10_fields, ENC_BIG_ENDIAN);
541 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
542 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
543 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
544 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
545 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
549 void
550 dissect_sbc_read12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
551 unsigned offset, bool isreq, bool iscdb,
552 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
554 static int * const rdwr12_fields[] = {
555 &hf_scsi_sbc_rdprotect,
556 &hf_scsi_sbc_dpo,
557 &hf_scsi_sbc_fua,
558 &hf_scsi_sbc_fua_nv,
559 NULL
562 if (isreq && iscdb) {
563 col_append_fstr(pinfo->cinfo, COL_INFO, "%u bytes (%u blocks) at LBA: 0x%08x ",
564 cdata->itlq->data_length,
565 tvb_get_ntohl(tvb, offset+5),
566 tvb_get_ntohl(tvb, offset+1));
569 if (tree && isreq && iscdb) {
570 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
571 ett_scsi_rdwr, rdwr12_fields, ENC_BIG_ENDIAN);
572 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
573 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+5, 4, ENC_BIG_ENDIAN);
574 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, ENC_BIG_ENDIAN);
575 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
576 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
580 void
581 dissect_sbc_write12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
582 unsigned offset, bool isreq, bool iscdb,
583 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
585 static int * const rdwr12_fields[] = {
586 &hf_scsi_sbc_wrprotect,
587 &hf_scsi_sbc_dpo,
588 &hf_scsi_sbc_fua,
589 &hf_scsi_sbc_fua_nv,
590 NULL
593 if (isreq && iscdb) {
594 col_append_fstr(pinfo->cinfo, COL_INFO, "%u bytes (%u blocks) at LBA: 0x%08x ",
595 cdata->itlq->data_length,
596 tvb_get_ntohl(tvb, offset+5),
597 tvb_get_ntohl(tvb, offset+1));
600 if (tree && isreq && iscdb) {
601 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
602 ett_scsi_rdwr, rdwr12_fields, ENC_BIG_ENDIAN);
603 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
604 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+5, 4, ENC_BIG_ENDIAN);
605 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, ENC_BIG_ENDIAN);
606 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
607 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
611 static void
612 dissect_sbc_read16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
613 unsigned offset, bool isreq, bool iscdb,
614 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
616 static int * const rdwr16_fields[] = {
617 &hf_scsi_sbc_rdprotect,
618 &hf_scsi_sbc_dpo,
619 &hf_scsi_sbc_fua,
620 &hf_scsi_sbc_fua_nv,
621 NULL
624 if (isreq && iscdb) {
625 col_append_fstr(pinfo->cinfo, COL_INFO, "%u bytes (%u blocks) at LBA: %" PRIu64,
626 cdata->itlq->data_length,
627 tvb_get_ntohl(tvb, offset+9),
628 tvb_get_ntoh64(tvb, offset+1)
632 if (tree && isreq && iscdb) {
633 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
634 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
635 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
636 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
637 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
638 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
639 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
642 static void
643 dissect_sbc_write16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
644 unsigned offset, bool isreq, bool iscdb,
645 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
647 static int * const rdwr16_fields[] = {
648 &hf_scsi_sbc_wrprotect,
649 &hf_scsi_sbc_dpo,
650 &hf_scsi_sbc_fua,
651 &hf_scsi_sbc_fua_nv,
652 NULL
655 if (isreq && iscdb) {
656 col_append_fstr (pinfo->cinfo, COL_INFO, "%u bytes (%u blocks) at LBA: %" PRIu64,
657 cdata->itlq->data_length,
658 tvb_get_ntohl(tvb, offset+9),
659 tvb_get_ntoh64 (tvb, offset+1)
663 if (tree && isreq && iscdb) {
664 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
665 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
666 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
667 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
668 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
669 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
670 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
674 static void
675 dissect_sbc_writeatomic16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
676 unsigned offset, bool isreq, bool iscdb,
677 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
679 static int * const rdwr16_fields[] = {
680 &hf_scsi_sbc_wrprotect,
681 &hf_scsi_sbc_dpo,
682 &hf_scsi_sbc_fua,
683 NULL
686 if (isreq && iscdb) {
687 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
688 tvb_get_ntoh64 (tvb, offset+1),
689 tvb_get_ntohs (tvb, offset+11));
692 if (tree && isreq && iscdb) {
693 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
694 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
695 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
696 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+11, 2, ENC_BIG_ENDIAN);
697 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
698 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
699 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
703 static void
704 dissect_sbc_orwrite (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
705 unsigned offset, bool isreq, bool iscdb,
706 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
708 static int * const rdwr16_fields[] = {
709 &hf_scsi_sbc_wrprotect,
710 &hf_scsi_sbc_dpo,
711 &hf_scsi_sbc_fua,
712 &hf_scsi_sbc_fua_nv,
713 NULL
716 if (isreq && iscdb) {
717 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
718 tvb_get_ntoh64 (tvb, offset+1),
719 tvb_get_ntohl (tvb, offset+9));
722 if (tree && isreq && iscdb) {
723 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
724 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
725 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
726 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
727 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
728 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
729 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
733 static void
734 dissect_sbc_comparenwrite (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
735 unsigned offset, bool isreq, bool iscdb,
736 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
738 static int * const rdwr16_fields[] = {
739 &hf_scsi_sbc_wrprotect,
740 &hf_scsi_sbc_dpo,
741 &hf_scsi_sbc_fua,
742 &hf_scsi_sbc_fua_nv,
743 NULL
746 if (isreq && iscdb) {
747 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
748 tvb_get_ntoh64 (tvb, offset+1),
749 tvb_get_ntohl (tvb, offset+9));
752 if (tree && isreq && iscdb) {
753 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
754 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
755 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
756 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+12, 1, ENC_BIG_ENDIAN);
757 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
758 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
759 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
763 static const value_string scsi_ssu_pwrcnd_val[] = {
764 {0x0, "No Change"},
765 {0x1, "Place Device In Active Condition"},
766 {0x2, "Place device into Idle condition"},
767 {0x3, "Place device into Standby condition"},
768 {0x4, "Reserved"},
769 {0x5, "Place device into Sleep condition"},
770 {0x6, "Reserved"},
771 {0x7, "Transfer control of power conditions to block device"},
772 {0x8, "Reserved"},
773 {0x9, "Reserved"},
774 {0xA, "Force Idle Condition Timer to zero"},
775 {0xB, "Force Standby Condition Timer to zero"},
776 {0, NULL},
779 static const value_string scsi_ptype_val[] = {
780 {0x0, "Type 1 protection" },
781 {0x1, "Type 2 protection" },
782 {0x2, "Type 3 protection" },
783 {0, NULL},
786 static const value_string scsi_provisioning_type_val[] = {
787 {0x0, "The LBA is MAPPED" },
788 {0x1, "The LBA is DEALLOCATED" },
789 {0x2, "The LBA is ANCHORED" },
790 {0, NULL},
793 void
794 dissect_sbc_startstopunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
795 unsigned offset, bool isreq _U_, bool iscdb,
796 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
798 static int * const ssu_fields[] = {
799 &hf_scsi_sbc_ssu_immed,
800 NULL
802 static int * const pwr_fields[] = {
803 &hf_scsi_sbc_ssu_pwr_cond,
804 &hf_scsi_sbc_ssu_loej,
805 &hf_scsi_sbc_ssu_start,
806 NULL
809 if (!tree || !iscdb)
810 return;
812 if (isreq && iscdb) {
813 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_ssu_immed_flags,
814 ett_scsi_ssu_immed, ssu_fields, ENC_BIG_ENDIAN);
815 proto_tree_add_bitmask(tree, tvb, offset+3, hf_scsi_sbc_ssu_pwr_flags,
816 ett_scsi_ssu_pwr, pwr_fields, ENC_BIG_ENDIAN);
817 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
818 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
822 static void
823 dissect_sbc_verify10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
824 unsigned offset, bool isreq, bool iscdb,
825 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
828 static int * const verify10_fields[] = {
829 &hf_scsi_sbc_vrprotect,
830 &hf_scsi_sbc_dpo,
831 &hf_scsi_sbc_bytchk,
832 NULL
835 if (isreq && iscdb) {
836 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u) ",
837 tvb_get_ntohl (tvb, offset+1),
838 tvb_get_ntohs (tvb, offset+6));
841 if (tree && isreq && iscdb) {
842 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags,
843 ett_scsi_verify, verify10_fields, ENC_BIG_ENDIAN);
844 proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
845 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
846 proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
847 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
848 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
852 static void
853 dissect_sbc_verify12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
854 unsigned offset, bool isreq, bool iscdb,
855 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
858 static int * const verify12_fields[] = {
859 &hf_scsi_sbc_vrprotect,
860 &hf_scsi_sbc_dpo,
861 &hf_scsi_sbc_bytchk,
862 NULL
865 if (isreq && iscdb) {
866 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u) ",
867 tvb_get_ntohl (tvb, offset+1),
868 tvb_get_ntohl (tvb, offset+5));
871 if (isreq && iscdb) {
872 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags,
873 ett_scsi_verify, verify12_fields, ENC_BIG_ENDIAN);
874 proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
875 proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen32, tvb, offset+5, 4, ENC_BIG_ENDIAN);
876 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, ENC_BIG_ENDIAN);
877 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
878 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
882 static void
883 dissect_sbc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
884 unsigned offset, bool isreq, bool iscdb,
885 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
888 static int * const verify16_fields[] = {
889 &hf_scsi_sbc_vrprotect,
890 &hf_scsi_sbc_dpo,
891 &hf_scsi_sbc_bytchk,
892 NULL
895 if (isreq && iscdb) {
896 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u) ",
897 tvb_get_ntoh64 (tvb, offset+1),
898 tvb_get_ntohl (tvb, offset+9));
901 if (isreq && iscdb) {
902 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags,
903 ett_scsi_verify, verify16_fields, ENC_BIG_ENDIAN);
904 proto_tree_add_item (tree, hf_scsi_sbc_verify_lba64, tvb, offset+1, 8, ENC_BIG_ENDIAN);
905 proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen32, tvb, offset+9, 4, ENC_BIG_ENDIAN);
906 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
907 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
908 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
913 static void
914 dissect_sbc_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_,
915 proto_tree *tree, unsigned offset, bool isreq,
916 bool iscdb, unsigned payload_len _U_,
917 scsi_task_data_t *cdata _U_)
920 static int * const wrverify10_fields[] = {
921 &hf_scsi_sbc_wrprotect,
922 &hf_scsi_sbc_dpo,
923 &hf_scsi_sbc_bytchk,
924 NULL
927 if (isreq && iscdb) {
928 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u) ",
929 tvb_get_ntohl (tvb, offset+1),
930 tvb_get_ntohs (tvb, offset+6));
933 if (tree && isreq && iscdb) {
934 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags,
935 ett_scsi_wrverify, wrverify10_fields, ENC_BIG_ENDIAN);
936 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
937 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
938 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
939 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
940 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
944 static void
945 dissect_sbc_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_,
946 proto_tree *tree, unsigned offset, bool isreq,
947 bool iscdb, unsigned payload_len _U_,
948 scsi_task_data_t *cdata _U_)
950 static int * const wrverify12_fields[] = {
951 &hf_scsi_sbc_wrprotect,
952 &hf_scsi_sbc_dpo,
953 &hf_scsi_sbc_bytchk,
954 NULL
957 if (isreq && iscdb) {
958 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u) ",
959 tvb_get_ntohl (tvb, offset+1),
960 tvb_get_ntohl (tvb, offset+5));
963 if (tree && isreq && iscdb) {
964 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags,
965 ett_scsi_wrverify, wrverify12_fields, ENC_BIG_ENDIAN);
966 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
967 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+5, 4, ENC_BIG_ENDIAN);
968 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, ENC_BIG_ENDIAN);
969 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
970 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
974 static void
975 dissect_sbc_wrverify16 (tvbuff_t *tvb, packet_info *pinfo _U_,
976 proto_tree *tree, unsigned offset, bool isreq,
977 bool iscdb, unsigned payload_len _U_,
978 scsi_task_data_t *cdata _U_)
980 static int * const wrverify16_fields[] = {
981 &hf_scsi_sbc_wrprotect,
982 &hf_scsi_sbc_dpo,
983 &hf_scsi_sbc_bytchk,
984 NULL
987 if (isreq && iscdb) {
988 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u) ",
989 tvb_get_ntoh64 (tvb, offset+1),
990 tvb_get_ntohl (tvb, offset+9));
993 if (tree && isreq && iscdb) {
994 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags,
995 ett_scsi_wrverify, wrverify16_fields, ENC_BIG_ENDIAN);
996 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba64, tvb, offset+1, 8, ENC_BIG_ENDIAN);
997 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+9, 4, ENC_BIG_ENDIAN);
998 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
999 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
1000 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1004 void
1005 dissect_sbc_readcapacity10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1006 unsigned offset, bool isreq, bool iscdb,
1007 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1009 uint32_t lba, block_len;
1010 uint64_t totalSizeBytes64;
1011 double totalSizeBytes, totalSizeAbbrev;
1012 static const char* binaryPrefixes[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB" };
1013 int idx = 0;
1015 if (!tree)
1016 return;
1018 if (isreq && iscdb) {
1019 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1020 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1022 else if (!iscdb) {
1023 lba = tvb_get_ntohl(tvb, offset) + 1; /* LBAs are zero-based so we add 1 */
1024 proto_tree_add_uint_format(tree, hf_scsi_sbc_returned_lba, tvb, offset, 4, lba, "LBA: %u ", lba);
1025 proto_tree_add_item(tree, hf_scsi_sbc_blocksize, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1027 block_len = tvb_get_ntohl(tvb, offset+4);
1028 totalSizeBytes64 = (uint64_t)lba * (uint64_t)block_len; /* prevent overflow */
1029 totalSizeBytes = (double)totalSizeBytes64;
1030 totalSizeAbbrev = totalSizeBytes;
1032 while (totalSizeAbbrev >= 1024 && idx < 5) {
1033 totalSizeAbbrev /= 1024.0;
1034 idx++;
1036 proto_tree_add_double_format(tree, hf_scsi_sbc_read_capacity, tvb, 0, 0,
1037 totalSizeBytes, "Read capacity: %.0f bytes (%.2f %s)",
1038 totalSizeBytes, totalSizeAbbrev, binaryPrefixes[idx]);
1040 col_prepend_fstr(pinfo->cinfo, COL_INFO, "%.2f %s ",
1041 totalSizeAbbrev, binaryPrefixes[idx]);
1045 static void
1046 dissect_sbc_readdefectdata10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1047 proto_tree *tree, unsigned offset, bool isreq,
1048 bool iscdb,
1049 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1051 static int * const defect_fields[] = {
1052 &hf_scsi_sbc_defect_list_format,
1053 &hf_scsi_sbc_req_plist,
1054 &hf_scsi_sbc_req_glist,
1055 NULL
1058 if (!tree)
1059 return;
1061 if (isreq && iscdb) {
1062 proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_sbc_readdefdata_flags,
1063 ett_scsi_defectdata, defect_fields, ENC_BIG_ENDIAN);
1064 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1065 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1066 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1068 /* TODO : add dissection of DATA */
1072 static void
1073 dissect_sbc_readlong10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1074 proto_tree *tree, unsigned offset, bool isreq,
1075 bool iscdb,
1076 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1078 static int * const corrct_fields[] = {
1079 &hf_scsi_sbc_corrct,
1080 NULL
1083 if (!tree)
1084 return;
1086 if (isreq && iscdb) {
1087 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_corrct_flags,
1088 ett_scsi_corrct, corrct_fields, ENC_BIG_ENDIAN);
1089 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
1090 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1091 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1092 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1096 static void
1097 dissect_sbc_writelong10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1098 proto_tree *tree, unsigned offset, bool isreq,
1099 bool iscdb,
1100 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1102 if (!tree)
1103 return;
1105 if (isreq && iscdb) {
1106 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
1107 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1108 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1109 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1113 static void
1114 dissect_sbc_writesame10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1115 proto_tree *tree, unsigned offset, bool isreq,
1116 bool iscdb,
1117 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1119 static int * const writesame10_fields[] = {
1120 &hf_scsi_sbc_wrprotect,
1121 &hf_scsi_sbc_anchor,
1122 &hf_scsi_sbc_unmap,
1123 &hf_scsi_sbc_pbdata,
1124 &hf_scsi_sbc_lbdata,
1125 NULL
1128 if (!tree)
1129 return;
1131 if (isreq && iscdb) {
1132 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_writesame_flags,
1133 ett_scsi_writesame, writesame10_fields, ENC_BIG_ENDIAN);
1134 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
1135 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1136 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1137 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1138 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1142 static void
1143 dissect_sbc_writesame16 (tvbuff_t *tvb, packet_info *pinfo _U_,
1144 proto_tree *tree, unsigned offset, bool isreq,
1145 bool iscdb,
1146 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1148 static int * const writesame16_fields[] = {
1149 &hf_scsi_sbc_wrprotect,
1150 &hf_scsi_sbc_anchor,
1151 &hf_scsi_sbc_unmap,
1152 &hf_scsi_sbc_pbdata,
1153 &hf_scsi_sbc_lbdata,
1154 NULL
1157 if (!tree)
1158 return;
1160 if (isreq && iscdb) {
1161 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_writesame_flags,
1162 ett_scsi_writesame, writesame16_fields, ENC_BIG_ENDIAN);
1163 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
1164 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
1165 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1166 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
1167 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1171 static void
1172 dissect_sbc_unmap (tvbuff_t *tvb, packet_info *pinfo _U_,
1173 proto_tree *tree, unsigned offset, bool isreq,
1174 bool iscdb,
1175 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1177 static int * const unmap_fields[] = {
1178 &hf_scsi_sbc_unmap_anchor,
1179 NULL
1182 if (!tree)
1183 return;
1185 if (isreq && iscdb) {
1186 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_unmap_flags,
1187 ett_scsi_unmap, unmap_fields, ENC_BIG_ENDIAN);
1188 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1190 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1192 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1193 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1194 } else if (isreq) {
1195 proto_tree_add_item (tree, hf_scsi_sbc_unmap_data_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1196 proto_tree_add_item (tree, hf_scsi_sbc_unmap_block_descriptor_data_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1197 offset += 8;
1198 while (tvb_reported_length_remaining(tvb, offset) >=16) {
1199 proto_tree *tr;
1200 proto_item *it;
1201 int64_t lba;
1202 int32_t num_blocks;
1204 tr = proto_tree_add_subtree(tree, tvb, offset, 16, ett_scsi_unmap_block_descriptor, &it, "UNMAP Block Descriptor: LBA ");
1206 proto_tree_add_item (tr, hf_scsi_sbc_unmap_lba, tvb, offset, 8, ENC_BIG_ENDIAN);
1207 lba = tvb_get_ntoh64 (tvb, offset);
1209 proto_tree_add_item (tr, hf_scsi_sbc_unmap_num_blocks, tvb, offset+8, 4, ENC_BIG_ENDIAN);
1210 num_blocks = tvb_get_ntohl(tvb, offset+8);
1212 if (num_blocks > 1) {
1213 proto_item_append_text (it, "%" PRIu64 "-%" PRIu64 " ", lba, lba+num_blocks-1);
1214 } else {
1215 proto_item_append_text (it, "%" PRIu64 " ", lba);
1218 offset += 16;
1223 static const value_string sanitize_val[] = {
1224 {0x01, "OVERWRITE"},
1225 {0x02, "BLOCK ERASE"},
1226 {0x03, "CRYPTO ERASE"},
1227 {0x1f, "EXIT FAILURE MODE"},
1228 {0, NULL},
1231 static void
1232 dissect_sbc_sanitize (tvbuff_t *tvb, packet_info *pinfo _U_,
1233 proto_tree *tree, unsigned offset, bool isreq,
1234 bool iscdb,
1235 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1237 static int * const sanitize_fields[] = {
1238 &hf_scsi_sbc_sanitize_immed,
1239 &hf_scsi_sbc_sanitize_ause,
1240 &hf_scsi_sbc_sanitize_sa,
1241 NULL
1243 static int * const sanitize_overwrite_fields[] = {
1244 &hf_scsi_sbc_sanitize_invert,
1245 &hf_scsi_sbc_sanitize_test,
1246 &hf_scsi_sbc_sanitize_owcount,
1247 NULL
1250 if (!tree)
1251 return;
1253 if (isreq && iscdb) {
1254 uint8_t service_action;
1256 service_action = tvb_get_uint8 (tvb, offset) & 0x1F;
1257 col_append_str(pinfo->cinfo, COL_INFO,
1258 val_to_str(service_action, sanitize_val, "Unknown (0x%02x) "));
1260 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_sanitize_flags,
1261 ett_scsi_sanitize, sanitize_fields, ENC_BIG_ENDIAN);
1263 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2,
1264 ENC_BIG_ENDIAN);
1266 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1267 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1268 } else if (isreq) {
1269 proto_tree_add_bitmask(tree, tvb, offset,
1270 hf_scsi_sbc_sanitize_overwrite_flags,
1271 ett_scsi_sanitize_overwrite,
1272 sanitize_overwrite_fields,
1273 ENC_BIG_ENDIAN);
1275 proto_tree_add_item (tree, hf_scsi_sbc_sanitize_pattern_length,
1276 tvb, offset+2, 2,
1277 ENC_BIG_ENDIAN);
1279 proto_tree_add_item (tree, hf_scsi_sbc_sanitize_pattern,
1280 tvb, offset+4, -1,
1281 ENC_NA);
1285 static void
1286 dissect_sbc_readdefectdata12 (tvbuff_t *tvb, packet_info *pinfo _U_,
1287 proto_tree *tree, unsigned offset, bool isreq,
1288 bool iscdb,
1289 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1291 static int * const defect_fields[] = {
1292 &hf_scsi_sbc_defect_list_format,
1293 &hf_scsi_sbc_req_plist,
1294 &hf_scsi_sbc_req_glist,
1295 NULL
1298 if (!tree)
1299 return;
1301 if (isreq && iscdb) {
1302 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_readdefdata_flags,
1303 ett_scsi_defectdata, defect_fields, ENC_BIG_ENDIAN);
1304 proto_tree_add_item (tree, hf_scsi_sbc_alloclen32, tvb, offset+5, 4, ENC_BIG_ENDIAN);
1305 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
1306 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1308 /* TODO : add dissection of DATA */
1312 static void
1313 dissect_sbc_reassignblocks (tvbuff_t *tvb, packet_info *pinfo _U_,
1314 proto_tree *tree, unsigned offset, bool isreq,
1315 bool iscdb,
1316 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1318 static int * const reassign_fields[] = {
1319 &hf_scsi_sbc_reassignblocks_longlba,
1320 &hf_scsi_sbc_reassignblocks_longlist,
1321 NULL
1324 if (!tree)
1325 return;
1327 if (isreq && iscdb) {
1328 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_reassignblks_flags,
1329 ett_scsi_reassign_blocks, reassign_fields, ENC_BIG_ENDIAN);
1330 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
1331 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1333 /* TODO : add dissection of DATA */
1337 const value_string service_action_vals[] = {
1338 {SHORT_FORM_BLOCK_ID, "Short Form - Block ID"},
1339 {SHORT_FORM_VENDOR_SPECIFIC, "Short Form - Vendor-Specific"},
1340 {LONG_FORM, "Long Form"},
1341 {EXTENDED_FORM, "Extended Form"},
1342 {SERVICE_READ_CAPACITY16, "Read Capacity(16)"},
1343 {SERVICE_READ_LONG16, "Read Long(16)"},
1344 {SERVICE_GET_LBA_STATUS, "Get LBA Status"},
1345 {SERVICE_REPORT_REFERRALS, "Report Referrals"},
1346 {0, NULL}
1349 /* this is either readcapacity16 or readlong16 depending of what service
1350 action is set to.
1352 static void
1353 dissect_sbc_serviceactionin16 (tvbuff_t *tvb_a, packet_info *pinfo _U_,
1354 proto_tree *tree, unsigned offset_a, bool isreq,
1355 bool iscdb,
1356 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1358 uint8_t service_action;
1359 uint32_t block_len, alloc_len;
1360 uint64_t len, tot_len;
1361 const char *un;
1363 proto_item *it = NULL;
1365 if (isreq && iscdb) {
1366 service_action = tvb_get_uint8(tvb_a, offset_a) & 0x1F;
1367 if(cdata && cdata->itlq){
1368 cdata->itlq->flags=service_action;
1371 switch(service_action){
1372 case SERVICE_READ_CAPACITY16:
1373 col_append_str(pinfo->cinfo, COL_INFO, " READCAPACITY16");
1375 proto_tree_add_item(tree, hf_scsi_sbc_service_action, tvb_a, offset_a, 1, ENC_BIG_ENDIAN);
1377 offset_a += 9;
1379 proto_tree_add_item_ret_uint(tree, hf_scsi_sbc_alloclen32, tvb_a, offset_a, 4, ENC_BIG_ENDIAN, &alloc_len);
1380 if (cdata && cdata->itlq) {
1381 cdata->itlq->alloc_len = alloc_len;
1383 offset_a += 5;
1385 proto_tree_add_bitmask(tree, tvb_a, offset_a, hf_scsi_control,
1386 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1387 offset_a++;
1389 break;
1390 case SERVICE_READ_LONG16:
1391 col_append_str(pinfo->cinfo, COL_INFO, " READ_LONG16");
1393 proto_tree_add_item(tree, hf_scsi_sbc_service_action, tvb_a, offset_a, 1, ENC_BIG_ENDIAN);
1395 offset_a++;
1397 proto_tree_add_item(tree, hf_scsi_sbc_lba64_address, tvb_a, offset_a, 8, ENC_BIG_ENDIAN);
1399 offset_a+=8;
1401 /* two reserved bytes */
1402 offset_a+=2;
1404 proto_tree_add_item_ret_uint(tree, hf_scsi_sbc_alloclen16, tvb_a, offset_a, 2, ENC_BIG_ENDIAN, &alloc_len);
1405 if (cdata && cdata->itlq) {
1406 cdata->itlq->alloc_len = alloc_len;
1408 offset_a+=2;
1410 /* CORRCT bit */
1411 offset_a++;
1413 proto_tree_add_bitmask(tree, tvb_a, offset_a, hf_scsi_control,
1414 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1415 offset_a++;
1417 break;
1418 case SERVICE_GET_LBA_STATUS:
1419 col_append_str(pinfo->cinfo, COL_INFO, " GET_LBA_STATUS");
1421 proto_tree_add_item(tree, hf_scsi_sbc_service_action, tvb_a, offset_a, 1, ENC_BIG_ENDIAN);
1423 offset_a++;
1425 proto_tree_add_item(tree, hf_scsi_sbc_get_lba_status_lba, tvb_a, offset_a, 8, ENC_BIG_ENDIAN);
1426 offset_a += 8;
1428 proto_tree_add_item_ret_uint(tree, hf_scsi_sbc_alloclen32, tvb_a, offset_a, 4, ENC_BIG_ENDIAN, &alloc_len);
1429 if (cdata && cdata->itlq) {
1430 cdata->itlq->alloc_len = alloc_len;
1432 offset_a += 4;
1434 /* reserved */
1435 offset_a++;
1437 proto_tree_add_bitmask(tree, tvb_a, offset_a, hf_scsi_control,
1438 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1439 offset_a++;
1441 break;
1442 case SERVICE_REPORT_REFERRALS:
1443 col_append_str(pinfo->cinfo, COL_INFO, " REPORT_REFERRALS");
1445 proto_tree_add_item(tree, hf_scsi_sbc_service_action, tvb_a, offset_a, 1, ENC_BIG_ENDIAN);
1447 offset_a++;
1449 proto_tree_add_item(tree, hf_scsi_sbc_lba64_address, tvb_a, offset_a, 8, ENC_BIG_ENDIAN);
1451 offset_a += 8;
1453 proto_tree_add_item_ret_uint(tree, hf_scsi_sbc_alloclen32, tvb_a, offset_a, 4, ENC_BIG_ENDIAN, &alloc_len);
1454 if (cdata && cdata->itlq) {
1455 cdata->itlq->alloc_len = alloc_len;
1458 offset_a +=4;
1460 /* reserved */
1461 offset_a++;
1463 proto_tree_add_bitmask(tree, tvb_a, offset_a, hf_scsi_control,
1464 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1465 offset_a++;
1467 break;
1468 default:
1469 col_append_str(pinfo->cinfo, COL_INFO, " RESERVED");
1471 proto_tree_add_uint_format_value(tree, hf_scsi_sbc_service_action, tvb_a, offset_a, 1, service_action, "Reserved (0x%x)", service_action);
1472 break;
1474 } else if (!iscdb) {
1476 if(cdata && cdata->itlq){
1477 TRY_SCSI_CDB_ALLOC_LEN(cdata->itlq->alloc_len);
1479 switch(cdata->itlq->flags){
1480 case SERVICE_READ_CAPACITY16:
1482 len = tvb_get_ntoh64 (try_tvb, try_offset);
1483 block_len = tvb_get_ntohl (try_tvb, try_offset+8);
1484 tot_len=((len/1024)*block_len)/1024; /*MB*/
1485 un="MB";
1486 if(tot_len>20000){
1487 tot_len/=1024;
1488 un="GB";
1491 it = proto_tree_add_item (tree, hf_scsi_sbc_lba64_address, try_tvb, try_offset, 8, ENC_BIG_ENDIAN);
1492 proto_item_append_text (it, " (%" PRIu64 " %s)", tot_len, un);
1493 try_offset += 8;
1495 proto_tree_add_item (tree, hf_scsi_sbc_blocksize, try_tvb, try_offset, 4, ENC_BIG_ENDIAN);
1496 try_offset += 4;
1498 proto_tree_add_item (tree, hf_scsi_sbc_prot_en, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
1499 if (tvb_get_uint8(try_tvb, try_offset) & 0x01) {
1500 /* only decode the protection type if protection is enabled */
1501 proto_tree_add_item (tree, hf_scsi_sbc_ptype, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
1503 try_offset += 1;
1505 proto_tree_add_item (tree, hf_scsi_sbc_p_i_exponent, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
1506 proto_tree_add_item (tree, hf_scsi_sbc_lbppbe, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
1507 try_offset += 1;
1509 proto_tree_add_item (tree, hf_scsi_sbc_lbpme, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
1510 proto_tree_add_item (tree, hf_scsi_sbc_lbprz, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
1511 proto_tree_add_item (tree, hf_scsi_sbc_lalba, try_tvb, try_offset, 2, ENC_BIG_ENDIAN);
1513 break;
1514 case SERVICE_GET_LBA_STATUS:
1515 proto_tree_add_item (tree, hf_scsi_sbc_get_lba_status_data_length, try_tvb, try_offset, 4, ENC_BIG_ENDIAN);
1516 try_offset += 4;
1518 /* reserved */
1519 try_offset += 4;
1521 while (tvb_captured_length_remaining(try_tvb, try_offset) >= 16) {
1522 proto_tree *tr;
1523 uint64_t lba;
1524 uint32_t num_blocks;
1525 uint8_t type;
1527 tr = proto_tree_add_subtree(tree, try_tvb, try_offset, 16, ett_scsi_lba_status_descriptor, &it, "LBA Status Descriptor: ");
1529 proto_tree_add_item (tr, hf_scsi_sbc_get_lba_status_lba, try_tvb, try_offset, 8, ENC_BIG_ENDIAN);
1530 lba = tvb_get_ntoh64(try_tvb, try_offset);
1531 try_offset += 8;
1533 proto_tree_add_item (tr, hf_scsi_sbc_get_lba_status_num_blocks, try_tvb, try_offset, 4, ENC_BIG_ENDIAN);
1534 num_blocks = tvb_get_ntohl(try_tvb, try_offset);
1535 try_offset += 4;
1537 proto_tree_add_item (tr, hf_scsi_sbc_get_lba_status_provisioning_status, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
1538 type = tvb_get_uint8(try_tvb, try_offset) & 0x07;
1539 try_offset++;
1541 /* reserved */
1542 try_offset += 3;
1544 proto_item_append_text (it, "%" PRIu64 "-%" PRIu64 " %s",
1545 lba,
1546 lba + num_blocks - 1,
1547 val_to_str(type, scsi_provisioning_type_val, "Unknown (0x%02x) ")
1550 break;
1552 END_TRY_SCSI_CDB_ALLOC_LEN;
1557 static void
1558 dissect_sbc_serviceactionout16(tvbuff_t *tvb, packet_info *pinfo _U_,
1559 proto_tree *tree, unsigned offset, bool isreq,
1560 bool iscdb,
1561 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
1563 uint8_t service_action;
1565 if (isreq && iscdb) {
1566 service_action = tvb_get_uint8 (tvb, offset) & 0x1F;
1567 if(cdata && cdata->itlq){
1568 cdata->itlq->flags=service_action;
1571 switch(service_action){
1572 case SERVICE_WRITE_LONG16:
1573 col_append_str(pinfo->cinfo, COL_INFO, " WRITE_LONG16");
1575 if (!tree)
1576 return;
1578 /* Read Long (16) & Write Long (16) share the same service action code, we're looking for Write Long (16) here
1579 We can't lookup from service_action_vals[] as we'll always get Read Long (16) instead */
1580 proto_tree_add_uint_format_value(tree, hf_scsi_sbc_service_action, tvb, offset, 1, service_action, "Write Long (16) (0x%x)", service_action);
1582 offset++;
1584 proto_tree_add_item(tree, hf_scsi_sbc_lba64_address, tvb, offset, 8, ENC_BIG_ENDIAN);
1586 offset+=8;
1588 /* two reserved bytes */
1589 offset+=2;
1591 proto_tree_add_item(tree, hf_scsi_sbc_alloclen16, tvb, offset, 2, ENC_BIG_ENDIAN);
1592 offset+=2;
1594 /* Reserved byte */
1595 offset++;
1597 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_control,
1598 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1599 offset++;
1601 break;
1602 default:
1603 col_append_str(pinfo->cinfo, COL_INFO, " RESERVED");
1605 if (!tree)
1606 return;
1608 proto_tree_add_uint_format_value(tree, hf_scsi_sbc_service_action, tvb, offset, 1, service_action, "Reserved (0x%x) ", service_action);
1609 break;
1614 /* SBC Commands */
1615 static const value_string scsi_sbc_vals[] = {
1616 /* 0x00 */ {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"},
1617 /* 0x03 */ {SCSI_SPC_REQSENSE , "Request Sense"},
1618 /* 0x04 */ {SCSI_SBC_FORMATUNIT , "Format Unit"},
1619 /* 0x07 */ {SCSI_SBC_REASSIGNBLKS , "Reassign Blocks"},
1620 /* 0x08 */ {SCSI_SBC_READ6 , "Read(6)"},
1621 /* 0x0A */ {SCSI_SBC_WRITE6 , "Write(6)"},
1622 /* 0x12 */ {SCSI_SPC_INQUIRY , "Inquiry"},
1623 /* 0x15 */ {SCSI_SPC_MODESELECT6 , "Mode Select(6)"},
1624 /* 0x16 */ {SCSI_SPC_RESERVE6 , "Reserve(6)"}, /* obsolete in SBC2 and later */
1625 /* 0x17 */ {SCSI_SPC_RELEASE6 , "Release(6)"}, /* obsolete in SBC2 and later */
1626 /* 0x1A */ {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"},
1627 /* 0x1B */ {SCSI_SBC_STARTSTOPUNIT , "Start Stop Unit"},
1628 /* 0x1D */ {SCSI_SPC_SENDDIAG , "Send Diagnostic"},
1629 /* 0x1E */ {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"},
1630 /* 0x25 */ {SCSI_SBC_READCAPACITY10 , "Read Capacity(10)"},
1631 /* 0x28 */ {SCSI_SBC_READ10 , "Read(10)"},
1632 /* 0x2A */ {SCSI_SBC_WRITE10 , "Write(10)"},
1633 /* 0x2B */ {SCSI_SBC_SEEK10 , "Seek(10)"},
1634 /* 0x2E */ {SCSI_SBC_WRITENVERIFY10 , "Write & Verify(10)"},
1635 /* 0x2F */ {SCSI_SBC_VERIFY10 , "Verify(10)"},
1636 /* 0x33 */ {SCSI_SBC_SETLIMITS10 , "Set Limits(10)"},
1637 /* 0x34 */ {SCSI_SBC_PREFETCH10 , "Pre-Fetch(10)"},
1638 /* 0x35 */ {SCSI_SBC_SYNCCACHE10 , "Synchronize Cache(10)"},
1639 /* 0x36 */ {SCSI_SBC_LOCKUNLKCACHE10 , "Lock Unlock Cache(10)"},
1640 /* 0x37 */ {SCSI_SBC_READDEFDATA10 , "Read Defect Data(10)"},
1641 /* 0x3B */ {SCSI_SPC_WRITEBUFFER , "Write Buffer"},
1642 /* 0x3E */ {SCSI_SBC_READLONG , "Read Long(10)"},
1643 /* 0x3F */ {SCSI_SBC_WRITELONG , "Write Long"},
1644 /* 0x41 */ {SCSI_SBC_WRITESAME10 , "Write Same(10)"},
1645 /* 0x42 */ {SCSI_SBC_UNMAP , "Unmap"},
1646 /* 0x48 */ {SCSI_SBC_SANITIZE , "Sanitize"},
1647 /* 0x4C */ {SCSI_SPC_LOGSELECT , "Log Select"},
1648 /* 0x4D */ {SCSI_SPC_LOGSENSE , "Log Sense"},
1649 /* 0x50 */ {SCSI_SBC_XDWRITE10 , "XdWrite(10)"},
1650 /* 0x51 */ {SCSI_SBC_XPWRITE10 , "XpWrite(10)"},
1651 /* 0x52 */ {SCSI_SBC_XDREAD10 , "XdRead(10)"},
1652 /* 0x53 */ {SCSI_SBC_XDWRITEREAD10 , "XdWriteRead(10)"},
1653 /* 0x55 */ {SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
1654 /* 0x56 */ {SCSI_SPC_RESERVE10 , "Reserve(10)"},/* obsolete in SBC2 and later */
1655 /* 0x57 */ {SCSI_SPC_RELEASE10 , "Release(10)"},/* obsolete in SBC2 and later */
1656 /* 0x5A */ {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"},
1657 /* 0x5E */ {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"},
1658 /* 0x5F */ {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"},
1659 /* 0x7F */ {SCSI_SBC_REBUILD32 , "Rebuild(32)"},
1660 #if 0 /* dups which would never have been found (in the previous unsorted version of this array) */
1661 /* 0x7F */ {SCSI_SBC_REGENERATE32 , "Regenerate(32)"},
1662 /* 0x7F */ {SCSI_SBC_XDREAD32 , "XdRead(32)"},
1663 /* 0x7F */ {SCSI_SBC_XDWRITE32 , "XdWrite(32)"},
1664 /* 0x7F */ {SCSI_SBC_XDWRITEEXTD32 , "XdWrite Extended(32)"},
1665 /* 0x7F */ {SCSI_SBC_XDWRITEREAD32 , "XdWriteRead(32)"},
1666 /* 0x7F */ {SCSI_SBC_XPWRITE32 , "XpWrite(32)"},
1667 #endif
1668 /* 0x80 */ {SCSI_SBC_XDWRITEEXTD16 , "XdWrite Extended(16)"},
1669 /* 0x81 */ {SCSI_SBC_REBUILD16 , "Rebuild(16)"},
1670 /* 0x82 */ {SCSI_SBC_REGENERATE16 , "Regenerate(16)"},
1671 /* 0x83 */ {SCSI_SPC_EXTCOPY , "Extended Copy"},
1672 /* 0x84 */ {SCSI_SPC_RECVCOPY , "Receive Copy"},
1673 /* 0x88 */ {SCSI_SBC_READ16 , "Read(16)"},
1674 /* 0x89 */ {SCSI_SBC_COMPARENWRITE , "Compare & Write(16)"},
1675 /* 0x8A */ {SCSI_SBC_WRITE16 , "Write(16)"},
1676 /* 0x8B */ {SCSI_SBC_ORWRITE , "OrWrite(16)"},
1677 /* 0x8E */ {SCSI_SBC_WRITENVERIFY16 , "Write & Verify(16)"},
1678 /* 0x8F */ {SCSI_SBC_VERIFY16 , "Verify(16)"},
1679 /* 0x90 */ {SCSI_SBC_PREFETCH16 , "Pre-Fetch(16)"},
1680 /* 0x91 */ {SCSI_SBC_SYNCCACHE16 , "Synchronize Cache(16)"},
1681 /* 0x92 */ {SCSI_SBC_LOCKUNLKCACHE16 , "Lock Unlock Cache(16)"},
1682 /* 0x93 */ {SCSI_SBC_WRITESAME16 , "Write Same(16)"},
1683 /* 0x9C */ {SCSI_SBC_WRITEATOMIC16 , "Write Atomic(16)"},
1684 /* 0x9E */ {SCSI_SBC_SERVICEACTIONIN16 , "Service Action In(16)"},
1685 /* 0x9F */ {SCSI_SBC_SERVICEACTIONOUT16, "Service Action Out(16)"},
1686 /* 0xA0 */ {SCSI_SPC_REPORTLUNS , "Report LUNs"},
1687 /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
1688 /* 0xA8 */ {SCSI_SBC_READ12 , "Read(12)"},
1689 /* 0xAA */ {SCSI_SBC_WRITE12 , "Write(12)"},
1690 /* 0xAE */ {SCSI_SBC_WRITENVERIFY12 , "Write & Verify(12)"},
1691 /* 0xAF */ {SCSI_SBC_VERIFY12 , "Verify(12)"},
1692 /* 0xB3 */ {SCSI_SBC_SETLIMITS12 , "Set Limits(12)"},
1693 /* 0xB7 */ {SCSI_SBC_READDEFDATA12 , "Read Defect Data(12)"},
1694 {0, NULL}
1696 value_string_ext scsi_sbc_vals_ext = VALUE_STRING_EXT_INIT(scsi_sbc_vals);
1698 const scsi_cdb_table_t scsi_sbc_table[256] = {
1699 /*SPC 0x00*/{dissect_spc_testunitready},
1700 /*SBC 0x01*/{NULL},
1701 /*SBC 0x02*/{NULL},
1702 /*SPC 0x03*/{dissect_spc_requestsense},
1703 /*SBC 0x04*/{dissect_sbc_formatunit},
1704 /*SBC 0x05*/{NULL},
1705 /*SBC 0x06*/{NULL},
1706 /*SBC 0x07*/{dissect_sbc_reassignblocks},
1707 /*SBC 0x08*/{dissect_sbc_read6},
1708 /*SBC 0x09*/{NULL},
1709 /*SBC 0x0a*/{dissect_sbc_write6},
1710 /*SBC 0x0b*/{NULL},
1711 /*SBC 0x0c*/{NULL},
1712 /*SBC 0x0d*/{NULL},
1713 /*SBC 0x0e*/{NULL},
1714 /*SBC 0x0f*/{NULL},
1715 /*SBC 0x10*/{NULL},
1716 /*SBC 0x11*/{NULL},
1717 /*SPC 0x12*/{dissect_spc_inquiry},
1718 /*SBC 0x13*/{NULL},
1719 /*SBC 0x14*/{NULL},
1720 /*SPC 0x15*/{dissect_spc_modeselect6},
1721 /*SBC 0x16*/{dissect_spc_reserve6}, /* obsolete in SBC2 and later */
1722 /*SBC 0x17*/{dissect_spc_release6}, /* obsolete in SBC2 and later */
1723 /*SBC 0x18*/{NULL},
1724 /*SBC 0x19*/{NULL},
1725 /*SPC 0x1a*/{dissect_spc_modesense6},
1726 /*SBC 0x1b*/{dissect_sbc_startstopunit},
1727 /*SBC 0x1c*/{NULL},
1728 /*SPC 0x1d*/{dissect_spc_senddiagnostic},
1729 /*SBC 0x1e*/{dissect_spc_preventallowmediaremoval},
1730 /*SBC 0x1f*/{NULL},
1731 /*SBC 0x20*/{NULL},
1732 /*SBC 0x21*/{NULL},
1733 /*SBC 0x22*/{NULL},
1734 /*SBC 0x23*/{NULL},
1735 /*SBC 0x24*/{NULL},
1736 /*SBC 0x25*/{dissect_sbc_readcapacity10},
1737 /*SBC 0x26*/{NULL},
1738 /*SBC 0x27*/{NULL},
1739 /*SBC 0x28*/{dissect_sbc_read10},
1740 /*SBC 0x29*/{NULL},
1741 /*SBC 0x2a*/{dissect_sbc_write10},
1742 /*SBC 0x2b*/{NULL},
1743 /*SBC 0x2c*/{NULL},
1744 /*SBC 0x2d*/{NULL},
1745 /*SBC 0x2e*/{dissect_sbc_wrverify10},
1746 /*SBC 0x2f*/{dissect_sbc_verify10},
1747 /*SBC 0x30*/{NULL},
1748 /*SBC 0x31*/{NULL},
1749 /*SBC 0x32*/{NULL},
1750 /*SBC 0x33*/{NULL},
1751 /*SBC 0x34*/{dissect_sbc_prefetch10},
1752 /*SBC 0x35*/{dissect_sbc_synchronizecache10},
1753 /*SBC 0x36*/{NULL},
1754 /*SBC 0x37*/{dissect_sbc_readdefectdata10},
1755 /*SBC 0x38*/{NULL},
1756 /*SBC 0x39*/{NULL},
1757 /*SBC 0x3a*/{NULL},
1758 /*SPC 0x3b*/{dissect_spc_writebuffer},
1759 /*SBC 0x3c*/{NULL},
1760 /*SBC 0x3d*/{NULL},
1761 /*SBC 0x3e*/{dissect_sbc_readlong10},
1762 /*SBC 0x3f*/{dissect_sbc_writelong10},
1763 /*SBC 0x40*/{NULL},
1764 /*SBC 0x41*/{dissect_sbc_writesame10},
1765 /*SBC 0x42*/{dissect_sbc_unmap},
1766 /*SBC 0x43*/{NULL},
1767 /*SBC 0x44*/{NULL},
1768 /*SBC 0x45*/{NULL},
1769 /*SBC 0x46*/{NULL},
1770 /*SBC 0x47*/{NULL},
1771 /*SBC 0x48*/{dissect_sbc_sanitize},
1772 /*SBC 0x49*/{NULL},
1773 /*SBC 0x4a*/{NULL},
1774 /*SBC 0x4b*/{NULL},
1775 /*SPC 0x4c*/{dissect_spc_logselect},
1776 /*SPC 0x4d*/{dissect_spc_logsense},
1777 /*SBC 0x4e*/{NULL},
1778 /*SBC 0x4f*/{NULL},
1779 /*SBC 0x50*/{dissect_sbc_xdwrite10},
1780 /*SBC 0x51*/{dissect_sbc_xpwrite10},
1781 /*SBC 0x52*/{dissect_sbc_xdread10},
1782 /*SBC 0x53*/{dissect_sbc_xdwriteread10},
1783 /*SBC 0x54*/{NULL},
1784 /*SPC 0x55*/{dissect_spc_modeselect10},
1785 /*SPC 0x56*/{dissect_spc_reserve10},/* obsolete in SBC2 and later */
1786 /*SPC 0x57*/{dissect_spc_release10},/* obsolete in SBC2 and later */
1787 /*SBC 0x58*/{NULL},
1788 /*SBC 0x59*/{NULL},
1789 /*SPC 0x5a*/{dissect_spc_modesense10},
1790 /*SBC 0x5b*/{NULL},
1791 /*SBC 0x5c*/{NULL},
1792 /*SBC 0x5d*/{NULL},
1793 /*SPC 0x5e*/{dissect_spc_persistentreservein},
1794 /*SPC 0x5f*/{dissect_spc_persistentreserveout},
1795 /*SBC 0x60*/{NULL},
1796 /*SBC 0x61*/{NULL},
1797 /*SBC 0x62*/{NULL},
1798 /*SBC 0x63*/{NULL},
1799 /*SBC 0x64*/{NULL},
1800 /*SBC 0x65*/{NULL},
1801 /*SBC 0x66*/{NULL},
1802 /*SBC 0x67*/{NULL},
1803 /*SBC 0x68*/{NULL},
1804 /*SBC 0x69*/{NULL},
1805 /*SBC 0x6a*/{NULL},
1806 /*SBC 0x6b*/{NULL},
1807 /*SBC 0x6c*/{NULL},
1808 /*SBC 0x6d*/{NULL},
1809 /*SBC 0x6e*/{NULL},
1810 /*SBC 0x6f*/{NULL},
1811 /*SBC 0x70*/{NULL},
1812 /*SBC 0x71*/{NULL},
1813 /*SBC 0x72*/{NULL},
1814 /*SBC 0x73*/{NULL},
1815 /*SBC 0x74*/{NULL},
1816 /*SBC 0x75*/{NULL},
1817 /*SBC 0x76*/{NULL},
1818 /*SBC 0x77*/{NULL},
1819 /*SBC 0x78*/{NULL},
1820 /*SBC 0x79*/{NULL},
1821 /*SBC 0x7a*/{NULL},
1822 /*SBC 0x7b*/{NULL},
1823 /*SBC 0x7c*/{NULL},
1824 /*SBC 0x7d*/{NULL},
1825 /*SBC 0x7e*/{NULL},
1826 /*SBC 0x7f*/{NULL},
1827 /*SBC 0x80*/{NULL},
1828 /*SBC 0x81*/{NULL},
1829 /*SBC 0x82*/{NULL},
1830 /*SPC 0x83*/{dissect_spc_extcopy},
1831 /*SBC 0x84*/{dissect_spc_recvcopy},
1832 /*SBC 0x85*/{NULL},
1833 /*SBC 0x86*/{NULL},
1834 /*SBC 0x87*/{NULL},
1835 /*SBC 0x88*/{dissect_sbc_read16},
1836 /*SBC 0x89*/{dissect_sbc_comparenwrite},
1837 /*SBC 0x8a*/{dissect_sbc_write16},
1838 /*SBC 0x8b*/{dissect_sbc_orwrite},
1839 /*SBC 0x8c*/{NULL},
1840 /*SBC 0x8d*/{NULL},
1841 /*SBC 0x8e*/{dissect_sbc_wrverify16},
1842 /*SBC 0x8f*/{dissect_sbc_verify16},
1843 /*SBC 0x90*/{dissect_sbc_prefetch16},
1844 /*SBC 0x91*/{dissect_sbc_synchronizecache16},
1845 /*SBC 0x92*/{NULL},
1846 /*SBC 0x93*/{dissect_sbc_writesame16},
1847 /*SBC 0x94*/{NULL},
1848 /*SBC 0x95*/{NULL},
1849 /*SBC 0x96*/{NULL},
1850 /*SBC 0x97*/{NULL},
1851 /*SBC 0x98*/{NULL},
1852 /*SBC 0x99*/{NULL},
1853 /*SBC 0x9a*/{NULL},
1854 /*SBC 0x9b*/{NULL},
1855 /*SBC 0x9c*/{dissect_sbc_writeatomic16},
1856 /*SBC 0x9d*/{NULL},
1857 /*SBC 0x9e*/{dissect_sbc_serviceactionin16},
1858 /*SBC 0x9f*/{dissect_sbc_serviceactionout16},
1859 /*SPC 0xa0*/{dissect_spc_reportluns},
1860 /*SBC 0xa1*/{NULL},
1861 /*SBC 0xa2*/{NULL},
1862 /*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
1863 /*SBC 0xa4*/{NULL},
1864 /*SBC 0xa5*/{NULL},
1865 /*SBC 0xa6*/{NULL},
1866 /*SBC 0xa7*/{NULL},
1867 /*SBC 0xa8*/{dissect_sbc_read12},
1868 /*SBC 0xa9*/{NULL},
1869 /*SBC 0xaa*/{dissect_sbc_write12},
1870 /*SBC 0xab*/{NULL},
1871 /*SBC 0xac*/{NULL},
1872 /*SBC 0xad*/{NULL},
1873 /*SBC 0xae*/{dissect_sbc_wrverify12},
1874 /*SBC 0xaf*/{dissect_sbc_verify12},
1875 /*SBC 0xb0*/{NULL},
1876 /*SBC 0xb1*/{NULL},
1877 /*SBC 0xb2*/{NULL},
1878 /*SBC 0xb3*/{NULL},
1879 /*SBC 0xb4*/{NULL},
1880 /*SBC 0xb5*/{NULL},
1881 /*SBC 0xb6*/{NULL},
1882 /*SBC 0xb7*/{dissect_sbc_readdefectdata12},
1883 /*SBC 0xb8*/{NULL},
1884 /*SBC 0xb9*/{NULL},
1885 /*SBC 0xba*/{NULL},
1886 /*SBC 0xbb*/{NULL},
1887 /*SBC 0xbc*/{NULL},
1888 /*SBC 0xbd*/{NULL},
1889 /*SBC 0xbe*/{NULL},
1890 /*SBC 0xbf*/{NULL},
1891 /*SBC 0xc0*/{NULL},
1892 /*SBC 0xc1*/{NULL},
1893 /*SBC 0xc2*/{NULL},
1894 /*SBC 0xc3*/{NULL},
1895 /*SBC 0xc4*/{NULL},
1896 /*SBC 0xc5*/{NULL},
1897 /*SBC 0xc6*/{NULL},
1898 /*SBC 0xc7*/{NULL},
1899 /*SBC 0xc8*/{NULL},
1900 /*SBC 0xc9*/{NULL},
1901 /*SBC 0xca*/{NULL},
1902 /*SBC 0xcb*/{NULL},
1903 /*SBC 0xcc*/{NULL},
1904 /*SBC 0xcd*/{NULL},
1905 /*SBC 0xce*/{NULL},
1906 /*SBC 0xcf*/{NULL},
1907 /*SBC 0xd0*/{NULL},
1908 /*SBC 0xd1*/{NULL},
1909 /*SBC 0xd2*/{NULL},
1910 /*SBC 0xd3*/{NULL},
1911 /*SBC 0xd4*/{NULL},
1912 /*SBC 0xd5*/{NULL},
1913 /*SBC 0xd6*/{NULL},
1914 /*SBC 0xd7*/{NULL},
1915 /*SBC 0xd8*/{NULL},
1916 /*SBC 0xd9*/{NULL},
1917 /*SBC 0xda*/{NULL},
1918 /*SBC 0xdb*/{NULL},
1919 /*SBC 0xdc*/{NULL},
1920 /*SBC 0xdd*/{NULL},
1921 /*SBC 0xde*/{NULL},
1922 /*SBC 0xdf*/{NULL},
1923 /*SBC 0xe0*/{NULL},
1924 /*SBC 0xe1*/{NULL},
1925 /*SBC 0xe2*/{NULL},
1926 /*SBC 0xe3*/{NULL},
1927 /*SBC 0xe4*/{NULL},
1928 /*SBC 0xe5*/{NULL},
1929 /*SBC 0xe6*/{NULL},
1930 /*SBC 0xe7*/{NULL},
1931 /*SBC 0xe8*/{NULL},
1932 /*SBC 0xe9*/{NULL},
1933 /*SBC 0xea*/{NULL},
1934 /*SBC 0xeb*/{NULL},
1935 /*SBC 0xec*/{NULL},
1936 /*SBC 0xed*/{NULL},
1937 /*SBC 0xee*/{NULL},
1938 /*SBC 0xef*/{NULL},
1939 /*SBC 0xf0*/{NULL},
1940 /*SBC 0xf1*/{NULL},
1941 /*SBC 0xf2*/{NULL},
1942 /*SBC 0xf3*/{NULL},
1943 /*SBC 0xf4*/{NULL},
1944 /*SBC 0xf5*/{NULL},
1945 /*SBC 0xf6*/{NULL},
1946 /*SBC 0xf7*/{NULL},
1947 /*SBC 0xf8*/{NULL},
1948 /*SBC 0xf9*/{NULL},
1949 /*SBC 0xfa*/{NULL},
1950 /*SBC 0xfb*/{NULL},
1951 /*SBC 0xfc*/{NULL},
1952 /*SBC 0xfd*/{NULL},
1953 /*SBC 0xfe*/{NULL},
1954 /*SBC 0xff*/{NULL}
1958 void
1959 proto_register_scsi_sbc(void)
1961 static hf_register_info hf[] = {
1962 { &hf_scsi_sbc_opcode,
1963 {"SBC Opcode", "scsi_sbc.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
1964 &scsi_sbc_vals_ext, 0x0, NULL, HFILL}},
1965 { &hf_scsi_sbc_service_action,
1966 {"Service Action", "scsi_sbc.sa", FT_UINT8, BASE_HEX,
1967 VALS(service_action_vals), 0x1F, "Unknown", HFILL}},
1968 { &hf_scsi_sbc_formatunit_flags,
1969 {"Flags", "scsi_sbc.formatunit.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
1970 NULL, HFILL}},
1971 // TODO: need multiple fields, as appears in different positions in fields lists!
1972 { &hf_scsi_sbc_defect_list_format,
1973 {"Defect List Format", "scsi_sbc.defect_list_format", FT_UINT8, BASE_DEC,
1974 NULL, 0x07, NULL, HFILL}},
1975 { &hf_scsi_sbc_formatunit_vendor,
1976 {"Vendor Unique", "scsi_sbc.formatunit.vendor", FT_UINT8, BASE_HEX, NULL,
1977 0x0, NULL, HFILL}},
1978 { &hf_scsi_sbc_formatunit_interleave,
1979 {"Interleave", "scsi_sbc.formatunit.interleave", FT_UINT16, BASE_HEX,
1980 NULL, 0x0, NULL, HFILL}},
1981 { &hf_scsi_sbc_rdwr6_lba,
1982 {"Logical Block Address (LBA)", "scsi_sbc.rdwr6.lba", FT_UINT24, BASE_HEX_DEC,
1983 NULL, 0x0FFFFF, NULL, HFILL}},
1984 { &hf_scsi_sbc_rdwr6_xferlen,
1985 {"Transfer Length", "scsi_sbc.rdwr6.xferlen", FT_UINT24, BASE_DEC, NULL, 0x0,
1986 NULL, HFILL}},
1987 { &hf_scsi_sbc_rdwr10_lba,
1988 {"Logical Block Address (LBA)", "scsi_sbc.rdwr10.lba", FT_UINT32, BASE_HEX_DEC,
1989 NULL, 0x0, NULL, HFILL}},
1990 { &hf_scsi_sbc_rdwr10_xferlen,
1991 {"Transfer Length", "scsi_sbc.rdwr10.xferlen", FT_UINT16, BASE_DEC, NULL,
1992 0x0, NULL, HFILL}},
1993 { &hf_scsi_sbc_rdwr12_xferlen,
1994 {"Transfer Length", "scsi_sbc.rdwr12.xferlen", FT_UINT32, BASE_DEC, NULL,
1995 0x0, NULL, HFILL}},
1996 { &hf_scsi_sbc_rdwr16_lba,
1997 {"Logical Block Address (LBA)", "scsi_sbc.rdwr16.lba", FT_BYTES, BASE_NONE,
1998 NULL, 0x0, NULL, HFILL}},
1999 { &hf_scsi_sbc_ssu_immed,
2000 {"Immediate", "scsi_sbc.ssu.immediate", FT_BOOLEAN, 8, NULL,
2001 0x01, NULL, HFILL}},
2002 { &hf_scsi_sbc_ssu_pwr_cond,
2003 {"Power Conditions", "scsi_sbc.ssu.pwr", FT_UINT8, BASE_HEX,
2004 VALS (scsi_ssu_pwrcnd_val), 0xF0, NULL, HFILL}},
2005 { &hf_scsi_sbc_ssu_loej,
2006 {"LOEJ", "scsi_sbc.ssu.loej", FT_BOOLEAN, 8, NULL, 0x2, NULL,
2007 HFILL}},
2008 { &hf_scsi_sbc_ssu_start,
2009 {"Start", "scsi_sbc.ssu.start", FT_BOOLEAN, 8, NULL, 0x1,
2010 NULL, HFILL}},
2011 { &hf_scsi_sbc_bytchk,
2012 {"BYTCHK", "scsi_sbc.bytchk", FT_BOOLEAN, 8,
2013 NULL, 0x02, NULL, HFILL}},
2014 #if 0
2015 { &hf_scsi_sbc_verify_reladdr,
2016 {"RELADDR", "scsi_sbc.verify.reladdr", FT_BOOLEAN, 8, NULL,
2017 0x1, NULL, HFILL}},
2018 #endif
2019 { &hf_scsi_sbc_verify_lba,
2020 {"LBA", "scsi_sbc.verify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
2021 HFILL}},
2022 { &hf_scsi_sbc_verify_lba64,
2023 {"LBA", "scsi_sbc.verify.lba64", FT_UINT64, BASE_DEC, NULL, 0x0, NULL,
2024 HFILL}},
2025 { &hf_scsi_sbc_verify_vlen,
2026 {"Verification Length", "scsi_sbc.verify.vlen", FT_UINT16,
2027 BASE_DEC, NULL, 0x0, NULL, HFILL}},
2028 { &hf_scsi_sbc_verify_vlen32,
2029 {"Verification Length", "scsi_sbc.verify.vlen32", FT_UINT32,
2030 BASE_DEC, NULL, 0x0, NULL, HFILL}},
2031 { &hf_scsi_sbc_wrverify_lba,
2032 {"LBA", "scsi_sbc.wrverify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
2033 HFILL}},
2034 { &hf_scsi_sbc_wrverify_xferlen,
2035 {"Transfer Length", "scsi_sbc.wrverify.xferlen", FT_UINT16, BASE_DEC,
2036 NULL, 0x0, NULL, HFILL}},
2037 { &hf_scsi_sbc_wrverify_lba64,
2038 {"LBA", "scsi_sbc.wrverify.lba64", FT_UINT64, BASE_DEC, NULL, 0x0,
2039 NULL, HFILL}},
2040 { &hf_scsi_sbc_wrverify_xferlen32,
2041 {"Transfer Length", "scsi_sbc.wrverify.xferlen32", FT_UINT32,
2042 BASE_DEC, NULL, 0x0, NULL, HFILL}},
2043 #if 0
2044 { &hf_scsi_sbc_readcapacity_flags,
2045 {"Flags", "scsi_sbc.readcapacity.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
2046 NULL, HFILL}},
2047 #endif
2048 { &hf_scsi_sbc_readdefdata_flags,
2049 {"Flags", "scsi_sbc.readdefdata.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2050 HFILL}},
2051 { &hf_scsi_sbc_reassignblks_flags,
2052 {"Flags", "scsi_sbc.reassignblks.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2053 HFILL}},
2054 { &hf_scsi_sbc_read_flags,
2055 {"Flags", "scsi_sbc.read.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2056 HFILL}},
2057 { &hf_scsi_sbc_alloclen32,
2058 {"Allocation Length", "scsi_sbc.alloclen32", FT_UINT32, BASE_DEC,
2059 NULL, 0x0, NULL, HFILL}},
2060 { &hf_scsi_sbc_alloclen16,
2061 {"Allocation Length", "scsi_sbc.alloclen16", FT_UINT16, BASE_DEC,
2062 NULL, 0x0, NULL, HFILL}},
2063 { &hf_scsi_sbc_lba64_address,
2064 {"Logical Block Address", "scsi_sbc.lba64_add", FT_UINT64, BASE_HEX_DEC,
2065 NULL, 0x0, NULL, HFILL}},
2066 { &hf_scsi_sbc_fuflags_fmtpinfo,
2067 {"FMTPINFO", "scsi_sbc.format_unit.fmtpinfo", FT_BOOLEAN, 8,
2068 NULL, 0x80, NULL, HFILL}},
2069 { &hf_scsi_sbc_fuflags_rto_req,
2070 {"RTO_REQ", "scsi_sbc.format_unit.rto_req", FT_BOOLEAN, 8,
2071 NULL, 0x40, NULL, HFILL}},
2072 { &hf_scsi_sbc_fuflags_longlist,
2073 {"LONGLIST", "scsi_sbc.format_unit.longlist", FT_BOOLEAN, 8,
2074 NULL, 0x20, NULL, HFILL}},
2075 { &hf_scsi_sbc_fuflags_fmtdata,
2076 {"FMTDATA", "scsi_sbc.format_unit.fmtdata", FT_BOOLEAN, 8,
2077 NULL, 0x10, NULL, HFILL}},
2078 { &hf_scsi_sbc_fuflags_cmplist,
2079 {"CMPLIST", "scsi_sbc.format_unit.cmplist", FT_BOOLEAN, 8,
2080 NULL, 0x08, NULL, HFILL}},
2081 { &hf_scsi_sbc_prefetch_flags,
2082 {"Flags", "scsi_sbc.prefetch.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2083 HFILL}},
2084 { &hf_scsi_sbc_prefetch_immed,
2085 {"Immediate", "scsi_sbc.prefetch.immediate", FT_BOOLEAN, 8, NULL,
2086 0x2, NULL, HFILL}},
2087 { &hf_scsi_sbc_group,
2088 {"Group", "scsi_sbc.group", FT_UINT8, BASE_HEX, NULL,
2089 0x1f, NULL, HFILL}},
2090 { &hf_scsi_sbc_rdprotect,
2091 {"RDPROTECT", "scsi_sbc.rdprotect", FT_UINT8, BASE_HEX,
2092 NULL, 0xe0, NULL, HFILL}},
2093 { &hf_scsi_sbc_dpo,
2094 {"DPO", "scsi_sbc.dpo", FT_BOOLEAN, 8,
2095 TFS(&dpo_tfs), 0x10, "DisablePageOut: Whether the device should cache the data or not", HFILL}},
2096 { &hf_scsi_sbc_fua,
2097 {"FUA", "scsi_sbc.fua", FT_BOOLEAN, 8,
2098 TFS(&fua_tfs), 0x08, "ForceUnitAccess: Whether to allow reading from the cache or not", HFILL}},
2099 { &hf_scsi_sbc_fua_nv,
2100 {"FUA_NV", "scsi_sbc.fua_nv", FT_BOOLEAN, 8,
2101 TFS(&fua_nv_tfs), 0x02, "ForceUnitAccess_NonVolatile: Whether to allow reading from non-volatile cache or not", HFILL}},
2102 { &hf_scsi_sbc_blocksize,
2103 {"Block size in bytes", "scsi_sbc.blocksize", FT_UINT32, BASE_DEC,
2104 NULL, 0, NULL, HFILL}},
2105 { &hf_scsi_sbc_returned_lba,
2106 {"Returned LBA", "scsi_sbc.returned_lba", FT_UINT32, BASE_DEC,
2107 NULL, 0, NULL, HFILL}},
2108 { &hf_scsi_sbc_read_capacity,
2109 {"Read capacity", "scsi_sbc.read_capacity", FT_DOUBLE, BASE_DEC,
2110 NULL,0,NULL, HFILL}},
2111 { &hf_scsi_sbc_req_plist,
2112 {"REQ_PLIST", "scsi_sbc.req_plist", FT_BOOLEAN, 8,
2113 NULL, 0x10, NULL, HFILL}},
2114 { &hf_scsi_sbc_req_glist,
2115 {"REQ_GLIST", "scsi_sbc.req_glist", FT_BOOLEAN, 8,
2116 NULL, 0x08, NULL, HFILL}},
2117 { &hf_scsi_sbc_corrct,
2118 {"CORRCT", "scsi_sbc.corrct", FT_BOOLEAN, 8,
2119 NULL, 0x02, NULL, HFILL}},
2120 { &hf_scsi_sbc_corrct_flags,
2121 {"Flags", "scsi_sbc.corrct_flags", FT_UINT8, BASE_HEX,
2122 NULL, 0, NULL, HFILL}},
2123 { &hf_scsi_sbc_reassignblocks_longlba,
2124 {"LongLBA", "scsi_sbc.reassignblocks.longlba", FT_BOOLEAN, 8,
2125 NULL, 0x02, NULL, HFILL}},
2126 { &hf_scsi_sbc_reassignblocks_longlist,
2127 {"LongList", "scsi_sbc.reassignblocks.longlist", FT_BOOLEAN, 8,
2128 NULL, 0x01, NULL, HFILL}},
2129 { &hf_scsi_sbc_ssu_immed_flags,
2130 {"Immed flags", "scsi_sbc.ssu.immed_flags", FT_UINT8, BASE_HEX,
2131 NULL, 0, NULL, HFILL}},
2132 { &hf_scsi_sbc_ssu_pwr_flags,
2133 {"Pwr flags", "scsi_sbc.ssu.pwr_flags", FT_UINT8, BASE_HEX,
2134 NULL, 0, NULL, HFILL}},
2135 { &hf_scsi_sbc_synccache_flags,
2136 {"Flags", "scsi_sbc.synccache.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2137 HFILL}},
2138 { &hf_scsi_sbc_synccache_immed,
2139 {"Immediate", "scsi_sbc.synccache.immediate", FT_BOOLEAN, 8, NULL,
2140 0x02, NULL, HFILL}},
2141 { &hf_scsi_sbc_synccache_sync_nv,
2142 {"SYNC_NV", "scsi_sbc.synccache.sync_nv", FT_BOOLEAN, 8, NULL,
2143 0x04, NULL, HFILL}},
2144 { &hf_scsi_sbc_vrprotect,
2145 {"VRPROTECT", "scsi_sbc.vrprotect", FT_UINT8, BASE_HEX,
2146 NULL, 0xe0, NULL, HFILL}},
2147 { &hf_scsi_sbc_verify_flags,
2148 {"Flags", "scsi_sbc.verify_flags", FT_UINT8, BASE_HEX,
2149 NULL, 0, NULL, HFILL}},
2150 { &hf_scsi_sbc_wrprotect,
2151 {"WRPROTECT", "scsi_sbc.wrprotect", FT_UINT8, BASE_HEX,
2152 NULL, 0xe0, NULL, HFILL}},
2153 { &hf_scsi_sbc_wrverify_flags,
2154 {"Flags", "scsi_sbc.wrverify_flags", FT_UINT8, BASE_HEX,
2155 NULL, 0, NULL, HFILL}},
2156 { &hf_scsi_sbc_writesame_flags,
2157 {"Flags", "scsi_sbc.writesame_flags", FT_UINT8, BASE_HEX,
2158 NULL, 0, NULL, HFILL}},
2159 { &hf_scsi_sbc_anchor,
2160 {"ANCHOR", "scsi_sbc.anchor", FT_BOOLEAN, 8, NULL,
2161 0x10, NULL, HFILL}},
2162 { &hf_scsi_sbc_unmap,
2163 {"UNMAP", "scsi_sbc.unmap", FT_BOOLEAN, 8, NULL,
2164 0x08, NULL, HFILL}},
2165 { &hf_scsi_sbc_pbdata,
2166 {"PBDATA", "scsi_sbc.pbdata", FT_BOOLEAN, 8, NULL,
2167 0x04, NULL, HFILL}},
2168 { &hf_scsi_sbc_lbdata,
2169 {"LBDATA", "scsi_sbc.lbdata", FT_BOOLEAN, 8, NULL,
2170 0x02, NULL, HFILL}},
2171 { &hf_scsi_sbc_xdread_flags,
2172 {"Flags", "scsi_sbc.xdread.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2173 HFILL}},
2174 { &hf_scsi_sbc_xorpinfo,
2175 {"XORPINFO", "scsi_sbc.xorpinfo", FT_BOOLEAN, 8, NULL,
2176 0x01, NULL, HFILL}},
2177 { &hf_scsi_sbc_disable_write,
2178 {"DISABLE_WRITE", "scsi_sbc.disable_write", FT_BOOLEAN, 8, NULL,
2179 0x04, NULL, HFILL}},
2180 { &hf_scsi_sbc_xdwrite_flags,
2181 {"Flags", "scsi_sbc.xdwrite.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2182 HFILL}},
2183 { &hf_scsi_sbc_xdwriteread_flags,
2184 {"Flags", "scsi_sbc.xdwriteread.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2185 HFILL}},
2186 { &hf_scsi_sbc_xpwrite_flags,
2187 {"Flags", "scsi_sbc.xpwrite.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2188 HFILL}},
2189 { &hf_scsi_sbc_unmap_anchor,
2190 {"ANCHOR", "scsi_sbc.unmap.anchor", FT_BOOLEAN, 8, NULL,
2191 0x01, NULL, HFILL}},
2192 { &hf_scsi_sbc_unmap_flags,
2193 {"Flags", "scsi_sbc.unmap_flags", FT_UINT8, BASE_HEX,
2194 NULL, 0, NULL, HFILL}},
2195 { &hf_scsi_sbc_unmap_data_length,
2196 {"Data Length", "scsi_sbc.unmap.data_length", FT_UINT16, BASE_DEC,
2197 NULL, 0, NULL, HFILL}},
2198 { &hf_scsi_sbc_unmap_block_descriptor_data_length,
2199 {"Block Descriptor Data Length", "scsi_sbc.unmap.block_descriptor_data_length", FT_UINT16, BASE_DEC,
2200 NULL, 0, NULL, HFILL}},
2201 { &hf_scsi_sbc_unmap_lba,
2202 {"LBA", "scsi_sbc.unmap.lba", FT_UINT64, BASE_DEC,
2203 NULL, 0, NULL, HFILL}},
2204 { &hf_scsi_sbc_unmap_num_blocks,
2205 {"Num Blocks", "scsi_sbc.unmap.num_blocks", FT_UINT32, BASE_DEC,
2206 NULL, 0, NULL, HFILL}},
2207 { &hf_scsi_sbc_ptype,
2208 {"PTYPE", "scsi_sbc.ptype", FT_UINT8, BASE_DEC,
2209 VALS(scsi_ptype_val), 0x0e, NULL, HFILL}},
2210 { &hf_scsi_sbc_prot_en,
2211 {"PROT_EN", "scsi_sbc.prot_en", FT_BOOLEAN, 8,
2212 NULL, 0x01, NULL, HFILL}},
2213 { &hf_scsi_sbc_p_i_exponent,
2214 {"P_I_EXPONENT", "scsi_sbc.p_i_exponent", FT_UINT8, BASE_DEC,
2215 NULL, 0xf0, NULL, HFILL}},
2216 { &hf_scsi_sbc_lbppbe,
2217 {"LOGICAL_BLOCKS_PER_PHYSICAL_BLOCK_EXPONENT", "scsi_sbc.lbppbe", FT_UINT8, BASE_DEC,
2218 NULL, 0x0f, NULL, HFILL}},
2219 { &hf_scsi_sbc_lbpme,
2220 {"LBPME (logical block provisioning management enabled) / TPE", "scsi_sbc.lbpme", FT_BOOLEAN, 8,
2221 NULL, 0x80, NULL, HFILL}},
2222 { &hf_scsi_sbc_lbprz,
2223 {"LBPRZ (logical block provisioning read zeros) / TPRZ", "scsi_sbc.lbprz", FT_BOOLEAN, 8,
2224 NULL, 0x40, NULL, HFILL}},
2225 { &hf_scsi_sbc_lalba,
2226 {"LOWEST_ALIGNED_LBA", "scsi_sbc.lalba", FT_UINT16, BASE_DEC,
2227 NULL, 0x3fff, NULL, HFILL}},
2228 { &hf_scsi_sbc_get_lba_status_lba,
2229 {"LBA", "scsi_sbc.get_lba_status.start_lba", FT_UINT64, BASE_DEC,
2230 NULL, 0, NULL, HFILL}},
2231 { &hf_scsi_sbc_get_lba_status_data_length,
2232 {"Data Length", "scsi_sbc.get_lba_status.data_length", FT_UINT32, BASE_DEC,
2233 NULL, 0, NULL, HFILL}},
2234 { &hf_scsi_sbc_get_lba_status_num_blocks,
2235 {"Num Blocks", "scsi_sbc.get_lba_status.num_blocks", FT_UINT32, BASE_DEC,
2236 NULL, 0, NULL, HFILL}},
2237 { &hf_scsi_sbc_get_lba_status_provisioning_status,
2238 {"Provisioning Type", "scsi_sbc.get_lba_status.provisioning_type", FT_UINT8, BASE_DEC,
2239 VALS(scsi_provisioning_type_val), 0x07, NULL, HFILL}},
2240 { &hf_scsi_sbc_sanitize_sa,
2241 {"Service Action", "scsi_sbc.sanitize.sa", FT_UINT8, BASE_HEX,
2242 VALS(sanitize_val), 0x1f, NULL, HFILL}},
2243 { &hf_scsi_sbc_sanitize_ause,
2244 {"AUSE", "scsi_sbc.sanitize.ause", FT_BOOLEAN, 8, NULL,
2245 0x20, NULL, HFILL}},
2246 { &hf_scsi_sbc_sanitize_immed,
2247 {"IMMED", "scsi_sbc.sanitize.immed", FT_BOOLEAN, 8, NULL,
2248 0x80, NULL, HFILL}},
2249 { &hf_scsi_sbc_sanitize_flags,
2250 {"Flags", "scsi_sbc.sanitize_flags", FT_UINT8, BASE_HEX,
2251 NULL, 0, NULL, HFILL}},
2252 { &hf_scsi_sbc_sanitize_overwrite_flags,
2253 {"Flags", "scsi_sbc.sanitize_overwrite_flags", FT_UINT8, BASE_HEX,
2254 NULL, 0, NULL, HFILL}},
2255 { &hf_scsi_sbc_sanitize_invert,
2256 {"INVERT", "scsi_sbc.sanitize.invert", FT_BOOLEAN, 8, NULL,
2257 0x80, NULL, HFILL}},
2258 { &hf_scsi_sbc_sanitize_test,
2259 {"TEST", "scsi_sbc.sanitize.test", FT_UINT8, BASE_HEX, NULL,
2260 0x60, NULL, HFILL}},
2261 { &hf_scsi_sbc_sanitize_owcount,
2262 {"Overwrite Count", "scsi_sbc.sanitize.overwrite_count", FT_UINT8, BASE_DEC_HEX, NULL,
2263 0x1f, NULL, HFILL}},
2264 { &hf_scsi_sbc_sanitize_pattern_length,
2265 {"Initialization Pattern Length", "scsi_sbc.sanitize.pattern_length", FT_UINT16, BASE_DEC, NULL,
2266 0, NULL, HFILL}},
2267 { &hf_scsi_sbc_sanitize_pattern,
2268 {"Initialization Pattern", "scsi_sbc.sanitize.pattern", FT_BYTES, BASE_NONE, NULL,
2269 0, NULL, HFILL}},
2273 /* Setup protocol subtree array */
2274 static int *ett[] = {
2275 &ett_scsi_format_unit,
2276 &ett_scsi_prefetch,
2277 &ett_scsi_rdwr,
2278 &ett_scsi_xdread,
2279 &ett_scsi_xdwrite,
2280 &ett_scsi_xdwriteread,
2281 &ett_scsi_xpwrite,
2282 &ett_scsi_defectdata,
2283 &ett_scsi_corrct,
2284 &ett_scsi_reassign_blocks,
2285 &ett_scsi_ssu_immed,
2286 &ett_scsi_ssu_pwr,
2287 &ett_scsi_synccache,
2288 &ett_scsi_verify,
2289 &ett_scsi_wrverify,
2290 &ett_scsi_writesame,
2291 &ett_scsi_unmap,
2292 &ett_scsi_unmap_block_descriptor,
2293 &ett_scsi_lba_status_descriptor,
2294 &ett_scsi_sanitize,
2295 &ett_scsi_sanitize_overwrite
2298 /* Register the protocol name and description */
2299 proto_scsi_sbc = proto_register_protocol("SCSI_SBC", "SCSI_SBC", "scsi_sbc");
2301 /* Required function calls to register the header fields and subtrees used */
2302 proto_register_field_array(proto_scsi_sbc, hf, array_length(hf));
2303 proto_register_subtree_array(ett, array_length(ett));
2307 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2309 * Local variables:
2310 * c-basic-offset: 4
2311 * tab-width: 8
2312 * indent-tabs-mode: nil
2313 * End:
2315 * vi: set shiftwidth=4 tabstop=8 expandtab:
2316 * :indentSize=4:tabSize=8:noTabs=true: