From Didier Gautheron:
[obnox/wireshark/wip.git] / epan / dissectors / packet-scsi-sbc.c
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.
10  */
11 /* packet-scsi-sbc.c
12  * Dissector for the SCSI SBC commandset
13  * Extracted from packet-scsi.c
14  *
15  * Dinesh G Dutt (ddutt@cisco.com)
16  * Ronnie sahlberg 2006
17  *
18  * $Id$
19  *
20  * Wireshark - Network traffic analyzer
21  * By Gerald Combs <gerald@wireshark.org>
22  * Copyright 2002 Gerald Combs
23  *
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.
28  *
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.
33  *
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
37  */
38
39 #ifdef HAVE_CONFIG_H
40 # include "config.h"
41 #endif
42
43 #include <glib.h>
44 #include <string.h>
45 #include <epan/strutil.h>
46 #include <epan/packet.h>
47 #include <epan/conversation.h>
48 #include <epan/tap.h>
49 #include "packet-scsi.h"
50 #include "packet-fc.h"
51 #include "packet-scsi-sbc.h"
52
53
54 static int proto_scsi_sbc                       = -1;
55 int hf_scsi_sbc_opcode                          = -1;
56 static int hf_scsi_sbc_formatunit_flags         = -1;
57 static int hf_scsi_sbc_defect_list_format       = -1;
58 static int hf_scsi_sbc_formatunit_vendor        = -1;
59 static int hf_scsi_sbc_formatunit_interleave    = -1;
60 static int hf_scsi_sbc_rdwr6_lba                = -1;
61 static int hf_scsi_sbc_rdwr6_xferlen            = -1;
62 static int hf_scsi_sbc_rdwr10_lba               = -1;
63 static int hf_scsi_sbc_rdwr10_xferlen           = -1;
64 static int hf_scsi_sbc_rdwr12_xferlen           = -1;
65 static int hf_scsi_sbc_rdwr16_lba               = -1;
66 static int hf_scsi_sbc_ssu_immed_flags          = -1;
67 static int hf_scsi_sbc_ssu_immed                = -1;
68 static int hf_scsi_sbc_ssu_pwr_flags            = -1;
69 static int hf_scsi_sbc_ssu_pwr_cond             = -1;
70 static int hf_scsi_sbc_ssu_loej                 = -1;
71 static int hf_scsi_sbc_ssu_start                = -1;
72 static int hf_scsi_sbc_bytchk                   = -1;
73 static int hf_scsi_sbc_verify_reladdr           = -1;
74 static int hf_scsi_sbc_verify_lba               = -1;
75 static int hf_scsi_sbc_verify_lba64             = -1;
76 static int hf_scsi_sbc_verify_vlen              = -1;
77 static int hf_scsi_sbc_verify_vlen32            = -1;
78 static int hf_scsi_sbc_wrverify_lba             = -1;
79 static int hf_scsi_sbc_wrverify_xferlen         = -1;
80 static int hf_scsi_sbc_wrverify_lba64           = -1;
81 static int hf_scsi_sbc_wrverify_xferlen32       = -1;
82 static int hf_scsi_sbc_readcapacity_flags       = -1;
83 static int hf_scsi_sbc_readcapacity_lba         = -1;
84 static int hf_scsi_sbc_readdefdata_flags        = -1;
85 static int hf_scsi_sbc_reassignblks_flags       = -1;
86 static int hf_scsi_sbc_read_flags               = -1;
87 static int hf_scsi_sbc_alloclen32               = -1;
88 static int hf_scsi_sbc_alloclen16               = -1;
89 static int hf_scsi_sbc_fuflags_fmtpinfo         = -1;
90 static int hf_scsi_sbc_fuflags_rto_req          = -1;
91 static int hf_scsi_sbc_fuflags_longlist         = -1;
92 static int hf_scsi_sbc_fuflags_fmtdata          = -1;
93 static int hf_scsi_sbc_fuflags_cmplist          = -1;
94 static int hf_scsi_sbc_prefetch_flags           = -1;
95 static int hf_scsi_sbc_prefetch_immed           = -1;
96 static int hf_scsi_sbc_group                    = -1;
97 static int hf_scsi_sbc_rdprotect                = -1;
98 static int hf_scsi_sbc_dpo                      = -1;
99 static int hf_scsi_sbc_fua                      = -1;
100 static int hf_scsi_sbc_fua_nv                   = -1;
101 static int hf_scsi_sbc_pmi_flags                = -1;
102 static int hf_scsi_sbc_pmi                      = -1;
103 static int hf_scsi_sbc_blocksize                = -1;
104 static int hf_scsi_sbc_returned_lba             = -1;
105 static int hf_scsi_sbc_req_plist                = -1;
106 static int hf_scsi_sbc_req_glist                = -1;
107 static int hf_scsi_sbc_corrct_flags             = -1;
108 static int hf_scsi_sbc_corrct                   = -1;
109 static int hf_scsi_sbc_reassignblocks_longlba   = -1;
110 static int hf_scsi_sbc_reassignblocks_longlist  = -1;
111 static int hf_scsi_sbc_synccache_flags          = -1;
112 static int hf_scsi_sbc_synccache_immed          = -1;
113 static int hf_scsi_sbc_synccache_sync_nv        = -1;
114 static int hf_scsi_sbc_vrprotect                = -1;
115 static int hf_scsi_sbc_verify_flags             = -1;
116 static int hf_scsi_sbc_wrprotect                = -1;
117 static int hf_scsi_sbc_wrverify_flags           = -1;
118 static int hf_scsi_sbc_writesame_flags          = -1;
119 static int hf_scsi_sbc_pbdata                   = -1;
120 static int hf_scsi_sbc_lbdata                   = -1;
121 static int hf_scsi_sbc_xdread_flags             = -1;
122 static int hf_scsi_sbc_xorpinfo                 = -1;
123 static int hf_scsi_sbc_disable_write            = -1;
124 static int hf_scsi_sbc_xdwrite_flags            = -1;
125 static int hf_scsi_sbc_xdwriteread_flags        = -1;
126 static int hf_scsi_sbc_xpwrite_flags            = -1;
127
128 static gint ett_scsi_format_unit                = -1;
129 static gint ett_scsi_prefetch                   = -1;
130 static gint ett_scsi_rdwr                       = -1;
131 static gint ett_scsi_xdread                     = -1;
132 static gint ett_scsi_xdwrite                    = -1;
133 static gint ett_scsi_xdwriteread                = -1;
134 static gint ett_scsi_xpwrite                    = -1;
135 static gint ett_scsi_pmi                        = -1;
136 static gint ett_scsi_defectdata                 = -1;
137 static gint ett_scsi_corrct                     = -1;
138 static gint ett_scsi_reassign_blocks            = -1;
139 static gint ett_scsi_ssu_immed                  = -1;
140 static gint ett_scsi_ssu_pwr                    = -1;
141 static gint ett_scsi_synccache                  = -1;
142 static gint ett_scsi_verify                     = -1;
143 static gint ett_scsi_wrverify                   = -1;
144 static gint ett_scsi_writesame                  = -1;
145
146
147
148 static const true_false_string dpo_tfs = {
149     "Disable Page Out (don't cache this data)",
150     "Disable page out is DISABLED (cache this data)"
151 };
152 static const true_false_string fua_tfs = {
153     "Read from the medium, not cache",
154     "Read from cache if possible"
155 };
156 static const true_false_string fua_nv_tfs = {
157     "Read from volatile cache is NOT permitted",
158     "Read from volatile or non-volatile cache permitted"
159 };
160 static const true_false_string pmi_tfs = {
161     "PMI is SET",
162     "Pmi is CLEAR"
163 };
164
165 static void
166 dissect_sbc_formatunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
167                          guint offset, gboolean isreq, gboolean iscdb,
168                          guint payload_len _U_, scsi_task_data_t *cdata _U_)
169 {
170     guint8 flags;
171     static const int *fuflags_fields[] = {
172         &hf_scsi_sbc_fuflags_fmtpinfo,
173         &hf_scsi_sbc_fuflags_rto_req,
174         &hf_scsi_sbc_fuflags_longlist,
175         &hf_scsi_sbc_fuflags_fmtdata,
176         &hf_scsi_sbc_fuflags_cmplist,
177         &hf_scsi_sbc_defect_list_format,
178         NULL
179     };
180
181     if (!tree)
182         return;
183
184     if (isreq && iscdb) {
185         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_formatunit_flags, ett_scsi_format_unit, fuflags_fields, FALSE);
186
187         proto_tree_add_item (tree, hf_scsi_sbc_formatunit_vendor, tvb, offset+1,
188                              1, 0);
189         proto_tree_add_item (tree, hf_scsi_sbc_formatunit_interleave, tvb, offset+2,
190                              2, 0);
191         flags = tvb_get_guint8 (tvb, offset+4);
192         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
193                                     flags,
194                                     "Vendor Unique = %u, NACA = %u, Link = %u",
195                                     flags & 0xC0, flags & 0x4, flags & 0x1);
196     }
197     /* TODO : add dissection of DATA */
198 }
199
200 static void
201 dissect_sbc_read6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
202                     guint offset, gboolean isreq, gboolean iscdb,
203                     guint payload_len _U_, scsi_task_data_t *cdata _U_)
204 {
205     guint8 flags;
206
207     if (isreq && iscdb) {
208         if (check_col (pinfo->cinfo, COL_INFO))
209             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)",
210                              tvb_get_ntoh24 (tvb, offset),
211                              tvb_get_guint8 (tvb, offset+3));
212     }
213
214     if (tree && isreq && iscdb) {
215         proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_lba, tvb, offset, 3, 0);
216         proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_xferlen, tvb, offset+3, 1, 0);
217         flags = tvb_get_guint8 (tvb, offset+4);
218         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
219                                     flags,
220                                     "Vendor Unique = %u, NACA = %u, Link = %u",
221                                     flags & 0xC0, flags & 0x4, flags & 0x1);
222     }
223 }
224
225 static void
226 dissect_sbc_write6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
227                     guint offset, gboolean isreq, gboolean iscdb,
228                     guint payload_len _U_, scsi_task_data_t *cdata _U_)
229 {
230     guint8 flags;
231
232     if (isreq && iscdb) {
233         if (check_col (pinfo->cinfo, COL_INFO))
234             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)",
235                              tvb_get_ntoh24 (tvb, offset),
236                              tvb_get_guint8 (tvb, offset+3));
237     }
238
239     if (tree && isreq && iscdb) {
240         proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_lba, tvb, offset, 3, 0);
241         proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_xferlen, tvb, offset+3, 1, 0);
242         flags = tvb_get_guint8 (tvb, offset+4);
243         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
244                                     flags,
245                                     "Vendor Unique = %u, NACA = %u, Link = %u",
246                                     flags & 0xC0, flags & 0x4, flags & 0x1);
247     }
248 }
249
250 static void
251 dissect_sbc_prefetch10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
252                      guint offset, gboolean isreq, gboolean iscdb,
253                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
254
255 {
256     guint8 flags;
257     static const int *prefetch_fields[] = {
258         &hf_scsi_sbc_prefetch_immed,
259         NULL
260     };
261
262     if (isreq && iscdb) {
263         if (check_col (pinfo->cinfo, COL_INFO))
264             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
265                              tvb_get_ntohl (tvb, offset+1),
266                              tvb_get_ntohs (tvb, offset+6));
267     }
268
269     if (tree && isreq && iscdb) {
270         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_prefetch_flags, ett_scsi_prefetch, prefetch_fields, FALSE);
271
272         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
273
274         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
275
276         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
277         flags = tvb_get_guint8 (tvb, offset+8);
278         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
279                                     flags,
280                                     "Vendor Unique = %u, NACA = %u, Link = %u",
281                                     flags & 0xC0, flags & 0x4, flags & 0x1);
282     }
283 }
284
285 static void
286 dissect_sbc_synchronizecache10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
287                      guint offset, gboolean isreq, gboolean iscdb,
288                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
289
290 {
291     guint8 flags;
292     static const int *sync_fields[] = {
293         &hf_scsi_sbc_synccache_sync_nv,
294         &hf_scsi_sbc_synccache_immed,
295         NULL
296     };
297
298     if (isreq && iscdb) {
299         if (check_col (pinfo->cinfo, COL_INFO))
300             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
301                              tvb_get_ntohl (tvb, offset+1),
302                              tvb_get_ntohs (tvb, offset+6));
303     }
304
305     if (tree && isreq && iscdb) {
306         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_synccache_flags, ett_scsi_synccache, sync_fields, FALSE);
307
308         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
309
310         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
311
312         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
313         flags = tvb_get_guint8 (tvb, offset+8);
314         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
315                                     flags,
316                                     "Vendor Unique = %u, NACA = %u, Link = %u",
317                                     flags & 0xC0, flags & 0x4, flags & 0x1);
318     }
319 }
320
321 static void
322 dissect_sbc_synchronizecache16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
323                      guint offset, gboolean isreq, gboolean iscdb,
324                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
325
326 {
327     guint8 flags;
328     static const int *sync_fields[] = {
329         &hf_scsi_sbc_synccache_sync_nv,
330         &hf_scsi_sbc_synccache_immed,
331         NULL
332     };
333
334     if (isreq && iscdb) {
335         if (check_col (pinfo->cinfo, COL_INFO))
336             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
337                              tvb_get_ntoh64 (tvb, offset+1),
338                              tvb_get_ntohl (tvb, offset+9));
339     }
340
341     if (tree && isreq && iscdb) {
342         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_synccache_flags, ett_scsi_synccache, sync_fields, FALSE);
343
344         proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, 0);
345         proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, 0);
346         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);
347
348         flags = tvb_get_guint8 (tvb, offset+14);
349         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
350                                     flags,
351                                     "Vendor Unique = %u, NACA = %u, Link = %u",
352                                     flags & 0xC0, flags & 0x4, flags & 0x1);
353     }
354 }
355
356 static void
357 dissect_sbc_prefetch16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
358                      guint offset, gboolean isreq, gboolean iscdb,
359                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
360
361 {
362     guint8 flags;
363     static const int *prefetch_fields[] = {
364         &hf_scsi_sbc_prefetch_immed,
365         NULL
366     };
367
368     if (isreq && iscdb) {
369         if (check_col (pinfo->cinfo, COL_INFO))
370             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
371                              tvb_get_ntoh64 (tvb, offset+1),
372                              tvb_get_ntohl (tvb, offset+9));
373     }
374
375     if (tree && isreq && iscdb) {
376         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_prefetch_flags, ett_scsi_prefetch, prefetch_fields, FALSE);
377
378         proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, 0);
379         proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, 0);
380         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);
381
382         flags = tvb_get_guint8 (tvb, offset+14);
383         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
384                                     flags,
385                                     "Vendor Unique = %u, NACA = %u, Link = %u",
386                                     flags & 0xC0, flags & 0x4, flags & 0x1);
387     }
388 }
389
390 void
391 dissect_sbc_read10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
392                      guint offset, gboolean isreq, gboolean iscdb,
393                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
394
395 {
396     guint8 flags;
397     static const int *rdwr10_fields[] = {
398         &hf_scsi_sbc_rdprotect,
399         &hf_scsi_sbc_dpo,
400         &hf_scsi_sbc_fua,
401         &hf_scsi_sbc_fua_nv,
402         NULL
403     };
404
405     if (isreq && iscdb) {
406         if (check_col (pinfo->cinfo, COL_INFO))
407             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
408                              tvb_get_ntohl (tvb, offset+1),
409                              tvb_get_ntohs (tvb, offset+6));
410     }
411
412     if (tree && isreq && iscdb) {
413         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr10_fields, FALSE);
414
415         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
416         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
417
418         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
419         flags = tvb_get_guint8 (tvb, offset+8);
420         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
421                                     flags,
422                                     "Vendor Unique = %u, NACA = %u, Link = %u",
423                                     flags & 0xC0, flags & 0x4, flags & 0x1);
424     }
425 }
426
427 static void
428 dissect_sbc_xdread10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
429                      guint offset, gboolean isreq, gboolean iscdb,
430                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
431
432 {
433     guint8 flags;
434     static const int *xdread10_fields[] = {
435         &hf_scsi_sbc_xorpinfo,
436         NULL
437     };
438
439     if (isreq && iscdb) {
440         if (check_col (pinfo->cinfo, COL_INFO))
441             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
442                              tvb_get_ntohl (tvb, offset+1),
443                              tvb_get_ntohs (tvb, offset+6));
444     }
445
446     if (tree && isreq && iscdb) {
447         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdread_flags, ett_scsi_xdread, xdread10_fields, FALSE);
448
449         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
450         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
451
452         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
453         flags = tvb_get_guint8 (tvb, offset+8);
454         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
455                                     flags,
456                                     "Vendor Unique = %u, NACA = %u, Link = %u",
457                                     flags & 0xC0, flags & 0x4, flags & 0x1);
458     }
459 }
460
461 static void
462 dissect_sbc_xdwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
463                      guint offset, gboolean isreq, gboolean iscdb,
464                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
465
466 {
467     guint8 flags;
468     static const int *xdwrite10_fields[] = {
469         &hf_scsi_sbc_wrprotect,
470         &hf_scsi_sbc_dpo,
471         &hf_scsi_sbc_fua,
472         &hf_scsi_sbc_disable_write,
473         &hf_scsi_sbc_fua_nv,
474         NULL
475     };
476
477     if (isreq && iscdb) {
478         if (check_col (pinfo->cinfo, COL_INFO))
479             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
480                              tvb_get_ntohl (tvb, offset+1),
481                              tvb_get_ntohs (tvb, offset+6));
482     }
483
484     if (tree && isreq && iscdb) {
485         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdwrite_flags, ett_scsi_xdwrite, xdwrite10_fields, FALSE);
486
487         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
488         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
489
490         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
491         flags = tvb_get_guint8 (tvb, offset+8);
492         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
493                                     flags,
494                                     "Vendor Unique = %u, NACA = %u, Link = %u",
495                                     flags & 0xC0, flags & 0x4, flags & 0x1);
496     }
497 }
498
499 static void
500 dissect_sbc_xdwriteread10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
501                      guint offset, gboolean isreq, gboolean iscdb,
502                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
503
504 {
505     guint8 flags;
506     static const int *xdwriteread10_fields[] = {
507         &hf_scsi_sbc_wrprotect,
508         &hf_scsi_sbc_dpo,
509         &hf_scsi_sbc_fua,
510         &hf_scsi_sbc_disable_write,
511         &hf_scsi_sbc_fua_nv,
512         &hf_scsi_sbc_xorpinfo,
513         NULL
514     };
515
516     if (isreq && iscdb) {
517         if (check_col (pinfo->cinfo, COL_INFO))
518             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
519                              tvb_get_ntohl (tvb, offset+1),
520                              tvb_get_ntohs (tvb, offset+6));
521     }
522
523     if (tree && isreq && iscdb) {
524         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xdwriteread_flags, ett_scsi_xdwriteread, xdwriteread10_fields, FALSE);
525
526         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
527         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
528
529         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
530         flags = tvb_get_guint8 (tvb, offset+8);
531         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
532                                     flags,
533                                     "Vendor Unique = %u, NACA = %u, Link = %u",
534                                     flags & 0xC0, flags & 0x4, flags & 0x1);
535     }
536 }
537
538 static void
539 dissect_sbc_xpwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
540                      guint offset, gboolean isreq, gboolean iscdb,
541                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
542
543 {
544     guint8 flags;
545     static const int *xpwrite10_fields[] = {
546         &hf_scsi_sbc_dpo,
547         &hf_scsi_sbc_fua,
548         &hf_scsi_sbc_fua_nv,
549         &hf_scsi_sbc_xorpinfo,
550         NULL
551     };
552
553     if (isreq && iscdb) {
554         if (check_col (pinfo->cinfo, COL_INFO))
555             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
556                              tvb_get_ntohl (tvb, offset+1),
557                              tvb_get_ntohs (tvb, offset+6));
558     }
559
560     if (tree && isreq && iscdb) {
561         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_xpwrite_flags, ett_scsi_xpwrite, xpwrite10_fields, FALSE);
562
563         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
564         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
565
566         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
567         flags = tvb_get_guint8 (tvb, offset+8);
568         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
569                                     flags,
570                                     "Vendor Unique = %u, NACA = %u, Link = %u",
571                                     flags & 0xC0, flags & 0x4, flags & 0x1);
572     }
573 }
574
575 void
576 dissect_sbc_write10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
577                      guint offset, gboolean isreq, gboolean iscdb,
578                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
579
580 {
581     guint8 flags;
582     static const int *rdwr10_fields[] = {
583         &hf_scsi_sbc_wrprotect,
584         &hf_scsi_sbc_dpo,
585         &hf_scsi_sbc_fua,
586         &hf_scsi_sbc_fua_nv,
587         NULL
588     };
589
590     if (isreq && iscdb) {
591         if (check_col (pinfo->cinfo, COL_INFO))
592             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
593                              tvb_get_ntohl (tvb, offset+1),
594                              tvb_get_ntohs (tvb, offset+6));
595     }
596
597     if (tree && isreq && iscdb) {
598         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr10_fields, FALSE);
599
600         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
601         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
602
603         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
604         flags = tvb_get_guint8 (tvb, offset+8);
605         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
606                                     flags,
607                                     "Vendor Unique = %u, NACA = %u, Link = %u",
608                                     flags & 0xC0, flags & 0x4, flags & 0x1);
609     }
610 }
611
612 void
613 dissect_sbc_read12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
614                      guint offset, gboolean isreq, gboolean iscdb,
615                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
616 {
617     guint8 flags;
618     static const int *rdwr12_fields[] = {
619         &hf_scsi_sbc_rdprotect,
620         &hf_scsi_sbc_dpo,
621         &hf_scsi_sbc_fua,
622         &hf_scsi_sbc_fua_nv,
623         NULL
624     };
625
626     if (isreq && iscdb) {
627         if (check_col (pinfo->cinfo, COL_INFO))
628             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
629                              tvb_get_ntohl (tvb, offset+1),
630                              tvb_get_ntohl (tvb, offset+5));
631     }
632
633     if (tree && isreq && iscdb) {
634         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr12_fields, FALSE);
635
636         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
637         proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+5, 4, 0);
638         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, 0);
639
640         flags = tvb_get_guint8 (tvb, offset+10);
641         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1,
642                                     flags,
643                                     "Vendor Unique = %u, NACA = %u, Link = %u",
644                                     flags & 0xC0, flags & 0x4, flags & 0x1);
645     }
646 }
647 void
648 dissect_sbc_write12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
649                      guint offset, gboolean isreq, gboolean iscdb,
650                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
651 {
652     guint8 flags;
653     static const int *rdwr12_fields[] = {
654         &hf_scsi_sbc_wrprotect,
655         &hf_scsi_sbc_dpo,
656         &hf_scsi_sbc_fua,
657         &hf_scsi_sbc_fua_nv,
658         NULL
659     };
660
661     if (isreq && iscdb) {
662         if (check_col (pinfo->cinfo, COL_INFO))
663             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
664                              tvb_get_ntohl (tvb, offset+1),
665                              tvb_get_ntohl (tvb, offset+5));
666     }
667
668     if (tree && isreq && iscdb) {
669         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr12_fields, FALSE);
670
671         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
672         proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+5, 4, 0);
673         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, 0);
674
675         flags = tvb_get_guint8 (tvb, offset+10);
676         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1,
677                                     flags,
678                                     "Vendor Unique = %u, NACA = %u, Link = %u",
679                                     flags & 0xC0, flags & 0x4, flags & 0x1);
680     }
681 }
682
683 static void
684 dissect_sbc_read16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
685                      guint offset, gboolean isreq, gboolean iscdb,
686                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
687 {
688     guint8 flags;
689     static const int *rdwr16_fields[] = {
690         &hf_scsi_sbc_rdprotect,
691         &hf_scsi_sbc_dpo,
692         &hf_scsi_sbc_fua,
693         &hf_scsi_sbc_fua_nv,
694         NULL
695     };
696
697     if (isreq && iscdb) {
698         if (check_col (pinfo->cinfo, COL_INFO))
699             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
700                              tvb_get_ntoh64 (tvb, offset+1),
701                              tvb_get_ntohl (tvb, offset+9));
702     }
703
704     if (tree && isreq && iscdb) {
705         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr16_fields, FALSE);
706
707         proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, 0);
708         proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, 0);
709         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);
710
711         flags = tvb_get_guint8 (tvb, offset+14);
712         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
713                                     flags,
714                                     "Vendor Unique = %u, NACA = %u, Link = %u",
715                                     flags & 0xC0, flags & 0x4, flags & 0x1);
716     }
717 }
718 static void
719 dissect_sbc_write16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
720                      guint offset, gboolean isreq, gboolean iscdb,
721                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
722 {
723     guint8 flags;
724     static const int *rdwr16_fields[] = {
725         &hf_scsi_sbc_wrprotect,
726         &hf_scsi_sbc_dpo,
727         &hf_scsi_sbc_fua,
728         &hf_scsi_sbc_fua_nv,
729         NULL
730     };
731
732     if (isreq && iscdb) {
733         if (check_col (pinfo->cinfo, COL_INFO))
734             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
735                              tvb_get_ntoh64 (tvb, offset+1),
736                              tvb_get_ntohl (tvb, offset+9));
737     }
738
739     if (tree && isreq && iscdb) {
740         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr16_fields, FALSE);
741
742         proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, 0);
743         proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, 0);
744         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);
745
746         flags = tvb_get_guint8 (tvb, offset+14);
747         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
748                                     flags,
749                                     "Vendor Unique = %u, NACA = %u, Link = %u",
750                                     flags & 0xC0, flags & 0x4, flags & 0x1);
751     }
752 }
753
754
755 static const value_string scsi_ssu_pwrcnd_val[] = {
756     {0x0, "No Change"},
757     {0x1, "Place Device In Active Condition"},
758     {0x2, "Place device into Idle condition"},
759     {0x3, "Place device into Standby condition"},
760     {0x4, "Reserved"},
761     {0x5, "Place device into Sleep condition"},
762     {0x6, "Reserved"},
763     {0x7, "Transfer control of power conditions to block device"},
764     {0x8, "Reserved"},
765     {0x9, "Reserved"},
766     {0xA, "Force Idle Condition Timer to zero"},
767     {0xB, "Force Standby Condition Timer to zero"},
768     {0, NULL},
769 };
770
771 void
772 dissect_sbc_startstopunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
773                             guint offset, gboolean isreq _U_, gboolean iscdb,
774                             guint payload_len _U_, scsi_task_data_t *cdata _U_)
775 {
776     guint8 flags;
777     static const int *ssu_fields[] = {
778         &hf_scsi_sbc_ssu_immed,
779         NULL
780     };
781     static const int *pwr_fields[] = {
782         &hf_scsi_sbc_ssu_pwr_cond,
783         &hf_scsi_sbc_ssu_loej,
784         &hf_scsi_sbc_ssu_start,
785         NULL
786     };
787
788     if (!tree || !iscdb)
789         return;
790
791     if (isreq && iscdb) {
792         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_ssu_immed_flags, ett_scsi_ssu_immed, ssu_fields, FALSE);
793
794         proto_tree_add_bitmask(tree, tvb, offset+3, hf_scsi_sbc_ssu_pwr_flags, ett_scsi_ssu_pwr, pwr_fields, FALSE);
795
796
797         flags = tvb_get_guint8 (tvb, offset+4);
798         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
799                                 flags,
800                                 "Vendor Unique = %u, NACA = %u, Link = %u",
801                                 flags & 0xC0, flags & 0x4, flags & 0x1);
802     }
803 }
804
805 static void
806 dissect_sbc_verify10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
807                        guint offset, gboolean isreq, gboolean iscdb,
808                        guint payload_len _U_, scsi_task_data_t *cdata _U_)
809
810 {
811     guint8 flags;
812     static const int *verify10_fields[] = {
813         &hf_scsi_sbc_vrprotect,
814         &hf_scsi_sbc_dpo,
815         &hf_scsi_sbc_bytchk,
816         NULL
817     };
818
819     if (isreq && iscdb) {
820         if (check_col (pinfo->cinfo, COL_INFO))
821             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
822                              tvb_get_ntohl (tvb, offset+1),
823                              tvb_get_ntohs (tvb, offset+6));
824     }
825
826     if (tree && isreq && iscdb) {
827          proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags, ett_scsi_verify, verify10_fields, FALSE);
828
829          proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+1, 4, 0);
830          proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
831
832          proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen, tvb, offset+6, 2, 0);
833          flags = tvb_get_guint8 (tvb, offset+8);
834          proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
835                                      flags,
836                                      "Vendor Unique = %u, NACA = %u, Link = %u",
837                                      flags & 0xC0, flags & 0x4, flags & 0x1);
838     }
839 }
840
841 static void
842 dissect_sbc_verify12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
843                        guint offset, gboolean isreq, gboolean iscdb,
844                        guint payload_len _U_, scsi_task_data_t *cdata _U_)
845
846 {
847     guint8 flags;
848     static const int *verify12_fields[] = {
849         &hf_scsi_sbc_vrprotect,
850         &hf_scsi_sbc_dpo,
851         &hf_scsi_sbc_bytchk,
852         NULL
853     };
854
855     if (isreq && iscdb) {
856         if (check_col (pinfo->cinfo, COL_INFO))
857             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
858                              tvb_get_ntohl (tvb, offset+1),
859                              tvb_get_ntohl (tvb, offset+5));
860     }
861
862     if (isreq && iscdb) {
863          proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags, ett_scsi_verify, verify12_fields, FALSE);
864
865
866          proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+1, 4, 0);
867          proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen32, tvb, offset+5, 4, 0);
868
869          proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, 0);
870
871          flags = tvb_get_guint8 (tvb, offset+10);
872          proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1,
873                                      flags,
874                                      "Vendor Unique = %u, NACA = %u, Link = %u",
875                                      flags & 0xC0, flags & 0x4, flags & 0x1);
876     }
877 }
878
879 static void
880 dissect_sbc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
881                        guint offset, gboolean isreq, gboolean iscdb,
882                        guint payload_len _U_, scsi_task_data_t *cdata _U_)
883
884 {
885     guint8 flags;
886     static const int *verify16_fields[] = {
887         &hf_scsi_sbc_vrprotect,
888         &hf_scsi_sbc_dpo,
889         &hf_scsi_sbc_bytchk,
890         NULL
891     };
892
893     if (isreq && iscdb) {
894         if (check_col (pinfo->cinfo, COL_INFO))
895             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
896                              tvb_get_ntoh64 (tvb, offset+1),
897                              tvb_get_ntohl (tvb, offset+9));
898     }
899
900     if (isreq && iscdb) {
901          proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_verify_flags, ett_scsi_verify, verify16_fields, FALSE);
902
903          proto_tree_add_item (tree, hf_scsi_sbc_verify_lba64, tvb, offset+1, 8, 0);
904          proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen32, tvb, offset+9, 4, 0);
905          proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);
906
907          flags = tvb_get_guint8 (tvb, offset+14);
908          proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
909                                      flags,
910                                      "Vendor Unique = %u, NACA = %u, Link = %u",
911                                      flags & 0xC0, flags & 0x4, flags & 0x1);
912     }
913 }
914
915
916 static void
917 dissect_sbc_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_,
918                          proto_tree *tree, guint offset, gboolean isreq,
919                          gboolean iscdb, guint payload_len _U_,
920                          scsi_task_data_t *cdata _U_)
921
922 {
923     guint8 flags;
924     static const int *wrverify10_fields[] = {
925         &hf_scsi_sbc_wrprotect,
926         &hf_scsi_sbc_dpo,
927         &hf_scsi_sbc_bytchk,
928         NULL
929     };
930
931     if (isreq && iscdb) {
932         if (check_col (pinfo->cinfo, COL_INFO))
933             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
934                              tvb_get_ntohl (tvb, offset+1),
935                              tvb_get_ntohs (tvb, offset+6));
936     }
937
938     if (tree && isreq && iscdb) {
939         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags, ett_scsi_wrverify, wrverify10_fields, FALSE);
940
941          proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+1, 4, 0);
942          proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
943
944          proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen, tvb, offset+6,
945                               2, 0);
946          flags = tvb_get_guint8 (tvb, offset+8);
947          proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
948                                      flags,
949                                      "Vendor Unique = %u, NACA = %u, Link = %u",
950                                      flags & 0xC0, flags & 0x4, flags & 0x1);
951     }
952 }
953
954 static void
955 dissect_sbc_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_,
956                          proto_tree *tree, guint offset, gboolean isreq,
957                          gboolean iscdb, guint payload_len _U_,
958                          scsi_task_data_t *cdata _U_)
959 {
960     guint8 flags;
961     static const int *wrverify12_fields[] = {
962         &hf_scsi_sbc_wrprotect,
963         &hf_scsi_sbc_dpo,
964         &hf_scsi_sbc_bytchk,
965         NULL
966     };
967
968     if (isreq && iscdb) {
969         if (check_col (pinfo->cinfo, COL_INFO))
970             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
971                              tvb_get_ntohl (tvb, offset+1),
972                              tvb_get_ntohl (tvb, offset+5));
973     }
974
975     if (tree && isreq && iscdb) {
976         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags, ett_scsi_wrverify, wrverify12_fields, FALSE);
977
978          proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+1, 4, 0);
979          proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+5,
980                               4, 0);
981          proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, 0);
982
983          flags = tvb_get_guint8 (tvb, offset+10);
984          proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1,
985                                      flags,
986                                      "Vendor Unique = %u, NACA = %u, Link = %u",
987                                      flags & 0xC0, flags & 0x4, flags & 0x1);
988     }
989 }
990
991 static void
992 dissect_sbc_wrverify16 (tvbuff_t *tvb, packet_info *pinfo _U_,
993                          proto_tree *tree, guint offset, gboolean isreq,
994                          gboolean iscdb, guint payload_len _U_,
995                          scsi_task_data_t *cdata _U_)
996 {
997     guint8 flags;
998     static const int *wrverify16_fields[] = {
999         &hf_scsi_sbc_wrprotect,
1000         &hf_scsi_sbc_dpo,
1001         &hf_scsi_sbc_bytchk,
1002         NULL
1003     };
1004
1005     if (isreq && iscdb) {
1006         if (check_col (pinfo->cinfo, COL_INFO))
1007             col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" G_GINT64_MODIFIER "u, Len: %u)",
1008                              tvb_get_ntoh64 (tvb, offset+1),
1009                              tvb_get_ntohl (tvb, offset+9));
1010     }
1011
1012     if (tree && isreq && iscdb) {
1013         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_wrverify_flags, ett_scsi_wrverify, wrverify16_fields, FALSE);
1014
1015          proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba64, tvb, offset+1, 8, 0);
1016          proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+9,
1017                               4, 0);
1018          proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);
1019
1020          flags = tvb_get_guint8 (tvb, offset+14);
1021          proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
1022                                      flags,
1023                                      "Vendor Unique = %u, NACA = %u, Link = %u",
1024                                      flags & 0xC0, flags & 0x4, flags & 0x1);
1025     }
1026 }
1027
1028
1029 void
1030 dissect_sbc_readcapacity10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1031                            guint offset, gboolean isreq, gboolean iscdb,
1032                            guint payload_len _U_, scsi_task_data_t *cdata _U_)
1033 {
1034     guint8 flags;
1035     guint32 len, block_len, tot_len;
1036     const char *un;
1037     static const int *pmi_fields[] = {
1038         &hf_scsi_sbc_pmi,
1039         NULL
1040     };
1041
1042     if (!tree)
1043         return;
1044
1045     if (isreq && iscdb) {
1046         proto_tree_add_item (tree, hf_scsi_sbc_readcapacity_lba, tvb, offset+1,
1047                              4, 0);
1048         proto_tree_add_bitmask(tree, tvb, offset+7, hf_scsi_sbc_pmi_flags, ett_scsi_pmi, pmi_fields, FALSE);
1049
1050
1051         flags = tvb_get_guint8 (tvb, offset+8);
1052         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
1053                                     flags,
1054                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1055                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1056     }
1057     else if (!iscdb) {
1058         len = tvb_get_ntohl (tvb, offset);
1059         block_len = tvb_get_ntohl (tvb, offset+4);
1060         tot_len=((len/1024)*block_len)/1024; /*MB*/
1061         un="MB";
1062         if(tot_len>20000){
1063             tot_len/=1024;
1064             un="GB";
1065         }
1066         proto_tree_add_uint_format (tree, hf_scsi_sbc_returned_lba, tvb, offset, 4, len, "LBA: %u (%u %s)", len, tot_len, un);
1067         proto_tree_add_item (tree, hf_scsi_sbc_blocksize, tvb, offset+4, 4, 0);
1068     }
1069 }
1070
1071 static void
1072 dissect_sbc_readdefectdata10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1073                             proto_tree *tree, guint offset, gboolean isreq,
1074                             gboolean iscdb,
1075                             guint payload_len _U_, scsi_task_data_t *cdata _U_)
1076 {
1077     guint8 flags;
1078     static const int *defect_fields[] = {
1079         &hf_scsi_sbc_defect_list_format,
1080         &hf_scsi_sbc_req_plist,
1081         &hf_scsi_sbc_req_glist,
1082         NULL
1083     };
1084
1085     if (!tree)
1086         return;
1087
1088     if (isreq && iscdb) {
1089         proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_sbc_readdefdata_flags, ett_scsi_defectdata, defect_fields, FALSE);
1090
1091         proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, 0);
1092         flags = tvb_get_guint8 (tvb, offset+8);
1093         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
1094                                     flags,
1095                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1096                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1097     }
1098     /* TODO : add dissection of DATA */
1099 }
1100
1101
1102 static void
1103 dissect_sbc_readlong10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1104                             proto_tree *tree, guint offset, gboolean isreq,
1105                             gboolean iscdb,
1106                             guint payload_len _U_, scsi_task_data_t *cdata _U_)
1107 {
1108     guint8 flags;
1109     static const int *corrct_fields[] = {
1110         &hf_scsi_sbc_corrct,
1111         NULL
1112     };
1113
1114     if (!tree)
1115         return;
1116
1117     if (isreq && iscdb) {
1118         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_corrct_flags, ett_scsi_corrct, corrct_fields, FALSE);
1119
1120         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
1121
1122         proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, 0);
1123         flags = tvb_get_guint8 (tvb, offset+8);
1124         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
1125                                     flags,
1126                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1127                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1128     }
1129 }
1130
1131 static void
1132 dissect_sbc_writelong10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1133                             proto_tree *tree, guint offset, gboolean isreq,
1134                             gboolean iscdb,
1135                             guint payload_len _U_, scsi_task_data_t *cdata _U_)
1136 {
1137     guint8 flags;
1138
1139     if (!tree)
1140         return;
1141
1142     if (isreq && iscdb) {
1143         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
1144
1145         proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, 0);
1146         flags = tvb_get_guint8 (tvb, offset+8);
1147         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
1148                                     flags,
1149                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1150                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1151     }
1152 }
1153
1154 static void
1155 dissect_sbc_writesame10 (tvbuff_t *tvb, packet_info *pinfo _U_,
1156                             proto_tree *tree, guint offset, gboolean isreq,
1157                             gboolean iscdb,
1158                             guint payload_len _U_, scsi_task_data_t *cdata _U_)
1159 {
1160     guint8 flags;
1161     static const int *writesame10_fields[] = {
1162         &hf_scsi_sbc_wrprotect,
1163         &hf_scsi_sbc_pbdata,
1164         &hf_scsi_sbc_lbdata,
1165         NULL
1166     };
1167
1168     if (!tree)
1169         return;
1170
1171     if (isreq && iscdb) {
1172         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_writesame_flags, ett_scsi_writesame, writesame10_fields, FALSE);
1173
1174         proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
1175
1176         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);
1177
1178         proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, 0);
1179         flags = tvb_get_guint8 (tvb, offset+8);
1180         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
1181                                     flags,
1182                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1183                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1184     }
1185 }
1186
1187 static void
1188 dissect_sbc_writesame16 (tvbuff_t *tvb, packet_info *pinfo _U_,
1189                             proto_tree *tree, guint offset, gboolean isreq,
1190                             gboolean iscdb,
1191                             guint payload_len _U_, scsi_task_data_t *cdata _U_)
1192 {
1193     guint8 flags;
1194     static const int *writesame16_fields[] = {
1195         &hf_scsi_sbc_wrprotect,
1196         &hf_scsi_sbc_pbdata,
1197         &hf_scsi_sbc_lbdata,
1198         NULL
1199     };
1200
1201     if (!tree)
1202         return;
1203
1204     if (isreq && iscdb) {
1205         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_writesame_flags, ett_scsi_writesame, writesame16_fields, FALSE);
1206
1207         proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, 0);
1208         proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, 0);
1209         proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);
1210
1211         flags = tvb_get_guint8 (tvb, offset+14);
1212         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
1213                                     flags,
1214                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1215                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1216     }
1217 }
1218
1219
1220 static void
1221 dissect_sbc_readdefectdata12 (tvbuff_t *tvb, packet_info *pinfo _U_,
1222                             proto_tree *tree, guint offset, gboolean isreq,
1223                             gboolean iscdb,
1224                             guint payload_len _U_, scsi_task_data_t *cdata _U_)
1225 {
1226     guint8 flags;
1227     static const int *defect_fields[] = {
1228         &hf_scsi_sbc_defect_list_format,
1229         &hf_scsi_sbc_req_plist,
1230         &hf_scsi_sbc_req_glist,
1231         NULL
1232     };
1233
1234     if (!tree)
1235         return;
1236
1237     if (isreq && iscdb) {
1238         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_readdefdata_flags, ett_scsi_defectdata, defect_fields, FALSE);
1239
1240         proto_tree_add_item (tree, hf_scsi_sbc_alloclen32, tvb, offset+5, 4, 0);
1241         flags = tvb_get_guint8 (tvb, offset+10);
1242         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1,
1243                                     flags,
1244                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1245                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1246     }
1247     /* TODO : add dissection of DATA */
1248 }
1249
1250
1251 static void
1252 dissect_sbc_reassignblocks (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_)
1256 {
1257     guint8 flags;
1258     static const int *reassign_fields[] = {
1259         &hf_scsi_sbc_reassignblocks_longlba,
1260         &hf_scsi_sbc_reassignblocks_longlist,
1261         NULL
1262     };
1263
1264     if (!tree)
1265         return;
1266
1267     if (isreq && iscdb) {
1268         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_reassignblks_flags, ett_scsi_reassign_blocks, reassign_fields, FALSE);
1269
1270         flags = tvb_get_guint8 (tvb, offset+4);
1271         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
1272                                     flags,
1273                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1274                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1275     }
1276     /* TODO : add dissection of DATA */
1277 }
1278
1279
1280 const value_string service_action_vals[] = {
1281         {SHORT_FORM_BLOCK_ID,        "Short Form - Block ID"},
1282         {SHORT_FORM_VENDOR_SPECIFIC, "Short Form - Vendor-Specific"},
1283         {LONG_FORM,                  "Long Form"},
1284         {EXTENDED_FORM,              "Extended Form"},
1285         {SERVICE_READ_CAPACITY16,    "Read Capacity(16)"},
1286         {SERVICE_READ_LONG16,        "Read Long(16)"},
1287         {0, NULL}
1288 };
1289
1290 /* this is either readcapacity16  or  readlong16  depending of what service
1291    action is set to.
1292 */
1293 static void
1294 dissect_sbc_serviceactionin16 (tvbuff_t *tvb, packet_info *pinfo _U_,
1295                            proto_tree *tree, guint offset, gboolean isreq,
1296                            gboolean iscdb,
1297                            guint payload_len _U_, scsi_task_data_t *cdata _U_)
1298 {
1299     guint8 service_action, flags;
1300     guint32 block_len;
1301     guint64 len, tot_len;
1302     char *un;
1303     static const int *pmi_fields[] = {
1304         &hf_scsi_sbc_pmi,
1305         NULL
1306     };
1307
1308     if (!tree)
1309         return;
1310
1311     if (isreq && iscdb) {
1312         service_action = tvb_get_guint8 (tvb, offset) & 0x1F;
1313         if(cdata && cdata->itlq){
1314             cdata->itlq->flags=service_action;
1315         }
1316
1317         switch(service_action){
1318         case SERVICE_READ_CAPACITY16:
1319                 proto_tree_add_text (tree, tvb, offset, 1,
1320                              "Service Action: %s",
1321                              val_to_str (service_action,
1322                                          service_action_vals,
1323                                          "Unknown (0x%02x)"));
1324                 offset++;
1325
1326                 proto_tree_add_text (tree, tvb, offset, 8,
1327                              "Logical Block Address: %" G_GINT64_MODIFIER "u",
1328                               tvb_get_ntoh64 (tvb, offset));
1329                 offset += 8;
1330
1331                 proto_tree_add_item (tree, hf_scsi_sbc_alloclen32, tvb, offset, 4, 0);
1332                 offset += 4;
1333
1334                 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_pmi_flags, ett_scsi_pmi, pmi_fields, FALSE);
1335                 offset++;
1336
1337                 flags = tvb_get_guint8 (tvb, offset);
1338                 proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset, 1,
1339                                     flags,
1340                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1341                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1342                 offset++;
1343
1344                 break;
1345         case SERVICE_READ_LONG16:
1346                 proto_tree_add_text (tree, tvb, offset, 1,
1347                              "Service Action: %s",
1348                              val_to_str (service_action,
1349                                          service_action_vals,
1350                                          "Unknown (0x%02x)"));
1351                 offset++;
1352
1353                 proto_tree_add_text (tree, tvb, offset, 8,
1354                              "Logical Block Address: %" G_GINT64_MODIFIER "u",
1355                               tvb_get_ntoh64 (tvb, offset));
1356                 offset+=8;
1357
1358                 /* two reserved bytes */
1359                 offset+=2;
1360
1361                 proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset, 2, 0);
1362                 offset+=2;
1363
1364                 /* CORRCT bit */
1365                 offset++;
1366
1367                 flags = tvb_get_guint8 (tvb, offset);
1368                 proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset, 1,
1369                                     flags,
1370                                     "Vendor Unique = %u, NACA = %u, Link = %u",
1371                                     flags & 0xC0, flags & 0x4, flags & 0x1);
1372                 offset++;
1373
1374                 break;
1375         };
1376     } else if (!iscdb) {
1377         if(cdata && cdata->itlq){
1378             switch(cdata->itlq->flags){
1379             case SERVICE_READ_CAPACITY16:
1380                 len = tvb_get_ntoh64 (tvb, offset);
1381                 block_len = tvb_get_ntohl (tvb, offset+8);
1382                 tot_len=((len/1024)*block_len)/1024; /*MB*/
1383                 un="MB";
1384                 if(tot_len>20000){
1385                     tot_len/=1024;
1386                     un="GB";
1387                 }
1388                 proto_tree_add_text (tree, tvb, offset, 8, "LBA: %" G_GINT64_MODIFIER "u (%" G_GINT64_MODIFIER "u %s)",
1389                              len, tot_len, un);
1390                 proto_tree_add_item (tree, hf_scsi_sbc_blocksize, tvb, offset+8, 4, 0);
1391                 break;
1392             }
1393         }
1394     }
1395 }
1396
1397
1398 /* SBC Commands */
1399 const value_string scsi_sbc_vals[] = {
1400     {SCSI_SPC_EXTCOPY           , "Extended Copy"},
1401     {SCSI_SPC_INQUIRY           , "Inquiry"},
1402     {SCSI_SBC_FORMATUNIT        , "Format Unit"},
1403     {SCSI_SBC_LOCKUNLKCACHE10   , "Lock Unlock Cache(10)"},
1404     {SCSI_SBC_LOCKUNLKCACHE16   , "Lock Unlock Cache(16)"},
1405     {SCSI_SPC_LOGSELECT         , "Log Select"},
1406     {SCSI_SPC_LOGSENSE          , "Log Sense"},
1407     {SCSI_SPC_MODESELECT6       , "Mode Select(6)"},
1408     {SCSI_SPC_MODESELECT10      , "Mode Select(10)"},
1409     {SCSI_SPC_MODESENSE6        , "Mode Sense(6)"},
1410     {SCSI_SPC_MODESENSE10       , "Mode Sense(10)"},
1411     {SCSI_SPC_PERSRESVIN        , "Persistent Reserve In"},
1412     {SCSI_SPC_PERSRESVOUT       , "Persistent Reserve Out"},
1413     {SCSI_SBC_PREFETCH10        , "Pre-Fetch(10)"},
1414     {SCSI_SBC_PREFETCH16        , "Pre-Fetch(16)"},
1415     {SCSI_SPC_PREVMEDREMOVAL    , "Prevent/Allow Medium Removal"},
1416     {SCSI_SBC_READ6             , "Read(6)"},
1417     {SCSI_SBC_READ10            , "Read(10)"},
1418     {SCSI_SBC_READ12            , "Read(12)"},
1419     {SCSI_SBC_READ16            , "Read(16)"},
1420     {SCSI_SBC_READCAPACITY10    , "Read Capacity(10)"},
1421     {SCSI_SPC_REPORTLUNS        , "Report LUNs"},
1422     {SCSI_SPC_REQSENSE          , "Request Sense"},
1423     {SCSI_SBC_SERVICEACTIONIN16 , "Service Action In(16)"},
1424     {SCSI_SBC_READDEFDATA10     , "Read Defect Data(10)"},
1425     {SCSI_SBC_READDEFDATA12     , "Read Defect Data(12)"},
1426     {SCSI_SBC_READLONG          , "Read Long(10)"},
1427     {SCSI_SBC_REASSIGNBLKS      , "Reassign Blocks"},
1428     {SCSI_SBC_REBUILD16         , "Rebuild(16)"},
1429     {SCSI_SBC_REBUILD32         , "Rebuild(32)"},
1430     {SCSI_SBC_REGENERATE16      , "Regenerate(16)"},
1431     {SCSI_SBC_REGENERATE32      , "Regenerate(32)"},
1432     {SCSI_SPC_RELEASE6          , "Release(6)"}, /* obsolete in SBC2 and later */
1433     {SCSI_SPC_RELEASE10         , "Release(10)"},/* obsolete in SBC2 and later */
1434     {SCSI_SPC_RESERVE6          , "Reserve(6)"}, /* obsolete in SBC2 and later */
1435     {SCSI_SPC_RESERVE10         , "Reserve(10)"},/* obsolete in SBC2 and later */
1436     {SCSI_SBC_SEEK10            , "Seek(10)"},
1437     {SCSI_SPC_SENDDIAG          , "Send Diagnostic"},
1438     {SCSI_SBC_SETLIMITS10       , "Set Limits(10)"},
1439     {SCSI_SBC_SETLIMITS12       , "Set Limits(12)"},
1440     {SCSI_SBC_STARTSTOPUNIT     , "Start Stop Unit"},
1441     {SCSI_SBC_SYNCCACHE10       , "Synchronize Cache(10)"},
1442     {SCSI_SBC_SYNCCACHE16       , "Synchronize Cache(16)"},
1443     {SCSI_SPC_TESTUNITRDY       , "Test Unit Ready"},
1444     {SCSI_SBC_VERIFY10          , "Verify(10)"},
1445     {SCSI_SBC_VERIFY12          , "Verify(12)"},
1446     {SCSI_SBC_VERIFY16          , "Verify(16)"},
1447     {SCSI_SBC_WRITE6            , "Write(6)"},
1448     {SCSI_SBC_WRITE10           , "Write(10)"},
1449     {SCSI_SBC_WRITE12           , "Write(12)"},
1450     {SCSI_SBC_WRITE16           , "Write(16)"},
1451     {SCSI_SPC_WRITEBUFFER       , "Write Buffer"},
1452     {SCSI_SBC_WRITENVERIFY10    , "Write & Verify(10)"},
1453     {SCSI_SBC_WRITENVERIFY12    , "Write & Verify(12)"},
1454     {SCSI_SBC_WRITENVERIFY16    , "Write & Verify(16)"},
1455     {SCSI_SBC_WRITELONG         , "Write Long"},
1456     {SCSI_SBC_WRITESAME10       , "Write Same(10)"},
1457     {SCSI_SBC_WRITESAME16       , "Write Same(16)"},
1458     {SCSI_SBC_XDREAD10          , "XdRead(10)"},
1459     {SCSI_SBC_XDREAD32          , "XdRead(32)"},
1460     {SCSI_SBC_XDWRITE10         , "XdWrite(10)"},
1461     {SCSI_SBC_XDWRITE32         , "XdWrite(32)"},
1462     {SCSI_SBC_XDWRITEREAD10     , "XdWriteRead(10)"},
1463     {SCSI_SBC_XDWRITEREAD32     , "XdWriteRead(32)"},
1464     {SCSI_SBC_XDWRITEEXTD16     , "XdWrite Extended(16)"},
1465     {SCSI_SBC_XDWRITEEXTD32     , "XdWrite Extended(32)"},
1466     {SCSI_SBC_XPWRITE10         , "XpWrite(10)"},
1467     {SCSI_SBC_XPWRITE32         , "XpWrite(32)"},
1468     {0, NULL}
1469 };
1470
1471 scsi_cdb_table_t scsi_sbc_table[256] = {
1472 /*SPC 0x00*/{dissect_spc_testunitready},
1473 /*SBC 0x01*/{NULL},
1474 /*SBC 0x02*/{NULL},
1475 /*SPC 0x03*/{dissect_spc_requestsense},
1476 /*SBC 0x04*/{dissect_sbc_formatunit},
1477 /*SBC 0x05*/{NULL},
1478 /*SBC 0x06*/{NULL},
1479 /*SBC 0x07*/{dissect_sbc_reassignblocks},
1480 /*SBC 0x08*/{dissect_sbc_read6},
1481 /*SBC 0x09*/{NULL},
1482 /*SBC 0x0a*/{dissect_sbc_write6},
1483 /*SBC 0x0b*/{NULL},
1484 /*SBC 0x0c*/{NULL},
1485 /*SBC 0x0d*/{NULL},
1486 /*SBC 0x0e*/{NULL},
1487 /*SBC 0x0f*/{NULL},
1488 /*SBC 0x10*/{NULL},
1489 /*SBC 0x11*/{NULL},
1490 /*SPC 0x12*/{dissect_spc_inquiry},
1491 /*SBC 0x13*/{NULL},
1492 /*SBC 0x14*/{NULL},
1493 /*SPC 0x15*/{dissect_spc_modeselect6},
1494 /*SBC 0x16*/{dissect_spc_reserve6}, /* obsolete in SBC2 and later */
1495 /*SBC 0x17*/{dissect_spc_release6}, /* obsolete in SBC2 and later */
1496 /*SBC 0x18*/{NULL},
1497 /*SBC 0x19*/{NULL},
1498 /*SPC 0x1a*/{dissect_spc_modesense6},
1499 /*SBC 0x1b*/{dissect_sbc_startstopunit},
1500 /*SBC 0x1c*/{NULL},
1501 /*SPC 0x1d*/{dissect_spc_senddiagnostic},
1502 /*SBC 0x1e*/{dissect_spc_preventallowmediaremoval},
1503 /*SBC 0x1f*/{NULL},
1504 /*SBC 0x20*/{NULL},
1505 /*SBC 0x21*/{NULL},
1506 /*SBC 0x22*/{NULL},
1507 /*SBC 0x23*/{NULL},
1508 /*SBC 0x24*/{NULL},
1509 /*SBC 0x25*/{dissect_sbc_readcapacity10},
1510 /*SBC 0x26*/{NULL},
1511 /*SBC 0x27*/{NULL},
1512 /*SBC 0x28*/{dissect_sbc_read10},
1513 /*SBC 0x29*/{NULL},
1514 /*SBC 0x2a*/{dissect_sbc_write10},
1515 /*SBC 0x2b*/{NULL},
1516 /*SBC 0x2c*/{NULL},
1517 /*SBC 0x2d*/{NULL},
1518 /*SBC 0x2e*/{dissect_sbc_wrverify10},
1519 /*SBC 0x2f*/{dissect_sbc_verify10},
1520 /*SBC 0x30*/{NULL},
1521 /*SBC 0x31*/{NULL},
1522 /*SBC 0x32*/{NULL},
1523 /*SBC 0x33*/{NULL},
1524 /*SBC 0x34*/{dissect_sbc_prefetch10},
1525 /*SBC 0x35*/{dissect_sbc_synchronizecache10},
1526 /*SBC 0x36*/{NULL},
1527 /*SBC 0x37*/{dissect_sbc_readdefectdata10},
1528 /*SBC 0x38*/{NULL},
1529 /*SBC 0x39*/{NULL},
1530 /*SBC 0x3a*/{NULL},
1531 /*SPC 0x3b*/{dissect_spc_writebuffer},
1532 /*SBC 0x3c*/{NULL},
1533 /*SBC 0x3d*/{NULL},
1534 /*SBC 0x3e*/{dissect_sbc_readlong10},
1535 /*SBC 0x3f*/{dissect_sbc_writelong10},
1536 /*SBC 0x40*/{NULL},
1537 /*SBC 0x41*/{dissect_sbc_writesame10},
1538 /*SBC 0x42*/{NULL},
1539 /*SBC 0x43*/{NULL},
1540 /*SBC 0x44*/{NULL},
1541 /*SBC 0x45*/{NULL},
1542 /*SBC 0x46*/{NULL},
1543 /*SBC 0x47*/{NULL},
1544 /*SBC 0x48*/{NULL},
1545 /*SBC 0x49*/{NULL},
1546 /*SBC 0x4a*/{NULL},
1547 /*SBC 0x4b*/{NULL},
1548 /*SPC 0x4c*/{dissect_spc_logselect},
1549 /*SPC 0x4d*/{dissect_spc_logsense},
1550 /*SBC 0x4e*/{NULL},
1551 /*SBC 0x4f*/{NULL},
1552 /*SBC 0x50*/{dissect_sbc_xdwrite10},
1553 /*SBC 0x51*/{dissect_sbc_xpwrite10},
1554 /*SBC 0x52*/{dissect_sbc_xdread10},
1555 /*SBC 0x53*/{dissect_sbc_xdwriteread10},
1556 /*SBC 0x54*/{NULL},
1557 /*SPC 0x55*/{dissect_spc_modeselect10},
1558 /*SPC 0x56*/{dissect_spc_reserve10},/* obsolete in SBC2 and later */
1559 /*SPC 0x57*/{dissect_spc_release10},/* obsolete in SBC2 and later */
1560 /*SBC 0x58*/{NULL},
1561 /*SBC 0x59*/{NULL},
1562 /*SPC 0x5a*/{dissect_spc_modesense10},
1563 /*SBC 0x5b*/{NULL},
1564 /*SBC 0x5c*/{NULL},
1565 /*SBC 0x5d*/{NULL},
1566 /*SPC 0x5e*/{dissect_spc_persistentreservein},
1567 /*SPC 0x5f*/{dissect_spc_persistentreserveout},
1568 /*SBC 0x60*/{NULL},
1569 /*SBC 0x61*/{NULL},
1570 /*SBC 0x62*/{NULL},
1571 /*SBC 0x63*/{NULL},
1572 /*SBC 0x64*/{NULL},
1573 /*SBC 0x65*/{NULL},
1574 /*SBC 0x66*/{NULL},
1575 /*SBC 0x67*/{NULL},
1576 /*SBC 0x68*/{NULL},
1577 /*SBC 0x69*/{NULL},
1578 /*SBC 0x6a*/{NULL},
1579 /*SBC 0x6b*/{NULL},
1580 /*SBC 0x6c*/{NULL},
1581 /*SBC 0x6d*/{NULL},
1582 /*SBC 0x6e*/{NULL},
1583 /*SBC 0x6f*/{NULL},
1584 /*SBC 0x70*/{NULL},
1585 /*SBC 0x71*/{NULL},
1586 /*SBC 0x72*/{NULL},
1587 /*SBC 0x73*/{NULL},
1588 /*SBC 0x74*/{NULL},
1589 /*SBC 0x75*/{NULL},
1590 /*SBC 0x76*/{NULL},
1591 /*SBC 0x77*/{NULL},
1592 /*SBC 0x78*/{NULL},
1593 /*SBC 0x79*/{NULL},
1594 /*SBC 0x7a*/{NULL},
1595 /*SBC 0x7b*/{NULL},
1596 /*SBC 0x7c*/{NULL},
1597 /*SBC 0x7d*/{NULL},
1598 /*SBC 0x7e*/{NULL},
1599 /*SBC 0x7f*/{NULL},
1600 /*SBC 0x80*/{NULL},
1601 /*SBC 0x81*/{NULL},
1602 /*SBC 0x82*/{NULL},
1603 /*SPC 0x83*/{dissect_spc_extcopy},
1604 /*SBC 0x84*/{NULL},
1605 /*SBC 0x85*/{NULL},
1606 /*SBC 0x86*/{NULL},
1607 /*SBC 0x87*/{NULL},
1608 /*SBC 0x88*/{dissect_sbc_read16},
1609 /*SBC 0x89*/{NULL},
1610 /*SBC 0x8a*/{dissect_sbc_write16},
1611 /*SBC 0x8b*/{NULL},
1612 /*SBC 0x8c*/{NULL},
1613 /*SBC 0x8d*/{NULL},
1614 /*SBC 0x8e*/{dissect_sbc_wrverify16},
1615 /*SBC 0x8f*/{dissect_sbc_verify16},
1616 /*SBC 0x90*/{dissect_sbc_prefetch16},
1617 /*SBC 0x91*/{dissect_sbc_synchronizecache16},
1618 /*SBC 0x92*/{NULL},
1619 /*SBC 0x93*/{dissect_sbc_writesame16},
1620 /*SBC 0x94*/{NULL},
1621 /*SBC 0x95*/{NULL},
1622 /*SBC 0x96*/{NULL},
1623 /*SBC 0x97*/{NULL},
1624 /*SBC 0x98*/{NULL},
1625 /*SBC 0x99*/{NULL},
1626 /*SBC 0x9a*/{NULL},
1627 /*SBC 0x9b*/{NULL},
1628 /*SBC 0x9c*/{NULL},
1629 /*SBC 0x9d*/{NULL},
1630 /*SBC 0x9e*/{dissect_sbc_serviceactionin16},
1631 /*SBC 0x9f*/{NULL},
1632 /*SPC 0xa0*/{dissect_spc_reportluns},
1633 /*SBC 0xa1*/{NULL},
1634 /*SBC 0xa2*/{NULL},
1635 /*SBC 0xa3*/{NULL},
1636 /*SBC 0xa4*/{NULL},
1637 /*SBC 0xa5*/{NULL},
1638 /*SBC 0xa6*/{NULL},
1639 /*SBC 0xa7*/{NULL},
1640 /*SBC 0xa8*/{dissect_sbc_read12},
1641 /*SBC 0xa9*/{NULL},
1642 /*SBC 0xaa*/{dissect_sbc_write12},
1643 /*SBC 0xab*/{NULL},
1644 /*SBC 0xac*/{NULL},
1645 /*SBC 0xad*/{NULL},
1646 /*SBC 0xae*/{dissect_sbc_wrverify12},
1647 /*SBC 0xaf*/{dissect_sbc_verify12},
1648 /*SBC 0xb0*/{NULL},
1649 /*SBC 0xb1*/{NULL},
1650 /*SBC 0xb2*/{NULL},
1651 /*SBC 0xb3*/{NULL},
1652 /*SBC 0xb4*/{NULL},
1653 /*SBC 0xb5*/{NULL},
1654 /*SBC 0xb6*/{NULL},
1655 /*SBC 0xb7*/{dissect_sbc_readdefectdata12},
1656 /*SBC 0xb8*/{NULL},
1657 /*SBC 0xb9*/{NULL},
1658 /*SBC 0xba*/{NULL},
1659 /*SBC 0xbb*/{NULL},
1660 /*SBC 0xbc*/{NULL},
1661 /*SBC 0xbd*/{NULL},
1662 /*SBC 0xbe*/{NULL},
1663 /*SBC 0xbf*/{NULL},
1664 /*SBC 0xc0*/{NULL},
1665 /*SBC 0xc1*/{NULL},
1666 /*SBC 0xc2*/{NULL},
1667 /*SBC 0xc3*/{NULL},
1668 /*SBC 0xc4*/{NULL},
1669 /*SBC 0xc5*/{NULL},
1670 /*SBC 0xc6*/{NULL},
1671 /*SBC 0xc7*/{NULL},
1672 /*SBC 0xc8*/{NULL},
1673 /*SBC 0xc9*/{NULL},
1674 /*SBC 0xca*/{NULL},
1675 /*SBC 0xcb*/{NULL},
1676 /*SBC 0xcc*/{NULL},
1677 /*SBC 0xcd*/{NULL},
1678 /*SBC 0xce*/{NULL},
1679 /*SBC 0xcf*/{NULL},
1680 /*SBC 0xd0*/{NULL},
1681 /*SBC 0xd1*/{NULL},
1682 /*SBC 0xd2*/{NULL},
1683 /*SBC 0xd3*/{NULL},
1684 /*SBC 0xd4*/{NULL},
1685 /*SBC 0xd5*/{NULL},
1686 /*SBC 0xd6*/{NULL},
1687 /*SBC 0xd7*/{NULL},
1688 /*SBC 0xd8*/{NULL},
1689 /*SBC 0xd9*/{NULL},
1690 /*SBC 0xda*/{NULL},
1691 /*SBC 0xdb*/{NULL},
1692 /*SBC 0xdc*/{NULL},
1693 /*SBC 0xdd*/{NULL},
1694 /*SBC 0xde*/{NULL},
1695 /*SBC 0xdf*/{NULL},
1696 /*SBC 0xe0*/{NULL},
1697 /*SBC 0xe1*/{NULL},
1698 /*SBC 0xe2*/{NULL},
1699 /*SBC 0xe3*/{NULL},
1700 /*SBC 0xe4*/{NULL},
1701 /*SBC 0xe5*/{NULL},
1702 /*SBC 0xe6*/{NULL},
1703 /*SBC 0xe7*/{NULL},
1704 /*SBC 0xe8*/{NULL},
1705 /*SBC 0xe9*/{NULL},
1706 /*SBC 0xea*/{NULL},
1707 /*SBC 0xeb*/{NULL},
1708 /*SBC 0xec*/{NULL},
1709 /*SBC 0xed*/{NULL},
1710 /*SBC 0xee*/{NULL},
1711 /*SBC 0xef*/{NULL},
1712 /*SBC 0xf0*/{NULL},
1713 /*SBC 0xf1*/{NULL},
1714 /*SBC 0xf2*/{NULL},
1715 /*SBC 0xf3*/{NULL},
1716 /*SBC 0xf4*/{NULL},
1717 /*SBC 0xf5*/{NULL},
1718 /*SBC 0xf6*/{NULL},
1719 /*SBC 0xf7*/{NULL},
1720 /*SBC 0xf8*/{NULL},
1721 /*SBC 0xf9*/{NULL},
1722 /*SBC 0xfa*/{NULL},
1723 /*SBC 0xfb*/{NULL},
1724 /*SBC 0xfc*/{NULL},
1725 /*SBC 0xfd*/{NULL},
1726 /*SBC 0xfe*/{NULL},
1727 /*SBC 0xff*/{NULL}
1728 };
1729
1730
1731 void
1732 proto_register_scsi_sbc(void)
1733 {
1734         static hf_register_info hf[] = {
1735         { &hf_scsi_sbc_opcode,
1736           {"SBC Opcode", "scsi.sbc.opcode", FT_UINT8, BASE_HEX,
1737            VALS (scsi_sbc_vals), 0x0, NULL, HFILL}},
1738         { &hf_scsi_sbc_formatunit_flags,
1739           {"Flags", "scsi.sbc.formatunit.flags", FT_UINT8, BASE_HEX, NULL, 0xF8,
1740            NULL, HFILL}},
1741         { &hf_scsi_sbc_defect_list_format,
1742           {"Defect List Format", "scsi.sbc.defect_list_format", FT_UINT8, BASE_DEC,
1743            NULL, 0x7, NULL, HFILL}},
1744         { &hf_scsi_sbc_formatunit_vendor,
1745           {"Vendor Unique", "scsi.sbc.formatunit.vendor", FT_UINT8, BASE_HEX, NULL,
1746            0x0, NULL, HFILL}},
1747         { &hf_scsi_sbc_formatunit_interleave,
1748           {"Interleave", "scsi.sbc.formatunit.interleave", FT_UINT16, BASE_HEX,
1749            NULL, 0x0, NULL, HFILL}},
1750         { &hf_scsi_sbc_rdwr6_lba,
1751           {"Logical Block Address (LBA)", "scsi.sbc.rdwr6.lba", FT_UINT24, BASE_DEC,
1752            NULL, 0x0FFFFF, NULL, HFILL}},
1753         { &hf_scsi_sbc_rdwr6_xferlen,
1754           {"Transfer Length", "scsi.sbc.rdwr6.xferlen", FT_UINT24, BASE_DEC, NULL, 0x0,
1755            NULL, HFILL}},
1756         { &hf_scsi_sbc_rdwr10_lba,
1757           {"Logical Block Address (LBA)", "scsi.sbc.rdwr10.lba", FT_UINT32, BASE_DEC,
1758            NULL, 0x0, NULL, HFILL}},
1759         { &hf_scsi_sbc_rdwr10_xferlen,
1760           {"Transfer Length", "scsi.sbc.rdwr10.xferlen", FT_UINT16, BASE_DEC, NULL,
1761            0x0, NULL, HFILL}},
1762         { &hf_scsi_sbc_rdwr12_xferlen,
1763           {"Transfer Length", "scsi.sbc.rdwr12.xferlen", FT_UINT32, BASE_DEC, NULL,
1764            0x0, NULL, HFILL}},
1765         { &hf_scsi_sbc_rdwr16_lba,
1766           {"Logical Block Address (LBA)", "scsi.sbc.rdwr16.lba", FT_BYTES, BASE_NONE,
1767            NULL, 0x0, NULL, HFILL}},
1768         { &hf_scsi_sbc_ssu_immed,
1769           {"Immediate", "scsi.sbc.ssu.immediate", FT_BOOLEAN, 8, NULL,
1770            0x01, NULL, HFILL}},
1771         { &hf_scsi_sbc_ssu_pwr_cond,
1772           {"Power Conditions", "scsi.sbc.ssu.pwr", FT_UINT8, BASE_HEX,
1773            VALS (scsi_ssu_pwrcnd_val), 0xF0, NULL, HFILL}},
1774         { &hf_scsi_sbc_ssu_loej,
1775           {"LOEJ", "scsi.sbc.ssu.loej", FT_BOOLEAN, 8, NULL, 0x2, NULL,
1776            HFILL}},
1777         { &hf_scsi_sbc_ssu_start,
1778           {"Start", "scsi.sbc.ssu.start", FT_BOOLEAN, 8, NULL, 0x1,
1779            NULL, HFILL}},
1780         { &hf_scsi_sbc_bytchk,
1781           {"BYTCHK", "scsi.sbc.bytchk", FT_BOOLEAN, 8,
1782            NULL, 0x02, NULL, HFILL}},
1783         { &hf_scsi_sbc_verify_reladdr,
1784           {"RELADDR", "scsi.sbc.verify.reladdr", FT_BOOLEAN, 8, NULL,
1785            0x1, NULL, HFILL}},
1786         { &hf_scsi_sbc_verify_lba,
1787           {"LBA", "scsi.sbc.verify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
1788            HFILL}},
1789         { &hf_scsi_sbc_verify_lba64,
1790           {"LBA", "scsi.sbc.verify.lba64", FT_UINT64, BASE_DEC, NULL, 0x0, NULL,
1791            HFILL}},
1792         { &hf_scsi_sbc_verify_vlen,
1793           {"Verification Length", "scsi.sbc.verify.vlen", FT_UINT16,
1794            BASE_DEC, NULL, 0x0, NULL, HFILL}},
1795         { &hf_scsi_sbc_verify_vlen32,
1796           {"Verification Length", "scsi.sbc.verify.vlen32", FT_UINT32,
1797            BASE_DEC, NULL, 0x0, NULL, HFILL}},
1798         { &hf_scsi_sbc_wrverify_lba,
1799           {"LBA", "scsi.sbc.wrverify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
1800            HFILL}},
1801         { &hf_scsi_sbc_wrverify_xferlen,
1802           {"Transfer Length", "scsi.sbc.wrverify.xferlen", FT_UINT16, BASE_DEC,
1803            NULL, 0x0, NULL, HFILL}},
1804         { &hf_scsi_sbc_wrverify_lba64,
1805           {"LBA", "scsi.sbc.wrverify.lba64", FT_UINT64, BASE_DEC, NULL, 0x0,
1806            NULL, HFILL}},
1807         { &hf_scsi_sbc_wrverify_xferlen32,
1808           {"Transfer Length", "scsi.sbc.wrverify.xferlen32", FT_UINT32,
1809            BASE_DEC, NULL, 0x0, NULL, HFILL}},
1810         { &hf_scsi_sbc_readcapacity_flags,
1811           {"Flags", "scsi.sbc.readcapacity.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
1812            NULL, HFILL}},
1813         { &hf_scsi_sbc_readcapacity_lba,
1814           {"Logical Block Address", "scsi.sbc.readcapacity.lba", FT_UINT32, BASE_DEC,
1815            NULL, 0x0, NULL, HFILL}},
1816         { &hf_scsi_sbc_readdefdata_flags,
1817           {"Flags", "scsi.sbc.readdefdata.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1818            HFILL}},
1819         { &hf_scsi_sbc_reassignblks_flags,
1820           {"Flags", "scsi.sbc.reassignblks.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1821            HFILL}},
1822         { &hf_scsi_sbc_read_flags,
1823           {"Flags", "scsi.sbc.read.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1824            HFILL}},
1825         { &hf_scsi_sbc_alloclen32,
1826           {"Allocation Length", "scsi.sbc.alloclen32", FT_UINT32, BASE_DEC,
1827            NULL, 0x0, NULL, HFILL}},
1828         { &hf_scsi_sbc_alloclen16,
1829           {"Allocation Length", "scsi.sbc.alloclen16", FT_UINT16, BASE_DEC,
1830            NULL, 0x0, NULL, HFILL}},
1831         { &hf_scsi_sbc_fuflags_fmtpinfo,
1832           {"FMTPINFO", "scsi.sbc.format_unit.fmtpinfo", FT_BOOLEAN, 8,
1833            NULL, 0x80, NULL, HFILL}},
1834         { &hf_scsi_sbc_fuflags_rto_req,
1835           {"RTO_REQ", "scsi.sbc.format_unit.rto_req", FT_BOOLEAN, 8,
1836            NULL, 0x40, NULL, HFILL}},
1837         { &hf_scsi_sbc_fuflags_longlist,
1838           {"LONGLIST", "scsi.sbc.format_unit.longlist", FT_BOOLEAN, 8,
1839            NULL, 0x20, NULL, HFILL}},
1840         { &hf_scsi_sbc_fuflags_fmtdata,
1841           {"FMTDATA", "scsi.sbc.format_unit.fmtdata", FT_BOOLEAN, 8,
1842            NULL, 0x10, NULL, HFILL}},
1843         { &hf_scsi_sbc_fuflags_cmplist,
1844           {"CMPLIST", "scsi.sbc.format_unit.cmplist", FT_BOOLEAN, 8,
1845            NULL, 0x08, NULL, HFILL}},
1846         { &hf_scsi_sbc_prefetch_flags,
1847           {"Flags", "scsi.sbc.prefetch.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1848            HFILL}},
1849         { &hf_scsi_sbc_prefetch_immed,
1850           {"Immediate", "scsi.sbc.prefetch.immediate", FT_BOOLEAN, 8, NULL,
1851            0x2, NULL, HFILL}},
1852         { &hf_scsi_sbc_group,
1853           {"Group", "scsi.sbc.group", FT_UINT8, BASE_HEX, NULL,
1854            0x1f, NULL, HFILL}},
1855         { &hf_scsi_sbc_rdprotect,
1856           {"RDPROTECT", "scsi.sbc.rdprotect", FT_UINT8, BASE_HEX,
1857            NULL, 0xe0, NULL, HFILL}},
1858         { &hf_scsi_sbc_dpo,
1859           {"DPO", "scsi.sbc.dpo", FT_BOOLEAN, 8,
1860            TFS(&dpo_tfs), 0x10, "DisablePageOut: Whether the device should cache the data or not", HFILL}},
1861         { &hf_scsi_sbc_fua,
1862           {"FUA", "scsi.sbc.fua", FT_BOOLEAN, 8,
1863            TFS(&fua_tfs), 0x08, "ForceUnitAccess: Whether to allow reading from the cache or not", HFILL}},
1864         { &hf_scsi_sbc_fua_nv,
1865           {"FUA_NV", "scsi.sbc.fua_nv", FT_BOOLEAN, 8,
1866            TFS(&fua_nv_tfs), 0x02, "ForceUnitAccess_NonVolatile: Whether to allow reading from non-volatile cache or not", HFILL}},
1867         { &hf_scsi_sbc_pmi,
1868           {"PMI", "scsi.sbc.pmi", FT_BOOLEAN, 8,
1869            TFS(&pmi_tfs), 0x01, "Partial Medium Indicator", HFILL}},
1870         { &hf_scsi_sbc_pmi_flags,
1871           {"PMI Flags", "scsi.sbc.pmi_flags", FT_UINT8, BASE_HEX,
1872            NULL, 0, NULL, HFILL}},
1873         { &hf_scsi_sbc_blocksize,
1874           {"Block size in bytes", "scsi.sbc.blocksize", FT_UINT32, BASE_DEC,
1875            NULL, 0, NULL, HFILL}},
1876         { &hf_scsi_sbc_returned_lba,
1877           {"Returned LBA", "scsi.sbc.returned_lba", FT_UINT32, BASE_DEC,
1878            NULL, 0, NULL, HFILL}},
1879         { &hf_scsi_sbc_req_plist,
1880           {"REQ_PLIST", "scsi.sbc.req_plist", FT_BOOLEAN, 8,
1881            NULL, 0x10, NULL, HFILL}},
1882         { &hf_scsi_sbc_req_glist,
1883           {"REQ_GLIST", "scsi.sbc.req_glist", FT_BOOLEAN, 8,
1884            NULL, 0x08, NULL, HFILL}},
1885         { &hf_scsi_sbc_corrct,
1886           {"CORRCT", "scsi.sbc.corrct", FT_BOOLEAN, 8,
1887            NULL, 0x02, NULL, HFILL}},
1888         { &hf_scsi_sbc_corrct_flags,
1889           {"Flags", "scsi.sbc.corrct_flags", FT_UINT8, BASE_HEX,
1890            NULL, 0, NULL, HFILL}},
1891         { &hf_scsi_sbc_reassignblocks_longlba,
1892           {"LongLBA", "scsi.sbc.reassignblocks.longlba", FT_BOOLEAN, 8,
1893            NULL, 0x02, NULL, HFILL}},
1894         { &hf_scsi_sbc_reassignblocks_longlist,
1895           {"LongList", "scsi.sbc.reassignblocks.longlist", FT_BOOLEAN, 8,
1896            NULL, 0x01, NULL, HFILL}},
1897         { &hf_scsi_sbc_ssu_immed_flags,
1898           {"Immed flags", "scsi.sbc.ssu.immed_flags", FT_UINT8, BASE_HEX,
1899            NULL, 0, NULL, HFILL}},
1900         { &hf_scsi_sbc_ssu_pwr_flags,
1901           {"Pwr flags", "scsi.sbc.ssu.pwr_flags", FT_UINT8, BASE_HEX,
1902            NULL, 0, NULL, HFILL}},
1903         { &hf_scsi_sbc_synccache_flags,
1904           {"Flags", "scsi.sbc.synccache.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1905            HFILL}},
1906         { &hf_scsi_sbc_synccache_immed,
1907           {"Immediate", "scsi.sbc.synccache.immediate", FT_BOOLEAN, 8, NULL,
1908            0x02, NULL, HFILL}},
1909         { &hf_scsi_sbc_synccache_sync_nv,
1910           {"SYNC_NV", "scsi.sbc.synccache.sync_nv", FT_BOOLEAN, 8, NULL,
1911            0x04, NULL, HFILL}},
1912         { &hf_scsi_sbc_vrprotect,
1913           {"VRPROTECT", "scsi.sbc.vrprotect", FT_UINT8, BASE_HEX,
1914            NULL, 0xe0, NULL, HFILL}},
1915         { &hf_scsi_sbc_verify_flags,
1916           {"Flags", "scsi.sbc.verify_flags", FT_UINT8, BASE_HEX,
1917            NULL, 0, NULL, HFILL}},
1918         { &hf_scsi_sbc_wrprotect,
1919           {"WRPROTECT", "scsi.sbc.wrprotect", FT_UINT8, BASE_HEX,
1920            NULL, 0xe0, NULL, HFILL}},
1921         { &hf_scsi_sbc_wrverify_flags,
1922           {"Flags", "scsi.sbc.wrverify_flags", FT_UINT8, BASE_HEX,
1923            NULL, 0, NULL, HFILL}},
1924         { &hf_scsi_sbc_writesame_flags,
1925           {"Flags", "scsi.sbc.writesame_flags", FT_UINT8, BASE_HEX,
1926            NULL, 0, NULL, HFILL}},
1927         { &hf_scsi_sbc_pbdata,
1928           {"PBDATA", "scsi.sbc.pbdata", FT_BOOLEAN, 8, NULL,
1929            0x04, NULL, HFILL}},
1930         { &hf_scsi_sbc_lbdata,
1931           {"LBDATA", "scsi.sbc.lbdata", FT_BOOLEAN, 8, NULL,
1932            0x02, NULL, HFILL}},
1933         { &hf_scsi_sbc_xdread_flags,
1934           {"Flags", "scsi.sbc.xdread.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1935            HFILL}},
1936         { &hf_scsi_sbc_xorpinfo,
1937           {"XORPINFO", "scsi.sbc.xorpinfo", FT_BOOLEAN, 8, NULL,
1938            0x01, NULL, HFILL}},
1939         { &hf_scsi_sbc_disable_write,
1940           {"DISABLE_WRITE", "scsi.sbc.disable_write", FT_BOOLEAN, 8, NULL,
1941            0x04, NULL, HFILL}},
1942         { &hf_scsi_sbc_xdwrite_flags,
1943           {"Flags", "scsi.sbc.xdwrite.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1944            HFILL}},
1945         { &hf_scsi_sbc_xdwriteread_flags,
1946           {"Flags", "scsi.sbc.xdwriteread.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1947            HFILL}},
1948         { &hf_scsi_sbc_xpwrite_flags,
1949           {"Flags", "scsi.sbc.xpwrite.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
1950            HFILL}},
1951         };
1952
1953
1954         /* Setup protocol subtree array */
1955         static gint *ett[] = {
1956                 &ett_scsi_format_unit,
1957                 &ett_scsi_prefetch,
1958                 &ett_scsi_pmi,
1959                 &ett_scsi_rdwr,
1960                 &ett_scsi_xdread,
1961                 &ett_scsi_xdwrite,
1962                 &ett_scsi_xdwriteread,
1963                 &ett_scsi_xpwrite,
1964                 &ett_scsi_defectdata,
1965                 &ett_scsi_corrct,
1966                 &ett_scsi_reassign_blocks,
1967                 &ett_scsi_ssu_immed,
1968                 &ett_scsi_ssu_pwr,
1969                 &ett_scsi_synccache,
1970                 &ett_scsi_verify,
1971                 &ett_scsi_wrverify,
1972                 &ett_scsi_writesame
1973         };
1974
1975         /* Register the protocol name and description */
1976         proto_scsi_sbc = proto_register_protocol("SCSI_SBC", "SCSI_SBC", "scsi_sbc");
1977
1978         /* Required function calls to register the header fields and subtrees used */
1979         proto_register_field_array(proto_scsi_sbc, hf, array_length(hf));
1980         proto_register_subtree_array(ett, array_length(ett));
1981 }
1982
1983 void
1984 proto_reg_handoff_scsi_sbc(void)
1985 {
1986 }
1987