HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-scsi-sbc.c
blob221cd057a5e24603c11bc97f163b742bc99ec4d5
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 * $Id$
20 * Wireshark - Network traffic analyzer
21 * By Gerald Combs <gerald@wireshark.org>
22 * Copyright 2002 Gerald Combs
24 * This program is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU General Public License
26 * as published by the Free Software Foundation; either version 2
27 * of the License, or (at your option) any later version.
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with this program; if not, write to the Free Software
36 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
39 #include "config.h"
41 #include <glib.h>
42 #include <epan/packet.h>
43 #include <epan/conversation.h>
44 #include <epan/tap.h>
45 #include "packet-scsi.h"
46 #include "packet-fc.h"
47 #include "packet-scsi-sbc.h"
50 static int proto_scsi_sbc = -1;
52 int hf_scsi_sbc_opcode= -1;
53 static int hf_scsi_sbc_formatunit_flags= -1;
54 static int hf_scsi_sbc_defect_list_format= -1;
55 static int hf_scsi_sbc_formatunit_vendor= -1;
56 static int hf_scsi_sbc_formatunit_interleave= -1;
57 static int hf_scsi_sbc_rdwr6_lba= -1;
58 static int hf_scsi_sbc_rdwr6_xferlen= -1;
59 static int hf_scsi_sbc_rdwr10_lba= -1;
60 static int hf_scsi_sbc_rdwr10_xferlen= -1;
61 static int hf_scsi_sbc_rdwr12_xferlen= -1;
62 static int hf_scsi_sbc_rdwr16_lba= -1;
63 static int hf_scsi_sbc_ssu_immed_flags= -1;
64 static int hf_scsi_sbc_ssu_immed= -1;
65 static int hf_scsi_sbc_ssu_pwr_flags= -1;
66 static int hf_scsi_sbc_ssu_pwr_cond= -1;
67 static int hf_scsi_sbc_ssu_loej= -1;
68 static int hf_scsi_sbc_ssu_start= -1;
69 static int hf_scsi_sbc_bytchk= -1;
70 /* static int hf_scsi_sbc_verify_reladdr= -1; */
71 static int hf_scsi_sbc_verify_lba= -1;
72 static int hf_scsi_sbc_verify_lba64= -1;
73 static int hf_scsi_sbc_verify_vlen= -1;
74 static int hf_scsi_sbc_verify_vlen32= -1;
75 static int hf_scsi_sbc_wrverify_lba= -1;
76 static int hf_scsi_sbc_wrverify_xferlen= -1;
77 static int hf_scsi_sbc_wrverify_lba64= -1;
78 static int hf_scsi_sbc_wrverify_xferlen32= -1;
79 /* static int hf_scsi_sbc_readcapacity_flags= -1; */
80 static int hf_scsi_sbc_readdefdata_flags= -1;
81 static int hf_scsi_sbc_reassignblks_flags= -1;
82 static int hf_scsi_sbc_read_flags= -1;
83 static int hf_scsi_sbc_alloclen32= -1;
84 static int hf_scsi_sbc_alloclen16= -1;
85 static int hf_scsi_sbc_fuflags_fmtpinfo= -1;
86 static int hf_scsi_sbc_fuflags_rto_req= -1;
87 static int hf_scsi_sbc_fuflags_longlist= -1;
88 static int hf_scsi_sbc_fuflags_fmtdata= -1;
89 static int hf_scsi_sbc_fuflags_cmplist= -1;
90 static int hf_scsi_sbc_prefetch_flags= -1;
91 static int hf_scsi_sbc_prefetch_immed= -1;
92 static int hf_scsi_sbc_group= -1;
93 static int hf_scsi_sbc_rdprotect= -1;
94 static int hf_scsi_sbc_dpo= -1;
95 static int hf_scsi_sbc_fua= -1;
96 static int hf_scsi_sbc_fua_nv= -1;
97 static int hf_scsi_sbc_blocksize= -1;
98 static int hf_scsi_sbc_returned_lba= -1;
99 static int hf_scsi_sbc_req_plist= -1;
100 static int hf_scsi_sbc_req_glist= -1;
101 static int hf_scsi_sbc_corrct_flags= -1;
102 static int hf_scsi_sbc_corrct= -1;
103 static int hf_scsi_sbc_reassignblocks_longlba= -1;
104 static int hf_scsi_sbc_reassignblocks_longlist= -1;
105 static int hf_scsi_sbc_synccache_flags= -1;
106 static int hf_scsi_sbc_synccache_immed= -1;
107 static int hf_scsi_sbc_synccache_sync_nv= -1;
108 static int hf_scsi_sbc_vrprotect= -1;
109 static int hf_scsi_sbc_verify_flags= -1;
110 static int hf_scsi_sbc_wrprotect= -1;
111 static int hf_scsi_sbc_wrverify_flags= -1;
112 static int hf_scsi_sbc_writesame_flags= -1;
113 static int hf_scsi_sbc_anchor= -1;
114 static int hf_scsi_sbc_unmap= -1;
115 static int hf_scsi_sbc_pbdata= -1;
116 static int hf_scsi_sbc_lbdata= -1;
117 static int hf_scsi_sbc_xdread_flags= -1;
118 static int hf_scsi_sbc_xorpinfo= -1;
119 static int hf_scsi_sbc_disable_write= -1;
120 static int hf_scsi_sbc_xdwrite_flags= -1;
121 static int hf_scsi_sbc_xdwriteread_flags= -1;
122 static int hf_scsi_sbc_xpwrite_flags= -1;
123 static int hf_scsi_sbc_unmap_flags= -1;
124 static int hf_scsi_sbc_unmap_anchor= -1;
125 static int hf_scsi_sbc_unmap_data_length= -1;
126 static int hf_scsi_sbc_unmap_block_descriptor_data_length= -1;
127 static int hf_scsi_sbc_unmap_lba= -1;
128 static int hf_scsi_sbc_unmap_num_blocks= -1;
129 static int hf_scsi_sbc_ptype= -1;
130 static int hf_scsi_sbc_prot_en= -1;
131 static int hf_scsi_sbc_p_i_exponent= -1;
132 static int hf_scsi_sbc_lbppbe= -1;
133 static int hf_scsi_sbc_lbpme= -1;
134 static int hf_scsi_sbc_lbprz= -1;
135 static int hf_scsi_sbc_lalba= -1;
136 static int hf_scsi_sbc_get_lba_status_lba= -1;
137 static int hf_scsi_sbc_get_lba_status_data_length= -1;
138 static int hf_scsi_sbc_get_lba_status_num_blocks= -1;
139 static int hf_scsi_sbc_get_lba_status_provisioning_status= -1;
140 static int hf_scsi_sbc_sanitize_flags= -1;
141 static int hf_scsi_sbc_sanitize_immed= -1;
142 static int hf_scsi_sbc_sanitize_ause= -1;
143 static int hf_scsi_sbc_sanitize_sa= -1;
144 static int hf_scsi_sbc_sanitize_overwrite_flags= -1;
145 static int hf_scsi_sbc_sanitize_invert= -1;
146 static int hf_scsi_sbc_sanitize_test= -1;
147 static int hf_scsi_sbc_sanitize_owcount= -1;
148 static int hf_scsi_sbc_sanitize_pattern_length= -1;
149 static int hf_scsi_sbc_sanitize_pattern= -1;
151 static gint ett_scsi_format_unit= -1;
152 static gint ett_scsi_prefetch= -1;
153 static gint ett_scsi_rdwr= -1;
154 static gint ett_scsi_xdread= -1;
155 static gint ett_scsi_xdwrite= -1;
156 static gint ett_scsi_xdwriteread= -1;
157 static gint ett_scsi_xpwrite= -1;
158 static gint ett_scsi_defectdata= -1;
159 static gint ett_scsi_corrct= -1;
160 static gint ett_scsi_reassign_blocks= -1;
161 static gint ett_scsi_ssu_immed= -1;
162 static gint ett_scsi_ssu_pwr= -1;
163 static gint ett_scsi_synccache= -1;
164 static gint ett_scsi_verify= -1;
165 static gint ett_scsi_wrverify= -1;
166 static gint ett_scsi_writesame= -1;
167 static gint ett_scsi_unmap= -1;
168 static gint ett_scsi_unmap_block_descriptor= -1;
169 static gint ett_scsi_lba_status_descriptor= -1;
170 static gint ett_scsi_sanitize= -1;
171 static gint ett_scsi_sanitize_overwrite= -1;
174 static const true_false_string dpo_tfs = {
175 "Disable Page Out (don't cache this data)",
176 "Disable page out is DISABLED (cache this data)"
178 static const true_false_string fua_tfs = {
179 "Read from the medium, not cache",
180 "Read from cache if possible"
182 static const true_false_string fua_nv_tfs = {
183 "Read from volatile cache is NOT permitted",
184 "Read from volatile or non-volatile cache permitted"
186 #if 0
187 static const true_false_string pmi_tfs = {
188 "PMI is SET",
189 "Pmi is CLEAR"
191 #endif
193 static void
194 dissect_sbc_formatunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
195 guint offset, gboolean isreq, gboolean iscdb,
196 guint payload_len _U_, scsi_task_data_t *cdata _U_)
198 static const int *fuflags_fields[] = {
199 &hf_scsi_sbc_fuflags_fmtpinfo,
200 &hf_scsi_sbc_fuflags_rto_req,
201 &hf_scsi_sbc_fuflags_longlist,
202 &hf_scsi_sbc_fuflags_fmtdata,
203 &hf_scsi_sbc_fuflags_cmplist,
204 &hf_scsi_sbc_defect_list_format,
205 NULL
208 if (!tree)
209 return;
211 if (isreq && iscdb) {
212 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_formatunit_flags,
213 ett_scsi_format_unit, fuflags_fields, ENC_BIG_ENDIAN);
214 proto_tree_add_item (tree, hf_scsi_sbc_formatunit_vendor, tvb, offset+1, 1, ENC_BIG_ENDIAN);
215 proto_tree_add_item (tree, hf_scsi_sbc_formatunit_interleave, tvb, offset+2, 2, ENC_BIG_ENDIAN);
216 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
217 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
219 /* TODO : add dissection of DATA */
222 static void
223 dissect_sbc_read6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
224 guint offset, gboolean isreq, gboolean iscdb,
225 guint payload_len _U_, scsi_task_data_t *cdata _U_)
227 if (isreq && iscdb) {
228 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)",
229 tvb_get_ntoh24 (tvb, offset),
230 tvb_get_guint8 (tvb, offset+3));
233 if (tree && isreq && iscdb) {
234 proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_lba, tvb, offset, 3, ENC_BIG_ENDIAN);
235 proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_xferlen, tvb, offset+3, 1, ENC_BIG_ENDIAN);
236 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
237 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
241 static void
242 dissect_sbc_write6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
243 guint offset, gboolean isreq, gboolean iscdb,
244 guint payload_len _U_, scsi_task_data_t *cdata _U_)
246 if (isreq && iscdb) {
247 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)",
248 tvb_get_ntoh24 (tvb, offset),
249 tvb_get_guint8 (tvb, offset+3));
252 if (tree && isreq && iscdb) {
253 proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_lba, tvb, offset, 3, ENC_BIG_ENDIAN);
254 proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_xferlen, tvb, offset+3, 1, ENC_BIG_ENDIAN);
255 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
256 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
260 static void
261 dissect_sbc_prefetch10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
262 guint offset, gboolean isreq, gboolean iscdb,
263 guint payload_len _U_, scsi_task_data_t *cdata _U_)
266 static const int *prefetch_fields[] = {
267 &hf_scsi_sbc_prefetch_immed,
268 NULL
271 if (isreq && iscdb) {
272 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
273 tvb_get_ntohl (tvb, offset+1),
274 tvb_get_ntohs (tvb, offset+6));
277 if (tree && isreq && iscdb) {
278 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_prefetch_flags,
279 ett_scsi_prefetch, prefetch_fields, ENC_BIG_ENDIAN);
280 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
281 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
282 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
283 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
284 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
288 static void
289 dissect_sbc_synchronizecache10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
290 guint offset, gboolean isreq, gboolean iscdb,
291 guint payload_len _U_, scsi_task_data_t *cdata _U_)
294 static const int *sync_fields[] = {
295 &hf_scsi_sbc_synccache_sync_nv,
296 &hf_scsi_sbc_synccache_immed,
297 NULL
300 if (isreq && iscdb) {
301 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
302 tvb_get_ntohl (tvb, offset+1),
303 tvb_get_ntohs (tvb, offset+6));
306 if (tree && isreq && iscdb) {
307 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_synccache_flags,
308 ett_scsi_synccache, sync_fields, ENC_BIG_ENDIAN);
309 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
310 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
311 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
312 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
313 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
317 static void
318 dissect_sbc_synchronizecache16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
319 guint offset, gboolean isreq, gboolean iscdb,
320 guint payload_len _U_, scsi_task_data_t *cdata _U_)
323 static const int *sync_fields[] = {
324 &hf_scsi_sbc_synccache_sync_nv,
325 &hf_scsi_sbc_synccache_immed,
326 NULL
329 if (isreq && iscdb) {
330 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
331 tvb_get_ntoh64 (tvb, offset+1),
332 tvb_get_ntohl (tvb, offset+9));
335 if (tree && isreq && iscdb) {
336 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_synccache_flags,
337 ett_scsi_synccache, sync_fields, ENC_BIG_ENDIAN);
338 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
339 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
340 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
341 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
342 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
346 static void
347 dissect_sbc_prefetch16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
348 guint offset, gboolean isreq, gboolean iscdb,
349 guint payload_len _U_, scsi_task_data_t *cdata _U_)
352 static const int *prefetch_fields[] = {
353 &hf_scsi_sbc_prefetch_immed,
354 NULL
357 if (isreq && iscdb) {
358 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
359 tvb_get_ntoh64 (tvb, offset+1),
360 tvb_get_ntohl (tvb, offset+9));
363 if (tree && isreq && iscdb) {
364 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_prefetch_flags,
365 ett_scsi_prefetch, prefetch_fields, ENC_BIG_ENDIAN);
366 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
367 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
368 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
369 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
370 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
374 void
375 dissect_sbc_read10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
376 guint offset, gboolean isreq, gboolean iscdb,
377 guint payload_len _U_, scsi_task_data_t *cdata _U_)
380 static const int *rdwr10_fields[] = {
381 &hf_scsi_sbc_rdprotect,
382 &hf_scsi_sbc_dpo,
383 &hf_scsi_sbc_fua,
384 &hf_scsi_sbc_fua_nv,
385 NULL
388 if (isreq && iscdb) {
389 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
390 tvb_get_ntohl (tvb, offset+1),
391 tvb_get_ntohs (tvb, offset+6));
394 if (tree && isreq && iscdb) {
395 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
396 ett_scsi_rdwr, rdwr10_fields, ENC_BIG_ENDIAN);
397 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
398 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
399 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
400 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
401 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
405 static void
406 dissect_sbc_xdread10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
407 guint offset, gboolean isreq, gboolean iscdb,
408 guint payload_len _U_, scsi_task_data_t *cdata _U_)
411 static const int *xdread10_fields[] = {
412 &hf_scsi_sbc_xorpinfo,
413 NULL
416 if (isreq && iscdb) {
417 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
418 tvb_get_ntohl (tvb, offset+1),
419 tvb_get_ntohs (tvb, offset+6));
422 if (tree && isreq && iscdb) {
423 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdread_flags,
424 ett_scsi_xdread, xdread10_fields, ENC_BIG_ENDIAN);
425 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
426 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
427 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
428 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
429 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
433 static void
434 dissect_sbc_xdwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
435 guint offset, gboolean isreq, gboolean iscdb,
436 guint payload_len _U_, scsi_task_data_t *cdata _U_)
439 static const int *xdwrite10_fields[] = {
440 &hf_scsi_sbc_wrprotect,
441 &hf_scsi_sbc_dpo,
442 &hf_scsi_sbc_fua,
443 &hf_scsi_sbc_disable_write,
444 &hf_scsi_sbc_fua_nv,
445 NULL
448 if (isreq && iscdb) {
449 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
450 tvb_get_ntohl (tvb, offset+1),
451 tvb_get_ntohs (tvb, offset+6));
454 if (tree && isreq && iscdb) {
455 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdwrite_flags,
456 ett_scsi_xdwrite, xdwrite10_fields, ENC_BIG_ENDIAN);
457 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
458 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
459 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
460 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
461 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
465 static void
466 dissect_sbc_xdwriteread10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
467 guint offset, gboolean isreq, gboolean iscdb,
468 guint payload_len _U_, scsi_task_data_t *cdata _U_)
471 static const int *xdwriteread10_fields[] = {
472 &hf_scsi_sbc_wrprotect,
473 &hf_scsi_sbc_dpo,
474 &hf_scsi_sbc_fua,
475 &hf_scsi_sbc_disable_write,
476 &hf_scsi_sbc_fua_nv,
477 &hf_scsi_sbc_xorpinfo,
478 NULL
481 if (isreq && iscdb) {
482 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
483 tvb_get_ntohl (tvb, offset+1),
484 tvb_get_ntohs (tvb, offset+6));
487 if (tree && isreq && iscdb) {
488 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdwriteread_flags,
489 ett_scsi_xdwriteread, xdwriteread10_fields, ENC_BIG_ENDIAN);
490 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
491 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
492 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
493 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
494 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
498 static void
499 dissect_sbc_xpwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
500 guint offset, gboolean isreq, gboolean iscdb,
501 guint payload_len _U_, scsi_task_data_t *cdata _U_)
504 static const int *xpwrite10_fields[] = {
505 &hf_scsi_sbc_dpo,
506 &hf_scsi_sbc_fua,
507 &hf_scsi_sbc_fua_nv,
508 &hf_scsi_sbc_xorpinfo,
509 NULL
512 if (isreq && iscdb) {
513 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
514 tvb_get_ntohl (tvb, offset+1),
515 tvb_get_ntohs (tvb, offset+6));
518 if (tree && isreq && iscdb) {
519 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xpwrite_flags,
520 ett_scsi_xpwrite, xpwrite10_fields, ENC_BIG_ENDIAN);
521 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
522 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
523 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
524 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
525 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
529 void
530 dissect_sbc_write10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
531 guint offset, gboolean isreq, gboolean iscdb,
532 guint payload_len _U_, scsi_task_data_t *cdata _U_)
535 static const int *rdwr10_fields[] = {
536 &hf_scsi_sbc_wrprotect,
537 &hf_scsi_sbc_dpo,
538 &hf_scsi_sbc_fua,
539 &hf_scsi_sbc_fua_nv,
540 NULL
543 if (isreq && iscdb) {
544 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
545 tvb_get_ntohl (tvb, offset+1),
546 tvb_get_ntohs (tvb, offset+6));
549 if (tree && isreq && iscdb) {
550 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
551 ett_scsi_rdwr, rdwr10_fields, ENC_BIG_ENDIAN);
552 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
553 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
554 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
555 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
556 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
560 void
561 dissect_sbc_read12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
562 guint offset, gboolean isreq, gboolean iscdb,
563 guint payload_len _U_, scsi_task_data_t *cdata _U_)
565 static const int *rdwr12_fields[] = {
566 &hf_scsi_sbc_rdprotect,
567 &hf_scsi_sbc_dpo,
568 &hf_scsi_sbc_fua,
569 &hf_scsi_sbc_fua_nv,
570 NULL
573 if (isreq && iscdb) {
574 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
575 tvb_get_ntohl (tvb, offset+1),
576 tvb_get_ntohl (tvb, offset+5));
579 if (tree && isreq && iscdb) {
580 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
581 ett_scsi_rdwr, rdwr12_fields, ENC_BIG_ENDIAN);
582 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
583 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+5, 4, ENC_BIG_ENDIAN);
584 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, ENC_BIG_ENDIAN);
585 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
586 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
590 void
591 dissect_sbc_write12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
592 guint offset, gboolean isreq, gboolean iscdb,
593 guint payload_len _U_, scsi_task_data_t *cdata _U_)
595 static const int *rdwr12_fields[] = {
596 &hf_scsi_sbc_wrprotect,
597 &hf_scsi_sbc_dpo,
598 &hf_scsi_sbc_fua,
599 &hf_scsi_sbc_fua_nv,
600 NULL
603 if (isreq && iscdb) {
604 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
605 tvb_get_ntohl (tvb, offset+1),
606 tvb_get_ntohl (tvb, offset+5));
609 if (tree && isreq && iscdb) {
610 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
611 ett_scsi_rdwr, rdwr12_fields, ENC_BIG_ENDIAN);
612 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
613 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+5, 4, ENC_BIG_ENDIAN);
614 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, ENC_BIG_ENDIAN);
615 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
616 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
620 static void
621 dissect_sbc_read16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
622 guint offset, gboolean isreq, gboolean iscdb,
623 guint payload_len _U_, scsi_task_data_t *cdata _U_)
625 static const int *rdwr16_fields[] = {
626 &hf_scsi_sbc_rdprotect,
627 &hf_scsi_sbc_dpo,
628 &hf_scsi_sbc_fua,
629 &hf_scsi_sbc_fua_nv,
630 NULL
633 if (isreq && iscdb) {
634 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
635 tvb_get_ntoh64 (tvb, offset+1),
636 tvb_get_ntohl (tvb, offset+9));
639 if (tree && isreq && iscdb) {
640 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
641 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
642 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
643 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
644 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
645 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
646 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
649 static void
650 dissect_sbc_write16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
651 guint offset, gboolean isreq, gboolean iscdb,
652 guint payload_len _U_, scsi_task_data_t *cdata _U_)
654 static const int *rdwr16_fields[] = {
655 &hf_scsi_sbc_wrprotect,
656 &hf_scsi_sbc_dpo,
657 &hf_scsi_sbc_fua,
658 &hf_scsi_sbc_fua_nv,
659 NULL
662 if (isreq && iscdb) {
663 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
664 tvb_get_ntoh64 (tvb, offset+1),
665 tvb_get_ntohl (tvb, offset+9));
668 if (tree && isreq && iscdb) {
669 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
670 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
671 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
672 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
673 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
674 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
675 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
679 static void
680 dissect_sbc_orwrite (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
681 guint offset, gboolean isreq, gboolean iscdb,
682 guint payload_len _U_, scsi_task_data_t *cdata _U_)
684 static const int *rdwr16_fields[] = {
685 &hf_scsi_sbc_wrprotect,
686 &hf_scsi_sbc_dpo,
687 &hf_scsi_sbc_fua,
688 &hf_scsi_sbc_fua_nv,
689 NULL
692 if (isreq && iscdb) {
693 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
694 tvb_get_ntoh64 (tvb, offset+1),
695 tvb_get_ntohl (tvb, offset+9));
698 if (tree && isreq && iscdb) {
699 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
700 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
701 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
702 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
703 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
704 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
705 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
709 static void
710 dissect_sbc_comparenwrite (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
711 guint offset, gboolean isreq, gboolean iscdb,
712 guint payload_len _U_, scsi_task_data_t *cdata _U_)
714 static const int *rdwr16_fields[] = {
715 &hf_scsi_sbc_wrprotect,
716 &hf_scsi_sbc_dpo,
717 &hf_scsi_sbc_fua,
718 &hf_scsi_sbc_fua_nv,
719 NULL
722 if (isreq && iscdb) {
723 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
724 tvb_get_ntoh64 (tvb, offset+1),
725 tvb_get_ntohl (tvb, offset+9));
728 if (tree && isreq && iscdb) {
729 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags,
730 ett_scsi_rdwr, rdwr16_fields, ENC_BIG_ENDIAN);
731 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
732 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+12, 1, ENC_BIG_ENDIAN);
733 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
734 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
735 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
739 static const value_string scsi_ssu_pwrcnd_val[] = {
740 {0x0, "No Change"},
741 {0x1, "Place Device In Active Condition"},
742 {0x2, "Place device into Idle condition"},
743 {0x3, "Place device into Standby condition"},
744 {0x4, "Reserved"},
745 {0x5, "Place device into Sleep condition"},
746 {0x6, "Reserved"},
747 {0x7, "Transfer control of power conditions to block device"},
748 {0x8, "Reserved"},
749 {0x9, "Reserved"},
750 {0xA, "Force Idle Condition Timer to zero"},
751 {0xB, "Force Standby Condition Timer to zero"},
752 {0, NULL},
755 static const value_string scsi_ptype_val[] = {
756 {0x0, "Type 1 protection" },
757 {0x1, "Type 2 protection" },
758 {0x2, "Type 3 protection" },
759 {0, NULL},
762 static const value_string scsi_provisioning_type_val[] = {
763 {0x0, "The LBA is MAPPED" },
764 {0x1, "The LBA is DEALLOCATED" },
765 {0x2, "The LBA is ANCHORED" },
766 {0, NULL},
769 void
770 dissect_sbc_startstopunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
771 guint offset, gboolean isreq _U_, gboolean iscdb,
772 guint payload_len _U_, scsi_task_data_t *cdata _U_)
774 static const int *ssu_fields[] = {
775 &hf_scsi_sbc_ssu_immed,
776 NULL
778 static const int *pwr_fields[] = {
779 &hf_scsi_sbc_ssu_pwr_cond,
780 &hf_scsi_sbc_ssu_loej,
781 &hf_scsi_sbc_ssu_start,
782 NULL
785 if (!tree || !iscdb)
786 return;
788 if (isreq && iscdb) {
789 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_ssu_immed_flags,
790 ett_scsi_ssu_immed, ssu_fields, ENC_BIG_ENDIAN);
791 proto_tree_add_bitmask(tree, tvb, offset+3, hf_scsi_sbc_ssu_pwr_flags,
792 ett_scsi_ssu_pwr, pwr_fields, ENC_BIG_ENDIAN);
793 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
794 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
798 static void
799 dissect_sbc_verify10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
800 guint offset, gboolean isreq, gboolean iscdb,
801 guint payload_len _U_, scsi_task_data_t *cdata _U_)
804 static const int *verify10_fields[] = {
805 &hf_scsi_sbc_vrprotect,
806 &hf_scsi_sbc_dpo,
807 &hf_scsi_sbc_bytchk,
808 NULL
811 if (isreq && iscdb) {
812 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
813 tvb_get_ntohl (tvb, offset+1),
814 tvb_get_ntohs (tvb, offset+6));
817 if (tree && isreq && iscdb) {
818 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags,
819 ett_scsi_verify, verify10_fields, ENC_BIG_ENDIAN);
820 proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
821 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
822 proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
823 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
824 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
828 static void
829 dissect_sbc_verify12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
830 guint offset, gboolean isreq, gboolean iscdb,
831 guint payload_len _U_, scsi_task_data_t *cdata _U_)
834 static const int *verify12_fields[] = {
835 &hf_scsi_sbc_vrprotect,
836 &hf_scsi_sbc_dpo,
837 &hf_scsi_sbc_bytchk,
838 NULL
841 if (isreq && iscdb) {
842 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
843 tvb_get_ntohl (tvb, offset+1),
844 tvb_get_ntohl (tvb, offset+5));
847 if (isreq && iscdb) {
848 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags,
849 ett_scsi_verify, verify12_fields, ENC_BIG_ENDIAN);
850 proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
851 proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen32, tvb, offset+5, 4, ENC_BIG_ENDIAN);
852 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, ENC_BIG_ENDIAN);
853 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
854 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
858 static void
859 dissect_sbc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
860 guint offset, gboolean isreq, gboolean iscdb,
861 guint payload_len _U_, scsi_task_data_t *cdata _U_)
864 static const int *verify16_fields[] = {
865 &hf_scsi_sbc_vrprotect,
866 &hf_scsi_sbc_dpo,
867 &hf_scsi_sbc_bytchk,
868 NULL
871 if (isreq && iscdb) {
872 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
873 tvb_get_ntoh64 (tvb, offset+1),
874 tvb_get_ntohl (tvb, offset+9));
877 if (isreq && iscdb) {
878 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags,
879 ett_scsi_verify, verify16_fields, ENC_BIG_ENDIAN);
880 proto_tree_add_item (tree, hf_scsi_sbc_verify_lba64, tvb, offset+1, 8, ENC_BIG_ENDIAN);
881 proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen32, tvb, offset+9, 4, ENC_BIG_ENDIAN);
882 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
883 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
884 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
889 static void
890 dissect_sbc_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_,
891 proto_tree *tree, guint offset, gboolean isreq,
892 gboolean iscdb, guint payload_len _U_,
893 scsi_task_data_t *cdata _U_)
896 static const int *wrverify10_fields[] = {
897 &hf_scsi_sbc_wrprotect,
898 &hf_scsi_sbc_dpo,
899 &hf_scsi_sbc_bytchk,
900 NULL
903 if (isreq && iscdb) {
904 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
905 tvb_get_ntohl (tvb, offset+1),
906 tvb_get_ntohs (tvb, offset+6));
909 if (tree && isreq && iscdb) {
910 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags,
911 ett_scsi_wrverify, wrverify10_fields, ENC_BIG_ENDIAN);
912 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
913 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
914 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
915 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
916 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
920 static void
921 dissect_sbc_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_,
922 proto_tree *tree, guint offset, gboolean isreq,
923 gboolean iscdb, guint payload_len _U_,
924 scsi_task_data_t *cdata _U_)
926 static const int *wrverify12_fields[] = {
927 &hf_scsi_sbc_wrprotect,
928 &hf_scsi_sbc_dpo,
929 &hf_scsi_sbc_bytchk,
930 NULL
933 if (isreq && iscdb) {
934 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
935 tvb_get_ntohl (tvb, offset+1),
936 tvb_get_ntohl (tvb, offset+5));
939 if (tree && isreq && iscdb) {
940 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags,
941 ett_scsi_wrverify, wrverify12_fields, ENC_BIG_ENDIAN);
942 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
943 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+5, 4, ENC_BIG_ENDIAN);
944 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, ENC_BIG_ENDIAN);
945 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
946 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
950 static void
951 dissect_sbc_wrverify16 (tvbuff_t *tvb, packet_info *pinfo _U_,
952 proto_tree *tree, guint offset, gboolean isreq,
953 gboolean iscdb, guint payload_len _U_,
954 scsi_task_data_t *cdata _U_)
956 static const int *wrverify16_fields[] = {
957 &hf_scsi_sbc_wrprotect,
958 &hf_scsi_sbc_dpo,
959 &hf_scsi_sbc_bytchk,
960 NULL
963 if (isreq && iscdb) {
964 col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
965 tvb_get_ntoh64 (tvb, offset+1),
966 tvb_get_ntohl (tvb, offset+9));
969 if (tree && isreq && iscdb) {
970 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags,
971 ett_scsi_wrverify, wrverify16_fields, ENC_BIG_ENDIAN);
972 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba64, tvb, offset+1, 8, ENC_BIG_ENDIAN);
973 proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+9, 4, ENC_BIG_ENDIAN);
974 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
975 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
976 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
980 void
981 dissect_sbc_readcapacity10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
982 guint offset, gboolean isreq, gboolean iscdb,
983 guint payload_len _U_, scsi_task_data_t *cdata _U_)
985 guint32 len, block_len, tot_len;
986 const char *un;
988 if (!tree)
989 return;
991 if (isreq && iscdb) {
992 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
993 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
995 else if (!iscdb) {
996 len = tvb_get_ntohl (tvb, offset);
997 block_len = tvb_get_ntohl (tvb, offset+4);
998 tot_len=((len/1024)*block_len)/1024; /*MB*/
999 un="MB";
1000 if(tot_len>20000){
1001 tot_len/=1024;
1002 un="GB";
1004 proto_tree_add_uint_format (tree, hf_scsi_sbc_returned_lba, tvb, offset, 4, len, "LBA: %u (%u %s)", len, tot_len, un);
1005 proto_tree_add_item (tree, hf_scsi_sbc_blocksize, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1009 static void
1010 dissect_sbc_readdefectdata10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1011 proto_tree *tree, guint offset, gboolean isreq,
1012 gboolean iscdb,
1013 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1015 static const int *defect_fields[] = {
1016 &hf_scsi_sbc_defect_list_format,
1017 &hf_scsi_sbc_req_plist,
1018 &hf_scsi_sbc_req_glist,
1019 NULL
1022 if (!tree)
1023 return;
1025 if (isreq && iscdb) {
1026 proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_sbc_readdefdata_flags,
1027 ett_scsi_defectdata, defect_fields, ENC_BIG_ENDIAN);
1028 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1029 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1030 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1032 /* TODO : add dissection of DATA */
1036 static void
1037 dissect_sbc_readlong10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1038 proto_tree *tree, guint offset, gboolean isreq,
1039 gboolean iscdb,
1040 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1042 static const int *corrct_fields[] = {
1043 &hf_scsi_sbc_corrct,
1044 NULL
1047 if (!tree)
1048 return;
1050 if (isreq && iscdb) {
1051 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_corrct_flags,
1052 ett_scsi_corrct, corrct_fields, ENC_BIG_ENDIAN);
1053 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
1054 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1055 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1056 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1060 static void
1061 dissect_sbc_writelong10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1062 proto_tree *tree, guint offset, gboolean isreq,
1063 gboolean iscdb,
1064 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1066 if (!tree)
1067 return;
1069 if (isreq && iscdb) {
1070 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
1071 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1072 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1073 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1077 static void
1078 dissect_sbc_writesame10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1079 proto_tree *tree, guint offset, gboolean isreq,
1080 gboolean iscdb,
1081 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1083 static const int *writesame10_fields[] = {
1084 &hf_scsi_sbc_wrprotect,
1085 &hf_scsi_sbc_anchor,
1086 &hf_scsi_sbc_unmap,
1087 &hf_scsi_sbc_pbdata,
1088 &hf_scsi_sbc_lbdata,
1089 NULL
1092 if (!tree)
1093 return;
1095 if (isreq && iscdb) {
1096 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_writesame_flags,
1097 ett_scsi_writesame, writesame10_fields, ENC_BIG_ENDIAN);
1098 proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, ENC_BIG_ENDIAN);
1099 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1100 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1101 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1102 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1106 static void
1107 dissect_sbc_writesame16 (tvbuff_t *tvb, packet_info *pinfo _U_,
1108 proto_tree *tree, guint offset, gboolean isreq,
1109 gboolean iscdb,
1110 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1112 static const int *writesame16_fields[] = {
1113 &hf_scsi_sbc_wrprotect,
1114 &hf_scsi_sbc_anchor,
1115 &hf_scsi_sbc_unmap,
1116 &hf_scsi_sbc_pbdata,
1117 &hf_scsi_sbc_lbdata,
1118 NULL
1121 if (!tree)
1122 return;
1124 if (isreq && iscdb) {
1125 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_writesame_flags,
1126 ett_scsi_writesame, writesame16_fields, ENC_BIG_ENDIAN);
1127 proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, ENC_NA);
1128 proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, ENC_BIG_ENDIAN);
1129 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1130 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
1131 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1135 static void
1136 dissect_sbc_unmap (tvbuff_t *tvb, packet_info *pinfo _U_,
1137 proto_tree *tree, guint offset, gboolean isreq,
1138 gboolean iscdb,
1139 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1141 static const int *unmap_fields[] = {
1142 &hf_scsi_sbc_unmap_anchor,
1143 NULL
1146 if (!tree)
1147 return;
1149 if (isreq && iscdb) {
1150 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_unmap_flags,
1151 ett_scsi_unmap, unmap_fields, ENC_BIG_ENDIAN);
1152 proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, ENC_BIG_ENDIAN);
1154 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
1156 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1157 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1158 } else if (isreq) {
1159 proto_tree_add_item (tree, hf_scsi_sbc_unmap_data_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1160 proto_tree_add_item (tree, hf_scsi_sbc_unmap_block_descriptor_data_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1161 offset += 8;
1162 while (tvb_reported_length_remaining(tvb, offset) >=16) {
1163 proto_tree *tr;
1164 proto_item *it;
1165 gint64 lba;
1166 gint32 num_blocks;
1168 it = proto_tree_add_text(tree, tvb, offset, 16, "UNMAP Block Descriptor: LBA ");
1169 tr = proto_item_add_subtree(it, ett_scsi_unmap_block_descriptor);
1171 proto_tree_add_item (tr, hf_scsi_sbc_unmap_lba, tvb, offset, 8, ENC_BIG_ENDIAN);
1172 lba = tvb_get_ntoh64 (tvb, offset);
1174 proto_tree_add_item (tr, hf_scsi_sbc_unmap_num_blocks, tvb, offset+8, 4, ENC_BIG_ENDIAN);
1175 num_blocks = tvb_get_ntohl(tvb, offset+8);
1177 if (num_blocks > 1) {
1178 proto_item_append_text (it, "%" G_GINT64_MODIFIER "u-%" G_GINT64_MODIFIER "u ", lba, lba+num_blocks-1);
1179 } else {
1180 proto_item_append_text (it, "%" G_GINT64_MODIFIER "u ", lba);
1183 offset += 16;
1188 static const value_string sanitize_val[] = {
1189 {0x01, "OVERWRITE"},
1190 {0x02, "BLOCK ERASE"},
1191 {0x03, "CRYPTO ERASE"},
1192 {0x1f, "EXIT FAILURE MODE"},
1193 {0, NULL},
1196 static void
1197 dissect_sbc_sanitize (tvbuff_t *tvb, packet_info *pinfo _U_,
1198 proto_tree *tree, guint offset, gboolean isreq,
1199 gboolean iscdb,
1200 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1202 static const int *sanitize_fields[] = {
1203 &hf_scsi_sbc_sanitize_immed,
1204 &hf_scsi_sbc_sanitize_ause,
1205 &hf_scsi_sbc_sanitize_sa,
1206 NULL
1208 static const int *sanitize_overwrite_fields[] = {
1209 &hf_scsi_sbc_sanitize_invert,
1210 &hf_scsi_sbc_sanitize_test,
1211 &hf_scsi_sbc_sanitize_owcount,
1212 NULL
1215 if (!tree)
1216 return;
1218 if (isreq && iscdb) {
1219 guint8 service_action;
1221 service_action = tvb_get_guint8 (tvb, offset) & 0x1F;
1222 col_append_str(pinfo->cinfo, COL_INFO, val_to_str(service_action,
1223 sanitize_val,
1224 "Unknown (0x%02x)"));
1226 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_sanitize_flags,
1227 ett_scsi_sanitize, sanitize_fields, ENC_BIG_ENDIAN);
1229 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2,
1230 ENC_BIG_ENDIAN);
1232 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
1233 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1234 } else if (isreq) {
1235 proto_tree_add_bitmask(tree, tvb, offset,
1236 hf_scsi_sbc_sanitize_overwrite_flags,
1237 ett_scsi_sanitize_overwrite,
1238 sanitize_overwrite_fields,
1239 ENC_BIG_ENDIAN);
1241 proto_tree_add_item (tree, hf_scsi_sbc_sanitize_pattern_length,
1242 tvb, offset+2, 2,
1243 ENC_BIG_ENDIAN);
1245 proto_tree_add_item (tree, hf_scsi_sbc_sanitize_pattern,
1246 tvb, offset+4, -1,
1247 ENC_BIG_ENDIAN);
1251 static void
1252 dissect_sbc_readdefectdata12 (tvbuff_t *tvb, packet_info *pinfo _U_,
1253 proto_tree *tree, guint offset, gboolean isreq,
1254 gboolean iscdb,
1255 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1257 static const int *defect_fields[] = {
1258 &hf_scsi_sbc_defect_list_format,
1259 &hf_scsi_sbc_req_plist,
1260 &hf_scsi_sbc_req_glist,
1261 NULL
1264 if (!tree)
1265 return;
1267 if (isreq && iscdb) {
1268 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_readdefdata_flags,
1269 ett_scsi_defectdata, defect_fields, ENC_BIG_ENDIAN);
1270 proto_tree_add_item (tree, hf_scsi_sbc_alloclen32, tvb, offset+5, 4, ENC_BIG_ENDIAN);
1271 proto_tree_add_bitmask(tree, tvb, offset+10, hf_scsi_control,
1272 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1274 /* TODO : add dissection of DATA */
1278 static void
1279 dissect_sbc_reassignblocks (tvbuff_t *tvb, packet_info *pinfo _U_,
1280 proto_tree *tree, guint offset, gboolean isreq,
1281 gboolean iscdb,
1282 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1284 static const int *reassign_fields[] = {
1285 &hf_scsi_sbc_reassignblocks_longlba,
1286 &hf_scsi_sbc_reassignblocks_longlist,
1287 NULL
1290 if (!tree)
1291 return;
1293 if (isreq && iscdb) {
1294 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_reassignblks_flags,
1295 ett_scsi_reassign_blocks, reassign_fields, ENC_BIG_ENDIAN);
1296 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
1297 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1299 /* TODO : add dissection of DATA */
1303 const value_string service_action_vals[] = {
1304 {SHORT_FORM_BLOCK_ID, "Short Form - Block ID"},
1305 {SHORT_FORM_VENDOR_SPECIFIC, "Short Form - Vendor-Specific"},
1306 {LONG_FORM, "Long Form"},
1307 {EXTENDED_FORM, "Extended Form"},
1308 {SERVICE_READ_CAPACITY16, "Read Capacity(16)"},
1309 {SERVICE_READ_LONG16, "Read Long(16)"},
1310 {SERVICE_GET_LBA_STATUS, "Get LBA Status"},
1311 {0, NULL}
1314 /* this is either readcapacity16 or readlong16 depending of what service
1315 action is set to.
1317 static void
1318 dissect_sbc_serviceactionin16 (tvbuff_t *tvb, packet_info *pinfo _U_,
1319 proto_tree *tree, guint offset, gboolean isreq,
1320 gboolean iscdb,
1321 guint payload_len _U_, scsi_task_data_t *cdata _U_)
1323 guint8 service_action;
1324 guint32 block_len;
1325 guint64 len, tot_len;
1326 const char *un;
1328 if (!tree)
1329 return;
1331 if (isreq && iscdb) {
1332 service_action = tvb_get_guint8 (tvb, offset) & 0x1F;
1333 if(cdata && cdata->itlq){
1334 cdata->itlq->flags=service_action;
1337 switch(service_action){
1338 case SERVICE_READ_CAPACITY16:
1339 col_append_str(pinfo->cinfo, COL_INFO, " READCAPACITY16");
1341 proto_tree_add_text (tree, tvb, offset, 1,
1342 "Service Action: %s",
1343 val_to_str (service_action,
1344 service_action_vals,
1345 "Unknown (0x%02x)"));
1346 offset += 9;
1348 proto_tree_add_item (tree, hf_scsi_sbc_alloclen32, tvb, offset, 4, ENC_BIG_ENDIAN);
1349 offset += 5;
1351 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_control,
1352 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1353 offset++;
1355 break;
1356 case SERVICE_READ_LONG16:
1357 col_append_str(pinfo->cinfo, COL_INFO, " READ_LONG16");
1358 proto_tree_add_text (tree, tvb, offset, 1,
1359 "Service Action: %s",
1360 val_to_str (service_action,
1361 service_action_vals,
1362 "Unknown (0x%02x)"));
1363 offset++;
1365 proto_tree_add_text (tree, tvb, offset, 8,
1366 "Logical Block Address: %" G_GINT64_MODIFIER "u",
1367 tvb_get_ntoh64 (tvb, offset));
1368 offset+=8;
1370 /* two reserved bytes */
1371 offset+=2;
1373 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset, 2, ENC_BIG_ENDIAN);
1374 offset+=2;
1376 /* CORRCT bit */
1377 offset++;
1379 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_control,
1380 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1381 offset++;
1383 break;
1384 case SERVICE_GET_LBA_STATUS:
1385 col_append_str(pinfo->cinfo, COL_INFO, " GET_LBA_STATUS");
1387 proto_tree_add_text (tree, tvb, offset, 1,
1388 "Service Action: %s",
1389 val_to_str (service_action,
1390 service_action_vals,
1391 "Unknown (0x%02x)"));
1392 offset++;
1394 proto_tree_add_item (tree, hf_scsi_sbc_get_lba_status_lba, tvb, offset, 8, ENC_BIG_ENDIAN);
1395 offset += 8;
1397 proto_tree_add_item (tree, hf_scsi_sbc_alloclen32, tvb, offset, 4, ENC_BIG_ENDIAN);
1398 offset += 4;
1400 /* reserved */
1401 offset++;
1403 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_control,
1404 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
1405 offset++;
1407 break;
1409 } else if (!iscdb) {
1410 if(cdata && cdata->itlq){
1411 switch(cdata->itlq->flags){
1412 case SERVICE_READ_CAPACITY16:
1413 len = tvb_get_ntoh64 (tvb, offset);
1414 block_len = tvb_get_ntohl (tvb, offset+8);
1415 tot_len=((len/1024)*block_len)/1024; /*MB*/
1416 un="MB";
1417 if(tot_len>20000){
1418 tot_len/=1024;
1419 un="GB";
1421 proto_tree_add_text (tree, tvb, offset, 8, "LBA: %" G_GINT64_MODIFIER "u (%" G_GINT64_MODIFIER "u %s)",
1422 len, tot_len, un);
1423 proto_tree_add_item (tree, hf_scsi_sbc_blocksize, tvb, offset+8, 4, ENC_BIG_ENDIAN);
1426 proto_tree_add_item (tree, hf_scsi_sbc_prot_en, tvb, offset+12, 1, ENC_BIG_ENDIAN);
1427 if (tvb_get_guint8(tvb, offset+12) & 0x01) {
1428 /* only decode the protection type if protection is enabled */
1429 proto_tree_add_item (tree, hf_scsi_sbc_ptype, tvb, offset+12, 1, ENC_BIG_ENDIAN);
1432 proto_tree_add_item (tree, hf_scsi_sbc_p_i_exponent, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1433 proto_tree_add_item (tree, hf_scsi_sbc_lbppbe, tvb, offset+13, 1, ENC_BIG_ENDIAN);
1435 proto_tree_add_item (tree, hf_scsi_sbc_lbpme, tvb, offset+14, 1, ENC_BIG_ENDIAN);
1436 proto_tree_add_item (tree, hf_scsi_sbc_lbprz, tvb, offset+14, 1, ENC_BIG_ENDIAN);
1437 proto_tree_add_item (tree, hf_scsi_sbc_lalba, tvb, offset+14, 2, ENC_BIG_ENDIAN);
1439 break;
1440 case SERVICE_GET_LBA_STATUS:
1441 proto_tree_add_item (tree, hf_scsi_sbc_get_lba_status_data_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1442 offset += 4;
1444 /* reserved */
1445 offset += 4;
1447 while (tvb_length_remaining(tvb, offset) >= 16) {
1448 proto_tree *tr;
1449 proto_item *it;
1450 guint64 lba;
1451 guint32 num_blocks;
1452 guint8 type;
1454 it = proto_tree_add_text(tree, tvb, offset, 16, "LBA Status Descriptor: ");
1455 tr = proto_item_add_subtree(it, ett_scsi_lba_status_descriptor);
1457 proto_tree_add_item (tr, hf_scsi_sbc_get_lba_status_lba, tvb, offset, 8, ENC_BIG_ENDIAN);
1458 lba = tvb_get_ntoh64(tvb, offset);
1459 offset += 8;
1461 proto_tree_add_item (tr, hf_scsi_sbc_get_lba_status_num_blocks, tvb, offset, 4, ENC_BIG_ENDIAN);
1462 num_blocks = tvb_get_ntohl(tvb, offset);
1463 offset += 4;
1465 proto_tree_add_item (tr, hf_scsi_sbc_get_lba_status_provisioning_status, tvb, offset, 1, ENC_BIG_ENDIAN);
1466 type = tvb_get_guint8(tvb, offset) & 0x07;
1467 offset++;
1469 /* reserved */
1470 offset += 3;
1472 proto_item_append_text (it, "%" G_GINT64_MODIFIER "u-%" G_GINT64_MODIFIER "u %s",
1473 lba,
1474 lba + num_blocks - 1,
1475 val_to_str(type, scsi_provisioning_type_val, "Unknown (0x%02x)")
1478 break;
1485 /* SBC Commands */
1486 const value_string scsi_sbc_vals[] = {
1487 {SCSI_SPC_EXTCOPY , "Extended Copy"},
1488 {SCSI_SPC_INQUIRY , "Inquiry"},
1489 {SCSI_SBC_FORMATUNIT , "Format Unit"},
1490 {SCSI_SBC_LOCKUNLKCACHE10 , "Lock Unlock Cache(10)"},
1491 {SCSI_SBC_LOCKUNLKCACHE16 , "Lock Unlock Cache(16)"},
1492 {SCSI_SPC_LOGSELECT , "Log Select"},
1493 {SCSI_SPC_LOGSENSE , "Log Sense"},
1494 {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
1495 {SCSI_SPC_MODESELECT6 , "Mode Select(6)"},
1496 {SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
1497 {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"},
1498 {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"},
1499 {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"},
1500 {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"},
1501 {SCSI_SBC_PREFETCH10 , "Pre-Fetch(10)"},
1502 {SCSI_SBC_PREFETCH16 , "Pre-Fetch(16)"},
1503 {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"},
1504 {SCSI_SBC_READ6 , "Read(6)"},
1505 {SCSI_SBC_READ10 , "Read(10)"},
1506 {SCSI_SBC_READ12 , "Read(12)"},
1507 {SCSI_SBC_READ16 , "Read(16)"},
1508 {SCSI_SBC_READCAPACITY10 , "Read Capacity(10)"},
1509 {SCSI_SPC_REPORTLUNS , "Report LUNs"},
1510 {SCSI_SPC_REQSENSE , "Request Sense"},
1511 {SCSI_SBC_SERVICEACTIONIN16 , "Service Action In(16)"},
1512 {SCSI_SBC_READDEFDATA10 , "Read Defect Data(10)"},
1513 {SCSI_SBC_READDEFDATA12 , "Read Defect Data(12)"},
1514 {SCSI_SBC_READLONG , "Read Long(10)"},
1515 {SCSI_SBC_REASSIGNBLKS , "Reassign Blocks"},
1516 {SCSI_SBC_REBUILD16 , "Rebuild(16)"},
1517 {SCSI_SBC_REBUILD32 , "Rebuild(32)"},
1518 {SCSI_SBC_REGENERATE16 , "Regenerate(16)"},
1519 {SCSI_SBC_REGENERATE32 , "Regenerate(32)"},
1520 {SCSI_SPC_RELEASE6 , "Release(6)"}, /* obsolete in SBC2 and later */
1521 {SCSI_SPC_RELEASE10 , "Release(10)"},/* obsolete in SBC2 and later */
1522 {SCSI_SPC_RESERVE6 , "Reserve(6)"}, /* obsolete in SBC2 and later */
1523 {SCSI_SPC_RESERVE10 , "Reserve(10)"},/* obsolete in SBC2 and later */
1524 {SCSI_SBC_SANITIZE , "Sanitize"},
1525 {SCSI_SBC_SEEK10 , "Seek(10)"},
1526 {SCSI_SPC_SENDDIAG , "Send Diagnostic"},
1527 {SCSI_SBC_SETLIMITS10 , "Set Limits(10)"},
1528 {SCSI_SBC_SETLIMITS12 , "Set Limits(12)"},
1529 {SCSI_SBC_STARTSTOPUNIT , "Start Stop Unit"},
1530 {SCSI_SBC_SYNCCACHE10 , "Synchronize Cache(10)"},
1531 {SCSI_SBC_SYNCCACHE16 , "Synchronize Cache(16)"},
1532 {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"},
1533 {SCSI_SBC_UNMAP , "Unmap"},
1534 {SCSI_SBC_VERIFY10 , "Verify(10)"},
1535 {SCSI_SBC_VERIFY12 , "Verify(12)"},
1536 {SCSI_SBC_VERIFY16 , "Verify(16)"},
1537 {SCSI_SBC_WRITE6 , "Write(6)"},
1538 {SCSI_SBC_WRITE10 , "Write(10)"},
1539 {SCSI_SBC_WRITE12 , "Write(12)"},
1540 {SCSI_SBC_WRITE16 , "Write(16)"},
1541 {SCSI_SBC_ORWRITE , "OrWrite(16)"},
1542 {SCSI_SPC_WRITEBUFFER , "Write Buffer"},
1543 {SCSI_SBC_COMPARENWRITE , "Compare & Write(16)"},
1544 {SCSI_SBC_WRITENVERIFY10 , "Write & Verify(10)"},
1545 {SCSI_SBC_WRITENVERIFY12 , "Write & Verify(12)"},
1546 {SCSI_SBC_WRITENVERIFY16 , "Write & Verify(16)"},
1547 {SCSI_SBC_WRITELONG , "Write Long"},
1548 {SCSI_SBC_WRITESAME10 , "Write Same(10)"},
1549 {SCSI_SBC_WRITESAME16 , "Write Same(16)"},
1550 {SCSI_SBC_XDREAD10 , "XdRead(10)"},
1551 {SCSI_SBC_XDREAD32 , "XdRead(32)"},
1552 {SCSI_SBC_XDWRITE10 , "XdWrite(10)"},
1553 {SCSI_SBC_XDWRITE32 , "XdWrite(32)"},
1554 {SCSI_SBC_XDWRITEREAD10 , "XdWriteRead(10)"},
1555 {SCSI_SBC_XDWRITEREAD32 , "XdWriteRead(32)"},
1556 {SCSI_SBC_XDWRITEEXTD16 , "XdWrite Extended(16)"},
1557 {SCSI_SBC_XDWRITEEXTD32 , "XdWrite Extended(32)"},
1558 {SCSI_SBC_XPWRITE10 , "XpWrite(10)"},
1559 {SCSI_SBC_XPWRITE32 , "XpWrite(32)"},
1560 {0, NULL}
1563 scsi_cdb_table_t scsi_sbc_table[256] = {
1564 /*SPC 0x00*/{dissect_spc_testunitready},
1565 /*SBC 0x01*/{NULL},
1566 /*SBC 0x02*/{NULL},
1567 /*SPC 0x03*/{dissect_spc_requestsense},
1568 /*SBC 0x04*/{dissect_sbc_formatunit},
1569 /*SBC 0x05*/{NULL},
1570 /*SBC 0x06*/{NULL},
1571 /*SBC 0x07*/{dissect_sbc_reassignblocks},
1572 /*SBC 0x08*/{dissect_sbc_read6},
1573 /*SBC 0x09*/{NULL},
1574 /*SBC 0x0a*/{dissect_sbc_write6},
1575 /*SBC 0x0b*/{NULL},
1576 /*SBC 0x0c*/{NULL},
1577 /*SBC 0x0d*/{NULL},
1578 /*SBC 0x0e*/{NULL},
1579 /*SBC 0x0f*/{NULL},
1580 /*SBC 0x10*/{NULL},
1581 /*SBC 0x11*/{NULL},
1582 /*SPC 0x12*/{dissect_spc_inquiry},
1583 /*SBC 0x13*/{NULL},
1584 /*SBC 0x14*/{NULL},
1585 /*SPC 0x15*/{dissect_spc_modeselect6},
1586 /*SBC 0x16*/{dissect_spc_reserve6}, /* obsolete in SBC2 and later */
1587 /*SBC 0x17*/{dissect_spc_release6}, /* obsolete in SBC2 and later */
1588 /*SBC 0x18*/{NULL},
1589 /*SBC 0x19*/{NULL},
1590 /*SPC 0x1a*/{dissect_spc_modesense6},
1591 /*SBC 0x1b*/{dissect_sbc_startstopunit},
1592 /*SBC 0x1c*/{NULL},
1593 /*SPC 0x1d*/{dissect_spc_senddiagnostic},
1594 /*SBC 0x1e*/{dissect_spc_preventallowmediaremoval},
1595 /*SBC 0x1f*/{NULL},
1596 /*SBC 0x20*/{NULL},
1597 /*SBC 0x21*/{NULL},
1598 /*SBC 0x22*/{NULL},
1599 /*SBC 0x23*/{NULL},
1600 /*SBC 0x24*/{NULL},
1601 /*SBC 0x25*/{dissect_sbc_readcapacity10},
1602 /*SBC 0x26*/{NULL},
1603 /*SBC 0x27*/{NULL},
1604 /*SBC 0x28*/{dissect_sbc_read10},
1605 /*SBC 0x29*/{NULL},
1606 /*SBC 0x2a*/{dissect_sbc_write10},
1607 /*SBC 0x2b*/{NULL},
1608 /*SBC 0x2c*/{NULL},
1609 /*SBC 0x2d*/{NULL},
1610 /*SBC 0x2e*/{dissect_sbc_wrverify10},
1611 /*SBC 0x2f*/{dissect_sbc_verify10},
1612 /*SBC 0x30*/{NULL},
1613 /*SBC 0x31*/{NULL},
1614 /*SBC 0x32*/{NULL},
1615 /*SBC 0x33*/{NULL},
1616 /*SBC 0x34*/{dissect_sbc_prefetch10},
1617 /*SBC 0x35*/{dissect_sbc_synchronizecache10},
1618 /*SBC 0x36*/{NULL},
1619 /*SBC 0x37*/{dissect_sbc_readdefectdata10},
1620 /*SBC 0x38*/{NULL},
1621 /*SBC 0x39*/{NULL},
1622 /*SBC 0x3a*/{NULL},
1623 /*SPC 0x3b*/{dissect_spc_writebuffer},
1624 /*SBC 0x3c*/{NULL},
1625 /*SBC 0x3d*/{NULL},
1626 /*SBC 0x3e*/{dissect_sbc_readlong10},
1627 /*SBC 0x3f*/{dissect_sbc_writelong10},
1628 /*SBC 0x40*/{NULL},
1629 /*SBC 0x41*/{dissect_sbc_writesame10},
1630 /*SBC 0x42*/{dissect_sbc_unmap},
1631 /*SBC 0x43*/{NULL},
1632 /*SBC 0x44*/{NULL},
1633 /*SBC 0x45*/{NULL},
1634 /*SBC 0x46*/{NULL},
1635 /*SBC 0x47*/{NULL},
1636 /*SBC 0x48*/{dissect_sbc_sanitize},
1637 /*SBC 0x49*/{NULL},
1638 /*SBC 0x4a*/{NULL},
1639 /*SBC 0x4b*/{NULL},
1640 /*SPC 0x4c*/{dissect_spc_logselect},
1641 /*SPC 0x4d*/{dissect_spc_logsense},
1642 /*SBC 0x4e*/{NULL},
1643 /*SBC 0x4f*/{NULL},
1644 /*SBC 0x50*/{dissect_sbc_xdwrite10},
1645 /*SBC 0x51*/{dissect_sbc_xpwrite10},
1646 /*SBC 0x52*/{dissect_sbc_xdread10},
1647 /*SBC 0x53*/{dissect_sbc_xdwriteread10},
1648 /*SBC 0x54*/{NULL},
1649 /*SPC 0x55*/{dissect_spc_modeselect10},
1650 /*SPC 0x56*/{dissect_spc_reserve10},/* obsolete in SBC2 and later */
1651 /*SPC 0x57*/{dissect_spc_release10},/* obsolete in SBC2 and later */
1652 /*SBC 0x58*/{NULL},
1653 /*SBC 0x59*/{NULL},
1654 /*SPC 0x5a*/{dissect_spc_modesense10},
1655 /*SBC 0x5b*/{NULL},
1656 /*SBC 0x5c*/{NULL},
1657 /*SBC 0x5d*/{NULL},
1658 /*SPC 0x5e*/{dissect_spc_persistentreservein},
1659 /*SPC 0x5f*/{dissect_spc_persistentreserveout},
1660 /*SBC 0x60*/{NULL},
1661 /*SBC 0x61*/{NULL},
1662 /*SBC 0x62*/{NULL},
1663 /*SBC 0x63*/{NULL},
1664 /*SBC 0x64*/{NULL},
1665 /*SBC 0x65*/{NULL},
1666 /*SBC 0x66*/{NULL},
1667 /*SBC 0x67*/{NULL},
1668 /*SBC 0x68*/{NULL},
1669 /*SBC 0x69*/{NULL},
1670 /*SBC 0x6a*/{NULL},
1671 /*SBC 0x6b*/{NULL},
1672 /*SBC 0x6c*/{NULL},
1673 /*SBC 0x6d*/{NULL},
1674 /*SBC 0x6e*/{NULL},
1675 /*SBC 0x6f*/{NULL},
1676 /*SBC 0x70*/{NULL},
1677 /*SBC 0x71*/{NULL},
1678 /*SBC 0x72*/{NULL},
1679 /*SBC 0x73*/{NULL},
1680 /*SBC 0x74*/{NULL},
1681 /*SBC 0x75*/{NULL},
1682 /*SBC 0x76*/{NULL},
1683 /*SBC 0x77*/{NULL},
1684 /*SBC 0x78*/{NULL},
1685 /*SBC 0x79*/{NULL},
1686 /*SBC 0x7a*/{NULL},
1687 /*SBC 0x7b*/{NULL},
1688 /*SBC 0x7c*/{NULL},
1689 /*SBC 0x7d*/{NULL},
1690 /*SBC 0x7e*/{NULL},
1691 /*SBC 0x7f*/{NULL},
1692 /*SBC 0x80*/{NULL},
1693 /*SBC 0x81*/{NULL},
1694 /*SBC 0x82*/{NULL},
1695 /*SPC 0x83*/{dissect_spc_extcopy},
1696 /*SBC 0x84*/{NULL},
1697 /*SBC 0x85*/{NULL},
1698 /*SBC 0x86*/{NULL},
1699 /*SBC 0x87*/{NULL},
1700 /*SBC 0x88*/{dissect_sbc_read16},
1701 /*SBC 0x89*/{dissect_sbc_comparenwrite},
1702 /*SBC 0x8a*/{dissect_sbc_write16},
1703 /*SBC 0x8b*/{dissect_sbc_orwrite},
1704 /*SBC 0x8c*/{NULL},
1705 /*SBC 0x8d*/{NULL},
1706 /*SBC 0x8e*/{dissect_sbc_wrverify16},
1707 /*SBC 0x8f*/{dissect_sbc_verify16},
1708 /*SBC 0x90*/{dissect_sbc_prefetch16},
1709 /*SBC 0x91*/{dissect_sbc_synchronizecache16},
1710 /*SBC 0x92*/{NULL},
1711 /*SBC 0x93*/{dissect_sbc_writesame16},
1712 /*SBC 0x94*/{NULL},
1713 /*SBC 0x95*/{NULL},
1714 /*SBC 0x96*/{NULL},
1715 /*SBC 0x97*/{NULL},
1716 /*SBC 0x98*/{NULL},
1717 /*SBC 0x99*/{NULL},
1718 /*SBC 0x9a*/{NULL},
1719 /*SBC 0x9b*/{NULL},
1720 /*SBC 0x9c*/{NULL},
1721 /*SBC 0x9d*/{NULL},
1722 /*SBC 0x9e*/{dissect_sbc_serviceactionin16},
1723 /*SBC 0x9f*/{NULL},
1724 /*SPC 0xa0*/{dissect_spc_reportluns},
1725 /*SBC 0xa1*/{NULL},
1726 /*SBC 0xa2*/{NULL},
1727 /*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
1728 /*SBC 0xa4*/{NULL},
1729 /*SBC 0xa5*/{NULL},
1730 /*SBC 0xa6*/{NULL},
1731 /*SBC 0xa7*/{NULL},
1732 /*SBC 0xa8*/{dissect_sbc_read12},
1733 /*SBC 0xa9*/{NULL},
1734 /*SBC 0xaa*/{dissect_sbc_write12},
1735 /*SBC 0xab*/{NULL},
1736 /*SBC 0xac*/{NULL},
1737 /*SBC 0xad*/{NULL},
1738 /*SBC 0xae*/{dissect_sbc_wrverify12},
1739 /*SBC 0xaf*/{dissect_sbc_verify12},
1740 /*SBC 0xb0*/{NULL},
1741 /*SBC 0xb1*/{NULL},
1742 /*SBC 0xb2*/{NULL},
1743 /*SBC 0xb3*/{NULL},
1744 /*SBC 0xb4*/{NULL},
1745 /*SBC 0xb5*/{NULL},
1746 /*SBC 0xb6*/{NULL},
1747 /*SBC 0xb7*/{dissect_sbc_readdefectdata12},
1748 /*SBC 0xb8*/{NULL},
1749 /*SBC 0xb9*/{NULL},
1750 /*SBC 0xba*/{NULL},
1751 /*SBC 0xbb*/{NULL},
1752 /*SBC 0xbc*/{NULL},
1753 /*SBC 0xbd*/{NULL},
1754 /*SBC 0xbe*/{NULL},
1755 /*SBC 0xbf*/{NULL},
1756 /*SBC 0xc0*/{NULL},
1757 /*SBC 0xc1*/{NULL},
1758 /*SBC 0xc2*/{NULL},
1759 /*SBC 0xc3*/{NULL},
1760 /*SBC 0xc4*/{NULL},
1761 /*SBC 0xc5*/{NULL},
1762 /*SBC 0xc6*/{NULL},
1763 /*SBC 0xc7*/{NULL},
1764 /*SBC 0xc8*/{NULL},
1765 /*SBC 0xc9*/{NULL},
1766 /*SBC 0xca*/{NULL},
1767 /*SBC 0xcb*/{NULL},
1768 /*SBC 0xcc*/{NULL},
1769 /*SBC 0xcd*/{NULL},
1770 /*SBC 0xce*/{NULL},
1771 /*SBC 0xcf*/{NULL},
1772 /*SBC 0xd0*/{NULL},
1773 /*SBC 0xd1*/{NULL},
1774 /*SBC 0xd2*/{NULL},
1775 /*SBC 0xd3*/{NULL},
1776 /*SBC 0xd4*/{NULL},
1777 /*SBC 0xd5*/{NULL},
1778 /*SBC 0xd6*/{NULL},
1779 /*SBC 0xd7*/{NULL},
1780 /*SBC 0xd8*/{NULL},
1781 /*SBC 0xd9*/{NULL},
1782 /*SBC 0xda*/{NULL},
1783 /*SBC 0xdb*/{NULL},
1784 /*SBC 0xdc*/{NULL},
1785 /*SBC 0xdd*/{NULL},
1786 /*SBC 0xde*/{NULL},
1787 /*SBC 0xdf*/{NULL},
1788 /*SBC 0xe0*/{NULL},
1789 /*SBC 0xe1*/{NULL},
1790 /*SBC 0xe2*/{NULL},
1791 /*SBC 0xe3*/{NULL},
1792 /*SBC 0xe4*/{NULL},
1793 /*SBC 0xe5*/{NULL},
1794 /*SBC 0xe6*/{NULL},
1795 /*SBC 0xe7*/{NULL},
1796 /*SBC 0xe8*/{NULL},
1797 /*SBC 0xe9*/{NULL},
1798 /*SBC 0xea*/{NULL},
1799 /*SBC 0xeb*/{NULL},
1800 /*SBC 0xec*/{NULL},
1801 /*SBC 0xed*/{NULL},
1802 /*SBC 0xee*/{NULL},
1803 /*SBC 0xef*/{NULL},
1804 /*SBC 0xf0*/{NULL},
1805 /*SBC 0xf1*/{NULL},
1806 /*SBC 0xf2*/{NULL},
1807 /*SBC 0xf3*/{NULL},
1808 /*SBC 0xf4*/{NULL},
1809 /*SBC 0xf5*/{NULL},
1810 /*SBC 0xf6*/{NULL},
1811 /*SBC 0xf7*/{NULL},
1812 /*SBC 0xf8*/{NULL},
1813 /*SBC 0xf9*/{NULL},
1814 /*SBC 0xfa*/{NULL},
1815 /*SBC 0xfb*/{NULL},
1816 /*SBC 0xfc*/{NULL},
1817 /*SBC 0xfd*/{NULL},
1818 /*SBC 0xfe*/{NULL},
1819 /*SBC 0xff*/{NULL}
1823 void
1824 proto_register_scsi_sbc(void)
1826 static hf_register_info hf[] = {
1827 { &hf_scsi_sbc_opcode,
1828 {"SBC Opcode", "scsi_sbc.opcode", FT_UINT8, BASE_HEX,
1829 VALS (scsi_sbc_vals), 0x0, NULL, HFILL}},
1830 { &hf_scsi_sbc_formatunit_flags,
1831 {"Flags", "scsi_sbc.formatunit.flags", FT_UINT8, BASE_HEX, NULL, 0xF8,
1832 NULL, HFILL}},
1833 { &hf_scsi_sbc_defect_list_format,
1834 {"Defect List Format", "scsi_sbc.defect_list_format", FT_UINT8, BASE_DEC,
1835 NULL, 0x7, NULL, HFILL}},
1836 { &hf_scsi_sbc_formatunit_vendor,
1837 {"Vendor Unique", "scsi_sbc.formatunit.vendor", FT_UINT8, BASE_HEX, NULL,
1838 0x0, NULL, HFILL}},
1839 { &hf_scsi_sbc_formatunit_interleave,
1840 {"Interleave", "scsi_sbc.formatunit.interleave", FT_UINT16, BASE_HEX,
1841 NULL, 0x0, NULL, HFILL}},
1842 { &hf_scsi_sbc_rdwr6_lba,
1843 {"Logical Block Address (LBA)", "scsi_sbc.rdwr6.lba", FT_UINT24, BASE_DEC,
1844 NULL, 0x0FFFFF, NULL, HFILL}},
1845 { &hf_scsi_sbc_rdwr6_xferlen,
1846 {"Transfer Length", "scsi_sbc.rdwr6.xferlen", FT_UINT24, BASE_DEC, NULL, 0x0,
1847 NULL, HFILL}},
1848 { &hf_scsi_sbc_rdwr10_lba,
1849 {"Logical Block Address (LBA)", "scsi_sbc.rdwr10.lba", FT_UINT32, BASE_DEC,
1850 NULL, 0x0, NULL, HFILL}},
1851 { &hf_scsi_sbc_rdwr10_xferlen,
1852 {"Transfer Length", "scsi_sbc.rdwr10.xferlen", FT_UINT16, BASE_DEC, NULL,
1853 0x0, NULL, HFILL}},
1854 { &hf_scsi_sbc_rdwr12_xferlen,
1855 {"Transfer Length", "scsi_sbc.rdwr12.xferlen", FT_UINT32, BASE_DEC, NULL,
1856 0x0, NULL, HFILL}},
1857 { &hf_scsi_sbc_rdwr16_lba,
1858 {"Logical Block Address (LBA)", "scsi_sbc.rdwr16.lba", FT_BYTES, BASE_NONE,
1859 NULL, 0x0, NULL, HFILL}},
1860 { &hf_scsi_sbc_ssu_immed,
1861 {"Immediate", "scsi_sbc.ssu.immediate", FT_BOOLEAN, 8, NULL,
1862 0x01, NULL, HFILL}},
1863 { &hf_scsi_sbc_ssu_pwr_cond,
1864 {"Power Conditions", "scsi_sbc.ssu.pwr", FT_UINT8, BASE_HEX,
1865 VALS (scsi_ssu_pwrcnd_val), 0xF0, NULL, HFILL}},
1866 { &hf_scsi_sbc_ssu_loej,
1867 {"LOEJ", "scsi_sbc.ssu.loej", FT_BOOLEAN, 8, NULL, 0x2, NULL,
1868 HFILL}},
1869 { &hf_scsi_sbc_ssu_start,
1870 {"Start", "scsi_sbc.ssu.start", FT_BOOLEAN, 8, NULL, 0x1,
1871 NULL, HFILL}},
1872 { &hf_scsi_sbc_bytchk,
1873 {"BYTCHK", "scsi_sbc.bytchk", FT_BOOLEAN, 8,
1874 NULL, 0x02, NULL, HFILL}},
1875 #if 0
1876 { &hf_scsi_sbc_verify_reladdr,
1877 {"RELADDR", "scsi_sbc.verify.reladdr", FT_BOOLEAN, 8, NULL,
1878 0x1, NULL, HFILL}},
1879 #endif
1880 { &hf_scsi_sbc_verify_lba,
1881 {"LBA", "scsi_sbc.verify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
1882 HFILL}},
1883 { &hf_scsi_sbc_verify_lba64,
1884 {"LBA", "scsi_sbc.verify.lba64", FT_UINT64, BASE_DEC, NULL, 0x0, NULL,
1885 HFILL}},
1886 { &hf_scsi_sbc_verify_vlen,
1887 {"Verification Length", "scsi_sbc.verify.vlen", FT_UINT16,
1888 BASE_DEC, NULL, 0x0, NULL, HFILL}},
1889 { &hf_scsi_sbc_verify_vlen32,
1890 {"Verification Length", "scsi_sbc.verify.vlen32", FT_UINT32,
1891 BASE_DEC, NULL, 0x0, NULL, HFILL}},
1892 { &hf_scsi_sbc_wrverify_lba,
1893 {"LBA", "scsi_sbc.wrverify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
1894 HFILL}},
1895 { &hf_scsi_sbc_wrverify_xferlen,
1896 {"Transfer Length", "scsi_sbc.wrverify.xferlen", FT_UINT16, BASE_DEC,
1897 NULL, 0x0, NULL, HFILL}},
1898 { &hf_scsi_sbc_wrverify_lba64,
1899 {"LBA", "scsi_sbc.wrverify.lba64", FT_UINT64, BASE_DEC, NULL, 0x0,
1900 NULL, HFILL}},
1901 { &hf_scsi_sbc_wrverify_xferlen32,
1902 {"Transfer Length", "scsi_sbc.wrverify.xferlen32", FT_UINT32,
1903 BASE_DEC, NULL, 0x0, NULL, HFILL}},
1904 #if 0
1905 { &hf_scsi_sbc_readcapacity_flags,
1906 {"Flags", "scsi_sbc.readcapacity.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
1907 NULL, HFILL}},
1908 #endif
1909 { &hf_scsi_sbc_readdefdata_flags,
1910 {"Flags", "scsi_sbc.readdefdata.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1911 HFILL}},
1912 { &hf_scsi_sbc_reassignblks_flags,
1913 {"Flags", "scsi_sbc.reassignblks.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1914 HFILL}},
1915 { &hf_scsi_sbc_read_flags,
1916 {"Flags", "scsi_sbc.read.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1917 HFILL}},
1918 { &hf_scsi_sbc_alloclen32,
1919 {"Allocation Length", "scsi_sbc.alloclen32", FT_UINT32, BASE_DEC,
1920 NULL, 0x0, NULL, HFILL}},
1921 { &hf_scsi_sbc_alloclen16,
1922 {"Allocation Length", "scsi_sbc.alloclen16", FT_UINT16, BASE_DEC,
1923 NULL, 0x0, NULL, HFILL}},
1924 { &hf_scsi_sbc_fuflags_fmtpinfo,
1925 {"FMTPINFO", "scsi_sbc.format_unit.fmtpinfo", FT_BOOLEAN, 8,
1926 NULL, 0x80, NULL, HFILL}},
1927 { &hf_scsi_sbc_fuflags_rto_req,
1928 {"RTO_REQ", "scsi_sbc.format_unit.rto_req", FT_BOOLEAN, 8,
1929 NULL, 0x40, NULL, HFILL}},
1930 { &hf_scsi_sbc_fuflags_longlist,
1931 {"LONGLIST", "scsi_sbc.format_unit.longlist", FT_BOOLEAN, 8,
1932 NULL, 0x20, NULL, HFILL}},
1933 { &hf_scsi_sbc_fuflags_fmtdata,
1934 {"FMTDATA", "scsi_sbc.format_unit.fmtdata", FT_BOOLEAN, 8,
1935 NULL, 0x10, NULL, HFILL}},
1936 { &hf_scsi_sbc_fuflags_cmplist,
1937 {"CMPLIST", "scsi_sbc.format_unit.cmplist", FT_BOOLEAN, 8,
1938 NULL, 0x08, NULL, HFILL}},
1939 { &hf_scsi_sbc_prefetch_flags,
1940 {"Flags", "scsi_sbc.prefetch.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1941 HFILL}},
1942 { &hf_scsi_sbc_prefetch_immed,
1943 {"Immediate", "scsi_sbc.prefetch.immediate", FT_BOOLEAN, 8, NULL,
1944 0x2, NULL, HFILL}},
1945 { &hf_scsi_sbc_group,
1946 {"Group", "scsi_sbc.group", FT_UINT8, BASE_HEX, NULL,
1947 0x1f, NULL, HFILL}},
1948 { &hf_scsi_sbc_rdprotect,
1949 {"RDPROTECT", "scsi_sbc.rdprotect", FT_UINT8, BASE_HEX,
1950 NULL, 0xe0, NULL, HFILL}},
1951 { &hf_scsi_sbc_dpo,
1952 {"DPO", "scsi_sbc.dpo", FT_BOOLEAN, 8,
1953 TFS(&dpo_tfs), 0x10, "DisablePageOut: Whether the device should cache the data or not", HFILL}},
1954 { &hf_scsi_sbc_fua,
1955 {"FUA", "scsi_sbc.fua", FT_BOOLEAN, 8,
1956 TFS(&fua_tfs), 0x08, "ForceUnitAccess: Whether to allow reading from the cache or not", HFILL}},
1957 { &hf_scsi_sbc_fua_nv,
1958 {"FUA_NV", "scsi_sbc.fua_nv", FT_BOOLEAN, 8,
1959 TFS(&fua_nv_tfs), 0x02, "ForceUnitAccess_NonVolatile: Whether to allow reading from non-volatile cache or not", HFILL}},
1960 { &hf_scsi_sbc_blocksize,
1961 {"Block size in bytes", "scsi_sbc.blocksize", FT_UINT32, BASE_DEC,
1962 NULL, 0, NULL, HFILL}},
1963 { &hf_scsi_sbc_returned_lba,
1964 {"Returned LBA", "scsi_sbc.returned_lba", FT_UINT32, BASE_DEC,
1965 NULL, 0, NULL, HFILL}},
1966 { &hf_scsi_sbc_req_plist,
1967 {"REQ_PLIST", "scsi_sbc.req_plist", FT_BOOLEAN, 8,
1968 NULL, 0x10, NULL, HFILL}},
1969 { &hf_scsi_sbc_req_glist,
1970 {"REQ_GLIST", "scsi_sbc.req_glist", FT_BOOLEAN, 8,
1971 NULL, 0x08, NULL, HFILL}},
1972 { &hf_scsi_sbc_corrct,
1973 {"CORRCT", "scsi_sbc.corrct", FT_BOOLEAN, 8,
1974 NULL, 0x02, NULL, HFILL}},
1975 { &hf_scsi_sbc_corrct_flags,
1976 {"Flags", "scsi_sbc.corrct_flags", FT_UINT8, BASE_HEX,
1977 NULL, 0, NULL, HFILL}},
1978 { &hf_scsi_sbc_reassignblocks_longlba,
1979 {"LongLBA", "scsi_sbc.reassignblocks.longlba", FT_BOOLEAN, 8,
1980 NULL, 0x02, NULL, HFILL}},
1981 { &hf_scsi_sbc_reassignblocks_longlist,
1982 {"LongList", "scsi_sbc.reassignblocks.longlist", FT_BOOLEAN, 8,
1983 NULL, 0x01, NULL, HFILL}},
1984 { &hf_scsi_sbc_ssu_immed_flags,
1985 {"Immed flags", "scsi_sbc.ssu.immed_flags", FT_UINT8, BASE_HEX,
1986 NULL, 0, NULL, HFILL}},
1987 { &hf_scsi_sbc_ssu_pwr_flags,
1988 {"Pwr flags", "scsi_sbc.ssu.pwr_flags", FT_UINT8, BASE_HEX,
1989 NULL, 0, NULL, HFILL}},
1990 { &hf_scsi_sbc_synccache_flags,
1991 {"Flags", "scsi_sbc.synccache.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1992 HFILL}},
1993 { &hf_scsi_sbc_synccache_immed,
1994 {"Immediate", "scsi_sbc.synccache.immediate", FT_BOOLEAN, 8, NULL,
1995 0x02, NULL, HFILL}},
1996 { &hf_scsi_sbc_synccache_sync_nv,
1997 {"SYNC_NV", "scsi_sbc.synccache.sync_nv", FT_BOOLEAN, 8, NULL,
1998 0x04, NULL, HFILL}},
1999 { &hf_scsi_sbc_vrprotect,
2000 {"VRPROTECT", "scsi_sbc.vrprotect", FT_UINT8, BASE_HEX,
2001 NULL, 0xe0, NULL, HFILL}},
2002 { &hf_scsi_sbc_verify_flags,
2003 {"Flags", "scsi_sbc.verify_flags", FT_UINT8, BASE_HEX,
2004 NULL, 0, NULL, HFILL}},
2005 { &hf_scsi_sbc_wrprotect,
2006 {"WRPROTECT", "scsi_sbc.wrprotect", FT_UINT8, BASE_HEX,
2007 NULL, 0xe0, NULL, HFILL}},
2008 { &hf_scsi_sbc_wrverify_flags,
2009 {"Flags", "scsi_sbc.wrverify_flags", FT_UINT8, BASE_HEX,
2010 NULL, 0, NULL, HFILL}},
2011 { &hf_scsi_sbc_writesame_flags,
2012 {"Flags", "scsi_sbc.writesame_flags", FT_UINT8, BASE_HEX,
2013 NULL, 0, NULL, HFILL}},
2014 { &hf_scsi_sbc_anchor,
2015 {"ANCHOR", "scsi_sbc.anchor", FT_BOOLEAN, 8, NULL,
2016 0x10, NULL, HFILL}},
2017 { &hf_scsi_sbc_unmap,
2018 {"UNMAP", "scsi_sbc.unmap", FT_BOOLEAN, 8, NULL,
2019 0x08, NULL, HFILL}},
2020 { &hf_scsi_sbc_pbdata,
2021 {"PBDATA", "scsi_sbc.pbdata", FT_BOOLEAN, 8, NULL,
2022 0x04, NULL, HFILL}},
2023 { &hf_scsi_sbc_lbdata,
2024 {"LBDATA", "scsi_sbc.lbdata", FT_BOOLEAN, 8, NULL,
2025 0x02, NULL, HFILL}},
2026 { &hf_scsi_sbc_xdread_flags,
2027 {"Flags", "scsi_sbc.xdread.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2028 HFILL}},
2029 { &hf_scsi_sbc_xorpinfo,
2030 {"XORPINFO", "scsi_sbc.xorpinfo", FT_BOOLEAN, 8, NULL,
2031 0x01, NULL, HFILL}},
2032 { &hf_scsi_sbc_disable_write,
2033 {"DISABLE_WRITE", "scsi_sbc.disable_write", FT_BOOLEAN, 8, NULL,
2034 0x04, NULL, HFILL}},
2035 { &hf_scsi_sbc_xdwrite_flags,
2036 {"Flags", "scsi_sbc.xdwrite.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2037 HFILL}},
2038 { &hf_scsi_sbc_xdwriteread_flags,
2039 {"Flags", "scsi_sbc.xdwriteread.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2040 HFILL}},
2041 { &hf_scsi_sbc_xpwrite_flags,
2042 {"Flags", "scsi_sbc.xpwrite.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
2043 HFILL}},
2044 { &hf_scsi_sbc_unmap_anchor,
2045 {"ANCHOR", "scsi_sbc.unmap.anchor", FT_BOOLEAN, 8, NULL,
2046 0x01, NULL, HFILL}},
2047 { &hf_scsi_sbc_unmap_flags,
2048 {"Flags", "scsi_sbc.unmap_flags", FT_UINT8, BASE_HEX,
2049 NULL, 0, NULL, HFILL}},
2050 { &hf_scsi_sbc_unmap_data_length,
2051 {"Data Length", "scsi_sbc.unmap.data_length", FT_UINT16, BASE_DEC,
2052 NULL, 0, NULL, HFILL}},
2053 { &hf_scsi_sbc_unmap_block_descriptor_data_length,
2054 {"Block Descriptor Data Length", "scsi_sbc.unmap.block_descriptor_data_length", FT_UINT16, BASE_DEC,
2055 NULL, 0, NULL, HFILL}},
2056 { &hf_scsi_sbc_unmap_lba,
2057 {"LBA", "scsi_sbc.unmap.lba", FT_UINT64, BASE_DEC,
2058 NULL, 0, NULL, HFILL}},
2059 { &hf_scsi_sbc_unmap_num_blocks,
2060 {"Num Blocks", "scsi_sbc.unmap.num_blocks", FT_UINT32, BASE_DEC,
2061 NULL, 0, NULL, HFILL}},
2062 { &hf_scsi_sbc_ptype,
2063 {"PTYPE", "scsi_sbc.ptype", FT_UINT8, BASE_DEC,
2064 VALS(scsi_ptype_val), 0x0e, NULL, HFILL}},
2065 { &hf_scsi_sbc_prot_en,
2066 {"PROT_EN", "scsi_sbc.prot_en", FT_BOOLEAN, 8,
2067 NULL, 0x01, NULL, HFILL}},
2068 { &hf_scsi_sbc_p_i_exponent,
2069 {"P_I_EXPONENT", "scsi_sbc.p_i_exponent", FT_UINT8, BASE_DEC,
2070 NULL, 0xf0, NULL, HFILL}},
2071 { &hf_scsi_sbc_lbppbe,
2072 {"LOGICAL_BLOCKS_PER_PHYSICAL_BLOCK_EXPONENT", "scsi_sbc.lbppbe", FT_UINT8, BASE_DEC,
2073 NULL, 0x0f, NULL, HFILL}},
2074 { &hf_scsi_sbc_lbpme,
2075 {"LBPME", "scsi_sbc.lbpme", FT_BOOLEAN, 8,
2076 NULL, 0x80, NULL, HFILL}},
2077 { &hf_scsi_sbc_lbprz,
2078 {"LBPRZ", "scsi_sbc.lbprz", FT_BOOLEAN, 8,
2079 NULL, 0x40, NULL, HFILL}},
2080 { &hf_scsi_sbc_lalba,
2081 {"LOWEST_ALIGNED_LBA", "scsi_sbc.lalba", FT_UINT16, BASE_DEC,
2082 NULL, 0x3fff, NULL, HFILL}},
2083 { &hf_scsi_sbc_get_lba_status_lba,
2084 {"LBA", "scsi_sbc.get_lba_status.start_lba", FT_UINT64, BASE_DEC,
2085 NULL, 0, NULL, HFILL}},
2086 { &hf_scsi_sbc_get_lba_status_data_length,
2087 {"Data Length", "scsi_sbc.get_lba_status.data_length", FT_UINT32, BASE_DEC,
2088 NULL, 0, NULL, HFILL}},
2089 { &hf_scsi_sbc_get_lba_status_num_blocks,
2090 {"Num Blocks", "scsi_sbc.get_lba_status.num_blocks", FT_UINT32, BASE_DEC,
2091 NULL, 0, NULL, HFILL}},
2092 { &hf_scsi_sbc_get_lba_status_provisioning_status,
2093 {"Provisioning Type", "scsi_sbc.get_lba_status.provisioning_type", FT_UINT8, BASE_DEC,
2094 VALS(scsi_provisioning_type_val), 0x07, NULL, HFILL}},
2095 { &hf_scsi_sbc_sanitize_sa,
2096 {"Service Action", "scsi_sbc.sanitize.sa", FT_UINT8, BASE_HEX, VALS(sanitize_val),
2097 0x1f, NULL, HFILL}},
2098 { &hf_scsi_sbc_sanitize_ause,
2099 {"AUSE", "scsi_sbc.sanitize.ause", FT_BOOLEAN, 8, NULL,
2100 0x20, NULL, HFILL}},
2101 { &hf_scsi_sbc_sanitize_immed,
2102 {"IMMED", "scsi_sbc.sanitize.immed", FT_BOOLEAN, 8, NULL,
2103 0x80, NULL, HFILL}},
2104 { &hf_scsi_sbc_sanitize_flags,
2105 {"Flags", "scsi_sbc.sanitize_flags", FT_UINT8, BASE_HEX,
2106 NULL, 0, NULL, HFILL}},
2107 { &hf_scsi_sbc_sanitize_overwrite_flags,
2108 {"Flags", "scsi_sbc.sanitize_overwrite_flags", FT_UINT8, BASE_HEX,
2109 NULL, 0, NULL, HFILL}},
2110 { &hf_scsi_sbc_sanitize_invert,
2111 {"INVERT", "scsi_sbc.sanitize.invert", FT_BOOLEAN, 8, NULL,
2112 0x80, NULL, HFILL}},
2113 { &hf_scsi_sbc_sanitize_test,
2114 {"TEST", "scsi_sbc.sanitize.test", FT_UINT8, BASE_HEX, NULL,
2115 0x60, NULL, HFILL}},
2116 { &hf_scsi_sbc_sanitize_owcount,
2117 {"Overwrite Count", "scsi_sbc.sanitize.overwrite_count", FT_UINT8, BASE_HEX, NULL,
2118 0x1f, NULL, HFILL}},
2119 { &hf_scsi_sbc_sanitize_pattern_length,
2120 {"Initialization Pattern Length", "scsi_sbc.sanitize.pattern_length", FT_UINT16, BASE_DEC, NULL,
2121 0, NULL, HFILL}},
2122 { &hf_scsi_sbc_sanitize_pattern,
2123 {"Initialization Pattern", "scsi_sbc.sanitize.pattern", FT_BYTES, BASE_NONE, NULL,
2124 0, NULL, HFILL}},
2128 /* Setup protocol subtree array */
2129 static gint *ett[] = {
2130 &ett_scsi_format_unit,
2131 &ett_scsi_prefetch,
2132 &ett_scsi_rdwr,
2133 &ett_scsi_xdread,
2134 &ett_scsi_xdwrite,
2135 &ett_scsi_xdwriteread,
2136 &ett_scsi_xpwrite,
2137 &ett_scsi_defectdata,
2138 &ett_scsi_corrct,
2139 &ett_scsi_reassign_blocks,
2140 &ett_scsi_ssu_immed,
2141 &ett_scsi_ssu_pwr,
2142 &ett_scsi_synccache,
2143 &ett_scsi_verify,
2144 &ett_scsi_wrverify,
2145 &ett_scsi_writesame,
2146 &ett_scsi_unmap,
2147 &ett_scsi_unmap_block_descriptor,
2148 &ett_scsi_lba_status_descriptor,
2149 &ett_scsi_sanitize,
2150 &ett_scsi_sanitize_overwrite
2153 /* Register the protocol name and description */
2154 proto_scsi_sbc = proto_register_protocol("SCSI_SBC", "SCSI_SBC", "scsi_sbc");
2156 /* Required function calls to register the header fields and subtrees used */
2157 proto_register_field_array(proto_scsi_sbc, hf, array_length(hf));
2158 proto_register_subtree_array(ett, array_length(ett));
2161 void
2162 proto_reg_handoff_scsi_sbc(void)
2168 * Editor modelines - http://www.wireshark.org/tools/modelines.html
2170 * Local variables:
2171 * c-basic-offset: 4
2172 * tab-width: 4
2173 * indent-tabs-mode: nil
2174 * End:
2176 * vi: set shiftwidth=4 tabstop=4 expandtab:
2177 * :indentSize=4:tabSize=4:noTabs=true: