summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-scsi-sbc.c
blob: 4a4880233752220dbd7caefa154a0b088b085c13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
/* TODO  add dissection of opcode 0x7f and READ32 */
/* packet-scsi-sbc.c
 * Dissector for the SCSI SBC commandset
 * Extracted from packet-scsi.c
 *
 * Dinesh G Dutt (ddutt@cisco.com)
 * Ronnie sahlberg 2006
 *
 * $Id$
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 2002 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <glib.h>
#include <string.h>
#include <epan/strutil.h>
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include <epan/conversation.h>
#include <epan/tap.h>
#include "packet-scsi.h"
#include "packet-fc.h"
#include "packet-scsi-sbc.h"


static int proto_scsi_sbc			= -1;
int hf_scsi_sbc_opcode				= -1;
static int hf_scsi_sbc_formatunit_flags		= -1;
static int hf_scsi_sbc_defect_list_format	= -1;
static int hf_scsi_sbc_formatunit_vendor	= -1;
static int hf_scsi_sbc_formatunit_interleave	= -1;
static int hf_scsi_sbc_rdwr6_lba		= -1;
static int hf_scsi_sbc_rdwr6_xferlen		= -1;
static int hf_scsi_sbc_rdwr10_lba		= -1;
static int hf_scsi_sbc_rdwr10_xferlen		= -1;
static int hf_scsi_sbc_rdwr12_xferlen		= -1;
static int hf_scsi_sbc_rdwr16_lba		= -1;
static int hf_scsi_sbc_ssu_immed		= -1;
static int hf_scsi_sbc_ssu_pwr_cond		= -1;
static int hf_scsi_sbc_ssu_loej			= -1;
static int hf_scsi_sbc_ssu_start		= -1;
static int hf_scsi_sbc_verify_blkvfy		= -1;
static int hf_scsi_sbc_verify_bytchk		= -1;
static int hf_scsi_sbc_verify_reladdr		= -1;
static int hf_scsi_sbc_verify_lba		= -1;
static int hf_scsi_sbc_verify_vlen		= -1;
static int hf_scsi_sbc_verify_vlen32		= -1;
static int hf_scsi_sbc_wrverify_ebp		= -1;
static int hf_scsi_sbc_wrverify_lba		= -1;
static int hf_scsi_sbc_wrverify_xferlen		= -1;
static int hf_scsi_sbc_wrverify_lba64		= -1;
static int hf_scsi_sbc_wrverify_xferlen32	= -1;
static int hf_scsi_sbc_readcapacity_flags	= -1;
static int hf_scsi_sbc_readcapacity_lba		= -1;
static int hf_scsi_sbc_readdefdata_flags	= -1;
static int hf_scsi_sbc_reassignblks_flags	= -1;
static int hf_scsi_sbc_read_flags		= -1;
static int hf_scsi_sbc_alloclen32		= -1;
static int hf_scsi_sbc_alloclen16		= -1;
static int hf_scsi_sbc_fuflags_fmtpinfo		= -1;
static int hf_scsi_sbc_fuflags_rto_req		= -1;
static int hf_scsi_sbc_fuflags_longlist		= -1;
static int hf_scsi_sbc_fuflags_fmtdata		= -1;
static int hf_scsi_sbc_fuflags_cmplist		= -1;
static int hf_scsi_sbc_prefetch_flags		= -1;
static int hf_scsi_sbc_prefetch_immed		= -1;
static int hf_scsi_sbc_group			= -1;
static int hf_scsi_sbc_rdprotect		= -1;
static int hf_scsi_sbc_dpo			= -1;
static int hf_scsi_sbc_fua			= -1;
static int hf_scsi_sbc_fua_nv			= -1;
static int hf_scsi_sbc_pmi_flags		= -1;
static int hf_scsi_sbc_pmi			= -1;
static int hf_scsi_sbc_blocksize		= -1;
static int hf_scsi_sbc_returned_lba		= -1;
static int hf_scsi_sbc_req_plist		= -1;
static int hf_scsi_sbc_req_glist		= -1;
static int hf_scsi_sbc_corrct_flags		= -1;
static int hf_scsi_sbc_corrct			= -1;

static gint ett_scsi_format_unit		= -1;
static gint ett_scsi_prefetch			= -1;
static gint ett_scsi_rdwr			= -1;
static gint ett_scsi_pmi			= -1;
static gint ett_scsi_defectdata			= -1;
static gint ett_scsi_corrct			= -1;



static const true_false_string dpo_tfs = {
    "Disable Page Out (dont cache this data)",
    "Disable page out is DISABLED (cache this data)"
};
static const true_false_string fua_tfs = {
    "Read from the medium, not cache",
    "Read from cache if possible"
};
static const true_false_string fua_nv_tfs = {
    "Read from volatile cache is NOT permitted",
    "Read from volatile or non-volatile cache permitted"
};
static const true_false_string pmi_tfs = {
    "PMI is SET",
    "Pmi is CLEAR"
};

static void
dissect_sbc_formatunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                         guint offset, gboolean isreq, gboolean iscdb,
                         guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;
    static const int *fuflags_fields[] = {
	&hf_scsi_sbc_fuflags_fmtpinfo,
	&hf_scsi_sbc_fuflags_rto_req,
	&hf_scsi_sbc_fuflags_longlist,
	&hf_scsi_sbc_fuflags_fmtdata,
	&hf_scsi_sbc_fuflags_cmplist,
	&hf_scsi_sbc_defect_list_format,
	NULL
    };

    if (!tree)
        return;

    if (isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_formatunit_flags, ett_scsi_format_unit, fuflags_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_formatunit_vendor, tvb, offset+1,
                             1, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_formatunit_interleave, tvb, offset+2,
                             2, 0);
        flags = tvb_get_guint8 (tvb, offset+4);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
    /* TODO : add dissection of DATA */
}

static void
dissect_sbc2_readwrite6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                    guint offset, gboolean isreq, gboolean iscdb,
                    guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%06x, Len: %u)",
                             tvb_get_ntoh24 (tvb, offset),
                             tvb_get_guint8 (tvb, offset+3));
    }

    if (tree && isreq && iscdb) {
        proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_lba, tvb, offset, 3, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_rdwr6_xferlen, tvb, offset+3, 1, 0);
        flags = tvb_get_guint8 (tvb, offset+4);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}

static void
dissect_sbc_prefetch10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                     guint offset, gboolean isreq, gboolean iscdb,
                     guint payload_len _U_, scsi_task_data_t *cdata _U_)

{
    guint8 flags;
    static const int *prefetch_fields[] = {
	&hf_scsi_sbc_prefetch_immed,
	NULL
    };

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
                             tvb_get_ntohl (tvb, offset+1),
                             tvb_get_ntohs (tvb, offset+6));
    }

    if (tree && isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_prefetch_flags, ett_scsi_prefetch, prefetch_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);

        proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);

        proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
        flags = tvb_get_guint8 (tvb, offset+8);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}
static void
dissect_sbc_prefetch16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                     guint offset, gboolean isreq, gboolean iscdb,
                     guint payload_len _U_, scsi_task_data_t *cdata _U_)

{
    guint8 flags;
    static const int *prefetch_fields[] = {
	&hf_scsi_sbc_prefetch_immed,
	NULL
    };

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
                             tvb_get_ntoh64 (tvb, offset+1),
                             tvb_get_ntohl (tvb, offset+9));
    }

    if (tree && isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_prefetch_flags, ett_scsi_prefetch, prefetch_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);

        flags = tvb_get_guint8 (tvb, offset+14);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}

void
dissect_sbc2_readwrite10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                     guint offset, gboolean isreq, gboolean iscdb,
                     guint payload_len _U_, scsi_task_data_t *cdata _U_)

{
    guint8 flags;
    static const int *rdwr10_fields[] = {
	&hf_scsi_sbc_rdprotect,
	&hf_scsi_sbc_dpo,
	&hf_scsi_sbc_fua,
	&hf_scsi_sbc_fua_nv,
	NULL
    };

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
                             tvb_get_ntohl (tvb, offset+1),
                             tvb_get_ntohs (tvb, offset+6));
    }

    if (tree && isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr10_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+5, 1, 0);

        proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_xferlen, tvb, offset+6, 2, 0);
        flags = tvb_get_guint8 (tvb, offset+8);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}

void
dissect_sbc2_readwrite12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                     guint offset, gboolean isreq, gboolean iscdb,
                     guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;
    static const int *rdwr12_fields[] = {
	&hf_scsi_sbc_rdprotect,
	&hf_scsi_sbc_dpo,
	&hf_scsi_sbc_fua,
	&hf_scsi_sbc_fua_nv,
	NULL
    };

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
                             tvb_get_ntohl (tvb, offset+1),
                             tvb_get_ntohl (tvb, offset+5));
    }

    if (tree && isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr12_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+5, 4, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+9, 1, 0);

        flags = tvb_get_guint8 (tvb, offset+10);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}

static void
dissect_sbc2_readwrite16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                     guint offset, gboolean isreq, gboolean iscdb,
                     guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;
    static const int *rdwr16_fields[] = {
	&hf_scsi_sbc_rdprotect,
	&hf_scsi_sbc_dpo,
	&hf_scsi_sbc_fua,
	&hf_scsi_sbc_fua_nv,
	NULL
    };

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
                             tvb_get_ntoh64 (tvb, offset+1),
                             tvb_get_ntohl (tvb, offset+9));
    }

    if (tree && isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_read_flags, ett_scsi_rdwr, rdwr16_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_rdwr16_lba, tvb, offset+1, 8, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_rdwr12_xferlen, tvb, offset+9, 4, 0);
        proto_tree_add_item (tree, hf_scsi_sbc_group, tvb, offset+13, 1, 0);

        flags = tvb_get_guint8 (tvb, offset+14);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+14, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}


static const value_string scsi_ssu_pwrcnd_val[] = {
    {0x0, "No Change"},
    {0x1, "Place Device In Active Condition"},
    {0x2, "Place device into Idle condition"},
    {0x3, "Place device into Standby condition"},
    {0x4, "Reserved"},
    {0x5, "Place device into Sleep condition"},
    {0x6, "Reserved"},
    {0x7, "Transfer control of power conditions to block device"},
    {0x8, "Reserved"},
    {0x9, "Reserved"},
    {0xA, "Force Idle Condition Timer to zero"},
    {0xB, "Force Standby Condition Timer to zero"},
    {0, NULL},
};

void
dissect_sbc2_startstopunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                            guint offset, gboolean isreq _U_, gboolean iscdb,
                            guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;

    if (!tree || !iscdb)
        return;

    proto_tree_add_boolean (tree, hf_scsi_sbc_ssu_immed, tvb, offset, 1, 0);
    proto_tree_add_uint (tree, hf_scsi_sbc_ssu_pwr_cond, tvb, offset+3, 1, 0);
    proto_tree_add_boolean (tree, hf_scsi_sbc_ssu_loej, tvb, offset+3, 1, 0);
    proto_tree_add_boolean (tree, hf_scsi_sbc_ssu_start, tvb, offset+3, 1, 0);

    flags = tvb_get_guint8 (tvb, offset+4);
    proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
                                flags,
                                "Vendor Unique = %u, NACA = %u, Link = %u",
                                flags & 0xC0, flags & 0x4, flags & 0x1);
}

static void
dissect_sbc2_verify10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                       guint offset, gboolean isreq, gboolean iscdb,
                       guint payload_len _U_, scsi_task_data_t *cdata _U_)

{
    guint8 flags;

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
                             tvb_get_ntohl (tvb, offset+2),
                             tvb_get_ntohs (tvb, offset+7));
    }

    if (tree && isreq && iscdb) {
         proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_blkvfy, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_bytchk, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1,
                              0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+2, 4, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen, tvb, offset+7, 2, 0);
         flags = tvb_get_guint8 (tvb, offset+9);
         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+9, 1,
                                     flags,
                                     "Vendor Unique = %u, NACA = %u, Link = %u",
                                     flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}

static void
dissect_sbc2_verify12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                       guint offset, gboolean isreq, gboolean iscdb,
                       guint payload_len _U_, scsi_task_data_t *cdata _U_)

{
    guint8 flags;

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
                             tvb_get_ntohl (tvb, offset+2),
                             tvb_get_ntohl (tvb, offset+6));
    }

    if (tree && isreq && iscdb) {
         proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_blkvfy, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_bytchk, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1,
                              0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+2, 4, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen32, tvb, offset+6, 4, 0);
         flags = tvb_get_guint8 (tvb, offset+11);
         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+11, 1,
                                     flags,
                                     "Vendor Unique = %u, NACA = %u, Link = %u",
                                     flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}

static void
dissect_sbc2_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                       guint offset, gboolean isreq, gboolean iscdb,
                       guint payload_len _U_, scsi_task_data_t *cdata _U_)

{
    guint8 flags;

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
                             tvb_get_ntoh64 (tvb, offset+2),
                             tvb_get_ntohl (tvb, offset+10));
    }

    if (tree && isreq && iscdb) {
         proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_blkvfy, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_bytchk, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1,
                              0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_lba, tvb, offset+2, 8, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_vlen, tvb, offset+10, 4, 0);
         flags = tvb_get_guint8 (tvb, offset+15);
         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+15, 1,
                                     flags,
                                     "Vendor Unique = %u, NACA = %u, Link = %u",
                                     flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}


static void
dissect_sbc2_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_,
                         proto_tree *tree, guint offset, gboolean isreq,
                         gboolean iscdb, guint payload_len _U_,
                         scsi_task_data_t *cdata _U_)

{
    guint8 flags;

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
                             tvb_get_ntohl (tvb, offset+2),
                             tvb_get_ntohs (tvb, offset+7));
    }

    if (tree && isreq && iscdb) {
         proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_ebp, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_bytchk, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1,
                              0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+2, 4, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen, tvb, offset+7,
                              2, 0);
         flags = tvb_get_guint8 (tvb, offset+9);
         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+9, 1,
                                     flags,
                                     "Vendor Unique = %u, NACA = %u, Link = %u",
                                     flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}

static void
dissect_sbc2_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_,
                         proto_tree *tree, guint offset, gboolean isreq,
                         gboolean iscdb, guint payload_len _U_,
                         scsi_task_data_t *cdata _U_)
{
    guint8 flags;

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
                             tvb_get_ntohl (tvb, offset+2),
                             tvb_get_ntohl (tvb, offset+6));
    }

    if (tree && isreq && iscdb) {
         proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_ebp, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_bytchk, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1,
                              0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba, tvb, offset+2, 4, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+6,
                              4, 0);
         flags = tvb_get_guint8 (tvb, offset+11);
         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+11, 1,
                                     flags,
                                     "Vendor Unique = %u, NACA = %u, Link = %u",
                                     flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}

static void
dissect_sbc2_wrverify16 (tvbuff_t *tvb, packet_info *pinfo _U_,
                         proto_tree *tree, guint offset, gboolean isreq,
                         gboolean iscdb, guint payload_len _U_,
                         scsi_task_data_t *cdata _U_)
{
    guint8 flags;

    if (isreq && iscdb) {
        if (check_col (pinfo->cinfo, COL_INFO))
            col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
                             tvb_get_ntoh64 (tvb, offset+2),
                             tvb_get_ntohl (tvb, offset+10));
    }

    if (tree && isreq && iscdb) {
         proto_tree_add_item (tree, hf_scsi_sbc_dpo, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_ebp, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_bytchk, tvb, offset+1, 1, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_verify_reladdr, tvb, offset+1, 1,
                              0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_lba64, tvb, offset+2, 8, 0);
         proto_tree_add_item (tree, hf_scsi_sbc_wrverify_xferlen32, tvb, offset+10,
                              4, 0);
         flags = tvb_get_guint8 (tvb, offset+15);
         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+15, 1,
                                     flags,
                                     "Vendor Unique = %u, NACA = %u, Link = %u",
                                     flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}


void
dissect_sbc2_readcapacity10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
                           guint offset, gboolean isreq, gboolean iscdb,
                           guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;
    guint32 len, block_len, tot_len;
    const char *un;
    static const int *pmi_fields[] = {
        &hf_scsi_sbc_pmi,
	NULL
    };

    if (!tree)
        return;

    if (isreq && iscdb) {
        proto_tree_add_item (tree, hf_scsi_sbc_readcapacity_lba, tvb, offset+1,
                             4, 0);
	proto_tree_add_bitmask(tree, tvb, offset+7, hf_scsi_sbc_pmi_flags, ett_scsi_pmi, pmi_fields, FALSE);


        flags = tvb_get_guint8 (tvb, offset+8);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
    else if (!iscdb) {
        len = tvb_get_ntohl (tvb, offset);
        block_len = tvb_get_ntohl (tvb, offset+4);
        tot_len=((len/1024)*block_len)/1024; /*MB*/
        un="MB";
        if(tot_len>20000){
            tot_len/=1024;
            un="GB";
        }
        proto_tree_add_uint_format (tree, hf_scsi_sbc_returned_lba, tvb, offset, 4, len, "LBA: %u (%u %s)", len, tot_len, un);
        proto_tree_add_item (tree, hf_scsi_sbc_blocksize, tvb, offset+4, 4, 0);
    }
}

static void
dissect_sbc2_readdefectdata10 (tvbuff_t *tvb, packet_info *pinfo _U_,
                            proto_tree *tree, guint offset, gboolean isreq,
                            gboolean iscdb,
                            guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;
    static const int *defect_fields[] = {
	&hf_scsi_sbc_defect_list_format,
	&hf_scsi_sbc_req_plist,
	&hf_scsi_sbc_req_glist,
	NULL
    };

    if (!tree)
        return;

    if (isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_sbc_readdefdata_flags, ett_scsi_defectdata, defect_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, 0);
        flags = tvb_get_guint8 (tvb, offset+8);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
    /* TODO : add dissection of DATA */
}


static void
dissect_sbc_readlong10 (tvbuff_t *tvb, packet_info *pinfo _U_,
                            proto_tree *tree, guint offset, gboolean isreq,
                            gboolean iscdb,
                            guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;
    static const int *corrct_fields[] = {
	&hf_scsi_sbc_corrct,
	NULL
    };

    if (!tree)
        return;

    if (isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_corrct_flags, ett_scsi_corrct, corrct_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_rdwr10_lba, tvb, offset+1, 4, 0);

        proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset+6, 2, 0);
        flags = tvb_get_guint8 (tvb, offset+8);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}


static void
dissect_sbc2_readdefectdata12 (tvbuff_t *tvb, packet_info *pinfo _U_,
                            proto_tree *tree, guint offset, gboolean isreq,
                            gboolean iscdb,
                            guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;
    static const int *defect_fields[] = {
	&hf_scsi_sbc_defect_list_format,
	&hf_scsi_sbc_req_plist,
	&hf_scsi_sbc_req_glist,
	NULL
    };

    if (!tree)
        return;

    if (isreq && iscdb) {
	proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_readdefdata_flags, ett_scsi_defectdata, defect_fields, FALSE);

        proto_tree_add_item (tree, hf_scsi_sbc_alloclen32, tvb, offset+5, 4, 0);
        flags = tvb_get_guint8 (tvb, offset+10);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+10, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
    /* TODO : add dissection of DATA */
}


static void
dissect_sbc2_reassignblocks (tvbuff_t *tvb, packet_info *pinfo _U_,
                           proto_tree *tree, guint offset, gboolean isreq,
                           gboolean iscdb,
                           guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 flags;

    if (!tree)
        return;

    if (isreq && iscdb) {
        flags = tvb_get_guint8 (tvb, offset);

        proto_tree_add_uint_format (tree, hf_scsi_sbc_reassignblks_flags, tvb,
                                    offset, 1, flags,
                                    "LongLBA = %u, LongList = %u",
                                    flags & 0x2, flags & 0x1);
        flags = tvb_get_guint8 (tvb, offset+4);
        proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
    }
}


const value_string service_action_vals[] = {
	{SHORT_FORM_BLOCK_ID,        "Short Form - Block ID"},
	{SHORT_FORM_VENDOR_SPECIFIC, "Short Form - Vendor-Specific"},
	{LONG_FORM,                  "Long Form"},
	{EXTENDED_FORM,              "Extended Form"},
	{SERVICE_READ_CAPACITY16,    "Read Capacity(16)"},
	{SERVICE_READ_LONG16,	     "Read Long(16)"},
	{0, NULL}
};

/* this is either readcapacity16  or  readlong16  depending of what service
   action is set to.
*/
static void
dissect_sbc2_serviceactionin16 (tvbuff_t *tvb, packet_info *pinfo _U_,
                           proto_tree *tree, guint offset, gboolean isreq,
                           gboolean iscdb,
                           guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
    guint8 service_action, flags;
    guint32 block_len;
    guint64 len, tot_len;
    char *un;
    static const int *pmi_fields[] = {
        &hf_scsi_sbc_pmi,
	NULL
    };

    if (!tree)
        return;

    if (isreq && iscdb) {
        service_action = tvb_get_guint8 (tvb, offset) & 0x1F;
        if(cdata && cdata->itlq){
            cdata->itlq->flags=service_action;
        }

	switch(service_action){
	case SERVICE_READ_CAPACITY16:
        	proto_tree_add_text (tree, tvb, offset, 1,
                             "Service Action: %s",
                             val_to_str (service_action,
                                         service_action_vals,
                                         "Unknown (0x%02x)"));
		offset++;

        	proto_tree_add_text (tree, tvb, offset, 8,
                             "Logical Block Address: %" PRIu64,
                              tvb_get_ntoh64 (tvb, offset));
        	offset += 8;

	        proto_tree_add_item (tree, hf_scsi_sbc_alloclen32, tvb, offset, 4, 0);
		offset += 4;

		proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_sbc_pmi_flags, ett_scsi_pmi, pmi_fields, FALSE);
		offset++;

	        flags = tvb_get_guint8 (tvb, offset);
        	proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
		offset++;

		break;
	case SERVICE_READ_LONG16:
        	proto_tree_add_text (tree, tvb, offset, 1,
                             "Service Action: %s",
                             val_to_str (service_action,
                                         service_action_vals,
                                         "Unknown (0x%02x)"));
		offset++;

        	proto_tree_add_text (tree, tvb, offset, 8,
                             "Logical Block Address: %" PRIu64,
                              tvb_get_ntoh64 (tvb, offset));
        	offset+=8;

		/* two reserved bytes */
		offset+=2;

		proto_tree_add_item (tree, hf_scsi_sbc_alloclen16, tvb, offset, 2, 0);
		offset+=2;

		/* CORRCT bit */
		offset++;

	        flags = tvb_get_guint8 (tvb, offset);
        	proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset, 1,
                                    flags,
                                    "Vendor Unique = %u, NACA = %u, Link = %u",
                                    flags & 0xC0, flags & 0x4, flags & 0x1);
		offset++;

		break;
	};
    } else if (!iscdb) {
        if(cdata && cdata->itlq){
            switch(cdata->itlq->flags){
            case SERVICE_READ_CAPACITY16:
                len = tvb_get_ntoh64 (tvb, offset);
                block_len = tvb_get_ntohl (tvb, offset+8);
                tot_len=((len/1024)*block_len)/1024; /*MB*/
                un="MB";
                if(tot_len>20000){
                    tot_len/=1024;
                    un="GB";
                }
                proto_tree_add_text (tree, tvb, offset, 8, "LBA: %" PRIu64 " (%" PRIu64 " %s)",
                             len, tot_len, un);
                proto_tree_add_item (tree, hf_scsi_sbc_blocksize, tvb, offset+8, 4, 0);
                break;
            }
        }
    }
}


/* SBC Commands */
const value_string scsi_sbc_vals[] = {
    {SCSI_SPC2_EXTCOPY           , "Extended Copy"},
    {SCSI_SPC2_INQUIRY           , "Inquiry"},
    {SCSI_SBC2_FORMATUNIT        , "Format Unit"},
    {SCSI_SBC2_LOCKUNLKCACHE10   , "Lock Unlock Cache(10)"},
    {SCSI_SBC2_LOCKUNLKCACHE16   , "Lock Unlock Cache(16)"},
    {SCSI_SPC2_LOGSELECT         , "Log Select"},
    {SCSI_SPC2_LOGSENSE          , "Log Sense"},
    {SCSI_SPC2_MODESELECT6       , "Mode Select(6)"},
    {SCSI_SPC2_MODESELECT10      , "Mode Select(10)"},
    {SCSI_SPC2_MODESENSE6        , "Mode Sense(6)"},
    {SCSI_SPC2_MODESENSE10       , "Mode Sense(10)"},
    {SCSI_SPC2_PERSRESVIN        , "Persistent Reserve In"},
    {SCSI_SPC2_PERSRESVOUT       , "Persistent Reserve Out"},
    {SCSI_SBC2_PREFETCH10        , "Pre-Fetch(10)"},
    {SCSI_SBC2_PREFETCH16        , "Pre-Fetch(16)"},
    {SCSI_SPC2_PREVMEDREMOVAL    , "Prevent/Allow Medium Removal"},
    {SCSI_SBC2_READ6             , "Read(6)"},
    {SCSI_SBC2_READ10            , "Read(10)"},
    {SCSI_SBC2_READ12            , "Read(12)"},
    {SCSI_SBC2_READ16            , "Read(16)"},
    {SCSI_SBC2_READCAPACITY10    , "Read Capacity(10)"},
    {SCSI_SPC2_REPORTLUNS        , "Report LUNs"},
    {SCSI_SPC2_REQSENSE          , "Request Sense"},
    {SCSI_SBC2_SERVICEACTIONIN16 , "Service Action In(16)"},
    {SCSI_SBC2_READDEFDATA10     , "Read Defect Data(10)"},
    {SCSI_SBC2_READDEFDATA12     , "Read Defect Data(12)"},
    {SCSI_SBC2_READLONG          , "Read Long(10)"},
    {SCSI_SBC2_REASSIGNBLKS      , "Reassign Blocks"},
    {SCSI_SBC2_REBUILD16         , "Rebuild(16)"},
    {SCSI_SBC2_REBUILD32         , "Rebuild(32)"},
    {SCSI_SBC2_REGENERATE16      , "Regenerate(16)"},
    {SCSI_SBC2_REGENERATE32      , "Regenerate(32)"},
    {SCSI_SBC2_SEEK10            , "Seek(10)"},
    {SCSI_SPC2_SENDDIAG          , "Send Diagnostic"},
    {SCSI_SBC2_SETLIMITS10       , "Set Limits(10)"},
    {SCSI_SBC2_SETLIMITS12       , "Set Limits(12)"},
    {SCSI_SBC2_STARTSTOPUNIT     , "Start Stop Unit"},
    {SCSI_SBC2_SYNCCACHE10       , "Synchronize Cache(10)"},
    {SCSI_SBC2_SYNCCACHE16       , "Synchronize Cache(16)"},
    {SCSI_SPC2_TESTUNITRDY       , "Test Unit Ready"},
    {SCSI_SBC2_VERIFY10          , "Verify(10)"},
    {SCSI_SBC2_VERIFY12          , "Verify(12)"},
    {SCSI_SBC2_VERIFY16          , "Verify(16)"},
    {SCSI_SBC2_WRITE6            , "Write(6)"},
    {SCSI_SBC2_WRITE10           , "Write(10)"},
    {SCSI_SBC2_WRITE12           , "Write(12)"},
    {SCSI_SBC2_WRITE16           , "Write(16)"},
    {SCSI_SPC2_WRITEBUFFER       , "Write Buffer"},
    {SCSI_SBC2_WRITENVERIFY10    , "Write & Verify(10)"},
    {SCSI_SBC2_WRITENVERIFY12    , "Write & Verify(12)"},
    {SCSI_SBC2_WRITENVERIFY16    , "Write & Verify(16)"},
    {SCSI_SBC2_WRITELONG         , "Write Long"},
    {SCSI_SBC2_WRITESAME10       , "Write Same(10)"},
    {SCSI_SBC2_WRITESAME16       , "Write Same(16)"},
    {SCSI_SBC2_XDREAD10          , "XdRead(10)"},
    {SCSI_SBC2_XDREAD32          , "XdRead(32)"},
    {SCSI_SBC2_XDWRITE10         , "XdWrite(10)"},
    {SCSI_SBC2_XDWRITE32         , "XdWrite(32)"},
    {SCSI_SBC2_XDWRITEREAD10     , "XdWriteRead(10)"},
    {SCSI_SBC2_XDWRITEREAD32     , "XdWriteRead(32)"},
    {SCSI_SBC2_XDWRITEEXTD16     , "XdWrite Extended(16)"},
    {SCSI_SBC2_XDWRITEEXTD32     , "XdWrite Extended(32)"},
    {SCSI_SBC2_XPWRITE10         , "XpWrite(10)"},
    {SCSI_SBC2_XPWRITE32         , "XpWrite(32)"},
    {0, NULL},
};

scsi_cdb_table_t scsi_sbc_table[256] = {
/*SPC 0x00*/{dissect_spc3_testunitready},
/*SBC 0x01*/{NULL},
/*SBC 0x02*/{NULL},
/*SPC 0x03*/{dissect_spc3_requestsense},
/*SBC 0x04*/{dissect_sbc_formatunit},
/*SBC 0x05*/{NULL},
/*SBC 0x06*/{NULL},
/*SBC 0x07*/{dissect_sbc2_reassignblocks},
/*SBC 0x08*/{dissect_sbc2_readwrite6},
/*SBC 0x09*/{NULL},
/*SBC 0x0a*/{dissect_sbc2_readwrite6},
/*SBC 0x0b*/{NULL},
/*SBC 0x0c*/{NULL},
/*SBC 0x0d*/{NULL},
/*SBC 0x0e*/{NULL},
/*SBC 0x0f*/{NULL},
/*SBC 0x10*/{NULL},
/*SBC 0x11*/{NULL},
/*SPC 0x12*/{dissect_spc3_inquiry},
/*SBC 0x13*/{NULL},
/*SBC 0x14*/{NULL},
/*SPC 0x15*/{dissect_spc3_modeselect6},
/*SBC 0x16*/{NULL},
/*SBC 0x17*/{NULL},
/*SBC 0x18*/{NULL},
/*SBC 0x19*/{NULL},
/*SPC 0x1a*/{dissect_spc3_modesense6},
/*SBC 0x1b*/{dissect_sbc2_startstopunit},
/*SBC 0x1c*/{NULL},
/*SPC 0x1d*/{dissect_spc3_senddiagnostic},
/*SBC 0x1e*/{dissect_spc3_preventallowmediaremoval},
/*SBC 0x1f*/{NULL},
/*SBC 0x20*/{NULL},
/*SBC 0x21*/{NULL},
/*SBC 0x22*/{NULL},
/*SBC 0x23*/{NULL},
/*SBC 0x24*/{NULL},
/*SBC 0x25*/{dissect_sbc2_readcapacity10},
/*SBC 0x26*/{NULL},
/*SBC 0x27*/{NULL},
/*SBC 0x28*/{dissect_sbc2_readwrite10},
/*SBC 0x29*/{NULL},
/*SBC 0x2a*/{dissect_sbc2_readwrite10},
/*SBC 0x2b*/{NULL},
/*SBC 0x2c*/{NULL},
/*SBC 0x2d*/{NULL},
/*SBC 0x2e*/{dissect_sbc2_wrverify10},
/*SBC 0x2f*/{dissect_sbc2_verify10},
/*SBC 0x30*/{NULL},
/*SBC 0x31*/{NULL},
/*SBC 0x32*/{NULL},
/*SBC 0x33*/{NULL},
/*SBC 0x34*/{dissect_sbc_prefetch10},
/*SBC 0x35*/{NULL},
/*SBC 0x36*/{NULL},
/*SBC 0x37*/{dissect_sbc2_readdefectdata10},
/*SBC 0x38*/{NULL},
/*SBC 0x39*/{NULL},
/*SBC 0x3a*/{NULL},
/*SPC 0x3b*/{dissect_spc3_writebuffer},
/*SBC 0x3c*/{NULL},
/*SBC 0x3d*/{NULL},
/*SBC 0x3e*/{dissect_sbc_readlong10},
/*SBC 0x3f*/{NULL},
/*SBC 0x40*/{NULL},
/*SBC 0x41*/{NULL},
/*SBC 0x42*/{NULL},
/*SBC 0x43*/{NULL},
/*SBC 0x44*/{NULL},
/*SBC 0x45*/{NULL},
/*SBC 0x46*/{NULL},
/*SBC 0x47*/{NULL},
/*SBC 0x48*/{NULL},
/*SBC 0x49*/{NULL},
/*SBC 0x4a*/{NULL},
/*SBC 0x4b*/{NULL},
/*SPC 0x4c*/{dissect_spc3_logselect},
/*SPC 0x4d*/{dissect_spc3_logsense},
/*SBC 0x4e*/{NULL},
/*SBC 0x4f*/{NULL},
/*SBC 0x50*/{NULL},
/*SBC 0x51*/{NULL},
/*SBC 0x52*/{NULL},
/*SBC 0x53*/{NULL},
/*SBC 0x54*/{NULL},
/*SPC 0x55*/{dissect_spc3_modeselect10},
/*SBC 0x56*/{NULL},
/*SBC 0x57*/{NULL},
/*SBC 0x58*/{NULL},
/*SBC 0x59*/{NULL},
/*SPC 0x5a*/{dissect_spc3_modesense10},
/*SBC 0x5b*/{NULL},
/*SBC 0x5c*/{NULL},
/*SBC 0x5d*/{NULL},
/*SPC 0x5e*/{dissect_spc3_persistentreservein},
/*SPC 0x5f*/{dissect_spc3_persistentreserveout},
/*SBC 0x60*/{NULL},
/*SBC 0x61*/{NULL},
/*SBC 0x62*/{NULL},
/*SBC 0x63*/{NULL},
/*SBC 0x64*/{NULL},
/*SBC 0x65*/{NULL},
/*SBC 0x66*/{NULL},
/*SBC 0x67*/{NULL},
/*SBC 0x68*/{NULL},
/*SBC 0x69*/{NULL},
/*SBC 0x6a*/{NULL},
/*SBC 0x6b*/{NULL},
/*SBC 0x6c*/{NULL},
/*SBC 0x6d*/{NULL},
/*SBC 0x6e*/{NULL},
/*SBC 0x6f*/{NULL},
/*SBC 0x70*/{NULL},
/*SBC 0x71*/{NULL},
/*SBC 0x72*/{NULL},
/*SBC 0x73*/{NULL},
/*SBC 0x74*/{NULL},
/*SBC 0x75*/{NULL},
/*SBC 0x76*/{NULL},
/*SBC 0x77*/{NULL},
/*SBC 0x78*/{NULL},
/*SBC 0x79*/{NULL},
/*SBC 0x7a*/{NULL},
/*SBC 0x7b*/{NULL},
/*SBC 0x7c*/{NULL},
/*SBC 0x7d*/{NULL},
/*SBC 0x7e*/{NULL},
/*SBC 0x7f*/{NULL},
/*SBC 0x80*/{NULL},
/*SBC 0x81*/{NULL},
/*SBC 0x82*/{NULL},
/*SPC 0x83*/{dissect_spc3_extcopy},
/*SBC 0x84*/{NULL},
/*SBC 0x85*/{NULL},
/*SBC 0x86*/{NULL},
/*SBC 0x87*/{NULL},
/*SBC 0x88*/{dissect_sbc2_readwrite16},
/*SBC 0x89*/{NULL},
/*SBC 0x8a*/{dissect_sbc2_readwrite16},
/*SBC 0x8b*/{NULL},
/*SBC 0x8c*/{NULL},
/*SBC 0x8d*/{NULL},
/*SBC 0x8e*/{dissect_sbc2_wrverify16},
/*SBC 0x8f*/{dissect_sbc2_verify16},
/*SBC 0x90*/{dissect_sbc_prefetch16},
/*SBC 0x91*/{NULL},
/*SBC 0x92*/{NULL},
/*SBC 0x93*/{NULL},
/*SBC 0x94*/{NULL},
/*SBC 0x95*/{NULL},
/*SBC 0x96*/{NULL},
/*SBC 0x97*/{NULL},
/*SBC 0x98*/{NULL},
/*SBC 0x99*/{NULL},
/*SBC 0x9a*/{NULL},
/*SBC 0x9b*/{NULL},
/*SBC 0x9c*/{NULL},
/*SBC 0x9d*/{NULL},
/*SBC 0x9e*/{dissect_sbc2_serviceactionin16},
/*SBC 0x9f*/{NULL},
/*SPC 0xa0*/{dissect_spc3_reportluns},
/*SBC 0xa1*/{NULL},
/*SBC 0xa2*/{NULL},
/*SBC 0xa3*/{NULL},
/*SBC 0xa4*/{NULL},
/*SBC 0xa5*/{NULL},
/*SBC 0xa6*/{NULL},
/*SBC 0xa7*/{NULL},
/*SBC 0xa8*/{dissect_sbc2_readwrite12},
/*SBC 0xa9*/{NULL},
/*SBC 0xaa*/{dissect_sbc2_readwrite12},
/*SBC 0xab*/{NULL},
/*SBC 0xac*/{NULL},
/*SBC 0xad*/{NULL},
/*SBC 0xae*/{dissect_sbc2_wrverify12},
/*SBC 0xaf*/{dissect_sbc2_verify12},
/*SBC 0xb0*/{NULL},
/*SBC 0xb1*/{NULL},
/*SBC 0xb2*/{NULL},
/*SBC 0xb3*/{NULL},
/*SBC 0xb4*/{NULL},
/*SBC 0xb5*/{NULL},
/*SBC 0xb6*/{NULL},
/*SBC 0xb7*/{dissect_sbc2_readdefectdata12},
/*SBC 0xb8*/{NULL},
/*SBC 0xb9*/{NULL},
/*SBC 0xba*/{NULL},
/*SBC 0xbb*/{NULL},
/*SBC 0xbc*/{NULL},
/*SBC 0xbd*/{NULL},
/*SBC 0xbe*/{NULL},
/*SBC 0xbf*/{NULL},
/*SBC 0xc0*/{NULL},
/*SBC 0xc1*/{NULL},
/*SBC 0xc2*/{NULL},
/*SBC 0xc3*/{NULL},
/*SBC 0xc4*/{NULL},
/*SBC 0xc5*/{NULL},
/*SBC 0xc6*/{NULL},
/*SBC 0xc7*/{NULL},
/*SBC 0xc8*/{NULL},
/*SBC 0xc9*/{NULL},
/*SBC 0xca*/{NULL},
/*SBC 0xcb*/{NULL},
/*SBC 0xcc*/{NULL},
/*SBC 0xcd*/{NULL},
/*SBC 0xce*/{NULL},
/*SBC 0xcf*/{NULL},
/*SBC 0xd0*/{NULL},
/*SBC 0xd1*/{NULL},
/*SBC 0xd2*/{NULL},
/*SBC 0xd3*/{NULL},
/*SBC 0xd4*/{NULL},
/*SBC 0xd5*/{NULL},
/*SBC 0xd6*/{NULL},
/*SBC 0xd7*/{NULL},
/*SBC 0xd8*/{NULL},
/*SBC 0xd9*/{NULL},
/*SBC 0xda*/{NULL},
/*SBC 0xdb*/{NULL},
/*SBC 0xdc*/{NULL},
/*SBC 0xdd*/{NULL},
/*SBC 0xde*/{NULL},
/*SBC 0xdf*/{NULL},
/*SBC 0xe0*/{NULL},
/*SBC 0xe1*/{NULL},
/*SBC 0xe2*/{NULL},
/*SBC 0xe3*/{NULL},
/*SBC 0xe4*/{NULL},
/*SBC 0xe5*/{NULL},
/*SBC 0xe6*/{NULL},
/*SBC 0xe7*/{NULL},
/*SBC 0xe8*/{NULL},
/*SBC 0xe9*/{NULL},
/*SBC 0xea*/{NULL},
/*SBC 0xeb*/{NULL},
/*SBC 0xec*/{NULL},
/*SBC 0xed*/{NULL},
/*SBC 0xee*/{NULL},
/*SBC 0xef*/{NULL},
/*SBC 0xf0*/{NULL},
/*SBC 0xf1*/{NULL},
/*SBC 0xf2*/{NULL},
/*SBC 0xf3*/{NULL},
/*SBC 0xf4*/{NULL},
/*SBC 0xf5*/{NULL},
/*SBC 0xf6*/{NULL},
/*SBC 0xf7*/{NULL},
/*SBC 0xf8*/{NULL},
/*SBC 0xf9*/{NULL},
/*SBC 0xfa*/{NULL},
/*SBC 0xfb*/{NULL},
/*SBC 0xfc*/{NULL},
/*SBC 0xfd*/{NULL},
/*SBC 0xfe*/{NULL},
/*SBC 0xff*/{NULL}
};


void
proto_register_scsi_sbc(void)
{
	static hf_register_info hf[] = {
        { &hf_scsi_sbc_opcode,
          {"SBC Opcode", "scsi.sbc.opcode", FT_UINT8, BASE_HEX,
           VALS (scsi_sbc_vals), 0x0, "", HFILL}},
        { &hf_scsi_sbc_formatunit_flags,
          {"Flags", "scsi.sbc.formatunit.flags", FT_UINT8, BASE_HEX, NULL, 0xF8,
           "", HFILL}},
        { &hf_scsi_sbc_defect_list_format,
          {"Defect List Format", "scsi.sbc.defect_list_format", FT_UINT8, BASE_DEC,
           NULL, 0x7, "", HFILL}},
        { &hf_scsi_sbc_formatunit_vendor,
          {"Vendor Unique", "scsi.sbc.formatunit.vendor", FT_UINT8, BASE_HEX, NULL,
           0x0, "", HFILL}},
        { &hf_scsi_sbc_formatunit_interleave,
          {"Interleave", "scsi.sbc.formatunit.interleave", FT_UINT16, BASE_HEX,
           NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_rdwr6_lba,
          {"Logical Block Address (LBA)", "scsi.sbc.rdwr6.lba", FT_UINT24, BASE_DEC,
           NULL, 0x0FFFFF, "", HFILL}},
        { &hf_scsi_sbc_rdwr6_xferlen,
          {"Transfer Length", "scsi.sbc.rdwr6.xferlen", FT_UINT24, BASE_DEC, NULL, 0x0,
           "", HFILL}},
        { &hf_scsi_sbc_rdwr10_lba,
          {"Logical Block Address (LBA)", "scsi.sbc.rdwr10.lba", FT_UINT32, BASE_DEC,
           NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_rdwr10_xferlen,
          {"Transfer Length", "scsi.sbc.rdwr10.xferlen", FT_UINT16, BASE_DEC, NULL,
           0x0, "", HFILL}},
        { &hf_scsi_sbc_rdwr12_xferlen,
          {"Transfer Length", "scsi.sbc.rdwr12.xferlen", FT_UINT32, BASE_DEC, NULL,
           0x0, "", HFILL}},
        { &hf_scsi_sbc_rdwr16_lba,
          {"Logical Block Address (LBA)", "scsi.sbc.rdwr16.lba", FT_BYTES, BASE_DEC,
           NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_ssu_immed,
          {"Immediate", "scsi.sbc.ssu.immediate", FT_BOOLEAN, 8, NULL,
           0x1, "", HFILL}},
        { &hf_scsi_sbc_ssu_pwr_cond,
          {"Power Conditions", "scsi.sbc.ssu.pwr", FT_UINT8, BASE_HEX,
           VALS (scsi_ssu_pwrcnd_val), 0xF0, "", HFILL}},
        { &hf_scsi_sbc_ssu_loej,
          {"LOEJ", "scsi.sbc.ssu.loej", FT_BOOLEAN, 8, NULL, 0x2, "",
           HFILL}},
        { &hf_scsi_sbc_ssu_start,
          {"Start", "scsi.sbc.ssu.start", FT_BOOLEAN, 8, NULL, 0x1,
           "", HFILL}},
        { &hf_scsi_sbc_verify_blkvfy,
          {"BLKVFY", "scsi.sbc.verify.blkvfy", FT_BOOLEAN, 8, NULL, 0x4,
           "", HFILL}},
        { &hf_scsi_sbc_verify_bytchk,
          {"BYTCHK", "scsi.sbc.verify.bytchk", FT_BOOLEAN, 8, NULL, 0x2,
           "", HFILL}},
        { &hf_scsi_sbc_verify_reladdr,
          {"RELADDR", "scsi.sbc.verify.reladdr", FT_BOOLEAN, 8, NULL,
           0x1, "", HFILL}},
        { &hf_scsi_sbc_verify_lba,
          {"LBA", "scsi.sbc.verify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, "",
           HFILL}},
        { &hf_scsi_sbc_verify_vlen,
          {"Verification Length", "scsi.sbc.verify.vlen", FT_UINT16,
           BASE_DEC, NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_verify_vlen32,
          {"Verification Length", "scsi.sbc.verify.vlen32", FT_UINT32,
           BASE_DEC, NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_wrverify_ebp,
          {"EBP", "scsi.sbc.wrverify.ebp", FT_BOOLEAN, 8, NULL, 0x4, "",
           HFILL}},
        { &hf_scsi_sbc_wrverify_lba,
          {"LBA", "scsi.sbc.wrverify.lba", FT_UINT32, BASE_DEC, NULL, 0x0, "",
           HFILL}},
        { &hf_scsi_sbc_wrverify_xferlen,
          {"Transfer Length", "scsi.sbc.wrverify.xferlen", FT_UINT16, BASE_DEC,
           NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_wrverify_lba64,
          {"LBA", "scsi.sbc.wrverify.lba64", FT_UINT64, BASE_DEC, NULL, 0x0,
           "", HFILL}},
        { &hf_scsi_sbc_wrverify_xferlen32,
          {"Transfer Length", "scsi.sbc.wrverify.xferlen32", FT_UINT32,
           BASE_DEC, NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_readcapacity_flags,
          {"Flags", "scsi.sbc.readcapacity.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
           "", HFILL}},
        { &hf_scsi_sbc_readcapacity_lba,
          {"Logical Block Address", "scsi.sbc.readcapacity.lba", FT_UINT32, BASE_DEC,
           NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_readdefdata_flags,
          {"Flags", "scsi.sbc.readdefdata.flags", FT_UINT8, BASE_HEX, NULL, 0x0, "",
           HFILL}},
        { &hf_scsi_sbc_reassignblks_flags,
          {"Flags", "scsi.sbc.reassignblks.flags", FT_UINT8, BASE_HEX, NULL, 0x0, "",
           HFILL}},
        { &hf_scsi_sbc_read_flags,
          {"Flags", "scsi.sbc.read.flags", FT_UINT8, BASE_HEX, NULL, 0x0, "",
           HFILL}},
        { &hf_scsi_sbc_alloclen32,
          {"Allocation Length", "scsi.sbc.alloclen32", FT_UINT32, BASE_DEC,
           NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_alloclen16,
          {"Allocation Length", "scsi.sbc.alloclen16", FT_UINT16, BASE_DEC,
           NULL, 0x0, "", HFILL}},
        { &hf_scsi_sbc_fuflags_fmtpinfo,
          {"FMTPINFO", "scsi.sbc.format_unit.fmtpinfo", FT_BOOLEAN, 8,
           NULL, 0x80, "", HFILL}},
        { &hf_scsi_sbc_fuflags_rto_req,
          {"RTO_REQ", "scsi.sbc.format_unit.rto_req", FT_BOOLEAN, 8,
           NULL, 0x40, "", HFILL}},
        { &hf_scsi_sbc_fuflags_longlist,
          {"LONGLIST", "scsi.sbc.format_unit.longlist", FT_BOOLEAN, 8,
           NULL, 0x20, "", HFILL}},
        { &hf_scsi_sbc_fuflags_fmtdata,
          {"FMTDATA", "scsi.sbc.format_unit.fmtdata", FT_BOOLEAN, 8,
           NULL, 0x10, "", HFILL}},
        { &hf_scsi_sbc_fuflags_cmplist,
          {"CMPLIST", "scsi.sbc.format_unit.cmplist", FT_BOOLEAN, 8,
           NULL, 0x08, "", HFILL}},
        { &hf_scsi_sbc_prefetch_flags,
          {"Flags", "scsi.sbc.prefetch.flags", FT_UINT8, BASE_HEX, NULL, 0x0, "",
           HFILL}},
        { &hf_scsi_sbc_prefetch_immed,
          {"Immediate", "scsi.sbc.prefetch.immediate", FT_BOOLEAN, 8, NULL,
           0x2, "", HFILL}},
        { &hf_scsi_sbc_group,
          {"Group", "scsi.sbc.group", FT_UINT8, BASE_HEX, NULL,
           0x1f, "", HFILL}},
        { &hf_scsi_sbc_rdprotect,
          {"RDPROTECT", "scsi.sbc.rdprotect", FT_UINT8, BASE_HEX,
           NULL, 0xe0, "", HFILL}},
        { &hf_scsi_sbc_dpo,
          {"DPO", "scsi.sbc.dpo", FT_BOOLEAN, 8,
           TFS(&dpo_tfs), 0x10, "DisablePageOut: Whether the device should cache the data or not", HFILL}},
        { &hf_scsi_sbc_fua,
          {"FUA", "scsi.sbc.fua", FT_BOOLEAN, 8,
           TFS(&fua_tfs), 0x08, "ForceUnitAccess: Whether to allow reading from the cache or not", HFILL}},
        { &hf_scsi_sbc_fua_nv,
          {"FUA_NV", "scsi.sbc.fua_nv", FT_BOOLEAN, 8,
           TFS(&fua_nv_tfs), 0x02, "ForceUnitAccess_NonVolatile: Whether to allow reading from non-volatile cache or not", HFILL}},
        { &hf_scsi_sbc_pmi,
          {"PMI", "scsi.sbc.pmi", FT_BOOLEAN, 8,
           TFS(&pmi_tfs), 0x01, "Partial Medium Indicator", HFILL}},
        { &hf_scsi_sbc_pmi_flags,
          {"PMI Flags", "scsi.sbc.pmi_flags", FT_UINT8, BASE_HEX,
           NULL, 0, "", HFILL}},
        { &hf_scsi_sbc_blocksize,
          {"Block size in bytes", "scsi.sbc.blocksize", FT_UINT32, BASE_DEC,
           NULL, 0, "", HFILL}},
        { &hf_scsi_sbc_returned_lba,
          {"Returned LBA", "scsi.sbc.returned_lba", FT_UINT32, BASE_DEC,
           NULL, 0, "", HFILL}},
        { &hf_scsi_sbc_req_plist,
          {"REQ_PLIST", "scsi.sbc.req_plist", FT_BOOLEAN, 8,
           NULL, 0x10, "", HFILL}},
        { &hf_scsi_sbc_req_glist,
          {"REQ_GLIST", "scsi.sbc.req_glist", FT_BOOLEAN, 8,
           NULL, 0x08, "", HFILL}},
        { &hf_scsi_sbc_corrct,
          {"CORRCT", "scsi.sbc.corrct", FT_BOOLEAN, 8,
           NULL, 0x02, "", HFILL}},
        { &hf_scsi_sbc_corrct_flags,
          {"Flags", "scsi.sbc.corrct_flags", FT_UINT8, BASE_HEX,
           NULL, 0, "", HFILL}},
	};


	/* Setup protocol subtree array */
	static gint *ett[] = {
		&ett_scsi_format_unit,
		&ett_scsi_prefetch,
		&ett_scsi_pmi,
		&ett_scsi_rdwr,
		&ett_scsi_defectdata,
		&ett_scsi_corrct
	};

	/* Register the protocol name and description */
	proto_scsi_sbc = proto_register_protocol("SCSI_SBC", "SCSI_SBC", "scsi_sbc");

	/* Required function calls to register the header fields and subtrees used */
	proto_register_field_array(proto_scsi_sbc, hf, array_length(hf));
	proto_register_subtree_array(ett, array_length(ett));
}

void
proto_reg_handoff_scsi_sbc(void)
{
}