*_stdup_printf -> strdup for "single string only" formatting.
[gd/wireshark/.git] / epan / dissectors / packet-scsi.c
1 /* TODO make the contracts require that all functions be called with valid
2  * pointers for itl and itlq and remove all tests for itl/itlq being NULL
3  */
4 /* TODO audit value parameter for proto_tree_add_boolean() calls */
5 /* packet-scsi.c
6  * Routines for decoding SCSI CDBs and responsess
7  * Author: Dinesh G Dutt (ddutt@cisco.com)
8  *
9  * Wireshark - Network traffic analyzer
10  * By Gerald Combs <gerald@wireshark.org>
11  * Copyright 2002 Gerald Combs
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26  */
27
28 /*
29  * Some Notes on using the SCSI Decoder:
30  *
31  * The SCSI decoder has been built right now so that it is invoked directly by the
32  * SCSI transport layers as compared to the standard mechanism of being invoked
33  * via a dissector chain. There are multiple reasons for this:
34  * - The SCSI CDB is typically embedded inside the transport along with other
35  *   header fields that have nothing to do with SCSI. So, it is required to be
36  *   done this way.
37  * - Originally, Wireshark couldn't do filtering on protocol trees that were not
38  *   on the top level.
39  *
40  * There are four main routines that are provided:
41  * o dissect_scsi_cdb - invoked on receiving a SCSI Command
42  *   void dissect_scsi_cdb(tvbuff_t *, packet_info *, proto_tree *,
43  *                         guint, itlq_nexus_t *, itl_nexus_t *);
44  * o dissect_scsi_payload - invoked to decode SCSI responses
45  *   void dissect_scsi_payload(tvbuff_t *, packet_info *, proto_tree *, guint,
46  *                             gboolean, itlq_nexusu_t *, itl_nexus_t *,
47  *                             guint32 relative_offset);
48  *   The final parameter is the length of the response field that is negotiated
49  *   as part of the SCSI transport layer. If this is not tracked by the
50  *   transport, it can be set to 0.
51  * o dissect_scsi_rsp - invoked to dissect the scsi status code in a response
52  *                      SCSI task.
53  *   void dissect_scsi_rsp(tvbuff_t *, packet_info *, proto_tree *,
54  *                         itlq_nexus_t *, itl_nexus_t *, guint8);
55  * o dissect_scsi_snsinfo - invoked to decode the sense data provided in case of
56  *                          an error.
57  *   void dissect_scsi_snsinfo(tvbuff_t *, packet_info *, proto_tree *, guint,
58  *                             guint, itlq_nexus_t *, itl_nexus_t *);
59  *
60  * In addition to this, the other requirement made from the transport is to
61  * provide ITL and ITLQ structures that are persistent.
62  *
63  * The ITL structure uniquely identifies a Initiator/Target/Lun combination
64  * and is among other things used to keep track of the device type for a
65  * specific LUN.
66  *
67  * The ITLQ structure uniquely identifies a specific scsi task and is used to
68  * keep track of OPCODEs between CDB/DATA/Responses and resp[onse times.
69  *
70  * This decoder attempts to track the type of SCSI device based on the response
71  * to the Inquiry command. If the trace does not contain an Inquiry command,
72  * the decoding of the commands is done as per a user preference. Currently,
73  * only SBC (disks) and SSC (tapes) are the alternatives offered. The basic
74  * SCSI command set (SPC-2/3) is decoded for all SCSI devices. If there is a
75  * mixture of devices in the trace, some with Inquiry response and some
76  * without, the user preference is used only for those devices whose type the
77  * decoder has not been able to determine.
78  *
79  */
80 #include "config.h"
81
82 #include <stdio.h>
83 #include <epan/packet.h>
84 #include <epan/to_str.h>
85 #include <epan/prefs.h>
86 #include <epan/conversation.h>
87 #include <epan/tap.h>
88 #include <epan/srt_table.h>
89 #include <epan/reassemble.h>
90 #include <epan/expert.h>
91 #include "packet-scsi.h"
92 #include "packet-scsi-osd.h"
93 #include "packet-scsi-mmc.h"
94 #include "packet-scsi-sbc.h"
95 #include "packet-scsi-ssc.h"
96 #include "packet-scsi-smc.h"
97
98 void proto_register_scsi(void);
99
100 static int proto_scsi                           = -1;
101 static int hf_scsi_inq_control_vendor_specific  = -1;
102 static int hf_scsi_inq_control_reserved         = -1;
103 static int hf_scsi_inq_control_naca             = -1;
104 static int hf_scsi_inq_control_obs1             = -1;
105 static int hf_scsi_inq_control_obs2             = -1;
106 static int hf_scsi_inq_control                  = -1;
107 static int hf_scsi_control_vendor_specific      = -1;
108 static int hf_scsi_control_reserved             = -1;
109 static int hf_scsi_control_naca                 = -1;
110 static int hf_scsi_control_obs1                 = -1;
111 static int hf_scsi_control_obs2                 = -1;
112 int hf_scsi_control                      = -1;
113 int hf_scsi_alloclen16                   = -1;
114 static int hf_scsi_alloclen32                   = -1;
115 static int hf_scsi_time                         = -1;
116 static int hf_scsi_request_frame                = -1;
117 static int hf_scsi_response_frame               = -1;
118 static int hf_scsi_status                       = -1;
119 static int hf_scsi_spcopcode                    = -1;
120 static int hf_scsi_inquiry_flags                = -1;
121 static int hf_scsi_inquiry_evpd_page            = -1;
122 static int hf_scsi_inquiry_cmdt_page            = -1;
123 static int hf_scsi_alloclen                     = -1;
124 static int hf_scsi_paramlen                     = -1;
125 static int hf_scsi_paramlen16                   = -1;
126 static int hf_scsi_modesel_flags                = -1;
127 static int hf_scsi_modesns_pc                   = -1;
128 static int hf_scsi_modepage_ps                  = -1;
129 static int hf_scsi_modepage_spf                 = -1;
130 static int hf_scsi_modepage_plen                = -1;
131 static int hf_scsi_modepage_tcmos               = -1;
132 static int hf_scsi_modepage_scsip               = -1;
133 static int hf_scsi_modepage_ialuae              = -1;
134 static int hf_scsi_modepage_icp                 = -1;
135 static int hf_scsi_modepage_msdl                = -1;
136 static int hf_scsi_spc_pagecode                 = -1;
137 static int hf_scsi_spc_subpagecode              = -1;
138 static int hf_scsi_sbcpagecode                  = -1;
139 static int hf_scsi_sscpagecode                  = -1;
140 static int hf_scsi_smcpagecode                  = -1;
141 static int hf_scsi_mmcpagecode                  = -1;
142 static int hf_scsi_modesns_flags                = -1;
143 static int hf_scsi_persresvin_svcaction         = -1;
144 static int hf_scsi_persresvout_svcaction        = -1;
145 static int hf_scsi_persresv_scope               = -1;
146 static int hf_scsi_persresv_type                = -1;
147 static int hf_scsi_persresvout_reskey           = -1;
148 static int hf_scsi_persresvout_sareskey         = -1;
149 static int hf_scsi_persresvout_obsolete         = -1;
150 static int hf_scsi_persresvout_control          = -1;
151 static int hf_scsi_persresvout_rel_tpi          = -1;
152 static int hf_scsi_persresvout_transportid_len  = -1;
153 static int hf_scsi_persresvout_transportid      = -1;
154 static int hf_scsi_persresv_control_rsvd        = -1;
155 static int hf_scsi_persresv_control_rsvd1       = -1;
156 static int hf_scsi_persresv_control_rsvd2       = -1;
157 static int hf_scsi_persresv_control_spec_i_pt   = -1;
158 static int hf_scsi_persresv_control_all_tg_pt   = -1;
159 static int hf_scsi_persresv_control_aptpl       = -1;
160 static int hf_scsi_persresv_control_unreg       = -1;
161 static int hf_scsi_release_flags                = -1;
162 static int hf_scsi_release_thirdpartyid         = -1;
163 static int hf_scsi_select_report                = -1;
164 static int hf_scsi_inq_add_len                  = -1;
165 static int hf_scsi_inq_peripheral               = -1;
166 static int hf_scsi_inq_qualifier                = -1;
167 static int hf_scsi_inq_vendor_id                = -1;
168 static int hf_scsi_inq_product_id               = -1;
169 static int hf_scsi_inq_product_rev              = -1;
170 static int hf_scsi_inq_vendor_specific          = -1;
171 static int hf_scsi_inq_version_desc             = -1;
172 static int hf_scsi_inq_devtype                  = -1;
173 static int hf_scsi_inq_rmb                      = -1;
174 static int hf_scsi_inq_version                  = -1;
175 static int hf_scsi_lun_address_mode             = -1;
176 static int hf_scsi_lun                          = -1;
177 static int hf_scsi_lun_extended                 = -1;
178 static int hf_scsi_extended_add_method_len      = -1;
179 static int hf_scsi_extended_add_method          = -1;
180 static int hf_scsi_bus                          = -1;
181 static int hf_scsi_target                       = -1;
182 static int hf_scsi_modesns_errrep               = -1;
183 static int hf_scsi_modesns_tst                  = -1;
184 static int hf_scsi_modesns_qmod                 = -1;
185 static int hf_scsi_modesns_qerr                 = -1;
186 static int hf_scsi_modesns_rac                  = -1;
187 static int hf_scsi_modesns_tas                  = -1;
188 static int hf_scsi_protocol                     = -1;
189 static int hf_scsi_sns_errtype                  = -1;
190 static int hf_scsi_snskey                       = -1;
191 static int hf_scsi_snsinfo                      = -1;
192 static int hf_scsi_addlsnslen                   = -1;
193 static int hf_scsi_asc                          = -1;
194 static int hf_scsi_ascascq                      = -1;
195 static int hf_scsi_ascq                         = -1;
196 static int hf_scsi_fru                          = -1;
197 static int hf_scsi_sksv                         = -1;
198 static int hf_scsi_sks_info                     = -1;
199 static int hf_scsi_sks_fp_cd                    = -1;
200 static int hf_scsi_sks_fp_bpv                   = -1;
201 static int hf_scsi_sks_fp_bit                   = -1;
202 static int hf_scsi_sks_fp_field                 = -1;
203 static int hf_scsi_sns_desc_type                = -1;
204 static int hf_scsi_sns_desc_length              = -1;
205 static int hf_scsi_sns_osd_object_not_initiated = -1;
206 static int hf_scsi_sns_osd_object_completed     = -1;
207 static int hf_scsi_sns_osd_object_validation    = -1;
208 static int hf_scsi_sns_osd_object_cmd_cap_v     = -1;
209 static int hf_scsi_sns_osd_object_command       = -1;
210 static int hf_scsi_sns_osd_object_imp_st_att    = -1;
211 static int hf_scsi_sns_osd_object_sa_cap_v      = -1;
212 static int hf_scsi_sns_osd_object_set_att       = -1;
213 static int hf_scsi_sns_osd_object_ga_cap_v      = -1;
214 static int hf_scsi_sns_osd_object_get_att       = -1;
215 static int hf_scsi_sns_osd_partition_id         = -1;
216 static int hf_scsi_sns_osd_object_id            = -1;
217 static int hf_scsi_sns_osd_attr_page            = -1;
218 static int hf_scsi_sns_osd_attr_number          = -1;
219 static int hf_scsi_inq_reladrflags              = -1;
220 static int hf_scsi_inq_reladr                   = -1;
221 static int hf_scsi_inq_linked                   = -1;
222 static int hf_scsi_inq_trandis                  = -1;
223 static int hf_scsi_inq_cmdque                   = -1;
224 static int hf_scsi_inq_bqueflags                = -1;
225 static int hf_scsi_inq_bque                     = -1;
226 static int hf_scsi_inq_encserv                  = -1;
227 static int hf_scsi_inq_multip                   = -1;
228 static int hf_scsi_inq_mchngr                   = -1;
229 static int hf_scsi_inq_ackreqq                  = -1;
230 static int hf_scsi_inq_sccsflags                = -1;
231 static int hf_scsi_inq_sccs                     = -1;
232 static int hf_scsi_inq_acc                      = -1;
233 static int hf_scsi_inq_tpc                      = -1;
234 static int hf_scsi_inq_protect                  = -1;
235 static int hf_scsi_inq_tpgs                     = -1;
236 static int hf_scsi_inq_acaflags                 = -1;
237 static int hf_scsi_inq_rmbflags                 = -1;
238 static int hf_scsi_inq_normaca                  = -1;
239 static int hf_scsi_inq_hisup                    = -1;
240 static int hf_scsi_inq_aerc                     = -1;
241 static int hf_scsi_inq_trmtsk                   = -1;
242 static int hf_scsi_inq_rdf                      = -1;
243 static int hf_scsi_persresv_key                 = -1;
244 static int hf_scsi_persresv_scopeaddr           = -1;
245 static int hf_scsi_add_cdblen                   = -1;
246 static int hf_scsi_svcaction                    = -1;
247 static int hf_scsi_wb_mode                      = -1;
248 static int hf_scsi_wb_bufferid                  = -1;
249 static int hf_scsi_wb_bufoffset                 = -1;
250 static int hf_scsi_paramlen24                   = -1;
251 static int hf_scsi_senddiag_st_code             = -1;
252 static int hf_scsi_senddiag_pf                  = -1;
253 static int hf_scsi_senddiag_st                  = -1;
254 static int hf_scsi_senddiag_devoff              = -1;
255 static int hf_scsi_senddiag_unitoff             = -1;
256 static int hf_scsi_fragments                    = -1;
257 static int hf_scsi_fragment                     = -1;
258 static int hf_scsi_fragment_overlap             = -1;
259 static int hf_scsi_fragment_overlap_conflict    = -1;
260 static int hf_scsi_fragment_multiple_tails      = -1;
261 static int hf_scsi_fragment_too_long_fragment   = -1;
262 static int hf_scsi_fragment_error               = -1;
263 static int hf_scsi_fragment_count               = -1;
264 static int hf_scsi_reassembled_in               = -1;
265 static int hf_scsi_reassembled_length           = -1;
266 static int hf_scsi_log_ppc_flags                = -1;
267 static int hf_scsi_log_pc_flags                 = -1;
268 static int hf_scsi_log_parameter_ptr            = -1;
269 static int hf_scsi_log_ppc                      = -1;
270 static int hf_scsi_log_pcr                      = -1;
271 static int hf_scsi_log_sp                       = -1;
272 static int hf_scsi_log_pagecode                 = -1;
273 static int hf_scsi_log_pc                       = -1;
274 static int hf_scsi_log_page_length              = -1;
275 static int hf_scsi_log_parameter_code           = -1;
276 static int hf_scsi_log_param_len                = -1;
277 static int hf_scsi_log_param_flags              = -1;
278 static int hf_scsi_log_param_data               = -1;
279 static int hf_scsi_log_pf_du                    = -1;
280 static int hf_scsi_log_pf_ds                    = -1;
281 static int hf_scsi_log_pf_tsd                   = -1;
282 static int hf_scsi_log_pf_etc                   = -1;
283 static int hf_scsi_log_pf_tmc                   = -1;
284 static int hf_scsi_log_pf_lbin                  = -1;
285 static int hf_scsi_log_pf_lp                    = -1;
286 static int hf_scsi_log_ta_rw                    = -1;
287 static int hf_scsi_log_ta_ww                    = -1;
288 static int hf_scsi_log_ta_he                    = -1;
289 static int hf_scsi_log_ta_media                 = -1;
290 static int hf_scsi_log_ta_rf                    = -1;
291 static int hf_scsi_log_ta_wf                    = -1;
292 static int hf_scsi_log_ta_ml                    = -1;
293 static int hf_scsi_log_ta_ndg                   = -1;
294 static int hf_scsi_log_ta_wp                    = -1;
295 static int hf_scsi_log_ta_nr                    = -1;
296 static int hf_scsi_log_ta_cm                    = -1;
297 static int hf_scsi_log_ta_uf                    = -1;
298 static int hf_scsi_log_ta_rmcf                  = -1;
299 static int hf_scsi_log_ta_umcf                  = -1;
300 static int hf_scsi_log_ta_mcicf                 = -1;
301 static int hf_scsi_log_ta_fe                    = -1;
302 static int hf_scsi_log_ta_rof                   = -1;
303 static int hf_scsi_log_ta_tdcol                 = -1;
304 static int hf_scsi_log_ta_nml                   = -1;
305 static int hf_scsi_log_ta_cn                    = -1;
306 static int hf_scsi_log_ta_cp                    = -1;
307 static int hf_scsi_log_ta_ecm                   = -1;
308 static int hf_scsi_log_ta_ict                   = -1;
309 static int hf_scsi_log_ta_rr                    = -1;
310 static int hf_scsi_log_ta_dpie                  = -1;
311 static int hf_scsi_log_ta_cff                   = -1;
312 static int hf_scsi_log_ta_psf                   = -1;
313 static int hf_scsi_log_ta_pc                    = -1;
314 static int hf_scsi_log_ta_dm                    = -1;
315 static int hf_scsi_log_ta_hwa                   = -1;
316 static int hf_scsi_log_ta_hwb                   = -1;
317 static int hf_scsi_log_ta_if                    = -1;
318 static int hf_scsi_log_ta_em                    = -1;
319 static int hf_scsi_log_ta_dwf                   = -1;
320 static int hf_scsi_log_ta_drhu                  = -1;
321 static int hf_scsi_log_ta_drtm                  = -1;
322 static int hf_scsi_log_ta_drvo                  = -1;
323 static int hf_scsi_log_ta_pefa                  = -1;
324 static int hf_scsi_log_ta_dire                  = -1;
325 static int hf_scsi_log_ta_lost                  = -1;
326 static int hf_scsi_log_ta_tduau                 = -1;
327 static int hf_scsi_log_ta_tsawf                 = -1;
328 static int hf_scsi_log_ta_tsarf                 = -1;
329 static int hf_scsi_log_ta_nsod                  = -1;
330 static int hf_scsi_log_ta_lofa                  = -1;
331 static int hf_scsi_log_ta_uuf                   = -1;
332 static int hf_scsi_log_ta_aif                   = -1;
333 static int hf_scsi_log_ta_fwf                   = -1;
334 static int hf_scsi_log_ta_wmicf                 = -1;
335 static int hf_scsi_log_ta_wmoa                  = -1;
336 static int hf_scsi_sbc_threshold_exponent       = -1;
337 static int hf_scsi_sbc_lbpu                     = -1;
338 static int hf_scsi_sbc_lbpws                    = -1;
339 static int hf_scsi_sbc_lbpws10                  = -1;
340 static int hf_scsi_sbc_lbprz                    = -1;
341 static int hf_scsi_sbc_anc_sup                  = -1;
342 static int hf_scsi_sbc_dp                       = -1;
343 static int hf_scsi_sbc_ptype                    = -1;
344 static int hf_scsi_block_limits_wsnz            = -1;
345 static int hf_scsi_block_limits_mcawl           = -1;
346 static int hf_scsi_block_limits_otlg            = -1;
347 static int hf_scsi_block_limits_mtl             = -1;
348 static int hf_scsi_block_limits_otl             = -1;
349 static int hf_scsi_block_limits_mpl             = -1;
350 static int hf_scsi_block_limits_mulc            = -1;
351 static int hf_scsi_block_limits_mubdc           = -1;
352 static int hf_scsi_block_limits_oug             = -1;
353 static int hf_scsi_block_limits_ugavalid        = -1;
354 static int hf_scsi_block_limits_uga             = -1;
355 static int hf_scsi_block_limits_mwsl            = -1;
356 static int hf_scsi_block_limits_matl            = -1;
357 static int hf_scsi_block_limits_aa              = -1;
358 static int hf_scsi_block_limits_atlg            = -1;
359 static int hf_scsi_prevent_allow_flags          = -1;
360 static int hf_scsi_prevent_allow_prevent        = -1;
361 static int hf_scsi_mpi_service_action           = -1;
362 static int hf_scsi_report_opcodes_rctd          = -1;
363 static int hf_scsi_report_opcodes_options       = -1;
364 static int hf_scsi_report_opcodes_requested_o   = -1;
365 static int hf_scsi_report_opcodes_requested_sa  = -1;
366 static int hf_scsi_report_opcodes_cdl           = -1;
367 static int hf_scsi_report_opcodes_sa            = -1;
368 static int hf_scsi_report_opcodes_ctdp          = -1;
369 static int hf_scsi_report_opcodes_ctdp_one      = -1;
370 static int hf_scsi_report_opcodes_servactv      = -1;
371 static int hf_scsi_report_opcodes_cdb_length    = -1;
372 static int hf_scsi_report_opcodes_support       = -1;
373 static int hf_scsi_report_opcodes_cdb_usage_data = -1;
374 static int hf_scsi_report_opcodes_tdl           = -1;
375 static int hf_scsi_report_opcodes_npt           = -1;
376 static int hf_scsi_report_opcodes_rct           = -1;
377 static int hf_scsi_inquiry_bdc_mrr              = -1;
378 static int hf_scsi_inquiry_bdc_pt               = -1;
379 static int hf_scsi_inquiry_bdc_wabereq          = -1;
380 static int hf_scsi_inquiry_bdc_wacereq          = -1;
381 static int hf_scsi_inquiry_bdc_nff              = -1;
382 static int hf_scsi_inquiry_bdc_fuab              = -1;
383 static int hf_scsi_inquiry_bdc_vbuls            = -1;
384 /* Generated from convert_proto_tree_add_text.pl */
385 static int hf_scsi_smc_modepage_first_storage_element_address = -1;
386 static int hf_scsi_smc_modepage_first_medium_transport_element_address = -1;
387 static int hf_scsi_ssc2_modepage_dde = -1;
388 static int hf_scsi_inq_cmddt_version = -1;
389 static int hf_scsi_mmc5_modepage_number_of_volume_levels_supported = -1;
390 static int hf_scsi_ssc2_modepage_dce = -1;
391 static int hf_scsi_modesel_block_descriptor_length16 = -1;
392 static int hf_scsi_mmc5_modepage_audio_pause_length = -1;
393 static int hf_scsi_spc_modepage_idle_condition_timer = -1;
394 static int hf_scsi_blockdescs_block_length24 = -1;
395 static int hf_scsi_spc_modepage_report_count = -1;
396 static int hf_scsi_spc_modepage_ready_aer_holdoff_period = -1;
397 static int hf_scsi_sbc_modepage_non_cache_segment_size = -1;
398 static int hf_scsi_blockdescs_no_of_blocks64 = -1;
399 static int hf_scsi_spc_modepage_gltsd = -1;
400 static int hf_scsi_smc_modepage_st_ne_dt = -1;
401 static int hf_scsi_modesel_dev_sbc_medium_type = -1;
402 static int hf_scsi_inq_evpd_devid_identifier_type = -1;
403 static int hf_scsi_inq_evpd_identifier_number = -1;
404 static int hf_scsi_sbc_modepage_write_retry_count = -1;
405 static int hf_scsi_spc_modepage_buffer_empty_ratio = -1;
406 static int hf_scsi_ssc2_modepage_partition_size = -1;
407 static int hf_scsi_mmc5_modepage_initiator_application_code = -1;
408 static int hf_scsi_sbc_modepage_demand_read_retention_priority = -1;
409 static int hf_scsi_smc_modepage_dt_dt = -1;
410 static int hf_scsi_sbc_modepage_ssec = -1;
411 static int hf_scsi_smc_modepage_number_of_medium_transport_elements = -1;
412 static int hf_scsi_mmc5_modepage_copy_management_revision_support = -1;
413 static int hf_scsi_ssc2_modepage_maximum_additional_partitions = -1;
414 static int hf_scsi_blockdescs_density_code = -1;
415 static int hf_scsi_ssc2_modepage_write_object_buffer_full_ratio = -1;
416 static int hf_scsi_spc_modepage_rr_tov = -1;
417 static int hf_scsi_inq_cmddt_support = -1;
418 static int hf_scsi_mmc5_modepage_packet_size = -1;
419 static int hf_scsi_ssc2_modepage_fdp = -1;
420 static int hf_scsi_spc_modepage_autoload_mode = -1;
421 static int hf_scsi_mmc5_modepage_rw_in_lead_in = -1;
422 static int hf_scsi_spc_modepage_perf = -1;
423 static int hf_scsi_inq_evpd_devid_association = -1;
424 static int hf_scsi_smc_modepage_stordt = -1;
425 static int hf_scsi_smc_modepage_ie_dt = -1;
426 static int hf_scsi_spc_modepage_disable_queuing = -1;
427 static int hf_scsi_sbc_modepage_maximum_pre_fetch_ceiling = -1;
428 static int hf_scsi_persresvin_generation_number = -1;
429 static int hf_scsi_ssc2_modepage_read_object_buffer_empty_ratio = -1;
430 static int hf_scsi_spc_modepage_extended_self_test_completion_time = -1;
431 static int hf_scsi_smc_modepage_number_of_import_export_elements = -1;
432 static int hf_scsi_smc_modepage_number_of_storage_elements = -1;
433 static int hf_scsi_sbc_modepage_landing_zone_cyl = -1;
434 static int hf_scsi_smc_modepage_mt_ne_dt = -1;
435 static int hf_scsi_mmc5_modepage_loading_mechanism_type = -1;
436 static int hf_scsi_smc_modepage_mt_dt = -1;
437 static int hf_scsi_smc_modepage_first_import_export_element_address = -1;
438 static int hf_scsi_mmc5_modepage_link_size = -1;
439 static int hf_scsi_ssc2_modepage_decompression_algorithm = -1;
440 static int hf_scsi_reportluns_lun_list_length = -1;
441 static int hf_scsi_spc_modepage_idle = -1;
442 static int hf_scsi_spc_modepage_emdp = -1;
443 static int hf_scsi_inq_evpd_devid_code_set = -1;
444 static int hf_scsi_modesel_longlba = -1;
445 static int hf_scsi_mmc5_modepage_bufe = -1;
446 static int hf_scsi_ssc2_modepage_select_data_compression_algorithm = -1;
447 static int hf_scsi_mmc5_modepage_rotation_control_selected = -1;
448 static int hf_scsi_mmc5_modepage_sub_header_byte = -1;
449 static int hf_scsi_spc_modepage_rr_tov_units = -1;
450 static int hf_scsi_mmc5_modepage_vendor_specific = -1;
451 static int hf_scsi_modesel_block_descriptor_length8 = -1;
452 static int hf_scsi_smc_modepage_ie_ne_dt = -1;
453 static int hf_scsi_modesel_device_specific_parameter = -1;
454 static int hf_scsi_spc_modepage_connect_time_limit = -1;
455 static int hf_scsi_sbc_modepage_medium_rotation_rate = -1;
456 static int hf_scsi_inq_evpd_devid_identifier_length = -1;
457 static int hf_scsi_blockdescs_no_of_blocks32 = -1;
458 static int hf_scsi_inq_evpd_devid_identifier_str = -1;
459 static int hf_scsi_sns_valid = -1;
460 static int hf_scsi_mmc5_modepage_dvd_ram_read = -1;
461 static int hf_scsi_ssc2_modepage_gap_size = -1;
462 static int hf_scsi_smc_modepage_first_data_transfer_element_address = -1;
463 static int hf_scsi_mmc5_modepage_wrparam_multi_session = -1;
464 static int hf_scsi_mmc5_modepage_num_write_speed_performance = -1;
465 static int hf_scsi_mmc5_modepage_buf = -1;
466 static int hf_scsi_mmc5_modepage_lba_space = -1;
467 static int hf_scsi_mmc5_modepage_data_block_type = -1;
468 static int hf_scsi_ssc2_modepage_additional_partitions_defined = -1;
469 static int hf_scsi_spc_modepage_dtfd = -1;
470 static int hf_scsi_spc_modepage_disconnect_time_limit = -1;
471 static int hf_scsi_sbc_modepage_read_retry_count = -1;
472 static int hf_scsi_mmc5_modepage_length = -1;
473 static int hf_scsi_sns_filemark = -1;
474 static int hf_scsi_sbc_modepage_alternate_tracks_per_zone = -1;
475 static int hf_scsi_ssc2_modepage_eod_defined = -1;
476 static int hf_scsi_mmc5_modepage_media_catalog_number = -1;
477 static int hf_scsi_mmc5_modepage_current_write_speed_selected = -1;
478 static int hf_scsi_inq_evpd_devid_identifier_bytes = -1;
479 static int hf_scsi_spc_modepage_interval_timer = -1;
480 static int hf_scsi_ssc2_modepage_oir = -1;
481 static int hf_scsi_sbc_modepage_correction_span = -1;
482 static int hf_scsi_mmc5_modepage_session_format = -1;
483 static int hf_scsi_sbc_modepage_minimum_pre_fetch = -1;
484 static int hf_scsi_spc_modepage_maximum_burst_size = -1;
485 static int hf_scsi_ssc2_modepage_partition_units = -1;
486 static int hf_scsi_sbc_modepage_cache_segment_size = -1;
487 static int hf_scsi_blockdescs_block_length32 = -1;
488 static int hf_scsi_sbc_modepage_number_of_cylinders = -1;
489 static int hf_scsi_sbc_modepage_alternate_tracks_per_lu = -1;
490 static int hf_scsi_inq_evpd_page_length = -1;
491 static int hf_scsi_sbc_modepage_starting_cyl_pre_compensation = -1;
492 static int hf_scsi_sbc_modepage_head_offset_count = -1;
493 static int hf_scsi_sbc_modepage_ic = -1;
494 static int hf_scsi_modesel_mode_data_length16 = -1;
495 static int hf_scsi_sbc_modepage_maximum_pre_fetch = -1;
496 static int hf_scsi_smc_modepage_number_of_data_transfer_elements = -1;
497 static int hf_scsi_ssc2_modepage_object_buffer_size_at_early_warning = -1;
498 static int hf_scsi_mmc5_modepage_buffer_size_supported = -1;
499 static int hf_scsi_persresvin_additional_length = -1;
500 static int hf_scsi_ssc2_modepage_obr = -1;
501 static int hf_scsi_spc_modepage_swp = -1;
502 static int hf_scsi_inq_evpd_supported_page = -1;
503 static int hf_scsi_sbc_modepage_awre = -1;
504 static int hf_scsi_smc_modepage_dt_ne_dt = -1;
505 static int hf_scsi_mmc5_modepage_read_bar_code = -1;
506 static int hf_scsi_ssc2_modepage_media_format_recognition = -1;
507 static int hf_scsi_sns_command_specific_information = -1;
508 static int hf_scsi_ssc2_modepage_write_delay_time = -1;
509 static int hf_scsi_sbc_modepage_track_skew_factor = -1;
510 static int hf_scsi_spc_modepage_standby_condition_timer = -1;
511 static int hf_scsi_sbc_modepage_interleave = -1;
512 static int hf_scsi_sbc_modepage_alternate_sectors_per_zone = -1;
513 static int hf_scsi_sbc_modepage_rotational_offset = -1;
514 static int hf_scsi_spc_modepage_buffer_full_ratio = -1;
515 static int hf_scsi_sbc_modepage_number_of_heads = -1;
516 static int hf_scsi_sbc_modepage_sectors_per_track = -1;
517 static int hf_scsi_sbc_modepage_recovery_time_limit = -1;
518 static int hf_scsi_sbc_modepage_tracks_per_zone = -1;
519 static int hf_scsi_spc_modepage_first_burst_size = -1;
520 static int hf_scsi_inq_evpd_product_serial_number = -1;
521 static int hf_scsi_sbc_modepage_cylinder_skew_factor = -1;
522 static int hf_scsi_sbc_modepage_data_bytes_per_physical_sector = -1;
523 static int hf_scsi_ssc2_modepage_compression_algorithm = -1;
524 static int hf_scsi_ssc2_modepage_caf = -1;
525 static int hf_scsi_sbc_modepage_starting_cyl_reduced_write_current = -1;
526 static int hf_scsi_inq_cmddt_cdb_size = -1;
527 static int hf_scsi_mmc5_modepage_international_standard_recording_code = -1;
528 static int hf_scsi_spc_modepage_bus_inactivity_limit = -1;
529 static int hf_scsi_sbc_modepage_disable_pre_fetch_xfer_len = -1;
530 static int hf_scsi_spc_modepage_busy_timeout_period = -1;
531 static int hf_scsi_sbc_modepage_fsw = -1;
532 static int hf_scsi_ssc2_modepage_active_partition = -1;
533 static int hf_scsi_modesel_mode_data_length8 = -1;
534 static int hf_scsi_smc_modepage_st_dt = -1;
535 static int hf_scsi_sbc_modepage_number_of_cache_segments = -1;
536 static int hf_scsi_blockdescs_no_of_blocks24 = -1;
537 static int hf_scsi_sbc_modepage_data_strobe_offset_count = -1;
538 static int hf_scsi_modesel_medium_type = -1;
539 static int hf_scsi_sbc_modepage_device_step_rate = -1;
540 static int hf_scsi_mmc5_modepage_dvd_ram_write = -1;
541 static int hf_scsi_mmc5_modepage_track_mode = -1;
542 static int hf_scsi_smc_modepage_mt_ne_mt = -1;
543 static int hf_scsi_smc_modepage_dt_mt = -1;
544 static int hf_scsi_mmc5_modepage_eject = -1;
545 static int hf_scsi_mmc5_modepage_mode_2_form2 = -1;
546 static int hf_scsi_sbc_modepage_dra = -1;
547 static int hf_scsi_mmc5_modepage_dvd_rom_write = -1;
548 static int hf_scsi_sbc_modepage_eer = -1;
549 static int hf_scsi_mmc5_modepage_cd_da_cmds_supported = -1;
550 static int hf_scsi_smc_modepage_ie_ne_mt = -1;
551 static int hf_scsi_mmc5_modepage_rw_deinterleaved_corrected = -1;
552 static int hf_scsi_sbc_modepage_vendor_specific = -1;
553 static int hf_scsi_spc_modepage_report_log_exception_condition = -1;
554 static int hf_scsi_mmc5_modepage_c2_pointers_supported = -1;
555 static int hf_scsi_mmc5_modepage_ls_v = -1;
556 static int hf_scsi_sbc_modepage_tb = -1;
557 static int hf_scsi_sbc_modepage_write_retention_priority = -1;
558 static int hf_scsi_smc_modepage_mt_ne_ie = -1;
559 static int hf_scsi_ssc2_modepage_prmwp = -1;
560 static int hf_scsi_sbc_modepage_surf = -1;
561 static int hf_scsi_sns_ili = -1;
562 static int hf_scsi_smc_modepage_mt_ie = -1;
563 static int hf_scsi_sbc_modepage_rcd = -1;
564 static int hf_scsi_mmc5_modepage_composite = -1;
565 static int hf_scsi_sbc_modepage_wce = -1;
566 static int hf_scsi_mmc5_modepage_method_2 = -1;
567 static int hf_scsi_ssc2_modepage_clear = -1;
568 static int hf_scsi_sbc_modepage_lbcss = -1;
569 static int hf_scsi_mmc5_modepage_cd_r_read = -1;
570 static int hf_scsi_spc_modepage_test = -1;
571 static int hf_scsi_ssc2_modepage_rsmk = -1;
572 static int hf_scsi_spc_modepage_rha = -1;
573 static int hf_scsi_mmc5_modepage_lsbf = -1;
574 static int hf_scsi_mmc5_modepage_cd_rw_write = -1;
575 static int hf_scsi_mmc5_modepage_wrparam_test_write = -1;
576 static int hf_scsi_ssc2_modepage_eeg = -1;
577 static int hf_scsi_mmc5_modepage_digital_port2 = -1;
578 static int hf_scsi_mmc5_modepage_copy = -1;
579 static int hf_scsi_sbc_modepage_abpf = -1;
580 static int hf_scsi_spc_modepage_alwi = -1;
581 static int hf_scsi_mmc5_modepage_bckf = -1;
582 static int hf_scsi_ssc2_modepage_dsp = -1;
583 static int hf_scsi_mmc5_modepage_mode_2_form1 = -1;
584 static int hf_scsi_smc_modepage_stormt = -1;
585 static int hf_scsi_mmc5_modepage_mmcap_test_write = -1;
586 static int hf_scsi_smc_modepage_st_mt = -1;
587 static int hf_scsi_ssc2_modepage_sew = -1;
588 static int hf_scsi_ssc2_modepage_psum = -1;
589 static int hf_scsi_mmc5_modepage_dvd_r_read = -1;
590 static int hf_scsi_ssc2_modepage_asocwp = -1;
591 static int hf_scsi_smc_modepage_st_ie = -1;
592 static int hf_scsi_mmc5_modepage_cd_rw_read = -1;
593 static int hf_scsi_spc_modepage_standby = -1;
594 static int hf_scsi_spc_modepage_ewasc = -1;
595 static int hf_scsi_sbc_modepage_arre = -1;
596 static int hf_scsi_smc_modepage_st_st = -1;
597 static int hf_scsi_ssc2_modepage_swp = -1;
598 static int hf_scsi_smc_modepage_storie = -1;
599 static int hf_scsi_mmc5_modepage_fp = -1;
600 static int hf_scsi_ssc2_modepage_red = -1;
601 static int hf_scsi_ssc2_modepage_active_format = -1;
602 static int hf_scsi_mmc5_modepage_mmcap_multi_session = -1;
603 static int hf_scsi_mmc5_modepage_lock_state = -1;
604 static int hf_scsi_mmc5_modepage_side_change_capable = -1;
605 static int hf_scsi_mmc5_modepage_dvd_rom_read = -1;
606 static int hf_scsi_sns_eom = -1;
607 static int hf_scsi_sbc_modepage_rc = -1;
608 static int hf_scsi_mmc5_modepage_lock = -1;
609 static int hf_scsi_sbc_modepage_per = -1;
610 static int hf_scsi_ssc2_modepage_socf = -1;
611 static int hf_scsi_sbc_modepage_mf = -1;
612 static int hf_scsi_smc_modepage_ie_st = -1;
613 static int hf_scsi_mmc5_modepage_digital_port1 = -1;
614 static int hf_scsi_sbc_modepage_hsec = -1;
615 static int hf_scsi_sbc_modepage_cap = -1;
616 static int hf_scsi_smc_modepage_st_ne_ie = -1;
617 static int hf_scsi_spc_modepage_logerr = -1;
618 static int hf_scsi_sbc_modepage_rmb = -1;
619 static int hf_scsi_mmc5_modepage_prevent_jumper = -1;
620 static int hf_scsi_smc_modepage_ie_mt = -1;
621 static int hf_scsi_mmc5_modepage_changer_supports_disc_present = -1;
622 static int hf_scsi_mmc5_modepage_cd_r_write = -1;
623 static int hf_scsi_ssc2_modepage_addp = -1;
624 static int hf_scsi_mmc5_modepage_dvd_r_write = -1;
625 static int hf_scsi_spc_modepage_dexcpt = -1;
626 static int hf_scsi_spc_modepage_ebf = -1;
627 static int hf_scsi_mmc5_modepage_write_type = -1;
628 static int hf_scsi_spc_modepage_fab = -1;
629 static int hf_scsi_smc_modepage_ie_ne_st = -1;
630 static int hf_scsi_ssc2_modepage_baml = -1;
631 static int hf_scsi_smc_modepage_storst = -1;
632 static int hf_scsi_sbc_modepage_dte = -1;
633 static int hf_scsi_mmc5_modepage_separate_volume_levels = -1;
634 static int hf_scsi_mmc5_modepage_isrc = -1;
635 static int hf_scsi_smc_modepage_dt_ne_mt = -1;
636 static int hf_scsi_mmc5_modepage_audio_play = -1;
637 static int hf_scsi_mmc5_modepage_separate_channel_mute = -1;
638 static int hf_scsi_ssc2_modepage_rew = -1;
639 static int hf_scsi_sbc_modepage_dcr = -1;
640 static int hf_scsi_smc_modepage_dt_ie = -1;
641 static int hf_scsi_ssc2_modepage_avc = -1;
642 static int hf_scsi_sbc_modepage_size = -1;
643 static int hf_scsi_mmc5_modepage_rw_supported = -1;
644 static int hf_scsi_spc_modepage_dtipe = -1;
645 static int hf_scsi_mmc5_modepage_sw_slot_selection = -1;
646 static int hf_scsi_ssc2_modepage_pofm = -1;
647 static int hf_scsi_spc_modepage_dlm = -1;
648 static int hf_scsi_spc_modepage_plpb = -1;
649 static int hf_scsi_smc_modepage_st_ne_st = -1;
650 static int hf_scsi_smc_modepage_dt_ne_st = -1;
651 static int hf_scsi_smc_modepage_st_ne_mt = -1;
652 static int hf_scsi_ssc2_modepage_robo = -1;
653 static int hf_scsi_spc_modepage_faa = -1;
654 static int hf_scsi_spc_modepage_ddis = -1;
655 static int hf_scsi_mmc5_modepage_cd_da_stream_is_accurate = -1;
656 static int hf_scsi_ssc2_modepage_bam = -1;
657 static int hf_scsi_spc_modepage_fac = -1;
658 static int hf_scsi_smc_modepage_mt_st = -1;
659 static int hf_scsi_smc_modepage_ie_ie = -1;
660 static int hf_scsi_smc_modepage_dt_ne_ie = -1;
661 static int hf_scsi_ssc2_modepage_lois = -1;
662 static int hf_scsi_spc_modepage_dtoli = -1;
663 static int hf_scsi_sbc_modepage_disc = -1;
664 static int hf_scsi_smc_modepage_ie_ne_ie = -1;
665 static int hf_scsi_smc_modepage_mt_ne_st = -1;
666 static int hf_scsi_ssc2_modepage_dcc = -1;
667 static int hf_scsi_mmc5_modepage_rck = -1;
668 static int hf_scsi_smc_modepage_mt_mt = -1;
669 static int hf_scsi_smc_modepage_dt_st = -1;
670 static int hf_scsi_ssc2_modepage_rewind_on_reset = -1;
671 static int hf_scsi_mmc5_modepage_upc = -1;
672 static int hf_scsi_ssc2_modepage_idp = -1;
673 static int hf_scsi_ssc2_modepage_perswp = -1;
674 static int hf_scsi_spc_xcopy_service = -1;
675 static int hf_scsi_spc_recv_copy_service = -1;
676 static int hf_scsi_spc_xcopy_param_list_len = -1;
677 static int hf_scsi_spc_xcopy_param_list_format = -1;
678 static int hf_scsi_spc_xcopy_cscd_desc_list_len = -1;
679 static int hf_scsi_spc_xcopy_head_cscd_desc_list_len = -1;
680 static int hf_scsi_spc_xcopy_head_cscd_desc_type_code = -1;
681 static int hf_scsi_spc_xcopy_cscd_desc_type_code = -1;
682 static int hf_scsi_spc_xcopy_inline_data_len = -1;
683 static int hf_scsi_spc_xcopy_seg_desc_list_len = -1;
684 static int hf_scsi_spc_xcopy_list_id = -1;
685 static int hf_scsi_spc_xcopy_rel_init_port_id = -1;
686 static int hf_scsi_spc_xcopy_per_dev_type_byte = -1;
687 static int hf_scsi_spc_xcopy_per_dev_type = -1;
688 static int hf_scsi_spc_xcopy_lu_type = -1;
689 static int hf_scsi_spc_xcopy_disk_block_len = -1;
690 static int hf_scsi_spc_xcopy_cscd_desc_code_set = -1;
691 static int hf_scsi_spc_xcopy_cscd_desc_assoc = -1;
692 static int hf_scsi_spc_xcopy_cscd_desc_des_type = -1;
693 static int hf_scsi_spc_xcopy_cscd_desc_des_len = -1;
694 static int hf_scsi_spc_xcopy_seg_desc_type = -1;
695 static int hf_scsi_spc_xcopy_seg_desc_dc = -1;
696 static int hf_scsi_spc_xcopy_seg_desc_cat = -1;
697 static int hf_scsi_spc_xcopy_seg_des_src_desc_id = -1;
698 static int hf_scsi_spc_xcopy_seg_des_dest_desc_id = -1;
699 static int hf_scsi_spc_xcopy_num_of_blocks = -1;
700 static int hf_scsi_spc_xcopy_param_list_id_usage = -1;
701 static int hf_scsi_spc_xcopy_param_str = -1;
702 static int hf_scsi_spc_xcopy_param_priority = -1;
703 static int hf_scsi_spc_xcopy_param_byte = -1;
704 static int hf_scsi_spc_xcopy_source_lba = -1;
705 static int hf_scsi_spc_xcopy_dest_lba = -1;
706 static int hf_scsi_recv_copy_max_cscd_desc_count = -1;
707 static int hf_scsi_recv_copy_max_seg_desc_count = -1;
708 static int hf_scsi_recv_copy_max_desc_list_len = -1;
709 static int hf_scsi_recv_copy_max_seg_len = -1;
710 static int hf_scsi_recv_copy_max_inline_data_len = -1;
711 static int hf_scsi_recv_copy_held_data_limit = -1;
712 static int hf_scsi_recv_copy_max_stream_dev_trans_size = -1;
713 static int hf_scsi_recv_copy_snlid = -1;
714 static int hf_scsi_recv_copy_avail_data = -1;
715 static int hf_scsi_recv_copy_total_con_copies = -1;
716 static int hf_scsi_recv_copy_max_con_copies = -1;
717 static int hf_scsi_recv_copy_data_seg_gran = -1;
718 static int hf_scsi_recv_copy_inline_data_gran = -1;
719 static int hf_scsi_recv_copy_held_data_gran = -1;
720 static int hf_scsi_recv_copy_implemented_desc_list_len = -1;
721 static int hf_scsi_segment_descriptor_length = -1;
722 static int hf_scsi_designator = -1;
723 static int hf_scsi_inline_data = -1;
724 static int hf_scsi_reserved_8 = -1;
725 static int hf_scsi_reserved_16 = -1;
726 static int hf_scsi_reserved_24 = -1;
727 static int hf_scsi_reserved_32 = -1;
728 static int hf_scsi_reserved_64 = -1;
729 static int hf_scsi_naa_type = -1;
730 static int hf_scsi_naa_locally_assigned = -1;
731 static int hf_scsi_naa_ieee_company_id = -1;
732 static int hf_scsi_naa_vendor_specific = -1;
733 static int hf_scsi_naa_vendor_specific_extension = -1;
734
735 static gint ett_scsi = -1;
736 static gint ett_scsi_page = -1;
737 gint ett_scsi_control = -1;
738 static gint ett_scsi_inq_control = -1;
739 static gint ett_scsi_inq_peripheral = -1;
740 static gint ett_scsi_inq_acaflags = -1;
741 static gint ett_scsi_inq_rmbflags = -1;
742 static gint ett_scsi_inq_sccsflags = -1;
743 static gint ett_scsi_inq_bqueflags = -1;
744 static gint ett_scsi_inq_reladrflags = -1;
745 static gint ett_scsi_log = -1;
746 static gint ett_scsi_log_ppc = -1;
747 static gint ett_scsi_log_pc = -1;
748 static gint ett_scsi_log_param = -1;
749 static gint ett_scsi_fragments = -1;
750 static gint ett_scsi_fragment = -1;
751 static gint ett_persresv_control = -1;
752 static gint ett_scsi_lun = -1;
753 static gint ett_scsi_lun_unit = -1;
754 static gint ett_scsi_prevent_allow = -1;
755 static gint ett_command_descriptor = -1;
756 static gint ett_timeout_descriptor = -1;
757 static gint ett_sense_descriptor = -1;
758 static gint ett_sense_osd_not_initiated = -1;
759 static gint ett_sense_osd_completed = -1;
760 static gint ett_xcopy_per_dev_type = -1;
761 static gint ett_xcopy_param_byte = -1;
762 static gint ett_scsi_xcopy_cscds = -1;
763 static gint ett_scsi_xcopy_cscd = -1;
764 static gint ett_scsi_xcopy_dev_params = -1;
765 static gint ett_scsi_xcopy_segs = -1;
766 static gint ett_scsi_xcopy_seg = -1;
767 static gint ett_scsi_xcopy_seg_param = -1;
768 static gint ett_scsi_cscd_desc = -1;
769 static gint ett_scsi_naa = -1;
770 static gint ett_scsi_designation_descriptor = -1;
771
772 /* Generated from convert_proto_tree_add_text.pl */
773 static expert_field ei_scsi_unknown_scsi_exchange = EI_INIT;
774 static expert_field ei_scsi_product_data_goes_past_end_of_page = EI_INIT;
775 static expert_field ei_scsi_unknown_page = EI_INIT;
776 static expert_field ei_scsi_no_dissection_for_service_action = EI_INIT;
777 static expert_field ei_scsi_unknown_serv_action = EI_INIT;
778
779 static int scsi_tap = -1;
780
781 /* Defragment of SCSI DATA IN/OUT */
782 static gboolean scsi_defragment = FALSE;
783
784 static reassembly_table scsi_reassembly_table;
785
786 /*
787  * Required by all commands
788  */
789 const int *cdb_control_fields[6] = {
790     &hf_scsi_control_vendor_specific,
791     &hf_scsi_control_reserved,
792     &hf_scsi_control_naca,
793     &hf_scsi_control_obs1,
794     &hf_scsi_control_obs2,
795     NULL
796 };
797
798 static void
799 scsi_defragment_init(void)
800 {
801     reassembly_table_init(&scsi_reassembly_table,
802                           &addresses_reassembly_table_functions);
803 }
804
805 static void
806 scsi_defragment_cleanup(void)
807 {
808     reassembly_table_destroy(&scsi_reassembly_table);
809 }
810
811 static const fragment_items scsi_frag_items = {
812     &ett_scsi_fragment,
813     &ett_scsi_fragments,
814     &hf_scsi_fragments,
815     &hf_scsi_fragment,
816     &hf_scsi_fragment_overlap,
817     &hf_scsi_fragment_overlap_conflict,
818     &hf_scsi_fragment_multiple_tails,
819     &hf_scsi_fragment_too_long_fragment,
820     &hf_scsi_fragment_error,
821     &hf_scsi_fragment_count,
822     &hf_scsi_reassembled_in,
823     &hf_scsi_reassembled_length,
824     /* Reassembled data field */
825     NULL,
826     "fragments"
827 };
828
829
830 typedef guint32 scsi_cmnd_type;
831 typedef guint32 scsi_device_type;
832
833 /* Valid SCSI Command Types */
834 #define SCSI_CMND_SPC                    1
835 #define SCSI_CMND_SBC                    2
836 #define SCSI_CMND_SSC                    3
837 #define SCSI_CMND_SMC                    4
838 #define SCSI_CMND_MMC                    5
839
840 /* SPC and SPC-2 Commands */
841 static const value_string scsi_spc_vals[] = {
842     /* 0x00 */    {SCSI_SPC_TESTUNITRDY        , "Test Unit Ready"},
843     /* 0x03 */    {SCSI_SPC_REQSENSE           , "Request Sense"},
844     /* 0x12 */    {SCSI_SPC_INQUIRY            , "Inquiry"},
845     /* 0x15 */    {SCSI_SPC_MODESELECT6        , "Mode Select(6)"},
846     /* 0x16 */    {SCSI_SPC_RESERVE6           , "Reserve(6)"},
847     /* 0x17 */    {SCSI_SPC_RELEASE6           , "Release(6)"},
848     /* 0x18 */    {SCSI_SPC_COPY               , "Copy"},
849     /* 0x1A */    {SCSI_SPC_MODESENSE6         , "Mode Sense(6)"},
850     /* 0x1C */    {SCSI_SPC_RCVDIAGRESULTS     , "Receive Diagnostics Results"},
851     /* 0x1D */    {SCSI_SPC_SENDDIAG           , "Send Diagnostic"},
852     /* 0x1E */    {SCSI_SPC_PREVMEDREMOVAL     , "Prevent/Allow Medium Removal"},
853     /* 0x39 */    {SCSI_SPC_COMPARE            , "Compare"},
854     /* 0x3A */    {SCSI_SPC_COPY_AND_VERIFY    , "Copy And Verify"},
855     /* 0x3B */    {SCSI_SPC_WRITEBUFFER        , "Write Buffer"},
856     /* 0x3C */    {SCSI_SPC_READBUFFER         , "Read Buffer"},
857     /* 0x40 */    {SCSI_SPC_CHANGE_DEFINITION  , "Change Definition"},
858     /* 0x4C */    {SCSI_SPC_LOGSELECT          , "Log Select"},
859     /* 0x4D */    {SCSI_SPC_LOGSENSE           , "Log Sense"},
860     /* 0x55 */    {SCSI_SPC_MODESELECT10       , "Mode Select(10)"},
861     /* 0x56 */    {SCSI_SPC_RESERVE10          , "Reserve(10)"},
862     /* 0x57 */    {SCSI_SPC_RELEASE10          , "Release(10)"},
863     /* 0x5A */    {SCSI_SPC_MODESENSE10        , "Mode Sense(10)"},
864     /* 0x5E */    {SCSI_SPC_PERSRESVIN         , "Persistent Reserve In"},
865     /* 0x5F */    {SCSI_SPC_PERSRESVOUT        , "Persistent Reserve Out"},
866     /* 0x7F */    {SCSI_SPC_VARLENCDB          , "Variable Length CDB"},
867     /* 0x83 */    {SCSI_SPC_EXTCOPY            , "Extended Copy"},
868     /* 0x84 */    {SCSI_SPC_RECVCOPY           , "Receive Copy"},
869     /* 0x84 */    {SCSI_SPC_RCVCOPYRESULTS     , "Receive Copy Results"},
870     /* 0x86 */    {SCSI_SPC_ACCESS_CONTROL_IN  , "Access Control In"},
871     /* 0x87 */    {SCSI_SPC_ACCESS_CONTROL_OUT , "Access Control Out"},
872     /* 0xA0 */    {SCSI_SPC_REPORTLUNS         , "Report LUNs"},
873     /* 0xA3 */    {SCSI_SPC_MGMT_PROTOCOL_IN   , "Mgmt Protocol In"},
874     {0, NULL},
875 };
876 static value_string_ext scsi_spc_vals_ext = VALUE_STRING_EXT_INIT(scsi_spc_vals);
877
878 static const value_string scsi_lun_address_mode_vals[] = {
879     { 0, "Peripheral Device Addressing Method" },
880     { 1, "Flat Space Addressing Method" },
881     { 2, "Logical Unit Addressing Method" },
882     { 3, "Extended Logical Unit Addressing" },
883     { 0, NULL }
884 };
885
886 static const value_string provisioning_vals[] = {
887     {0, "No provisioning"},
888     {1, "Resource provisioned"},
889     {2, "Thin provisioned"},
890     {0, NULL},
891 };
892
893 static const value_string log_flags_tmc_vals[] = {
894     {0, "Every update of the cumulative value"},
895     {1, "Cumulative value equal to threshold value"},
896     {2, "Cumulative value not equal to threshold value"},
897     {3, "Cumulative value greater than threshold value"},
898     {0, NULL},
899 };
900
901 static const value_string scsi_select_report_val[] = {
902     {0, "Select All LUNs" },
903     {1, "Select Well-Known LUNs" },
904     {2, "Select All LUNs accessible to this I_T nexus" },
905     {0, NULL},
906 };
907
908 #define SCSI_EVPD_SUPPPG          0x00
909 #define SCSI_EVPD_DEVSERNUM       0x80
910 #define SCSI_EVPD_OPER            0x81
911 #define SCSI_EVPD_ASCIIOPER       0x82
912 #define SCSI_EVPD_DEVID           0x83
913 #define SCSI_EVPD_BLKLIMITS       0xb0
914 #define SCSI_EVPD_BLKDEVCHAR      0xb1
915 #define SCSI_EVPD_LBP             0xb2
916
917 static const value_string scsi_evpd_pagecode_val[] = {
918     {SCSI_EVPD_SUPPPG,    "Supported Vital Product Data Pages"},
919     {0x01,                "ASCII Information Page"},
920     {0x02,                "ASCII Information Page"},
921     {0x03,                "ASCII Information Page"},
922     {0x04,                "ASCII Information Page"},
923     {0x05,                "ASCII Information Page"},
924     {0x06,                "ASCII Information Page"},
925     {0x07,                "ASCII Information Page"},
926     /* XXX - 0x01 through 0x7F are all ASCII information pages */
927     {SCSI_EVPD_DEVSERNUM, "Unit Serial Number Page"},
928     {SCSI_EVPD_OPER,      "Implemented Operating Definition Page"},
929     {SCSI_EVPD_ASCIIOPER, "ASCII Implemented Operating Definition Page"},
930     {SCSI_EVPD_DEVID,     "Device Identification Page"},
931     {SCSI_EVPD_BLKLIMITS, "Block Limits Page"},
932     {SCSI_EVPD_BLKDEVCHAR,"Block Device Characteristics"},
933     {SCSI_EVPD_LBP,       "Logical Block Provisioning Page"},
934     {0, NULL},
935 };
936
937 static const value_string mrr_val[] = {
938     {0x0,       "Media rotation speed not reported"},
939     {0x1,       "Non-rotating media"},
940     /* 0x2 - 0x400 - reserved */
941     {5400,      "5,400 RPM"},
942     {7200,      "7,200 RPM"},
943     {10000,     "10,000 RPM"},
944     {15000,     "15,000 RPM"},
945     {0, NULL},
946 };
947 static const value_string scsi_log_pc_val[] = {
948     {0, "Threshold Values"},
949     {1, "Cumulative Values"},
950     {2, "Default Threshold Values"},
951     {3, "Default Cumulative Values"},
952     {0, NULL},
953 };
954
955 #define NAA_TYPE_IEEE_EXTENDED            2
956 #define NAA_TYPE_LOCALLY_ASSIGNED         3
957 #define NAA_TYPE_IEEE_REGISTERED          5
958 #define NAA_TYPE_IEEE_REGISTERED_EXTENDED 6
959 static const value_string scsi_naa_designator_type_val[] = {
960     {2, "IEEE Extended" },
961     {3, "Locally Assigned" },
962     {5, "IEEE Registered" },
963     {6, "IEEE Registered Extended" },
964     {0, NULL},
965 };
966
967 #define SCSI_NUM_PROCEDURES 256
968 typedef struct scsistat_tap_data
969 {
970     guint8     cmdset;
971     const char *prog;
972     value_string_ext *cdbnames_ext;
973     const char *hf_name;
974 } scsistat_tap_data_t;
975
976 static void
977 scsistat_init(struct register_srt* srt, GArray* srt_array, srt_gui_init_cb gui_callback, void* gui_data)
978 {
979     scsistat_tap_data_t* tap_data = (scsistat_tap_data_t*)get_srt_table_param_data(srt);
980     srt_stat_table *scsi_srt_table;
981     guint32 i;
982
983     DISSECTOR_ASSERT(tap_data);
984
985     scsi_srt_table = init_srt_table(tap_data->prog, NULL, srt_array, SCSI_NUM_PROCEDURES, NULL, tap_data->hf_name, gui_callback, gui_data, tap_data);
986     for (i = 0; i < SCSI_NUM_PROCEDURES; i++)
987     {
988         init_srt_table_row(scsi_srt_table, i, val_to_str_ext_const(i, tap_data->cdbnames_ext, "Unknown-0x%02x"));
989     }
990 }
991
992 static int
993 scsistat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv)
994 {
995     guint i = 0;
996     srt_stat_table *scsi_srt_table;
997     srt_data_t *data = (srt_data_t *)pss;
998     const scsi_task_data_t *ri = (const scsi_task_data_t *)prv;
999     scsistat_tap_data_t* tap_data;
1000
1001     scsi_srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
1002     tap_data = (scsistat_tap_data_t*)scsi_srt_table->table_specific_data;
1003
1004     /* we are only interested in response packets */
1005     if (ri->type != SCSI_PDU_TYPE_RSP) {
1006         return 0;
1007     }
1008     /* we are only interested in a specific commandset */
1009     if ( (!ri->itl) || ((ri->itl->cmdset&SCSI_CMDSET_MASK) != tap_data->cmdset) ) {
1010         return 0;
1011     }
1012     /* check that the opcode looks sane */
1013     if ( (!ri->itlq) || (ri->itlq->scsi_opcode > 255) ) {
1014         return 0;
1015     }
1016
1017     add_srt_table_data(scsi_srt_table, ri->itlq->scsi_opcode, &ri->itlq->fc_time, pinfo);
1018     return 1;
1019 }
1020
1021 static guint
1022 scsistat_param(register_srt_t* srt, const char* opt_arg, char** err)
1023 {
1024     int pos = 0;
1025     int program;
1026     scsistat_tap_data_t* tap_data;
1027
1028     if (sscanf(opt_arg, ",%d%n", &program, &pos) == 1)
1029     {
1030         tap_data = g_new0(scsistat_tap_data_t, 1);
1031         tap_data->cmdset = (guint8)program;
1032
1033         switch(program){
1034         case SCSI_DEV_SBC:
1035             tap_data->prog = "SBC (disk)";
1036             tap_data->cdbnames_ext = &scsi_sbc_vals_ext;
1037             tap_data->hf_name = "scsi_sbc.opcode";
1038         break;
1039         case SCSI_DEV_SSC:
1040             tap_data->prog = "SSC (tape)";
1041             tap_data->cdbnames_ext = &scsi_ssc_vals_ext;
1042             tap_data->hf_name = "scsi_ssc.opcode";
1043         break;
1044         case SCSI_DEV_CDROM:
1045             tap_data->prog = "MMC (cd/dvd)";
1046             tap_data->cdbnames_ext = &scsi_mmc_vals_ext;
1047             tap_data->hf_name = "scsi_mmc.opcode";
1048         break;
1049         case SCSI_DEV_SMC:
1050             tap_data->prog = "SMC (tape robot)";
1051             tap_data->cdbnames_ext = &scsi_smc_vals_ext;
1052             tap_data->hf_name = "scsi_smc.opcode";
1053         break;
1054         case SCSI_DEV_OSD:
1055             tap_data->prog = "OSD (object based)";
1056             tap_data->cdbnames_ext = &scsi_osd_vals_ext;
1057             tap_data->hf_name = "scsi_osd.opcode";
1058         break;
1059         }
1060
1061         set_srt_table_param_data(srt, tap_data);
1062     }
1063     else
1064     {
1065         *err = g_strdup("<cmdset>[,<filter>]");
1066     }
1067
1068     return pos;
1069 }
1070
1071 /* TapeAlert page : read warning flag */
1072 static void
1073 log_parameter_2e_0001(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1074 {
1075     proto_tree_add_item(tree, hf_scsi_log_ta_rw, tvb, 0, 1, ENC_BIG_ENDIAN);
1076 }
1077
1078 /* TapeAlert page : write warning flag */
1079 static void
1080 log_parameter_2e_0002(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1081 {
1082     proto_tree_add_item(tree, hf_scsi_log_ta_ww, tvb, 0, 1, ENC_BIG_ENDIAN);
1083 }
1084
1085 /* TapeAlert page : hard error flag */
1086 static void
1087 log_parameter_2e_0003(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1088 {
1089     proto_tree_add_item(tree, hf_scsi_log_ta_he, tvb, 0, 1, ENC_BIG_ENDIAN);
1090 }
1091
1092 /* TapeAlert page : media flag */
1093 static void
1094 log_parameter_2e_0004(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1095 {
1096     proto_tree_add_item(tree, hf_scsi_log_ta_media, tvb, 0, 1, ENC_BIG_ENDIAN);
1097 }
1098
1099 /* TapeAlert page : read failure flag */
1100 static void
1101 log_parameter_2e_0005(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1102 {
1103     proto_tree_add_item(tree, hf_scsi_log_ta_rf, tvb, 0, 1, ENC_BIG_ENDIAN);
1104 }
1105
1106 /* TapeAlert page : write failure flag */
1107 static void
1108 log_parameter_2e_0006(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1109 {
1110     proto_tree_add_item(tree, hf_scsi_log_ta_wf, tvb, 0, 1, ENC_BIG_ENDIAN);
1111 }
1112
1113 /* TapeAlert page : media life flag */
1114 static void
1115 log_parameter_2e_0007(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1116 {
1117     proto_tree_add_item(tree, hf_scsi_log_ta_ml, tvb, 0, 1, ENC_BIG_ENDIAN);
1118 }
1119
1120 /* TapeAlert page : not data grade flag */
1121 static void
1122 log_parameter_2e_0008(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1123 {
1124     proto_tree_add_item(tree, hf_scsi_log_ta_ndg, tvb, 0, 1, ENC_BIG_ENDIAN);
1125 }
1126
1127 /* TapeAlert page : write protect flag */
1128 static void
1129 log_parameter_2e_0009(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1130 {
1131     proto_tree_add_item(tree, hf_scsi_log_ta_wp, tvb, 0, 1, ENC_BIG_ENDIAN);
1132 }
1133
1134 /* TapeAlert page : no removal flag */
1135 static void
1136 log_parameter_2e_000a(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1137 {
1138     proto_tree_add_item(tree, hf_scsi_log_ta_nr, tvb, 0, 1, ENC_BIG_ENDIAN);
1139 }
1140
1141 /* TapeAlert page : cleaning media flag */
1142 static void
1143 log_parameter_2e_000b(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1144 {
1145     proto_tree_add_item(tree, hf_scsi_log_ta_cm, tvb, 0, 1, ENC_BIG_ENDIAN);
1146 }
1147
1148 /* TapeAlert page : unsupported format flag */
1149 static void
1150 log_parameter_2e_000c(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1151 {
1152     proto_tree_add_item(tree, hf_scsi_log_ta_uf, tvb, 0, 1, ENC_BIG_ENDIAN);
1153 }
1154
1155 /* TapeAlert page : removable mechanical cartridge failure flag */
1156 static void
1157 log_parameter_2e_000d(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1158 {
1159     proto_tree_add_item(tree, hf_scsi_log_ta_rmcf, tvb, 0, 1, ENC_BIG_ENDIAN);
1160 }
1161
1162 /* TapeAlert page : unrecoverable mechanical cartridge failure flag */
1163 static void
1164 log_parameter_2e_000e(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1165 {
1166     proto_tree_add_item(tree, hf_scsi_log_ta_umcf, tvb, 0, 1, ENC_BIG_ENDIAN);
1167 }
1168
1169 /* TapeAlert page : memory chip in cartridge failure flag */
1170 static void
1171 log_parameter_2e_000f(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1172 {
1173     proto_tree_add_item(tree, hf_scsi_log_ta_mcicf, tvb, 0, 1, ENC_BIG_ENDIAN);
1174 }
1175
1176 /* TapeAlert page : forced eject flag */
1177 static void
1178 log_parameter_2e_0010(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1179 {
1180     proto_tree_add_item(tree, hf_scsi_log_ta_fe, tvb, 0, 1, ENC_BIG_ENDIAN);
1181 }
1182
1183 /* TapeAlert page : read only format flag */
1184 static void
1185 log_parameter_2e_0011(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1186 {
1187     proto_tree_add_item(tree, hf_scsi_log_ta_rof, tvb, 0, 1, ENC_BIG_ENDIAN);
1188 }
1189
1190 /* TapeAlert page : tape directory corrupted on load flag */
1191 static void
1192 log_parameter_2e_0012(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1193 {
1194     proto_tree_add_item(tree, hf_scsi_log_ta_tdcol, tvb, 0, 1, ENC_BIG_ENDIAN);
1195 }
1196
1197 /* TapeAlert page : nearing media life flag */
1198 static void
1199 log_parameter_2e_0013(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1200 {
1201     proto_tree_add_item(tree, hf_scsi_log_ta_nml, tvb, 0, 1, ENC_BIG_ENDIAN);
1202 }
1203
1204 /* TapeAlert page : clean now flag */
1205 static void
1206 log_parameter_2e_0014(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1207 {
1208     proto_tree_add_item(tree, hf_scsi_log_ta_cn, tvb, 0, 1, ENC_BIG_ENDIAN);
1209 }
1210
1211 /* TapeAlert page : clean periodic flag */
1212 static void
1213 log_parameter_2e_0015(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1214 {
1215     proto_tree_add_item(tree, hf_scsi_log_ta_cp, tvb, 0, 1, ENC_BIG_ENDIAN);
1216 }
1217
1218 /* TapeAlert page : expired cleaning media flag */
1219 static void
1220 log_parameter_2e_0016(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1221 {
1222     proto_tree_add_item(tree, hf_scsi_log_ta_ecm, tvb, 0, 1, ENC_BIG_ENDIAN);
1223 }
1224
1225 /* TapeAlert page : invalid cleaning tape flag */
1226 static void
1227 log_parameter_2e_0017(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1228 {
1229     proto_tree_add_item(tree, hf_scsi_log_ta_ict, tvb, 0, 1, ENC_BIG_ENDIAN);
1230 }
1231
1232 /* TapeAlert page : retention requested flag */
1233 static void
1234 log_parameter_2e_0018(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1235 {
1236     proto_tree_add_item(tree, hf_scsi_log_ta_rr, tvb, 0, 1, ENC_BIG_ENDIAN);
1237 }
1238
1239 /* TapeAlert page : dual port interface error flag */
1240 static void
1241 log_parameter_2e_0019(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1242 {
1243     proto_tree_add_item(tree, hf_scsi_log_ta_dpie, tvb, 0, 1, ENC_BIG_ENDIAN);
1244 }
1245
1246 /* TapeAlert page : cooling fan failure flag */
1247 static void
1248 log_parameter_2e_001a(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1249 {
1250     proto_tree_add_item(tree, hf_scsi_log_ta_cff, tvb, 0, 1, ENC_BIG_ENDIAN);
1251 }
1252
1253 /* TapeAlert page : power supply failure flag */
1254 static void
1255 log_parameter_2e_001b(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1256 {
1257     proto_tree_add_item(tree, hf_scsi_log_ta_psf, tvb, 0, 1, ENC_BIG_ENDIAN);
1258 }
1259
1260 /* TapeAlert page : power consumption flag */
1261 static void
1262 log_parameter_2e_001c(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1263 {
1264     proto_tree_add_item(tree, hf_scsi_log_ta_pc, tvb, 0, 1, ENC_BIG_ENDIAN);
1265 }
1266
1267 /* TapeAlert page : drive maintenance flag */
1268 static void
1269 log_parameter_2e_001d(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1270 {
1271     proto_tree_add_item(tree, hf_scsi_log_ta_dm, tvb, 0, 1, ENC_BIG_ENDIAN);
1272 }
1273
1274 /* TapeAlert page : hardware a flag */
1275 static void
1276 log_parameter_2e_001e(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1277 {
1278     proto_tree_add_item(tree, hf_scsi_log_ta_hwa, tvb, 0, 1, ENC_BIG_ENDIAN);
1279 }
1280
1281 /* TapeAlert page : hardware b flag */
1282 static void
1283 log_parameter_2e_001f(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1284 {
1285     proto_tree_add_item(tree, hf_scsi_log_ta_hwb, tvb, 0, 1, ENC_BIG_ENDIAN);
1286 }
1287
1288 /* TapeAlert page : interface flag */
1289 static void
1290 log_parameter_2e_0020(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1291 {
1292     proto_tree_add_item(tree, hf_scsi_log_ta_if, tvb, 0, 1, ENC_BIG_ENDIAN);
1293 }
1294
1295 /* TapeAlert page : eject media flag */
1296 static void
1297 log_parameter_2e_0021(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1298 {
1299     proto_tree_add_item(tree, hf_scsi_log_ta_em, tvb, 0, 1, ENC_BIG_ENDIAN);
1300 }
1301
1302 /* TapeAlert page : download failed flag */
1303 static void
1304 log_parameter_2e_0022(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1305 {
1306     proto_tree_add_item(tree, hf_scsi_log_ta_dwf, tvb, 0, 1, ENC_BIG_ENDIAN);
1307 }
1308
1309 /* TapeAlert page : drive humidity flag */
1310 static void
1311 log_parameter_2e_0023(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1312 {
1313     proto_tree_add_item(tree, hf_scsi_log_ta_drhu, tvb, 0, 1, ENC_BIG_ENDIAN);
1314 }
1315
1316 /* TapeAlert page : drive temperature flag */
1317 static void
1318 log_parameter_2e_0024(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1319 {
1320     proto_tree_add_item(tree, hf_scsi_log_ta_drtm, tvb, 0, 1, ENC_BIG_ENDIAN);
1321 }
1322
1323 /* TapeAlert page : drive voltage flag */
1324 static void
1325 log_parameter_2e_0025(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1326 {
1327     proto_tree_add_item(tree, hf_scsi_log_ta_drvo, tvb, 0, 1, ENC_BIG_ENDIAN);
1328 }
1329
1330 /* TapeAlert page : periodic failure flag */
1331 static void
1332 log_parameter_2e_0026(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1333 {
1334     proto_tree_add_item(tree, hf_scsi_log_ta_pefa, tvb, 0, 1, ENC_BIG_ENDIAN);
1335 }
1336
1337 /* TapeAlert page : diagnostics required flag */
1338 static void
1339 log_parameter_2e_0027(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1340 {
1341     proto_tree_add_item(tree, hf_scsi_log_ta_dire, tvb, 0, 1, ENC_BIG_ENDIAN);
1342 }
1343
1344 /* TapeAlert page : lost statistics flag */
1345 static void
1346 log_parameter_2e_0032(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1347 {
1348     proto_tree_add_item(tree, hf_scsi_log_ta_lost, tvb, 0, 1, ENC_BIG_ENDIAN);
1349 }
1350
1351 /* TapeAlert page : tape directory invalid at unload flag */
1352 static void
1353 log_parameter_2e_0033(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1354 {
1355     proto_tree_add_item(tree, hf_scsi_log_ta_tduau, tvb, 0, 1, ENC_BIG_ENDIAN);
1356 }
1357
1358 /* TapeAlert page : tape system area write failure flag */
1359 static void
1360 log_parameter_2e_0034(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1361 {
1362     proto_tree_add_item(tree, hf_scsi_log_ta_tsawf, tvb, 0, 1, ENC_BIG_ENDIAN);
1363 }
1364
1365 /* TapeAlert page : tape system area read failure flag */
1366 static void
1367 log_parameter_2e_0035(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1368 {
1369     proto_tree_add_item(tree, hf_scsi_log_ta_tsarf, tvb, 0, 1, ENC_BIG_ENDIAN);
1370 }
1371
1372 /* TapeAlert page : no start of data flag */
1373 static void
1374 log_parameter_2e_0036(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1375 {
1376     proto_tree_add_item(tree, hf_scsi_log_ta_nsod, tvb, 0, 1, ENC_BIG_ENDIAN);
1377 }
1378
1379 /* TapeAlert page : loading failure flag */
1380 static void
1381 log_parameter_2e_0037(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1382 {
1383     proto_tree_add_item(tree, hf_scsi_log_ta_lofa, tvb, 0, 1, ENC_BIG_ENDIAN);
1384 }
1385
1386 /* TapeAlert page : unrecoverable unload failure flag */
1387 static void
1388 log_parameter_2e_0038(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1389 {
1390     proto_tree_add_item(tree, hf_scsi_log_ta_uuf, tvb, 0, 1, ENC_BIG_ENDIAN);
1391 }
1392
1393 /* TapeAlert page : automatic interface failure flag */
1394 static void
1395 log_parameter_2e_0039(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1396 {
1397     proto_tree_add_item(tree, hf_scsi_log_ta_aif, tvb, 0, 1, ENC_BIG_ENDIAN);
1398 }
1399
1400 /* TapeAlert page : firmware failure flag */
1401 static void
1402 log_parameter_2e_003a(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1403 {
1404     proto_tree_add_item(tree, hf_scsi_log_ta_fwf, tvb, 0, 1, ENC_BIG_ENDIAN);
1405 }
1406
1407 /* TapeAlert page : worm medium integrity check failed flag */
1408 static void
1409 log_parameter_2e_003b(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1410 {
1411     proto_tree_add_item(tree, hf_scsi_log_ta_wmicf, tvb, 0, 1, ENC_BIG_ENDIAN);
1412 }
1413
1414 /* TapeAlert page : worm medium overwrite attempted flag */
1415 static void
1416 log_parameter_2e_003c(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1417 {
1418     proto_tree_add_item(tree, hf_scsi_log_ta_wmoa, tvb, 0, 1, ENC_BIG_ENDIAN);
1419 }
1420
1421
1422 typedef void (*log_parameter_dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1423
1424 typedef struct _log_page_parameters_t {
1425     guint32 number;
1426     const char *name;
1427     log_parameter_dissector dissector;
1428 } log_page_parameters_t;
1429 static const log_page_parameters_t tape_alert_log_parameters[] = {
1430     {0x0001,    "Read Warning", log_parameter_2e_0001},
1431     {0x0002,    "write warning", log_parameter_2e_0002},
1432     {0x0003,    "hard error", log_parameter_2e_0003},
1433     {0x0004,    "media", log_parameter_2e_0004},
1434     {0x0005,    "read failure", log_parameter_2e_0005},
1435     {0x0006,    "write failure", log_parameter_2e_0006},
1436     {0x0007,    "media life", log_parameter_2e_0007},
1437     {0x0008,    "not data grade", log_parameter_2e_0008},
1438     {0x0009,    "write protect", log_parameter_2e_0009},
1439     {0x000a,    "no removal", log_parameter_2e_000a},
1440     {0x000b,    "cleaning media", log_parameter_2e_000b},
1441     {0x000c,    "unsupported format", log_parameter_2e_000c},
1442     {0x000d,    "removable mechanical cartridge failure", log_parameter_2e_000d},
1443     {0x000e,    "unrecoverable mechanical cartridge failure", log_parameter_2e_000e},
1444     {0x000f,    "memory chip in cartridge failure", log_parameter_2e_000f},
1445     {0x0010,    "forced eject", log_parameter_2e_0010},
1446     {0x0011,    "read only format", log_parameter_2e_0011},
1447     {0x0012,    "tape directory corrupted on load", log_parameter_2e_0012},
1448     {0x0013,    "nearing media life", log_parameter_2e_0013},
1449     {0x0014,    "clean now", log_parameter_2e_0014},
1450     {0x0015,    "clean periodic", log_parameter_2e_0015},
1451     {0x0016,    "expired cleaning media", log_parameter_2e_0016},
1452     {0x0017,    "invalid cleaning tape", log_parameter_2e_0017},
1453     {0x0018,    "retention requested", log_parameter_2e_0018},
1454     {0x0019,    "dual port interface error", log_parameter_2e_0019},
1455     {0x001a,    "cooling fan failure", log_parameter_2e_001a},
1456     {0x001b,    "power supply failure", log_parameter_2e_001b},
1457     {0x001c,    "power consumption", log_parameter_2e_001c},
1458     {0x001d,    "drive maintenance", log_parameter_2e_001d},
1459     {0x001e,    "hardware a", log_parameter_2e_001e},
1460     {0x001f,    "hardware b", log_parameter_2e_001f},
1461     {0x0020,    "interface", log_parameter_2e_0020},
1462     {0x0021,    "eject media", log_parameter_2e_0021},
1463     {0x0022,    "download failed", log_parameter_2e_0022},
1464     {0x0023,    "drive humidity", log_parameter_2e_0023},
1465     {0x0024,    "drive temperature", log_parameter_2e_0024},
1466     {0x0025,    "drive voltage", log_parameter_2e_0025},
1467     {0x0026,    "periodic failure", log_parameter_2e_0026},
1468     {0x0027,    "diagnostics required", log_parameter_2e_0027},
1469     {0x0032,    "lost statistics", log_parameter_2e_0032},
1470     {0x0033,    "tape directory invalid at unload", log_parameter_2e_0033},
1471     {0x0034,    "tape system area write failure", log_parameter_2e_0034},
1472     {0x0035,    "tape system area read failure", log_parameter_2e_0035},
1473     {0x0036,    "no start of data", log_parameter_2e_0036},
1474     {0x0037,    "loading failure", log_parameter_2e_0037},
1475     {0x0038,    "unrecoverable unload failure", log_parameter_2e_0038},
1476     {0x0039,    "automatic interface failure", log_parameter_2e_0039},
1477     {0x003a,    "firmware failure", log_parameter_2e_003a},
1478     {0x003b,    "worm medium integrity check failed", log_parameter_2e_003b},
1479     {0x003c,    "worm medium overwrite attempted", log_parameter_2e_003c},
1480     {0, NULL, NULL}
1481 };
1482
1483 typedef struct _log_pages_t {
1484     guint32 page;
1485     const log_page_parameters_t *parameters;
1486 } log_pages_t;
1487
1488
1489 #define LOG_PAGE_TAPE_ALERT     0x2e
1490 static const value_string scsi_log_page_val[] = {
1491     {0x00, "Supported Log Pages"},
1492     {0x01, "Buffer Overrun/Underrun Page"},
1493     {0x02, "Error Counter (write) Page"},
1494     {0x03, "Error Counter (read) Page"},
1495     {0x04, "Error Counter (read reverse) Page"},
1496     {0x05, "Error Counter (verify) Page"},
1497     {0x06, "Non-medium Error Page"},
1498     {0x07, "Last n Error Events Page"},
1499     {0x08, "Format Status Log Page"},
1500     {0x0B, "Last n Deferred Errors or Async Events Page"},
1501     {0x0C, "Sequential-Access Device Log Page"},
1502     {0x0D, "Temperature Page"},
1503     {0x0E, "Start-Stop Cycle Counter Page"},
1504     {0x0F, "Application Client Page"},
1505     {0x10, "Self-test Results Page"},
1506     {0x11, "DTD Status Log Page"},
1507     {LOG_PAGE_TAPE_ALERT, "Tape-Alert Log Page (SSC)"},
1508     {0x2f, "Informational Exceptions Log Page"},
1509     {0, NULL},
1510 };
1511
1512 static const log_pages_t log_pages[] = {
1513     {LOG_PAGE_TAPE_ALERT, tape_alert_log_parameters},
1514     {0, NULL}
1515 };
1516
1517
1518
1519
1520 static const value_string scsi_modesns_pc_val[] = {
1521     {0, "Current Values"},
1522     {1, "Changeable Values"},
1523     {2, "Default Values"},
1524     {3, "Saved Values"},
1525     {0, NULL},
1526 };
1527
1528 #define SCSI_SPC_MODEPAGE_CTL      0x0A
1529 #define SCSI_SPC_MODEPAGE_DISCON   0x02
1530 #define SCSI_SCSI2_MODEPAGE_PERDEV  0x09  /* Obsolete in SPC-2; generic in SCSI-2 */
1531 #define SCSI_SPC_MODEPAGE_INFOEXCP 0x1C
1532 #define SCSI_SPC_MODEPAGE_PWR      0x1A
1533 #define SCSI_SPC_MODEPAGE_LUN      0x18
1534 #define SCSI_SPC_MODEPAGE_PORT     0x19
1535 #define SCSI_SPC_MODEPAGE_VEND     0x00
1536
1537 static const value_string scsi_spc_modepage_val[] = {
1538     {SCSI_SPC_MODEPAGE_CTL,      "Control"},
1539     {SCSI_SPC_MODEPAGE_DISCON,   "Disconnect-Reconnect"},
1540     {SCSI_SCSI2_MODEPAGE_PERDEV, "Peripheral Device"},
1541     {SCSI_SPC_MODEPAGE_INFOEXCP, "Informational Exceptions Control"},
1542     {SCSI_SPC_MODEPAGE_PWR,      "Power Condition"},
1543     {SCSI_SPC_MODEPAGE_LUN,      "Protocol Specific LUN"},
1544     {SCSI_SPC_MODEPAGE_PORT,     "Protocol-Specific Port"},
1545     {SCSI_SPC_MODEPAGE_VEND,     "Vendor Specific Page"},
1546     {0x3F,                       "Return All Mode Pages"},
1547     {0, NULL},
1548 };
1549
1550 #define SCSI_SBC_MODEPAGE_RDWRERR  0x01
1551 #define SCSI_SBC_MODEPAGE_FMTDEV   0x03
1552 #define SCSI_SBC_MODEPAGE_DISKGEOM 0x04
1553 #define SCSI_SBC_MODEPAGE_FLEXDISK 0x05
1554 #define SCSI_SBC_MODEPAGE_VERERR   0x07
1555 #define SCSI_SBC_MODEPAGE_CACHE    0x08
1556 #define SCSI_SBC_MODEPAGE_MEDTYPE  0x0B
1557 #define SCSI_SBC_MODEPAGE_NOTPART  0x0C
1558 #define SCSI_SBC_MODEPAGE_XORCTL   0x10
1559
1560 static const value_string scsi_sbc_modepage_val[] = {
1561     {SCSI_SBC_MODEPAGE_RDWRERR,  "Read/Write Error Recovery"},
1562     {SCSI_SBC_MODEPAGE_FMTDEV,   "Format Device"},
1563     {SCSI_SBC_MODEPAGE_DISKGEOM, "Rigid Disk Geometry"},
1564     {SCSI_SBC_MODEPAGE_FLEXDISK, "Flexible Disk"},
1565     {SCSI_SBC_MODEPAGE_VERERR,   "Verify Error Recovery"},
1566     {SCSI_SBC_MODEPAGE_CACHE,    "Caching"},
1567     {SCSI_SBC_MODEPAGE_MEDTYPE,  "Medium Types Supported"},
1568     {SCSI_SBC_MODEPAGE_NOTPART,  "Notch & Partition"},
1569     {SCSI_SBC_MODEPAGE_XORCTL,   "XOR Control"},
1570     {0x3F,                        "Return All Mode Pages"},
1571     {0, NULL},
1572 };
1573
1574 #define SCSI_SSC2_MODEPAGE_DATACOMP 0x0F  /* data compression */
1575 #define SCSI_SSC2_MODEPAGE_DEVCONF  0x10  /* device configuration */
1576 #define SCSI_SSC2_MODEPAGE_MEDPAR1  0x11  /* medium partition (1) */
1577 #define SCSI_SSC2_MODEPAGE_MEDPAR2  0x12  /* medium partition (2) */
1578 #define SCSI_SSC2_MODEPAGE_MEDPAR3  0x13  /* medium partition (3) */
1579 #define SCSI_SSC2_MODEPAGE_MEDPAR4  0x14  /* medium partition (4) */
1580
1581 static const value_string scsi_ssc2_modepage_val[] = {
1582     {SCSI_SSC2_MODEPAGE_DATACOMP, "Data Compression"},
1583     {SCSI_SSC2_MODEPAGE_DEVCONF,  "Device Configuration"},
1584     {SCSI_SSC2_MODEPAGE_MEDPAR1,  "Medium Partition (1)"},
1585     {SCSI_SSC2_MODEPAGE_MEDPAR2,  "Medium Partition (2)"},
1586     {SCSI_SSC2_MODEPAGE_MEDPAR3,  "Medium Partition (3)"},
1587     {SCSI_SSC2_MODEPAGE_MEDPAR4,  "Medium Partition (4)"},
1588     {0x3F,                        "Return All Mode Pages"},
1589     {0, NULL},
1590 };
1591
1592 #define SCSI_SMC_MODEPAGE_EAA      0x1D  /* element address assignment */
1593 #define SCSI_SMC_MODEPAGE_TRANGEOM 0x1E  /* transport geometry parameters */
1594 #define SCSI_SMC_MODEPAGE_DEVCAP   0x1F  /* device capabilities */
1595
1596 static const value_string scsi_smc_modepage_val[] = {
1597     {SCSI_SMC_MODEPAGE_EAA,      "Element Address Assignment"},
1598     {SCSI_SMC_MODEPAGE_TRANGEOM, "Transport Geometry Parameters"},
1599     {SCSI_SMC_MODEPAGE_DEVCAP,   "Device Capabilities"},
1600     {0x3F,                        "Return All Mode Pages"},
1601     {0, NULL},
1602 };
1603
1604 #define SCSI_MMC5_MODEPAGE_MRW     0x03  /* MRW */
1605 #define SCSI_MMC5_MODEPAGE_WRPARAM 0x05  /* Write Parameters */
1606 #define SCSI_MMC3_MODEPAGE_MMCAP   0x2A  /* device capabilities */
1607
1608 static const value_string scsi_mmc5_modepage_val[] = {
1609     {SCSI_MMC5_MODEPAGE_MRW,      "MRW"},
1610     {SCSI_MMC5_MODEPAGE_WRPARAM,  "Write Parameters"},
1611     {SCSI_MMC3_MODEPAGE_MMCAP,    "MM Capabilities and Mechanical Status"},
1612     {0x3F,                        "Return All Mode Pages"},
1613     {0, NULL},
1614 };
1615
1616 #define SCSI_SPC_RESVIN_SVCA_RDKEYS 0
1617 #define SCSI_SPC_RESVIN_SVCA_RDRESV 1
1618 #define SCSI_SPC_RESVIN_SVCA_RPTCAP 2
1619 #define SCSI_SPC_RESVIN_SVCA_FULL   3
1620
1621 static const value_string scsi_persresvin_svcaction_val[] = {
1622     {SCSI_SPC_RESVIN_SVCA_RDKEYS, "Read Keys"},
1623     {SCSI_SPC_RESVIN_SVCA_RDRESV, "Read Reservation"},
1624     {SCSI_SPC_RESVIN_SVCA_RPTCAP, "Report Capabilities"},
1625     {SCSI_SPC_RESVIN_SVCA_FULL,   "Read Full Status"},
1626     {0, NULL},
1627 };
1628
1629 #define SCSI_PR_REGISTER 0
1630 #define SCSI_PR_RESERVE 1
1631 #define SCSI_PR_RELEASE 2
1632 #define SCSI_PR_CLEAR 3
1633 #define SCSI_PR_PREEMPT 4
1634 #define SCSI_PR_PREEM_ABORT 5
1635 #define SCSI_PR_REG_IGNORE 6
1636 #define SCSI_PR_REG_MOVE 7
1637 #define SCSI_PR_REPLACE_LOST 8
1638
1639 static const value_string scsi_persresvout_svcaction_val[] = {
1640     {SCSI_PR_REGISTER, "Register"},
1641     {SCSI_PR_RESERVE, "Reserve"},
1642     {SCSI_PR_RELEASE, "Release"},
1643     {SCSI_PR_CLEAR, "Clear"},
1644     {SCSI_PR_PREEMPT, "Preempt"},
1645     {SCSI_PR_PREEM_ABORT, "Preempt & Abort"},
1646     {SCSI_PR_REG_IGNORE, "Register & Ignore Existing Key"},
1647     {SCSI_PR_REG_MOVE, "Register & Move"},
1648     {SCSI_PR_REPLACE_LOST, "Replace Lost Reservation"},
1649     {0, NULL},
1650 };
1651
1652 static const value_string scsi_persresv_scope_val[] = {
1653     {0, "LU Scope"},
1654     {1, "Obsolete"},
1655     {2, "Element Scope"},
1656     {0, NULL},
1657 };
1658
1659 static const value_string scsi_persresv_type_val[] = {
1660     {1, "Write Excl"},
1661     {3, "Excl Access"},
1662     {5, "Write Excl, Registrants Only"},
1663     {6, "Excl Access, Registrants Only"},
1664     {7, "Write Excl, All Registrants"},
1665     {8, "Excl Access, All Registrants"},
1666     {0, NULL},
1667 };
1668
1669 static const value_string scsi_qualifier_val[] = {
1670     {0x0, "Device type is connected to logical unit"},
1671     {0x1, "Device type is supported by server but is not connected to logical unit"},
1672     {0x3, "Device type is not supported by server"},
1673     { 0, NULL }
1674 };
1675
1676 static const value_string scsi_devtype_val[] = {
1677     {SCSI_DEV_SBC   , "Direct Access Device"},
1678     {SCSI_DEV_SSC   , "Sequential Access Device"},
1679     {SCSI_DEV_PRNT  , "Printer"},
1680     {SCSI_DEV_PROC  , "Processor"},
1681     {SCSI_DEV_WORM  , "WORM"},
1682     {SCSI_DEV_CDROM , "CD-ROM"},
1683     {SCSI_DEV_SCAN  , "Scanner"},
1684     {SCSI_DEV_OPTMEM, "Optical Memory"},
1685     {SCSI_DEV_SMC   , "Medium Changer"},
1686     {SCSI_DEV_COMM  , "Communication"},
1687     {SCSI_DEV_RAID  , "Storage Array"},
1688     {SCSI_DEV_SES   , "Enclosure Services"},
1689     {SCSI_DEV_RBC   , "Simplified Block Device"},
1690     {SCSI_DEV_OCRW  , "Optical Card Reader/Writer"},
1691     {SCSI_DEV_OSD   , "Object-based Storage Device"},
1692     {SCSI_DEV_ADC   , "Automation/Drive Interface"},
1693     {0x1E           , "Well known logical unit"},
1694     {SCSI_DEV_NOLUN , "Unknown or no device type"},
1695     {0, NULL},
1696 };
1697
1698 static const enum_val_t scsi_devtype_options[] = {
1699     {"block",         "Block Device",                SCSI_DEV_SBC},
1700     {"sequential",    "Sequential Device",           SCSI_DEV_SSC},
1701     {"objectbased",   "Object Based Storage Device", SCSI_DEV_OSD},
1702     {"mediumchanger", "Medium Changer Device",       SCSI_DEV_SMC},
1703     {"cdrom",         "Multimedia Device",           SCSI_DEV_CDROM},
1704     {NULL, NULL, -1},
1705 };
1706
1707 static const value_string scsi_inquiry_vers_val[] = {
1708     {0x00, "No Compliance to any Standard"},
1709     {0x02, "Compliance to ANSI X3.131:1994"},
1710     {0x03, "Compliance to ANSI X3.301:1997"},
1711     {0x04, "Compliance to SPC-2"},
1712     {0x05, "Compliance to SPC-3"},
1713     {0x06, "Compliance to SPC-4"},
1714     {0x80, "Compliance to ISO/IEC 9316:1995"},
1715     {0x82, "Compliance to ISO/IEC 9316:1995 and to ANSI X3.131:1994"},
1716     {0x83, "Compliance to ISO/IEC 9316:1995 and to ANSI X3.301:1997"},
1717     {0x84, "Compliance to ISO/IEC 9316:1995 and SPC-2"},
1718     {0, NULL},
1719 };
1720
1721 static const value_string scsi_modesense_medtype_sbc_val[] = {
1722     {0x00, "Default"},
1723     {0x01, "Flexible disk, single-sided; unspecified medium"},
1724     {0x02, "Flexible disk, double-sided; unspecified medium"},
1725     {0x05, "Flexible disk, single-sided, single density; 200mm/8in diameter"},
1726     {0x06, "Flexible disk, double-sided, single density; 200mm/8in diameter"},
1727     {0x09, "Flexible disk, single-sided, double density; 200mm/8in diameter"},
1728     {0x0A, "Flexible disk, double-sided, double density; 200mm/8in diameter"},
1729     {0x0D, "Flexible disk, single-sided, single density; 130mm/5.25in diameter"},
1730     {0x12, "Flexible disk, double-sided, single density; 130mm/5.25in diameter"},
1731     {0x16, "Flexible disk, single-sided, double density; 130mm/5.25in diameter"},
1732     {0x1A, "Flexible disk, double-sided, double density; 130mm/5.25in diameter"},
1733     {0x1E, "Flexible disk, double-sided; 90mm/3.5in diameter"},
1734     {0x40, "Direct-access magnetic tape, 12 tracks"},
1735     {0x44, "Direct-access magnetic tape, 24 tracks"},
1736     {0, NULL},
1737 };
1738
1739 static const value_string scsi_verdesc_val[] = {
1740     {0x0000, "Version Descriptor Not Supported or No Standard Identified"},
1741     {0x0020, "SAM (no version claimed)"},
1742     {0x003B, "SAM T10/0994-D revision 18"},
1743     {0x003C, "SAM ANSI INCITS 270-1996"},
1744     {0x0040, "SAM-2 (no version claimed)"},
1745     {0x0054, "SAM-2 T10/1157-D revision 23"},
1746     {0x0055, "SAM-2 T10/1157-D revision 24"},
1747     {0x005C, "SAM-2 ANSI INCITS 366-2003"},
1748     {0x005E, "SAM-2 ISO/IEC 14776-412"},
1749     {0x0060, "SAM-3 (no version claimed)"},
1750     {0x0062, "SAM-3 T10/1561-D revision 7"},
1751     {0x0075, "SAM-3 T10/1561-D revision 13"},
1752     {0x0076, "SAM-3 T10/1561-D revision 14"},
1753     {0x0077, "SAM-3 ANSI INCITS 402-2005"},
1754     {0x0080, "SAM-4 (no version claimed)"},
1755     {0x0087, "SAM-4 T10/1683-D revision 13"},
1756     {0x008B, "SAM-4 T10/1683-D revision 14"},
1757     {0x0090, "SAM-4 ANSI INCITS 447-2008"},
1758     {0x0092, "SAM-4 ISO/IEC 14776-414"},
1759     {0x00A0, "SAM-5 (no version claimed)"},
1760     {0x00A2, "SAM-5 T10/2104-D revision 4"},
1761     {0x0120, "SPC (no version claimed)"},
1762     {0x013B, "SPC T10/0995-D revision 11a"},
1763     {0x013C, "SPC ANSI INCITS 301-1997"},
1764     {0x0140, "MMC (no version claimed)"},
1765     {0x015B, "MMC T10/1048-D revision 10a"},
1766     {0x015C, "MMC ANSI INCITS 304-1997"},
1767     {0x0160, "SCC (no version claimed)"},
1768     {0x017B, "SCC T10/1047-D revision 06c"},
1769     {0x017C, "SCC ANSI INCITS 276-1997"},
1770     {0x0180, "SBC (no version claimed)"},
1771     {0x019B, "SBC T10/0996-D revision 08c"},
1772     {0x019C, "SBC ANSI INCITS 306-1998"},
1773     {0x01A0, "SMC (no version claimed)"},
1774     {0x01BB, "SMC T10/0999-D revision 10a"},
1775     {0x01BC, "SMC ANSI INCITS 314-1998"},
1776     {0x01BE, "SMC ISO/IEC 14776-351"},
1777     {0x01C0, "SES (no version claimed)"},
1778     {0x01DB, "SES T10/1212-D revision 08b"},
1779     {0x01DC, "SES ANSI INCITS 305-1998"},
1780     {0x01DD, "SES T10/1212 revision 08b w/ Amendment ANSI INCITS.305/AM1-2000"},
1781     {0x01DE, "SES ANSI INCITS 305-1998 w/ Amendment ANSI INCITS.305/AM1-2000"},
1782     {0x01E0, "SCC-2 (no version claimed)"},
1783     {0x01FB, "SCC-2 T10/1125-D revision 4"},
1784     {0x01FC, "SCC-2 ANSI INCITS 318-1998"},
1785     {0x0200, "SSC (no version claimed)"},
1786     {0x0201, "SSC T10/0997-D revision 17"},
1787     {0x0207, "SSC T10/0997-D revision 22"},
1788     {0x021C, "SSC ANSI INCITS 335-2000"},
1789     {0x0220, "RBC (no version claimed)"},
1790     {0x0238, "RBC T10/1240-D revision 10a"},
1791     {0x023C, "RBC ANSI INCITS 330-2000"},
1792     {0x0240, "MMC-2 (no version claimed)"},
1793     {0x0255, "MMC-2 T10/1228-D revision 11"},
1794     {0x025B, "MMC-2 T10/1228-D revision 11a"},
1795     {0x025C, "MMC-2 ANSI INCITS 333-2000"},
1796     {0x0260, "SPC-2 (no version claimed)"},
1797     {0x0267, "SPC-2 T10/1236-D revision 12"},
1798     {0x0269, "SPC-2 T10/1236-D revision 18"},
1799     {0x0275, "SPC-2 T10/1236-D revision 19"},
1800     {0x0276, "SPC-2 T10/1236-D revision 20"},
1801     {0x0277, "SPC-2 ANSI INCITS 351-2001"},
1802     {0x0278, "SPC-2 ISO/IEC 14776-452"},
1803     {0x0280, "OCRW (no version claimed)"},
1804     {0x029E, "OCRW ISO/IEC 14776-381"},
1805     {0x02A0, "MMC-3 (no version claimed)"},
1806     {0x02B5, "MMC-3 T10/1363-D revision 9"},
1807     {0x02B6, "MMC-3 T10/1363-D revision 10g"},
1808     {0x02B8, "MMC-3 ANSI INCITS 360-2002"},
1809     {0x02E0, "SMC-2 (no version claimed)"},
1810     {0x02F5, "SMC-2 T10/1383-D revision 5"},
1811     {0x02FC, "SMC-2 T10/1383-D revision 6"},
1812     {0x02FD, "SMC-2 T10/1383-D revision 7"},
1813     {0x02FE, "SMC-2 ANSI INCITS 382-2004"},
1814     {0x0300, "SPC-3 (no version claimed)"},
1815     {0x0301, "SPC-3 T10/1416-D revision 7"},
1816     {0x0307, "SPC-3 T10/1416-D revision 21"},
1817     {0x030F, "SPC-3 T10/1416-D revision 22"},
1818     {0x0312, "SPC-3 T10/1416-D revision 23"},
1819     {0x0314, "SPC-3 ANSI INCITS 408-2005"},
1820     {0x0316, "SPC-3 ISO/IEC 14776-453"},
1821     {0x0320, "SBC-2 (no version claimed)"},
1822     {0x0322, "SBC-2 T10/1417-D revision 5a"},
1823     {0x0324, "SBC-2 T10/1417-D revision 15"},
1824     {0x033B, "SBC-2 T10/1417-D revision 16"},
1825     {0x033D, "SBC-2 ANSI INCITS 405-2005"},
1826     {0x033E, "SBC-2 ISO/IEC 14776-322"},
1827     {0x0340, "OSD (no version claimed)"},
1828     {0x0341, "OSD T10/1355-D revision 0"},
1829     {0x0342, "OSD T10/1355-D revision 7a"},
1830     {0x0343, "OSD T10/1355-D revision 8"},
1831     {0x0344, "OSD T10/1355-D revision 9"},
1832     {0x0355, "OSD T10/1355-D revision 10"},
1833     {0x0356, "OSD ANSI INCITS 400-2004"},
1834     {0x0360, "SSC-2 (no version claimed)"},
1835     {0x0374, "SSC-2 T10/1434-D revision 7"},
1836     {0x0375, "SSC-2 T10/1434-D revision 9"},
1837     {0x037D, "SSC-2 ANSI INCITS 380-2003"},
1838     {0x0380, "BCC (no version claimed)"},
1839     {0x03A0, "MMC-4 (no version claimed)"},
1840     {0x03B0, "MMC-4 T10/1545-D revision 5"},
1841     {0x03B1, "MMC-4 T10/1545-D revision 5a"},
1842     {0x03BD, "MMC-4 T10/1545-D revision 3"},
1843     {0x03BE, "MMC-4 T10/1545-D revision 3d"},
1844     {0x03BF, "MMC-4 ANSI INCITS 401-2005"},
1845     {0x03C0, "ADC (no version claimed)"},
1846     {0x03D5, "ADC T10/1558-D revision 6"},
1847     {0x03D6, "ADC T10/1558-D revision 7"},
1848     {0x03D7, "ADC ANSI INCITS 403-2005"},
1849     {0x03E0, "SES-2 (no version claimed)"},
1850     {0x03E1, "SES-2 T10/1559-D revision 16"},
1851     {0x03E7, "SES-2 T10/1559-D revision 19"},
1852     {0x03EB, "SES-2 T10/1559-D revision 20"},
1853     {0x03F0, "SES-2 ANSI INCITS 448-2008"},
1854     {0x03F2, "SES-2 ISO/IEC 14776-372"},
1855     {0x0400, "SSC-3 (no version claimed)"},
1856     {0x0403, "SSC-3 T10/1611-D revision 04a"},
1857     {0x0407, "SSC-3 T10/1611-D revision 5"},
1858     {0x0409, "SSC-3 ANSI INCITS 467-2011"},
1859     {0x0420, "MMC-5 (no version claimed)"},
1860     {0x042F, "MMC-5 T10/1675-D revision 3"},
1861     {0x0431, "MMC-5 T10/1675-D revision 03b"},
1862     {0x0432, "MMC-5 T10/1675-D revision 4"},
1863     {0x0434, "MMC-5 ANSI INCITS 430-2007"},
1864     {0x0440, "OSD-2 (no version claimed)"},
1865     {0x0444, "OSD-2 T10/1729-D revision 4"},
1866     {0x0446, "OSD-2 T10/1729-D revision 5"},
1867     {0x0448, "OSD-2 ANSI INCITS 458-2011"},
1868     {0x0460, "SPC-4 (no version claimed)"},
1869     {0x0461, "SPC-4 T10/BSR INCITS 513 revision 16"},
1870     {0x0462, "SPC-4 T10/BSR INCITS 513 revision 18"},
1871     {0x0463, "SPC-4 T10/BSR INCITS 513 revision 23"},
1872     {0x0466, "SPC-4 T10/BSR INCITS 513 revision 36"},
1873     {0x0480, "SMC-3 (no version claimed)"},
1874     {0x0482, "SMC-3 T10/1730-D revision 15"},
1875     {0x0484, "SMC-3 T10/1730-D revision 16"},
1876     {0x0486, "SMC-3 ANSI INCITS 484-2012"},
1877     {0x04A0, "ADC-2 (no version claimed)"},
1878     {0x04A7, "ADC-2 T10/1741-D revision 7"},
1879     {0x04AA, "ADC-2 T10/1741-D revision 8"},
1880     {0x04AC, "ADC-2 ANSI INCITS 441-2008"},
1881     {0x04C0, "SBC-3 (no version claimed)"},
1882     {0x04C3, "SBC-3 T10/BSR INCITS 514 revision 35"},
1883     {0x04E0, "MMC-6 (no version claimed)"},
1884     {0x04E3, "MMC-6 T10/1836-D revision 02b"},
1885     {0x04E5, "MMC-6 T10/1836-D revision 02g"},
1886     {0x04E6, "MMC-6 ANSI INCITS 468-2010"},
1887     {0x04E7, "MMC-6 ANSI INCITS 468-2010 + MMC-6/AM1 ANSI"},
1888     {0x0500, "ADC-3 (no version claimed)"},
1889     {0x0502, "ADC-3 T10/1895-D revision 4"},
1890     {0x0504, "ADC-3 T10/1895-D revision 5"},
1891     {0x0506, "ADC-3 T10/1895-D revision 05a"},
1892     {0x050A, "ADC-3 ANSI INCITS 497-2012"},
1893     {0x0520, "SSC-4 (no version claimed)"},
1894     {0x0523, "SSC-4 T10/BSR INCITS 516 revision 2"},
1895     {0x0560, "OSD-3 (no version claimed)"},
1896     {0x0580, "SES-3 (no version claimed)"},
1897     {0x05A0, "SSC-5 (no version claimed)"},
1898     {0x05C0, "SPC-5 (no version claimed)"},
1899     {0x05E0, "SFSC (no version claimed)"},
1900     {0x0600, "SBC-4 (no version claimed)"},
1901     {0x0820, "SSA-TL2 (no version claimed)"},
1902     {0x083B, "SSA-TL2 T10.1/1147-D revision 05b"},
1903     {0x083C, "SSA-TL2 ANSI INCITS 308-1998"},
1904     {0x0840, "SSA-TL1 (no version claimed)"},
1905     {0x085B, "SSA-TL1 T10.1/0989-D revision 10b"},
1906     {0x085C, "SSA-TL1 ANSI INCITS 295-1996"},
1907     {0x0860, "SSA-S3P (no version claimed)"},
1908     {0x087B, "SSA-S3P T10.1/1051-D revision 05b"},
1909     {0x087C, "SSA-S3P ANSI INCITS 309-1998"},
1910     {0x0880, "SSA-S2P (no version claimed)"},
1911     {0x089B, "SSA-S2P T10.1/1121-D revision 07b"},
1912     {0x089C, "SSA-S2P ANSI INCITS 294-1996"},
1913     {0x08A0, "SIP (no version claimed)"},
1914     {0x08BB, "SIP T10/0856-D revision 10"},
1915     {0x08BC, "SIP ANSI INCITS 292-1997"},
1916     {0x08C0, "FCP (no version claimed)"},
1917     {0x08DB, "FCP T10/0993-D revision 12"},
1918     {0x08DC, "FCP ANSI INCITS 269-1996"},
1919     {0x08E0, "SBP-2 (no version claimed)"},
1920     {0x08FB, "SBP-2 T10/1155-D revision 4"},
1921     {0x08FC, "SBP-2 ANSI INCITS 325-1998"},
1922     {0x0900, "FCP-2 (no version claimed)"},
1923     {0x0901, "FCP-2 T10/1144-D revision 4"},
1924     {0x0915, "FCP-2 T10/1144-D revision 7"},
1925     {0x0916, "FCP-2 T10/1144-D revision 7a"},
1926     {0x0917, "FCP-2 ANSI INCITS 350-2003"},
1927     {0x0918, "FCP-2 T10/1144-D revision 8"},
1928     {0x0920, "SST (no version claimed)"},
1929     {0x0935, "SST T10/1380-D revision 8b"},
1930     {0x0940, "SRP (no version claimed)"},
1931     {0x0954, "SRP T10/1415-D revision 10"},
1932     {0x0955, "SRP T10/1415-D revision 16a"},
1933     {0x095C, "SRP ANSI INCITS 365-2002"},
1934     {0x0960, "iSCSI (no version claimed)"},
1935     {0x0980, "SBP-3 (no version claimed)"},
1936     {0x0982, "SBP-3 T10/1467-D revision 1f"},
1937     {0x0994, "SBP-3 T10/1467-D revision 3"},
1938     {0x099A, "SBP-3 T10/1467-D revision 4"},
1939     {0x099B, "SBP-3 T10/1467-D revision 5"},
1940     {0x099C, "SBP-3 ANSI INCITS 375-2004"},
1941     {0x09C0, "ADP (no version claimed)"},
1942     {0x09E0, "ADT (no version claimed)"},
1943     {0x09F9, "ADT T10/1557-D revision 11"},
1944     {0x09FA, "ADT T10/1557-D revision 14"},
1945     {0x09FD, "ADT ANSI INCITS 406-2005"},
1946     {0x0A00, "FCP-3 (no version claimed)"},
1947     {0x0A07, "FCP-3 T10/1560-D revision 3f"},
1948     {0x0A0F, "FCP-3 T10/1560-D revision 4"},
1949     {0x0A11, "FCP-3 ANSI INCITS 416-2006"},
1950     {0x0A1C, "FCP-3 ISO/IEC 14776-223"},
1951     {0x0A20, "ADT-2 (no version claimed)"},
1952     {0x0A22, "ADT-2 T10/1742-D revision 6"},
1953     {0x0A27, "ADT-2 T10/1742-D revision 8"},
1954     {0x0A28, "ADT-2 T10/1742-D revision 9"},
1955     {0x0A2B, "ADT-2 ANSI INCITS 472-2011"},
1956     {0x0A40, "FCP-4 (no version claimed)"},
1957     {0x0A42, "FCP-4 T10/1828-D revision 1"},
1958     {0x0A44, "FCP-4 T10/1828-D revision 2"},
1959     {0x0A45, "FCP-4 T10/1828-D revision 02b"},
1960     {0x0A46, "FCP-4 ANSI INCITS 481-2012"},
1961     {0x0AA0, "SPI (no version claimed)"},
1962     {0x0AB9, "SPI T10/0855-D revision 15a"},
1963     {0x0ABA, "SPI ANSI INCITS 253-1995"},
1964     {0x0ABB, "SPI T10/0855-D revision 15a with SPI Amnd revision 3a"},
1965     {0x0ABC, "SPI ANSI INCITS 253-1995 with SPI Amnd ANSI INCITS 253/AM1-1998"},
1966     {0x0AC0, "Fast-20 (no version claimed)"},
1967     {0x0ADB, "Fast-20 T10/1071 revision 6"},
1968     {0x0ADC, "Fast-20 ANSI INCITS 277-1996"},
1969     {0x0AE0, "SPI-2 (no version claimed)"},
1970     {0x0AFB, "SPI-2 T10/1142-D revision 20b"},
1971     {0x0AFC, "SPI-2 ANSI INCITS 302-1999"},
1972     {0x0B00, "SPI-3 (no version claimed)"},
1973     {0x0B18, "SPI-3 T10/1302-D revision 10"},
1974     {0x0B19, "SPI-3 T10/1302-D revision 13a"},
1975     {0x0B1A, "SPI-3 T10/1302-D revision 14"},
1976     {0x0B1C, "SPI-3 ANSI INCITS 336-2000"},
1977     {0x0B20, "EPI (no version claimed)"},
1978     {0x0B3B, "EPI T10/1134 revision 16"},
1979     {0x0B3C, "EPI ANSI INCITS TR-23 1999"},
1980     {0x0B40, "SPI-4 (no version claimed)"},
1981     {0x0B54, "SPI-4 T10/1365-D revision 7"},
1982     {0x0B55, "SPI-4 T10/1365-D revision 9"},
1983     {0x0B56, "SPI-4 ANSI INCITS 362-2002"},
1984     {0x0B59, "SPI-4 T10/1365-D revision 10"},
1985     {0x0B60, "SPI-5 (no version claimed)"},
1986     {0x0B79, "SPI-5 T10/1525-D revision 3"},
1987     {0x0B7A, "SPI-5 T10/1525-D revision 5"},
1988     {0x0B7B, "SPI-5 T10/1525-D revision 6"},
1989     {0x0B7C, "SPI-5 ANSI INCITS 367-2003"},
1990     {0x0BE0, "SAS (no version claimed)"},
1991     {0x0BE1, "SAS T10/1562-D revision 1"},
1992     {0x0BF5, "SAS T10/1562-D revision 3"},
1993     {0x0BFA, "SAS T10/1562-D revision 4"},
1994     {0x0BFB, "SAS T10/1562-D revision 4"},
1995     {0x0BFC, "SAS T10/1562-D revision 5"},
1996     {0x0BFD, "SAS ANSI INCITS 376-2003"},
1997     {0x0C00, "SAS-1.1 (no version claimed)"},
1998     {0x0C07, "SAS-1.1 T10/1601-D revision 9"},
1999     {0x0C0F, "SAS-1.1 T10/1601-D revision 10"},
2000     {0x0C11, "SAS-1.1 ANSI INCITS 417-2006"},
2001     {0x0C12, "SAS-1.1 ISO/IEC 14776-151"},
2002     {0x0C20, "SAS-2 (no version claimed)"},
2003     {0x0C23, "SAS-2 T10/1760-D revision 14"},
2004     {0x0C27, "SAS-2 T10/1760-D revision 15"},
2005     {0x0C28, "SAS-2 T10/1760-D revision 16"},
2006     {0x0C2A, "SAS-2 ANSI INCITS 457-2010"},
2007     {0x0C40, "SAS-2.1 (no version claimed)"},
2008     {0x0C48, "SAS-2.1 T10/2125-D revision 4"},
2009     {0x0C4A, "SAS-2.1 T10/2125-D revision 6"},
2010     {0x0C4B, "SAS-2.1 T10/2125-D revision 7"},
2011     {0x0C4E, "SAS-2.1 ANSI INCITS 478-2011"},
2012     {0x0C60, "SAS-3 (no version claimed)"},
2013     {0x0C63, "SAS-3 T10/BSR INCITS 519 revision 05a"},
2014     {0x0D20, "FC-PH (no version claimed)"},
2015     {0x0D3B, "FC-PH ANSI INCITS 230-1994"},
2016     {0x0D3C, "FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS 230/AM1-1996"},
2017     {0x0D40, "FC-AL (no version claimed)"},
2018     {0x0D5C, "FC-AL ANSI INCITS 272-1996"},
2019     {0x0D60, "FC-AL-2 (no version claimed)"},
2020     {0x0D61, "FC-AL-2 T11/1133-D revision 7.0"},
2021     {0x0D63, "FC-AL-2 ANSI INCITS 332-1999 with AM1-2003 & AM2-2006"},
2022     {0x0D64, "FC-AL-2 ANSI INCITS 332-1999 with Amnd 2 AM2-2006"},
2023     {0x0D65, "FC-AL-2 ISO/IEC 14165-122 with AM1 & AM2"},
2024     {0x0D7C, "FC-AL-2 ANSI INCITS 332-1999"},
2025     {0x0D7D, "FC-AL-2 ANSI INCITS 332-1999 with Amnd 1 AM1-2003"},
2026     {0x0D80, "FC-PH-3 (no version claimed)"},
2027     {0x0D9C, "FC-PH-3 ANSI INCITS 303-1998"},
2028     {0x0DA0, "FC-FS (no version claimed)"},
2029     {0x0DB7, "FC-FS T11/1331-D revision 1.2"},
2030     {0x0DB8, "FC-FS T11/1331-D revision 1.7"},
2031     {0x0DBC, "FC-FS ANSI INCITS 373-2003"},
2032     {0x0DBD, "FC-FS ISO/IEC 14165-251"},
2033     {0x0DC0, "FC-PI (no version claimed)"},
2034     {0x0DDC, "FC-PI ANSI INCITS 352-2002"},
2035     {0x0DE0, "FC-PI-2 (no version claimed)"},
2036     {0x0DE2, "FC-PI-2 T11/1506-D revision 5.0"},
2037     {0x0DE4, "FC-PI-2 ANSI INCITS 404-2006"},
2038     {0x0E00, "FC-FS-2 (no version claimed)"},
2039     {0x0E02, "FC-FS-2 ANSI INCITS 242-2007"},
2040     {0x0E03, "FC-FS-2 ANSI INCITS 242-2007 with AM1 ANSI INCITS 242/AM1-2007"},
2041     {0x0E20, "FC-LS (no version claimed)"},
2042     {0x0E21, "FC-LS T11/1620-D revision 1.62"},
2043     {0x0E29, "FC-LS ANSI INCITS 433-2007"},
2044     {0x0E40, "FC-SP (no version claimed)"},
2045     {0x0E42, "FC-SP T11/1570-D revision 1.6"},
2046     {0x0E45, "FC-SP ANSI INCITS 426-2007"},
2047     {0x0E60, "FC-PI-3 (no version claimed)"},
2048     {0x0E62, "FC-PI-3 T11/1625-D revision 2.0"},
2049     {0x0E68, "FC-PI-3 T11/1625-D revision 2.1"},
2050     {0x0E6A, "FC-PI-3 T11/1625-D revision 4.0"},
2051     {0x0E6E, "FC-PI-3 ANSI INCITS 460-2011"},
2052     {0x0E80, "FC-PI-4 (no version claimed)"},
2053     {0x0E82, "FC-PI-4 T11/1647-D revision 8.0"},
2054     {0x0E88, "FC-PI-4 ANSI INCITS 450-2009"},
2055     {0x0EA0, "FC 10GFC (no version claimed)"},
2056     {0x0EA2, "FC 10GFC ANSI INCITS 364-2003"},
2057     {0x0EA3, "FC 10GFC ISO/IEC 14165-116"},
2058     {0x0EA5, "FC 10GFC ISO/IEC 14165-116 with AM1"},
2059     {0x0EA6, "FC 10GFC ANSI INCITS 364-2003 with AM1 ANSI INCITS 364/AM1-2007"},
2060     {0x0EC0, "FC-SP-2 (no version claimed)"},
2061     {0x0EE0, "FC-FS-3 (no version claimed)"},
2062     {0x0EE2, "FC-FS-3 T11/1861-D revision 0.9"},
2063     {0x0EE7, "FC-FS-3 T11/1861-D revision 1.0"},
2064     {0x0EE9, "FC-FS-3 T11/1861-D revision 1.10"},
2065     {0x0EEB, "FC-FS-3 ANSI INCITS 470-2011"},
2066     {0x0F00, "FC-LS-2 (no version claimed)"},
2067     {0x0F03, "FC-LS-2 T11/2103-D revision 2.11"},
2068     {0x0F05, "FC-LS-2 T11/2103-D revision 2.21"},
2069     {0x0F07, "FC-LS-2 ANSI INCITS 477-2011"},
2070     {0x0F20, "FC-PI-5 (no version claimed)"},
2071     {0x0F27, "FC-PI-5 T11/2118-D revision 2.00"},
2072     {0x0F28, "FC-PI-5 T11/2118-D revision 3.00"},
2073     {0x0F2A, "FC-PI-5 T11/2118-D revision 6.00"},
2074     {0x0F2B, "FC-PI-5 T11/2118-D revision 6.10"},
2075     {0x0F2E, "FC-PI-5 ANSI INCITS 479-2011"},
2076     {0x0F40, "FC-PI-6 (no version claimed)"},
2077     {0x0F60, "FC-FS-4 (no version claimed)"},
2078     {0x0F80, "FC-LS-3 (no version claimed)"},
2079     {0x12A0, "FC-SCM (no version claimed)"},
2080     {0x12A3, "FC-SCM T11/1824DT revision 1.0"},
2081     {0x12A5, "FC-SCM T11/1824DT revision 1.1"},
2082     {0x12A7, "FC-SCM T11/1824DT revision 1.4"},
2083     {0x12AA, "FC-SCM INCITS TR-47 2012"},
2084     {0x12C0, "FC-DA-2 (no version claimed)"},
2085     {0x12C3, "FC-DA-2 T11/1870DT revision 1.04"},
2086     {0x12C5, "FC-DA-2 T11/1870DT revision 1.06"},
2087     {0x12C9, "FC-DA-2 INCITS TR-49 2012"},
2088     {0x12E0, "FC-DA (no version claimed)"},
2089     {0x12E2, "FC-DA T11/1513-DT revision 3.1"},
2090     {0x12E8, "FC-DA ANSI INCITS TR-36 2004"},
2091     {0x12E9, "FC-DA ISO/IEC 14165-341"},
2092     {0x1300, "FC-Tape (no version claimed)"},
2093     {0x1301, "FC-Tape T11/1315 revision 1.16"},
2094     {0x131B, "FC-Tape T11/1315 revision 1.17"},
2095     {0x131C, "FC-Tape ANSI INCITS TR-24 1999"},
2096     {0x1320, "FC-FLA (no version claimed)"},
2097     {0x133B, "FC-FLA T11/1235 revision 7"},
2098     {0x133C, "FC-FLA ANSI INCITS TR-20 1998"},
2099     {0x1340, "FC-PLDA (no version claimed)"},
2100     {0x135B, "FC-PLDA T11/1162 revision 2.1"},
2101     {0x135C, "FC-PLDA ANSI INCITS TR-19 1998"},
2102     {0x1360, "SSA-PH2 (no version claimed)"},
2103     {0x137B, "SSA-PH2 T10.1/1145-D revision 09c"},
2104     {0x137C, "SSA-PH2 ANSI INCITS 293-1996"},
2105     {0x1380, "SSA-PH3 (no version claimed)"},
2106     {0x139B, "SSA-PH3 T10.1/1146-D revision 05b"},
2107     {0x139C, "SSA-PH3 ANSI INCITS 307-1998"},
2108     {0x14A0, "IEEE 1394 (no version claimed)"},
2109     {0x14BD, "ANSI IEEE 1394-1995"},
2110     {0x14C0, "IEEE 1394a (no version claimed)"},
2111     {0x14E0, "IEEE 1394b (no version claimed)"},
2112     {0x15E0, "ATA/ATAPI-6 (no version claimed)"},
2113     {0x15FD, "ATA/ATAPI-6 ANSI INCITS 361-2002"},
2114     {0x1600, "ATA/ATAPI-7 (no version claimed)"},
2115     {0x1602, "ATA/ATAPI-7 T13/1532-D revision 3"},
2116     {0x161C, "ATA/ATAPI-7 ANSI INCITS 397-2005"},
2117     {0x161E, "ATA/ATAPI-7 ISO/IEC 24739"},
2118     {0x1620, "ATA/ATAPI-8 ATA8-AAM (no version claimed)"},
2119     {0x1621, "ATA/ATAPI-8 ATA8-APT Parallel Transport (no version claimed)"},
2120     {0x1622, "ATA/ATAPI-8 ATA8-AST Serial Transport (no version claimed)"},
2121     {0x1623, "ATA/ATAPI-8 ATA8-ACS ATA/ATAPI Command Set (no version claimed)"},
2122     {0x1628, "ATA/ATAPI-8 ATA8-AAM ANSI INCITS 451-2008"},
2123     {0x162A, "ATA/ATAPI-8 ATA8-ACS ANSI INCITS 452-2009 w/Amendment 1"},
2124     {0x1728, "Universal Serial Bus Specification, Revision 1.1"},
2125     {0x1729, "Universal Serial Bus Specification, Revision 2.0"},
2126     {0x1730, "USB Mass Storage Class Bulk-Only Transport, Revision 1.0"},
2127     {0x1740, "UAS (no version claimed)"},
2128     {0x1743, "UAS T10/2095-D revision 2"},
2129     {0x1747, "UAS T10/2095-D revision 4"},
2130     {0x1748, "UAS ANSI INCITS 471-2010"},
2131     {0x1761, "ACS-2 (no version claimed)"},
2132     {0x1762, "ACS-2 ANSI INCITS 482-2013"},
2133     {0x1765, "ACS-3 (no version claimed)"},
2134     {0x1780, "UAS-2 (no version claimed)"},
2135     {0x1EA0, "SAT (no version claimed)"},
2136     {0x1EA7, "SAT T10/1711-D revision 8"},
2137     {0x1EAB, "SAT T10/1711-D revision 9"},
2138     {0x1EAD, "SAT ANSI INCITS 431-2007"},
2139     {0x1EC0, "SAT-2 (no version claimed)"},
2140     {0x1EC4, "SAT-2 T10/1826-D revision 6"},
2141     {0x1EC8, "SAT-2 T10/1826-D revision 9"},
2142     {0x1ECA, "SAT-2 ANSI INCITS 465-2010"},
2143     {0x1EE0, "SAT-3 (no version claimed)"},
2144     {0x1EE2, "SAT-3 T10/BSR INCITS 517 revision 4"},
2145     {0x1F00, "SAT-4 (no version claimed)"},
2146     {0x20A0, "SPL (no version claimed)"},
2147     {0x20A3, "SPL T10/2124-D revision 6a"},
2148     {0x20A5, "SPL T10/2124-D revision 7"},
2149     {0x20A7, "SPL ANSI INCITS 476-2011"},
2150     {0x20A8, "SPL ANSI INCITS 476-2011 + SPL AM1 INCITS 476/AM1 2012"},
2151     {0x20C0, "SPL-2 (no version claimed)"},
2152     {0x20C2, "SPL-2 T10/BSR INCITS 505 revision 4"},
2153     {0x20C4, "SPL-2 T10/BSR INCITS 505 revision 5"},
2154     {0x20E0, "SPL-3 (no version claimed)"},
2155     {0x21E0, "SOP (no version claimed)"},
2156     {0x21E4, "SOP T10/BSR INCITS 489 revision 4"},
2157     {0x2200, "PQI (no version claimed)"},
2158     {0x2204, "PQI T10/BSR INCITS 490 revision 6"},
2159     {0x2220, "SOP-2 (no version claimed)"},
2160     {0x2240, "PQI-2 (no version claimed)"},
2161     {0xFFC0, "IEEE 1667 (no version claimed)"},
2162     {0xFFC1, "IEEE 1667-2006"},
2163     {0xFFC2, "IEEE 1667-2009"},
2164     {0, NULL},
2165 };
2166
2167 static value_string_ext scsi_verdesc_val_ext = VALUE_STRING_EXT_INIT(scsi_verdesc_val);
2168
2169 /* Command Support Data "Support" field definitions */
2170 static const value_string scsi_cmdt_supp_val[] = {
2171     {0, "Data not currently available"},
2172     {1, "SCSI Command not supported"},
2173     {2, "Reserved"},
2174     {3, "SCSI Command supported in conformance with a SCSI standard"},
2175     {4, "Vendor Specific"},
2176     {5, "SCSI Command supported in a vendor specific manner"},
2177     {6, "Vendor Specific"},
2178     {7, "Reserved"},
2179     {0, NULL},
2180 };
2181
2182 #define CODESET_BINARY  1
2183 #define CODESET_ASCII   2
2184 #define CODESET_UTF8    3
2185
2186 const value_string scsi_devid_codeset_val[] = {
2187     {0,              "Reserved"},
2188     {CODESET_BINARY, "Identifier field contains binary values"},
2189     {CODESET_ASCII,  "Identifier field contains ASCII graphic codes"},
2190     {CODESET_UTF8,   "Identifier field contains UTF-8 codes"},
2191     {0,              NULL},
2192 };
2193
2194 static const value_string scsi_devid_assoc_val[] = {
2195     {0, "Identifier is associated with addressed logical/physical device"},
2196     {1, "Identifier is associated with the port that received the request"},
2197     {2, "Identifier is associated with the SCSI target devices that contains the logical/physical device"},
2198     {0, NULL},
2199 };
2200
2201 #define DEVID_TYPE_VEND_ID_VEND_SPEC_ID 1
2202 #define DEVID_TYPE_NAA                  3
2203
2204 const value_string scsi_devid_idtype_val[] = {
2205     {0, "Vendor-specific ID (non-globally unique)"},
2206     {DEVID_TYPE_VEND_ID_VEND_SPEC_ID, "Vendor-ID + vendor-specific ID (globally unique)"},
2207     {2, "EUI-64 ID"},
2208     {DEVID_TYPE_NAA, "NAA"},
2209     {4, "4-byte Binary Number/Reserved"},
2210     {0, NULL},
2211 };
2212
2213 static const value_string scsi_modesns_mrie_val[] = {
2214     {0, "No Reporting of Informational Exception Condition"},
2215     {1, "Asynchronous Error Reporting"},
2216     {2, "Generate Unit Attention"},
2217     {3, "Conditionally Generate Recovered Error"},
2218     {4, "Unconditionally Generate Recovered Error"},
2219     {5, "Generate No Sense"},
2220     {6, "Only Report Informational Exception Condition on Request"},
2221     {0, NULL},
2222 };
2223
2224 static const value_string scsi_modesns_tst_val[] = {
2225     {0, "Task Set Per LU For All Initiators"},
2226     {1, "Task Set Per Initiator Per LU"},
2227     {0, NULL},
2228 };
2229
2230 static const value_string scsi_modesns_qmod_val[] = {
2231     {0, "Restricted reordering"},
2232     {1, "Unrestricted reordering"},
2233     {0, NULL},
2234 };
2235
2236 static const true_false_string scsi_modesns_qerr_val = {
2237     "All blocked tasks shall be aborted on CHECK CONDITION",
2238     "Blocked tasks shall resume after ACA/CA is cleared",
2239 };
2240
2241 static const true_false_string scsi_spec_i_pt_tfs = {
2242     "Specify Initiator Ports is set",
2243     "Specify Initiator Ports is not set"
2244 };
2245
2246 static const true_false_string scsi_all_tg_pt_tfs = {
2247     "All Target Ports is set",
2248     "All Target Ports is not set"
2249 };
2250
2251 static const true_false_string scsi_aptpl_tfs = {
2252     "Active Persist Through Power Loss is set",
2253     "Active Persist Through Power Loss is not set"
2254 };
2255
2256 static const true_false_string scsi_naca_tfs = {
2257     "Normal ACA is set",
2258     "Normal ACA is not set"
2259 };
2260
2261 static const true_false_string normaca_tfs = {
2262     "NormACA is SUPPORTED",
2263     "Normaca is NOT supported",
2264 };
2265
2266 static const true_false_string sccs_tfs = {
2267     "SCC is SUPPORTED",
2268     "Scc is NOT supported",
2269 };
2270
2271 static const true_false_string acc_tfs = {
2272     "Access Control Coordinator is SUPPORTED",
2273     "Access control coordinator NOT supported",
2274 };
2275
2276 static const true_false_string bque_tfs = {
2277     "BQUE is SUPPORTED",
2278     "Bque is NOT supported",
2279 };
2280
2281 static const true_false_string encserv_tfs = {
2282     "Enclosed Services is SUPPORTED",
2283     "Enclosed services is NOT supported",
2284 };
2285
2286 static const true_false_string reladr_tfs = {
2287     "Relative Addressing mode is SUPPORTED",
2288     "Relative addressing mode is NOT supported",
2289 };
2290
2291 #if 0
2292 static const true_false_string sync_tfs = {
2293     "Synchronous data transfer is SUPPORTED",
2294     "Synchronous data transfer is NOT supported",
2295 };
2296 #endif
2297
2298 static const true_false_string linked_tfs = {
2299     "Linked Commands are SUPPORTED",
2300     "Linked commands are NOT supported",
2301 };
2302
2303 static const true_false_string cmdque_tfs = {
2304     "Command queuing is SUPPORTED",
2305     "Command queuing is NOT supported",
2306 };
2307
2308 static const true_false_string multip_tfs = {
2309     "This is a MULTIPORT device",
2310     "This is NOT a multiport device",
2311 };
2312
2313 static const true_false_string mchngr_tfs = {
2314     "This device is attached to a MEDIUMCHANGER",
2315     "This is a normal device",
2316 };
2317
2318 static const true_false_string tpc_tfs = {
2319     "Third Party Copy is SUPPORTED",
2320     "Third party copy is NOT supported",
2321 };
2322
2323 static const true_false_string protect_tfs = {
2324     "Protection Information is SUPPORTED",
2325     "Protection information NOT supported",
2326 };
2327
2328 static const true_false_string hisup_tfs = {
2329     "Hierarchical Addressing Mode is SUPPORTED",
2330     "Hierarchical addressing mode is NOT supported",
2331 };
2332
2333 static const true_false_string aerc_tfs = {
2334     "Async Event Reporting Capability is SUPPORTED",
2335     "Async event reporting capability is NOT supported",
2336 };
2337
2338 static const true_false_string trmtsk_tfs = {
2339     "Terminate Task management functions are SUPPORTED",
2340     "Terminate task management functions are NOT supported",
2341 };
2342
2343 static const true_false_string scsi_removable_val = {
2344     "This is a REMOVABLE device",
2345     "This device is NOT removable",
2346 };
2347
2348 static const true_false_string scsi_modesns_tas_val = {
2349     "Terminated tasks aborted without informing initiators",
2350     "Tasks aborted by another initiator terminated with TASK ABORTED",
2351 };
2352
2353 static const true_false_string scsi_modesns_rac_val = {
2354     "Report a CHECK CONDITION Instead of Long Busy Condition",
2355     "Long Busy Conditions Maybe Reported",
2356 };
2357
2358 /* SCSI Transport Protocols */
2359 #define SCSI_PROTO_FCP          0
2360 #define SCSI_PROTO_iSCSI        5
2361
2362 static const value_string scsi_proto_val[] = {
2363     {0, "FCP"},
2364     {5, "iSCSI"},
2365     {0, NULL},
2366 };
2367
2368 static const value_string scsi_fcp_rrtov_val[] = {
2369     {0, "No Timer Specified"},
2370     {1, "0.001 secs"},
2371     {3, "0.1 secs"},
2372     {5, "10 secs"},
2373     {0, NULL},
2374 };
2375
2376 static const value_string scsi_sensekey_val[] = {
2377     {0x0, "No Sense"},
2378     {0x1, "Recovered Error"},
2379     {0x2, "Not Ready"},
2380     {0x3, "Medium Error"},
2381     {0x4, "Hardware Error"},
2382     {0x5, "Illegal Request"},
2383     {0x6, "Unit Attention"},
2384     {0x7, "Data Protection"},
2385     {0x8, "Blank Check"},
2386     {0x9, "Vendor Specific"},
2387     {0xA, "Copy Aborted"},
2388     {0xB, "Command Aborted"},
2389     {0xC, "Obsolete Error Code"},
2390     {0xD, "Overflow Command"},
2391     {0xE, "Miscompare"},
2392     {0xF, "Reserved"},
2393     {0, NULL},
2394 };
2395
2396 static const value_string scsi_sense_desc_type_val[] = {
2397     {0x00, "Information"},
2398     {0x01, "Command specific information"},
2399     {0x02, "Sense key specific"},
2400     {0x03, "Field replaceable unit"},
2401     {0x04, "Stream commands"},
2402     {0x05, "Block commands"},
2403     {0x06, "OSD object identification"},
2404     {0x07, "OSD response integrity check value"},
2405     {0x08, "OSD attribute identification"},
2406     {0x09, "ATA Status"},
2407     {0x0A, "Another progress indication"},
2408     {0x0B, "User data segment referral"},
2409     {0x0C, "Forwarded sense data"},
2410     {0, NULL},
2411 };
2412
2413 static const value_string scsi_sense_sks_fp_cd_val[] = {
2414     {0, "illegal parameter in the Data-Out buffer"},
2415     {1, "illegal parameter in the CDB"},
2416     {0, NULL},
2417 };
2418
2419 static const value_string scsi_sns_errtype_val[] = {
2420     {0x70, "Current Error"},
2421     {0x71, "Deferred Error"},
2422     {0x72, "Current Error"},
2423     {0x73, "Deferred Error"},
2424     {0x7F, "Vendor Specific"},
2425     {0, NULL},
2426 };
2427
2428 /* All can be found @ http://www.t10.org/lists/asc-alph.txt or http://www.t10.org/lists/asc-num.txt */
2429 static const value_string scsi_asc_val[] = {
2430     {0x0000,  "No Additional Sense Information"},
2431     {0x0001,  "Filemark Detected"},
2432     {0x0002,  "End Of Partition/Medium Detected"},
2433     {0x0003,  "Setmark Detected"},
2434     {0x0004,  "Beginning Of Partition Detected"},
2435     {0x0005,  "End Of Data Detected"},
2436     {0x0006,  "I/O Process Terminated"},
2437     {0x0016,  "Operation In Progress"},
2438     {0x0017,  "Cleaning Requested"},
2439     {0x0018,  "Erase Operation In Progress"},
2440     {0x0019,  "Locate Operation In Progress"},
2441     {0x001A,  "Rewind Operation In Progress"},
2442     {0x001B,  "Set Capacity Operation In Progress"},
2443     {0x001C,  "Verify operation in progress"},
2444     {0x0100,  "No Index/Sector Signal"},
2445     {0x0200,  "No Seek Complete"},
2446     {0x0300,  "Peripheral Device Write Fault"},
2447     {0x0400,  "Logical Unit Not Ready, Cause Not Reportable"},
2448     {0x0401,  "Logical Unit Is In Process Of Becoming Ready"},
2449     {0x0402,  "Logical Unit Not Ready, Initializing Cmd. Required"},
2450     {0x0403,  "Logical Unit Not Ready, Manual Intervention Required"},
2451     {0x0404,  "Logical Unit Not Ready, Format In Progress"},
2452     {0x0405,  "Logical Unit Not Ready, Rebuild In Progress"},
2453     {0x0406,  "Logical Unit Not Ready, Recalculation In Progress"},
2454     {0x0407,  "Logical Unit Not Ready, Operation In Progress"},
2455     {0x0409,  "Logical Unit Not Ready, Self-Test In Progress"},
2456     {0x0500,  "Logical Unit Does Not Respond To Selection"},
2457     {0x0600,  "No Reference Position Found"},
2458     {0x0700,  "Multiple Peripheral Devices Selected"},
2459     {0x0800,  "Logical Unit Communication Failure"},
2460     {0x0801,  "Logical Unit Communication Time-Out"},
2461     {0x0802,  "Logical Unit Communication Parity Error"},
2462     {0x0803,  "Logical Unit Communication Crc Error (Ultra-Dma/32)"},
2463     {0x0804,  "Unreachable Copy Target"},
2464     {0x0900,  "Track Following Error"},
2465     {0x0904,  "Head Select Fault"},
2466     {0x0A00,  "Error Log Overflow"},
2467     {0x0B00,  "Warning"},
2468     {0x0B01,  "Warning - Specified Temperature Exceeded"},
2469     {0x0B02,  "Warning - Enclosure Degraded"},
2470     {0x0C02,  "Write Error - Auto Reallocation Failed"},
2471     {0x0C03,  "Write Error - Recommend Reassignment"},
2472     {0x0C04,  "Compression Check Miscompare Error"},
2473     {0x0C05,  "Data Expansion Occurred During Compression"},
2474     {0x0C06,  "Block Not Compressible"},
2475     {0x0D00,  "Error Detected By Third Party Temporary Initiator"},
2476     {0x0D01,  "Third Party Device Failure"},
2477     {0x0D02,  "Copy Target Device Not Reachable"},
2478     {0x0D03,  "Incorrect Copy Target Device Type"},
2479     {0x0D04,  "Copy Target Device Data Underrun"},
2480     {0x0D05,  "Copy Target Device Data Overrun"},
2481     {0x1000,  "Id Crc Or Ecc Error"},
2482     {0x1100,  "Unrecovered Read Error"},
2483     {0x1101,  "Read Retries Exhausted"},
2484     {0x1102,  "Error Too Long To Correct"},
2485     {0x1103,  "Multiple Read Errors"},
2486     {0x1104,  "Unrecovered Read Error - Auto Reallocate Failed"},
2487     {0x110A,  "Miscorrected Error"},
2488     {0x110B,  "Unrecovered Read Error - Recommend Reassignment"},
2489     {0x110C,  "Unrecovered Read Error - Recommend Rewrite The Data"},
2490     {0x110D,  "De-Compression Crc Error"},
2491     {0x110E,  "Cannot Decompress Using Declared Algorithm"},
2492     {0x1200,  "Address Mark Not Found For Id Field"},
2493     {0x1300,  "Address Mark Not Found For Data Field"},
2494     {0x1400,  "Recorded Entity Not Found"},
2495     {0x1401,  "Record Not Found"},
2496     {0x1405,  "Record Not Found - Recommend Reassignment"},
2497     {0x1406,  "Record Not Found - Data Auto-Reallocated"},
2498     {0x1500,  "Random Positioning Error"},
2499     {0x1501,  "Mechanical Positioning Error"},
2500     {0x1502,  "Positioning Error Detected By Read Of Medium"},
2501     {0x1600,  "Data Synchronization Mark Error"},
2502     {0x1601,  "Data Sync Error - Data Rewritten"},
2503     {0x1602,  "Data Sync Error - Recommend Rewrite"},
2504     {0x1603,  "Data Sync Error - Data Auto-Reallocated"},
2505     {0x1604,  "Data Sync Error - Recommend Reassignment"},
2506     {0x1700,  "Recovered Data With No Error Correction Applied"},
2507     {0x1701,  "Recovered Data With Retries"},
2508     {0x1702,  "Recovered Data With Positive Head Offset"},
2509     {0x1703,  "Recovered Data With Negative Head Offset"},
2510     {0x1705,  "Recovered Data Using Previous Sector Id"},
2511     {0x1706,  "Recovered Data Without Ecc - Data Auto-Reallocated"},
2512     {0x1707,  "Recovered Data Without Ecc - Recommend Reassignment"},
2513     {0x1708,  "Recovered Data Without Ecc - Recommend Rewrite"},
2514     {0x1709,  "Recovered Data Without Ecc - Data Rewritten"},
2515     {0x1800,  "Recovered Data With Error Correction Applied"},
2516     {0x1801,  "Recovered Data With Error Corr. & Retries Applied"},
2517     {0x1802,  "Recovered Data - Data Auto-Reallocated"},
2518     {0x1805,  "Recovered Data - Recommend Reassignment"},
2519     {0x1806,  "Recovered Data - Recommend Rewrite"},
2520     {0x1807,  "Recovered Data With Ecc - Data Rewritten"},
2521     {0x1900,  "List Error"},
2522     {0x1901,  "List Not Available"},
2523     {0x1902,  "List Error In Primary List"},
2524     {0x1903,  "List Error In Grown List"},
2525     {0x1A00,  "Parameter List Length Error"},
2526     {0x1B00,  "Synchronous Data Transfer Error"},
2527     {0x1C00,  "Defect List Not Found"},
2528     {0x1C01,  "Primary Defect List Not Found"},
2529     {0x1C02,  "Grown Defect List Not Found"},
2530     {0x1D00,  "Miscompare During Verify Operation"},
2531     {0x1E00,  "Recovered Id With Ecc Correction"},
2532     {0x1F00,  "Defect List Transfer"},
2533     {0x2000,  "Invalid Command Operation Code"},
2534     {0x2100,  "Logical Block Address Out Of Range"},
2535     {0x2101,  "Invalid Element Address"},
2536     {0x2400,  "Invalid Field In Cdb"},
2537     {0x2401,  "Cdb Decryption Error"},
2538     {0x2500,  "Logical Unit Not Supported"},
2539     {0x2600,  "Invalid Field In Parameter List"},
2540     {0x2601,  "Parameter Not Supported"},
2541     {0x2602,  "Parameter Value Invalid"},
2542     {0x2603,  "Threshold Parameters Not Supported"},
2543     {0x2604,  "Invalid Release Of Persistent Reservation"},
2544     {0x2605,  "Data Decryption Error"},
2545     {0x2606,  "Too Many Target Descriptors"},
2546     {0x2607,  "Unsupported Target Descriptor Type Code"},
2547     {0x2608,  "Too Many Segment Descriptors"},
2548     {0x2609,  "Unsupported Segment Descriptor Type Code"},
2549     {0x260A,  "Unexpected Inexact Segment"},
2550     {0x260B,  "Inline Data Length Exceeded"},
2551     {0x260C,  "Invalid Operation For Copy Source Or Destination"},
2552     {0x260D,  "Copy Segment Granularity Violation"},
2553     {0x2700,  "Write Protected"},
2554     {0x2701,  "Hardware Write Protected"},
2555     {0x2702,  "Logical Unit Software Write Protected"},
2556     {0x2800,  "Not Ready To Ready Change, Medium May Have Changed"},
2557     {0x2801,  "Import Or Export Element Accessed"},
2558     {0x2900,  "Power On, Reset, Or Bus Device Reset Occurred"},
2559     {0x2901,  "Power On Occurred"},
2560     {0x2902,  "Scsi Bus Reset Occurred"},
2561     {0x2903,  "Bus Device Reset Function Occurred"},
2562     {0x2904,  "Device Internal Reset"},
2563     {0x2905,  "Transceiver Mode Changed To Single-Ended"},
2564     {0x2906,  "Transceiver Mode Changed To Lvd"},
2565     {0x2A00,  "Parameters Changed"},
2566     {0x2A01,  "Mode Parameters Changed"},
2567     {0x2A02,  "Log Parameters Changed"},
2568     {0x2A03,  "Reservations Preempted"},
2569     {0x2A04,  "Reservations Released"},
2570     {0x2A05,  "Registrations Preempted"},
2571     {0x2B00,  "Copy Cannot Execute Since Host Cannot Disconnect"},
2572     {0x2C00,  "Command Sequence Error"},
2573     {0x2C0A,  "Partition or Collection Contains User Objects"},
2574     {0x2F00,  "Commands Cleared By Another Initiator"},
2575     {0x3000,  "Incompatible Medium Installed"},
2576     {0x3001,  "Cannot Read Medium - Unknown Format"},
2577     {0x3002,  "Cannot Read Medium - Incompatible Format"},
2578     {0x3003,  "Cleaning Cartridge Installed"},
2579     {0x3004,  "Cannot Write Medium - Unknown Format"},
2580     {0x3005,  "Cannot Write Medium - Incompatible Format"},
2581     {0x3006,  "Cannot Format Medium - Incompatible Medium"},
2582     {0x3007,  "Cleaning Failure"},
2583     {0x3100,  "Medium Format Corrupted"},
2584     {0x3101,  "Format Command Failed"},
2585     {0x3200,  "No Defect Spare Location Available"},
2586     {0x3201,  "Defect List Update Failure"},
2587     {0x3400,  "Enclosure Failure"},
2588     {0x3500,  "Enclosure Services Failure"},
2589     {0x3501,  "Unsupported Enclosure Function"},
2590     {0x3502,  "Enclosure Services Unavailable"},
2591     {0x3503,  "Enclosure Services Transfer Failure"},
2592     {0x3504,  "Enclosure Services Transfer Refused"},
2593     {0x3700,  "Rounded Parameter"},
2594     {0x3807,  "Thin Provisioning Soft Threshold Reached"},
2595     {0x3900,  "Saving Parameters Not Supported"},
2596     {0x3A00,  "Medium Not Present"},
2597     {0x3A01,  "Medium Not Present - Tray Closed"},
2598     {0x3A02,  "Medium Not Present - Tray Open"},
2599     {0x3A03,  "Medium Not Present - Loadable"},
2600     {0x3A04,  "Medium Not Present - Medium Auxiliary Memory Accessible"},
2601     {0x3B0D,  "Medium Destination Element Full"},
2602     {0x3B0E,  "Medium Source Element Empty"},
2603     {0x3B11,  "Medium Magazine Not Accessible"},
2604     {0x3B12,  "Medium Magazine Removed"},
2605     {0x3B13,  "Medium Magazine Inserted"},
2606     {0x3B14,  "Medium Magazine Locked"},
2607     {0x3B15,  "Medium Magazine Unlocked"},
2608     {0x3D00,  "Invalid Bits In Identify Message"},
2609     {0x3E00,  "Logical Unit Has Not Self-Configured Yet"},
2610     {0x3E01,  "Logical Unit Failure"},
2611     {0x3E02,  "Timeout On Logical Unit"},
2612     {0x3E03,  "Logical Unit Failed Self-Test"},
2613     {0x3E04,  "Logical Unit Unable To Update Self-Test Log"},
2614     {0x3F00,  "Target Operating Conditions Have Changed"},
2615     {0x3F01,  "Microcode Has Been Changed"},
2616     {0x3F02,  "Changed Operating Definition"},
2617     {0x3F03,  "Inquiry Data Has Changed"},
2618     {0x3F04,  "Component Device Attached"},
2619     {0x3F05,  "Device Identifier Changed"},
2620     {0x3F06,  "Redundancy Group Created Or Modified"},
2621     {0x3F07,  "Redundancy Group Deleted"},
2622     {0x3F08,  "Spare Created Or Modified"},
2623     {0x3F09,  "Spare Deleted"},
2624     {0x3F0A,  "Volume Set Created Or Modified"},
2625     {0x3F0B,  "Volume Set Deleted"},
2626     {0x3F0C,  "Volume Set Deassigned"},
2627     {0x3F0D,  "Volume Set Reassigned"},
2628     {0x3F0E,  "Reported Luns Data Has Changed"},
2629     {0x3F0F,  "Echo Buffer Overwritten"},
2630     {0x3F10,  "Medium Loadable"},
2631     {0x3F11,  "Medium Auxiliary Memory Accessible"},
2632     {0x4200,  "Self-Test Failure (Should Use 40 Nn)"},
2633     {0x4300,  "Message Error"},
2634     {0x4400,  "Internal Target Failure"},
2635     {0x4500,  "Select Or Reselect Failure"},
2636     {0x4600,  "Unsuccessful Soft Reset"},
2637     {0x4700,  "Scsi Parity Error"},
2638     {0x4701,  "Data Phase Crc Error Detected"},
2639     {0x4702,  "Scsi Parity Error Detected During St Data Phase"},
2640     {0x4703,  "Information Unit Crc Error Detected"},
2641     {0x4704,  "Asynchronous Information Protection Error Detected"},
2642     {0x4800,  "Initiator Detected Error Message Received"},
2643     {0x4900,  "Invalid Message Error"},
2644     {0x4A00,  "Command Phase Error"},
2645     {0x4B00,  "Data Phase Error"},
2646     {0x4C00,  "Logical Unit Failed Self-Configuration"},
2647     {0x4D00,  "Tagged Overlapped Commands (Nn = Queue Tag)"},
2648     {0x4E00,  "Overlapped Commands Attempted"},
2649     {0x5300,  "Media Load Or Eject Failed"},
2650     {0x5302,  "Medium Removal Prevented"},
2651     {0x5501,  "System Buffer Full"},
2652     {0x5502,  "Insufficient Reservation Resources"},
2653     {0x5503,  "Insufficient Resources"},
2654     {0x5504,  "Insufficient Registration Resources"},
2655     {0x5A00,  "Operator Request Or State Change Input"},
2656     {0x5A01,  "Operator Medium Removal Request"},
2657     {0x5A02,  "Operator Selected Write Protect"},
2658     {0x5A03,  "Operator Selected Write Permit"},
2659     {0x5B00,  "Log Exception"},
2660     {0x5B01,  "Threshold Condition Met"},
2661     {0x5B02,  "Log Counter At Maximum"},
2662     {0x5B03,  "Log List Codes Exhausted"},
2663     {0x5C00,  "Change"},
2664     {0x5C02,  "Synchronized"},
2665     {0x5D00,  "Failure Prediction Threshold Exceeded"},
2666     {0x5D10,  "Failure General Hard Drive Failure"},
2667     {0x5D11,  "Failure Drive Error Rate Too High"},
2668     {0x5D12,  "Failure Data Error Rate Too High"},
2669     {0x5D13,  "Failure Seek Error Rate Too High"},
2670     {0x5D14,  "Failure Too Many Block Reassigns"},
2671     {0x5D15,  "Failure Access Times Too High"},
2672     {0x5D16,  "Failure Start Unit Times Too High"},
2673     {0x5D17,  "Failure Channel Parametrics"},
2674     {0x5D18,  "Failure Controller Detected"},
2675     {0x5D19,  "Failure Throughput Performance"},
2676     {0x5D1A,  "Failure Seek Time Performance"},
2677     {0x5D1B,  "Failure Spin-Up Retry Count"},
2678     {0x5D1C,  "Failure Drive Calibration Retry"},
2679     {0x5D20,  "Failure General Hard Drive Failure"},
2680     {0x5D21,  "Failure Drive Error Rate Too High"},
2681     {0x5D22,  "Failure Data Error Rate Too High"},
2682     {0x5D23,  "Failure Seek Error Rate Too High"},
2683     {0x5D24,  "Failure Too Many Block Reassigns"},
2684     {0x5D25,  "Failure Access Times Too High"},
2685     {0x5D26,  "Failure Start Unit Times Too High"},
2686     {0x5D27,  "Failure Channel Parametrics"},
2687     {0x5D28,  "Failure Controller Detected"},
2688     {0x5D29,  "Failure Throughput Performance"},
2689     {0x5D2A,  "Failure Seek Time Performance"},
2690     {0x5D2B,  "Failure Spin-Up Retry Count"},
2691     {0x5D2C,  "Failure Drive Calibration Retry"},
2692     {0x5D30,  "Impending Failure General Hard Drive"},
2693     {0x5D31,  "Impending Failure Drive Error Rate Too High"},
2694     {0x5D32,  "Impending Failure Data Error Rate Too High"},
2695     {0x5D33,  "Impending Failure Seek Error Rate Too High"},
2696     {0x5D34,  "Impending Failure Too Many Block Reassigns"},
2697     {0x5D35,  "Impending Failure Access Times Too High"},
2698     {0x5D36,  "Impending Failure Start Unit Times Too High"},
2699     {0x5D37,  "Impending Failure Channel Parametrics"},
2700     {0x5D38,  "Impending Failure Controller Detected"},
2701     {0x5D39,  "Impending Failure Throughput Performance"},
2702     {0x5D3A,  "Impending Failure Seek Time Performance"},
2703     {0x5D3B,  "Impending Failure Spin-Up Retry Count"},
2704     {0x5D3C,  "Impending Failure Drive Calibration Retry"},
2705     {0x5D40,  "Failure General Hard Drive Failure"},
2706     {0x5D41,  "Failure Drive Error Rate Too High"},
2707     {0x5D42,  "Failure Data Error Rate Too High"},
2708     {0x5D43,  "Failure Seek Error Rate Too High"},
2709     {0x5D44,  "Failure Too Many Block Reassigns"},
2710     {0x5D45,  "Failure Access Times Too High"},
2711     {0x5D46,  "Failure Start Unit Times Too High"},
2712     {0x5D47,  "Failure Channel Parametrics"},
2713     {0x5D48,  "Failure Controller Detected"},
2714     {0x5D49,  "Failure Throughput Performance"},
2715     {0x5D4A,  "Failure Seek Time Performance"},
2716     {0x5D4B,  "Failure Spin-Up Retry Count"},
2717     {0x5D4C,  "Failure Drive Calibration Retry Count"},
2718     {0x5D50,  "Failure General Hard Drive Failure"},
2719     {0x5D51,  "Failure Drive Error Rate Too High"},
2720     {0x5D52,  "Failure Data Error Rate Too High"},
2721     {0x5D53,  "Failure Seek Error Rate Too High"},
2722     {0x5D54,  "Failure Too Many Block Reassigns"},
2723     {0x5D55,  "Failure Access Times Too High"},
2724     {0x5D56,  "Failure Start Unit Times Too High"},
2725     {0x5D57,  "Failure Channel Parametrics"},
2726     {0x5D58,  "Failure Controller Detected"},
2727     {0x5D59,  "Failure Throughput Performance"},
2728     {0x5D5A,  "Failure Seek Time Performance"},
2729     {0x5D5B,  "Failure Spin-Up Retry Count"},
2730     {0x5D5C,  "Failure Drive Calibration Retry Count"},
2731     {0x5D60,  "Failure General Hard Drive Failure"},
2732     {0x5D61,  "Failure Drive Error Rate Too High"},
2733     {0x5D62,  "Failure Data Error Rate Too High"},
2734     {0x5D63,  "Failure Seek Error Rate Too High"},
2735     {0x5D64,  "Failure Too Many Block Reassigns"},
2736     {0x5D65,  "Failure Access Times Too High"},
2737     {0x5D66,  "Failure Start Unit Times Too High"},
2738     {0x5D67,  "Failure Channel Parametrics"},
2739     {0x5D68,  "Failure Controller Detected"},
2740     {0x5D69,  "Failure Throughput Performance"},
2741     {0x5D6A,  "Failure Seek Time Performance"},
2742     {0x5D6B,  "Failure Spin-Up Retry Count"},
2743     {0x5D6C,  "Failure Drive Calibration Retry Count"},
2744     {0x5DFF,  "Failure Prediction Threshold Exceeded (False)"},
2745     {0x5E00,  "Low Power Condition On"},
2746     {0x5E01,  "Idle Condition Activated By Timer"},
2747     {0x5E02,  "Standby Condition Activated By Timer"},
2748     {0x5E03,  "Idle Condition Activated By Command"},
2749     {0x5E04,  "Standby Condition Activated By Command"},
2750     {0x6500,  "Voltage Fault"},
2751     {0, NULL},
2752 };
2753 value_string_ext scsi_asc_val_ext = VALUE_STRING_EXT_INIT(scsi_asc_val);
2754
2755 /* SCSI Status Codes */
2756 const value_string scsi_status_val[] = {
2757     {0x00, "Good"},
2758     {0x02, "Check Condition"},
2759     {0x04, "Condition Met"},
2760     {0x08, "Busy"},
2761     {0x10, "Intermediate"},
2762     {0x14, "Intermediate Condition Met"},
2763     {0x18, "Reservation Conflict"},
2764     {0x28, "Task Set Full"},
2765     {0x30, "ACA Active"},
2766     {0x40, "Task Aborted"},
2767     {0, NULL},
2768 };
2769
2770
2771 const value_string scsi_wb_mode_val[] = {
2772     {0x0, "Write combined header and data"},
2773     {0x1, "Vendor specific"},
2774     {0x2, "Write data"},
2775     {0x3, "Reserved"},
2776     {0x4, "Download microcode"},
2777     {0x5, "Download microcode and save"},
2778     {0x6, "Download microcode with offsets"},
2779     {0x7, "Download microcode with offsets and save"},
2780     {0x8, "Reserved"},
2781     {0x9, "Reserved"},
2782     {0xA, "Echo buffer"},
2783     {0, NULL},
2784 };
2785
2786 const value_string scsi_senddiag_st_code_val[] = {
2787     {0, ""},
2788     {0x1, "Start short self-test in background"},
2789     {0x2, "Start extended self-test in background"},
2790     {0x3, "Reserved"},
2791     {0x4, "Abort background self-test"},
2792     {0x5, "Foreground short self-test"},
2793     {0x6, "Foreground extended self-test"},
2794     {0x7, "Reserved"},
2795     {0, NULL},
2796 };
2797
2798 const true_false_string scsi_senddiag_pf_val = {
2799     "Standard Page Format",
2800     "Vendor-specific Page Format",
2801 };
2802
2803 static gint scsi_def_devtype = SCSI_DEV_SBC;
2804
2805
2806 typedef struct _cmdset_t {
2807     int                 hf_opcode;
2808     value_string_ext   *cdb_vals_ext;
2809     scsi_cdb_table_t   *cdb_table;
2810 } cmdset_t;
2811
2812 static cmdset_t *get_cmdset_data(itlq_nexus_t *itlq, itl_nexus_t *itl);
2813
2814 static void
2815 dissect_naa_designator(proto_tree *tree, tvbuff_t *tvb, guint offset, guint len)
2816 {
2817         proto_tree *naa_tree;
2818         guint8 naa_type;
2819         guint64 vs;
2820
2821         naa_type = tvb_get_guint8(tvb, offset) >> 4;
2822
2823         naa_tree = proto_tree_add_subtree_format(tree, tvb, offset, len,
2824                         ett_scsi_naa, NULL, "NAA Designator: %s",
2825                         val_to_str(naa_type,
2826                                    scsi_naa_designator_type_val,
2827                                    "Unknown (0x%08x)"));
2828
2829         proto_tree_add_item(naa_tree, hf_scsi_naa_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2830         switch(naa_type) {
2831         case NAA_TYPE_IEEE_EXTENDED:
2832             vs = tvb_get_guint64(tvb, offset, ENC_BIG_ENDIAN);
2833             proto_tree_add_uint(naa_tree, hf_scsi_naa_vendor_specific, tvb, offset, 2, (guint)((vs >> 48) & 0x0fff));
2834             proto_tree_add_item(naa_tree, hf_scsi_naa_ieee_company_id, tvb, offset + 2, 3, ENC_BIG_ENDIAN);
2835             proto_tree_add_uint(naa_tree, hf_scsi_naa_vendor_specific, tvb, offset + 5, 3, (guint)(vs & 0x00ffffff));
2836             break;
2837         case NAA_TYPE_LOCALLY_ASSIGNED:
2838             proto_tree_add_item(naa_tree, hf_scsi_naa_locally_assigned, tvb, offset + 1, len - 1, ENC_NA);
2839             break;
2840         case NAA_TYPE_IEEE_REGISTERED:
2841             vs = tvb_get_guint64(tvb, offset, ENC_BIG_ENDIAN);
2842             proto_tree_add_uint(naa_tree, hf_scsi_naa_ieee_company_id, tvb, offset, 4, (guint)((vs >> 36) & 0x00ffffff));
2843             proto_tree_add_uint(naa_tree, hf_scsi_naa_vendor_specific, tvb, offset + 3, 4, (guint)(vs & 0x0fffffff));
2844             break;
2845         case NAA_TYPE_IEEE_REGISTERED_EXTENDED:
2846             vs = tvb_get_guint64(tvb, offset, ENC_BIG_ENDIAN);
2847             proto_tree_add_uint(naa_tree, hf_scsi_naa_ieee_company_id, tvb, offset, 4, (guint)((vs >> 36) & 0x00ffffff));
2848             proto_tree_add_uint(naa_tree, hf_scsi_naa_vendor_specific, tvb, offset + 3, 4, (guint)(vs & 0x0fffffff));
2849             proto_tree_add_item(naa_tree, hf_scsi_naa_vendor_specific_extension, tvb, offset + 8, 8, ENC_NA);
2850             break;
2851         }
2852 }
2853
2854
2855 static void
2856 dissect_scsi_evpd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
2857                   guint offset, guint tot_len _U_)
2858 {
2859     proto_tree *evpd_tree;
2860     proto_item *ti;
2861     guint       pcode, plen, i, idlen;
2862     guint8      codeset, identifier_type;
2863     proto_tree *des_tree;
2864
2865     if (tree) {
2866         pcode = tvb_get_guint8(tvb, offset+1);
2867         plen = tvb_get_guint8(tvb, offset+3);
2868         evpd_tree = proto_tree_add_subtree_format(tree, tvb, offset, plen+4,
2869                                  ett_scsi_page, NULL, "Page Code: %s",
2870                                  val_to_str(pcode, scsi_evpd_pagecode_val,
2871                                             "Unknown (0x%08x)"));
2872
2873         proto_tree_add_item(evpd_tree, hf_scsi_inq_qualifier, tvb, offset,
2874                             1, ENC_BIG_ENDIAN);
2875         proto_tree_add_item(evpd_tree, hf_scsi_inq_devtype, tvb, offset,
2876                             1, ENC_BIG_ENDIAN);
2877         proto_tree_add_item(evpd_tree, hf_scsi_inquiry_evpd_page, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2878         proto_tree_add_item(evpd_tree, hf_scsi_inq_evpd_page_length, tvb, offset+2, 2, ENC_BIG_ENDIAN);
2879         offset += 4;
2880         switch (pcode) {
2881         case SCSI_EVPD_SUPPPG:
2882             for (i = 0; i < plen; i++) {
2883                 proto_tree_add_item(evpd_tree, hf_scsi_inq_evpd_supported_page, tvb, offset+i, 1, ENC_BIG_ENDIAN);
2884             }
2885             break;
2886         case SCSI_EVPD_DEVID:
2887             i = 0;
2888             while (plen != 0) {
2889                 idlen = tvb_get_guint8(tvb, offset + 3);
2890
2891                 des_tree = proto_tree_add_subtree_format(evpd_tree,
2892                         tvb, offset, idlen, ett_scsi_designation_descriptor,
2893                         NULL, "Designation Descriptor");
2894
2895                 i++;
2896                 ti = proto_tree_add_uint(des_tree, hf_scsi_inq_evpd_identifier_number, tvb, offset, 0, i);
2897                 PROTO_ITEM_SET_GENERATED(ti);
2898
2899                 codeset = tvb_get_guint8(tvb, offset) & 0x0F;
2900                 ti = proto_tree_add_item(des_tree, hf_scsi_inq_evpd_devid_code_set, tvb, offset, 1, ENC_BIG_ENDIAN);
2901                 plen -= 1;
2902                 offset += 1;
2903
2904                 if (plen < 1) {
2905                     expert_add_info(pinfo, ti, &ei_scsi_product_data_goes_past_end_of_page);
2906                     break;
2907                 }
2908
2909                 proto_tree_add_item(des_tree, hf_scsi_inq_evpd_devid_association, tvb, offset, 1, ENC_BIG_ENDIAN);
2910                 identifier_type = tvb_get_guint8(tvb, offset);
2911                 ti = proto_tree_add_item(des_tree, hf_scsi_inq_evpd_devid_identifier_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2912                 plen -= 1;
2913                 offset += 1;
2914
2915                 /* Skip reserved byte */
2916                 if (plen < 1) {
2917                     expert_add_info(pinfo, ti, &ei_scsi_product_data_goes_past_end_of_page);
2918                     break;
2919                 }
2920                 plen -= 1;
2921                 offset += 1;
2922
2923                 if (plen < 1) {
2924                     expert_add_info(pinfo, ti, &ei_scsi_product_data_goes_past_end_of_page);
2925                     break;
2926                 }
2927                 ti = proto_tree_add_item(des_tree, hf_scsi_inq_evpd_devid_identifier_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2928                 plen -= 1;
2929                 offset += 1;
2930
2931                 if (idlen != 0) {
2932                     if (plen < idlen) {
2933                         expert_add_info(pinfo, ti, &ei_scsi_product_data_goes_past_end_of_page);
2934                         break;
2935                     }
2936                     if (codeset == CODESET_ASCII) {
2937                         if (identifier_type == DEVID_TYPE_VEND_ID_VEND_SPEC_ID) {
2938                             proto_tree_add_item(des_tree, hf_scsi_inq_vendor_id, tvb, offset, 8, ENC_ASCII|ENC_NA);
2939                             proto_tree_add_item(des_tree, hf_scsi_inq_evpd_devid_identifier_str, tvb, offset + 8, idlen - 8, ENC_NA|ENC_ASCII);
2940                         } else {
2941                             proto_tree_add_item(des_tree, hf_scsi_inq_evpd_devid_identifier_str, tvb, offset, idlen, ENC_NA|ENC_ASCII);
2942                         }
2943                     } else if (codeset == CODESET_BINARY && identifier_type == DEVID_TYPE_NAA) {
2944                         dissect_naa_designator(des_tree, tvb, offset, idlen);
2945                     } else {
2946                         /*
2947                          * XXX - decode this based on the identifier type,
2948                          * if the codeset is CODESET_BINARY?
2949                          */
2950                         proto_tree_add_item(des_tree, hf_scsi_inq_evpd_devid_identifier_bytes, tvb, offset, idlen, ENC_NA);
2951                     }
2952                     plen -= idlen;
2953                     offset += idlen;
2954                 }
2955             }
2956             break;
2957         case SCSI_EVPD_DEVSERNUM:
2958             if (plen > 0) {
2959                 proto_tree_add_item(evpd_tree, hf_scsi_inq_evpd_product_serial_number, tvb, offset, plen, ENC_NA|ENC_ASCII);
2960             }
2961             break;
2962         case SCSI_EVPD_BLKDEVCHAR:
2963             proto_tree_add_item(evpd_tree, hf_scsi_inquiry_bdc_mrr, tvb,
2964                 offset, 2, ENC_BIG_ENDIAN);
2965             offset += 2;
2966
2967             proto_tree_add_item(evpd_tree, hf_scsi_inquiry_bdc_pt, tvb,
2968                 offset, 1, ENC_BIG_ENDIAN);
2969             offset += 1;
2970
2971             proto_tree_add_item(evpd_tree, hf_scsi_inquiry_bdc_wabereq, tvb,
2972                 offset, 1, ENC_BIG_ENDIAN);
2973             proto_tree_add_item(evpd_tree, hf_scsi_inquiry_bdc_wacereq, tvb,
2974                 offset, 1, ENC_BIG_ENDIAN);
2975             proto_tree_add_item(evpd_tree, hf_scsi_inquiry_bdc_nff, tvb,
2976                 offset, 1, ENC_BIG_ENDIAN);
2977             offset += 1;
2978
2979             proto_tree_add_item(evpd_tree, hf_scsi_inquiry_bdc_fuab, tvb,
2980                 offset, 1, ENC_BIG_ENDIAN);
2981             proto_tree_add_item(evpd_tree, hf_scsi_inquiry_bdc_vbuls, tvb,
2982                 offset, 1, ENC_BIG_ENDIAN);
2983             /*offset += 1;*/
2984         break;
2985         case SCSI_EVPD_BLKLIMITS:
2986             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_wsnz, tvb, offset, 1, ENC_NA);
2987             offset += 1;
2988
2989             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mcawl, tvb, offset, 1, ENC_BIG_ENDIAN);
2990             offset += 1;
2991
2992             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_otlg, tvb, offset, 2, ENC_BIG_ENDIAN);
2993             offset += 2;
2994
2995             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mtl, tvb, offset, 4, ENC_BIG_ENDIAN);
2996             offset += 4;
2997
2998             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_otl, tvb, offset, 4, ENC_BIG_ENDIAN);
2999             offset += 4;
3000
3001             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mpl, tvb, offset, 4, ENC_BIG_ENDIAN);
3002             offset += 4;
3003
3004             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mulc, tvb, offset, 4, ENC_BIG_ENDIAN);
3005             offset += 4;
3006
3007             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mubdc, tvb, offset, 4, ENC_BIG_ENDIAN);
3008             offset += 4;
3009
3010             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_oug, tvb, offset, 4, ENC_BIG_ENDIAN);
3011             offset += 4;
3012
3013             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_ugavalid, tvb, offset, 1, ENC_NA);
3014             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_uga, tvb, offset, 4, ENC_BIG_ENDIAN);
3015             offset += 4;
3016
3017             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mwsl, tvb, offset, 8, ENC_BIG_ENDIAN);
3018             offset += 8;
3019
3020             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_matl, tvb, offset, 4, ENC_BIG_ENDIAN);
3021             offset += 4;
3022
3023             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_aa, tvb, offset, 4, ENC_BIG_ENDIAN);
3024             offset += 4;
3025
3026             proto_tree_add_item(evpd_tree, hf_scsi_block_limits_atlg, tvb, offset, 4, ENC_BIG_ENDIAN);
3027             /*offset += 4;*/
3028
3029             break;
3030         case SCSI_EVPD_LBP:
3031             proto_tree_add_item(evpd_tree, hf_scsi_sbc_threshold_exponent, tvb, offset, 1, ENC_BIG_ENDIAN);
3032             offset += 1;
3033
3034             proto_tree_add_item(evpd_tree, hf_scsi_sbc_lbpu, tvb, offset, 1, ENC_NA);
3035             proto_tree_add_item(evpd_tree, hf_scsi_sbc_lbpws, tvb, offset, 1, ENC_NA);
3036             proto_tree_add_item(evpd_tree, hf_scsi_sbc_lbpws10, tvb, offset, 1, ENC_NA);
3037             proto_tree_add_item(evpd_tree, hf_scsi_sbc_lbprz, tvb, offset, 1, ENC_NA);
3038             proto_tree_add_item(evpd_tree, hf_scsi_sbc_anc_sup, tvb, offset, 1, ENC_NA);
3039             proto_tree_add_item(evpd_tree, hf_scsi_sbc_dp, tvb, offset, 1, ENC_NA);
3040             offset += 1;
3041
3042             proto_tree_add_item(evpd_tree, hf_scsi_sbc_ptype, tvb, offset, 1, ENC_BIG_ENDIAN);
3043             /*offset += 1;*/
3044
3045             break;
3046         }
3047     }
3048 }
3049
3050 static void
3051 dissect_scsi_cmddt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
3052                    guint offset, guint tot_len _U_)
3053 {
3054     proto_tree *cmdt_tree;
3055     guint       plen;
3056
3057     if (tree) {
3058         plen = tvb_get_guint8(tvb, offset+5);
3059         cmdt_tree = proto_tree_add_subtree_format(tree, tvb, offset, plen, ett_scsi_page, NULL, "Command Data");
3060
3061         proto_tree_add_item(cmdt_tree, hf_scsi_inq_qualifier, tvb, offset,
3062                             1, ENC_BIG_ENDIAN);
3063         proto_tree_add_item(cmdt_tree, hf_scsi_inq_devtype, tvb, offset,
3064                             1, ENC_BIG_ENDIAN);
3065         proto_tree_add_item(cmdt_tree, hf_scsi_inq_cmddt_support, tvb, offset+1, 1, ENC_BIG_ENDIAN);
3066         proto_tree_add_item(cmdt_tree, hf_scsi_inq_cmddt_version, tvb, offset+2, 1, ENC_BIG_ENDIAN);
3067         proto_tree_add_item(cmdt_tree, hf_scsi_inq_cmddt_cdb_size, tvb, offset+5, 1, ENC_BIG_ENDIAN);
3068     }
3069 }
3070
3071
3072 #define SCSI_INQ_ACAFLAGS_AERC      0x80
3073 #define SCSI_INQ_ACAFLAGS_TRMTSK    0x40
3074 #define SCSI_INQ_ACAFLAGS_NORMACA   0x20
3075 #define SCSI_INQ_ACAFLAGS_HISUP     0x10
3076
3077 static const value_string inq_rdf_vals[] = {
3078     { 2, "SPC-2/SPC-3/SPC-4" },
3079     { 0, NULL }
3080 };
3081
3082
3083 #define SCSI_INQ_SCCSFLAGS_SCCS     0x80
3084 #define SCSI_INQ_SCCSFLAGS_ACC      0x40
3085 #define SCSI_INQ_SCCSFLAGS_TPC      0x08
3086 #define SCSI_INQ_SCCSFLAGS_PROTECT  0x01
3087
3088 static const value_string inq_tpgs_vals[] = {
3089     { 0, "Asymmetric LU Access not supported" },
3090     { 1, "Implicit Asymmetric LU Access supported" },
3091     { 2, "Explicit LU Access supported" },
3092     { 3, "Both Implicit and Explicit LU Access supported" },
3093     { 0, NULL }
3094 };
3095
3096 /* This dissects byte 5 of the SPC/SPC-2/SPC-3/SPC-4 standard INQ data */
3097 static int
3098 dissect_spc_inq_sccsflags(tvbuff_t *tvb, int offset, proto_tree *tree, int version)
3099 {
3100     static const int *sccs_fields_spc2[] = {
3101         &hf_scsi_inq_sccs,
3102         NULL
3103     };
3104     static const int *sccs_fields_spc3[] = {
3105         &hf_scsi_inq_sccs,
3106         &hf_scsi_inq_acc,
3107         &hf_scsi_inq_tpgs,
3108         &hf_scsi_inq_tpc,
3109         &hf_scsi_inq_protect,
3110         NULL
3111     };
3112
3113     switch (version) {
3114     case 3: /* SPC */
3115         break;
3116     case 4: /* SPC-2 */
3117         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_sccsflags, ett_scsi_inq_sccsflags,  sccs_fields_spc2, ENC_BIG_ENDIAN);
3118         break;
3119     case 5: /* SPC-3 */
3120     case 6: /* SPC-4 */
3121         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_sccsflags, ett_scsi_inq_sccsflags,  sccs_fields_spc3, ENC_BIG_ENDIAN);
3122         break;
3123     default: /* including version 0 : claims conformance to no standard */
3124         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_sccsflags, ett_scsi_inq_sccsflags,  sccs_fields_spc3, ENC_BIG_ENDIAN);
3125     }
3126
3127     offset += 1;
3128     return offset;
3129 }
3130
3131
3132 #define SCSI_INQ_BQUEFLAGS_BQUE     0x80
3133 #define SCSI_INQ_BQUEFLAGS_ENCSERV  0x40
3134 #define SCSI_INQ_BQUEFLAGS_MULTIP   0x10
3135 #define SCSI_INQ_BQUEFLAGS_MCHNGR   0x08
3136 #define SCSI_INQ_BQUEFLAGS_ACKREQQ  0x04
3137
3138 /* This dissects byte 6 of the SPC/SPC-2/SPC-3/SPC-4 standard INQ data */
3139 static int
3140 dissect_spc_inq_bqueflags(tvbuff_t *tvb, int offset, proto_tree *tree, int version)
3141 {
3142     static const int *bqe_fields_spc[] = {
3143         &hf_scsi_inq_encserv,
3144         &hf_scsi_inq_multip,
3145         &hf_scsi_inq_mchngr,
3146         &hf_scsi_inq_ackreqq,
3147         NULL
3148     };
3149     static const int *bqe_fields_spc2[] = {
3150         &hf_scsi_inq_bque,
3151         &hf_scsi_inq_encserv,
3152         &hf_scsi_inq_multip,
3153         &hf_scsi_inq_mchngr,
3154         NULL
3155     };
3156     static const int *bqe_fields_spc4[] = {
3157         &hf_scsi_inq_bque,
3158         &hf_scsi_inq_encserv,
3159         &hf_scsi_inq_multip,
3160         NULL
3161     };
3162
3163     switch (version) {
3164     case 3: /* SPC */
3165         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_bqueflags, ett_scsi_inq_bqueflags,  bqe_fields_spc, ENC_BIG_ENDIAN);
3166         break;
3167     case 4: /* SPC-2 */
3168     case 5: /* SPC-3 */
3169         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_bqueflags, ett_scsi_inq_bqueflags,  bqe_fields_spc2, ENC_BIG_ENDIAN);
3170         break;
3171     case 6: /* SPC-4 */
3172         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_bqueflags, ett_scsi_inq_bqueflags,  bqe_fields_spc4, ENC_BIG_ENDIAN);
3173         break;
3174     default: /* including version 0 : claims conformance to no standard */
3175         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_bqueflags, ett_scsi_inq_bqueflags,  bqe_fields_spc4, ENC_BIG_ENDIAN);
3176         break;
3177     }
3178
3179     offset+=1;
3180     return offset;
3181 }
3182
3183 #define SCSI_INQ_RELADRFLAGS_RELADR     0x80
3184 #define SCSI_INQ_RELADRFLAGS_LINKED     0x08
3185 #define SCSI_INQ_RELADRFLAGS_TRANDIS    0x04
3186 #define SCSI_INQ_RELADRFLAGS_CMDQUE     0x02
3187
3188 /* This dissects byte 7 of the SPC/SPC-2/SPC-3/SPC-4 standard INQ data */
3189 static int
3190 dissect_spc_inq_reladrflags(tvbuff_t *tvb, int offset, proto_tree *tree, int version)
3191 {
3192     static const int *reladr_fields_spc[] = {
3193         &hf_scsi_inq_reladr,
3194         &hf_scsi_inq_linked,
3195         &hf_scsi_inq_trandis,
3196         &hf_scsi_inq_cmdque,
3197         NULL
3198     };
3199     static const int *reladr_fields_spc2[] = {
3200         &hf_scsi_inq_reladr,
3201         &hf_scsi_inq_linked,
3202         &hf_scsi_inq_cmdque,
3203         NULL
3204     };
3205     static const int *reladr_fields_spc3[] = {
3206         &hf_scsi_inq_linked,
3207         &hf_scsi_inq_cmdque,
3208         NULL
3209     };
3210     static const int *reladr_fields_spc4[] = {
3211         &hf_scsi_inq_cmdque,
3212         NULL
3213     };
3214
3215
3216     switch (version) {
3217     case 3: /* SPC */
3218         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_reladrflags, ett_scsi_inq_reladrflags,  reladr_fields_spc, ENC_BIG_ENDIAN);
3219         break;
3220     case 4: /* SPC-2 */
3221         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_reladrflags, ett_scsi_inq_reladrflags,  reladr_fields_spc2, ENC_BIG_ENDIAN);
3222         break;
3223     case 5: /* SPC-3 */
3224         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_reladrflags, ett_scsi_inq_reladrflags,  reladr_fields_spc3, ENC_BIG_ENDIAN);
3225         break;
3226     case 6: /* SPC-4 */
3227         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_reladrflags, ett_scsi_inq_reladrflags,  reladr_fields_spc4, ENC_BIG_ENDIAN);
3228         break;
3229     default: /* including version 0 : claims conformance to no standard */
3230         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_inq_reladrflags, ett_scsi_inq_reladrflags,  reladr_fields_spc4, ENC_BIG_ENDIAN);
3231     }
3232
3233     offset+=1;
3234     return offset;
3235 }
3236
3237 static const int *peripheral_fields[] = {
3238     &hf_scsi_inq_qualifier,
3239     &hf_scsi_inq_devtype,
3240     NULL
3241 };
3242
3243
3244 void
3245 dissect_spc_inquiry(tvbuff_t *tvb_a, packet_info *pinfo,
3246                     proto_tree *tree, guint offset_a, gboolean isreq,
3247                     gboolean iscdb, guint32 payload_len,
3248                     scsi_task_data_t *cdata)
3249 {
3250     guint8             flags, i, version;
3251
3252     static const int *inq_control_fields[] = {
3253         &hf_scsi_inq_control_vendor_specific,
3254         &hf_scsi_inq_control_reserved,
3255         &hf_scsi_inq_control_naca,
3256         &hf_scsi_inq_control_obs1,
3257         &hf_scsi_inq_control_obs2,
3258         NULL
3259     };
3260     static const int *aca_fields_spc[] = {
3261         &hf_scsi_inq_aerc,  /* obsolete in spc3 and forward */
3262         &hf_scsi_inq_trmtsk,/* obsolete in spc2 and forward */
3263         &hf_scsi_inq_normaca,
3264         &hf_scsi_inq_hisup,
3265         &hf_scsi_inq_rdf,
3266         NULL
3267     };
3268     static const int *aca_fields_spc2[] = {
3269         &hf_scsi_inq_aerc,      /* obsolete in spc3 and forward */
3270         &hf_scsi_inq_normaca,
3271         &hf_scsi_inq_hisup,
3272         &hf_scsi_inq_rdf,
3273         NULL
3274     };
3275     static const int *aca_fields_spc3[] = {
3276         &hf_scsi_inq_normaca,
3277         &hf_scsi_inq_hisup,
3278         &hf_scsi_inq_rdf,
3279         NULL
3280     };
3281     static const int *rmb_fields[] = {
3282         &hf_scsi_inq_rmb,
3283         NULL
3284     };
3285
3286     if (!isreq && ((cdata == NULL) || !(cdata->itlq->flags & 0x3))
3287         && (tvb_reported_length_remaining(tvb_a, offset_a) >= 1) ) {
3288         /*
3289          * INQUIRY response with device type information; add device type
3290          * to list of known devices & their types if not already known.
3291          */
3292         if (cdata && cdata->itl) {
3293             cdata->itl->cmdset = tvb_get_guint8(tvb_a, offset_a)&SCSI_DEV_BITS;
3294         }
3295     }
3296
3297     if (isreq && iscdb) {
3298         flags = tvb_get_guint8(tvb_a, offset_a);
3299         if (cdata) {
3300             cdata->itlq->flags = flags;
3301         }
3302
3303         proto_tree_add_uint_format(tree, hf_scsi_inquiry_flags, tvb_a, offset_a, 1,
3304                                    flags, "CMDT = %u, EVPD = %u",
3305                                    flags & 0x2, flags & 0x1);
3306         if (flags & 0x1) {
3307             proto_tree_add_item(tree, hf_scsi_inquiry_evpd_page, tvb_a, offset_a+1,
3308                                 1, ENC_BIG_ENDIAN);
3309
3310         col_add_fstr(pinfo->cinfo, COL_INFO, " %s",
3311              val_to_str(tvb_get_guint8(tvb_a, offset_a+1),
3312                     scsi_evpd_pagecode_val,
3313                     "Unknown VPD 0x%02x"));
3314         } else if (flags & 0x2) {
3315             proto_tree_add_item(tree, hf_scsi_inquiry_cmdt_page, tvb_a, offset_a+1,
3316                                 1, ENC_BIG_ENDIAN);
3317         }
3318
3319         proto_tree_add_item(tree, hf_scsi_alloclen16, tvb_a, offset_a+2, 2, ENC_BIG_ENDIAN);
3320         /* we need the alloc_len in the response */
3321         if (cdata) {
3322             cdata->itlq->alloc_len = tvb_get_ntohs(tvb_a, offset_a+2);
3323         }
3324         proto_tree_add_bitmask(tree, tvb_a, offset_a+4, hf_scsi_inq_control,
3325                                ett_scsi_inq_control, inq_control_fields, ENC_BIG_ENDIAN);
3326     } else if (!isreq) {
3327         if (!cdata) {
3328             return;
3329         }
3330
3331         if (cdata->itlq->flags & 0x1) {
3332             dissect_scsi_evpd(tvb_a, pinfo, tree, offset_a, payload_len);
3333             return;
3334         }
3335         if (cdata->itlq->flags & 0x2) {
3336             dissect_scsi_cmddt(tvb_a, pinfo, tree, offset_a, payload_len);
3337             return;
3338         }
3339
3340         /* These pdus are sometimes truncated by SCSI allocation length
3341          * in the CDB
3342          */
3343         TRY_SCSI_CDB_ALLOC_LEN(cdata->itlq->alloc_len);  /* (defines/initializes try_tvb & try_offset) */
3344
3345         /* Qualifier and DeviceType */
3346         proto_tree_add_bitmask(tree, try_tvb, try_offset, hf_scsi_inq_peripheral, ett_scsi_inq_peripheral, peripheral_fields, ENC_BIG_ENDIAN);
3347         try_offset+=1;
3348
3349         /* RMB */
3350         proto_tree_add_bitmask(tree, try_tvb, try_offset, hf_scsi_inq_rmbflags, ett_scsi_inq_rmbflags, rmb_fields, ENC_BIG_ENDIAN);
3351         try_offset+=1;
3352
3353         /* Version */
3354         version = tvb_get_guint8(try_tvb, try_offset);
3355         proto_tree_add_item(tree, hf_scsi_inq_version, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
3356         try_offset+=1;
3357
3358         /* aca flags */
3359         switch (version) {
3360         case 3: /* SPC */
3361             proto_tree_add_bitmask(tree, try_tvb, try_offset, hf_scsi_inq_acaflags, ett_scsi_inq_acaflags, aca_fields_spc, ENC_BIG_ENDIAN);
3362             break;
3363         case 4: /* SPC-2 */
3364             proto_tree_add_bitmask(tree, try_tvb, try_offset, hf_scsi_inq_acaflags, ett_scsi_inq_acaflags, aca_fields_spc2, ENC_BIG_ENDIAN);
3365             break;
3366         case 5: /* SPC-3 */
3367         case 6: /* SPC-4 */
3368             proto_tree_add_bitmask(tree, try_tvb, try_offset, hf_scsi_inq_acaflags, ett_scsi_inq_acaflags, aca_fields_spc3, ENC_BIG_ENDIAN);
3369             break;
3370         default: /* including version 0 : claims conformance to no standard */
3371             proto_tree_add_bitmask(tree, try_tvb, try_offset, hf_scsi_inq_acaflags, ett_scsi_inq_acaflags, aca_fields_spc3, ENC_BIG_ENDIAN);
3372         }
3373         try_offset+=1;
3374
3375         /* Additional Length */
3376         SET_SCSI_DATA_END(tvb_get_guint8(try_tvb, try_offset)+try_offset);
3377         proto_tree_add_item(tree, hf_scsi_inq_add_len, try_tvb, try_offset, 1, ENC_BIG_ENDIAN);
3378         try_offset+=1;
3379
3380         /* sccs flags */
3381         try_offset = dissect_spc_inq_sccsflags(try_tvb, try_offset, tree, version);
3382
3383         /* bque flags */
3384         try_offset = dissect_spc_inq_bqueflags(try_tvb, try_offset, tree, version);
3385
3386         /* reladdr flags */
3387         try_offset = dissect_spc_inq_reladrflags(try_tvb, try_offset, tree, version);
3388
3389         /* vendor id */
3390         proto_tree_add_item(tree, hf_scsi_inq_vendor_id, try_tvb, try_offset, 8, ENC_ASCII|ENC_NA);
3391         try_offset+=8;
3392
3393         /* product id */
3394         proto_tree_add_item(tree, hf_scsi_inq_product_id, try_tvb, try_offset, 16, ENC_ASCII|ENC_NA);
3395         try_offset+=16;
3396
3397         /* product revision level */
3398         proto_tree_add_item(tree, hf_scsi_inq_product_rev, try_tvb, try_offset, 4, ENC_ASCII|ENC_NA);
3399         try_offset+=4;
3400
3401         /* vendor specific, 20 bytes */
3402         proto_tree_add_item(tree, hf_scsi_inq_vendor_specific, try_tvb, try_offset, 20, ENC_NA);
3403         try_offset+=20;
3404
3405         /* reserved */
3406         try_offset += 2;
3407
3408         /* version descriptors */
3409         for(i = 0;i<8;i++) {
3410             proto_tree_add_item(tree, hf_scsi_inq_version_desc, try_tvb, try_offset, 2, ENC_BIG_ENDIAN);
3411             try_offset+=2;
3412         }
3413
3414         END_TRY_SCSI_CDB_ALLOC_LEN;
3415     }
3416 }
3417
3418 #define XCOPY_LID1 0
3419 #define XCOPY_LID4 1
3420 static const value_string extcopy_service_vals[] = {
3421        { XCOPY_LID1, "Extended Copy (LID1)" },
3422         { XCOPY_LID4, "Extended Copy (LID4)" },
3423         { 0, NULL }
3424 };
3425
3426 #define RECV_COPY_PARAMS 0x3
3427 static const value_string recv_copy_service_vals[] = {
3428         { 0x6, "Receive Copy Data (LID4)" },
3429         { 0x1, "Receive Copy Data (LID1)" },
3430         { RECV_COPY_PARAMS, "Receive Copy Parameters" },
3431         { 0x4, "Receive Copy Failure details" },
3432         { 0x5, "Receive Copy Status (LID4)" },
3433         { 0x0, "Receive Copy Status (LID1)" },
3434         { 0, NULL }
3435 };
3436
3437
3438 #if 0
3439 static const value_string cscd_desc_type_code_vals[] = {
3440         { 0xE0, "Fibre Channel N_Port_Name CSCD descriptor" },
3441         { 0xE1, "Fibre Channel N_Port_ID CSCD descriptor" },
3442         { 0xE2, "Fibre Channel N_Port_ID With N_Port_Name Checking CSCD descriptor" },
3443         { 0xE3, "Parallel Interface T_L CSCD descriptor" },
3444         { 0xE4, "Identification Descriptor CSCD descriptor" },
3445         { 0xFF, "Extension descriptor" },
3446         { 0, NULL }
3447 };
3448 #endif
3449
3450 static const int *per_dev_type_bitmask_fields[] = {
3451         &hf_scsi_spc_xcopy_lu_type,
3452         &hf_scsi_spc_xcopy_per_dev_type,
3453         NULL
3454 };
3455
3456 static const int *xcopy_param_list_bits[] = {
3457         &hf_scsi_spc_xcopy_param_str,
3458         &hf_scsi_spc_xcopy_param_list_id_usage,
3459         &hf_scsi_spc_xcopy_param_priority,
3460         NULL
3461 };
3462
3463 #define BLOCK_DEV_0 0x0
3464 #define BLOCK_DEV_4 0x4
3465 #define BLOCK_DEV_5 0x5
3466 #define BLOCK_DEV_7 0x7
3467 #define BLOCK_DEV_E 0xE
3468
3469 static const value_string per_dev_type_vals[] = {
3470         { BLOCK_DEV_0, "Block devices" },
3471         { 0x1, "Sequential access devices" },
3472         { 0x3, "Processor devices" },
3473         { BLOCK_DEV_4, "Block devices" },
3474         { BLOCK_DEV_5, "Block devices" },
3475         { BLOCK_DEV_7, "Block devices" },
3476         { BLOCK_DEV_E, "Block devices" },
3477         { 0, NULL }
3478 };
3479
3480 static const value_string lu_type_vals[] = {
3481         { 0, "Logical Unit Number" },
3482         { 1, "Proxy Token" },
3483         { 2, "Reserved" },
3484         { 3, "Reserved" },
3485         { 0, NULL }
3486 };
3487
3488 #define BLOCK_TO_BLOCK 2
3489
3490 static const range_string desc_type_rval[] = {
3491         { 0x0, 0x0, "Block to stream" },
3492         { 0x1, 0x1, "Stream to block" },
3493         { BLOCK_TO_BLOCK, BLOCK_TO_BLOCK, "Block to block" },
3494         { 0x3, 0x3, "Stream to stream" },
3495         { 0x4, 0x4, "Inline to stream" },
3496         { 0x5, 0x5, "Embedded to strem" },
3497         { 0x6, 0x6, "Stream to discard" },
3498         { 0x7, 0x7, "Verify CSCD" },
3499         { 0x0, 0xBF, "Segment descriptors" },
3500         { 0xC, 0xDF, "Vendor-specific descriptors" },
3501         { 0xE0, 0xE0, "Fibre Channel N_Port_Name CSCD descriptor" },
3502         { 0xE1,  0xE1, "Fibre Channel N_Port_ID CSCD descriptor" },
3503         { 0xE2, 0xE2, "Fibre Channel N_Port_ID With N_Port_Name Checking CSCD descriptor" },
3504         { 0xE3, 0xE3, "Parallel Interface T_L CSCD descriptor" },
3505         { 0xE4, 0xE4, "Identification Descriptor CSCD descriptor" },
3506         { 0xE5, 0xFE, "CSCD descriptors" },
3507         { 0xFF, 0xFF, "CSCD descriptor extension" },
3508         { 0, 0, NULL }
3509 };
3510
3511 void
3512 dissect_spc_extcopy(tvbuff_t *tvb, packet_info *pinfo _U_,
3513                     proto_tree *tree, guint offset,
3514                     gboolean isreq, gboolean iscdb,
3515                     guint payload_len _U_, scsi_task_data_t *cdata)
3516 {
3517         guint16 serv_action;
3518         guint8 cscd_desc_type, dev_type, des_len, code_set, des_type, seg_type;
3519         guint16 cscd_desc_list_len, seg_desc_len;
3520         guint32 /*param_list_len,*/ seg_desc_list_len, inline_data_len, i;
3521         proto_tree *cscds_tree = NULL, *dev_tree = NULL, *cscd_tree = NULL, *segs_tree = NULL,
3522                    *seg_tree = NULL, *seg_param_tree = NULL, *cscd_desc_tree;
3523
3524         if (isreq && iscdb) {
3525                proto_tree_add_item(tree, hf_scsi_spc_xcopy_service, tvb, offset, 1, ENC_BIG_ENDIAN);
3526                serv_action = tvb_get_guint8(tvb, offset) & 0x1F;
3527                if (cdata) {
3528                    cdata->itlq->flags = serv_action;
3529                }
3530                offset += 1;
3531
3532                proto_tree_add_item(tree, hf_scsi_reserved_64, tvb, offset, 8, ENC_BIG_ENDIAN);
3533                offset += 8;
3534                proto_tree_add_item(tree, hf_scsi_spc_xcopy_param_list_len, tvb, offset, 4, ENC_BIG_ENDIAN);
3535                /*param_list_len = tvb_get_ntohl(tvb, offset); */
3536                offset += 4;
3537
3538                proto_tree_add_item(tree, hf_scsi_reserved_8, tvb, offset, 1, ENC_BIG_ENDIAN);
3539                offset+= 1;
3540                proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_control,
3541                         ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
3542                /*offset += 1;*/
3543                /*offset += (param_list_len - 15);*/
3544         } else {
3545                if (cdata) {
3546                         serv_action = cdata->itlq->flags;
3547                }
3548                else {
3549                         return;
3550                }
3551                if (serv_action == XCOPY_LID1){
3552                         proto_tree_add_item(tree, hf_scsi_spc_xcopy_list_id, tvb, offset, 1, ENC_BIG_ENDIAN);
3553                         offset += 1;
3554                         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_spc_xcopy_param_byte, ett_xcopy_param_byte, xcopy_param_list_bits, ENC_NA);
3555                         offset += 1;
3556                         proto_tree_add_item(tree, hf_scsi_spc_xcopy_cscd_desc_list_len, tvb, offset, 2, ENC_BIG_ENDIAN);
3557                         cscd_desc_list_len = tvb_get_ntohs(tvb, offset);
3558                         offset += 2;
3559                         proto_tree_add_item(tree, hf_scsi_reserved_32, tvb, offset, 4, ENC_BIG_ENDIAN);
3560                         offset += 4;
3561                         proto_tree_add_item(tree, hf_scsi_spc_xcopy_seg_desc_list_len, tvb, offset, 4, ENC_BIG_ENDIAN);
3562                         seg_desc_list_len = tvb_get_ntohl(tvb, offset);
3563                         offset += 4;
3564                         proto_tree_add_item(tree, hf_scsi_spc_xcopy_inline_data_len, tvb, offset, 4, ENC_BIG_ENDIAN);
3565                         inline_data_len = tvb_get_ntohl(tvb, offset);
3566                         offset += 4;
3567                         if (cscd_desc_list_len > 0) {
3568                                 cscds_tree = proto_tree_add_subtree_format(tree, tvb, offset, cscd_desc_list_len, ett_scsi_xcopy_cscds, NULL,
3569                                                         "CSCD (Copy Source and Copy Destination) descriptors (%u bytes)", cscd_desc_list_len);
3570                                 i = 1;
3571                                 while(cscd_desc_list_len > 0) {
3572                                         cscd_desc_type = tvb_get_guint8(tvb, offset);
3573                                         if (cscd_desc_type == 0xEA || cscd_desc_type == 0xEB) { /* both types occupy 64 bytes overall, everything else is 32 bytes */
3574                                                 cscd_tree = proto_tree_add_subtree_format(cscds_tree, tvb, offset, 64, ett_scsi_xcopy_cscd, NULL, "CSCD descriptor #%u", i);
3575                                         } else {
3576                                                 cscd_tree = proto_tree_add_subtree_format(cscds_tree, tvb, offset, 32, ett_scsi_xcopy_cscd, NULL, "CSCD descriptor #%u", i);
3577                                         }
3578                                         i++;
3579                                         proto_tree_add_item(cscd_tree, hf_scsi_spc_xcopy_cscd_desc_type_code, tvb, offset, 1, ENC_BIG_ENDIAN);
3580                                         offset += 1;
3581                                         proto_tree_add_bitmask(cscd_tree, tvb, offset, hf_scsi_spc_xcopy_per_dev_type_byte, ett_xcopy_per_dev_type,  per_dev_type_bitmask_fields, ENC_NA);
3582                                         dev_type = tvb_get_guint8(tvb, offset) & 0x1F;
3583                                         offset += 1;
3584                                         proto_tree_add_item(cscd_tree, hf_scsi_spc_xcopy_rel_init_port_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3585                                         offset += 2;
3586                                         cscd_desc_tree = proto_tree_add_subtree(cscd_tree, tvb, offset, 24, ett_scsi_cscd_desc, NULL, "CSCD descriptor parameters");
3587                                         proto_tree_add_item(cscd_desc_tree, hf_scsi_spc_xcopy_cscd_desc_code_set, tvb, offset, 1, ENC_BIG_ENDIAN);
3588                                         code_set = tvb_get_guint8(tvb, offset) & 0x0F;
3589                                         offset += 1;
3590                                         proto_tree_add_item(cscd_desc_tree, hf_scsi_spc_xcopy_cscd_desc_assoc, tvb, offset, 1, ENC_BIG_ENDIAN);
3591                                         proto_tree_add_item(cscd_desc_tree, hf_scsi_spc_xcopy_cscd_desc_des_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3592                                         des_type = tvb_get_guint8(tvb, offset) & 0x0F;
3593                                         offset += 1;
3594                                         proto_tree_add_item(cscd_desc_tree, hf_scsi_reserved_8, tvb, offset, 1, ENC_BIG_ENDIAN);
3595                                         offset += 1;
3596                                         proto_tree_add_item(cscd_desc_tree, hf_scsi_spc_xcopy_cscd_desc_des_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3597                                         des_len = tvb_get_guint8(tvb, offset);
3598                                         offset += 1;
3599                                         proto_tree_add_bytes_format(cscd_desc_tree, hf_scsi_designator, tvb, offset, 20, NULL, "Designator (20 bytes, zero padded, used length %u)", des_len);
3600                                         if (code_set == CODESET_BINARY && des_type == DEVID_TYPE_NAA) { /* des_type 3 = NAA */
3601                                             dissect_naa_designator(cscd_tree, tvb, offset, des_len);
3602                                         }
3603                                         offset += 20;
3604                                         dev_tree = proto_tree_add_subtree(cscd_tree, tvb, offset, 4, ett_scsi_xcopy_dev_params, NULL, "Device type specific parameters");
3605                                         if (dev_type == BLOCK_DEV_0 || dev_type == BLOCK_DEV_4 || dev_type == BLOCK_DEV_5 || dev_type == BLOCK_DEV_7 || dev_type == BLOCK_DEV_E) {
3606                                                 proto_tree_add_item(dev_tree, hf_scsi_reserved_8, tvb, offset, 1, ENC_BIG_ENDIAN);
3607                                                 offset += 1; /*TODO: dissect this byte */
3608                                                 proto_tree_add_item(dev_tree, hf_scsi_spc_xcopy_disk_block_len, tvb, offset, 3, ENC_BIG_ENDIAN);
3609                                                 offset += 3;
3610                                         } else {
3611                                                 offset += 4;
3612                                         }
3613                                         cscd_desc_list_len -= 32;
3614                                         if (cscd_desc_type == 0xEA || cscd_desc_type == 0xEB) { /* both types occupy 64 bytes overall, everything else is 32 bytes */
3615                                                 offset += 32;
3616                                                 cscd_desc_list_len -= 32;
3617                                         }
3618                                 }
3619                         }
3620                         if (seg_desc_list_len > 0) {
3621                                 segs_tree = proto_tree_add_subtree_format(tree, tvb, offset, seg_desc_list_len,
3622                                         ett_scsi_xcopy_segs, NULL, "Segment descriptor list (%u bytes)", seg_desc_list_len);
3623                                 i = 1;
3624                                 while(seg_desc_list_len > 0) {
3625                                         seg_desc_len = tvb_get_ntohs(tvb, offset + 2);
3626                                         seg_tree = proto_tree_add_subtree_format(segs_tree, tvb, offset, seg_desc_len + 4,
3627                                                             ett_scsi_xcopy_seg, NULL, "Segment descriptor #%u", i);
3628                                         i++;
3629                                         proto_tree_add_item(seg_tree, hf_scsi_spc_xcopy_seg_desc_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3630                                         seg_type = tvb_get_guint8(tvb, offset);
3631                                         offset += 1;
3632                                         proto_tree_add_item(seg_tree, hf_scsi_spc_xcopy_seg_desc_dc, tvb, offset, 1, ENC_BIG_ENDIAN);
3633                                         proto_tree_add_item(seg_tree, hf_scsi_spc_xcopy_seg_desc_cat, tvb, offset, 1, ENC_BIG_ENDIAN);
3634                                         offset += 1;
3635                                         proto_tree_add_item(seg_tree, hf_scsi_segment_descriptor_length, tvb, offset, 2, ENC_BIG_ENDIAN);
3636                                         offset += 2;
3637                                         proto_tree_add_item(seg_tree, hf_scsi_spc_xcopy_seg_des_src_desc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3638                                         offset += 2;
3639                                         proto_tree_add_item(seg_tree, hf_scsi_spc_xcopy_seg_des_dest_desc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3640                                         offset += 2;
3641                                         seg_param_tree = proto_tree_add_subtree(seg_tree, tvb, offset, seg_desc_len - 4,
3642                                                             ett_scsi_xcopy_seg_param, NULL, "Segment descriptor parameters");
3643                                         seg_desc_list_len -= (seg_desc_len + 4);
3644                                         if (seg_type == BLOCK_TO_BLOCK) {
3645                                                 proto_tree_add_item(seg_param_tree, hf_scsi_reserved_16, tvb, offset, 2, ENC_BIG_ENDIAN);
3646                                                 offset += 2;
3647                                                 proto_tree_add_item(seg_param_tree, hf_scsi_spc_xcopy_num_of_blocks, tvb, offset, 2, ENC_BIG_ENDIAN);
3648                                                 offset += 2;
3649                                                 proto_tree_add_item(seg_param_tree, hf_scsi_spc_xcopy_source_lba, tvb, offset, 8, ENC_BIG_ENDIAN);
3650                                                 offset += 8;
3651                                                 proto_tree_add_item(seg_param_tree, hf_scsi_spc_xcopy_dest_lba, tvb, offset, 8, ENC_BIG_ENDIAN);
3652                                                 offset += 8;
3653                                         } else {
3654                                                 offset += (seg_desc_len - 4);
3655                                         }
3656                                 }
3657                         }
3658                         if (inline_data_len > 0) {
3659                                 proto_tree_add_item(tree, hf_scsi_inline_data, tvb, offset, inline_data_len, ENC_NA);
3660                                 /*offset += inline_data_len;*/
3661                         }
3662               } else if (serv_action == XCOPY_LID4) {
3663                         proto_tree_add_item(tree, hf_scsi_spc_xcopy_param_list_format, tvb, offset, 1, ENC_BIG_ENDIAN);
3664                         offset += 1;
3665                         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_spc_xcopy_param_byte, ett_xcopy_param_byte, xcopy_param_list_bits, ENC_NA);
3666                         offset += 1;
3667                         proto_tree_add_item(tree, hf_scsi_spc_xcopy_head_cscd_desc_list_len, tvb, offset, 2, ENC_BIG_ENDIAN);
3668                         offset += 2;
3669                         proto_tree_add_item(tree, hf_scsi_spc_xcopy_head_cscd_desc_type_code, tvb, offset, 1, ENC_BIG_ENDIAN);
3670                         /*offset += 1;*/
3671                }
3672        }
3673
3674 }
3675
3676 void dissect_spc_recvcopy(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
3677                     proto_tree *tree _U_, guint offset _U_,
3678                     gboolean isreq _U_, gboolean iscdb _U_,
3679                     guint payload_len _U_, scsi_task_data_t *cdata _U_)
3680 {
3681         guint16 serv_action;
3682         guint8  imp_desc_list_len;
3683
3684         if (isreq && iscdb) {
3685                 proto_tree_add_item(tree, hf_scsi_spc_recv_copy_service, tvb, offset, 1, ENC_BIG_ENDIAN);
3686                 serv_action = tvb_get_guint8(tvb, offset) & 0x1F;
3687                 if (cdata) {
3688                         cdata->itlq->flags = serv_action;
3689                 }
3690                 offset += 1;
3691                 proto_tree_add_item(tree, hf_scsi_reserved_64, tvb, offset, 8, ENC_BIG_ENDIAN);
3692                 offset += 8;
3693                 proto_tree_add_item(tree, hf_scsi_alloclen32, tvb, offset, 4, ENC_BIG_ENDIAN);
3694                 offset += 4;
3695                 proto_tree_add_item(tree, hf_scsi_reserved_8, tvb, offset, 1, ENC_BIG_ENDIAN);
3696                 offset += 1;
3697                 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_control,
3698                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
3699                 offset += 1;
3700
3701         } else {
3702                 if (cdata) {
3703                         serv_action = cdata->itlq->flags;
3704                 }
3705                 else {
3706                         return;
3707                 }
3708                 if (serv_action == RECV_COPY_PARAMS) {
3709                         proto_tree_add_item(tree, hf_scsi_recv_copy_avail_data, tvb, offset, 4, ENC_BIG_ENDIAN);
3710                         offset += 4;
3711                         proto_tree_add_item(tree, hf_scsi_recv_copy_snlid, tvb, offset, 1, ENC_BIG_ENDIAN);
3712                         offset += 1;
3713                         proto_tree_add_item(tree, hf_scsi_reserved_24, tvb, offset, 3, ENC_BIG_ENDIAN);
3714                         offset += 3;
3715                         proto_tree_add_item(tree, hf_scsi_recv_copy_max_cscd_desc_count, tvb, offset, 2, ENC_BIG_ENDIAN);
3716                         offset += 2;
3717                         proto_tree_add_item(tree, hf_scsi_recv_copy_max_seg_desc_count, tvb, offset, 2, ENC_BIG_ENDIAN);
3718                         offset += 2;
3719                         proto_tree_add_item(tree, hf_scsi_recv_copy_max_desc_list_len, tvb, offset, 4, ENC_BIG_ENDIAN);
3720                         offset += 4;
3721                         proto_tree_add_item(tree, hf_scsi_recv_copy_max_seg_len, tvb, offset, 4, ENC_BIG_ENDIAN);
3722                         offset += 4;
3723                         proto_tree_add_item(tree, hf_scsi_recv_copy_max_inline_data_len, tvb, offset, 4, ENC_BIG_ENDIAN);
3724                         offset += 4;
3725                         proto_tree_add_item(tree, hf_scsi_recv_copy_held_data_limit, tvb, offset, 4, ENC_BIG_ENDIAN);
3726                         offset += 4;
3727                         proto_tree_add_item(tree, hf_scsi_recv_copy_max_stream_dev_trans_size, tvb, offset, 4, ENC_BIG_ENDIAN);
3728                         offset += 4;
3729                         proto_tree_add_item(tree, hf_scsi_reserved_16, tvb, offset, 2, ENC_BIG_ENDIAN);
3730                         offset += 2;
3731                         proto_tree_add_item(tree, hf_scsi_recv_copy_total_con_copies, tvb, offset, 2, ENC_BIG_ENDIAN);
3732                         offset += 2;
3733                         proto_tree_add_item(tree, hf_scsi_recv_copy_max_con_copies, tvb, offset, 1, ENC_BIG_ENDIAN);
3734                         offset += 1;
3735                         proto_tree_add_item(tree, hf_scsi_recv_copy_data_seg_gran, tvb, offset, 1, ENC_BIG_ENDIAN);
3736                         offset += 1;
3737                         proto_tree_add_item(tree, hf_scsi_recv_copy_inline_data_gran, tvb, offset, 1, ENC_BIG_ENDIAN);
3738                         offset += 1;
3739                         proto_tree_add_item(tree, hf_scsi_recv_copy_held_data_gran, tvb, offset, 1, ENC_BIG_ENDIAN);
3740                         offset += 1;
3741                         proto_tree_add_item(tree, hf_scsi_reserved_24, tvb, offset, 3, ENC_BIG_ENDIAN);
3742                         offset += 3;
3743                         proto_tree_add_item(tree, hf_scsi_recv_copy_implemented_desc_list_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3744                         imp_desc_list_len = tvb_get_guint8(tvb, offset);
3745                         offset += 1;
3746                         while (imp_desc_list_len > 0) {
3747                                 proto_tree_add_item(tree, hf_scsi_spc_xcopy_cscd_desc_type_code, tvb, offset, 1, ENC_BIG_ENDIAN);
3748                                 offset += 1;
3749                                 imp_desc_list_len--;
3750                         }
3751                 } else {
3752                         proto_tree_add_expert_format(tree, pinfo, &ei_scsi_unknown_serv_action, tvb, offset, 0, "Unknown serv_action %u", serv_action);
3753                 }
3754         }
3755 }
3756
3757
3758 static int
3759 dissect_scsi_log_page(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
3760                       guint offset)
3761 {
3762     static const int *pcflags_fields[] = {
3763         &hf_scsi_log_pagecode,
3764         NULL
3765     };
3766     static const int *paramflags_fields[] = {
3767         &hf_scsi_log_pf_du,
3768         &hf_scsi_log_pf_ds,
3769         &hf_scsi_log_pf_tsd,
3770         &hf_scsi_log_pf_etc,
3771         &hf_scsi_log_pf_tmc,
3772         &hf_scsi_log_pf_lbin,
3773         &hf_scsi_log_pf_lp,
3774         NULL
3775     };
3776     guint16 pagelen, pagecode;
3777     guint8 paramlen;
3778     proto_tree *log_tree;
3779     proto_item *ti;
3780     guint old_offset = offset;
3781     const log_pages_t *log_page;
3782
3783     pagecode = tvb_get_guint8(tvb, offset) & 0x3f;
3784
3785     log_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_scsi_log, &ti,
3786                                 "Log Page: %s", val_to_str(pagecode, scsi_log_page_val, "Unknown (0x%04x)"));
3787
3788     /* page code */
3789     proto_tree_add_bitmask(log_tree, tvb, offset, hf_scsi_log_pc_flags, ett_scsi_log_pc, pcflags_fields, ENC_BIG_ENDIAN);
3790     offset+=1;
3791
3792     /* reserved byte */
3793     offset+=1;
3794
3795     /* page length */
3796     pagelen = tvb_get_ntohs(tvb, offset);
3797     proto_tree_add_item(log_tree, hf_scsi_log_page_length, tvb, offset, 2, ENC_BIG_ENDIAN);
3798     offset+=2;
3799
3800
3801     /* find the appropriate log page */
3802     for(log_page = log_pages;log_page;log_page++) {
3803         if (log_page->parameters == NULL) {
3804             log_page = NULL;
3805             break;
3806         }
3807         if (log_page->page == pagecode) {
3808             break;
3809         }
3810     }
3811
3812     /* loop over all parameters */
3813     while( offset<(old_offset+4+pagelen) ) {
3814         const log_page_parameters_t *log_parameter = NULL;
3815         guint16 log_param;
3816
3817         /* parameter code */
3818         log_param = tvb_get_ntohs(tvb, offset);
3819         proto_tree_add_item(log_tree, hf_scsi_log_parameter_code, tvb, offset, 2, ENC_BIG_ENDIAN);
3820         offset+=2;
3821
3822         /* flags */
3823         proto_tree_add_bitmask(log_tree, tvb, offset, hf_scsi_log_param_flags, ett_scsi_log_param, paramflags_fields, ENC_BIG_ENDIAN);
3824         offset+=1;
3825
3826         /* parameter length */
3827         paramlen = tvb_get_guint8(tvb, offset);
3828         proto_tree_add_item(log_tree, hf_scsi_log_param_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3829         offset+=1;
3830
3831         /* find the log parameter */
3832         if (log_page) {
3833             for(log_parameter = log_page->parameters;log_parameter;log_parameter++) {
3834                 if (log_parameter->dissector == NULL) {
3835                     log_parameter = NULL;
3836                     break;
3837                 }
3838                 if (log_parameter->number == log_param) {
3839                     break;
3840                 }
3841             }
3842         }
3843
3844         /* parameter data */
3845         if (paramlen) {
3846             if (log_parameter && log_parameter->dissector) {
3847                 tvbuff_t *param_tvb;
3848
3849                 param_tvb = tvb_new_subset(tvb, offset, MIN(tvb_reported_length_remaining(tvb, offset),paramlen), paramlen);
3850                 log_parameter->dissector(param_tvb, pinfo, log_tree);
3851             } else {
3852                 /* We did not have a dissector for this page/parameter so
3853                  * just display it as data.
3854                  */
3855                 proto_tree_add_item(log_tree, hf_scsi_log_param_data, tvb, offset, paramlen, ENC_NA);
3856             }
3857             offset+=paramlen;
3858         }
3859     }
3860
3861     proto_item_set_len(ti, offset-old_offset);
3862     return offset;
3863 }
3864
3865 void
3866 dissect_spc_logselect(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
3867                       guint offset, gboolean isreq, gboolean iscdb,
3868                       guint payload_len _U_, scsi_task_data_t *cdata _U_)
3869 {
3870     static const int *ppcflags_fields[] = {
3871         &hf_scsi_log_pcr,
3872         &hf_scsi_log_sp,
3873         NULL
3874     };
3875     static const int *pcflags_fields[] = {
3876         &hf_scsi_log_pc,
3877         NULL
3878     };
3879
3880     if (!tree)
3881         return;
3882
3883     if (isreq && iscdb) {
3884         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_log_ppc_flags,
3885                                ett_scsi_log_ppc, ppcflags_fields, ENC_BIG_ENDIAN);
3886         proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_log_pc_flags, ett_scsi_log_pc, pcflags_fields, ENC_BIG_ENDIAN);
3887         proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
3888         proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
3889                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
3890     }
3891     else {
3892     }
3893 }
3894
3895 static const true_false_string scsi_log_pcr_tfs = {
3896     "Reset all parameters to default values",
3897     "Do not reset log parameters"
3898 };
3899 static const true_false_string scsi_log_ppc_tfs = {
3900     "Return only parameters that have changed since last LOG SELECT/SENSE",
3901     "Return parameters even if they are unchanged"
3902 };
3903 static const true_false_string scsi_log_sp_tfs = {
3904     "Device shall save all log parameters",
3905     "Device should not save any of the logged parameters"
3906 };
3907
3908 void
3909 dissect_spc_logsense(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
3910                      guint offset, gboolean isreq, gboolean iscdb,
3911                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
3912 {
3913     static const int *ppcflags_fields[] = {
3914         &hf_scsi_log_ppc,
3915         &hf_scsi_log_sp,
3916         NULL
3917     };
3918     static const int *pcflags_fields[] = {
3919         &hf_scsi_log_pc,
3920         &hf_scsi_log_pagecode,
3921         NULL
3922     };
3923
3924     if (!tree)
3925         return;
3926
3927     if (isreq && iscdb) {
3928         proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_log_ppc_flags,
3929                                ett_scsi_log_ppc, ppcflags_fields, ENC_BIG_ENDIAN);
3930         proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_log_pc_flags,
3931                                ett_scsi_log_pc, pcflags_fields, ENC_BIG_ENDIAN);
3932         proto_tree_add_item(tree, hf_scsi_log_parameter_ptr, tvb, offset+4,
3933                             2, ENC_BIG_ENDIAN);
3934         proto_tree_add_item(tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
3935         proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
3936                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
3937     } else if (!isreq) {
3938         if (!cdata) {
3939             return;
3940         }
3941         dissect_scsi_log_page(tvb, pinfo, tree, offset);
3942     }
3943 }
3944
3945 static void
3946 dissect_scsi_blockdescs(tvbuff_t *tvb, packet_info *pinfo _U_,
3947                         proto_tree *scsi_tree,
3948                         scsi_task_data_t *cdata, gboolean longlba)
3949 {
3950     int offset = 0;
3951
3952     /* without cdata there is no point in continuing */
3953     if (!cdata)
3954         return;
3955
3956     while (tvb_reported_length_remaining(tvb, offset) > 0) {
3957         if (longlba) {
3958             if (tvb_reported_length_remaining(tvb, offset)<8)
3959                 return;
3960             proto_tree_add_item(scsi_tree, hf_scsi_blockdescs_no_of_blocks64, tvb, offset, 8, ENC_BIG_ENDIAN);
3961             offset += 8;
3962
3963             if (tvb_reported_length_remaining(tvb, offset)<1)
3964                 return;
3965             proto_tree_add_item(scsi_tree, hf_scsi_blockdescs_density_code, tvb, offset, 1, ENC_BIG_ENDIAN);
3966             offset += 1;
3967
3968             /* 3 reserved bytes */
3969             offset += 3;
3970
3971             if (tvb_reported_length_remaining(tvb, offset)<4)
3972                 return;
3973             proto_tree_add_item(scsi_tree, hf_scsi_blockdescs_block_length32, tvb, offset, 4, ENC_BIG_ENDIAN);
3974             offset += 4;
3975         } else {
3976             if ((cdata->itl->cmdset&SCSI_CMDSET_MASK) == SCSI_DEV_SBC) {
3977                 if (tvb_reported_length_remaining(tvb, offset)<4)
3978                     return;
3979                 proto_tree_add_item(scsi_tree, hf_scsi_blockdescs_no_of_blocks32, tvb, offset, 4, ENC_BIG_ENDIAN);
3980                 offset += 4;
3981
3982                 offset++;  /* reserved */
3983
3984                 if (tvb_reported_length_remaining(tvb, offset)<3)
3985                     return;
3986                 proto_tree_add_item(scsi_tree, hf_scsi_blockdescs_block_length24, tvb, offset, 3, ENC_BIG_ENDIAN);
3987                 offset += 3;
3988             } else {
3989                 if (tvb_reported_length_remaining(tvb, offset)<1)
3990                     return;
3991                 proto_tree_add_item(scsi_tree, hf_scsi_blockdescs_density_code, tvb, offset, 1, ENC_BIG_ENDIAN);
3992                 offset += 1;
3993
3994                 if (tvb_reported_length_remaining(tvb, offset)<3)
3995                     return;
3996                 proto_tree_add_item(scsi_tree, hf_scsi_blockdescs_no_of_blocks24, tvb, offset, 3, ENC_BIG_ENDIAN);
3997                 offset += 3;
3998
3999                 offset++; /* reserved */
4000
4001                 if (tvb_reported_length_remaining(tvb, offset)<3)
4002                     return;
4003                 proto_tree_add_item(scsi_tree, hf_scsi_blockdescs_block_length24, tvb, offset, 3, ENC_BIG_ENDIAN);
4004                 offset += 3;
4005             }
4006         }
4007     }
4008 }
4009
4010 static gboolean
4011 dissect_scsi_spc_modepage(tvbuff_t *tvb, packet_info *pinfo _U_,
4012                           proto_tree *tree, guint offset, guint8 pcode, guint8 spf, guint8 subpcode)
4013 {
4014     guint8 flags, proto;
4015
4016     switch (pcode) {
4017     case SCSI_SPC_MODEPAGE_CTL:
4018         if (!spf) {
4019             /* standard page for control */
4020             proto_tree_add_item(tree, hf_scsi_modesns_tst, tvb, offset+2, 1, ENC_BIG_ENDIAN);
4021             proto_tree_add_item(tree, hf_scsi_spc_modepage_gltsd, tvb, offset+2, 1, ENC_BIG_ENDIAN);
4022             proto_tree_add_item(tree, hf_scsi_spc_modepage_report_log_exception_condition, tvb, offset+2, 1, ENC_NA);
4023             proto_tree_add_item(tree, hf_scsi_modesns_qmod, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4024             proto_tree_add_item(tree, hf_scsi_modesns_qerr, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4025             proto_tree_add_item(tree, hf_scsi_spc_modepage_disable_queuing, tvb, offset+3, 1, ENC_NA);
4026             proto_tree_add_item(tree, hf_scsi_modesns_rac, tvb, offset+4, 1, ENC_BIG_ENDIAN);
4027             proto_tree_add_item(tree, hf_scsi_modesns_tas, tvb, offset+4, 1, ENC_BIG_ENDIAN);
4028             proto_tree_add_item(tree, hf_scsi_spc_modepage_swp, tvb, offset+4, 1, ENC_NA);
4029             proto_tree_add_item(tree, hf_scsi_spc_modepage_autoload_mode, tvb, offset+5, 1, ENC_BIG_ENDIAN);
4030             proto_tree_add_item(tree, hf_scsi_spc_modepage_ready_aer_holdoff_period, tvb, offset+6, 2, ENC_BIG_ENDIAN);
4031             proto_tree_add_uint(tree, hf_scsi_spc_modepage_busy_timeout_period, tvb, offset+8, 2,
4032                                 tvb_get_ntohs(tvb, offset+8)*100);
4033             proto_tree_add_item(tree, hf_scsi_spc_modepage_extended_self_test_completion_time, tvb, offset+10, 2, ENC_BIG_ENDIAN);
4034         } else {
4035             switch (subpcode) {
4036             case 1:
4037                 /* control extension subpage */
4038                 proto_item_append_text(tree, " Control Extension");
4039
4040                 /* TCMOS SCSIP IALUAE */
4041                 proto_tree_add_item(tree, hf_scsi_modepage_tcmos, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
4042                 proto_tree_add_item(tree, hf_scsi_modepage_scsip, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
4043                 proto_tree_add_item(tree, hf_scsi_modepage_ialuae, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
4044
4045                 /* Initial Command Priority */
4046                 proto_tree_add_item(tree, hf_scsi_modepage_icp, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
4047
4048                 /* Maximum Sense Data Length */
4049                 proto_tree_add_item(tree, hf_scsi_modepage_msdl, tvb, offset + 6, 1, ENC_BIG_ENDIAN);
4050
4051                 break;
4052             }
4053         }
4054         break;
4055     case SCSI_SPC_MODEPAGE_DISCON:
4056         proto_tree_add_item(tree, hf_scsi_spc_modepage_buffer_full_ratio, tvb, offset+2, 1, ENC_BIG_ENDIAN);
4057         proto_tree_add_item(tree, hf_scsi_spc_modepage_buffer_empty_ratio, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4058         proto_tree_add_item(tree, hf_scsi_spc_modepage_bus_inactivity_limit, tvb, offset+4, 2, ENC_BIG_ENDIAN);
4059         proto_tree_add_item(tree, hf_scsi_spc_modepage_disconnect_time_limit, tvb, offset+6, 2, ENC_BIG_ENDIAN);
4060         proto_tree_add_item(tree, hf_scsi_spc_modepage_connect_time_limit, tvb, offset+8, 2, ENC_BIG_ENDIAN);
4061         proto_tree_add_uint(tree, hf_scsi_spc_modepage_maximum_burst_size, tvb, offset+10, 2,
4062                             tvb_get_ntohs(tvb, offset+10)*512);
4063         proto_tree_add_item(tree, hf_scsi_spc_modepage_emdp, tvb, offset+12, 1, ENC_NA);
4064         proto_tree_add_item(tree, hf_scsi_spc_modepage_faa, tvb, offset+12, 1, ENC_NA);
4065         proto_tree_add_item(tree, hf_scsi_spc_modepage_fab, tvb, offset+12, 1, ENC_NA);
4066         proto_tree_add_item(tree, hf_scsi_spc_modepage_fac, tvb, offset+12, 1, ENC_NA);
4067         proto_tree_add_uint(tree, hf_scsi_spc_modepage_first_burst_size, tvb, offset+14, 2,
4068                             tvb_get_ntohs(tvb, offset+14)*512);
4069         break;
4070     case SCSI_SPC_MODEPAGE_INFOEXCP:
4071         flags = tvb_get_guint8(tvb, offset+2);
4072         proto_tree_add_item(tree, hf_scsi_spc_modepage_perf, tvb, offset+2, 1, ENC_NA);
4073         proto_tree_add_item(tree, hf_scsi_spc_modepage_ebf, tvb, offset+2, 1, ENC_NA);
4074         proto_tree_add_item(tree, hf_scsi_spc_modepage_ewasc, tvb, offset+2, 1, ENC_NA);
4075         proto_tree_add_item(tree, hf_scsi_spc_modepage_dexcpt, tvb, offset+2, 1, ENC_NA);
4076         proto_tree_add_item(tree, hf_scsi_spc_modepage_test, tvb, offset+2, 1, ENC_NA);
4077         proto_tree_add_item(tree, hf_scsi_spc_modepage_logerr, tvb, offset+2, 1, ENC_NA);
4078         if (!((flags & 0x10) >> 4) && ((flags & 0x08) >> 3)) {
4079             proto_item *hidden_item;
4080             hidden_item = proto_tree_add_item(tree, hf_scsi_modesns_errrep, tvb,
4081                                               offset+3, 1, ENC_BIG_ENDIAN);
4082             PROTO_ITEM_SET_HIDDEN(hidden_item);
4083         }
4084         else {
4085             proto_tree_add_item(tree, hf_scsi_modesns_errrep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4086         }
4087         proto_tree_add_item(tree, hf_scsi_spc_modepage_interval_timer, tvb, offset+4, 4, ENC_BIG_ENDIAN);
4088         proto_tree_add_item(tree, hf_scsi_spc_modepage_report_count, tvb, offset+8, 4, ENC_BIG_ENDIAN);
4089         break;
4090     case SCSI_SPC_MODEPAGE_PWR:
4091         proto_tree_add_item(tree, hf_scsi_spc_modepage_idle, tvb, offset+3, 1, ENC_NA);
4092         proto_tree_add_item(tree, hf_scsi_spc_modepage_standby, tvb, offset+3, 1, ENC_NA);
4093         proto_tree_add_uint(tree, hf_scsi_spc_modepage_idle_condition_timer, tvb, offset+4, 2,
4094                             tvb_get_ntohs(tvb, offset+4) * 100);
4095         proto_tree_add_uint(tree, hf_scsi_spc_modepage_standby_condition_timer, tvb, offset+6, 2,
4096                             tvb_get_ntohs(tvb, offset+6) * 100);
4097         break;
4098     case SCSI_SPC_MODEPAGE_LUN:
4099         return FALSE;
4100     case SCSI_SPC_MODEPAGE_PORT:
4101         proto = tvb_get_guint8(tvb, offset+2) & 0x0F;
4102         proto_tree_add_item(tree, hf_scsi_protocol, tvb, offset+2, 1, ENC_BIG_ENDIAN);
4103         if (proto == SCSI_PROTO_FCP) {
4104             proto_tree_add_item(tree, hf_scsi_spc_modepage_dtfd, tvb, offset+3, 1, ENC_NA);
4105             proto_tree_add_item(tree, hf_scsi_spc_modepage_plpb, tvb, offset+3, 1, ENC_NA);
4106             proto_tree_add_item(tree, hf_scsi_spc_modepage_ddis, tvb, offset+3, 1, ENC_NA);
4107             proto_tree_add_item(tree, hf_scsi_spc_modepage_dlm, tvb, offset+3, 1, ENC_NA);
4108             proto_tree_add_item(tree, hf_scsi_spc_modepage_rha, tvb, offset+3, 1, ENC_NA);
4109             proto_tree_add_item(tree, hf_scsi_spc_modepage_alwi, tvb, offset+3, 1, ENC_NA);
4110             proto_tree_add_item(tree, hf_scsi_spc_modepage_dtipe, tvb, offset+3, 1, ENC_NA);
4111             proto_tree_add_item(tree, hf_scsi_spc_modepage_dtoli, tvb, offset+3, 1, ENC_NA);
4112             proto_tree_add_item(tree, hf_scsi_spc_modepage_rr_tov_units, tvb, offset+6, 1, ENC_BIG_ENDIAN);
4113             proto_tree_add_item(tree, hf_scsi_spc_modepage_rr_tov, tvb, offset+7, 1, ENC_BIG_ENDIAN);
4114         }
4115         else if (proto == SCSI_PROTO_iSCSI) {
4116             return FALSE;
4117         }
4118         else {
4119             return FALSE;
4120         }
4121         break;
4122     case SCSI_SCSI2_MODEPAGE_PERDEV:
4123         return FALSE;
4124     default:
4125         return FALSE;
4126     }
4127     return TRUE;
4128 }
4129
4130 static gboolean
4131 dissect_scsi_sbc_modepage(tvbuff_t *tvb, packet_info *pinfo _U_,
4132                           proto_tree *tree, guint offset, guint8 pcode, guint8 spf _U_, guint8 subpcode _U_)
4133 {
4134     switch (pcode) {
4135     case SCSI_SBC_MODEPAGE_FMTDEV:
4136         proto_tree_add_item(tree, hf_scsi_sbc_modepage_tracks_per_zone, tvb, offset+2, 2, ENC_BIG_ENDIAN);
4137         proto_tree_add_item(tree, hf_scsi_sbc_modepage_alternate_sectors_per_zone, tvb, offset+4, 2, ENC_BIG_ENDIAN);
4138         proto_tree_add_item(tree, hf_scsi_sbc_modepage_alternate_tracks_per_zone, tvb, offset+6, 2, ENC_BIG_ENDIAN);
4139         proto_tree_add_item(tree, hf_scsi_sbc_modepage_alternate_tracks_per_lu, tvb, offset+8, 2, ENC_BIG_ENDIAN);
4140         proto_tree_add_item(tree, hf_scsi_sbc_modepage_sectors_per_track, tvb, offset+10, 2, ENC_BIG_ENDIAN);
4141         proto_tree_add_item(tree, hf_scsi_sbc_modepage_data_bytes_per_physical_sector, tvb, offset+12, 2, ENC_BIG_ENDIAN);
4142         proto_tree_add_item(tree, hf_scsi_sbc_modepage_interleave, tvb, offset+14, 2, ENC_BIG_ENDIAN);
4143         proto_tree_add_item(tree, hf_scsi_sbc_modepage_track_skew_factor, tvb, offset+16, 2, ENC_BIG_ENDIAN);
4144         proto_tree_add_item(tree, hf_scsi_sbc_modepage_cylinder_skew_factor, tvb, offset+18, 2, ENC_BIG_ENDIAN);
4145         proto_tree_add_item(tree, hf_scsi_sbc_modepage_ssec, tvb, offset+20, 1, ENC_NA);
4146         proto_tree_add_item(tree, hf_scsi_sbc_modepage_hsec, tvb, offset+20, 1, ENC_NA);
4147         proto_tree_add_item(tree, hf_scsi_sbc_modepage_rmb, tvb, offset+20, 1, ENC_NA);
4148         proto_tree_add_item(tree, hf_scsi_sbc_modepage_surf, tvb, offset+20, 1, ENC_NA);
4149         break;
4150     case SCSI_SBC_MODEPAGE_RDWRERR:
4151         proto_tree_add_item(tree, hf_scsi_sbc_modepage_awre, tvb, offset+2, 1, ENC_NA);
4152         proto_tree_add_item(tree, hf_scsi_sbc_modepage_arre, tvb, offset+2, 1, ENC_NA);
4153         proto_tree_add_item(tree, hf_scsi_sbc_modepage_tb, tvb, offset+2, 1, ENC_NA);
4154         proto_tree_add_item(tree, hf_scsi_sbc_modepage_rc, tvb, offset+2, 1, ENC_NA);
4155         proto_tree_add_item(tree, hf_scsi_sbc_modepage_eer, tvb, offset+2, 1, ENC_NA);
4156         proto_tree_add_item(tree, hf_scsi_sbc_modepage_per, tvb, offset+2, 1, ENC_NA);
4157         proto_tree_add_item(tree, hf_scsi_sbc_modepage_dte, tvb, offset+2, 1, ENC_NA);
4158         proto_tree_add_item(tree, hf_scsi_sbc_modepage_dcr, tvb, offset+2, 1, ENC_NA);
4159         proto_tree_add_item(tree, hf_scsi_sbc_modepage_read_retry_count, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4160         proto_tree_add_item(tree, hf_scsi_sbc_modepage_correction_span, tvb, offset+4, 1, ENC_BIG_ENDIAN);
4161         proto_tree_add_item(tree, hf_scsi_sbc_modepage_head_offset_count, tvb, offset+5, 1, ENC_BIG_ENDIAN);
4162         proto_tree_add_item(tree, hf_scsi_sbc_modepage_data_strobe_offset_count, tvb, offset+6, 1, ENC_BIG_ENDIAN);
4163         proto_tree_add_item(tree, hf_scsi_sbc_modepage_write_retry_count, tvb, offset+8, 1, ENC_BIG_ENDIAN);
4164         proto_tree_add_item(tree, hf_scsi_sbc_modepage_recovery_time_limit, tvb, offset+10, 2, ENC_BIG_ENDIAN);
4165         break;
4166     case SCSI_SBC_MODEPAGE_DISKGEOM:
4167         proto_tree_add_item(tree, hf_scsi_sbc_modepage_number_of_cylinders, tvb, offset+2, 3, ENC_BIG_ENDIAN);
4168         proto_tree_add_item(tree, hf_scsi_sbc_modepage_number_of_heads, tvb, offset+5, 1, ENC_BIG_ENDIAN);
4169         proto_tree_add_item(tree, hf_scsi_sbc_modepage_starting_cyl_pre_compensation, tvb, offset+6, 3, ENC_BIG_ENDIAN);
4170         proto_tree_add_item(tree, hf_scsi_sbc_modepage_starting_cyl_reduced_write_current, tvb, offset+9, 3, ENC_BIG_ENDIAN);
4171         proto_tree_add_item(tree, hf_scsi_sbc_modepage_device_step_rate, tvb, offset+12, 2, ENC_BIG_ENDIAN);
4172         proto_tree_add_item(tree, hf_scsi_sbc_modepage_landing_zone_cyl, tvb, offset+14, 3, ENC_BIG_ENDIAN);
4173         proto_tree_add_item(tree, hf_scsi_sbc_modepage_rotational_offset, tvb, offset+18, 1, ENC_BIG_ENDIAN);
4174         proto_tree_add_item(tree, hf_scsi_sbc_modepage_medium_rotation_rate, tvb, offset+20, 2, ENC_BIG_ENDIAN);
4175         break;
4176     case SCSI_SBC_MODEPAGE_FLEXDISK:
4177         return FALSE;
4178     case SCSI_SBC_MODEPAGE_VERERR:
4179         return FALSE;
4180     case SCSI_SBC_MODEPAGE_CACHE:
4181         proto_tree_add_item(tree, hf_scsi_sbc_modepage_ic, tvb, offset+2, 1, ENC_NA);
4182         proto_tree_add_item(tree, hf_scsi_sbc_modepage_abpf, tvb, offset+2, 1, ENC_NA);
4183         proto_tree_add_item(tree, hf_scsi_sbc_modepage_cap, tvb, offset+2, 1, ENC_NA);
4184         proto_tree_add_item(tree, hf_scsi_sbc_modepage_disc, tvb, offset+2, 1, ENC_NA);
4185         proto_tree_add_item(tree, hf_scsi_sbc_modepage_size, tvb, offset+2, 1, ENC_NA);
4186         proto_tree_add_item(tree, hf_scsi_sbc_modepage_wce, tvb, offset+2, 1, ENC_NA);
4187         proto_tree_add_item(tree, hf_scsi_sbc_modepage_mf, tvb, offset+2, 1, ENC_NA);
4188         proto_tree_add_item(tree, hf_scsi_sbc_modepage_rcd, tvb, offset+2, 1, ENC_NA);
4189         proto_tree_add_item(tree, hf_scsi_sbc_modepage_demand_read_retention_priority, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4190         proto_tree_add_item(tree, hf_scsi_sbc_modepage_write_retention_priority, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4191         proto_tree_add_item(tree, hf_scsi_sbc_modepage_disable_pre_fetch_xfer_len, tvb, offset+4, 2, ENC_BIG_ENDIAN);
4192         proto_tree_add_item(tree, hf_scsi_sbc_modepage_minimum_pre_fetch, tvb, offset+6, 2, ENC_BIG_ENDIAN);
4193         proto_tree_add_item(tree, hf_scsi_sbc_modepage_maximum_pre_fetch, tvb, offset+8, 2, ENC_BIG_ENDIAN);
4194         proto_tree_add_item(tree, hf_scsi_sbc_modepage_maximum_pre_fetch_ceiling, tvb, offset+10, 2, ENC_BIG_ENDIAN);
4195         proto_tree_add_item(tree, hf_scsi_sbc_modepage_fsw, tvb, offset+12, 1, ENC_NA);
4196         proto_tree_add_item(tree, hf_scsi_sbc_modepage_lbcss, tvb, offset+12, 1, ENC_NA);
4197         proto_tree_add_item(tree, hf_scsi_sbc_modepage_dra, tvb, offset+12, 1, ENC_NA);
4198         proto_tree_add_item(tree, hf_scsi_sbc_modepage_vendor_specific, tvb, offset+12, 1, ENC_BIG_ENDIAN);
4199         proto_tree_add_item(tree, hf_scsi_sbc_modepage_number_of_cache_segments, tvb, offset+13, 1, ENC_BIG_ENDIAN);
4200         proto_tree_add_item(tree, hf_scsi_sbc_modepage_cache_segment_size, tvb, offset+14, 2, ENC_BIG_ENDIAN);
4201         proto_tree_add_item(tree, hf_scsi_sbc_modepage_non_cache_segment_size, tvb, offset+17, 3, ENC_BIG_ENDIAN);
4202         break;
4203     case SCSI_SBC_MODEPAGE_MEDTYPE:
4204         return FALSE;
4205     case SCSI_SBC_MODEPAGE_NOTPART:
4206         return FALSE;
4207     case SCSI_SBC_MODEPAGE_XORCTL:
4208         return FALSE;
4209     default:
4210         return FALSE;
4211     }
4212     return TRUE;
4213 }
4214
4215 static const value_string compression_algorithm_vals[] = {
4216     {0x00, "No algorithm selected"},
4217     {0x01, "Default algorithm"},
4218     {0x03, "IBM ALDC with 512-byte buffer"},
4219     {0x04, "IBM ALDC with 1024-byte buffer"},
4220     {0x05, "IBM ALDC with 2048-byte buffer"},
4221     {0x10, "IBM IDRC"},
4222     {0x20, "DCLZ"},
4223     {0xFF, "Unregistered algorithm"},
4224     {0, NULL}
4225 };
4226
4227 static gboolean
4228 dissect_scsi_ssc2_modepage(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
4229                            proto_tree *tree _U_, guint offset _U_,
4230                            guint8 pcode, guint8 spf _U_, guint8 subpcode _U_)
4231 {
4232     switch (pcode) {
4233     case SCSI_SSC2_MODEPAGE_DATACOMP:
4234         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_dce, tvb, offset+2, 1, ENC_NA);
4235         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_dcc, tvb, offset+2, 1, ENC_NA);
4236         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_dde, tvb, offset+3, 1, ENC_NA);
4237         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_red, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4238         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_compression_algorithm, tvb, offset+4, 4, ENC_BIG_ENDIAN);
4239         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_decompression_algorithm, tvb, offset+8, 4, ENC_BIG_ENDIAN);
4240         break;
4241     case SCSI_SSC2_MODEPAGE_DEVCONF:
4242         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_caf, tvb, offset+2, 1, ENC_NA);
4243         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_active_format, tvb, offset+2, 1, ENC_BIG_ENDIAN);
4244         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_active_partition, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4245         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_write_object_buffer_full_ratio, tvb, offset+4, 1, ENC_BIG_ENDIAN);
4246         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_read_object_buffer_empty_ratio, tvb, offset+5, 1, ENC_BIG_ENDIAN);
4247         proto_tree_add_uint_format_value(tree, hf_scsi_ssc2_modepage_write_delay_time, tvb, offset+6, 2,
4248                             tvb_get_ntohs(tvb, offset+6), "%u 100ms",
4249                             tvb_get_ntohs(tvb, offset+6));
4250         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_obr, tvb, offset+8, 1, ENC_NA);
4251         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_lois, tvb, offset+8, 1, ENC_NA);
4252         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_rsmk, tvb, offset+8, 1, ENC_NA);
4253         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_avc, tvb, offset+8, 1, ENC_NA);
4254         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_socf, tvb, offset+8, 1, ENC_BIG_ENDIAN);
4255         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_robo, tvb, offset+8, 1, ENC_NA);
4256         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_rew, tvb, offset+8, 1, ENC_NA);
4257         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_gap_size, tvb, offset+9, 1, ENC_BIG_ENDIAN);
4258         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_eod_defined, tvb, offset+10, 1, ENC_BIG_ENDIAN);
4259         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_eeg, tvb, offset+10, 1, ENC_NA);
4260         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_sew, tvb, offset+10, 1, ENC_NA);
4261         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_swp, tvb, offset+10, 1, ENC_NA);
4262         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_baml, tvb, offset+10, 1, ENC_NA);
4263         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_bam, tvb, offset+10, 1, ENC_NA);
4264         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_object_buffer_size_at_early_warning, tvb, offset+11, 3, ENC_BIG_ENDIAN);
4265         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_select_data_compression_algorithm, tvb, offset+14, 1, ENC_BIG_ENDIAN);
4266         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_oir, tvb, offset+15, 1, ENC_NA);
4267         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_rewind_on_reset, tvb, offset+15, 1, ENC_BIG_ENDIAN);
4268         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_asocwp, tvb, offset+15, 1, ENC_NA);
4269         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_perswp, tvb, offset+15, 1, ENC_NA);
4270         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_prmwp, tvb, offset+15, 1, ENC_NA);
4271         break;
4272     case SCSI_SSC2_MODEPAGE_MEDPAR1:
4273         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_maximum_additional_partitions, tvb, offset+2, 1, ENC_BIG_ENDIAN);
4274         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_additional_partitions_defined, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4275         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_fdp, tvb, offset+4, 1, ENC_NA);
4276         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_dsp, tvb, offset+4, 1, ENC_NA);
4277         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_idp, tvb, offset+4, 1, ENC_NA);
4278         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_psum, tvb, offset+4, 1, ENC_BIG_ENDIAN);
4279         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_pofm, tvb, offset+4, 1, ENC_NA);
4280         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_clear, tvb, offset+4, 1, ENC_NA);
4281         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_addp, tvb, offset+4, 1, ENC_NA);
4282         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_media_format_recognition, tvb, offset+5, 1, ENC_BIG_ENDIAN);
4283         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_partition_units, tvb, offset+6, 1, ENC_BIG_ENDIAN);
4284         proto_tree_add_item(tree, hf_scsi_ssc2_modepage_partition_size, tvb, offset+8, 2, ENC_BIG_ENDIAN);
4285         break;
4286     case SCSI_SSC2_MODEPAGE_MEDPAR2:
4287         return FALSE;
4288     case SCSI_SSC2_MODEPAGE_MEDPAR3:
4289         return FALSE;
4290     case SCSI_SSC2_MODEPAGE_MEDPAR4:
4291         return FALSE;
4292     default:
4293         return FALSE;
4294     }
4295     return TRUE;
4296 }
4297
4298 static gboolean
4299 dissect_scsi_mmc5_modepage(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
4300                            proto_tree *tree _U_, guint offset _U_, guint8 pcode, guint8 spf _U_, guint8 subpcode _U_)
4301 {
4302     guint8  flags;
4303     guint8  i;
4304
4305     switch (pcode) {
4306     case SCSI_MMC5_MODEPAGE_MRW:
4307         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_lba_space, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4308         break;
4309     case SCSI_MMC5_MODEPAGE_WRPARAM:
4310         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_bufe, tvb, offset+2, 1, ENC_NA);
4311         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_ls_v, tvb, offset+2, 1, ENC_NA);
4312         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_wrparam_test_write, tvb, offset+2, 1, ENC_NA);
4313         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_write_type, tvb, offset+2, 1, ENC_BIG_ENDIAN);
4314         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_wrparam_multi_session, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4315         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_fp, tvb, offset+3, 1, ENC_NA);
4316         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_copy, tvb, offset+3, 1, ENC_NA);
4317         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_track_mode, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4318         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_data_block_type, tvb, offset+4, 1, ENC_BIG_ENDIAN);
4319         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_link_size, tvb, offset+5, 1, ENC_BIG_ENDIAN);
4320         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_initiator_application_code, tvb, offset+7, 1, ENC_BIG_ENDIAN);
4321         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_session_format, tvb, offset+8, 1, ENC_BIG_ENDIAN);
4322         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_packet_size, tvb, offset+10, 4, ENC_BIG_ENDIAN);
4323         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_audio_pause_length, tvb, offset+14, 2, ENC_BIG_ENDIAN);
4324         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_media_catalog_number, tvb, offset+16, 16, ENC_NA|ENC_ASCII);
4325         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_international_standard_recording_code, tvb, offset+32, 16, ENC_NA|ENC_ASCII);
4326         for (i = 0; i < 4; i++) {
4327             flags = tvb_get_guint8(tvb, offset+48+i);
4328             proto_tree_add_uint_format(tree, hf_scsi_mmc5_modepage_sub_header_byte, tvb, offset+48+i, 1, flags,
4329                                 "Sub-header Byte %u: %u", i, flags);
4330         }
4331         if (0x36 == tvb_get_guint8(tvb, offset+1))
4332             proto_tree_add_item(tree, hf_scsi_mmc5_modepage_vendor_specific, tvb, offset+52, 4, ENC_BIG_ENDIAN);
4333         break;
4334     case SCSI_MMC3_MODEPAGE_MMCAP:
4335         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_dvd_ram_read, tvb, offset+2, 1, ENC_NA);
4336         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_dvd_r_read, tvb, offset+2, 1, ENC_NA);
4337         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_dvd_rom_read, tvb, offset+2, 1, ENC_NA);
4338         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_method_2, tvb, offset+2, 1, ENC_NA);
4339         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_cd_rw_read, tvb, offset+2, 1, ENC_NA);
4340         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_cd_r_read, tvb, offset+2, 1, ENC_NA);
4341         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_dvd_ram_write, tvb, offset+3, 1, ENC_NA);
4342         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_dvd_r_write, tvb, offset+3, 1, ENC_NA);
4343         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_dvd_rom_write, tvb, offset+3, 1, ENC_NA);
4344         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_mmcap_test_write, tvb, offset+3, 1, ENC_NA);
4345         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_cd_rw_write, tvb, offset+3, 1, ENC_NA);
4346         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_cd_r_write, tvb, offset+3, 1, ENC_NA);
4347         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_buf, tvb, offset+4, 1, ENC_NA);
4348         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_mmcap_multi_session, tvb, offset+4, 1, ENC_NA);
4349         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_mode_2_form2, tvb, offset+4, 1, ENC_NA);
4350         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_mode_2_form1, tvb, offset+4, 1, ENC_NA);
4351         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_digital_port2, tvb, offset+4, 1, ENC_NA);
4352         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_digital_port1, tvb, offset+4, 1, ENC_NA);
4353         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_composite, tvb, offset+4, 1, ENC_NA);
4354         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_audio_play, tvb, offset+4, 1, ENC_NA);
4355         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_read_bar_code, tvb, offset+5, 1, ENC_NA);
4356         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_upc, tvb, offset+5, 1, ENC_NA);
4357         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_isrc, tvb, offset+5, 1, ENC_NA);
4358         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_c2_pointers_supported, tvb, offset+5, 1, ENC_NA);
4359         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_rw_deinterleaved_corrected, tvb, offset+5, 1, ENC_NA);
4360         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_rw_supported, tvb, offset+5, 1, ENC_NA);
4361         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_cd_da_stream_is_accurate, tvb, offset+5, 1, ENC_NA);
4362         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_cd_da_cmds_supported, tvb, offset+5, 1, ENC_NA);
4363         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_loading_mechanism_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
4364         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_eject, tvb, offset+6, 1, ENC_NA);
4365         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_prevent_jumper, tvb, offset+6, 1, ENC_NA);
4366         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_lock_state, tvb, offset+6, 1, ENC_NA);
4367         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_lock, tvb, offset+6, 1, ENC_NA);
4368         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_rw_in_lead_in, tvb, offset+7, 1, ENC_NA);
4369         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_side_change_capable, tvb, offset+7, 1, ENC_NA);
4370         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_sw_slot_selection, tvb, offset+7, 1, ENC_NA);
4371         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_changer_supports_disc_present, tvb, offset+7, 1, ENC_NA);
4372         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_separate_channel_mute, tvb, offset+7, 1, ENC_NA);
4373         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_separate_volume_levels, tvb, offset+7, 1, ENC_NA);
4374         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_number_of_volume_levels_supported, tvb, offset+10, 2, ENC_BIG_ENDIAN);
4375         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_buffer_size_supported, tvb, offset+12, 2, ENC_BIG_ENDIAN);
4376         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_length, tvb, offset+17, 1, ENC_BIG_ENDIAN);
4377         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_lsbf, tvb, offset+17, 1, ENC_BIG_ENDIAN);
4378         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_rck, tvb, offset+17, 1, ENC_NA);
4379         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_bckf, tvb, offset+17, 1, ENC_NA);
4380         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_copy_management_revision_support, tvb, offset+22, 2, ENC_BIG_ENDIAN);
4381         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_rotation_control_selected, tvb, offset+27, 1, ENC_BIG_ENDIAN);
4382         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_current_write_speed_selected, tvb, offset+28, 2, ENC_BIG_ENDIAN);
4383         proto_tree_add_item(tree, hf_scsi_mmc5_modepage_num_write_speed_performance, tvb, offset+30, 2, ENC_BIG_ENDIAN);
4384         break;
4385     default:
4386         return FALSE;
4387     }
4388     return TRUE;
4389 }
4390
4391 static gboolean
4392 dissect_scsi_smc_modepage(tvbuff_t *tvb, packet_info *pinfo _U_,
4393                           proto_tree *tree, guint offset, guint8 pcode, guint8 spf _U_, guint8 subpcode _U_)
4394 {
4395     guint8 param_list_len;
4396
4397     switch (pcode) {
4398     case SCSI_SMC_MODEPAGE_EAA:
4399         param_list_len = tvb_get_guint8(tvb, offset+1);
4400         if (param_list_len < 2)
4401             break;
4402         proto_tree_add_item(tree, hf_scsi_smc_modepage_first_medium_transport_element_address, tvb, offset+2, 2, ENC_BIG_ENDIAN);
4403         param_list_len -= 2;
4404         if (param_list_len < 2)
4405             break;
4406         proto_tree_add_item(tree, hf_scsi_smc_modepage_number_of_medium_transport_elements, tvb, offset+4, 2, ENC_BIG_ENDIAN);
4407         param_list_len -= 2;
4408         if (param_list_len < 2)
4409             break;
4410         proto_tree_add_item(tree, hf_scsi_smc_modepage_first_storage_element_address, tvb, offset+6, 2, ENC_BIG_ENDIAN);
4411         param_list_len -= 2;
4412         if (param_list_len < 2)
4413             break;
4414         proto_tree_add_item(tree, hf_scsi_smc_modepage_number_of_storage_elements, tvb, offset+8, 2, ENC_BIG_ENDIAN);
4415         param_list_len -= 2;
4416         if (param_list_len < 2)
4417             break;
4418         proto_tree_add_item(tree, hf_scsi_smc_modepage_first_import_export_element_address, tvb, offset+10, 2, ENC_BIG_ENDIAN);
4419         param_list_len -= 2;
4420         if (param_list_len < 2)
4421             break;
4422         proto_tree_add_item(tree, hf_scsi_smc_modepage_number_of_import_export_elements, tvb, offset+12, 2, ENC_BIG_ENDIAN);
4423         param_list_len -= 2;
4424         if (param_list_len < 2)
4425             break;
4426         proto_tree_add_item(tree, hf_scsi_smc_modepage_first_data_transfer_element_address, tvb, offset+14, 2, ENC_BIG_ENDIAN);
4427         param_list_len -= 2;
4428         if (param_list_len < 2)
4429             break;
4430         proto_tree_add_item(tree, hf_scsi_smc_modepage_number_of_data_transfer_elements, tvb, offset+16, 2, ENC_BIG_ENDIAN);
4431         break;
4432     case SCSI_SMC_MODEPAGE_TRANGEOM:
4433         return FALSE;
4434     case SCSI_SMC_MODEPAGE_DEVCAP:
4435         proto_tree_add_item(tree, hf_scsi_smc_modepage_stordt, tvb, offset+2, 1, ENC_NA);
4436         proto_tree_add_item(tree, hf_scsi_smc_modepage_storie, tvb, offset+2, 1, ENC_NA);
4437         proto_tree_add_item(tree, hf_scsi_smc_modepage_storst, tvb, offset+2, 1, ENC_NA);
4438         proto_tree_add_item(tree, hf_scsi_smc_modepage_stormt, tvb, offset+2, 1, ENC_NA);
4439         proto_tree_add_item(tree, hf_scsi_smc_modepage_mt_dt, tvb, offset+4, 1, ENC_NA);
4440         proto_tree_add_item(tree, hf_scsi_smc_modepage_mt_ie, tvb, offset+4, 1, ENC_NA);
4441         proto_tree_add_item(tree, hf_scsi_smc_modepage_mt_st, tvb, offset+4, 1, ENC_NA);
4442         proto_tree_add_item(tree, hf_scsi_smc_modepage_mt_mt, tvb, offset+4, 1, ENC_NA);
4443         proto_tree_add_item(tree, hf_scsi_smc_modepage_st_dt, tvb, offset+5, 1, ENC_NA);
4444         proto_tree_add_item(tree, hf_scsi_smc_modepage_st_ie, tvb, offset+5, 1, ENC_NA);
4445         proto_tree_add_item(tree, hf_scsi_smc_modepage_st_st, tvb, offset+5, 1, ENC_NA);
4446         proto_tree_add_item(tree, hf_scsi_smc_modepage_st_mt, tvb, offset+5, 1, ENC_NA);
4447         proto_tree_add_item(tree, hf_scsi_smc_modepage_ie_dt, tvb, offset+6, 1, ENC_NA);
4448         proto_tree_add_item(tree, hf_scsi_smc_modepage_ie_ie, tvb, offset+6, 1, ENC_NA);
4449         proto_tree_add_item(tree, hf_scsi_smc_modepage_ie_st, tvb, offset+6, 1, ENC_NA);
4450         proto_tree_add_item(tree, hf_scsi_smc_modepage_ie_mt, tvb, offset+6, 1, ENC_NA);
4451         proto_tree_add_item(tree, hf_scsi_smc_modepage_dt_dt, tvb, offset+7, 1, ENC_NA);
4452         proto_tree_add_item(tree, hf_scsi_smc_modepage_dt_ie, tvb, offset+7, 1, ENC_NA);
4453         proto_tree_add_item(tree, hf_scsi_smc_modepage_dt_st, tvb, offset+7, 1, ENC_NA);
4454         proto_tree_add_item(tree, hf_scsi_smc_modepage_dt_mt, tvb, offset+7, 1, ENC_NA);
4455         proto_tree_add_item(tree, hf_scsi_smc_modepage_mt_ne_dt, tvb, offset+12, 1, ENC_NA);
4456         proto_tree_add_item(tree, hf_scsi_smc_modepage_mt_ne_ie, tvb, offset+12, 1, ENC_NA);
4457         proto_tree_add_item(tree, hf_scsi_smc_modepage_mt_ne_st, tvb, offset+12, 1, ENC_NA);
4458         proto_tree_add_item(tree, hf_scsi_smc_modepage_mt_ne_mt, tvb, offset+12, 1, ENC_NA);
4459         proto_tree_add_item(tree, hf_scsi_smc_modepage_st_ne_dt, tvb, offset+13, 1, ENC_NA);
4460         proto_tree_add_item(tree, hf_scsi_smc_modepage_st_ne_ie, tvb, offset+13, 1, ENC_NA);
4461         proto_tree_add_item(tree, hf_scsi_smc_modepage_st_ne_st, tvb, offset+13, 1, ENC_NA);
4462         proto_tree_add_item(tree, hf_scsi_smc_modepage_st_ne_mt, tvb, offset+13, 1, ENC_NA);
4463         proto_tree_add_item(tree, hf_scsi_smc_modepage_ie_ne_dt, tvb, offset+14, 1, ENC_NA);
4464         proto_tree_add_item(tree, hf_scsi_smc_modepage_ie_ne_ie, tvb, offset+14, 1, ENC_NA);
4465         proto_tree_add_item(tree, hf_scsi_smc_modepage_ie_ne_st, tvb, offset+14, 1, ENC_NA);
4466         proto_tree_add_item(tree, hf_scsi_smc_modepage_ie_ne_mt, tvb, offset+14, 1, ENC_NA);
4467         proto_tree_add_item(tree, hf_scsi_smc_modepage_dt_ne_dt, tvb, offset+15, 1, ENC_NA);
4468         proto_tree_add_item(tree, hf_scsi_smc_modepage_dt_ne_ie, tvb, offset+15, 1, ENC_NA);
4469         proto_tree_add_item(tree, hf_scsi_smc_modepage_dt_ne_st, tvb, offset+15, 1, ENC_NA);
4470         proto_tree_add_item(tree, hf_scsi_smc_modepage_dt_ne_mt, tvb, offset+15, 1, ENC_NA);
4471         break;
4472     default:
4473         return FALSE;
4474     }
4475     return TRUE;
4476 }
4477
4478 static guint
4479 dissect_scsi_modepage(tvbuff_t *tvb, packet_info *pinfo,
4480                       proto_tree *scsi_tree, guint offset,
4481                       scsi_device_type devtype)
4482 {
4483     guint16             plen;
4484     guint8              pcode, spf, subpcode = 0;
4485     proto_tree         *tree;
4486     const value_string *modepage_val;
4487     int                 hf_pagecode;
4488     gboolean (*dissect_modepage)(tvbuff_t *, packet_info *, proto_tree *,
4489                                  guint, guint8, guint8, guint8);
4490
4491     pcode = tvb_get_guint8(tvb, offset) & SCSI_MS_PCODE_BITS;
4492     spf   = tvb_get_guint8(tvb, offset) & 0x40;
4493     if (spf) {
4494         subpcode = tvb_get_guint8(tvb, offset + 1);
4495         plen = tvb_get_ntohs(tvb, offset + 2);
4496     } else {
4497         plen = tvb_get_guint8(tvb, offset + 1);
4498     }
4499
4500     if (try_val_to_str(pcode & SCSI_MS_PCODE_BITS,
4501                      scsi_spc_modepage_val) == NULL) {
4502         /*
4503          * This isn't a generic mode page that applies to all SCSI
4504          * device types; try to interpret it based on what we deduced,
4505          * or were told, the device type is.
4506          */
4507         switch (devtype) {
4508         case SCSI_DEV_SBC:
4509             modepage_val = scsi_sbc_modepage_val;
4510             hf_pagecode = hf_scsi_sbcpagecode;
4511             dissect_modepage = dissect_scsi_sbc_modepage;
4512             break;
4513
4514         case SCSI_DEV_SSC:
4515             modepage_val = scsi_ssc2_modepage_val;
4516             hf_pagecode = hf_scsi_sscpagecode;
4517             dissect_modepage = dissect_scsi_ssc2_modepage;
4518             break;
4519
4520         case SCSI_DEV_SMC:
4521             modepage_val = scsi_smc_modepage_val;
4522             hf_pagecode = hf_scsi_smcpagecode;
4523             dissect_modepage = dissect_scsi_smc_modepage;
4524             break;
4525
4526         case SCSI_DEV_CDROM:
4527             modepage_val = scsi_mmc5_modepage_val;
4528             hf_pagecode = hf_scsi_mmcpagecode;
4529             dissect_modepage = dissect_scsi_mmc5_modepage;
4530             break;
4531
4532         default:
4533             /*
4534              * The "val_to_str()" lookup will fail in this table
4535              * (it failed in "try_val_to_str()"), so it'll return
4536              * "Unknown (XXX)", which is what we want.
4537              */
4538             modepage_val = scsi_spc_modepage_val;
4539             hf_pagecode = hf_scsi_spc_pagecode;
4540             dissect_modepage = dissect_scsi_spc_modepage;
4541             break;
4542         }
4543     } else {
4544         modepage_val = scsi_spc_modepage_val;
4545         hf_pagecode = hf_scsi_spc_pagecode;
4546         dissect_modepage = dissect_scsi_spc_modepage;
4547     }
4548
4549     tree = proto_tree_add_subtree_format(scsi_tree, tvb, offset, plen + (spf ? 4 : 2),
4550                              ett_scsi_page, NULL, "%s Mode Page",
4551                              val_to_str(pcode & SCSI_MS_PCODE_BITS,
4552                                         modepage_val, "Unknown (0x%08x)"));
4553     proto_tree_add_item(tree, hf_scsi_modepage_ps, tvb, offset, 1, ENC_BIG_ENDIAN);
4554     proto_tree_add_item(tree, hf_scsi_modepage_spf, tvb, offset, 1, ENC_BIG_ENDIAN);
4555     proto_tree_add_item(tree, hf_pagecode, tvb, offset, 1, ENC_BIG_ENDIAN);
4556
4557     if (spf) {
4558         proto_tree_add_item(tree, hf_scsi_spc_subpagecode, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4559         proto_tree_add_item(tree, hf_scsi_modepage_plen, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4560     } else {
4561         proto_tree_add_item(tree, hf_scsi_modepage_plen, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4562     }
4563
4564     if (!tvb_bytes_exist(tvb, offset, plen)) {
4565         /* XXX - why not just drive on and throw an exception? */
4566         return (plen + 2);
4567     }
4568
4569     if (!(*dissect_modepage)(tvb, pinfo, tree, offset,
4570                              pcode, spf, subpcode)) {
4571         proto_tree_add_expert(tree, pinfo, &ei_scsi_unknown_page, tvb, offset+2, plen);
4572     }
4573     return (plen+2);
4574 }
4575
4576 void
4577 dissect_spc_modeselect6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4578                         guint offset, gboolean isreq, gboolean iscdb,
4579                         guint payload_len, scsi_task_data_t *cdata)
4580 {
4581     guint8    flags;
4582     guint     plen;
4583     gint      desclen;
4584     tvbuff_t *blockdesc_tvb;
4585
4586     if (!tree)
4587         return;
4588
4589     if (isreq && iscdb) {
4590         flags = tvb_get_guint8(tvb, offset);
4591         proto_tree_add_uint_format(tree, hf_scsi_modesel_flags, tvb, offset, 1,
4592                                    flags, "PF = %u, SP = %u", flags & 0x10,
4593                                    flags & 0x1);
4594         proto_tree_add_item(tree, hf_scsi_paramlen, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4595         proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
4596                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
4597     }
4598     else {
4599         /* Mode Parameter has the following format:
4600          * Mode Parameter Header
4601          *    - Mode Data Len, Medium Type, Dev Specific Parameter,
4602          *      Blk Desc Len
4603          * Block Descriptor (s)
4604          *    - Number of blocks, density code, block length
4605          * Page (s)
4606          *    - Page code, Page length, Page Parameters
4607          */
4608         if (payload_len < 1)
4609             return;
4610         proto_tree_add_item(tree, hf_scsi_modesel_mode_data_length8, tvb, offset, 1, ENC_BIG_ENDIAN);
4611         offset += 1;
4612         payload_len -= 1;
4613         /* The mode data length is reserved for MODE SELECT, so we just
4614            use the payload length. */
4615
4616         if (payload_len < 1)
4617             return;
4618         switch (cdata->itl->cmdset&SCSI_CMDSET_MASK) {
4619
4620         case SCSI_DEV_SBC:
4621             proto_tree_add_item(tree, hf_scsi_modesel_dev_sbc_medium_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4622             break;
4623
4624         default:
4625             proto_tree_add_item(tree, hf_scsi_modesel_medium_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4626             break;
4627         }
4628         offset += 1;
4629         payload_len -= 1;
4630
4631         if (payload_len < 1)
4632             return;
4633         proto_tree_add_item(tree, hf_scsi_modesel_device_specific_parameter, tvb, offset, 1, ENC_BIG_ENDIAN);
4634         offset += 1;
4635         payload_len -= 1;
4636
4637         if (payload_len < 1)
4638             return;
4639         desclen = tvb_get_guint8(tvb, offset);
4640         proto_tree_add_item(tree, hf_scsi_modesel_block_descriptor_length8, tvb, offset, 1, ENC_BIG_ENDIAN);
4641         offset += 1;
4642         payload_len -= 1;
4643
4644         if (tvb_reported_length_remaining(tvb, offset)>0) {
4645             blockdesc_tvb = tvb_new_subset(tvb, offset, MIN(tvb_reported_length_remaining(tvb, offset),desclen), desclen);
4646             dissect_scsi_blockdescs(blockdesc_tvb, pinfo, tree, cdata, FALSE);
4647         }
4648         offset += desclen;
4649         payload_len -= desclen;
4650
4651         /* offset points to the start of the mode page */
4652         while ((payload_len > 0) && tvb_bytes_exist(tvb, offset, 2)) {
4653             plen = dissect_scsi_modepage(tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK);
4654             offset += plen;
4655             payload_len -= plen;
4656         }
4657     }
4658 }
4659
4660 void
4661 dissect_spc_modeselect10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4662                          guint offset, gboolean isreq, gboolean iscdb,
4663                          guint payload_len, scsi_task_data_t *cdata)
4664 {
4665     guint8    flags;
4666     gboolean  longlba;
4667     gint      desclen;
4668     guint     plen;
4669     tvbuff_t *blockdesc_tvb;
4670
4671     if (!tree)
4672         return;
4673
4674     if (isreq && iscdb) {
4675         flags = tvb_get_guint8(tvb, offset);
4676         proto_tree_add_uint_format(tree, hf_scsi_modesel_flags, tvb, offset, 1,
4677                                    flags, "PF = %u, SP = %u", flags & 0x10,
4678                                    flags & 0x1);
4679         proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
4680         proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
4681                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
4682     }
4683     else {
4684         /* Mode Parameter has the following format:
4685          * Mode Parameter Header
4686          *    - Mode Data Len, Medium Type, Dev Specific Parameter,
4687          *      Blk Desc Len
4688          * Block Descriptor (s)
4689          *    - Number of blocks, density code, block length
4690          * Page (s)
4691          *    - Page code, Page length, Page Parameters
4692          */
4693         if (payload_len < 1)
4694             return;
4695         proto_tree_add_item(tree, hf_scsi_modesel_mode_data_length16, tvb, offset, 2, ENC_BIG_ENDIAN);
4696         offset += 2;
4697         payload_len -= 2;
4698         /* The mode data length is reserved for MODE SELECT, so we just
4699            use the payload length. */
4700
4701         if (payload_len < 1)
4702             return;
4703         if (!cdata->itl)
4704             return;
4705         switch (cdata->itl->cmdset&SCSI_CMDSET_MASK) {
4706
4707         case SCSI_DEV_SBC:
4708             proto_tree_add_item(tree, hf_scsi_modesel_dev_sbc_medium_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4709             break;
4710
4711         default:
4712             proto_tree_add_item(tree, hf_scsi_modesel_medium_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4713             break;
4714         }
4715         offset += 1;
4716         payload_len -= 1;
4717
4718         if (payload_len < 1)
4719             return;
4720         proto_tree_add_item(tree, hf_scsi_modesel_device_specific_parameter, tvb, offset, 1, ENC_BIG_ENDIAN);
4721         offset += 1;
4722         payload_len -= 1;
4723
4724         if (payload_len < 1)
4725             return;
4726         longlba = tvb_get_guint8(tvb, offset) & 0x1;
4727         proto_tree_add_item(tree, hf_scsi_modesel_longlba, tvb, offset, 1, ENC_BIG_ENDIAN);
4728         offset += 2;    /* skip LongLBA byte and reserved byte */
4729         payload_len -= 2;
4730
4731         if (payload_len < 1)
4732             return;
4733         desclen = tvb_get_ntohs(tvb, offset);
4734         proto_tree_add_item(tree, hf_scsi_modesel_block_descriptor_length16, tvb, offset, 2, ENC_BIG_ENDIAN);
4735         offset += 2;
4736         payload_len -= 2;
4737
4738         if (tvb_reported_length_remaining(tvb, offset)>0) {
4739             blockdesc_tvb = tvb_new_subset(tvb, offset, MIN(tvb_reported_length_remaining(tvb, offset),desclen), desclen);
4740             dissect_scsi_blockdescs(blockdesc_tvb, pinfo, tree, cdata, longlba);
4741         }
4742         offset += desclen;
4743         payload_len -= desclen;
4744
4745         /* offset points to the start of the mode page */
4746         while ((payload_len > 0) && tvb_bytes_exist(tvb, offset, 2)) {
4747             plen = dissect_scsi_modepage(tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK);
4748             offset += plen;
4749             payload_len -= plen;
4750         }
4751     }
4752 }
4753
4754 static void
4755 dissect_scsi_pagecode(tvbuff_t *tvb, packet_info *pinfo _U_,
4756                       proto_tree *tree, guint offset,
4757                       scsi_task_data_t *cdata)
4758 {
4759     guint8 pcode;
4760     int    hf_pagecode;
4761
4762     /* unless we have cdata there is not much point in continuing */
4763     if (!cdata)
4764         return;
4765
4766     pcode = tvb_get_guint8(tvb, offset);
4767     if (try_val_to_str(pcode & SCSI_MS_PCODE_BITS,
4768                      scsi_spc_modepage_val) == NULL) {
4769         /*
4770          * This isn't a generic mode page that applies to all SCSI
4771          * device types; try to interpret it based on what we deduced,
4772          * or were told, the device type is.
4773          */
4774         switch (cdata->itl->cmdset&SCSI_CMDSET_MASK) {
4775         case SCSI_DEV_SBC:
4776             hf_pagecode = hf_scsi_sbcpagecode;
4777             break;
4778
4779         case SCSI_DEV_SSC:
4780             hf_pagecode = hf_scsi_sscpagecode;
4781             break;
4782
4783         case SCSI_DEV_SMC:
4784             hf_pagecode = hf_scsi_smcpagecode;
4785             break;
4786
4787         case SCSI_DEV_CDROM:
4788             hf_pagecode = hf_scsi_mmcpagecode;
4789             break;
4790
4791         default:
4792             hf_pagecode = hf_scsi_spc_pagecode;
4793             break;
4794         }
4795     } else {
4796         hf_pagecode = hf_scsi_spc_pagecode;
4797     }
4798     proto_tree_add_uint(tree, hf_pagecode, tvb, offset, 1, pcode);
4799 }
4800
4801 void
4802 dissect_spc_modesense6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4803                        guint offset, gboolean isreq, gboolean iscdb,
4804                        guint payload_len, scsi_task_data_t *cdata)
4805 {
4806     guint8    flags;
4807     guint     plen;
4808     gint      tot_len, desclen;
4809     tvbuff_t *blockdesc_tvb;
4810
4811     if (!tree)
4812         return;
4813
4814     if (isreq && iscdb) {
4815         flags = tvb_get_guint8(tvb, offset);
4816         proto_tree_add_uint_format(tree, hf_scsi_modesns_flags, tvb, offset, 1,
4817                                    flags, "DBD = %u", flags & 0x8);
4818         proto_tree_add_item(tree, hf_scsi_modesns_pc, tvb, offset+1, 1, ENC_BIG_ENDIAN);
4819         dissect_scsi_pagecode(tvb, pinfo, tree, offset+1, cdata);
4820         proto_tree_add_item(tree, hf_scsi_alloclen, tvb, offset+3, 1, ENC_BIG_ENDIAN);
4821         proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
4822                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
4823     }
4824     else {
4825         /* Mode sense response has the following format:
4826          * Mode Parameter Header
4827          *    - Mode Data Len, Medium Type, Dev Specific Parameter,
4828          *      Blk Desc Len
4829          * Block Descriptor (s)
4830          *    - Number of blocks, density code, block length
4831          * Page (s)
4832          *    - Page code, Page length, Page Parameters
4833          */
4834         tot_len = tvb_get_guint8(tvb, offset);
4835         proto_tree_add_item(tree, hf_scsi_modesel_mode_data_length8, tvb, offset, 1, ENC_BIG_ENDIAN);
4836         offset += 1;
4837
4838         /* The actual payload is the min of the length in the response & the
4839          * space allocated by the initiator as specified in the request.
4840          *
4841          * XXX - the payload length includes the length field, so we
4842          * really should subtract the length of the length field from
4843          * the payload length - but can it really be zero here?
4844          */
4845         if (payload_len && (tot_len > (gint)payload_len))
4846             tot_len = payload_len;
4847
4848         if (tot_len < 1)
4849             return;
4850         proto_tree_add_item(tree, hf_scsi_modesel_medium_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4851         offset += 1;
4852         tot_len -= 1;
4853
4854         if (tot_len < 1)
4855             return;
4856         proto_tree_add_item(tree, hf_scsi_modesel_device_specific_parameter, tvb, offset, 1, ENC_BIG_ENDIAN);
4857         offset += 1;
4858         tot_len -= 1;
4859
4860         if (tot_len < 1)
4861             return;
4862         desclen = tvb_get_guint8(tvb, offset);
4863         proto_tree_add_item(tree, hf_scsi_modesel_block_descriptor_length8, tvb, offset, 1, ENC_BIG_ENDIAN);
4864         offset += 1;
4865         tot_len -= 1;
4866
4867
4868         if (tvb_reported_length_remaining(tvb, offset)>0) {
4869             blockdesc_tvb = tvb_new_subset(tvb, offset, MIN(tvb_reported_length_remaining(tvb, offset),desclen), desclen);
4870             dissect_scsi_blockdescs(blockdesc_tvb, pinfo, tree, cdata, FALSE);
4871         }
4872         offset += desclen;
4873         tot_len -= desclen;
4874
4875         /* offset points to the start of the mode page */
4876         while ((tot_len > 0) && tvb_bytes_exist(tvb, offset, 2)) {
4877             plen = dissect_scsi_modepage(tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK);
4878             offset += plen;
4879             tot_len -= plen;
4880         }
4881     }
4882 }
4883
4884 void
4885 dissect_spc_modesense10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
4886                         guint offset, gboolean isreq, gboolean iscdb,
4887                         guint payload_len, scsi_task_data_t *cdata)
4888 {
4889     guint8    flags;
4890     gboolean  longlba;
4891     gint      tot_len, desclen;
4892     guint     plen;
4893     tvbuff_t *blockdesc_tvb;
4894
4895     if (!tree)
4896         return;
4897
4898     if (isreq && iscdb) {
4899         flags = tvb_get_guint8(tvb, offset);
4900         proto_tree_add_uint_format(tree, hf_scsi_modesns_flags, tvb, offset, 1,
4901                                    flags, "LLBAA = %u, DBD = %u", flags & 0x10,
4902                                    flags & 0x8);
4903         proto_tree_add_item(tree, hf_scsi_modesns_pc, tvb, offset+1, 1, ENC_BIG_ENDIAN);
4904         dissect_scsi_pagecode(tvb, pinfo, tree, offset+1, cdata);
4905         proto_tree_add_item(tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
4906         proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
4907                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
4908     }
4909     else {
4910         /* Mode sense response has the following format:
4911          * Mode Parameter Header
4912          *    - Mode Data Len, Medium Type, Dev Specific Parameter,
4913          *      Blk Desc Len
4914          * Block Descriptor (s)
4915          *    - Number of blocks, density code, block length
4916          * Page (s)
4917          *    - Page code, Page length, Page Parameters
4918          */
4919         tot_len = tvb_get_ntohs(tvb, offset);
4920         proto_tree_add_item(tree, hf_scsi_modesel_mode_data_length16, tvb, offset, 2, ENC_BIG_ENDIAN);
4921         offset += 2;
4922         /* The actual payload is the min of the length in the response & the
4923          * space allocated by the initiator as specified in the request.
4924          *
4925          * XXX - the payload length includes the length field, so we
4926          * really should subtract the length of the length field from
4927          * the payload length - but can it really be zero here?
4928          */
4929         if (payload_len && (tot_len > (gint)payload_len))
4930             tot_len = payload_len;
4931
4932         if (tot_len < 1)
4933             return;
4934         proto_tree_add_item(tree, hf_scsi_modesel_medium_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4935         offset += 1;
4936         tot_len -= 1;
4937
4938         if (tot_len < 1)
4939             return;
4940         proto_tree_add_item(tree, hf_scsi_modesel_device_specific_parameter, tvb, offset, 1, ENC_BIG_ENDIAN);
4941         offset += 1;
4942         tot_len -= 1;
4943
4944         if (tot_len < 1)
4945             return;
4946         longlba = tvb_get_guint8(tvb, offset) & 0x1;
4947         proto_tree_add_item(tree, hf_scsi_modesel_longlba, tvb, offset, 1, ENC_BIG_ENDIAN);
4948         offset += 2;    /* skip LongLBA byte and reserved byte */
4949         tot_len -= 2;
4950
4951         if (tot_len < 1)
4952             return;
4953         desclen = tvb_get_guint8(tvb, offset);
4954         proto_tree_add_item(tree, hf_scsi_modesel_block_descriptor_length8, tvb, offset, 1, ENC_BIG_ENDIAN);
4955         offset += 2;
4956         tot_len -= 2;
4957
4958         if (tvb_reported_length_remaining(tvb, offset)>0) {
4959             blockdesc_tvb = tvb_new_subset(tvb, offset, MIN(tvb_reported_length_remaining(tvb, offset),desclen), desclen);
4960             dissect_scsi_blockdescs(blockdesc_tvb, pinfo, tree, cdata, longlba);
4961         }
4962         offset += desclen;
4963         tot_len -= desclen;
4964
4965         /* offset points to the start of the mode page */
4966         while ((tot_len > 0) && tvb_bytes_exist(tvb, offset, 2)) {
4967             plen = dissect_scsi_modepage(tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK);
4968             offset += plen;
4969             tot_len -= plen;
4970         }
4971     }
4972 }
4973
4974 void
4975 dissect_spc_preventallowmediaremoval(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
4976                                      guint offset, gboolean isreq, gboolean iscdb,
4977                                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
4978 {
4979     if (isreq && iscdb) {
4980         static const int *prevent_allow_fields[] = {
4981             &hf_scsi_prevent_allow_prevent,
4982             NULL
4983         };
4984         guint8 flags;
4985
4986         proto_tree_add_bitmask(tree, tvb, offset + 3, hf_scsi_prevent_allow_flags,
4987             ett_scsi_prevent_allow, prevent_allow_fields, ENC_BIG_ENDIAN);
4988
4989         flags = tvb_get_guint8(tvb, offset + 3);
4990         if (flags & 0x01) {
4991             col_append_str(pinfo->cinfo, COL_INFO, " PREVENT");
4992         } else {
4993             col_append_str(pinfo->cinfo, COL_INFO, " ALLOW");
4994         }
4995
4996         proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
4997                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
4998     }
4999 }
5000
5001 void
5002 dissect_spc_persistentreservein(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
5003                                 guint offset, gboolean isreq, gboolean iscdb,
5004                                 guint payload_len, scsi_task_data_t *cdata)
5005 {
5006     guint16 flags;
5007     int     numrec, i;
5008     guint   len;
5009
5010     if (!tree)
5011         return;
5012
5013     if (isreq && iscdb) {
5014         proto_tree_add_item(tree, hf_scsi_persresvin_svcaction, tvb, offset, 1, ENC_BIG_ENDIAN);
5015         proto_tree_add_item(tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
5016         proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
5017                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5018         /* We store the service action since we want to interpret the data */
5019         cdata->itlq->flags = tvb_get_guint8(tvb, offset);
5020     }
5021     else {
5022         if (cdata) {
5023             flags = cdata->itlq->flags;
5024         }
5025         else {
5026             flags = 0xFF;
5027         }
5028         proto_tree_add_item(tree, hf_scsi_persresvin_generation_number, tvb, offset, 4, ENC_BIG_ENDIAN);
5029         len = tvb_get_ntohl(tvb, offset+4);
5030         proto_tree_add_item(tree, hf_scsi_persresvin_additional_length, tvb, offset+4, 4, ENC_BIG_ENDIAN);
5031         len = (payload_len > len) ? len : payload_len;
5032
5033         if ((flags & 0x1F) == SCSI_SPC_RESVIN_SVCA_RDKEYS) {
5034             /* XXX - what if len is < 8?  That may be illegal, but
5035                that doesn't make it impossible.... */
5036             numrec = len / 8;
5037             offset += 8;
5038
5039             for (i = 0; i < numrec; i++) {
5040                 proto_tree_add_item(tree, hf_scsi_persresv_key, tvb, offset,
5041                                     8, ENC_NA);
5042                 offset += 8;
5043             }
5044         }
5045         else if ((flags & 0x1F) == SCSI_SPC_RESVIN_SVCA_RDRESV && len) {
5046             proto_tree_add_item(tree, hf_scsi_persresv_key, tvb, offset+8,
5047                                 8, ENC_NA);
5048             proto_tree_add_item(tree, hf_scsi_persresv_scopeaddr, tvb,
5049                                 offset+16, 4, ENC_NA);
5050             proto_tree_add_item(tree, hf_scsi_persresv_scope, tvb, offset+21,
5051                                 1, ENC_BIG_ENDIAN);
5052             proto_tree_add_item(tree, hf_scsi_persresv_type, tvb, offset+21,
5053                                 1, ENC_BIG_ENDIAN);
5054         }
5055     }
5056 }
5057
5058 void
5059 dissect_spc_persistentreserveout(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
5060                                  guint offset, gboolean isreq, gboolean iscdb,
5061                                  guint payload_len _U_, scsi_task_data_t *cdata _U_)
5062 {
5063     guint8 svcaction;
5064
5065     if (!tree)
5066         return;
5067
5068     if (isreq && iscdb) {
5069         svcaction = tvb_get_guint8(tvb, offset) & 0x1F;
5070         proto_tree_add_item(tree, hf_scsi_persresvout_svcaction, tvb, offset, 1, ENC_BIG_ENDIAN);
5071         /* type and scope are ignored for REGISTER, REGISTER AND IGNORE EXISTING KEY, CLEAR service actions */
5072         if (svcaction != SCSI_PR_REGISTER && svcaction != SCSI_PR_REG_IGNORE && svcaction != SCSI_PR_CLEAR) {
5073             proto_tree_add_item(tree, hf_scsi_persresv_scope, tvb, offset+1, 1, ENC_BIG_ENDIAN);
5074             proto_tree_add_item(tree, hf_scsi_persresv_type, tvb, offset+1, 1, ENC_BIG_ENDIAN);
5075         }
5076         proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+4, 4, ENC_BIG_ENDIAN);
5077         proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
5078                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5079         /* We store the service action since we want to interpret the params */
5080         cdata->itlq->flags = tvb_get_guint8(tvb, offset);
5081     }
5082     else if (isreq && !iscdb) {
5083         proto_tree_add_item(tree, hf_scsi_persresvout_reskey, tvb, offset,
5084                             8, ENC_NA);
5085         proto_tree_add_item(tree, hf_scsi_persresvout_sareskey, tvb,
5086                             offset +8, 8, ENC_NA);
5087         if (cdata->itlq->flags == 0x07) {
5088             /* Service action REGISTER AND MOVE */
5089             const int *persresv_fields[] = {
5090                 &hf_scsi_persresv_control_rsvd,
5091                 &hf_scsi_persresv_control_unreg,
5092                 &hf_scsi_persresv_control_aptpl,
5093                 NULL
5094             };
5095             guint32 tid_len = tvb_get_ntohl(tvb, offset+20);
5096
5097             proto_tree_add_item(tree, hf_scsi_persresvout_obsolete, tvb,
5098                                 offset+16, 1, ENC_NA);
5099             proto_tree_add_bitmask(tree, tvb, offset+17,
5100                                    hf_scsi_persresvout_control, ett_persresv_control,
5101                                    persresv_fields, ENC_BIG_ENDIAN);
5102             proto_tree_add_item(tree, hf_scsi_persresvout_rel_tpi, tvb,
5103                                 offset+18, 2, ENC_BIG_ENDIAN);
5104             proto_tree_add_item(tree, hf_scsi_persresvout_transportid_len, tvb,
5105                                 offset+20, 4, ENC_BIG_ENDIAN);
5106             proto_tree_add_item(tree, hf_scsi_persresvout_transportid, tvb,
5107                                 offset+24, tid_len, ENC_NA);
5108         }
5109         else {
5110             /* Other service actions than REGISTER AND MOVE. */
5111             const int *persresv_fields[] = {
5112                 &hf_scsi_persresv_control_rsvd1,
5113                 &hf_scsi_persresv_control_spec_i_pt,
5114                 &hf_scsi_persresv_control_all_tg_pt,
5115                 &hf_scsi_persresv_control_rsvd2,
5116                 &hf_scsi_persresv_control_aptpl,
5117                 NULL
5118             };
5119
5120             proto_tree_add_item(tree, hf_scsi_persresvout_obsolete, tvb,
5121                                 offset+16, 4, ENC_NA);
5122             proto_tree_add_bitmask(tree, tvb, offset+20,
5123                                    hf_scsi_persresvout_control, ett_persresv_control,
5124                                    persresv_fields, ENC_BIG_ENDIAN);
5125         }
5126     }
5127     else {
5128     }
5129 }
5130
5131 void
5132 dissect_spc_release6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
5133                      guint offset, gboolean isreq, gboolean iscdb,
5134                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
5135 {
5136     if (!tree)
5137         return;
5138
5139     if (isreq && iscdb) {
5140         proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
5141                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5142     }
5143 }
5144
5145 void
5146 dissect_spc_release10(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
5147                       guint offset, gboolean isreq, gboolean iscdb,
5148                       guint payload_len _U_, scsi_task_data_t *cdata _U_)
5149 {
5150     guint8 flags;
5151
5152     if (!tree)
5153         return;
5154
5155     if (isreq && iscdb) {
5156         flags = tvb_get_guint8(tvb, offset);
5157         proto_tree_add_uint_format(tree, hf_scsi_release_flags, tvb, offset, 1,
5158                                    flags,
5159                                    "Flags: 3rd Party ID = %u, LongID = %u",
5160                                    flags & 0x10, flags & 0x2);
5161         if ((flags & 0x12) == 0x10) {
5162             proto_tree_add_item(tree, hf_scsi_release_thirdpartyid, tvb,
5163                                 offset+2, 1, ENC_NA);
5164         }
5165         proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
5166         proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
5167                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5168     }
5169 }
5170
5171 static void
5172 dissect_spc_reportdeviceidentifier(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
5173                                    proto_tree *tree _U_,
5174                                    guint offset _U_, gboolean isreq _U_, gboolean iscdb _U_,
5175                                    guint payload_len _U_, scsi_task_data_t *cdata _U_)
5176 {
5177
5178 }
5179
5180 void
5181 dissect_scsi_lun(proto_tree *tree, tvbuff_t *tvb, guint offset) {
5182     proto_item *ti;
5183     proto_tree *tt, *tl = proto_tree_add_subtree(tree, tvb, offset, 8, ett_scsi_lun, &ti, "LUN");
5184     guint8 address_mode, lun_len = 0, ea_code = 0, len_code = 0, lun_count = 0, complex_lun = 0;
5185     guint16 lun = 0;
5186     const gchar *str = NULL;
5187
5188     if (tvb_get_ntoh48(tvb, offset) << 16) {
5189         /* Pedantically change LUN to LUNs */
5190         proto_item_append_text(tl, "s");
5191         complex_lun = 1;
5192     }
5193
5194     while (lun_len < 8) {
5195         lun = tvb_get_ntohs(tvb, offset + lun_len);
5196         /* Don't skip the first non-zero LUN */
5197         if (lun_len && !lun)
5198             break;
5199
5200         address_mode = tvb_get_guint8(tvb, offset + lun_len);
5201         if ((address_mode >> 6) < 0x3)
5202             len_code = 2;
5203         else {
5204             len_code = (address_mode & 0x30) >> 4;
5205             len_code = 2 + (len_code * 2);
5206         }
5207
5208         if (complex_lun) {
5209             /* Add lun subtrees only for complex luns */
5210             tt = proto_tree_add_subtree(tl, tvb, offset + lun_len, len_code, ett_scsi_lun_unit, &ti, "LUN");
5211             proto_item_append_text(tt, " %d", lun_count++);
5212         } else
5213             tt = tl;
5214
5215         /* Peripheral and Simple logical unit addressing share the same identifier, with bus defining the difference */
5216         if (!address_mode)
5217             proto_tree_add_uint_format_value(tt, hf_scsi_lun_address_mode, tvb, offset + lun_len, 1, (address_mode >> 6),
5218                                              "Simple logical unit addressing (0x0%x)", address_mode >> 6);
5219         else
5220             proto_tree_add_item(tt, hf_scsi_lun_address_mode, tvb, offset + lun_len, 1, ENC_BIG_ENDIAN);
5221
5222         switch (address_mode >> 6) {
5223         case 0:
5224             /*  Simple logical unit addressing method has no bus id */
5225             if (address_mode) {
5226                 proto_tree_add_bits_item(tt, hf_scsi_bus, tvb, (offset + lun_len) * 8 + 2, 0x6, ENC_BIG_ENDIAN);
5227                 lun = tvb_get_guint8(tvb, offset + lun_len + 1);
5228                 proto_tree_add_uint(tt, hf_scsi_lun, tvb, offset + lun_len + 1, 1, lun);
5229             } else {
5230                 proto_tree_add_bits_item(tt, hf_scsi_lun, tvb, (offset + lun_len) * 8 + 2, 0xe, ENC_BIG_ENDIAN);
5231             }
5232             lun_len += len_code;
5233             break;
5234
5235         case 1:
5236             proto_tree_add_bits_item(tt, hf_scsi_lun, tvb, (offset + lun_len) * 8 + 2, 0xe, ENC_BIG_ENDIAN);
5237             lun_len += len_code;
5238             break;
5239         case 2:
5240             proto_tree_add_item(tt, hf_scsi_target, tvb, offset + lun_len, 1, ENC_BIG_ENDIAN);
5241             proto_tree_add_bits_item(tt, hf_scsi_bus, tvb, (offset + lun_len + 1) * 8, 0x3, ENC_BIG_ENDIAN);
5242             proto_tree_add_bits_item(tt, hf_scsi_lun, tvb, (offset + lun_len + 1) * 8 + 3, 0x5, ENC_BIG_ENDIAN);
5243             lun_len += len_code;
5244             break;
5245         case 3:
5246             ea_code = address_mode & 0xf;
5247             lun = len_code;
5248             len_code = (address_mode & 0x30) >> 4;
5249
5250             ti = proto_tree_add_item(tt, hf_scsi_extended_add_method_len, tvb, offset + lun_len, 1, ENC_BIG_ENDIAN);
5251             proto_item_append_text(ti, " (%d bytes)", lun);
5252
5253             ti = proto_tree_add_item(tt, hf_scsi_extended_add_method, tvb, offset + lun_len, 1, ENC_BIG_ENDIAN);
5254
5255             str = NULL;
5256             switch(ea_code) {
5257             case 0x1:
5258                 if (!len_code) {
5259                     str = "Well known logical unit";
5260                     proto_tree_add_item(tt, hf_scsi_lun, tvb, offset + lun_len + 1, 1, ENC_BIG_ENDIAN);
5261                 }
5262                 break;
5263             case 0x2:
5264                 if (len_code == 0x1)
5265                     str = "Extended flat space addressing";
5266                 else if (len_code == 0x2)
5267                     str = "Long extended flat space addressing";
5268                 if (str)
5269                     proto_tree_add_item(tt, hf_scsi_lun_extended, tvb, offset + lun_len + 1, lun - 1, ENC_BIG_ENDIAN);
5270                 break;
5271             case 0xe:
5272                 if (len_code == 0x3)
5273                     str = "Reserved for FC-SB-5";
5274                 break;
5275             case 0xf:
5276                 /* The contents of all hierarchical LUN structure addressing fields following a logical unit not specified addressing
5277                  * method addressing field shall be ignored. [SAM5] 4.7.7.5.4 */
5278                 if (len_code == 0x3) {
5279                     proto_item_append_text(ti, " (Logical unit not specified)");
5280                     return;
5281                 }
5282                 break;
5283             default:
5284                 str = "Reserved";
5285                 break;
5286             }
5287
5288             len_code = (guint8)lun;
5289             if (!str)
5290                 str = "Reserved";
5291
5292             proto_item_append_text(ti, " (%s)", str);
5293             lun_len += len_code;
5294             break;
5295
5296         default:
5297             break;
5298         }
5299     }
5300 }
5301
5302 void
5303 dissect_spc_reportluns(tvbuff_t *tvb_a, packet_info *pinfo _U_,
5304                        proto_tree *tree, guint offset_a,
5305                        gboolean isreq, gboolean iscdb, guint payload_len _U_,
5306                        scsi_task_data_t *cdata _U_)
5307 {
5308     gint               listlen;
5309
5310     if (isreq && iscdb) {
5311         proto_tree_add_item(tree, hf_scsi_select_report, tvb_a, offset_a+1, 1, ENC_BIG_ENDIAN);
5312         proto_tree_add_item(tree, hf_scsi_alloclen32, tvb_a, offset_a+5, 4, ENC_BIG_ENDIAN);
5313         if (cdata) {
5314             cdata->itlq->alloc_len = tvb_get_ntohl(tvb_a, offset_a+5);
5315         }
5316         proto_tree_add_bitmask(tree, tvb_a, offset_a+10, hf_scsi_control,
5317                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5318     } else if (!isreq) {
5319         if (!cdata) {
5320             return;
5321         }
5322
5323         TRY_SCSI_CDB_ALLOC_LEN(cdata->itlq->alloc_len);  /* (defines/initializes try_tvb & try_offset) */
5324         listlen = tvb_get_ntohl(try_tvb, try_offset);
5325         proto_tree_add_item(tree, hf_scsi_reportluns_lun_list_length, try_tvb, try_offset, 4, ENC_BIG_ENDIAN);
5326         try_offset += 8;
5327
5328         while(listlen>0) {
5329             dissect_scsi_lun(tree, try_tvb, try_offset);
5330             try_offset+=8;
5331             listlen-=8;
5332         }
5333         END_TRY_SCSI_CDB_ALLOC_LEN;
5334     }
5335 }
5336
5337 const value_string mpi_action_vals[] = {
5338     {MPI_MANAGEMENT_PROTOCOL_IN           , "Management Protocol In"},
5339     {MPI_REPORT_SUPPORTED_OPERATION_CODES , "Report Supported Opcodes"},
5340     {0, NULL}
5341 };
5342
5343 const value_string report_opcodes_options_vals[] = {
5344     {0, "Report ALL opcodes"},
5345     {1, "Report ONE opcode, NO service action"},
5346     {2, "Report ONE opcode, WITH service action"},
5347     {0, NULL}
5348 };
5349
5350 void
5351 dissect_spc_mgmt_protocol_in(tvbuff_t *tvb_a, packet_info *pinfo _U_,
5352                  proto_tree *tree, guint offset_a,
5353                  gboolean isreq, gboolean iscdb,
5354                  guint payload_len _U_,
5355                  scsi_task_data_t *cdata _U_)
5356 {
5357     guint8             service_action;
5358
5359     if (isreq && iscdb) {
5360         service_action = tvb_get_guint8 (tvb_a, offset_a) & 0x1F;
5361     if (cdata) {
5362         cdata->itlq->flags=service_action;
5363     }
5364     col_append_str(pinfo->cinfo, COL_INFO,
5365             val_to_str(service_action, mpi_action_vals, "Unknown"));
5366
5367     proto_tree_add_item(tree, hf_scsi_mpi_service_action, tvb_a,
5368             offset_a, 1, ENC_BIG_ENDIAN);
5369
5370     switch(service_action){
5371         case MPI_REPORT_SUPPORTED_OPERATION_CODES:
5372             proto_tree_add_item(tree, hf_scsi_report_opcodes_rctd,
5373                     tvb_a, offset_a+1, 1, ENC_BIG_ENDIAN);
5374             proto_tree_add_item(tree, hf_scsi_report_opcodes_options,
5375                     tvb_a, offset_a+1, 1, ENC_BIG_ENDIAN);
5376             if (cdata && (tvb_get_guint8(tvb_a, offset_a+1) & 0x07)) {
5377                 /* Need the one-command parameter format */
5378                 cdata->itlq->flags|=0x80;
5379             }
5380
5381             proto_tree_add_item(tree, hf_scsi_report_opcodes_requested_o,
5382                     tvb_a, offset_a+2, 1, ENC_BIG_ENDIAN);
5383             proto_tree_add_item(tree, hf_scsi_report_opcodes_requested_sa,
5384                     tvb_a, offset_a+3, 2, ENC_BIG_ENDIAN);
5385
5386             proto_tree_add_item(tree, hf_scsi_alloclen32, tvb_a,
5387                     offset_a+5, 4, ENC_BIG_ENDIAN);
5388             if (cdata) {
5389                 cdata->itlq->alloc_len = tvb_get_ntohl(tvb_a, offset_a+5);
5390             }
5391             break;
5392         default:
5393             proto_tree_add_expert(tree, pinfo, &ei_scsi_no_dissection_for_service_action, tvb_a, offset_a+1, 8);
5394     }
5395
5396     proto_tree_add_bitmask(tree, tvb_a, offset_a+10, hf_scsi_control,
5397             ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5398
5399     } else if (!isreq) {
5400         proto_item *it;
5401         int length;
5402         cmdset_t *csdata;
5403         int ctdp;
5404
5405         if (!cdata || !cdata->itlq || !cdata->itl) {
5406             return;
5407         }
5408
5409         csdata = get_cmdset_data(cdata->itlq, cdata->itl);
5410
5411         it = proto_tree_add_uint(tree, hf_scsi_mpi_service_action, tvb_a, 0, 0, cdata->itlq->flags & 0x7f);
5412         PROTO_ITEM_SET_GENERATED(it);
5413
5414         TRY_SCSI_CDB_ALLOC_LEN(cdata->itlq->alloc_len);  /* (defines/initializes try_tvb & try_offset) */
5415
5416         switch (cdata->itlq->flags & 0x7f) {
5417             case MPI_REPORT_SUPPORTED_OPERATION_CODES:
5418                 if (cdata->itlq->flags & 0x80) {
5419                     /* one-command format */
5420                     proto_tree_add_item(tree, hf_scsi_report_opcodes_ctdp_one,
5421                             try_tvb, try_offset+1, 1, ENC_BIG_ENDIAN);
5422                     ctdp = tvb_get_guint8(try_tvb, try_offset+1) & 0x80;
5423
5424                     proto_tree_add_item(tree, hf_scsi_report_opcodes_support,
5425                             try_tvb, try_offset+1, 1, ENC_BIG_ENDIAN);
5426
5427                     proto_tree_add_item(tree, hf_scsi_report_opcodes_cdb_length,
5428                             try_tvb, try_offset+2, 2, ENC_BIG_ENDIAN);
5429                     length = tvb_get_ntohs(try_tvb, try_offset+2);
5430
5431                     proto_tree_add_item(tree, hf_scsi_report_opcodes_cdb_usage_data,
5432                             try_tvb, try_offset+4, length, ENC_NA);
5433
5434                     if (ctdp) {
5435                         proto_tree *tr;
5436
5437                         tr = proto_tree_add_subtree(tree, try_tvb, try_offset,
5438                                 12, ett_timeout_descriptor, NULL, "Timeout Descriptor");
5439
5440                         proto_tree_add_item(tr, hf_scsi_report_opcodes_tdl,
5441                                 try_tvb, try_offset, 2, ENC_BIG_ENDIAN);
5442
5443                         proto_tree_add_item(tr, hf_scsi_report_opcodes_npt,
5444                                 try_tvb, try_offset + 4, 4, ENC_BIG_ENDIAN);
5445
5446                         proto_tree_add_item(tr, hf_scsi_report_opcodes_rct,
5447                                 try_tvb, try_offset + 8, 4, ENC_BIG_ENDIAN);
5448                     }
5449                 } else {
5450                     /* all commands format */
5451                     proto_tree_add_item(tree, hf_scsi_report_opcodes_cdl,
5452                             try_tvb, try_offset+0, 4, ENC_BIG_ENDIAN);
5453                     length = tvb_get_ntohl(try_tvb, try_offset);
5454                     try_offset += 4;
5455
5456                     while (length >= 20) {
5457                         proto_tree *tr;
5458
5459                         tr = proto_tree_add_subtree_format(tree, try_tvb, try_offset,
5460                                 20, ett_command_descriptor, NULL, "Command Descriptor: %s",
5461                                 val_to_str_ext_const(tvb_get_guint8(try_tvb, try_offset+0), csdata->cdb_vals_ext, "Unknown"));
5462
5463                         proto_tree_add_item(tr, csdata->hf_opcode,
5464                                 try_tvb, try_offset+0, 1, ENC_BIG_ENDIAN);
5465
5466                         proto_tree_add_item(tr, hf_scsi_report_opcodes_sa,
5467                                 try_tvb, try_offset+2, 2, ENC_BIG_ENDIAN);
5468
5469                         proto_tree_add_item(tr, hf_scsi_report_opcodes_ctdp,
5470                                 try_tvb, try_offset+5, 1, ENC_BIG_ENDIAN);
5471                         ctdp = tvb_get_guint8(try_tvb, try_offset+5) & 0x02;
5472
5473                         proto_tree_add_item(tr, hf_scsi_report_opcodes_servactv,
5474                                 try_tvb, try_offset+5, 1, ENC_BIG_ENDIAN);
5475
5476                         proto_tree_add_item(tr, hf_scsi_report_opcodes_cdb_length,
5477                                 try_tvb, try_offset+6, 2, ENC_BIG_ENDIAN);
5478
5479                         try_offset += 8;
5480                         length -= 8;
5481
5482                         if (!ctdp) {
5483                             continue;
5484                         }
5485
5486                         tr = proto_tree_add_subtree(tree, try_tvb, try_offset,
5487                                 12, ett_timeout_descriptor, NULL, "Timeout Descriptor");
5488
5489                         proto_tree_add_item(tr, hf_scsi_report_opcodes_tdl,
5490                                 try_tvb, try_offset, 2, ENC_BIG_ENDIAN);
5491
5492                         proto_tree_add_item(tr, hf_scsi_report_opcodes_npt,
5493                                 try_tvb, try_offset + 4, 4, ENC_BIG_ENDIAN);
5494
5495                         proto_tree_add_item(tr, hf_scsi_report_opcodes_rct,
5496                                 try_tvb, try_offset + 8, 4, ENC_BIG_ENDIAN);
5497
5498                         try_offset += 12;
5499                         length -= 12;
5500
5501                     }
5502                 }
5503                 break;
5504             default:
5505                 proto_tree_add_expert(tree, pinfo, &ei_scsi_no_dissection_for_service_action, try_tvb, try_offset+1, 8);
5506         }
5507
5508         END_TRY_SCSI_CDB_ALLOC_LEN;
5509     }
5510 }
5511
5512 static void
5513 dissect_scsi_sns_specific_info(tvbuff_t *tvb, proto_tree *sns_tree, guint offset, guint8 sense_key) {
5514  guint8 valid = tvb_get_guint8(tvb, offset)&0x80;
5515  proto_tree_add_item(sns_tree, hf_scsi_sksv, tvb, offset, 1, ENC_BIG_ENDIAN);
5516  proto_tree_add_item(sns_tree, hf_scsi_sks_info, tvb, offset, 3, ENC_BIG_ENDIAN);
5517
5518  if (sense_key==5&&valid) {
5519     /*illegal request*/
5520     proto_tree_add_item(sns_tree, hf_scsi_sks_fp_cd, tvb, offset, 3, ENC_BIG_ENDIAN);
5521     proto_tree_add_item(sns_tree, hf_scsi_sks_fp_bpv, tvb, offset, 3, ENC_BIG_ENDIAN);
5522     proto_tree_add_item(sns_tree, hf_scsi_sks_fp_bit, tvb, offset, 3, ENC_BIG_ENDIAN);
5523     proto_tree_add_item(sns_tree, hf_scsi_sks_fp_field,  tvb, offset, 3, ENC_BIG_ENDIAN);
5524  }
5525 }
5526
5527 static void
5528 dissect_scsi_fix_snsinfo(tvbuff_t *tvb, proto_tree *sns_tree, guint offset) {
5529     proto_item *hidden_item;
5530     guint8      flags;
5531
5532     proto_tree_add_item(sns_tree, hf_scsi_sns_valid, tvb, offset, 1, ENC_BIG_ENDIAN);
5533
5534     flags = tvb_get_guint8(tvb, offset+2);
5535     proto_tree_add_item(sns_tree, hf_scsi_sns_filemark, tvb, offset+2, 1, ENC_NA);
5536     proto_tree_add_item(sns_tree, hf_scsi_sns_eom, tvb, offset+2, 1, ENC_NA);
5537     proto_tree_add_item(sns_tree, hf_scsi_sns_ili, tvb, offset+2, 1, ENC_NA);
5538     proto_tree_add_item(sns_tree, hf_scsi_snskey, tvb, offset+2, 1, ENC_BIG_ENDIAN);
5539     proto_tree_add_item(sns_tree, hf_scsi_snsinfo, tvb, offset+3, 4, ENC_BIG_ENDIAN);
5540     proto_tree_add_item(sns_tree, hf_scsi_addlsnslen, tvb, offset+7, 1, ENC_BIG_ENDIAN);
5541     proto_tree_add_item(sns_tree, hf_scsi_sns_command_specific_information, tvb, offset+8, 4, ENC_NA);
5542     proto_tree_add_item(sns_tree, hf_scsi_ascascq, tvb, offset+12, 2, ENC_BIG_ENDIAN);
5543     hidden_item = proto_tree_add_item(sns_tree, hf_scsi_asc, tvb, offset+12, 1, ENC_BIG_ENDIAN);
5544     PROTO_ITEM_SET_HIDDEN(hidden_item);
5545     hidden_item = proto_tree_add_item(sns_tree, hf_scsi_ascq, tvb, offset+13, 1, ENC_BIG_ENDIAN);
5546     PROTO_ITEM_SET_HIDDEN(hidden_item);
5547     proto_tree_add_item(sns_tree, hf_scsi_fru, tvb, offset+14, 1, ENC_BIG_ENDIAN);
5548     dissect_scsi_sns_specific_info(tvb,sns_tree,offset+15,flags&0x0F);
5549 }
5550
5551 static void
5552 dissect_scsi_descriptor_snsinfo(tvbuff_t *tvb, proto_tree *sns_tree, guint offset)
5553 {
5554     guint8  additional_length, sense_key;
5555     guint   end;
5556
5557     proto_tree_add_item(sns_tree, hf_scsi_snskey, tvb, offset+1, 1, ENC_BIG_ENDIAN);
5558     proto_tree_add_item(sns_tree, hf_scsi_ascascq, tvb, offset+2, 2, ENC_BIG_ENDIAN);
5559     proto_tree_add_item(sns_tree, hf_scsi_addlsnslen, tvb, offset+7, 1, ENC_BIG_ENDIAN);
5560     sense_key = tvb_get_guint8(tvb, offset+1)&0xF;
5561     additional_length = tvb_get_guint8(tvb, offset+7);
5562     end = offset+7+additional_length;
5563     offset+=8;
5564     while (offset<end-2) {
5565        guint8      desc_type, desc_length, desc_end;
5566        proto_item *item;
5567        proto_tree *desc_tree;
5568
5569        desc_type   = tvb_get_guint8(tvb, offset);
5570        desc_length = tvb_get_guint8(tvb, offset+1);
5571        desc_end    = offset+desc_length+2;
5572        desc_tree = proto_tree_add_subtree(sns_tree, tvb, offset, desc_length+2, ett_sense_descriptor, NULL,
5573                   val_to_str(desc_type, scsi_sense_desc_type_val, "Unknown (0x%02x)"));
5574        proto_tree_add_item(desc_tree, hf_scsi_sns_desc_type, tvb, offset, 1, ENC_BIG_ENDIAN);
5575        proto_tree_add_item(desc_tree, hf_scsi_sns_desc_length, tvb, offset+1, 1, ENC_BIG_ENDIAN);
5576        switch (desc_type) {
5577           case 2:
5578              /*sense key specific*/
5579              if (desc_length==6) {
5580                     dissect_scsi_sns_specific_info(tvb,desc_tree,offset+4,sense_key);
5581              }
5582              break;
5583           case 6:
5584              /*OSD object identification*/
5585              if (desc_length==0x1e) {
5586                  static const int *command_functions[] = {
5587                      &hf_scsi_sns_osd_object_validation,
5588                      &hf_scsi_sns_osd_object_cmd_cap_v,
5589                      &hf_scsi_sns_osd_object_command,
5590                      &hf_scsi_sns_osd_object_imp_st_att,
5591                      &hf_scsi_sns_osd_object_sa_cap_v,
5592                      &hf_scsi_sns_osd_object_set_att,
5593                      &hf_scsi_sns_osd_object_ga_cap_v,
5594                      &hf_scsi_sns_osd_object_get_att,
5595                      NULL
5596                  };
5597                  proto_tree_add_bitmask(desc_tree, tvb, offset+8, hf_scsi_sns_osd_object_not_initiated, ett_sense_osd_not_initiated, command_functions, ENC_BIG_ENDIAN);
5598                  proto_tree_add_bitmask(desc_tree, tvb, offset+12, hf_scsi_sns_osd_object_completed, ett_sense_osd_completed, command_functions, ENC_BIG_ENDIAN);
5599                  proto_tree_add_item(desc_tree, hf_scsi_sns_osd_partition_id, tvb, offset+16, 8, ENC_BIG_ENDIAN);
5600                  proto_tree_add_item(desc_tree, hf_scsi_sns_osd_object_id, tvb, offset+24, 8, ENC_BIG_ENDIAN);
5601              }
5602              break;
5603           case 8:
5604             /*OSD attribute identification*/
5605             offset+=4;
5606             while (offset+8<=desc_end) {
5607                 const attribute_page_numbers_t *apn;
5608                 guint32 page,number;
5609                 page=tvb_get_ntohl(tvb, offset);
5610                 proto_tree_add_item(desc_tree, hf_scsi_sns_osd_attr_page,   tvb, offset, 4, ENC_BIG_ENDIAN);
5611                 offset+=4;
5612                 number=tvb_get_ntohl(tvb, offset);
5613                 item=proto_tree_add_item(desc_tree, hf_scsi_sns_osd_attr_number, tvb, offset, 4, ENC_BIG_ENDIAN);
5614                 apn=osd_lookup_attribute(page,number);
5615                 offset+=4;
5616                 if (apn) {
5617                     proto_item_append_text(item, " (%s)", apn->name);
5618                 } else {
5619                     proto_item_append_text(item, " (Unknown)");
5620                 }
5621             }
5622           default:
5623              break;
5624        }
5625        offset += desc_length+2;
5626     }
5627 }
5628
5629 static void
5630 dissect_scsi_sense(tvbuff_t *tvb, proto_tree *sns_tree, guint offset)
5631 {
5632     guint8 sense_type;
5633
5634     proto_tree_add_item(sns_tree, hf_scsi_sns_errtype, tvb, offset, 1, ENC_BIG_ENDIAN);
5635     sense_type = tvb_get_guint8(tvb, offset) & 0x7f;
5636
5637     switch (sense_type) {
5638     case 0x70:
5639     case 0x71:
5640         dissect_scsi_fix_snsinfo(tvb, sns_tree, offset);
5641         break;
5642     case 0x72:
5643     case 0x73:
5644         dissect_scsi_descriptor_snsinfo(tvb, sns_tree, offset);
5645         break;
5646     }
5647 }
5648
5649 void
5650 dissect_spc_requestsense(tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree,
5651                          guint offset, gboolean isreq, gboolean iscdb,
5652                          guint payload_len _U_, scsi_task_data_t *cdata _U_)
5653 {
5654     if (!tree)
5655         return;
5656
5657     if (isreq && iscdb) {
5658         proto_tree_add_item(tree, hf_scsi_alloclen, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5659         proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
5660                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5661     } else if (!isreq) {
5662         dissect_scsi_sense(tvb, tree, offset);
5663     }
5664 }
5665
5666 void
5667 dissect_spc_reserve6(tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree,
5668                      guint offset, gboolean isreq, gboolean iscdb,
5669                      guint payload_len _U_, scsi_task_data_t *cdata _U_)
5670 {
5671     if (!tree)
5672         return;
5673
5674     if (isreq && iscdb) {
5675         proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
5676                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5677     }
5678 }
5679
5680 void
5681 dissect_spc_reserve10(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
5682                       guint offset, gboolean isreq, gboolean iscdb,
5683                       guint payload_len _U_, scsi_task_data_t *cdata _U_)
5684 {
5685     guint8 flags;
5686
5687     if (!tree)
5688         return;
5689
5690     if (isreq && iscdb) {
5691         flags = tvb_get_guint8(tvb, offset);
5692         proto_tree_add_uint_format(tree, hf_scsi_release_flags, tvb, offset, 1,
5693                                    flags,
5694                                    "Flags: 3rd Party ID = %u, LongID = %u",
5695                                    flags & 0x10, flags & 0x2);
5696         if ((flags & 0x12) == 0x10) {
5697             proto_tree_add_item(tree, hf_scsi_release_thirdpartyid, tvb,
5698                                 offset+2, 1, ENC_NA);
5699         }
5700         proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN);
5701         proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
5702                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5703     }
5704 }
5705
5706 void
5707 dissect_spc_testunitready(tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree,
5708                           guint offset, gboolean isreq, gboolean iscdb,
5709                           guint payload_len _U_, scsi_task_data_t *cdata _U_)
5710 {
5711
5712     if (!tree)
5713         return;
5714
5715     if (isreq && iscdb) {
5716         proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
5717                                ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5718     }
5719 }
5720
5721
5722
5723
5724
5725
5726 void
5727 dissect_spc_senddiagnostic(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
5728                            guint offset, gboolean isreq, gboolean iscdb _U_,
5729                            guint payload_len _U_, scsi_task_data_t *cdata _U_)
5730 {
5731     if (!tree && !isreq)
5732         return;
5733
5734     proto_tree_add_item(tree, hf_scsi_senddiag_st_code, tvb, offset, 1, ENC_BIG_ENDIAN);
5735     proto_tree_add_item(tree, hf_scsi_senddiag_pf, tvb, offset, 1, ENC_BIG_ENDIAN);
5736     proto_tree_add_item(tree, hf_scsi_senddiag_st, tvb, offset, 1, ENC_BIG_ENDIAN);
5737     proto_tree_add_item(tree, hf_scsi_senddiag_devoff, tvb, offset, 1, ENC_BIG_ENDIAN);
5738     proto_tree_add_item(tree, hf_scsi_senddiag_unitoff, tvb, offset, 1, ENC_BIG_ENDIAN);
5739     proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+2, 2, ENC_BIG_ENDIAN);
5740     proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
5741                            ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5742 }
5743
5744 void
5745 dissect_spc_writebuffer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
5746                         guint offset, gboolean isreq, gboolean iscdb _U_,
5747                         guint payload_len _U_, scsi_task_data_t *cdata _U_)
5748 {
5749     if (!tree && !isreq)
5750         return;
5751
5752     proto_tree_add_item(tree, hf_scsi_wb_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
5753     proto_tree_add_item(tree, hf_scsi_wb_bufferid, tvb, offset+1, 1, ENC_BIG_ENDIAN);
5754     proto_tree_add_item(tree, hf_scsi_wb_bufoffset, tvb, offset+2, 3, ENC_BIG_ENDIAN);
5755     proto_tree_add_item(tree, hf_scsi_paramlen24, tvb, offset+5, 3, ENC_BIG_ENDIAN);
5756     proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
5757                            ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
5758 }
5759
5760 static void
5761 dissect_scsi_varlencdb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
5762                        guint offset, gboolean isreq, gboolean iscdb,
5763                        guint payload_len _U_, scsi_task_data_t *cdata _U_)
5764 {
5765     if (!tree)
5766         return;
5767
5768     if (isreq && iscdb) {
5769         proto_tree_add_item(tree, hf_scsi_control, tvb, offset, 1, ENC_BIG_ENDIAN);
5770         proto_tree_add_item(tree, hf_scsi_add_cdblen, tvb, offset+6, 1, ENC_BIG_ENDIAN);
5771         proto_tree_add_item(tree, hf_scsi_svcaction, tvb, offset+7, 2, ENC_BIG_ENDIAN);
5772
5773     }
5774 }
5775
5776 void
5777 dissect_scsi_rsp(tvbuff_t *tvb, packet_info *pinfo,
5778                  proto_tree *tree, itlq_nexus_t *itlq, itl_nexus_t *itl,
5779                  guint8 scsi_status)
5780 {
5781     proto_item       *ti;
5782     proto_tree       *scsi_tree = NULL;
5783     cmdset_t         *csdata;
5784     scsi_task_data_t *cdata;
5785
5786     cdata = wmem_new(wmem_packet_scope(), scsi_task_data_t);
5787     cdata->itl = itl;
5788     cdata->itlq = itlq;
5789     cdata->type = SCSI_PDU_TYPE_RSP;
5790     tap_queue_packet(scsi_tap, pinfo, cdata);
5791
5792     csdata = get_cmdset_data(itlq, itl);   /* will g_assert if itlq is null */
5793
5794     /* Nothing really to do here, just print some stuff passed to us
5795      */
5796     if (tree) {
5797         ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, 0,
5798                                             0, "SCSI Response (%s)",
5799                                             val_to_str_ext(itlq->scsi_opcode,
5800                                                            csdata->cdb_vals_ext,
5801                                                            "CDB:0x%02x"));
5802         scsi_tree = proto_item_add_subtree(ti, ett_scsi);
5803     }
5804
5805     ti = proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun);
5806     PROTO_ITEM_SET_GENERATED(ti);
5807
5808
5809     if (itl) {
5810         ti = proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK, "Command Set:%s (0x%02x) %s", val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"), itl->cmdset&SCSI_CMDSET_MASK,itl->cmdset&SCSI_CMDSET_DEFAULT?"(Using default commandset)":"");
5811         PROTO_ITEM_SET_GENERATED(ti);
5812
5813         if (itlq->scsi_opcode != 0xffff) {
5814             ti = proto_tree_add_uint(scsi_tree, csdata->hf_opcode, tvb, 0, 0, itlq->scsi_opcode);
5815             PROTO_ITEM_SET_GENERATED(ti);
5816         }
5817     }
5818
5819     if (itlq->first_exchange_frame) {
5820         nstime_t delta_time;
5821         ti = proto_tree_add_uint(scsi_tree, hf_scsi_request_frame, tvb, 0, 0, itlq->first_exchange_frame);
5822         PROTO_ITEM_SET_GENERATED(ti);
5823         nstime_delta(&delta_time, &pinfo->abs_ts, &itlq->fc_time);
5824         ti = proto_tree_add_time(scsi_tree, hf_scsi_time, tvb, 0, 0, &delta_time);
5825         PROTO_ITEM_SET_GENERATED(ti);
5826     }
5827
5828     ti = proto_tree_add_uint(scsi_tree, hf_scsi_status, tvb, 0, 0, scsi_status);
5829     PROTO_ITEM_SET_GENERATED(ti);
5830     col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: Response LUN: 0x%02x (%s) (%s)", itlq->lun,
5831                      val_to_str_ext(itlq->scsi_opcode, csdata->cdb_vals_ext, "CDB:0x%02x"),
5832                      val_to_str(scsi_status, scsi_status_val, "Unknown (0x%08x)"));
5833
5834     col_set_fence(pinfo->cinfo, COL_INFO);
5835 }
5836
5837 void
5838 dissect_scsi_snsinfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
5839                      guint offset, guint snslen, itlq_nexus_t *itlq, itl_nexus_t *itl)
5840 {
5841     proto_item       *ti;
5842     proto_tree       *sns_tree = NULL;
5843     const char       *old_proto;
5844     scsi_task_data_t *cdata;
5845
5846     cdata = wmem_new(wmem_packet_scope(), scsi_task_data_t);
5847     cdata->itl = itl;
5848     cdata->itlq = itlq;
5849     cdata->type = SCSI_PDU_TYPE_SNS;
5850     tap_queue_packet(scsi_tap, pinfo, cdata);
5851
5852
5853     old_proto = pinfo->current_proto;
5854     pinfo->current_proto="SCSI";
5855
5856     if (tree) {
5857         ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, offset,
5858                                             snslen, "SCSI: SNS Info");
5859         sns_tree = proto_item_add_subtree(ti, ett_scsi);
5860     }
5861
5862
5863     ti = proto_tree_add_uint(sns_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun);
5864     PROTO_ITEM_SET_GENERATED(ti);
5865     col_append_fstr(pinfo->cinfo, COL_INFO, " LUN:0x%02x ", itlq->lun);
5866
5867     col_set_fence(pinfo->cinfo, COL_INFO);
5868
5869     dissect_scsi_sense(tvb, sns_tree, offset);
5870
5871     pinfo->current_proto = old_proto;
5872 }
5873
5874
5875 static scsi_cdb_table_t spc[256] = {
5876     /*SPC 0x00*/{dissect_spc_testunitready},
5877     /*SPC 0x01*/{NULL},
5878     /*SPC 0x02*/{NULL},
5879     /*SPC 0x03*/{dissect_spc_requestsense},
5880     /*SPC 0x04*/{NULL},
5881     /*SPC 0x05*/{NULL},
5882     /*SPC 0x06*/{NULL},
5883     /*SPC 0x07*/{NULL},
5884     /*SPC 0x08*/{NULL},
5885     /*SPC 0x09*/{NULL},
5886     /*SPC 0x0a*/{NULL},
5887     /*SPC 0x0b*/{NULL},
5888     /*SPC 0x0c*/{NULL},
5889     /*SPC 0x0d*/{NULL},
5890     /*SPC 0x0e*/{NULL},
5891     /*SPC 0x0f*/{NULL},
5892     /*SPC 0x10*/{NULL},
5893     /*SPC 0x11*/{NULL},
5894     /*SPC 0x12*/{dissect_spc_inquiry},
5895     /*SPC 0x13*/{NULL},
5896     /*SPC 0x14*/{NULL},
5897     /*SPC 0x15*/{dissect_spc_modeselect6},
5898     /*SPC 0x16*/{dissect_spc_reserve6},
5899     /*SPC 0x17*/{dissect_spc_release6},
5900     /*SPC 0x18*/{NULL},
5901     /*SPC 0x19*/{NULL},
5902     /*SPC 0x1a*/{dissect_spc_modesense6},
5903     /*SPC 0x1b*/{NULL},
5904     /*SPC 0x1c*/{NULL},
5905     /*SPC 0x1d*/{dissect_spc_senddiagnostic},
5906     /*SPC 0x1e*/{dissect_spc_preventallowmediaremoval},
5907     /*SPC 0x1f*/{NULL},
5908     /*SPC 0x20*/{NULL},
5909     /*SPC 0x21*/{NULL},
5910     /*SPC 0x22*/{NULL},
5911     /*SPC 0x23*/{NULL},
5912     /*SPC 0x24*/{NULL},
5913     /*SPC 0x25*/{NULL},
5914     /*SPC 0x26*/{NULL},
5915     /*SPC 0x27*/{NULL},
5916     /*SPC 0x28*/{NULL},
5917     /*SPC 0x29*/{NULL},
5918     /*SPC 0x2a*/{NULL},
5919     /*SPC 0x2b*/{NULL},
5920     /*SPC 0x2c*/{NULL},
5921     /*SPC 0x2d*/{NULL},
5922     /*SPC 0x2e*/{NULL},
5923     /*SPC 0x2f*/{NULL},
5924     /*SPC 0x30*/{NULL},
5925     /*SPC 0x31*/{NULL},
5926     /*SPC 0x32*/{NULL},
5927     /*SPC 0x33*/{NULL},
5928     /*SPC 0x34*/{NULL},
5929     /*SPC 0x35*/{NULL},
5930     /*SPC 0x36*/{NULL},
5931     /*SPC 0x37*/{NULL},
5932     /*SPC 0x38*/{NULL},
5933     /*SPC 0x39*/{NULL},
5934     /*SPC 0x3a*/{NULL},
5935     /*SPC 0x3b*/{dissect_spc_writebuffer},
5936     /*SPC 0x3c*/{NULL},
5937     /*SPC 0x3d*/{NULL},
5938     /*SPC 0x3e*/{NULL},
5939     /*SPC 0x3f*/{NULL},
5940     /*SPC 0x40*/{NULL},
5941     /*SPC 0x41*/{NULL},
5942     /*SPC 0x42*/{NULL},
5943     /*SPC 0x43*/{NULL},
5944     /*SPC 0x44*/{NULL},
5945     /*SPC 0x45*/{NULL},
5946     /*SPC 0x46*/{NULL},
5947     /*SPC 0x47*/{NULL},
5948     /*SPC 0x48*/{NULL},
5949     /*SPC 0x49*/{NULL},
5950     /*SPC 0x4a*/{NULL},
5951     /*SPC 0x4b*/{NULL},
5952     /*SPC 0x4c*/{dissect_spc_logselect},
5953     /*SPC 0x4d*/{dissect_spc_logsense},
5954     /*SPC 0x4e*/{NULL},
5955     /*SPC 0x4f*/{NULL},
5956     /*SPC 0x50*/{NULL},
5957     /*SPC 0x51*/{NULL},
5958     /*SPC 0x52*/{NULL},
5959     /*SPC 0x53*/{NULL},
5960     /*SPC 0x54*/{NULL},
5961     /*SPC 0x55*/{dissect_spc_modeselect10},
5962     /*SPC 0x56*/{dissect_spc_reserve10},
5963     /*SPC 0x57*/{dissect_spc_release10},
5964     /*SPC 0x58*/{NULL},
5965     /*SPC 0x59*/{NULL},
5966     /*SPC 0x5a*/{dissect_spc_modesense10},
5967     /*SPC 0x5b*/{NULL},
5968     /*SPC 0x5c*/{NULL},
5969     /*SPC 0x5d*/{NULL},
5970     /*SPC 0x5e*/{dissect_spc_persistentreservein},
5971     /*SPC 0x5f*/{dissect_spc_persistentreserveout},
5972     /*SPC 0x60*/{NULL},
5973     /*SPC 0x61*/{NULL},
5974     /*SPC 0x62*/{NULL},
5975     /*SPC 0x63*/{NULL},
5976     /*SPC 0x64*/{NULL},
5977     /*SPC 0x65*/{NULL},
5978     /*SPC 0x66*/{NULL},
5979     /*SPC 0x67*/{NULL},
5980     /*SPC 0x68*/{NULL},
5981     /*SPC 0x69*/{NULL},
5982     /*SPC 0x6a*/{NULL},
5983     /*SPC 0x6b*/{NULL},
5984     /*SPC 0x6c*/{NULL},
5985     /*SPC 0x6d*/{NULL},
5986     /*SPC 0x6e*/{NULL},
5987     /*SPC 0x6f*/{NULL},
5988     /*SPC 0x70*/{NULL},
5989     /*SPC 0x71*/{NULL},
5990     /*SPC 0x72*/{NULL},
5991     /*SPC 0x73*/{NULL},
5992     /*SPC 0x74*/{NULL},
5993     /*SPC 0x75*/{NULL},
5994     /*SPC 0x76*/{NULL},
5995     /*SPC 0x77*/{NULL},
5996     /*SPC 0x78*/{NULL},
5997     /*SPC 0x79*/{NULL},
5998     /*SPC 0x7a*/{NULL},
5999     /*SPC 0x7b*/{NULL},
6000     /*SPC 0x7c*/{NULL},
6001     /*SPC 0x7d*/{NULL},
6002     /*SPC 0x7e*/{NULL},
6003     /*SPC 0x7f*/{dissect_scsi_varlencdb},
6004     /*SPC 0x80*/{NULL},
6005     /*SPC 0x81*/{NULL},
6006     /*SPC 0x82*/{NULL},
6007     /*SPC 0x83*/{dissect_spc_extcopy},
6008     /*SPC 0x84*/{dissect_spc_recvcopy},
6009     /*SPC 0x85*/{NULL},
6010     /*SPC 0x86*/{NULL},
6011     /*SPC 0x87*/{NULL},
6012     /*SPC 0x88*/{NULL},
6013     /*SPC 0x89*/{NULL},
6014     /*SPC 0x8a*/{NULL},
6015     /*SPC 0x8b*/{NULL},
6016     /*SPC 0x8c*/{NULL},
6017     /*SPC 0x8d*/{NULL},
6018     /*SPC 0x8e*/{NULL},
6019     /*SPC 0x8f*/{NULL},
6020     /*SPC 0x90*/{NULL},
6021     /*SPC 0x91*/{NULL},
6022     /*SPC 0x92*/{NULL},
6023     /*SPC 0x93*/{NULL},
6024     /*SPC 0x94*/{NULL},
6025     /*SPC 0x95*/{NULL},
6026     /*SPC 0x96*/{NULL},
6027     /*SPC 0x97*/{NULL},
6028     /*SPC 0x98*/{NULL},
6029     /*SPC 0x99*/{NULL},
6030     /*SPC 0x9a*/{NULL},
6031     /*SPC 0x9b*/{NULL},
6032     /*SPC 0x9c*/{NULL},
6033     /*SPC 0x9d*/{NULL},
6034     /*SPC 0x9e*/{NULL},
6035     /*SPC 0x9f*/{NULL},
6036     /*SPC 0xa0*/{dissect_spc_reportluns},
6037     /*SPC 0xa1*/{NULL},
6038     /*SPC 0xa2*/{NULL},
6039     /*SPC 0xa3*/{dissect_spc_reportdeviceidentifier},
6040     /*SPC 0xa4*/{NULL},
6041     /*SPC 0xa5*/{NULL},
6042     /*SPC 0xa6*/{NULL},
6043     /*SPC 0xa7*/{NULL},
6044     /*SPC 0xa8*/{NULL},
6045     /*SPC 0xa9*/{NULL},
6046     /*SPC 0xaa*/{NULL},
6047     /*SPC 0xab*/{NULL},
6048     /*SPC 0xac*/{NULL},
6049     /*SPC 0xad*/{NULL},
6050     /*SPC 0xae*/{NULL},
6051     /*SPC 0xaf*/{NULL},
6052     /*SPC 0xb0*/{NULL},
6053     /*SPC 0xb1*/{NULL},
6054     /*SPC 0xb2*/{NULL},
6055     /*SPC 0xb3*/{NULL},
6056     /*SPC 0xb4*/{NULL},
6057     /*SPC 0xb5*/{NULL},
6058     /*SPC 0xb6*/{NULL},
6059     /*SPC 0xb7*/{NULL},
6060     /*SPC 0xb8*/{NULL},
6061     /*SPC 0xb9*/{NULL},
6062     /*SPC 0xba*/{NULL},
6063     /*SPC 0xbb*/{NULL},
6064     /*SPC 0xbc*/{NULL},
6065     /*SPC 0xbd*/{NULL},
6066     /*SPC 0xbe*/{NULL},
6067     /*SPC 0xbf*/{NULL},
6068     /*SPC 0xc0*/{NULL},
6069     /*SPC 0xc1*/{NULL},
6070     /*SPC 0xc2*/{NULL},
6071     /*SPC 0xc3*/{NULL},
6072     /*SPC 0xc4*/{NULL},
6073     /*SPC 0xc5*/{NULL},
6074     /*SPC 0xc6*/{NULL},
6075     /*SPC 0xc7*/{NULL},
6076     /*SPC 0xc8*/{NULL},
6077     /*SPC 0xc9*/{NULL},
6078     /*SPC 0xca*/{NULL},
6079     /*SPC 0xcb*/{NULL},
6080     /*SPC 0xcc*/{NULL},
6081     /*SPC 0xcd*/{NULL},
6082     /*SPC 0xce*/{NULL},
6083     /*SPC 0xcf*/{NULL},
6084     /*SPC 0xd0*/{NULL},
6085     /*SPC 0xd1*/{NULL},
6086     /*SPC 0xd2*/{NULL},
6087     /*SPC 0xd3*/{NULL},
6088     /*SPC 0xd4*/{NULL},
6089     /*SPC 0xd5*/{NULL},
6090     /*SPC 0xd6*/{NULL},
6091     /*SPC 0xd7*/{NULL},
6092     /*SPC 0xd8*/{NULL},
6093     /*SPC 0xd9*/{NULL},
6094     /*SPC 0xda*/{NULL},
6095     /*SPC 0xdb*/{NULL},
6096     /*SPC 0xdc*/{NULL},
6097     /*SPC 0xdd*/{NULL},
6098     /*SPC 0xde*/{NULL},
6099     /*SPC 0xdf*/{NULL},
6100     /*SPC 0xe0*/{NULL},
6101     /*SPC 0xe1*/{NULL},
6102     /*SPC 0xe2*/{NULL},
6103     /*SPC 0xe3*/{NULL},
6104     /*SPC 0xe4*/{NULL},
6105     /*SPC 0xe5*/{NULL},
6106     /*SPC 0xe6*/{NULL},
6107     /*SPC 0xe7*/{NULL},
6108     /*SPC 0xe8*/{NULL},
6109     /*SPC 0xe9*/{NULL},
6110     /*SPC 0xea*/{NULL},
6111     /*SPC 0xeb*/{NULL},
6112     /*SPC 0xec*/{NULL},
6113     /*SPC 0xed*/{NULL},
6114     /*SPC 0xee*/{NULL},
6115     /*SPC 0xef*/{NULL},
6116     /*SPC 0xf0*/{NULL},
6117     /*SPC 0xf1*/{NULL},
6118     /*SPC 0xf2*/{NULL},
6119     /*SPC 0xf3*/{NULL},
6120     /*SPC 0xf4*/{NULL},
6121     /*SPC 0xf5*/{NULL},
6122     /*SPC 0xf6*/{NULL},
6123     /*SPC 0xf7*/{NULL},
6124     /*SPC 0xf8*/{NULL},
6125     /*SPC 0xf9*/{NULL},
6126     /*SPC 0xfa*/{NULL},
6127     /*SPC 0xfb*/{NULL},
6128     /*SPC 0xfc*/{NULL},
6129     /*SPC 0xfd*/{NULL},
6130     /*SPC 0xfe*/{NULL},
6131     /*SPC 0xff*/{NULL}
6132 };
6133
6134
6135 /* This function must be called with valid pointers for both itlq and itl */
6136 void
6137 dissect_scsi_cdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
6138                  gint devtype_arg _U_, itlq_nexus_t *itlq, itl_nexus_t *itl)
6139 {
6140     int               offset    = 0;
6141     proto_item       *ti;
6142     proto_tree       *scsi_tree = NULL;
6143     guint8            opcode;
6144 #if 0
6145     scsi_device_type  devtype;
6146 #endif
6147     const gchar      *valstr;
6148     scsi_task_data_t *cdata;
6149     const char       *old_proto;
6150     cmdset_t         *csdata;
6151
6152
6153     old_proto = pinfo->current_proto;
6154     pinfo->current_proto="SCSI";
6155
6156     if (!itlq) {
6157         DISSECTOR_ASSERT_NOT_REACHED();
6158     }
6159     if (!itl) {
6160         DISSECTOR_ASSERT_NOT_REACHED();
6161     }
6162
6163     opcode = tvb_get_guint8(tvb, offset);
6164     itlq->scsi_opcode = opcode;
6165     csdata = get_cmdset_data(itlq, itl);
6166
6167 #if 0 /* XXX: devtype never actually used ?? */
6168     if (devtype_arg != SCSI_DEV_UNKNOWN) {
6169         devtype = devtype_arg;
6170     } else {
6171         if (itl) {
6172             devtype = itl->cmdset;
6173         } else {
6174             devtype = (scsi_device_type)scsi_def_devtype;
6175         }
6176     }
6177 #endif
6178
6179     if ((valstr = try_val_to_str_ext(opcode, &scsi_spc_vals_ext)) == NULL) {
6180         valstr = try_val_to_str_ext(opcode, csdata->cdb_vals_ext);
6181     }
6182
6183     if (valstr != NULL) {
6184         col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: %s LUN: 0x%02x ", valstr, itlq->lun);
6185     } else {
6186         col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI Command: 0x%02x LUN:0x%02x ", opcode, itlq->lun);
6187     }
6188     /* make sure no one will overwrite this in the info column */
6189     col_set_fence(pinfo->cinfo, COL_INFO);
6190
6191     cdata = wmem_new(wmem_packet_scope(), scsi_task_data_t);
6192     cdata->itl = itl;
6193     cdata->itlq = itlq;
6194     cdata->type = SCSI_PDU_TYPE_CDB;
6195     tap_queue_packet(scsi_tap, pinfo, cdata);
6196
6197     if (tree) {
6198         ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, 0,
6199                                             -1, "SCSI CDB %s",
6200                                             val_to_str_ext(opcode,
6201                                                            csdata->cdb_vals_ext,
6202                                                            "0x%02x")
6203             );
6204         scsi_tree = proto_item_add_subtree(ti, ett_scsi);
6205     }
6206
6207     ti = proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun);
6208     PROTO_ITEM_SET_GENERATED(ti);
6209
6210     if (itl) {
6211         ti = proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK, "Command Set:%s (0x%02x) %s", val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"), itl->cmdset&SCSI_CMDSET_MASK,itl->cmdset&SCSI_CMDSET_DEFAULT?"(Using default commandset)":"");
6212         PROTO_ITEM_SET_GENERATED(ti);
6213     }
6214
6215     if (itlq->last_exchange_frame) {
6216         ti = proto_tree_add_uint(scsi_tree, hf_scsi_response_frame, tvb, 0, 0, itlq->last_exchange_frame);
6217         PROTO_ITEM_SET_GENERATED(ti);
6218     }
6219
6220
6221     if (valstr != NULL) {
6222         proto_tree_add_uint_format(scsi_tree, csdata->hf_opcode, tvb,
6223                                    offset, 1,
6224                                    tvb_get_guint8(tvb, offset),
6225                                    "Opcode: %s (0x%02x)", valstr,
6226                                    opcode);
6227     } else {
6228         proto_tree_add_item(scsi_tree, hf_scsi_spcopcode, tvb, offset, 1, ENC_BIG_ENDIAN);
6229     }
6230
6231     if (csdata->cdb_table[opcode].func) {
6232         csdata->cdb_table[opcode].func(tvb, pinfo, scsi_tree, offset+1,
6233                                        TRUE, TRUE, 0, cdata);
6234     } else if (spc[opcode].func) {
6235         spc[opcode].func(tvb, pinfo, scsi_tree, offset+1,
6236                          TRUE, TRUE, 0, cdata);
6237     } else {
6238         call_data_dissector(tvb, pinfo, scsi_tree);
6239     }
6240
6241     pinfo->current_proto = old_proto;
6242 }
6243
6244 void
6245 dissect_scsi_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
6246                      gboolean isreq, itlq_nexus_t *itlq, itl_nexus_t *itl,
6247                      guint32 relative_offset)
6248 {
6249     int               offset          = 0;
6250     proto_item       *ti;
6251     proto_tree       *scsi_tree       = NULL;
6252     guint8            opcode;
6253     scsi_task_data_t *cdata;
6254     int               payload_len;
6255     const char       *old_proto;
6256     cmdset_t         *csdata;
6257     guint32           expected_length;
6258     fragment_head    *ipfd_head;
6259     tvbuff_t         *next_tvb        = tvb;
6260     gboolean          update_col_info = TRUE;
6261     gboolean          more_frags      = FALSE;
6262
6263     if (!itlq || !itl) {
6264         /* we have no record of this exchange and so we can't dissect the
6265          * payload
6266          */
6267         expert_add_info(pinfo, tree, &ei_scsi_unknown_scsi_exchange);
6268         return;
6269     }
6270
6271     payload_len = tvb_reported_length(tvb);
6272     cdata = wmem_new(wmem_packet_scope(), scsi_task_data_t);
6273     cdata->itl = itl;
6274     cdata->itlq = itlq;
6275     cdata->type = SCSI_PDU_TYPE_CDB;
6276     tap_queue_packet(scsi_tap, pinfo, cdata);
6277
6278     csdata = get_cmdset_data(itlq, itl);
6279
6280     old_proto = pinfo->current_proto;
6281     pinfo->current_proto="SCSI";
6282
6283     opcode = (guint8) cdata->itlq->scsi_opcode;
6284
6285     if (tree) {
6286         ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, offset,
6287                                             payload_len,
6288                                             "SCSI Payload (%s %s)",
6289                                             val_to_str_ext(opcode,
6290                                                            csdata->cdb_vals_ext,
6291                                                            "CDB:0x%02x"),
6292                                             isreq ? "Request Data" : "Response Data");
6293         scsi_tree = proto_item_add_subtree(ti, ett_scsi);
6294     }
6295
6296     col_add_fstr(pinfo->cinfo, COL_INFO,
6297                     "SCSI: Data %s LUN: 0x%02x (%s %s) ",
6298                     isreq ? "Out" : "In",
6299                     itlq->lun,
6300                     val_to_str_ext(opcode, csdata->cdb_vals_ext, "0x%02x"),
6301                     isreq ? "Request Data" : "Response Data");
6302
6303     col_set_fence(pinfo->cinfo, COL_INFO);
6304
6305     ti = proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun);
6306     PROTO_ITEM_SET_GENERATED(ti);
6307
6308     if (itl) {
6309         ti = proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK,
6310                                         "Command Set:%s (0x%02x) %s",
6311                                         val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"),
6312                                         itl->cmdset&SCSI_CMDSET_MASK,
6313                                         itl->cmdset&SCSI_CMDSET_DEFAULT ? "(Using default commandset)" : "");
6314         PROTO_ITEM_SET_GENERATED(ti);
6315
6316         if (itlq && (itlq->scsi_opcode != 0xffff)) {
6317             ti = proto_tree_add_uint(scsi_tree, csdata->hf_opcode, tvb, 0, 0, itlq->scsi_opcode);
6318             PROTO_ITEM_SET_GENERATED(ti);
6319         }
6320     }
6321
6322     if (itlq->first_exchange_frame) {
6323         ti = proto_tree_add_uint(scsi_tree, hf_scsi_request_frame, tvb, 0, 0, itlq->first_exchange_frame);
6324         PROTO_ITEM_SET_GENERATED(ti);
6325     }
6326
6327     if (itlq->last_exchange_frame) {
6328         ti = proto_tree_add_uint(scsi_tree, hf_scsi_response_frame, tvb, 0, 0, itlq->last_exchange_frame);
6329         PROTO_ITEM_SET_GENERATED(ti);
6330     }
6331
6332
6333     /* If we don't know the CDB opcode there is no point in trying to
6334      * dissect the data.
6335      */
6336     if ( !itlq->first_exchange_frame ) {
6337         call_data_dissector(tvb, pinfo, scsi_tree);
6338         goto end_of_payload;
6339     }
6340
6341     /* If we are not doing data reassembly we only call the dissector
6342      * for the very first data in/out pdu in each transfer
6343      */
6344     if (!scsi_defragment) {
6345         if (relative_offset) {
6346             call_data_dissector(tvb, pinfo, scsi_tree);
6347             goto end_of_payload;
6348         } else {
6349             goto dissect_the_payload;
6350         }
6351     }
6352
6353     /* If we don't have the entire PDU there is no point in even trying
6354      * reassembly
6355      */
6356     if (tvb_captured_length_remaining(tvb, offset) != tvb_reported_length_remaining(tvb, offset)) {
6357         if (relative_offset) {
6358             call_data_dissector(tvb, pinfo, scsi_tree);
6359             goto end_of_payload;
6360         } else {
6361             goto dissect_the_payload;
6362         }
6363     }
6364
6365
6366     /* What is the expected data length for this transfer */
6367     if ( (itlq->task_flags&(SCSI_DATA_READ|SCSI_DATA_WRITE)) == (SCSI_DATA_READ|SCSI_DATA_WRITE) ) {
6368         /* This is a bidirectional transfer */
6369         if (isreq) {
6370             expected_length = itlq->data_length;
6371         } else {
6372             expected_length = itlq->bidir_data_length;
6373         }
6374     } else {
6375         /* This is a unidirectional transfer */
6376         expected_length = itlq->data_length;
6377     }
6378
6379     /* If this PDU already contains all the expected data we don't have to do
6380      * reassembly.
6381      */
6382     if ( (!relative_offset) && ((guint32)tvb_reported_length_remaining(tvb, offset) == expected_length) ) {
6383         goto dissect_the_payload;
6384     }
6385
6386
6387     /* Start reassembly */
6388
6389     if (tvb_reported_length_remaining(tvb, offset) < 0) {
6390         goto end_of_payload;
6391     }
6392     if ((tvb_reported_length_remaining(tvb,offset) + relative_offset) != expected_length) {
6393         more_frags = TRUE;
6394     }
6395     ipfd_head = fragment_add_check(&scsi_reassembly_table, tvb, offset,
6396                                    pinfo,
6397                                    itlq->first_exchange_frame, /* key */
6398                                    NULL,
6399                                    relative_offset,
6400                                    tvb_reported_length_remaining(tvb, offset),
6401                                    more_frags);
6402     next_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled SCSI DATA", ipfd_head, &scsi_frag_items, &update_col_info, tree);
6403
6404     if ( ipfd_head && (ipfd_head->reassembled_in != pinfo->num) ) {
6405         col_prepend_fstr(pinfo->cinfo, COL_INFO, "[Reassembled in #%u] ",
6406                              ipfd_head->reassembled_in);
6407     }
6408
6409
6410 dissect_the_payload:
6411     if (!next_tvb) {
6412         /* reassembly has not yet finished so we don't have a tvb yet */
6413         goto end_of_payload;
6414     }
6415     if (tree == NULL) {
6416         /*
6417          * We have to dissect INQUIRY responses, in order to determine the
6418          * types of devices.
6419          *
6420          * We don't bother dissecting other payload if we're not building
6421          * a protocol tree.
6422          *
6423          * We assume opcode 0x12 is always INQUIRY regardless of the
6424          * commandset used.
6425          */
6426         if (opcode == SCSI_SPC_INQUIRY) {
6427             dissect_spc_inquiry(next_tvb, pinfo, scsi_tree, offset, isreq,
6428                                 FALSE, payload_len, cdata);
6429         }
6430     } else {
6431         /*
6432           All commandsets support SPC?
6433         */
6434         if (csdata->cdb_table && (csdata->cdb_table)[opcode].func) {
6435             (csdata->cdb_table)[opcode].func(next_tvb, pinfo, scsi_tree, offset,
6436                                              isreq, FALSE, payload_len, cdata);
6437         } else if (spc[opcode].func) {
6438             spc[opcode].func(next_tvb, pinfo, scsi_tree, offset,
6439                              isreq, FALSE, payload_len, cdata);
6440         } else { /* don't know this CDB */
6441             call_data_dissector(next_tvb, pinfo, scsi_tree);
6442         }
6443     }
6444
6445 end_of_payload:
6446     pinfo->current_proto = old_proto;
6447 }
6448
6449 static cmdset_t *
6450 get_cmdset_data(itlq_nexus_t *itlq, itl_nexus_t *itl)
6451 {
6452     cmdset_t *csdata;
6453     guint8    cmdset;
6454
6455     /* we must have an itlq structure */
6456     if (!itlq) {
6457         DISSECTOR_ASSERT_NOT_REACHED();
6458     }
6459
6460     if (itl) {
6461         if (itl->cmdset == 0xff) {
6462             itl->cmdset = scsi_def_devtype|SCSI_CMDSET_DEFAULT;
6463         }
6464         cmdset = itl->cmdset;
6465     } else {
6466         cmdset = scsi_def_devtype;
6467     }
6468
6469     csdata = wmem_new(wmem_packet_scope(), cmdset_t);
6470
6471     switch(cmdset&SCSI_CMDSET_MASK) {
6472     case SCSI_DEV_SBC:
6473         csdata->hf_opcode    = hf_scsi_sbc_opcode;
6474         csdata->cdb_vals_ext = &scsi_sbc_vals_ext;
6475         csdata->cdb_table    = scsi_sbc_table;
6476         break;
6477     case SCSI_DEV_CDROM:
6478         csdata->hf_opcode    = hf_scsi_mmc_opcode;
6479         csdata->cdb_vals_ext = &scsi_mmc_vals_ext;
6480         csdata->cdb_table    = scsi_mmc_table;
6481         break;
6482     case SCSI_DEV_SSC:
6483         csdata->hf_opcode    = hf_scsi_ssc_opcode;
6484         csdata->cdb_vals_ext = &scsi_ssc_vals_ext;
6485         csdata->cdb_table    = scsi_ssc_table;
6486         break;
6487     case SCSI_DEV_SMC:
6488         csdata->hf_opcode    = hf_scsi_smc_opcode;
6489         csdata->cdb_vals_ext = &scsi_smc_vals_ext;
6490         csdata->cdb_table    = scsi_smc_table;
6491         break;
6492     case SCSI_DEV_OSD:
6493         csdata->hf_opcode    = hf_scsi_osd_opcode;
6494         csdata->cdb_vals_ext = &scsi_osd_vals_ext;
6495         csdata->cdb_table    = scsi_osd_table;
6496         break;
6497     default:
6498         csdata->hf_opcode    = hf_scsi_spcopcode;
6499         csdata->cdb_vals_ext = &scsi_spc_vals_ext;
6500         csdata->cdb_table    = spc;
6501         break;
6502     }
6503
6504     return csdata;
6505 }
6506
6507
6508 void
6509 proto_register_scsi(void)
6510 {
6511     static hf_register_info hf[] = {
6512         { &hf_scsi_status,
6513           { "Status", "scsi.status", FT_UINT8, BASE_HEX,
6514             VALS(scsi_status_val), 0, "SCSI command status value", HFILL }},
6515         { &hf_scsi_spcopcode,
6516           {"SPC-2 Opcode", "scsi.spc.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
6517            &scsi_spc_vals_ext, 0x0, NULL, HFILL}},
6518         { &hf_scsi_control,
6519           {"Control", "scsi.cdb.control", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
6520            HFILL}},
6521         { &hf_scsi_control_vendor_specific,
6522           {"Vendor specific", "scsi.cdb.control.vendorspecific", FT_UINT8,
6523            BASE_HEX, NULL, 0xC0, NULL, HFILL}},
6524         { &hf_scsi_control_reserved,
6525           {"Reserved", "scsi.cdb.control.reserved", FT_UINT8, BASE_HEX, NULL,
6526            0x38, NULL, HFILL}},
6527         { &hf_scsi_control_naca,
6528           {"NACA", "scsi.cdb.control.naca", FT_BOOLEAN, 8,
6529            TFS(&scsi_naca_tfs), 0x04, NULL, HFILL}},
6530         { &hf_scsi_control_obs1,
6531           {"Obsolete", "scsi.cdb.control.obs1", FT_UINT8, BASE_HEX,
6532            NULL, 0x02, NULL, HFILL}},
6533         { &hf_scsi_control_obs2,
6534           {"Obsolete", "scsi.cdb.control.obs2", FT_UINT8, BASE_HEX,
6535            NULL, 0x01, NULL, HFILL}},
6536         { &hf_scsi_inq_control,
6537           {"Control", "scsi.cdb.inq.control", FT_UINT8, BASE_HEX, NULL, 0x0,
6538            NULL, HFILL}},
6539         { &hf_scsi_inquiry_flags,
6540           {"Inquiry Flags", "scsi.inquiry.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
6541            HFILL}},
6542         { &hf_scsi_inquiry_evpd_page,
6543           {"EVPD Page Code", "scsi.inquiry.evpd.pagecode", FT_UINT8, BASE_HEX,
6544            VALS(scsi_evpd_pagecode_val), 0x0, NULL, HFILL}},
6545         { &hf_scsi_inquiry_cmdt_page,
6546           {"CMDT Page Code", "scsi.inquiry.cmdt.pagecode", FT_UINT8, BASE_HEX,
6547            NULL, 0x0, NULL, HFILL}},
6548         { &hf_scsi_alloclen,
6549           {"Allocation Length", "scsi.cdb.alloclen", FT_UINT8, BASE_DEC, NULL,
6550            0x0, NULL, HFILL}},
6551         { &hf_scsi_paramlen,
6552           {"Parameter Length", "scsi.cdb.paramlen", FT_UINT8, BASE_DEC, NULL,
6553            0x0, NULL, HFILL}},
6554         { &hf_scsi_log_pc,
6555           {"Page Control", "scsi.log.pc", FT_UINT8, BASE_DEC,
6556            VALS(scsi_log_pc_val), 0xC0, NULL, HFILL}},
6557         { &hf_scsi_log_pagecode,
6558           {"Page Code", "scsi.log.pagecode", FT_UINT8, BASE_HEX,
6559            VALS(scsi_log_page_val), 0x3F, NULL, HFILL}},
6560         { &hf_scsi_paramlen16,
6561           {"Parameter Length", "scsi.cdb.paramlen16", FT_UINT16, BASE_DEC, NULL,
6562            0x0, NULL, HFILL}},
6563         { &hf_scsi_modesel_flags,
6564           {"Mode Sense/Select Flags", "scsi.cdb.mode.flags", FT_UINT8, BASE_HEX,
6565            NULL, 0x0, NULL, HFILL}},
6566         { &hf_scsi_alloclen16,
6567           {"Allocation Length", "scsi.cdb.alloclen16", FT_UINT16, BASE_DEC,
6568            NULL, 0x0, NULL, HFILL}},
6569         { &hf_scsi_modesns_pc,
6570           {"Page Control", "scsi.mode.pc", FT_UINT8, BASE_DEC,
6571            VALS(scsi_modesns_pc_val), 0xC0, NULL, HFILL}},
6572         { &hf_scsi_spc_subpagecode,
6573           {"SubPage Code", "scsi.mode.spc.subpagecode", FT_UINT8, BASE_HEX,
6574            NULL, 0, NULL, HFILL}},
6575         { &hf_scsi_spc_pagecode,
6576           {"SPC-2 Page Code", "scsi.mode.spc.pagecode", FT_UINT8, BASE_HEX,
6577            VALS(scsi_spc_modepage_val), 0x3F, NULL, HFILL}},
6578         { &hf_scsi_sbcpagecode,
6579           {"SBC-2 Page Code", "scsi.mode.sbc.pagecode", FT_UINT8, BASE_HEX,
6580            VALS(scsi_sbc_modepage_val), 0x3F, NULL, HFILL}},
6581         { &hf_scsi_sscpagecode,
6582           {"SSC-2 Page Code", "scsi.mode.ssc.pagecode", FT_UINT8, BASE_HEX,
6583            VALS(scsi_ssc2_modepage_val), 0x3F, NULL, HFILL}},
6584         { &hf_scsi_mmcpagecode,
6585           {"MMC-5 Page Code", "scsi.mode.mmc.pagecode", FT_UINT8, BASE_HEX,
6586            VALS(scsi_mmc5_modepage_val), 0x3F, NULL, HFILL}},
6587         { &hf_scsi_smcpagecode,
6588           {"SMC-2 Page Code", "scsi.mode.smc.pagecode", FT_UINT8, BASE_HEX,
6589            VALS(scsi_smc_modepage_val), 0x3F, NULL, HFILL}},
6590         { &hf_scsi_modesns_flags,
6591           {"Mode Sense Flags", "scsi.mode.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
6592            HFILL}},
6593         { &hf_scsi_persresvin_svcaction,
6594           {"Service Action", "scsi.persresvin.svcaction", FT_UINT8, BASE_HEX,
6595            VALS(scsi_persresvin_svcaction_val), 0x1F, NULL, HFILL}},
6596         { &hf_scsi_persresvout_svcaction,
6597           {"Service Action", "scsi.persresvout.svcaction", FT_UINT8, BASE_HEX,
6598            VALS(scsi_persresvout_svcaction_val), 0x1F, NULL, HFILL}},
6599         { &hf_scsi_persresv_scope,
6600           {"Reservation Scope", "scsi.persresv.scope", FT_UINT8, BASE_HEX,
6601            VALS(scsi_persresv_scope_val), 0xF0, NULL, HFILL}},
6602         { &hf_scsi_persresv_type,
6603           {"Reservation Type", "scsi.persresv.type", FT_UINT8, BASE_HEX,
6604            VALS(scsi_persresv_type_val), 0x0F, NULL, HFILL}},
6605         { &hf_scsi_persresvout_reskey,
6606           {"Reservation Key", "scsi.persresv.reskey", FT_BYTES, BASE_NONE,
6607            NULL, 0x0, NULL, HFILL}},
6608         { &hf_scsi_persresvout_sareskey,
6609           {"Service Action Reservation Key", "scsi.persresv.sareskey", FT_BYTES,
6610            BASE_NONE, NULL, 0x0, NULL, HFILL}},
6611         { &hf_scsi_persresvout_obsolete,
6612           {"Obsolete", "scsi.presresv.obs", FT_BYTES, BASE_NONE, NULL, 0x0,
6613            NULL, HFILL}},
6614         { &hf_scsi_persresvout_control,
6615           {"Control", "scsi.presresv.control", FT_UINT8, BASE_HEX, NULL, 0x0,
6616            NULL, HFILL}},
6617         /* Service action REGISTER AND MOVE */
6618         { &hf_scsi_persresv_control_rsvd,
6619           {"Reserved", "scsi.persresv.control.reserved", FT_UINT8, BASE_HEX,
6620            NULL, 0xFC, NULL, HFILL}},
6621         { &hf_scsi_persresv_control_unreg,
6622           {"unreg", "scsi.persresv.control.unreg", FT_BOOLEAN, 8,
6623            NULL, 0x02, NULL, HFILL}},
6624         /* Other service actions than REGISTER AND MOVE */
6625         { &hf_scsi_persresv_control_rsvd1,
6626           {"Reserved", "scsi.persresv.control.reserved1", FT_UINT8, BASE_HEX,
6627            NULL, 0xF0, NULL, HFILL}},
6628         { &hf_scsi_persresv_control_rsvd2,
6629           {"Reserved", "scsi.persresv.control.reserved2", FT_UINT8, BASE_HEX,
6630            NULL, 0x02, NULL, HFILL}},
6631         { &hf_scsi_persresv_control_spec_i_pt,
6632           {"SPEC_I_PT", "scsi.persresv.control.spec_i_pt", FT_BOOLEAN, 8,
6633            TFS(&scsi_spec_i_pt_tfs), 0x08, NULL, HFILL}},
6634         { &hf_scsi_persresv_control_all_tg_pt,
6635           {"ALL_TG_PT", "scsi.persresv.control.all_tg_pt", FT_BOOLEAN, 8,
6636            TFS(&scsi_all_tg_pt_tfs), 0x04, NULL, HFILL}},
6637         { &hf_scsi_persresv_control_aptpl,
6638           {"aptpl", "scsi.persresv.control.aptpl", FT_BOOLEAN, 8,
6639            TFS(&scsi_aptpl_tfs), 0x01, NULL, HFILL}},
6640         { &hf_scsi_persresvout_rel_tpi,
6641           {"rel_tpi", "scsi.persresv.rel_tpi", FT_UINT16, BASE_DEC,
6642            NULL, 0x0, NULL, HFILL}},
6643         { &hf_scsi_persresvout_transportid_len,
6644           {"transportid_len", "scsi.persresv.transportid_len",
6645            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
6646         { &hf_scsi_persresvout_transportid,
6647           {"transportid_len", "scsi.persresv.transportid",
6648            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6649         { &hf_scsi_release_flags,
6650           {"Release Flags", "scsi.release.flags", FT_UINT8, BASE_HEX, NULL,
6651            0x0, NULL, HFILL}},
6652         { &hf_scsi_release_thirdpartyid,
6653           {"Third-Party ID", "scsi.release.thirdpartyid", FT_BYTES, BASE_NONE,
6654            NULL, 0x0, NULL, HFILL}},
6655         { &hf_scsi_alloclen32,
6656           {"Allocation Length", "scsi.cdb.alloclen32", FT_UINT32, BASE_DEC,
6657            NULL, 0x0, NULL, HFILL}},
6658         { &hf_scsi_inq_add_len,
6659           {"Additional Length", "scsi.inquiry.add_len", FT_UINT8, BASE_DEC,
6660            NULL, 0, NULL, HFILL}},
6661         { &hf_scsi_inq_qualifier,
6662           {"Qualifier", "scsi.inquiry.qualifier", FT_UINT8, BASE_HEX,
6663            VALS(scsi_qualifier_val), 0xE0, NULL, HFILL}},
6664         { &hf_scsi_inq_peripheral,
6665           {"Peripheral", "scsi.inquiry.peripheral", FT_UINT8, BASE_HEX,
6666            NULL, 0, NULL, HFILL}},
6667         { &hf_scsi_inq_vendor_id,
6668           {"Vendor Id", "scsi.inquiry.vendor_id", FT_STRING, BASE_NONE,
6669            NULL, 0, NULL, HFILL}},
6670         { &hf_scsi_inq_product_id,
6671           {"Product Id", "scsi.inquiry.product_id", FT_STRING, BASE_NONE,
6672            NULL, 0, NULL, HFILL}},
6673         { &hf_scsi_inq_product_rev,
6674           {"Product Revision Level", "scsi.inquiry.product_rev", FT_STRING, BASE_NONE,
6675            NULL, 0, NULL, HFILL}},
6676         { &hf_scsi_inq_vendor_specific,
6677           {"Vendor Specific", "scsi.inquiry.vendor_specific", FT_BYTES, BASE_NONE,
6678            NULL, 0, NULL, HFILL}},
6679         { &hf_scsi_inq_version_desc,
6680           {"Version Description", "scsi.inquiry.version_desc", FT_UINT16, BASE_HEX|BASE_EXT_STRING,
6681            &scsi_verdesc_val_ext, 0, NULL, HFILL}},
6682         { &hf_scsi_inq_devtype,
6683           {"Device Type", "scsi.inquiry.devtype", FT_UINT8, BASE_HEX,
6684            VALS(scsi_devtype_val), SCSI_DEV_BITS, NULL, HFILL}},
6685         { &hf_scsi_inq_rmb,
6686           {"Removable", "scsi.inquiry.removable", FT_BOOLEAN, 8,
6687            TFS(&scsi_removable_val), 0x80, NULL, HFILL}},
6688         { & hf_scsi_inq_version,
6689           {"Version", "scsi.inquiry.version", FT_UINT8, BASE_HEX,
6690            VALS(scsi_inquiry_vers_val), 0x0, NULL, HFILL}},
6691         { &hf_scsi_inq_reladrflags,
6692           {"Inquiry RelAdr Flags", "scsi.inquiry.reladrflags", FT_UINT8, BASE_HEX, NULL, 0,
6693            NULL, HFILL}},
6694         { &hf_scsi_inq_reladr,
6695           {"RelAdr", "scsi.inquiry.reladr", FT_BOOLEAN, 8, TFS(&reladr_tfs), SCSI_INQ_RELADRFLAGS_RELADR,
6696            NULL, HFILL}},
6697         { &hf_scsi_inq_linked,
6698           {"Linked", "scsi.inquiry.linked", FT_BOOLEAN, 8, TFS(&linked_tfs), SCSI_INQ_RELADRFLAGS_LINKED,
6699            NULL, HFILL}},
6700         { &hf_scsi_inq_trandis,
6701           {"TranDis", "scsi.inquiry.trandis", FT_BOOLEAN, 8, NULL, SCSI_INQ_RELADRFLAGS_TRANDIS,
6702            NULL, HFILL}},
6703         { &hf_scsi_inq_cmdque,
6704           {"CmdQue", "scsi.inquiry.cmdque", FT_BOOLEAN, 8, TFS(&cmdque_tfs), SCSI_INQ_RELADRFLAGS_CMDQUE,
6705            NULL, HFILL}},
6706         { &hf_scsi_inq_bqueflags,
6707           {"Inquiry BQue Flags", "scsi.inquiry.bqueflags", FT_UINT8, BASE_HEX, NULL, 0,
6708            NULL, HFILL}},
6709         { &hf_scsi_inq_bque,
6710           {"BQue", "scsi.inquiry.bque", FT_BOOLEAN, 8, TFS(&bque_tfs), SCSI_INQ_BQUEFLAGS_BQUE,
6711            NULL, HFILL}},
6712         { &hf_scsi_inq_encserv,
6713           {"EncServ", "scsi.inquiry.encserv", FT_BOOLEAN, 8, TFS(&encserv_tfs), SCSI_INQ_BQUEFLAGS_ENCSERV,
6714            NULL, HFILL}},
6715         { &hf_scsi_inq_multip,
6716           {"MultiP", "scsi.inquiry.multip", FT_BOOLEAN, 8, TFS(&multip_tfs), SCSI_INQ_BQUEFLAGS_MULTIP,
6717            NULL, HFILL}},
6718         { &hf_scsi_inq_mchngr,
6719           {"MChngr", "scsi.inquiry.mchngr", FT_BOOLEAN, 8, TFS(&mchngr_tfs), SCSI_INQ_BQUEFLAGS_MCHNGR,
6720            NULL, HFILL}},
6721         { &hf_scsi_inq_ackreqq,
6722           {"ACKREQQ", "scsi.inquiry.ackreqq", FT_BOOLEAN, 8, NULL, SCSI_INQ_BQUEFLAGS_ACKREQQ,
6723            NULL, HFILL}},
6724         { &hf_scsi_inq_sccsflags,
6725           {"Inquiry SCCS Flags", "scsi.inquiry.sccsflags", FT_UINT8, BASE_HEX, NULL, 0,
6726            NULL, HFILL}},
6727         { &hf_scsi_inq_sccs,
6728           {"SCCS", "scsi.inquiry.sccs", FT_BOOLEAN, 8, TFS(&sccs_tfs), SCSI_INQ_SCCSFLAGS_SCCS,
6729            NULL, HFILL}},
6730         { &hf_scsi_inq_acc,
6731           {"ACC", "scsi.inquiry.acc", FT_BOOLEAN, 8, TFS(&acc_tfs), SCSI_INQ_SCCSFLAGS_ACC,
6732            NULL, HFILL}},
6733         { &hf_scsi_inq_tpc,
6734           {"3PC", "scsi.inquiry.tpc", FT_BOOLEAN, 8, TFS(&tpc_tfs), SCSI_INQ_SCCSFLAGS_TPC,
6735            NULL, HFILL}},
6736         { &hf_scsi_inq_protect,
6737           {"Protect", "scsi.inquiry.protect", FT_BOOLEAN, 8, TFS(&protect_tfs), SCSI_INQ_SCCSFLAGS_PROTECT,
6738            NULL, HFILL}},
6739         { &hf_scsi_inq_tpgs,
6740           {"TPGS", "scsi.inquiry.tpgs", FT_UINT8, BASE_DEC, VALS(inq_tpgs_vals), 0x30,
6741            NULL, HFILL}},
6742         { &hf_scsi_inq_acaflags,
6743           {"Inquiry ACA Flags", "scsi.inquiry.acaflags", FT_UINT8, BASE_HEX, NULL, 0,
6744            NULL, HFILL}},
6745         { &hf_scsi_inq_control_vendor_specific,
6746           {"Vendor specific", "scsi.inquiry.control.vendorspecific", FT_UINT8,
6747            BASE_HEX, NULL, 0xC0, NULL, HFILL}},
6748         { &hf_scsi_inq_control_reserved,
6749           {"Reserved", "scsi.inquiry.control.reserved", FT_UINT8, BASE_HEX,
6750            NULL, 0x38, NULL, HFILL}},
6751         { &hf_scsi_inq_control_naca,
6752           {"NACA", "scsi.inquiry.control.naca", FT_BOOLEAN, 8,
6753            TFS(&scsi_naca_tfs), 0x04, NULL, HFILL}},
6754         { &hf_scsi_inq_control_obs1,
6755           {"Obsolete", "scsi.inquiry.control.obs1", FT_UINT8, BASE_HEX,
6756            NULL, 0x02, NULL, HFILL}},
6757         { &hf_scsi_inq_control_obs2,
6758           {"Obsolete", "scsi.inquiry.control.obs2", FT_UINT8, BASE_HEX,
6759            NULL, 0x01, NULL, HFILL}},
6760         { &hf_scsi_inq_rmbflags,
6761           {"Inquiry RMB Flags", "scsi.inquiry.rmbflags", FT_UINT8, BASE_HEX, NULL, 0,
6762            NULL, HFILL}},
6763         { &hf_scsi_inq_normaca,
6764           {"NormACA", "scsi.inquiry.normaca", FT_BOOLEAN, 8, TFS(&normaca_tfs), SCSI_INQ_ACAFLAGS_NORMACA,
6765            NULL, HFILL}},
6766         { &hf_scsi_inq_hisup,
6767           {"HiSup", "scsi.inquiry.hisup", FT_BOOLEAN, 8, TFS(&hisup_tfs), SCSI_INQ_ACAFLAGS_HISUP,
6768            NULL, HFILL}},
6769         { &hf_scsi_inq_aerc,
6770           {"AERC", "scsi.inquiry.aerc", FT_BOOLEAN, 8, TFS(&aerc_tfs), SCSI_INQ_ACAFLAGS_AERC,
6771            "AERC is obsolete from SPC-3 and forward", HFILL}},
6772         { &hf_scsi_inq_trmtsk,
6773           {"TrmTsk", "scsi.inquiry.trmtsk", FT_BOOLEAN, 8, TFS(&trmtsk_tfs), SCSI_INQ_ACAFLAGS_TRMTSK,
6774            "TRMTSK is obsolete from SPC-2 and forward", HFILL}},
6775         { &hf_scsi_inq_rdf,
6776           {"Response Data Format", "scsi.inquiry.rdf", FT_UINT8, BASE_DEC, VALS(inq_rdf_vals), 0x0f,
6777            NULL, HFILL}},
6778         { &hf_scsi_modesns_errrep,
6779           {"MRIE", "scsi.mode.mrie", FT_UINT8, BASE_HEX,
6780            VALS(scsi_modesns_mrie_val), 0x0F, NULL, HFILL}},
6781         { &hf_scsi_modesns_tst,
6782           {"Task Set Type", "scsi.mode.tst", FT_UINT8, BASE_DEC,
6783            VALS(scsi_modesns_tst_val), 0xE0, NULL, HFILL}},
6784         { &hf_scsi_modesns_qmod,
6785           {"Queue Algorithm Modifier", "scsi.mode.qmod", FT_UINT8, BASE_HEX,
6786            VALS(scsi_modesns_qmod_val), 0xF0, NULL, HFILL}},
6787         { &hf_scsi_modesns_qerr,
6788           {"Queue Error Management", "scsi.mode.qerr", FT_BOOLEAN, 8,
6789            TFS(&scsi_modesns_qerr_val), 0x2, NULL, HFILL}},
6790         { &hf_scsi_modesns_tas,
6791           {"Task Aborted Status", "scsi.mode.tac", FT_BOOLEAN, 8,
6792            TFS(&scsi_modesns_tas_val), 0x80, NULL, HFILL}},
6793         { &hf_scsi_modesns_rac,
6794           {"Report a Check", "scsi.mode.rac", FT_BOOLEAN, 8,
6795            TFS(&scsi_modesns_rac_val), 0x40, NULL, HFILL}},
6796         { &hf_scsi_protocol,
6797           {"Protocol", "scsi.proto", FT_UINT8, BASE_DEC, VALS(scsi_proto_val),
6798            0x0F, NULL, HFILL}},
6799         { &hf_scsi_sns_errtype,
6800           {"SNS Error Type", "scsi.sns.errtype", FT_UINT8, BASE_HEX,
6801            VALS(scsi_sns_errtype_val), 0x7F, NULL, HFILL}},
6802         { &hf_scsi_snskey,
6803           {"Sense Key", "scsi.sns.key", FT_UINT8, BASE_HEX,
6804            VALS(scsi_sensekey_val), 0x0F, NULL, HFILL}},
6805         { &hf_scsi_snsinfo,
6806           {"Sense Info", "scsi.sns.info", FT_UINT32, BASE_HEX, NULL, 0x0, NULL,
6807            HFILL}},
6808         { &hf_scsi_addlsnslen,
6809           {"Additional Sense Length", "scsi.sns.addlen", FT_UINT8, BASE_DEC,
6810            NULL, 0x0, NULL, HFILL}},
6811         { &hf_scsi_asc,
6812           {"Additional Sense Code", "scsi.sns.asc", FT_UINT8, BASE_HEX, NULL,
6813            0x0, NULL, HFILL}},
6814         { &hf_scsi_ascq,
6815           {"Additional Sense Code Qualifier", "scsi.sns.ascq", FT_UINT8,
6816            BASE_HEX, NULL, 0x0, NULL, HFILL}},
6817         { &hf_scsi_ascascq,
6818           {"Additional Sense Code+Qualifier", "scsi.sns.ascascq", FT_UINT16,
6819            BASE_HEX|BASE_EXT_STRING, &scsi_asc_val_ext, 0x0, NULL, HFILL}},
6820         { &hf_scsi_fru,
6821           {"Field Replaceable Unit Code", "scsi.sns.fru", FT_UINT8, BASE_HEX,
6822            NULL, 0x0, NULL, HFILL}},
6823         { &hf_scsi_sksv,
6824           {"SKSV", "scsi.sns.sksv", FT_BOOLEAN, 8, NULL, 0x80, NULL,
6825            HFILL}},
6826         { &hf_scsi_sks_info,
6827           {"Sense Key Specific", "scsi.sns.sks_info", FT_UINT24, BASE_HEX, NULL, 0x7FFFFF, NULL, HFILL}},
6828         { &hf_scsi_sks_fp_cd,
6829           {"Command/Data", "scsi.sns.sks.fp.cd", FT_UINT24, BASE_HEX, VALS(scsi_sense_sks_fp_cd_val), 0x400000, NULL, HFILL}},
6830         { &hf_scsi_sks_fp_bpv,
6831           {"Bit pointer valid", "scsi.sns.sks.fp.bpv", FT_BOOLEAN, 24, NULL, 0x080000, NULL, HFILL}},
6832         { &hf_scsi_sks_fp_bit,
6833           {"Bit pointer", "scsi.sns.sks.fp.bit", FT_UINT24, BASE_DEC, NULL, 0x070000, NULL, HFILL}},
6834         { &hf_scsi_sks_fp_field,
6835           {"Field pointer", "scsi.sns.sks.fp.field", FT_UINT24, BASE_DEC, NULL, 0x00FFFF, NULL, HFILL}},
6836         { &hf_scsi_sns_desc_type,
6837           {"Sense data descriptor type", "scsi.sns.desc.type", FT_UINT8, BASE_HEX, VALS(scsi_sense_desc_type_val), 0, NULL, HFILL}},
6838         { &hf_scsi_sns_desc_length,
6839             {"Sense data descriptor length", "scsi.sns.desc.length", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6840         { &hf_scsi_sns_osd_object_not_initiated,
6841             {"Not initiated", "scsi.sns.desc.osd_object.not_initiated", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}},
6842         { &hf_scsi_sns_osd_object_completed,
6843             {"Completed", "scsi.sns.desc.osd_object.completed", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}},
6844         { &hf_scsi_sns_osd_object_validation,
6845             {"VALIDATION", "scsi.sns.desc.osd_object.validation", FT_BOOLEAN, 32, NULL, 0x80000000, NULL, HFILL}},
6846         { &hf_scsi_sns_osd_object_cmd_cap_v,
6847             {"CMD_CAP_V", "scsi.sns.desc.osd_object.cmd_cap_v",   FT_BOOLEAN, 32, NULL, 0x20000000, NULL, HFILL}},
6848         { &hf_scsi_sns_osd_object_command,
6849             {"COMMAND", "scsi.sns.desc.osd_object.command",       FT_BOOLEAN, 32, NULL, 0x10000000, NULL, HFILL}},
6850         { &hf_scsi_sns_osd_object_imp_st_att,
6851             {"IMP_ST_ATT", "scsi.sns.desc.osd_object.imp_st_att", FT_BOOLEAN, 32, NULL, 0x00100000, NULL, HFILL}},
6852         { &hf_scsi_sns_osd_object_sa_cap_v,
6853             {"SA_CAP_V", "scsi.sns.desc.osd_object.sa_cap_v",     FT_BOOLEAN, 32, NULL, 0x00002000, NULL, HFILL}},
6854         { &hf_scsi_sns_osd_object_set_att,
6855             {"SET_ATT", "scsi.sns.desc.osd_object.set_att",       FT_BOOLEAN, 32, NULL, 0x00001000, NULL, HFILL}},
6856         { &hf_scsi_sns_osd_object_ga_cap_v,
6857             {"GA_CAP_V", "scsi.sns.desc.osd_object.ga_cap_v",     FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL}},
6858         { &hf_scsi_sns_osd_object_get_att,
6859             {"GET_ATT", "scsi.sns.desc.osd_object.get_att",       FT_BOOLEAN, 32, NULL, 0x00000010, NULL, HFILL}},
6860         { &hf_scsi_sns_osd_partition_id,
6861             {"Partition ID", "scsi.sns.desc.osd_object.partition_id", FT_UINT64, BASE_HEX,  NULL, 0, NULL, HFILL}},
6862         { &hf_scsi_sns_osd_object_id,
6863             {"Object ID", "scsi.sns.desc.osd_object.object_id",  FT_UINT64, BASE_HEX,  NULL, 0, NULL, HFILL}},
6864         { &hf_scsi_sns_osd_attr_page,
6865             {"Attribute page", "scsi.sns.desc.osd_attr.page",      FT_UINT32, BASE_HEX | BASE_EXT_STRING,  &attributes_page_vals_ext, 0, NULL, HFILL}},
6866         { &hf_scsi_sns_osd_attr_number,
6867             {"Attribute number", "scsi.sns.desc.osd_attr.number",  FT_UINT32, BASE_HEX,  NULL, 0, NULL, HFILL}},
6868         { &hf_scsi_persresv_key,
6869             {"Reservation Key", "scsi.spc.resv.key", FT_BYTES, BASE_NONE, NULL,
6870            0x0, NULL, HFILL}},
6871         { &hf_scsi_persresv_scopeaddr,
6872           {"Scope Address", "scsi.spc.resv.scopeaddr", FT_BYTES, BASE_NONE, NULL,
6873            0x0, NULL, HFILL}},
6874         { &hf_scsi_add_cdblen,
6875           {"Additional CDB Length", "scsi.spc.addcdblen", FT_UINT8, BASE_DEC,
6876            NULL, 0x0, NULL, HFILL}},
6877         { &hf_scsi_svcaction,
6878           {"Service Action", "scsi.spc.svcaction", FT_UINT16, BASE_HEX, NULL,
6879            0x0, NULL, HFILL}},
6880         { &hf_scsi_wb_mode,
6881           {"Mode", "scsi.spc.wb.mode", FT_UINT8, BASE_HEX,
6882            VALS(scsi_wb_mode_val), 0xF, NULL, HFILL}},
6883         { &hf_scsi_wb_bufferid,
6884           {"Buffer ID", "scsi.spc.sb.bufid", FT_UINT8, BASE_DEC, NULL, 0x0,
6885            NULL, HFILL}},
6886         { &hf_scsi_wb_bufoffset,
6887           {"Buffer Offset", "scsi.spc.wb.bufoff", FT_UINT24, BASE_HEX, NULL,
6888            0x0, NULL, HFILL}},
6889         { &hf_scsi_paramlen24,
6890           {"Parameter List Length", "scsi.cdb.paramlen24", FT_UINT24, BASE_HEX,
6891            NULL, 0x0, NULL, HFILL}},
6892         { &hf_scsi_senddiag_st_code,
6893           {"Self-Test Code", "scsi.spc.senddiag.code", FT_UINT8, BASE_HEX,
6894            VALS(scsi_senddiag_st_code_val), 0xE0, NULL, HFILL}},
6895         { &hf_scsi_select_report,
6896           {"Select Report", "scsi.spc.select_report", FT_UINT8, BASE_HEX,
6897            VALS(scsi_select_report_val), 0x00, NULL, HFILL}},
6898         { &hf_scsi_senddiag_pf,
6899           {"PF", "scsi.spc.senddiag.pf", FT_BOOLEAN, 8,
6900            TFS(&scsi_senddiag_pf_val), 0x10, NULL, HFILL}},
6901         { &hf_scsi_senddiag_st,
6902           {"Self Test", "scsi.spc.senddiag.st", FT_BOOLEAN, 8, NULL,
6903            0x4, NULL, HFILL}},
6904         { &hf_scsi_senddiag_devoff,
6905           {"Device Offline", "scsi.spc.senddiag.devoff", FT_BOOLEAN, 8,
6906            NULL, 0x2, NULL, HFILL}},
6907         { &hf_scsi_senddiag_unitoff,
6908           {"Unit Offline", "scsi.spc.senddiag.unitoff", FT_BOOLEAN, 8,
6909            NULL, 0x1, NULL, HFILL}},
6910         { &hf_scsi_request_frame,
6911           { "Request in", "scsi.request_frame", FT_FRAMENUM, BASE_NONE, NULL, 0,
6912             "The request to this transaction is in this frame", HFILL }},
6913         { &hf_scsi_time,
6914           { "Time from request", "scsi.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0,
6915             "Time between the Command and the Response", HFILL }},
6916         { &hf_scsi_response_frame,
6917           { "Response in", "scsi.response_frame", FT_FRAMENUM, BASE_NONE, NULL, 0,
6918             "The response to this transaction is in this frame", HFILL }},
6919         { &hf_scsi_fragments,
6920           { "SCSI Fragments", "scsi.fragments", FT_NONE, BASE_NONE, NULL, 0x0,
6921             NULL, HFILL }},
6922         { &hf_scsi_fragment_overlap,
6923           { "Fragment overlap", "scsi.fragment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6924             "Fragment overlaps with other fragments", HFILL }},
6925         { &hf_scsi_fragment_overlap_conflict,
6926           { "Conflicting data in fragment overlap", "scsi.fragment.overlap.conflict", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6927             "Overlapping fragments contained conflicting data", HFILL }},
6928         { &hf_scsi_fragment_multiple_tails,
6929           { "Multiple tail fragments found", "scsi.fragment.multipletails", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6930             "Several tails were found when defragmenting the packet", HFILL }},
6931         { &hf_scsi_fragment_too_long_fragment,
6932           { "Fragment too long", "scsi.fragment.toolongfragment", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6933             "Fragment contained data past end of packet", HFILL }},
6934         { &hf_scsi_fragment_error,
6935           { "Defragmentation error", "scsi.fragment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
6936             "Defragmentation error due to illegal fragments", HFILL }},
6937         { &hf_scsi_fragment_count,
6938           { "Fragment count", "scsi.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x0,
6939             NULL, HFILL }},
6940         { &hf_scsi_fragment,
6941           { "SCSI DATA Fragment", "scsi.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
6942             NULL, HFILL }},
6943         { &hf_scsi_reassembled_in,
6944           { "Reassembled SCSI DATA in frame", "scsi.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
6945             "This SCSI DATA packet is reassembled in this frame", HFILL }},
6946         { &hf_scsi_reassembled_length,
6947           { "Reassembled SCSI DATA length", "scsi.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0,
6948             "The total length of the reassembled payload", HFILL }},
6949         { &hf_scsi_log_ppc_flags,
6950           {"PPC Flags", "scsi.log.ppc.flags", FT_UINT8, BASE_HEX, NULL, 0,
6951            NULL, HFILL}},
6952         { &hf_scsi_log_ppc,
6953           {"PPC", "scsi.log.ppc", FT_BOOLEAN, 8,
6954            TFS(&scsi_log_ppc_tfs), 0x02, NULL, HFILL}},
6955         { &hf_scsi_log_pcr,
6956           {"PCR", "scsi.log.pcr", FT_BOOLEAN, 8,
6957            TFS(&scsi_log_pcr_tfs), 0x02, NULL, HFILL}},
6958         { &hf_scsi_log_sp,
6959           {"SP", "scsi.log.sp", FT_BOOLEAN, 8,
6960            TFS(&scsi_log_sp_tfs), 0x01, NULL, HFILL}},
6961         { &hf_scsi_log_pc_flags,
6962           {"PC Flags", "scsi.log.pc.flags", FT_UINT8, BASE_HEX, NULL, 0,
6963            NULL, HFILL}},
6964         { &hf_scsi_log_parameter_ptr,
6965           {"Parameter Pointer", "scsi.log.param_ptr", FT_UINT8, BASE_HEX, NULL,
6966            0, NULL, HFILL}},
6967         { &hf_scsi_log_page_length,
6968           {"Page Length", "scsi.log.page_length", FT_UINT16, BASE_DEC, NULL, 0,
6969            NULL, HFILL}},
6970         { &hf_scsi_log_parameter_code,
6971           {"Parameter Code", "scsi.log.parameter_code", FT_UINT16, BASE_HEX, NULL, 0,
6972            NULL, HFILL}},
6973         { &hf_scsi_log_param_flags,
6974           {"Param Flags", "scsi.log.param.flags", FT_UINT8, BASE_HEX, NULL, 0,
6975            NULL, HFILL}},
6976         { &hf_scsi_log_param_len,
6977           {"Parameter Len", "scsi.log.param_len", FT_UINT8, BASE_DEC, NULL, 0,
6978            NULL, HFILL}},
6979         { &hf_scsi_log_param_data,
6980           {"Parameter Data", "scsi.log.param_data", FT_BYTES, BASE_NONE, NULL, 0,
6981            NULL, HFILL}},
6982         { &hf_scsi_log_pf_du,
6983           {"DU", "scsi.log.pf.du", FT_BOOLEAN, 8, NULL, 0x80,
6984            NULL, HFILL}},
6985         { &hf_scsi_log_pf_ds,
6986           {"DS", "scsi.log.pf.ds", FT_BOOLEAN, 8, NULL, 0x40,
6987            NULL, HFILL}},
6988         { &hf_scsi_log_pf_tsd,
6989           {"TSD", "scsi.log.pf.tsd", FT_BOOLEAN, 8, NULL, 0x20,
6990            NULL, HFILL}},
6991         { &hf_scsi_log_pf_etc,
6992           {"ETC", "scsi.log.pf.etc", FT_BOOLEAN, 8, NULL, 0x10,
6993            NULL, HFILL}},
6994         { &hf_scsi_log_pf_tmc,
6995           {"TMC", "scsi.log.pf.tmc", FT_UINT8, BASE_HEX, VALS(log_flags_tmc_vals), 0x0c,
6996            NULL, HFILL}},
6997         { &hf_scsi_log_pf_lbin,
6998           {"LBIN", "scsi.log.pf.lbin", FT_BOOLEAN, 8, NULL, 0x02,
6999            NULL, HFILL}},
7000         { &hf_scsi_log_pf_lp,
7001           {"LP", "scsi.log.pf.lp", FT_BOOLEAN, 8, NULL, 0x01,
7002            NULL, HFILL}},
7003         { &hf_scsi_log_ta_rw,
7004           {"Read Warning", "scsi.log.ta.rw", FT_BOOLEAN, 8, NULL, 0x01,
7005            NULL, HFILL}},
7006         { &hf_scsi_log_ta_ww,
7007           {"write warning", "scsi.log.ta.ww", FT_BOOLEAN, 8, NULL, 0x01,
7008            NULL, HFILL}},
7009         { &hf_scsi_log_ta_he,
7010           {"hard error", "scsi.log.ta.he", FT_BOOLEAN, 8, NULL, 0x01,
7011            NULL, HFILL}},
7012         { &hf_scsi_log_ta_media,
7013           {"media", "scsi.log.ta.media", FT_BOOLEAN, 8, NULL, 0x01,
7014            NULL, HFILL}},
7015         { &hf_scsi_log_ta_rf,
7016           {"read failure", "scsi.log.ta.rf", FT_BOOLEAN, 8, NULL, 0x01,
7017            NULL, HFILL}},
7018         { &hf_scsi_log_ta_wf,
7019           {"write failure", "scsi.log.ta.wf", FT_BOOLEAN, 8, NULL, 0x01,
7020            NULL, HFILL}},
7021         { &hf_scsi_log_ta_ml,
7022           {"media life", "scsi.log.ta.ml", FT_BOOLEAN, 8, NULL, 0x01,
7023            NULL, HFILL}},
7024         { &hf_scsi_log_ta_ndg,
7025           {"not data grade", "scsi.log.ta.ndg", FT_BOOLEAN, 8, NULL, 0x01,
7026            NULL, HFILL}},
7027         { &hf_scsi_log_ta_wp,
7028           {"write protect", "scsi.log.ta.wp", FT_BOOLEAN, 8, NULL, 0x01,
7029            NULL, HFILL}},
7030         { &hf_scsi_log_ta_nr,
7031           {"no removal", "scsi.log.ta.nr", FT_BOOLEAN, 8, NULL, 0x01,
7032            NULL, HFILL}},
7033         { &hf_scsi_log_ta_cm,
7034           {"cleaning media", "scsi.log.ta.cm", FT_BOOLEAN, 8, NULL, 0x01,
7035            NULL, HFILL}},
7036         { &hf_scsi_log_ta_uf,
7037           {"unsupported format", "scsi.log.ta.uf", FT_BOOLEAN, 8, NULL, 0x01,
7038            NULL, HFILL}},
7039         { &hf_scsi_log_ta_rmcf,
7040           {"removable mechanical cartridge failure", "scsi.log.ta.rmcf", FT_BOOLEAN, 8, NULL, 0x01,
7041            NULL, HFILL}},
7042         { &hf_scsi_log_ta_umcf,
7043           {"unrecoverable mechanical cartridge failure", "scsi.log.ta.umcf", FT_BOOLEAN, 8, NULL, 0x01,
7044            NULL, HFILL}},
7045         { &hf_scsi_log_ta_mcicf,
7046           {"memory chip in cartridge failure", "scsi.log.ta.mcicf", FT_BOOLEAN, 8, NULL, 0x01,
7047            NULL, HFILL}},
7048         { &hf_scsi_log_ta_fe,
7049           {"forced eject", "scsi.log.ta.fe", FT_BOOLEAN, 8, NULL, 0x01,
7050            NULL, HFILL}},
7051         { &hf_scsi_log_ta_rof,
7052           {"read only format", "scsi.log.ta.rof", FT_BOOLEAN, 8, NULL, 0x01,
7053            NULL, HFILL}},
7054         { &hf_scsi_log_ta_tdcol,
7055           {"tape directory corrupted on load", "scsi.log.ta.tdcol", FT_BOOLEAN, 8, NULL, 0x01,
7056            NULL, HFILL}},
7057         { &hf_scsi_log_ta_nml,
7058           {"nearing media life", "scsi.log.ta.nml", FT_BOOLEAN, 8, NULL, 0x01,
7059            NULL, HFILL}},
7060         { &hf_scsi_log_ta_cn,
7061           {"clean now", "scsi.log.ta.cn", FT_BOOLEAN, 8, NULL, 0x01,
7062            NULL, HFILL}},
7063         { &hf_scsi_log_ta_cp,
7064           {"clean periodic", "scsi.log.ta.cp", FT_BOOLEAN, 8, NULL, 0x01,
7065            NULL, HFILL}},
7066         { &hf_scsi_log_ta_ecm,
7067           {"expired cleaning media", "scsi.log.ta.ecm", FT_BOOLEAN, 8, NULL, 0x01,
7068            NULL, HFILL}},
7069         { &hf_scsi_log_ta_ict,
7070           {"invalid cleaning tape", "scsi.log.ta.ict", FT_BOOLEAN, 8, NULL, 0x01,
7071            NULL, HFILL}},
7072         { &hf_scsi_log_ta_rr,
7073           {"retention requested", "scsi.log.ta.rr", FT_BOOLEAN, 8, NULL, 0x01,
7074            NULL, HFILL}},
7075         { &hf_scsi_log_ta_dpie,
7076           {"dual port interface error", "scsi.log.ta.dpie", FT_BOOLEAN, 8, NULL, 0x01,
7077            NULL, HFILL}},
7078         { &hf_scsi_log_ta_cff,
7079           {"cooling fan failure", "scsi.log.ta.cff", FT_BOOLEAN, 8, NULL, 0x01,
7080            NULL, HFILL}},
7081         { &hf_scsi_log_ta_psf,
7082           {"power supply failure", "scsi.log.ta.psf", FT_BOOLEAN, 8, NULL, 0x01,
7083            NULL, HFILL}},
7084         { &hf_scsi_log_ta_pc,
7085           {"power consumption", "scsi.log.ta.pc", FT_BOOLEAN, 8, NULL, 0x01,
7086            NULL, HFILL}},
7087         { &hf_scsi_log_ta_dm,
7088           {"drive maintenance", "scsi.log.ta.dm", FT_BOOLEAN, 8, NULL, 0x01,
7089            NULL, HFILL}},
7090         { &hf_scsi_log_ta_hwa,
7091           {"hardware a", "scsi.log.ta.hwa", FT_BOOLEAN, 8, NULL, 0x01,
7092            NULL, HFILL}},
7093         { &hf_scsi_log_ta_hwb,
7094           {"hardware b", "scsi.log.ta.hwb", FT_BOOLEAN, 8, NULL, 0x01,
7095            NULL, HFILL}},
7096         { &hf_scsi_log_ta_if,
7097           {"interface", "scsi.log.ta.if", FT_BOOLEAN, 8, NULL, 0x01,
7098            NULL, HFILL}},
7099         { &hf_scsi_log_ta_em,
7100           {"eject media", "scsi.log.ta.em", FT_BOOLEAN, 8, NULL, 0x01,
7101            NULL, HFILL}},
7102         { &hf_scsi_log_ta_dwf,
7103           {"download failed", "scsi.log.ta.dwf", FT_BOOLEAN, 8, NULL, 0x01,
7104            NULL, HFILL}},
7105         { &hf_scsi_log_ta_drhu,
7106           {"drive humidity", "scsi.log.ta.drhu", FT_BOOLEAN, 8, NULL, 0x01,
7107            NULL, HFILL}},
7108         { &hf_scsi_log_ta_drtm,
7109           {"drive temperature", "scsi.log.ta.drtm", FT_BOOLEAN, 8, NULL, 0x01,
7110            NULL, HFILL}},
7111         { &hf_scsi_log_ta_drvo,
7112           {"drive voltage", "scsi.log.ta.drvo", FT_BOOLEAN, 8, NULL, 0x01,
7113            NULL, HFILL}},
7114         { &hf_scsi_log_ta_pefa,
7115           {"periodic failure", "scsi.log.ta.pefa", FT_BOOLEAN, 8, NULL, 0x01,
7116            NULL, HFILL}},
7117         { &hf_scsi_log_ta_dire,
7118           {"diagnostics required", "scsi.log.ta.dire", FT_BOOLEAN, 8, NULL, 0x01,
7119            NULL, HFILL}},
7120         { &hf_scsi_log_ta_lost,
7121           {"lost statistics", "scsi.log.ta.lost", FT_BOOLEAN, 8, NULL, 0x01,
7122            NULL, HFILL}},
7123         { &hf_scsi_log_ta_tduau,
7124           {"tape directory invalid at unload", "scsi.log.ta.tduau", FT_BOOLEAN, 8, NULL, 0x01,
7125            NULL, HFILL}},
7126         { &hf_scsi_log_ta_tsawf,
7127           {"tape system area write failure", "scsi.log.ta.tsawf", FT_BOOLEAN, 8, NULL, 0x01,
7128            NULL, HFILL}},
7129         { &hf_scsi_log_ta_tsarf,
7130           {"tape system area read failure", "scsi.log.ta.tsarf", FT_BOOLEAN, 8, NULL, 0x01,
7131            NULL, HFILL}},
7132         { &hf_scsi_log_ta_nsod,
7133           {"no start of data", "scsi.log.ta.nsod", FT_BOOLEAN, 8, NULL, 0x01,
7134            NULL, HFILL}},
7135         { &hf_scsi_log_ta_lofa,
7136           {"loading failure", "scsi.log.ta.lofa", FT_BOOLEAN, 8, NULL, 0x01,
7137            NULL, HFILL}},
7138         { &hf_scsi_log_ta_uuf,
7139           {"unrecoverable unload failure", "scsi.log.ta.uuf", FT_BOOLEAN, 8, NULL, 0x01,
7140            NULL, HFILL}},
7141         { &hf_scsi_log_ta_aif,
7142           {"automatic interface failure", "scsi.log.ta.aif", FT_BOOLEAN, 8, NULL, 0x01,
7143            NULL, HFILL}},
7144         { &hf_scsi_log_ta_fwf,
7145           {"firmware failure", "scsi.log.ta.fwf", FT_BOOLEAN, 8, NULL, 0x01,
7146            NULL, HFILL}},
7147         { &hf_scsi_log_ta_wmicf,
7148           {"worm medium integrity check failed", "scsi.log.ta.wmicf", FT_BOOLEAN, 8, NULL, 0x01,
7149            NULL, HFILL}},
7150         { &hf_scsi_log_ta_wmoa,
7151           {"worm medium overwrite attempted", "scsi.log.ta.wmoa", FT_BOOLEAN, 8, NULL, 0x01,
7152            NULL, HFILL}},
7153         { &hf_scsi_sbc_threshold_exponent,
7154           {"Threshold Exponent", "scsi_sbc.threshold_exponent", FT_UINT8, BASE_DEC, NULL, 0,
7155            NULL, HFILL}},
7156         { &hf_scsi_sbc_lbpu,
7157           {"LBPU (logical block provisioning UNMAP)", "scsi_sbc.lbpu", FT_BOOLEAN, 8, NULL, 0x80,
7158            NULL, HFILL}},
7159         { &hf_scsi_sbc_lbpws,
7160           {"LBPWS (logical block provisioning WRITE SAME)", "scsi_sbc.lbpws", FT_BOOLEAN, 8, NULL, 0x40,
7161            NULL, HFILL}},
7162         { &hf_scsi_sbc_lbpws10,
7163           {"LBPWS10 (logical block provisioning WRITE SAME (10) )", "scsi_sbc.lbpws10", FT_BOOLEAN, 8, NULL, 0x20,
7164            NULL, HFILL}},
7165         { &hf_scsi_sbc_lbprz,
7166           {"LBPRZ (logical block provisioning read zeros)", "scsi_sbc.lbprz", FT_BOOLEAN, 8, NULL, 0x04,
7167            NULL, HFILL}},
7168         { &hf_scsi_sbc_anc_sup,
7169           {"ANC_SUP (anchor supported)", "scsi_sbc.anc_sup", FT_BOOLEAN, 8, NULL, 0x02,
7170            NULL, HFILL}},
7171         { &hf_scsi_sbc_dp,
7172           {"DP (descriptor present)", "scsi_sbc.dp", FT_BOOLEAN, 8, NULL, 0x01,
7173            NULL, HFILL}},
7174         { &hf_scsi_sbc_ptype,
7175           {"Provisioning Type", "scsi_sbc.ptype", FT_UINT8, BASE_DEC, VALS(provisioning_vals), 0x07,
7176            NULL, HFILL}},
7177         { &hf_scsi_block_limits_wsnz,
7178           {"WSNZ (write same non-zero)", "scsi_sbc.bl.wsnz", FT_BOOLEAN, 8, NULL, 0x01,
7179            NULL, HFILL}},
7180         { &hf_scsi_block_limits_mcawl,
7181           {"Maximum Compare And Write Length", "scsi_sbc.bl.mcawl", FT_UINT8, BASE_DEC, NULL, 0,
7182            NULL, HFILL}},
7183         { &hf_scsi_block_limits_otlg,
7184           {"Optimal Transfer Length Granularity", "scsi_sbc.bl.otlg", FT_UINT16, BASE_DEC, NULL, 0,
7185            NULL, HFILL}},
7186         { &hf_scsi_block_limits_mtl,
7187           {"Maximum Transfer Length", "scsi_sbc.bl.mtl", FT_UINT32, BASE_DEC, NULL, 0,
7188            NULL, HFILL}},
7189         { &hf_scsi_block_limits_otl,
7190           {"Optimal Transfer Length", "scsi_sbc.bl.otl", FT_UINT32, BASE_DEC, NULL, 0,
7191            NULL, HFILL}},
7192         { &hf_scsi_block_limits_mpl,
7193           {"Optimal Prefetch/Xdread/Xdwrite Transfer Length", "scsi_sbc.bl.mpl", FT_UINT32, BASE_DEC, NULL, 0,
7194            NULL, HFILL}},
7195         { &hf_scsi_block_limits_mulc,
7196           {"Maximum Unmap LBA Count", "scsi_sbc.bl.mulc", FT_UINT32, BASE_DEC, NULL, 0,
7197            NULL, HFILL}},
7198         { &hf_scsi_block_limits_mubdc,
7199           {"Maximum Unmap Block Descriptor Count", "scsi_sbc.bl.mubdc", FT_UINT32, BASE_DEC, NULL, 0,
7200            NULL, HFILL}},
7201         { &hf_scsi_block_limits_oug,
7202           {"Optimal Unmap Block Granularity", "scsi_sbc.bl.oug", FT_UINT32, BASE_DEC, NULL, 0,
7203            NULL, HFILL}},
7204         { &hf_scsi_block_limits_ugavalid,
7205           {"UGAVALID", "scsi_sbc.bl.ugavalid", FT_BOOLEAN, 8, NULL, 0x80,
7206            NULL, HFILL}},
7207         { &hf_scsi_block_limits_uga,
7208           {"Unmap Granularity Alignment", "scsi_sbc.bl.uga", FT_UINT32, BASE_DEC, NULL, 0x7fffffff,
7209            NULL, HFILL}},
7210         { &hf_scsi_block_limits_mwsl,
7211           {"Maximum Write Same Length", "scsi_sbc.bl.mwsl", FT_UINT64, BASE_DEC, NULL, 0,
7212            NULL, HFILL}},
7213         { &hf_scsi_block_limits_matl,
7214           {"Maximum Atomic Transfer Length", "scsi_sbc.bl.matl", FT_UINT32, BASE_DEC, NULL, 0,
7215            NULL, HFILL}},
7216         { &hf_scsi_block_limits_aa,
7217           {"Atomic Alignment", "scsi_sbc.bl.aa", FT_UINT32, BASE_DEC, NULL, 0,
7218            NULL, HFILL}},
7219         { &hf_scsi_block_limits_atlg,
7220           {"Atomic Transfer Length Granularity", "scsi_sbc.bl.atlg", FT_UINT32, BASE_DEC, NULL, 0,
7221            NULL, HFILL}},
7222         { &hf_scsi_modepage_ps,
7223           {"PS", "scsi.spc.modepage.ps", FT_BOOLEAN, 8, NULL, 0x80,
7224            NULL, HFILL}},
7225         { &hf_scsi_modepage_spf,
7226           {"SPF", "scsi.spc.modepage.spf", FT_BOOLEAN, 8, NULL, 0x40,
7227            NULL, HFILL}},
7228         { &hf_scsi_modepage_plen,
7229           {"Page Length", "scsi.spc.modepage.plen", FT_UINT16, BASE_DEC, NULL, 0,
7230            NULL, HFILL}},
7231         { &hf_scsi_modepage_tcmos,
7232           {"TCMOS", "scsi.spc.modepage.tcmos", FT_BOOLEAN, 8, NULL, 0x04,
7233            NULL, HFILL}},
7234         { &hf_scsi_modepage_scsip,
7235           {"SCSIP", "scsi.spc.modepage.scsip", FT_BOOLEAN, 8, NULL, 0x02,
7236            NULL, HFILL}},
7237         { &hf_scsi_modepage_ialuae,
7238           {"IALUAE", "scsi.spc.modepage.ialuae", FT_BOOLEAN, 8, NULL, 0x01,
7239            NULL, HFILL}},
7240         { &hf_scsi_modepage_icp,
7241           {"Initial Command Priority", "scsi.spc.modepage.icp", FT_UINT8, BASE_DEC,
7242            NULL, 0x0f, NULL, HFILL}},
7243         { &hf_scsi_modepage_msdl,
7244           {"Maximum Sense Data Length", "scsi.spc.modepage.msdl", FT_UINT8, BASE_DEC,
7245            NULL, 0, NULL, HFILL}},
7246         { &hf_scsi_lun,
7247           { "LUN", "scsi.lun", FT_UINT16, BASE_HEX,
7248            NULL, 0, "Logical Unit Number", HFILL }},
7249         { &hf_scsi_lun_extended,
7250           { "LUN", "scsi.lun_long", FT_UINT64, BASE_HEX,
7251            NULL, 0, "Logical Unit Number", HFILL }},
7252         /* hf_scsi_bus has length of 0x6 with 2bit offset, or 0x3 with no offset
7253            so we handle it with add_bits_item */
7254         { &hf_scsi_bus,
7255           { "BUS", "scsi.bus", FT_UINT8, BASE_HEX,
7256            NULL, 0, NULL, HFILL }},
7257         { &hf_scsi_target,
7258           { "Target", "scsi.target", FT_UINT8, BASE_HEX,
7259            NULL, 0x3f, NULL, HFILL }},
7260         { &hf_scsi_lun_address_mode,
7261           { "Address Mode", "scsi.lun.address_mode", FT_UINT8, BASE_HEX,
7262           VALS(scsi_lun_address_mode_vals), 0xc0, "Addressing mode for the LUN", HFILL }},
7263         { &hf_scsi_extended_add_method_len,
7264           { "Extended Address Method Length", "scsi.lun.extended_address_method.len", FT_UINT8, BASE_HEX,
7265           NULL, 0x30, "Extended Address Method Specific Field", HFILL }},
7266         { &hf_scsi_extended_add_method,
7267           { "Extended Address Method", "scsi.lun.extended_address_method", FT_UINT8, BASE_HEX,
7268           NULL, 0xf, "Extended Logical Unit Addressing", HFILL }},
7269         { &hf_scsi_prevent_allow_flags,
7270           {"Prevent Allow Flags", "scsi.prevent_allow.flags", FT_UINT8, BASE_HEX, NULL, 0,
7271            NULL, HFILL}},
7272         { &hf_scsi_prevent_allow_prevent,
7273           { "PREVENT", "scsi.prevent_allow.prevent", FT_BOOLEAN, 8,
7274             NULL, 0x01, NULL, HFILL}},
7275         { &hf_scsi_mpi_service_action,
7276           { "Service Action", "scsi.mpi.service_action", FT_UINT8, BASE_HEX,
7277           VALS(mpi_action_vals), 0x1f, "Management Protocol In Service Action", HFILL }},
7278         { &hf_scsi_report_opcodes_rctd,
7279           { "RCTD", "scsi.report_opcodes.rctd", FT_BOOLEAN, 8,
7280             NULL, 0x80, NULL, HFILL}},
7281         { &hf_scsi_report_opcodes_options,
7282           { "Reporting Options", "scsi.report_opcodes.options", FT_UINT8, BASE_HEX,
7283             VALS(report_opcodes_options_vals), 0x07, NULL, HFILL}},
7284         { &hf_scsi_report_opcodes_requested_o,
7285           { "Requested Operation Code", "scsi.report_opcodes.requested_operation_code", FT_UINT8, BASE_HEX,
7286             NULL, 0, NULL, HFILL}},
7287         { &hf_scsi_report_opcodes_requested_sa,
7288           { "Requested Service Action", "scsi.report_opcodes.requested_service_action", FT_UINT16, BASE_HEX,
7289             NULL, 0, NULL, HFILL}},
7290         { &hf_scsi_report_opcodes_cdl,
7291           { "Command Data Length", "scsi.report_opcodes.command_data_length", FT_UINT32, BASE_DEC,
7292             NULL, 0, NULL, HFILL}},
7293         { &hf_scsi_report_opcodes_sa,
7294           { "Service Action", "scsi.report_opcodes.service_action", FT_UINT16, BASE_DEC,
7295             NULL, 0, NULL, HFILL}},
7296         { &hf_scsi_report_opcodes_ctdp,
7297           { "CTDP", "scsi.report_opcodes.ctdp", FT_BOOLEAN, 8,
7298             NULL, 0x02, NULL, HFILL}},
7299         { &hf_scsi_report_opcodes_ctdp_one,
7300           { "CTDP", "scsi.report_opcodes_one.ctdp", FT_BOOLEAN, 8,
7301             NULL, 0x80, NULL, HFILL}},
7302         { &hf_scsi_report_opcodes_servactv,
7303           { "SERVACTV", "scsi.report_opcodes.servactv", FT_BOOLEAN, 8,
7304             NULL, 0x01, NULL, HFILL}},
7305         { &hf_scsi_report_opcodes_cdb_length,
7306           { "CDB Length", "scsi.report_opcodes.cdb_length", FT_UINT16, BASE_DEC,
7307             NULL, 0, NULL, HFILL}},
7308         { &hf_scsi_report_opcodes_support,
7309           { "Support", "scsi.report_opcodes.support", FT_UINT8, BASE_DEC,
7310             NULL, 0x07, NULL, HFILL}},
7311         { &hf_scsi_report_opcodes_cdb_usage_data,
7312           {"CDB Usage Data", "scsi.report_opcodes.cdb_usage_data", FT_BYTES, BASE_NONE,
7313        NULL, 0, NULL, HFILL}},
7314         { &hf_scsi_report_opcodes_tdl,
7315           { "Timeout Descriptor Length", "scsi.report_opcodes.timeout_descriptor_length", FT_UINT16, BASE_DEC,
7316             NULL, 0, NULL, HFILL}},
7317         { &hf_scsi_report_opcodes_npt,
7318             { "Nominal Command Processing Timeout", "scsi.report_opcodes.ncpt", FT_UINT32, BASE_DEC,
7319                 NULL, 0, NULL, HFILL}},
7320         { &hf_scsi_report_opcodes_rct,
7321             { "Recommended Command Timeout", "scsi.report_opcodes.rct", FT_UINT32, BASE_DEC,
7322                 NULL, 0, NULL, HFILL}},
7323         { &hf_scsi_inquiry_bdc_mrr,
7324             { "Medium Rotation Rate", "scsi.inquiry.bdc.mrr", FT_UINT16, BASE_DEC,
7325                 VALS(mrr_val), 0, NULL, HFILL}},
7326         { &hf_scsi_inquiry_bdc_pt,
7327             { "Product Type", "scsi.inquiry.bdc.pt", FT_UINT8, BASE_DEC,
7328                 NULL, 0, NULL, HFILL}},
7329         { &hf_scsi_inquiry_bdc_wabereq,
7330             { "WABEREQ", "scsi.inquiry.bdc.wabereq", FT_UINT8, BASE_DEC,
7331                 NULL, 0xc0, NULL, HFILL}},
7332         { &hf_scsi_inquiry_bdc_wacereq,
7333             { "WACEREQ", "scsi.inquiry.bdc.wacereq", FT_UINT8, BASE_DEC,
7334                 NULL, 0x30, NULL, HFILL}},
7335         { &hf_scsi_inquiry_bdc_nff,
7336           { "Nominal Form factor", "scsi.inquiry.bdc.nff", FT_UINT8, BASE_DEC,
7337               NULL, 0x0f, NULL, HFILL}},
7338         { &hf_scsi_inquiry_bdc_fuab,
7339             { "FUAB", "scsi.inquiry.bdc.fuab", FT_BOOLEAN, 8,
7340                 NULL, 0x02, NULL, HFILL}},
7341         { &hf_scsi_inquiry_bdc_vbuls,
7342             { "VBULS", "scsi.inquiry.bdc.vbuls", FT_BOOLEAN, 8,
7343                 NULL, 0x01, NULL, HFILL}},
7344
7345       /* Generated from convert_proto_tree_add_text.pl */
7346       { &hf_scsi_inq_evpd_page_length, { "Page Length", "scsi.inquiry.evpd.pagelength", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7347       { &hf_scsi_inq_evpd_supported_page, { "Supported Page", "scsi.inquiry.evpd.supported_page", FT_UINT8, BASE_HEX, VALS(scsi_evpd_pagecode_val), 0x0, NULL, HFILL }},
7348       { &hf_scsi_inq_evpd_devid_code_set, { "Code Set", "scsi.inquiry.evpd.devid.code_set", FT_UINT8, BASE_HEX, VALS(scsi_devid_codeset_val), 0x0F, NULL, HFILL }},
7349       { &hf_scsi_inq_evpd_devid_association, { "Association", "scsi.inquiry.evpd.devid.association", FT_UINT8, BASE_HEX, VALS(scsi_devid_assoc_val), 0x30, NULL, HFILL }},
7350       { &hf_scsi_inq_evpd_devid_identifier_type, { "Identifier Type", "scsi.inquiry.evpd.devid.identifier_type", FT_UINT8, BASE_HEX, VALS(scsi_devid_idtype_val), 0x0F, NULL, HFILL }},
7351       { &hf_scsi_inq_evpd_identifier_number, { "Identifier Number", "scsi.inquiry.evpd.identifier_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7352       { &hf_scsi_inq_evpd_devid_identifier_length, { "Identifier Length", "scsi.inquiry.evpd.devid.identifier_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7353       { &hf_scsi_inq_evpd_devid_identifier_str, { "Identifier", "scsi.inquiry.evpd.devid.identifier_str", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7354       { &hf_scsi_inq_evpd_devid_identifier_bytes, { "Identifier", "scsi.inquiry.evpd.devid.identifier_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7355       { &hf_scsi_inq_evpd_product_serial_number, { "Product Serial Number", "scsi.inquiry.evpd.product_serial_number", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7356       { &hf_scsi_inq_cmddt_support, { "Support", "scsi.inquiry.cmddt.support", FT_UINT8, BASE_DEC, VALS(scsi_cmdt_supp_val), 0x07, NULL, HFILL }},
7357       { &hf_scsi_inq_cmddt_version, { "Version", "scsi.inquiry.cmddt.version", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &scsi_verdesc_val_ext, 0x0, NULL, HFILL }},
7358       { &hf_scsi_inq_cmddt_cdb_size, { "CDB Size", "scsi.inquiry.cmddt.cdb_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7359       { &hf_scsi_blockdescs_no_of_blocks64, { "No. of Blocks", "scsi.blockdescs.no_of_blocks64", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7360       { &hf_scsi_blockdescs_density_code, { "Density Code", "scsi.blockdescs.density_code", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7361       { &hf_scsi_blockdescs_block_length32, { "Block Length", "scsi.blockdescs.block_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7362       { &hf_scsi_blockdescs_no_of_blocks32, { "No. of Blocks", "scsi.blockdescs.no_of_blocks", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7363       { &hf_scsi_blockdescs_block_length24, { "Block Length", "scsi.blockdescs.block_length", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7364       { &hf_scsi_blockdescs_no_of_blocks24, { "No. of Blocks", "scsi.blockdescs.no_of_blocks", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7365       { &hf_scsi_spc_modepage_gltsd, { "Global Logging Target Save Disable", "scsi.spc.modepage.gltsd", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7366       { &hf_scsi_spc_modepage_disable_queuing, { "Disable Queuing", "scsi.spc.modepage.disable_queuing", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7367       { &hf_scsi_spc_modepage_swp, { "SWP", "scsi.spc.modepage.swp", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7368       { &hf_scsi_spc_modepage_autoload_mode, { "Autoload Mode", "scsi.spc.modepage.autoload_mode", FT_UINT8, BASE_HEX, NULL, 0x07, NULL, HFILL }},
7369       { &hf_scsi_spc_modepage_ready_aer_holdoff_period, { "Ready AER Holdoff Period (ms)", "scsi.spc.modepage.ready_aer_holdoff_period", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7370       { &hf_scsi_spc_modepage_busy_timeout_period, { "Busy Timeout Period (ms)", "scsi.spc.modepage.busy_timeout_period", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7371       { &hf_scsi_spc_modepage_extended_self_test_completion_time, { "Extended Self-Test Completion Time", "scsi.spc.modepage.extended_self_test_completion_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7372       { &hf_scsi_spc_modepage_buffer_full_ratio, { "Buffer Full Ratio", "scsi.spc.modepage.buffer_full_ratio", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7373       { &hf_scsi_spc_modepage_buffer_empty_ratio, { "Buffer Empty Ratio", "scsi.spc.modepage.buffer_empty_ratio", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7374       { &hf_scsi_spc_modepage_bus_inactivity_limit, { "Bus Inactivity Limit", "scsi.spc.modepage.bus_inactivity_limit", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7375       { &hf_scsi_spc_modepage_disconnect_time_limit, { "Disconnect Time Limit", "scsi.spc.modepage.disconnect_time_limit", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7376       { &hf_scsi_spc_modepage_connect_time_limit, { "Connect Time Limit", "scsi.spc.modepage.connect_time_limit", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7377       { &hf_scsi_spc_modepage_maximum_burst_size, { "Maximum Burst Size (bytes)", "scsi.spc.modepage.maximum_burst_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7378       { &hf_scsi_spc_modepage_emdp, { "EMDP", "scsi.spc.modepage.emdp", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7379       { &hf_scsi_spc_modepage_first_burst_size, { "First Burst Size (bytes)", "scsi.spc.modepage.first_burst_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7380       { &hf_scsi_spc_modepage_perf, { "Perf", "scsi.spc.modepage.perf", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7381       { &hf_scsi_spc_modepage_interval_timer, { "Interval Timer", "scsi.spc.modepage.interval_timer", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7382       { &hf_scsi_spc_modepage_report_count, { "Report Count", "scsi.spc.modepage.report_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7383       { &hf_scsi_spc_modepage_idle, { "Idle", "scsi.spc.modepage.idle", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7384       { &hf_scsi_spc_modepage_idle_condition_timer, { "Idle Condition Timer (ms)", "scsi.spc.modepage.idle_condition_timer", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7385       { &hf_scsi_spc_modepage_standby_condition_timer, { "Standby Condition Timer (ms)", "scsi.spc.modepage.standby_condition_timer", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7386       { &hf_scsi_spc_modepage_dtfd, { "DTFD", "scsi.spc.modepage.dtfd", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7387       { &hf_scsi_spc_modepage_rr_tov_units, { "RR_TOV Units", "scsi.spc.modepage.rr_tov_units", FT_UINT8, BASE_DEC, VALS(scsi_fcp_rrtov_val), 0x07, NULL, HFILL }},
7388       { &hf_scsi_spc_modepage_rr_tov, { "RR_TOV", "scsi.spc.modepage.rr_tov", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7389       { &hf_scsi_sbc_modepage_tracks_per_zone, { "Tracks Per Zone", "scsi.sbc.modepage.tracks_per_zone", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7390       { &hf_scsi_sbc_modepage_alternate_sectors_per_zone, { "Alternate Sectors Per Zone", "scsi.sbc.modepage.alternate_sectors_per_zone", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7391       { &hf_scsi_sbc_modepage_alternate_tracks_per_zone, { "Alternate Tracks Per Zone", "scsi.sbc.modepage.alternate_tracks_per_zone", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7392       { &hf_scsi_sbc_modepage_alternate_tracks_per_lu, { "Alternate Tracks Per LU", "scsi.sbc.modepage.alternate_tracks_per_lu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7393       { &hf_scsi_sbc_modepage_sectors_per_track, { "Sectors Per Track", "scsi.sbc.modepage.sectors_per_track", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7394       { &hf_scsi_sbc_modepage_data_bytes_per_physical_sector, { "Data Bytes Per Physical Sector", "scsi.sbc.modepage.data_bytes_per_physical_sector", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7395       { &hf_scsi_sbc_modepage_interleave, { "Interleave", "scsi.sbc.modepage.interleave", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7396       { &hf_scsi_sbc_modepage_track_skew_factor, { "Track Skew Factor", "scsi.sbc.modepage.track_skew_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7397       { &hf_scsi_sbc_modepage_cylinder_skew_factor, { "Cylinder Skew Factor", "scsi.sbc.modepage.cylinder_skew_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7398       { &hf_scsi_sbc_modepage_ssec, { "SSEC", "scsi.sbc.modepage.ssec", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7399       { &hf_scsi_sbc_modepage_awre, { "AWRE", "scsi.sbc.modepage.awre", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7400       { &hf_scsi_sbc_modepage_read_retry_count, { "Read Retry Count", "scsi.sbc.modepage.read_retry_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7401       { &hf_scsi_sbc_modepage_correction_span, { "Correction Span", "scsi.sbc.modepage.correction_span", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7402       { &hf_scsi_sbc_modepage_head_offset_count, { "Head Offset Count", "scsi.sbc.modepage.head_offset_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7403       { &hf_scsi_sbc_modepage_data_strobe_offset_count, { "Data Strobe Offset Count", "scsi.sbc.modepage.data_strobe_offset_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7404       { &hf_scsi_sbc_modepage_write_retry_count, { "Write Retry Count", "scsi.sbc.modepage.write_retry_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7405       { &hf_scsi_sbc_modepage_recovery_time_limit, { "Recovery Time Limit (ms)", "scsi.sbc.modepage.recovery_time_limit", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7406       { &hf_scsi_sbc_modepage_number_of_cylinders, { "Number of Cylinders", "scsi.sbc.modepage.number_of_cylinders", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7407       { &hf_scsi_sbc_modepage_number_of_heads, { "Number of Heads", "scsi.sbc.modepage.number_of_heads", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7408       { &hf_scsi_sbc_modepage_starting_cyl_pre_compensation, { "Starting Cyl Pre-compensation", "scsi.sbc.modepage.starting_cyl_pre_compensation", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7409       { &hf_scsi_sbc_modepage_starting_cyl_reduced_write_current, { "Starting Cyl-reduced Write Current", "scsi.sbc.modepage.starting_cyl_reduced_write_current", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7410       { &hf_scsi_sbc_modepage_device_step_rate, { "Device Step Rate", "scsi.sbc.modepage.device_step_rate", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7411       { &hf_scsi_sbc_modepage_landing_zone_cyl, { "Landing Zone Cyl", "scsi.sbc.modepage.landing_zone_cyl", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7412       { &hf_scsi_sbc_modepage_rotational_offset, { "Rotational Offset", "scsi.sbc.modepage.rotational_offset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7413       { &hf_scsi_sbc_modepage_medium_rotation_rate, { "Medium Rotation Rate", "scsi.sbc.modepage.medium_rotation_rate", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7414       { &hf_scsi_sbc_modepage_ic, { "IC", "scsi.sbc.modepage.ic", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7415       { &hf_scsi_sbc_modepage_demand_read_retention_priority, { "Demand Read Retention Priority", "scsi.sbc.modepage.demand_read_retention_priority", FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }},
7416       { &hf_scsi_sbc_modepage_disable_pre_fetch_xfer_len, { "Disable Pre-fetch Xfer Len", "scsi.sbc.modepage.disable_pre_fetch_xfer_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7417       { &hf_scsi_sbc_modepage_minimum_pre_fetch, { "Minimum Pre-Fetch", "scsi.sbc.modepage.minimum_pre_fetch", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7418       { &hf_scsi_sbc_modepage_maximum_pre_fetch, { "Maximum Pre-Fetch", "scsi.sbc.modepage.maximum_pre_fetch", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7419       { &hf_scsi_sbc_modepage_maximum_pre_fetch_ceiling, { "Maximum Pre-Fetch Ceiling", "scsi.sbc.modepage.maximum_pre_fetch_ceiling", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7420       { &hf_scsi_sbc_modepage_fsw, { "FSW", "scsi.sbc.modepage.fsw", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7421       { &hf_scsi_sbc_modepage_number_of_cache_segments, { "Number of Cache Segments", "scsi.sbc.modepage.number_of_cache_segments", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7422       { &hf_scsi_sbc_modepage_cache_segment_size, { "Cache Segment Size", "scsi.sbc.modepage.cache_segment_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7423       { &hf_scsi_sbc_modepage_non_cache_segment_size, { "Non-Cache Segment Size", "scsi.sbc.modepage.non_cache_segment_size", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7424       { &hf_scsi_ssc2_modepage_dce, { "DCE", "scsi.ssc2.modepage.dce", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7425       { &hf_scsi_ssc2_modepage_dde, { "DDE", "scsi.ssc2.modepage.dde", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7426       { &hf_scsi_ssc2_modepage_compression_algorithm, { "Compression algorithm", "scsi.ssc2.modepage.compression_algorithm", FT_UINT32, BASE_HEX, VALS(compression_algorithm_vals), 0x0, NULL, HFILL }},
7427       { &hf_scsi_ssc2_modepage_decompression_algorithm, { "Decompression algorithm", "scsi.ssc2.modepage.decompression_algorithm", FT_UINT32, BASE_HEX, VALS(compression_algorithm_vals), 0x0, NULL, HFILL }},
7428       { &hf_scsi_ssc2_modepage_caf, { "CAF", "scsi.ssc2.modepage.caf", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7429       { &hf_scsi_ssc2_modepage_active_partition, { "Active Partition", "scsi.ssc2.modepage.active_partition", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7430       { &hf_scsi_ssc2_modepage_write_object_buffer_full_ratio, { "Write Object Buffer Full Ratio", "scsi.ssc2.modepage.write_object_buffer_full_ratio", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7431       { &hf_scsi_ssc2_modepage_read_object_buffer_empty_ratio, { "Read Object Buffer Empty Ratio", "scsi.ssc2.modepage.read_object_buffer_empty_ratio", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7432       { &hf_scsi_ssc2_modepage_write_delay_time, { "Write Delay time", "scsi.ssc2.modepage.write_delay_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7433       { &hf_scsi_ssc2_modepage_obr, { "OBR", "scsi.ssc2.modepage.obr", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7434       { &hf_scsi_ssc2_modepage_gap_size, { "Gap Size", "scsi.ssc2.modepage.gap_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7435       { &hf_scsi_ssc2_modepage_eod_defined, { "EOD Defined", "scsi.ssc2.modepage.eod_defined", FT_UINT8, BASE_DEC, NULL, 0xE0, NULL, HFILL }},
7436       { &hf_scsi_ssc2_modepage_object_buffer_size_at_early_warning, { "Object Buffer Size At Early Warning", "scsi.ssc2.modepage.object_buffer_size_at_early_warning", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7437       { &hf_scsi_ssc2_modepage_select_data_compression_algorithm, { "Select Data Compression Algorithm", "scsi.ssc2.modepage.select_data_compression_algorithm", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7438       { &hf_scsi_ssc2_modepage_oir, { "OIR", "scsi.ssc2.modepage.oir", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7439       { &hf_scsi_ssc2_modepage_maximum_additional_partitions, { "Maximum Additional Partitions", "scsi.ssc2.modepage.maximum_additional_partitions", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7440       { &hf_scsi_ssc2_modepage_additional_partitions_defined, { "Additional Partitions Defined", "scsi.ssc2.modepage.additional_partitions_defined", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7441       { &hf_scsi_ssc2_modepage_fdp, { "FDP", "scsi.ssc2.modepage.fdp", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7442       { &hf_scsi_ssc2_modepage_media_format_recognition, { "Media Format Recognition", "scsi.ssc2.modepage.media_format_recognition", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7443       { &hf_scsi_ssc2_modepage_partition_units, { "Partition Units", "scsi.ssc2.modepage.partition_units", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
7444       { &hf_scsi_ssc2_modepage_partition_size, { "Partition Size", "scsi.ssc2.modepage.partition_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7445       { &hf_scsi_mmc5_modepage_lba_space, { "LBA Space", "scsi.mmc5.modepage.lba_space", FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
7446       { &hf_scsi_mmc5_modepage_bufe, { "BUFE", "scsi.mmc5.modepage.bufe", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7447       { &hf_scsi_mmc5_modepage_wrparam_multi_session, { "Multi-session", "scsi.mmc5.modepage.wrparam_multi_session", FT_UINT8, BASE_DEC, NULL, 0xC0, NULL, HFILL }},
7448       { &hf_scsi_mmc5_modepage_data_block_type, { "Data Block Type", "scsi.mmc5.modepage.data_block_type", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
7449       { &hf_scsi_mmc5_modepage_link_size, { "Link Size", "scsi.mmc5.modepage.link_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7450       { &hf_scsi_mmc5_modepage_initiator_application_code, { "Initiator Application Code", "scsi.mmc5.modepage.initiator_application_code", FT_UINT8, BASE_DEC, NULL, 0x3F, NULL, HFILL }},
7451       { &hf_scsi_mmc5_modepage_session_format, { "Session Format", "scsi.mmc5.modepage.session_format", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7452       { &hf_scsi_mmc5_modepage_packet_size, { "Packet Size", "scsi.mmc5.modepage.packet_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7453       { &hf_scsi_mmc5_modepage_audio_pause_length, { "Audio Pause Length", "scsi.mmc5.modepage.audio_pause_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7454       { &hf_scsi_mmc5_modepage_media_catalog_number, { "Media Catalog Number", "scsi.mmc5.modepage.media_catalog_number", FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7455       { &hf_scsi_mmc5_modepage_international_standard_recording_code, { "International Standard Recording Code", "scsi.mmc5.modepage.international_standard_recording_code", FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7456       { &hf_scsi_mmc5_modepage_sub_header_byte, { "Sub-header Byte", "scsi.mmc5.modepage.sub_header_byte", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7457       { &hf_scsi_mmc5_modepage_vendor_specific, { "Vendor Specific", "scsi.mmc5.modepage.vendor_specific", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7458       { &hf_scsi_mmc5_modepage_dvd_ram_read, { "DVD-RAM Read", "scsi.mmc5.modepage.dvd_ram_read", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7459       { &hf_scsi_mmc5_modepage_dvd_ram_write, { "DVD-RAM Write", "scsi.mmc5.modepage.dvd_ram_write", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7460       { &hf_scsi_mmc5_modepage_buf, { "BUF", "scsi.mmc5.modepage.buf", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7461       { &hf_scsi_mmc5_modepage_read_bar_code, { "Read Bar Code", "scsi.mmc5.modepage.read_bar_code", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7462       { &hf_scsi_mmc5_modepage_loading_mechanism_type, { "Loading Mechanism Type", "scsi.mmc5.modepage.loading_mechanism_type", FT_UINT8, BASE_DEC, NULL, 0xE0, NULL, HFILL }},
7463       { &hf_scsi_mmc5_modepage_rw_in_lead_in, { "R-W in Lead-in", "scsi.mmc5.modepage.rw_in_lead_in", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7464       { &hf_scsi_mmc5_modepage_number_of_volume_levels_supported, { "Number of Volume Levels Supported", "scsi.mmc5.modepage.number_of_volume_levels_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7465       { &hf_scsi_mmc5_modepage_buffer_size_supported, { "Buffer Size Supported", "scsi.mmc5.modepage.buffer_size_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7466       { &hf_scsi_mmc5_modepage_length, { "Length", "scsi.mmc5.modepage.length", FT_UINT8, BASE_DEC, NULL, 0x30, NULL, HFILL }},
7467       { &hf_scsi_mmc5_modepage_copy_management_revision_support, { "Copy Management Revision Support", "scsi.mmc5.modepage.copy_management_revision_support", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7468       { &hf_scsi_mmc5_modepage_rotation_control_selected, { "Rotation Control Selected", "scsi.mmc5.modepage.rotation_control_selected", FT_UINT8, BASE_DEC, NULL, 0x03, NULL, HFILL }},
7469       { &hf_scsi_mmc5_modepage_current_write_speed_selected, { "Current Write Speed Selected", "scsi.mmc5.modepage.current_write_speed_selected", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7470       { &hf_scsi_mmc5_modepage_num_write_speed_performance, { "Number of Logical Unit Write Speed Performance Descriptor Tables", "scsi.mmc5.modepage.num_write_speed_performance", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7471       { &hf_scsi_smc_modepage_first_medium_transport_element_address, { "First Medium Transport Element Address", "scsi.mode.smc.first_medium_transport_element_address", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7472       { &hf_scsi_smc_modepage_number_of_medium_transport_elements, { "Number of Medium Transport Elements", "scsi.mode.smc.number_of_medium_transport_elements", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7473       { &hf_scsi_smc_modepage_first_storage_element_address, { "First Storage Element Address", "scsi.mode.smc.first_storage_element_address", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7474       { &hf_scsi_smc_modepage_number_of_storage_elements, { "Number of Storage Elements", "scsi.mode.smc.number_of_storage_elements", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7475       { &hf_scsi_smc_modepage_first_import_export_element_address, { "First Import/Export Element Address", "scsi.mode.smc.first_import_export_element_address", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7476       { &hf_scsi_smc_modepage_number_of_import_export_elements, { "Number of Import/Export Elements", "scsi.mode.smc.number_of_import_export_elements", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7477       { &hf_scsi_smc_modepage_first_data_transfer_element_address, { "First Data Transfer Element Address", "scsi.mode.smc.first_data_transfer_element_address", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7478       { &hf_scsi_smc_modepage_number_of_data_transfer_elements, { "Number of Data Transfer Elements", "scsi.mode.smc.number_of_data_transfer_elements", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7479       { &hf_scsi_smc_modepage_stordt, { "STORDT", "scsi.mode.smc.stordt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7480       { &hf_scsi_smc_modepage_mt_dt, { "MT->DT", "scsi.mode.smc.mt_dt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7481       { &hf_scsi_smc_modepage_st_dt, { "ST->DT", "scsi.mode.smc.st_dt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7482       { &hf_scsi_smc_modepage_ie_dt, { "I/E->DT", "scsi.mode.smc.ie_dt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7483       { &hf_scsi_smc_modepage_dt_dt, { "DT->DT", "scsi.mode.smc.dt_dt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7484       { &hf_scsi_smc_modepage_mt_ne_dt, { "MT<>DT", "scsi.mode.smc.mt_ne_dt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7485       { &hf_scsi_smc_modepage_st_ne_dt, { "ST<>DT", "scsi.mode.smc.st_ne_dt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7486       { &hf_scsi_smc_modepage_ie_ne_dt, { "I/E<>DT", "scsi.mode.smc.ie_ne_dt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7487       { &hf_scsi_smc_modepage_dt_ne_dt, { "DT<>DT", "scsi.mode.smc.dt_ne_dt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7488       { &hf_scsi_modesel_mode_data_length8, { "Mode Data Length", "scsi.cdb.mode.mode_data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7489       { &hf_scsi_modesel_dev_sbc_medium_type, { "Medium Type", "scsi.cdb.mode.medium_type", FT_UINT8, BASE_HEX, VALS(scsi_modesense_medtype_sbc_val), 0x0, NULL, HFILL }},
7490       { &hf_scsi_modesel_medium_type, { "Medium Type", "scsi.cdb.mode.medium_type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7491       { &hf_scsi_modesel_device_specific_parameter, { "Device-Specific Parameter", "scsi.cdb.mode.device_specific_parameter", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7492       { &hf_scsi_modesel_block_descriptor_length8, { "Block Descriptor Length", "scsi.cdb.mode.block_descriptor_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7493       { &hf_scsi_modesel_mode_data_length16, { "Mode Data Length", "scsi.cdb.mode.mode_data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7494       { &hf_scsi_modesel_longlba, { "LongLBA", "scsi.cdb.mode.longlba", FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
7495       { &hf_scsi_modesel_block_descriptor_length16, { "Block Descriptor Length", "scsi.cdb.mode.block_descriptor_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7496       { &hf_scsi_persresvin_generation_number, { "Generation Number", "scsi.persresvin.generation_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7497       { &hf_scsi_persresvin_additional_length, { "Additional Length", "scsi.persresvin.additional_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7498       { &hf_scsi_reportluns_lun_list_length, { "LUN List Length", "scsi.reportluns.lun_list_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7499       { &hf_scsi_sns_valid, { "Valid", "scsi.sns.valid", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7500       { &hf_scsi_sns_filemark, { "Filemark", "scsi.sns.filemark", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
7501       { &hf_scsi_sns_command_specific_information, { "Command-Specific Information", "scsi.sns.command_specific_information", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7502       { &hf_scsi_spc_modepage_report_log_exception_condition, { "Report Log Exception Condition", "scsi.spc.modepage.report_log_exception_condition", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7503       { &hf_scsi_spc_modepage_faa, { "FAA", "scsi.spc.modepage.faa", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7504       { &hf_scsi_spc_modepage_fab, { "FAB", "scsi.spc.modepage.fab", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7505       { &hf_scsi_spc_modepage_fac, { "FAC", "scsi.spc.modepage.fac", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7506       { &hf_scsi_spc_modepage_ebf, { "EBF", "scsi.spc.modepage.ebf", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7507       { &hf_scsi_spc_modepage_ewasc, { "EWasc", "scsi.spc.modepage.ewasc", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7508       { &hf_scsi_spc_modepage_dexcpt, { "DExcpt", "scsi.spc.modepage.dexcpt", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7509       { &hf_scsi_spc_modepage_test, { "Test", "scsi.spc.modepage.test", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7510       { &hf_scsi_spc_modepage_logerr, { "LogErr", "scsi.spc.modepage.logerr", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7511       { &hf_scsi_spc_modepage_standby, { "Standby", "scsi.spc.modepage.standby", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7512       { &hf_scsi_spc_modepage_plpb, { "PLPB", "scsi.spc.modepage.plpb", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7513       { &hf_scsi_spc_modepage_ddis, { "DDIS", "scsi.spc.modepage.ddis", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7514       { &hf_scsi_spc_modepage_dlm, { "DLM", "scsi.spc.modepage.dlm", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7515       { &hf_scsi_spc_modepage_rha, { "RHA", "scsi.spc.modepage.rha", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7516       { &hf_scsi_spc_modepage_alwi, { "ALWI", "scsi.spc.modepage.alwi", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7517       { &hf_scsi_spc_modepage_dtipe, { "DTIPE", "scsi.spc.modepage.dtipe", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7518       { &hf_scsi_spc_modepage_dtoli, { "DTOLI", "scsi.spc.modepage.dtoli", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7519       { &hf_scsi_sbc_modepage_hsec, { "HSEC", "scsi.sbc.modepage.hsec", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7520       { &hf_scsi_sbc_modepage_rmb, { "RMB", "scsi.sbc.modepage.rmb", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7521       { &hf_scsi_sbc_modepage_surf, { "SURF", "scsi.sbc.modepage.surf", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7522       { &hf_scsi_sbc_modepage_arre, { "ARRE", "scsi.sbc.modepage.arre", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7523       { &hf_scsi_sbc_modepage_tb, { "TB", "scsi.sbc.modepage.tb", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7524       { &hf_scsi_sbc_modepage_rc, { "RC", "scsi.sbc.modepage.rc", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7525       { &hf_scsi_sbc_modepage_eer, { "EER", "scsi.sbc.modepage.eer", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7526       { &hf_scsi_sbc_modepage_per, { "PER", "scsi.sbc.modepage.per", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7527       { &hf_scsi_sbc_modepage_dte, { "DTE", "scsi.sbc.modepage.dte", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7528       { &hf_scsi_sbc_modepage_dcr, { "DCR", "scsi.sbc.modepage.dcr", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7529       { &hf_scsi_sbc_modepage_abpf, { "ABPF", "scsi.sbc.modepage.abpf", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7530       { &hf_scsi_sbc_modepage_cap, { "CAP", "scsi.sbc.modepage.cap", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7531       { &hf_scsi_sbc_modepage_disc, { "Disc", "scsi.sbc.modepage.disc", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7532       { &hf_scsi_sbc_modepage_size, { "Size", "scsi.sbc.modepage.size", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7533       { &hf_scsi_sbc_modepage_wce, { "WCE", "scsi.sbc.modepage.wce", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7534       { &hf_scsi_sbc_modepage_mf, { "MF", "scsi.sbc.modepage.mf", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7535       { &hf_scsi_sbc_modepage_rcd, { "RCD", "scsi.sbc.modepage.rcd", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7536       { &hf_scsi_sbc_modepage_write_retention_priority, { "Write Retention Priority", "scsi.sbc.modepage.write_retention_priority", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
7537       { &hf_scsi_sbc_modepage_lbcss, { "LBCSS", "scsi.sbc.modepage.lbcss", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7538       { &hf_scsi_sbc_modepage_dra, { "DRA", "scsi.sbc.modepage.dra", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7539       { &hf_scsi_sbc_modepage_vendor_specific, { "Vendor Specific", "scsi.sbc.modepage.vendor_specific", FT_UINT8, BASE_DEC, NULL, 0x1F, NULL, HFILL }},
7540       { &hf_scsi_ssc2_modepage_dcc, { "DCC", "scsi.ssc2.modepage.dcc", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7541       { &hf_scsi_ssc2_modepage_red, { "RED", "scsi.ssc2.modepage.red", FT_UINT8, BASE_DEC, NULL, 0x60, NULL, HFILL }},
7542       { &hf_scsi_ssc2_modepage_active_format, { "Active Format", "scsi.ssc2.modepage.active_format", FT_UINT8, BASE_DEC, NULL, 0x1F, NULL, HFILL }},
7543       { &hf_scsi_ssc2_modepage_lois, { "LOIS", "scsi.ssc2.modepage.lois", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7544       { &hf_scsi_ssc2_modepage_rsmk, { "RSMK", "scsi.ssc2.modepage.rsmk", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7545       { &hf_scsi_ssc2_modepage_avc, { "AVC", "scsi.ssc2.modepage.avc", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7546       { &hf_scsi_ssc2_modepage_socf, { "SOCF", "scsi.ssc2.modepage.socf", FT_UINT8, BASE_DEC, NULL, 0x0C, NULL, HFILL }},
7547       { &hf_scsi_ssc2_modepage_robo, { "ROBO", "scsi.ssc2.modepage.robo", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7548       { &hf_scsi_ssc2_modepage_rew, { "REW", "scsi.ssc2.modepage.rew", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7549       { &hf_scsi_ssc2_modepage_eeg, { "EEG", "scsi.ssc2.modepage.eeg", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7550       { &hf_scsi_ssc2_modepage_sew, { "SEW", "scsi.ssc2.modepage.sew", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7551       { &hf_scsi_ssc2_modepage_swp, { "SWP", "scsi.ssc2.modepage.swp", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7552       { &hf_scsi_ssc2_modepage_baml, { "BAML", "scsi.ssc2.modepage.baml", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7553       { &hf_scsi_ssc2_modepage_bam, { "BAM", "scsi.ssc2.modepage.bam", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7554       { &hf_scsi_ssc2_modepage_rewind_on_reset, { "ReWind on Reset", "scsi.ssc2.modepage.rewind_on_reset", FT_UINT8, BASE_DEC, NULL, 0x18, NULL, HFILL }},
7555       { &hf_scsi_ssc2_modepage_asocwp, { "ASOCWP", "scsi.ssc2.modepage.asocwp", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7556       { &hf_scsi_ssc2_modepage_perswp, { "PERSWP", "scsi.ssc2.modepage.perswp", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7557       { &hf_scsi_ssc2_modepage_prmwp, { "PRMWP", "scsi.ssc2.modepage.prmwp", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7558       { &hf_scsi_ssc2_modepage_dsp, { "DSP", "scsi.ssc2.modepage.dsp", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7559       { &hf_scsi_ssc2_modepage_idp, { "IDP", "scsi.ssc2.modepage.idp", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7560       { &hf_scsi_ssc2_modepage_psum, { "PSUM", "scsi.ssc2.modepage.psum", FT_UINT8, BASE_DEC, NULL, 0x18, NULL, HFILL }},
7561       { &hf_scsi_ssc2_modepage_pofm, { "POFM", "scsi.ssc2.modepage.pofm", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7562       { &hf_scsi_ssc2_modepage_clear, { "CLEAR", "scsi.ssc2.modepage.clear", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7563       { &hf_scsi_ssc2_modepage_addp, { "ADDP", "scsi.ssc2.modepage.addp", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7564       { &hf_scsi_mmc5_modepage_ls_v, { "LS_V", "scsi.mmc5.modepage.ls_v", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7565       { &hf_scsi_mmc5_modepage_wrparam_test_write, { "Test Write", "scsi.mmc5.modepage.wrparam_test_write", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7566       { &hf_scsi_mmc5_modepage_write_type, { "Write Type", "scsi.mmc5.modepage.write_type", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
7567       { &hf_scsi_mmc5_modepage_fp, { "FP", "scsi.mmc5.modepage.fp", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7568       { &hf_scsi_mmc5_modepage_copy, { "Copy", "scsi.mmc5.modepage.copy", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7569       { &hf_scsi_mmc5_modepage_track_mode, { "Track Mode", "scsi.mmc5.modepage.track_mode", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
7570       { &hf_scsi_mmc5_modepage_dvd_r_read, { "DVD-R Read", "scsi.mmc5.modepage.dvd_r_read", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7571       { &hf_scsi_mmc5_modepage_dvd_rom_read, { "DVD-ROM Read", "scsi.mmc5.modepage.dvd_rom_read", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7572       { &hf_scsi_mmc5_modepage_method_2, { "Method 2", "scsi.mmc5.modepage.method_2", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7573       { &hf_scsi_mmc5_modepage_cd_rw_read, { "CD-RW Read", "scsi.mmc5.modepage.cd_rw_read", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7574       { &hf_scsi_mmc5_modepage_cd_r_read, { "CD-R Read", "scsi.mmc5.modepage.cd_r_read", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7575       { &hf_scsi_mmc5_modepage_dvd_r_write, { "DVD-R Write", "scsi.mmc5.modepage.dvd_r_write", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7576       { &hf_scsi_mmc5_modepage_dvd_rom_write, { "DVD-ROM Write", "scsi.mmc5.modepage.dvd_rom_write", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7577       { &hf_scsi_mmc5_modepage_mmcap_test_write, { "Test Write", "scsi.mmc5.modepage.mmcap_test_write", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7578       { &hf_scsi_mmc5_modepage_cd_rw_write, { "CD-RW Write", "scsi.mmc5.modepage.cd_rw_write", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7579       { &hf_scsi_mmc5_modepage_cd_r_write, { "CD-R Write", "scsi.mmc5.modepage.cd_r_write", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7580       { &hf_scsi_mmc5_modepage_mmcap_multi_session, { "Multi Session", "scsi.mmc5.modepage.mmcap_multi_session", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7581       { &hf_scsi_mmc5_modepage_mode_2_form2, { "Mode 2 Form 2", "scsi.mmc5.modepage.mode_2_form2", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7582       { &hf_scsi_mmc5_modepage_mode_2_form1, { "Mode 2 Form 1", "scsi.mmc5.modepage.mode_2_form1", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7583       { &hf_scsi_mmc5_modepage_digital_port2, { "Digital Port (2)", "scsi.mmc5.modepage.digital_port2", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7584       { &hf_scsi_mmc5_modepage_digital_port1, { "Digital Port (1)", "scsi.mmc5.modepage.digital_port1", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7585       { &hf_scsi_mmc5_modepage_composite, { "Composite", "scsi.mmc5.modepage.composite", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7586       { &hf_scsi_mmc5_modepage_audio_play, { "Audio Play", "scsi.mmc5.modepage.audio_play", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7587       { &hf_scsi_mmc5_modepage_upc, { "UPC", "scsi.mmc5.modepage.upc", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7588       { &hf_scsi_mmc5_modepage_isrc, { "ISRC", "scsi.mmc5.modepage.isrc", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7589       { &hf_scsi_mmc5_modepage_c2_pointers_supported, { "C2 Pointers supported", "scsi.mmc5.modepage.c2_pointers_supported", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7590       { &hf_scsi_mmc5_modepage_rw_deinterleaved_corrected, { "R-W Deinterleaved & corrected", "scsi.mmc5.modepage.rw_deinterleaved_corrected", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7591       { &hf_scsi_mmc5_modepage_rw_supported, { "R-W Supported", "scsi.mmc5.modepage.rw_supported", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7592       { &hf_scsi_mmc5_modepage_cd_da_stream_is_accurate, { "CD-DA Stream is Accurate", "scsi.mmc5.modepage.cd_da_stream_is_accurate", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7593       { &hf_scsi_mmc5_modepage_cd_da_cmds_supported, { "CD-DA Cmds Supported", "scsi.mmc5.modepage.cd_da_cmds_supported", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7594       { &hf_scsi_mmc5_modepage_eject, { "Eject", "scsi.mmc5.modepage.eject", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7595       { &hf_scsi_mmc5_modepage_prevent_jumper, { "Prevent Jumper", "scsi.mmc5.modepage.prevent_jumper", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7596       { &hf_scsi_mmc5_modepage_lock_state, { "Lock State", "scsi.mmc5.modepage.lock_state", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7597       { &hf_scsi_mmc5_modepage_lock, { "Lock", "scsi.mmc5.modepage.lock", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7598       { &hf_scsi_mmc5_modepage_side_change_capable, { "Side Change Capable", "scsi.mmc5.modepage.side_change_capable", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }},
7599       { &hf_scsi_mmc5_modepage_sw_slot_selection, { "S/W Slot Selection", "scsi.mmc5.modepage.sw_slot_selection", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
7600       { &hf_scsi_mmc5_modepage_changer_supports_disc_present, { "Changer Supports Disc Present", "scsi.mmc5.modepage.changer_supports_disc_present", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7601       { &hf_scsi_mmc5_modepage_separate_channel_mute, { "Separate Channel Mute", "scsi.mmc5.modepage.separate_channel_mute", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7602       { &hf_scsi_mmc5_modepage_separate_volume_levels, { "Separate volume levels", "scsi.mmc5.modepage.separate_volume_levels", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7603       { &hf_scsi_mmc5_modepage_lsbf, { "LSBF", "scsi.mmc5.modepage.lsbf", FT_UINT8, BASE_DEC, NULL, 0x30, NULL, HFILL }},
7604       { &hf_scsi_mmc5_modepage_rck, { "RCK", "scsi.mmc5.modepage.rck", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7605       { &hf_scsi_mmc5_modepage_bckf, { "BCKF", "scsi.mmc5.modepage.bckf", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7606       { &hf_scsi_smc_modepage_storie, { "STORI/E", "scsi.mode.smc.storie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7607       { &hf_scsi_smc_modepage_storst, { "STORST", "scsi.mode.smc.storst", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7608       { &hf_scsi_smc_modepage_stormt, { "STORMT", "scsi.mode.smc.stormt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7609       { &hf_scsi_smc_modepage_mt_ie, { "MT->I/E", "scsi.mode.smc.mt_ie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7610       { &hf_scsi_smc_modepage_mt_st, { "MT->ST", "scsi.mode.smc.mt_st", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7611       { &hf_scsi_smc_modepage_mt_mt, { "MT->MT", "scsi.mode.smc.mt_mt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7612       { &hf_scsi_smc_modepage_st_ie, { "ST->I/E", "scsi.mode.smc.st_ie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7613       { &hf_scsi_smc_modepage_st_st, { "ST->ST", "scsi.mode.smc.st_st", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7614       { &hf_scsi_smc_modepage_st_mt, { "ST->MT", "scsi.mode.smc.st_mt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7615       { &hf_scsi_smc_modepage_ie_ie, { "I/E->I/E", "scsi.mode.smc.ie_ie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7616       { &hf_scsi_smc_modepage_ie_st, { "I/E->ST", "scsi.mode.smc.ie_st", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7617       { &hf_scsi_smc_modepage_ie_mt, { "I/E->MT", "scsi.mode.smc.ie_mt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7618       { &hf_scsi_smc_modepage_dt_ie, { "DT->I/E", "scsi.mode.smc.dt_ie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7619       { &hf_scsi_smc_modepage_dt_st, { "DT->ST", "scsi.mode.smc.dt_st", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7620       { &hf_scsi_smc_modepage_dt_mt, { "DT->MT", "scsi.mode.smc.dt_mt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7621       { &hf_scsi_smc_modepage_mt_ne_ie, { "MT<>I/E", "scsi.mode.smc.mt_ne_ie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7622       { &hf_scsi_smc_modepage_mt_ne_st, { "MT<>ST", "scsi.mode.smc.mt_ne_st", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7623       { &hf_scsi_smc_modepage_mt_ne_mt, { "MT<>MT", "scsi.mode.smc.mt_ne_mt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7624       { &hf_scsi_smc_modepage_st_ne_ie, { "ST<>I/E", "scsi.mode.smc.st_ne_ie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7625       { &hf_scsi_smc_modepage_st_ne_st, { "ST<>ST", "scsi.mode.smc.st_ne_st", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7626       { &hf_scsi_smc_modepage_st_ne_mt, { "ST<>MT", "scsi.mode.smc.st_ne_mt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7627       { &hf_scsi_smc_modepage_ie_ne_ie, { "I/E<>I/E", "scsi.mode.smc.ie_ne_ie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7628       { &hf_scsi_smc_modepage_ie_ne_st, { "I/E<>ST", "scsi.mode.smc.ie_ne_st", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7629       { &hf_scsi_smc_modepage_ie_ne_mt, { "I/E<>MT", "scsi.mode.smc.ie_ne_mt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7630       { &hf_scsi_smc_modepage_dt_ne_ie, { "DT<>I/E", "scsi.mode.smc.dt_ne_ie", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
7631       { &hf_scsi_smc_modepage_dt_ne_st, { "DT<>ST", "scsi.mode.smc.dt_ne_st", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
7632       { &hf_scsi_smc_modepage_dt_ne_mt, { "DT<>MT", "scsi.mode.smc.dt_ne_mt", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
7633       { &hf_scsi_sns_eom, { "EOM", "scsi.sns.eom", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }},
7634       { &hf_scsi_sns_ili, { "ILI", "scsi.sns.ili", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }},
7635       { &hf_scsi_spc_xcopy_service, { "Service action", "scsi.extcopy.service_action", FT_UINT8, BASE_HEX, VALS(extcopy_service_vals), 0x0, NULL, HFILL }},
7636       { &hf_scsi_spc_recv_copy_service, { "Service action", "scsi.recv_copy.service_action", FT_UINT8, BASE_HEX, VALS(recv_copy_service_vals), 0x1F, NULL, HFILL }},
7637       { &hf_scsi_spc_xcopy_param_list_len, { "Parameter list length (bytes)", "scsi.extcopy.param_list_len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7638       { &hf_scsi_spc_xcopy_param_list_format, { "List format", "scsi.extcopy.list_format", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7639       { &hf_scsi_spc_xcopy_head_cscd_desc_list_len, { "Header cscd descriptor list length", "scsi.extcopy.hdr_cscd_list_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7640       { &hf_scsi_spc_xcopy_cscd_desc_list_len, { "CSCD descriptor list length", "scsi.extcopy.cscd_list_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7641       { &hf_scsi_spc_xcopy_inline_data_len, { "Inline data length", "scsi.extcopy.inline_data_len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7642       { &hf_scsi_spc_xcopy_seg_desc_list_len, { "Segment descriptor list length", "scsi.extcopy.seg_desc_list_len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7643       { &hf_scsi_spc_xcopy_list_id, { "List ID", "scsi.extcopy.list_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7644       { &hf_scsi_spc_xcopy_head_cscd_desc_type_code, { "Header CSCD description type code", "scsi.extcopy.head_cscd_desc_type_code", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7645       { &hf_scsi_spc_xcopy_cscd_desc_type_code, { "CSCD description type code", "scsi.cscd_desc_type_code", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(desc_type_rval), 0x0, NULL, HFILL}},
7646       { &hf_scsi_spc_xcopy_rel_init_port_id, { "Relative Initiator Port ID", "scsi.extcopy.rel_init_port_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7647       { &hf_scsi_spc_xcopy_per_dev_type, { "Peripherial Device Type", "scsi.extcopy.per_dev_type", FT_UINT8, BASE_DEC, VALS(per_dev_type_vals), 0x1F, NULL, HFILL }},
7648       { &hf_scsi_spc_xcopy_lu_type, { "LU type", "scsi.extcopy.lu_type", FT_UINT8, BASE_DEC, VALS(lu_type_vals), 0xC0, NULL, HFILL }},
7649       { &hf_scsi_spc_xcopy_per_dev_type_byte, { "Peripherial Device Type bits", "scsi.extcopy.per_dev_type_byte", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7650       { &hf_scsi_spc_xcopy_disk_block_len, { "Disk block length", "scsi.extcopy.disk_block_len", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7651       { &hf_scsi_spc_xcopy_cscd_desc_code_set, { "CSCD descriptor code set", "scsi.extcopy.cscd_code_set", FT_UINT8, BASE_DEC, VALS(scsi_devid_codeset_val), 0x0F, NULL, HFILL }},
7652       { &hf_scsi_spc_xcopy_cscd_desc_assoc, { "CSCD descriptor association", "scsi.extcopy.cscd_assoc", FT_UINT8, BASE_DEC, VALS(scsi_devid_assoc_val), 0x30, NULL, HFILL }},
7653       { &hf_scsi_spc_xcopy_cscd_desc_des_type, { "CSCD descriptor designator type", "scsi.extcopy.cscd_des_type", FT_UINT8, BASE_DEC, VALS(scsi_devid_idtype_val), 0x0F, NULL, HFILL }},
7654       { &hf_scsi_spc_xcopy_cscd_desc_des_len, { "CSCD descriptor desginator length", "scsi.extcopy.cscd_des_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7655       { &hf_scsi_spc_xcopy_seg_desc_type, { "Segment descriptor type code", "scsi.extcopy.seg_desc_type", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(desc_type_rval), 0x0, NULL, HFILL }},
7656       { &hf_scsi_spc_xcopy_seg_desc_dc, { "Segment descriptor designation count bit", "scsi.extcopy.seg_desc_dc", FT_UINT8, BASE_DEC, NULL, 0x2, NULL, HFILL }},
7657       { &hf_scsi_spc_xcopy_seg_desc_cat, { "Segment descriptor CAT bit", "scsi.extcopy.seg_desc_cat", FT_UINT8, BASE_DEC, NULL, 0x1, NULL, HFILL }},
7658       { &hf_scsi_spc_xcopy_seg_des_src_desc_id, { "Segment descriptor source ID", "scsi.extcopy.seg_desc_src_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7659       { &hf_scsi_spc_xcopy_seg_des_dest_desc_id, { "Segment descriptor destination ID", "scsi.extcopy.seg_desc_dest_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7660       { &hf_scsi_spc_xcopy_num_of_blocks, { "Number of blocks", "scsi.extcopy.seg_desc_num_of_blocks", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7661       { &hf_scsi_spc_xcopy_param_list_id_usage, { "List ID usage", "scsi.extcopy.xcopy_param_list_id_usage", FT_UINT8, BASE_HEX, NULL, 0x18, NULL, HFILL }},
7662       { &hf_scsi_spc_xcopy_param_str, { "Sequential strip bit (str)", "scsi.extcopy.xcopy_param_str", FT_UINT8, BASE_HEX, NULL, 0x20, NULL, HFILL }},
7663       { &hf_scsi_spc_xcopy_param_priority, { "Priority", "scsi.extcopy.xcopy_param_priority", FT_UINT8, BASE_HEX, NULL, 0x7, NULL, HFILL }},
7664       { &hf_scsi_spc_xcopy_param_byte, { "Extended copy Parameters: str, list ID usage, priority", "scsi.extcopy.xcopy_params_byte", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7665       { &hf_scsi_spc_xcopy_source_lba, { "Source LBA", "scsi.extcopy.source_lba", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7666       { &hf_scsi_spc_xcopy_dest_lba, { "Destination LBA", "scsi.extcopy.dest_lba", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7667       { &hf_scsi_recv_copy_max_cscd_desc_count, { "Max. CSCD descriptors count", "scsi.recv_copy.max_cscd_desc_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7668       { &hf_scsi_recv_copy_max_seg_desc_count, { "Max. segment descriptors count", "scsi.recv_copy.max_seg_desc_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7669       { &hf_scsi_recv_copy_max_desc_list_len, { "Max. descriptor list length", "scsi.recv_copy.max_desc_list_len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7670       { &hf_scsi_recv_copy_max_seg_len, { "Max. segment length", "scsi.recv_copy.max_seg_len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7671       { &hf_scsi_recv_copy_max_inline_data_len, { "Max. inline data length",  "scsi.recv_copy.max_inline_data_len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7672       { &hf_scsi_recv_copy_held_data_limit, { "Held data limit", "scsi.recv_copy.max_held_data_limit", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7673       { &hf_scsi_recv_copy_max_stream_dev_trans_size, { "Max. stream device transfer size", "scsi.recv_copy.max_stream_dev_trans_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7674       { &hf_scsi_recv_copy_snlid, { "SNLID bit", "scsi.recv_copy.snlid", FT_UINT8, BASE_DEC, NULL, 0x1, NULL, HFILL }},
7675       { &hf_scsi_recv_copy_avail_data, { "Available data", "scsi.recv_copy.avail_data", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7676       { &hf_scsi_recv_copy_total_con_copies, { "Total number of concurrent copies", "scsi.recv_copy.total_con_copies", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7677       { &hf_scsi_recv_copy_max_con_copies, { "Max. number of concurrent copies", "scsi.recv_copy.max_con_copies", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7678       { &hf_scsi_recv_copy_data_seg_gran, { "Data segment granularity", "scsi.recv_copy.data_seg_gran", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7679       { &hf_scsi_recv_copy_inline_data_gran, { "Inline data granularity", "scsi.recv_copy.inline_data_gran", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7680       { &hf_scsi_recv_copy_held_data_gran, { "Held data granularity", "scsi.recv_copy.held_data_gran", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7681       { &hf_scsi_recv_copy_implemented_desc_list_len, { "Implemented description list length", "scsi.recv_copy.implemented_desc_list_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7682       { &hf_scsi_designator, { "Designator", "scsi.designator", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7683       { &hf_scsi_segment_descriptor_length, { "Segment descriptor length (bytes)", "scsi.segment_descriptor_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7684       { &hf_scsi_inline_data, { "Inline data", "scsi.inline_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7685       { &hf_scsi_reserved_8, { "Reserved (1 byte)", "scsi.reserved", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7686       { &hf_scsi_reserved_16, { "Reserved (2 bytes)", "scsi.reserved2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7687       { &hf_scsi_reserved_24, { "Reserved (3 bytes)", "scsi.reserved3", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7688       { &hf_scsi_reserved_32, { "Reserved (4 bytes)", "scsi.reserved4", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7689       { &hf_scsi_reserved_64, { "Reserved (8 bytes)", "scsi.reserved8", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
7690       { &hf_scsi_naa_type, { "NAA Designator Type", "scsi.naa.type", FT_UINT8, BASE_DEC, VALS(scsi_naa_designator_type_val), 0xF0, NULL, HFILL }},
7691       { &hf_scsi_naa_locally_assigned, { "Locally Assigned", "scsi.naa.locally_assigned", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
7692       { &hf_scsi_naa_ieee_company_id, { "IEEE Company ID", "scsi.naa.ieee_company_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7693       { &hf_scsi_naa_vendor_specific, { "Vendor Specific Identifier", "scsi.naa.vendor_specific", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
7694       { &hf_scsi_naa_vendor_specific_extension, { "Vendor Specific Identifier Extension", "scsi.naa.vendor_specific.extension", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}
7695     };
7696
7697     /* Setup protocol subtree array */
7698     static gint *ett[] = {
7699         &ett_scsi,
7700         &ett_scsi_page,
7701         &ett_scsi_control,
7702         &ett_scsi_inq_control,
7703         &ett_scsi_inq_peripheral,
7704         &ett_scsi_inq_acaflags,
7705         &ett_scsi_inq_rmbflags,
7706         &ett_scsi_inq_sccsflags,
7707         &ett_scsi_inq_bqueflags,
7708         &ett_scsi_inq_reladrflags,
7709         &ett_scsi_log,
7710         &ett_scsi_log_ppc,
7711         &ett_scsi_log_pc,
7712         &ett_scsi_log_param,
7713         &ett_scsi_fragments,
7714         &ett_scsi_fragment,
7715         &ett_persresv_control,
7716         &ett_scsi_lun,
7717         &ett_scsi_lun_unit,
7718         &ett_scsi_prevent_allow,
7719         &ett_command_descriptor,
7720         &ett_timeout_descriptor,
7721         &ett_sense_descriptor,
7722         &ett_sense_osd_not_initiated,
7723         &ett_sense_osd_completed,
7724         &ett_xcopy_per_dev_type,
7725         &ett_scsi_xcopy_dev_params,
7726         &ett_scsi_xcopy_cscds,
7727         &ett_scsi_xcopy_cscd,
7728         &ett_scsi_xcopy_segs,
7729         &ett_scsi_xcopy_seg,
7730         &ett_scsi_xcopy_seg_param,
7731         &ett_xcopy_param_byte,
7732         &ett_scsi_cscd_desc,
7733         &ett_scsi_designation_descriptor,
7734         &ett_scsi_naa,
7735     };
7736
7737     static ei_register_info ei[] = {
7738         { &ei_scsi_product_data_goes_past_end_of_page, { "scsi.product_data_goes_past_end_of_page", PI_MALFORMED, PI_WARN, "Product data goes past end of page", EXPFILL }},
7739         { &ei_scsi_unknown_page, { "scsi.unknown_page", PI_UNDECODED, PI_WARN, "Unknown Page", EXPFILL }},
7740         { &ei_scsi_no_dissection_for_service_action, { "scsi.no_dissection_for_service_action", PI_UNDECODED, PI_WARN, "No dissection for this service action yet", EXPFILL }},
7741         { &ei_scsi_unknown_scsi_exchange, { "scsi.unknown_scsi_exchange", PI_PROTOCOL, PI_WARN, "Unknown SCSI exchange, can not decode SCSI data", EXPFILL }},
7742         { &ei_scsi_unknown_serv_action, { "scsi.unknown_serv_action", PI_PROTOCOL, PI_WARN, "Unknown serv_action", EXPFILL }},
7743     };
7744
7745     module_t *scsi_module;
7746     expert_module_t* expert_scsi;
7747
7748     /* Register the protocol name and description */
7749     proto_scsi = proto_register_protocol("SCSI", "SCSI", "scsi");
7750
7751     /* Required function calls to register the header fields and subtrees used */
7752     proto_register_field_array(proto_scsi, hf, array_length(hf));
7753     proto_register_subtree_array(ett, array_length(ett));
7754     expert_scsi = expert_register_protocol(proto_scsi);
7755     expert_register_field_array(expert_scsi, ei, array_length(ei));
7756
7757     /* add preferences to decode SCSI message */
7758     scsi_module = prefs_register_protocol(proto_scsi, NULL);
7759     prefs_register_enum_preference(scsi_module, "decode_scsi_messages_as",
7760                                    "Decode SCSI Messages As",
7761                                    "When Target Cannot Be Identified, Decode SCSI Messages As",
7762                                    &scsi_def_devtype,
7763                                    scsi_devtype_options,
7764                                    FALSE);
7765
7766     prefs_register_bool_preference(scsi_module, "defragment",
7767                                    "Reassemble fragmented SCSI DATA IN/OUT transfers",
7768                                    "Whether fragmented SCSI DATA IN/OUT transfers should be reassembled",
7769                                    &scsi_defragment);
7770     register_init_routine(scsi_defragment_init);
7771     register_cleanup_routine(scsi_defragment_cleanup);
7772
7773     register_srt_table(proto_scsi, NULL, 1, scsistat_packet, scsistat_init, scsistat_param);
7774
7775     scsi_tap    = register_tap("scsi");
7776 }
7777
7778 /*
7779  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
7780  *
7781  * Local variables:
7782  * c-basic-offset: 4
7783  * tab-width: 8
7784  * indent-tabs-mode: nil
7785  * End:
7786  *
7787  * vi: set shiftwidth=4 tabstop=8 expandtab:
7788  * :indentSize=4:tabSize=8:noTabs=true:
7789  */