Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-scsi-ssc.c
blob1a48daaf4fdc998e2af7f2ca6b3fe1e9cac27915
1 /* based on SSC3 spec */
2 /* TODO:
3 * dissect READPOSITION data
4 * dissect REPORTDENSITYSUPPORT data
5 */
6 /* packet-scsi-ssc.c
7 * Dissector for the SCSI SSC commandset
8 * Extracted from packet-scsi.c
10 * Dinesh G Dutt (ddutt@cisco.com)
11 * Ronnie sahlberg 2006
13 * Wireshark - Network traffic analyzer
14 * By Gerald Combs <gerald@wireshark.org>
15 * Copyright 2002 Gerald Combs
17 * SPDX-License-Identifier: GPL-2.0-or-later
20 #include "config.h"
22 #include <epan/packet.h>
23 #include <epan/unit_strings.h>
25 #include <wsutil/array.h>
26 #include "packet-scsi.h"
27 #include "packet-scsi-ssc.h"
28 #include "packet-scsi-smc.h"
30 void proto_register_scsi_ssc(void);
32 static int proto_scsi_ssc;
33 int hf_scsi_ssc_opcode;
34 static int hf_scsi_ssc_rdwr6_xferlen;
35 static int hf_scsi_ssc_ver16_verlen;
36 static int hf_scsi_ssc_locate10_loid;
37 static int hf_scsi_ssc_locate16_loid;
38 static int hf_scsi_ssc_space6_code;
39 static int hf_scsi_ssc_space6_count;
40 static int hf_scsi_ssc_space16_count;
41 static int hf_scsi_ssc_erase_flags;
42 static int hf_scsi_ssc_fcs;
43 static int hf_scsi_ssc_lcs;
44 static int hf_scsi_ssc_erase_immed;
45 static int hf_scsi_ssc_long;
46 static int hf_scsi_ssc_partition;
47 static int hf_scsi_ssc_lbi;
48 static int hf_scsi_ssc_verify;
49 static int hf_scsi_ssc_immed;
50 static int hf_scsi_ssc_formatmedium_flags;
51 static int hf_scsi_ssc_format;
52 static int hf_scsi_ssc_rdwr10_xferlen;
53 static int hf_scsi_ssc_loadunload_immed_flags;
54 static int hf_scsi_ssc_loadunload_flags;
55 static int hf_scsi_ssc_hold;
56 static int hf_scsi_ssc_eot;
57 static int hf_scsi_ssc_reten;
58 static int hf_scsi_ssc_load;
59 static int hf_scsi_ssc_locate_flags;
60 static int hf_scsi_ssc_bt;
61 static int hf_scsi_ssc_cp;
62 static int hf_scsi_ssc_dest_type;
63 static int hf_scsi_ssc_bam_flags;
64 static int hf_scsi_ssc_bam;
65 static int hf_scsi_ssc_read6_flags;
66 static int hf_scsi_ssc_sili;
67 static int hf_scsi_ssc_fixed;
68 static int hf_scsi_ssc_bytord;
69 static int hf_scsi_ssc_bytcmp;
70 static int hf_scsi_ssc_verify16_immed;
71 static int hf_scsi_ssc_medium_type;
72 static int hf_scsi_ssc_media;
73 static int hf_scsi_ssc_capacity_prop_value;
74 /* Generated from convert_proto_tree_add_text.pl */
75 static int hf_scsi_ssc_readposition_block_number;
76 static int hf_scsi_ssc_readposition_file_number;
77 static int hf_scsi_ssc_readposition_parameter_len;
78 static int hf_scsi_ssc_readblocklimits_max_block_length_limit;
79 static int hf_scsi_ssc_readposition_set_number;
80 static int hf_scsi_ssc_readblocklimits_granularity;
81 static int hf_scsi_ssc_readposition_flags;
82 static int hf_scsi_ssc_readposition_bop;
83 static int hf_scsi_ssc_readposition_eop;
84 static int hf_scsi_ssc_readposition_mpu;
85 static int hf_scsi_ssc_readposition_bcu;
86 static int hf_scsi_ssc_readposition_bycu;
87 static int hf_scsi_ssc_readposition_bpu;
88 static int hf_scsi_ssc_readposition_perr;
91 static int hf_scsi_ssc_readposition_additional_length;
92 static int hf_scsi_ssc_readposition_num_blocks_buffer;
93 static int hf_scsi_ssc_readposition_last_block_location;
94 static int hf_scsi_ssc_erase6_immed;
95 static int hf_scsi_ssc_erase6_long;
96 static int hf_scsi_ssc_readblocklimits_min_block_length_limit;
97 static int hf_scsi_ssc_readposition_service_action;
98 static int hf_scsi_ssc_readposition_num_bytes_buffer;
99 static int hf_scsi_ssc_readposition_first_block_location;
100 static int hf_scsi_ssc_space16_parameter_len;
101 static int hf_scsi_ssc_readposition_partition_number;
103 static int ett_scsi_erase;
104 static int ett_scsi_formatmedium;
105 static int ett_scsi_loadunload_immed;
106 static int ett_scsi_loadunload;
107 static int ett_scsi_locate;
108 static int ett_scsi_bam;
109 static int ett_scsi_read6;
110 static int ett_scsi_ssc_readposition_flags;
113 static void
114 dissect_ssc_read6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
115 unsigned offset, bool isreq, bool iscdb,
116 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
118 static int * const read6_fields[] = {
119 &hf_scsi_ssc_sili,
120 &hf_scsi_ssc_fixed,
121 NULL
124 if (isreq) {
125 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
126 tvb_get_ntoh24 (tvb, offset+1));
129 if (tree && isreq && iscdb) {
130 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
131 ett_scsi_read6, read6_fields, ENC_BIG_ENDIAN);
132 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
133 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
134 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
138 static void
139 dissect_ssc_recoverbuffereddata (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
140 unsigned offset, bool isreq, bool iscdb,
141 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
143 static int * const recover_fields[] = {
144 &hf_scsi_ssc_sili,
145 &hf_scsi_ssc_fixed,
146 NULL
149 if (isreq) {
150 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
151 tvb_get_ntoh24 (tvb, offset+1));
154 if (tree && isreq && iscdb) {
155 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
156 ett_scsi_read6, recover_fields, ENC_BIG_ENDIAN);
157 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
158 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
159 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
163 static void
164 dissect_ssc_reportdensitysupport (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
165 unsigned offset, bool isreq, bool iscdb,
166 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
168 static int * const rd_fields[] = {
169 &hf_scsi_ssc_medium_type,
170 &hf_scsi_ssc_media,
171 NULL
174 if (isreq) {
175 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
176 tvb_get_ntoh24 (tvb, offset+1));
179 if(!tree)
180 return;
182 if (isreq && iscdb) {
183 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
184 ett_scsi_read6, rd_fields, ENC_BIG_ENDIAN);
185 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
186 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
187 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
188 } else {
189 /* XXX decode the data */
193 static void
194 dissect_ssc_readreverse6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
195 unsigned offset, bool isreq, bool iscdb,
196 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
198 static int * const rr6_fields[] = {
199 &hf_scsi_ssc_bytord,
200 &hf_scsi_ssc_sili,
201 &hf_scsi_ssc_fixed,
202 NULL
205 if (isreq) {
206 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
207 tvb_get_ntoh24 (tvb, offset+1));
210 if (tree && isreq && iscdb) {
211 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
212 ett_scsi_read6, rr6_fields, ENC_BIG_ENDIAN);
213 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
214 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
215 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
219 static void
220 dissect_ssc_read16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
221 unsigned offset, bool isreq, bool iscdb,
222 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
224 static int * const read6_fields[] = {
225 &hf_scsi_ssc_sili,
226 &hf_scsi_ssc_fixed,
227 NULL
230 if (isreq) {
231 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
232 tvb_get_ntoh24 (tvb, offset+1));
235 if (tree && isreq && iscdb) {
236 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
237 ett_scsi_read6, read6_fields, ENC_BIG_ENDIAN);
238 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
239 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
240 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
241 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
242 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
246 static void
247 dissect_ssc_write16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
248 unsigned offset, bool isreq, bool iscdb,
249 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
251 static int * const write16_fields[] = {
252 &hf_scsi_ssc_fcs,
253 &hf_scsi_ssc_lcs,
254 &hf_scsi_ssc_fixed,
255 NULL
258 if (isreq) {
259 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
260 tvb_get_ntoh24 (tvb, offset+1));
263 if (tree && isreq && iscdb) {
264 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
265 ett_scsi_read6, write16_fields, ENC_BIG_ENDIAN);
266 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
267 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
268 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
269 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
270 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
274 static void
275 dissect_ssc_writefilemarks16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
276 unsigned offset, bool isreq, bool iscdb,
277 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
279 static int * const wf16_fields[] = {
280 &hf_scsi_ssc_fcs,
281 &hf_scsi_ssc_lcs,
282 &hf_scsi_ssc_immed,
283 NULL
286 if (isreq) {
287 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
288 tvb_get_ntoh24 (tvb, offset+1));
291 if (tree && isreq && iscdb) {
292 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
293 ett_scsi_read6, wf16_fields, ENC_BIG_ENDIAN);
294 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
295 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
296 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
297 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
298 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
302 static void
303 dissect_ssc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
304 unsigned offset, bool isreq, bool iscdb,
305 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
307 static int * const verify16_fields[] = {
308 &hf_scsi_ssc_verify16_immed,
309 &hf_scsi_ssc_bytcmp,
310 &hf_scsi_ssc_fixed,
311 NULL
314 if (isreq) {
315 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
316 tvb_get_ntoh24 (tvb, offset+1));
319 if (tree && isreq && iscdb) {
320 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
321 ett_scsi_read6, verify16_fields, ENC_BIG_ENDIAN);
322 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
323 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
324 proto_tree_add_item (tree, hf_scsi_ssc_ver16_verlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
325 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
326 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
330 static void
331 dissect_ssc_verify6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
332 unsigned offset, bool isreq, bool iscdb,
333 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
335 static int * const verify6_fields[] = {
336 &hf_scsi_ssc_verify16_immed,
337 &hf_scsi_ssc_bytcmp,
338 &hf_scsi_ssc_fixed,
339 NULL
342 if (isreq) {
343 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
344 tvb_get_ntoh24 (tvb, offset+1));
347 if (tree && isreq && iscdb) {
348 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
349 ett_scsi_read6, verify6_fields, ENC_BIG_ENDIAN);
350 proto_tree_add_item (tree, hf_scsi_ssc_ver16_verlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
351 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
352 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
356 static void
357 dissect_ssc_readreverse16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
358 unsigned offset, bool isreq, bool iscdb,
359 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
361 static int * const rr16_fields[] = {
362 &hf_scsi_ssc_bytord,
363 &hf_scsi_ssc_sili,
364 &hf_scsi_ssc_fixed,
365 NULL
368 if (isreq) {
369 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
370 tvb_get_ntoh24 (tvb, offset+1));
373 if (tree && isreq && iscdb) {
374 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
375 ett_scsi_read6, rr16_fields, ENC_BIG_ENDIAN);
376 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
377 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
378 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
379 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
380 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
384 static void
385 dissect_ssc_write6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
386 unsigned offset, bool isreq, bool iscdb,
387 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
389 static int * const write6_fields[] = {
390 &hf_scsi_ssc_immed,
391 NULL
394 if (isreq && iscdb) {
395 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
396 tvb_get_ntoh24 (tvb, offset+1));
399 if (tree && isreq && iscdb) {
400 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
401 ett_scsi_read6, write6_fields, ENC_BIG_ENDIAN);
402 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
403 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
404 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
408 static void
409 dissect_ssc_writefilemarks6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
410 unsigned offset, bool isreq, bool iscdb,
411 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
413 static int * const wf6_fields[] = {
414 &hf_scsi_ssc_immed,
415 NULL
418 if (isreq) {
419 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
420 tvb_get_ntoh24 (tvb, offset+1));
423 if (tree && isreq && iscdb) {
424 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
425 ett_scsi_read6, wf6_fields, ENC_BIG_ENDIAN);
426 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
427 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
428 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
432 static void
433 dissect_ssc_loadunload (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
434 unsigned offset, bool isreq, bool iscdb,
435 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
437 static int * const loadunload_immed_fields[] = {
438 &hf_scsi_ssc_immed,
439 NULL
441 static int * const loadunload_fields[] = {
442 &hf_scsi_ssc_hold,
443 &hf_scsi_ssc_eot,
444 &hf_scsi_ssc_reten,
445 &hf_scsi_ssc_load,
446 NULL
449 if (isreq && iscdb) {
450 col_append_fstr (pinfo->cinfo, COL_INFO, "(Immed: %u)",
451 tvb_get_uint8 (tvb, offset) & 0x01);
454 if (!tree)
455 return;
458 if (isreq && iscdb) {
459 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_loadunload_immed_flags,
460 ett_scsi_loadunload_immed, loadunload_immed_fields, ENC_BIG_ENDIAN);
461 proto_tree_add_bitmask(tree, tvb, offset+3, hf_scsi_ssc_loadunload_flags,
462 ett_scsi_loadunload, loadunload_fields, ENC_BIG_ENDIAN);
463 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
464 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
469 static void
470 dissect_ssc_readblocklimits (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
471 unsigned offset, bool isreq, bool iscdb,
472 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
474 uint8_t granularity;
476 if (!tree)
477 return;
479 if (isreq && iscdb) {
480 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
481 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
483 else if (!iscdb) {
484 granularity = tvb_get_uint8 (tvb, offset);
485 proto_tree_add_uint(tree, hf_scsi_ssc_readblocklimits_granularity, tvb, offset, 1, 1 << granularity);
486 proto_tree_add_item(tree, hf_scsi_ssc_readblocklimits_max_block_length_limit, tvb, offset+1, 3, ENC_BIG_ENDIAN);
487 proto_tree_add_item(tree, hf_scsi_ssc_readblocklimits_min_block_length_limit, tvb, offset+4, 2, ENC_BIG_ENDIAN);
491 static void
492 dissect_ssc_rewind (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
493 unsigned offset, bool isreq, bool iscdb,
494 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
496 static int * const rewind_fields[] = {
497 &hf_scsi_ssc_immed,
498 NULL
501 if (!tree)
502 return;
504 if (isreq && iscdb) {
505 col_append_fstr (pinfo->cinfo, COL_INFO, "(Immed: %u)",
506 tvb_get_uint8 (tvb, offset) & 0x01);
508 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags, ett_scsi_read6, rewind_fields, ENC_BIG_ENDIAN);
509 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
510 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
514 static void
515 dissect_ssc_setcapacity (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
516 unsigned offset, bool isreq, bool iscdb,
517 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
519 static int * const sc_fields[] = {
520 &hf_scsi_ssc_immed,
521 NULL
524 if (!tree)
525 return;
527 if (isreq && iscdb) {
528 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
529 ett_scsi_read6, sc_fields, ENC_BIG_ENDIAN);
530 proto_tree_add_item (tree, hf_scsi_ssc_capacity_prop_value, tvb, offset+2, 2, ENC_BIG_ENDIAN);
531 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
532 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
537 static void
538 dissect_ssc_locate10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
539 unsigned offset, bool isreq, bool iscdb,
540 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
542 static int * const locate_fields[] = {
543 &hf_scsi_ssc_bt,
544 &hf_scsi_ssc_cp,
545 &hf_scsi_ssc_immed,
546 NULL
549 if (!tree)
550 return;
552 if (isreq && iscdb) {
553 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_locate_flags,
554 ett_scsi_locate, locate_fields, ENC_BIG_ENDIAN);
555 proto_tree_add_item (tree, hf_scsi_ssc_locate10_loid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
556 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+7, 1, ENC_BIG_ENDIAN);
557 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
558 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
563 static void
564 dissect_ssc_locate16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
565 unsigned offset, bool isreq, bool iscdb,
566 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
568 static int * const locate_fields[] = {
569 &hf_scsi_ssc_dest_type,
570 &hf_scsi_ssc_cp,
571 &hf_scsi_ssc_immed,
572 NULL
574 static int * const bam_fields[] = {
575 &hf_scsi_ssc_bam,
576 NULL
579 if (!tree)
580 return;
582 if (isreq && iscdb) {
583 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_locate_flags,
584 ett_scsi_locate, locate_fields, ENC_BIG_ENDIAN);
585 proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_ssc_bam_flags,
586 ett_scsi_bam, bam_fields, ENC_BIG_ENDIAN);
587 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
588 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
589 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
590 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
595 static void
596 dissect_ssc_erase6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
597 unsigned offset, bool isreq, bool iscdb,
598 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
600 if (isreq && iscdb) {
601 if (!tree)
602 return;
604 proto_tree_add_item(tree, hf_scsi_ssc_erase6_immed, tvb, offset, 1, ENC_BIG_ENDIAN);
605 proto_tree_add_item(tree, hf_scsi_ssc_erase6_long, tvb, offset, 1, ENC_BIG_ENDIAN);
607 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
608 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
613 static void
614 dissect_ssc_erase16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
615 unsigned offset, bool isreq, bool iscdb,
616 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
618 static int * const erase16_fields[] = {
619 &hf_scsi_ssc_fcs,
620 &hf_scsi_ssc_lcs,
621 &hf_scsi_ssc_erase_immed,
622 &hf_scsi_ssc_long,
623 NULL
626 if (!tree)
627 return;
629 if (isreq && iscdb) {
630 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_erase_flags,
631 ett_scsi_erase, erase16_fields, ENC_BIG_ENDIAN);
632 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
633 proto_tree_add_item (tree, hf_scsi_ssc_lbi, tvb, offset+3, 8, ENC_BIG_ENDIAN);
634 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
635 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
639 static void
640 dissect_ssc_space6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
641 unsigned offset, bool isreq, bool iscdb,
642 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
644 if (!tree)
645 return;
647 if (isreq && iscdb) {
648 proto_tree_add_item (tree, hf_scsi_ssc_space6_code, tvb, offset, 1, ENC_BIG_ENDIAN);
649 proto_tree_add_item (tree, hf_scsi_ssc_space6_count, tvb, offset+1, 3, ENC_BIG_ENDIAN);
650 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
651 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
655 static void
656 dissect_ssc_space16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
657 unsigned offset, bool isreq, bool iscdb,
658 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
660 if (!tree)
661 return;
663 if (isreq && iscdb) {
664 proto_tree_add_item (tree, hf_scsi_ssc_space6_code, tvb, offset, 1, ENC_BIG_ENDIAN);
665 proto_tree_add_item (tree, hf_scsi_ssc_space16_count, tvb, offset+3, 8, ENC_BIG_ENDIAN);
666 proto_tree_add_item(tree, hf_scsi_ssc_space16_parameter_len, tvb, offset+11, 2, ENC_BIG_ENDIAN);
667 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
668 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
672 static const value_string space6_code_vals[] = {
673 {0, "Logical Blocks"},
674 {1, "Filemarks"},
675 {2, "Sequential Filemarks"},
676 {3, "End-Of-Data"},
677 {0, NULL}
680 static const value_string format_vals[] = {
681 {0x0, "Use default format"},
682 {0x1, "Partition medium"},
683 {0x2, "Default format then partition"},
684 {0, NULL}
687 static const value_string dest_type_vals[] = {
688 {0, "Logical Object Identifier"},
689 {1, "Logical File Identifier"},
690 {0, NULL}
693 static void
694 dissect_ssc_formatmedium (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
695 unsigned offset, bool isreq, bool iscdb,
696 unsigned payload_len _U_, scsi_task_data_t *cdata _U_)
698 static int * const formatmedium_fields[] = {
699 &hf_scsi_ssc_verify,
700 &hf_scsi_ssc_immed,
701 NULL
704 if (!tree)
705 return;
707 if (isreq && iscdb) {
708 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_formatmedium_flags,
709 ett_scsi_formatmedium, formatmedium_fields, ENC_BIG_ENDIAN);
710 proto_tree_add_item (tree, hf_scsi_ssc_format, tvb, offset+1, 1, ENC_BIG_ENDIAN);
711 proto_tree_add_item (tree, hf_scsi_ssc_rdwr10_xferlen, tvb, offset+2, 2, ENC_BIG_ENDIAN);
712 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
713 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
718 #define BCU 0x20
719 #define BYCU 0x10
720 #define MPU 0x08
721 #define BPU 0x04
723 static void
724 dissect_ssc_readposition (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
725 unsigned offset, bool isreq, bool iscdb,
726 unsigned payload_len _U_, scsi_task_data_t *cdata)
728 int service_action;
729 uint8_t flags;
731 if (!tree)
732 return;
734 if (isreq && iscdb) {
735 service_action = tvb_get_uint8 (tvb, offset) & 0x1F;
736 proto_tree_add_item(tree, hf_scsi_ssc_readposition_service_action, tvb, offset, 1, ENC_BIG_ENDIAN);
737 /* Remember the service action so we can decode the reply */
738 if (cdata != NULL) {
739 cdata->itlq->flags = service_action;
741 proto_tree_add_item(tree, hf_scsi_ssc_readposition_parameter_len, tvb, offset+6, 2, ENC_BIG_ENDIAN);
742 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
743 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
745 else if (!isreq) {
746 if (cdata)
747 service_action = cdata->itlq->flags;
748 else
749 service_action = -1; /* unknown */
750 switch (service_action) {
751 case SHORT_FORM_BLOCK_ID:
752 case SHORT_FORM_VENDOR_SPECIFIC:
754 static int * const block_id_flags[] = {
755 &hf_scsi_ssc_readposition_bop,
756 &hf_scsi_ssc_readposition_eop,
757 &hf_scsi_ssc_readposition_bcu,
758 &hf_scsi_ssc_readposition_bycu,
759 &hf_scsi_ssc_readposition_bpu,
760 &hf_scsi_ssc_readposition_perr,
761 NULL
764 flags = tvb_get_uint8 (tvb, offset);
765 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_readposition_flags,
766 ett_scsi_ssc_readposition_flags, block_id_flags, ENC_NA);
767 offset += 1;
769 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset, 1, ENC_BIG_ENDIAN);
770 offset += 1;
772 offset += 2; /* reserved */
774 if (!(flags & BPU)) {
775 proto_tree_add_item(tree, hf_scsi_ssc_readposition_first_block_location, tvb, offset, 4, ENC_BIG_ENDIAN);
776 offset += 4;
778 proto_tree_add_item(tree, hf_scsi_ssc_readposition_last_block_location, tvb, offset, 4, ENC_BIG_ENDIAN);
779 offset += 4;
780 } else
781 offset += 8;
783 offset += 1; /* reserved */
785 if (!(flags & BCU)) {
786 proto_tree_add_item(tree, hf_scsi_ssc_readposition_num_blocks_buffer, tvb, offset, 3, ENC_BIG_ENDIAN);
788 offset += 3;
790 if (!(flags & BYCU)) {
791 proto_tree_add_item(tree, hf_scsi_ssc_readposition_num_bytes_buffer, tvb, offset, 4, ENC_BIG_ENDIAN);
793 /*offset += 4;*/
795 break;
797 case LONG_FORM:
799 static int * const long_form_flags[] = {
800 &hf_scsi_ssc_readposition_bop,
801 &hf_scsi_ssc_readposition_eop,
802 &hf_scsi_ssc_readposition_mpu,
803 &hf_scsi_ssc_readposition_bcu,
804 NULL
807 flags = tvb_get_uint8 (tvb, offset);
808 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_readposition_flags,
809 ett_scsi_ssc_readposition_flags, long_form_flags, ENC_NA);
810 offset += 1;
812 offset += 3; /* reserved */
814 if (!(flags & BPU)) {
815 proto_tree_add_item(tree, hf_scsi_ssc_readposition_partition_number, tvb, offset, 4, ENC_BIG_ENDIAN);
816 offset += 4;
818 proto_tree_add_item(tree, hf_scsi_ssc_readposition_block_number, tvb, offset, 8, ENC_BIG_ENDIAN);
819 offset += 8;
820 } else
821 offset += 12;
823 if (!(flags & MPU)) {
824 proto_tree_add_item(tree, hf_scsi_ssc_readposition_file_number, tvb, offset, 8, ENC_BIG_ENDIAN);
825 offset += 8;
827 proto_tree_add_item(tree, hf_scsi_ssc_readposition_set_number, tvb, offset, 8, ENC_BIG_ENDIAN);
828 /*offset += 8;*/
829 } else {
830 /*offset += 16;*/
833 break;
835 case EXTENDED_FORM:
837 static int * const extended_form_flags[] = {
838 &hf_scsi_ssc_readposition_bop,
839 &hf_scsi_ssc_readposition_eop,
840 &hf_scsi_ssc_readposition_bcu,
841 &hf_scsi_ssc_readposition_bycu,
842 &hf_scsi_ssc_readposition_mpu,
843 &hf_scsi_ssc_readposition_bpu,
844 &hf_scsi_ssc_readposition_perr,
845 NULL
848 flags = tvb_get_uint8 (tvb, offset);
849 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_readposition_flags,
850 ett_scsi_ssc_readposition_flags, extended_form_flags, ENC_NA);
851 offset += 1;
853 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset, 1, ENC_BIG_ENDIAN);
854 offset += 1;
856 proto_tree_add_item(tree, hf_scsi_ssc_readposition_additional_length, tvb, offset, 2, ENC_BIG_ENDIAN);
857 offset += 2;
859 offset += 1; /* reserved */
861 if (!(flags & BCU)) {
862 proto_tree_add_item(tree, hf_scsi_ssc_readposition_num_blocks_buffer, tvb, offset, 3, ENC_BIG_ENDIAN);
864 offset += 3;
866 if (!(flags & BPU)) {
867 proto_tree_add_item(tree, hf_scsi_ssc_readposition_first_block_location, tvb, offset, 8, ENC_BIG_ENDIAN);
868 offset += 8;
870 proto_tree_add_item(tree, hf_scsi_ssc_readposition_last_block_location, tvb, offset, 8, ENC_BIG_ENDIAN);
871 offset += 8;
872 } else
873 offset += 16;
875 offset += 1; /* reserved */
877 if (!(flags & BYCU)) {
878 proto_tree_add_item(tree, hf_scsi_ssc_readposition_num_bytes_buffer, tvb, offset, 8, ENC_BIG_ENDIAN);
880 /*offset += 8;*/
882 break;
884 default:
885 break;
891 /* SSC Commands */
892 static const value_string scsi_ssc_vals[] = {
893 /* 0x00 */ {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"},
894 /* 0x01 */ {SCSI_SSC_REWIND , "Rewind"},
895 /* 0x03 */ {SCSI_SPC_REQSENSE , "Request Sense"},
896 /* 0x04 */ {SCSI_SSC_FORMAT_MEDIUM , "Format Medium"},
897 /* 0x05 */ {SCSI_SSC_READ_BLOCK_LIMITS , "Read Block Limits"},
898 /* 0x08 */ {SCSI_SSC_READ6 , "Read(6)"},
899 /* 0x0A */ {SCSI_SSC_WRITE6 , "Write(6)"},
900 /* 0x0B */ {SCSI_SSC_SET_CAPACITY , "Set Capacity"},
901 /* 0x0F */ {SCSI_SSC_READ_REVERSE_6 , "Read Reverse(6)"},
902 /* 0x10 */ {SCSI_SSC_WRITE_FILEMARKS_6 , "Write Filemarks(6)"},
903 /* 0x11 */ {SCSI_SSC_SPACE_6 , "Space(6)"},
904 /* 0x12 */ {SCSI_SPC_INQUIRY , "Inquiry"},
905 /* 0x13 */ {SCSI_SSC_VERIFY_6 , "Verify(6)"},
906 /* 0x14 */ {SCSI_SSC_RECOVER_BUFFERED_DATA , "Recover Buffered Data"},
907 /* 0x15 */ {SCSI_SPC_MODESELECT6 , "Mode Select(6)"},
908 /* 0x16 */ {SCSI_SPC_RESERVE6 , "Reserve(6)"},
909 /* 0x17 */ {SCSI_SPC_RELEASE6 , "Release(6)"},
910 /* 0x19 */ {SCSI_SSC_ERASE_6 , "Erase(6)"},
911 /* 0x1A */ {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"},
912 /* 0x1B */ {SCSI_SSC_LOAD_UNLOAD , "Load Unload"},
913 /* 0x1D */ {SCSI_SPC_SENDDIAG , "Send Diagnostic"},
914 /* 0x1E */ {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"},
915 /* 0x2B */ {SCSI_SSC_LOCATE_10 , "Locate(10)"},
916 /* 0x34 */ {SCSI_SSC_READ_POSITION , "Read Position"},
917 /* 0x3B */ {SCSI_SPC_WRITEBUFFER , "Write Buffer"},
918 /* 0x44 */ {SCSI_SSC_REPORT_DENSITY_SUPPORT , "Report Density Support"},
919 /* 0x4C */ {SCSI_SPC_LOGSELECT , "Log Select"},
920 /* 0x4D */ {SCSI_SPC_LOGSENSE , "Log Sense"},
921 /* 0x55 */ {SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
922 /* 0x5A */ {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"},
923 /* 0x5E */ {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"},
924 /* 0x5F */ {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"},
925 /* 0x80 */ {SCSI_SSC_WRITE_FILEMARKS_16 , "Write Filemarks(16)"},
926 /* 0x81 */ {SCSI_SSC_READ_REVERSE_16 , "Read Reverse(16)"},
927 /* 0x83 */ {SCSI_SPC_EXTCOPY , "Extended Copy"},
928 /* 0x88 */ {SCSI_SSC_READ_16 , "Read(16)"},
929 /* 0x8A */ {SCSI_SSC_WRITE_16 , "Write(16)"},
930 /* 0x8F */ {SCSI_SSC_VERIFY_16 , "Verify(16)"},
931 /* 0x91 */ {SCSI_SSC_SPACE_16 , "Space(16)"},
932 /* 0x92 */ {SCSI_SSC_LOCATE_16 , "Locate(16)"},
933 /* 0x93 */ {SCSI_SSC_ERASE_16 , "Erase(16)"},
934 /* 0xA0 */ {SCSI_SPC_REPORTLUNS , "Report LUNs"},
935 /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
936 /* 0xA5 */ {SCSI_SMC_MOVE_MEDIUM , "Move Medium"},
937 /* 0xA7 */ {SCSI_SMC_MOVE_MEDIUM_ATTACHED , "Move Medium Attached"},
938 /* 0xB4 */ {SCSI_SMC_READ_ELEMENT_STATUS_ATTACHED , "Read Element Status Attached"},
939 /* 0xB8 */ {SCSI_SMC_READ_ELEMENT_STATUS , "Read Element Status"},
940 {0, NULL}
942 value_string_ext scsi_ssc_vals_ext = VALUE_STRING_EXT_INIT(scsi_ssc_vals);
945 const scsi_cdb_table_t scsi_ssc_table[256] = {
946 /*SPC 0x00*/{dissect_spc_testunitready},
947 /*SSC 0x01*/{dissect_ssc_rewind},
948 /*SSC 0x02*/{NULL},
949 /*SPC 0x03*/{dissect_spc_requestsense},
950 /*SSC 0x04*/{dissect_ssc_formatmedium},
951 /*SSC 0x05*/{dissect_ssc_readblocklimits},
952 /*SSC 0x06*/{NULL},
953 /*SSC 0x07*/{NULL},
954 /*SSC 0x08*/{dissect_ssc_read6},
955 /*SSC 0x09*/{NULL},
956 /*SSC 0x0a*/{dissect_ssc_write6},
957 /*SSC 0x0b*/{dissect_ssc_setcapacity},
958 /*SSC 0x0c*/{NULL},
959 /*SSC 0x0d*/{NULL},
960 /*SSC 0x0e*/{NULL},
961 /*SSC 0x0f*/{dissect_ssc_readreverse6},
962 /*SSC 0x10*/{dissect_ssc_writefilemarks6},
963 /*SSC 0x11*/{dissect_ssc_space6},
964 /*SPC 0x12*/{dissect_spc_inquiry},
965 /*SSC 0x13*/{dissect_ssc_verify6},
966 /*SSC 0x14*/{dissect_ssc_recoverbuffereddata},
967 /*SPC 0x15*/{dissect_spc_modeselect6},
968 /*SSC 0x16*/{dissect_spc_reserve6},
969 /*SSC 0x17*/{dissect_spc_release6},
970 /*SSC 0x18*/{NULL},
971 /*SSC 0x19*/{dissect_ssc_erase6},
972 /*SPC 0x1a*/{dissect_spc_modesense6},
973 /*SSC 0x1b*/{dissect_ssc_loadunload},
974 /*SSC 0x1c*/{NULL},
975 /*SPC 0x1d*/{dissect_spc_senddiagnostic},
976 /*SSC 0x1e*/{dissect_spc_preventallowmediaremoval},
977 /*SSC 0x1f*/{NULL},
978 /*SSC 0x20*/{NULL},
979 /*SSC 0x21*/{NULL},
980 /*SSC 0x22*/{NULL},
981 /*SSC 0x23*/{NULL},
982 /*SSC 0x24*/{NULL},
983 /*SSC 0x25*/{NULL},
984 /*SSC 0x26*/{NULL},
985 /*SSC 0x27*/{NULL},
986 /*SSC 0x28*/{NULL},
987 /*SSC 0x29*/{NULL},
988 /*SSC 0x2a*/{NULL},
989 /*SSC 0x2b*/{dissect_ssc_locate10},
990 /*SSC 0x2c*/{NULL},
991 /*SSC 0x2d*/{NULL},
992 /*SSC 0x2e*/{NULL},
993 /*SSC 0x2f*/{NULL},
994 /*SSC 0x30*/{NULL},
995 /*SSC 0x31*/{NULL},
996 /*SSC 0x32*/{NULL},
997 /*SSC 0x33*/{NULL},
998 /*SSC 0x34*/{dissect_ssc_readposition},
999 /*SSC 0x35*/{NULL},
1000 /*SSC 0x36*/{NULL},
1001 /*SSC 0x37*/{NULL},
1002 /*SSC 0x38*/{NULL},
1003 /*SSC 0x39*/{NULL},
1004 /*SSC 0x3a*/{NULL},
1005 /*SPC 0x3b*/{dissect_spc_writebuffer},
1006 /*SSC 0x3c*/{NULL},
1007 /*SSC 0x3d*/{NULL},
1008 /*SSC 0x3e*/{NULL},
1009 /*SSC 0x3f*/{NULL},
1010 /*SSC 0x40*/{NULL},
1011 /*SSC 0x41*/{NULL},
1012 /*SSC 0x42*/{NULL},
1013 /*SSC 0x43*/{NULL},
1014 /*SSC 0x44*/{dissect_ssc_reportdensitysupport},
1015 /*SSC 0x45*/{NULL},
1016 /*SSC 0x46*/{NULL},
1017 /*SSC 0x47*/{NULL},
1018 /*SSC 0x48*/{NULL},
1019 /*SSC 0x49*/{NULL},
1020 /*SSC 0x4a*/{NULL},
1021 /*SSC 0x4b*/{NULL},
1022 /*SPC 0x4c*/{dissect_spc_logselect},
1023 /*SPC 0x4d*/{dissect_spc_logsense},
1024 /*SSC 0x4e*/{NULL},
1025 /*SSC 0x4f*/{NULL},
1026 /*SSC 0x50*/{NULL},
1027 /*SSC 0x51*/{NULL},
1028 /*SSC 0x52*/{NULL},
1029 /*SSC 0x53*/{NULL},
1030 /*SSC 0x54*/{NULL},
1031 /*SPC 0x55*/{dissect_spc_modeselect10},
1032 /*SSC 0x56*/{NULL},
1033 /*SSC 0x57*/{NULL},
1034 /*SSC 0x58*/{NULL},
1035 /*SSC 0x59*/{NULL},
1036 /*SPC 0x5a*/{dissect_spc_modesense10},
1037 /*SSC 0x5b*/{NULL},
1038 /*SSC 0x5c*/{NULL},
1039 /*SSC 0x5d*/{NULL},
1040 /*SPC 0x5e*/{dissect_spc_persistentreservein},
1041 /*SPC 0x5f*/{dissect_spc_persistentreserveout},
1042 /*SSC 0x60*/{NULL},
1043 /*SSC 0x61*/{NULL},
1044 /*SSC 0x62*/{NULL},
1045 /*SSC 0x63*/{NULL},
1046 /*SSC 0x64*/{NULL},
1047 /*SSC 0x65*/{NULL},
1048 /*SSC 0x66*/{NULL},
1049 /*SSC 0x67*/{NULL},
1050 /*SSC 0x68*/{NULL},
1051 /*SSC 0x69*/{NULL},
1052 /*SSC 0x6a*/{NULL},
1053 /*SSC 0x6b*/{NULL},
1054 /*SSC 0x6c*/{NULL},
1055 /*SSC 0x6d*/{NULL},
1056 /*SSC 0x6e*/{NULL},
1057 /*SSC 0x6f*/{NULL},
1058 /*SSC 0x70*/{NULL},
1059 /*SSC 0x71*/{NULL},
1060 /*SSC 0x72*/{NULL},
1061 /*SSC 0x73*/{NULL},
1062 /*SSC 0x74*/{NULL},
1063 /*SSC 0x75*/{NULL},
1064 /*SSC 0x76*/{NULL},
1065 /*SSC 0x77*/{NULL},
1066 /*SSC 0x78*/{NULL},
1067 /*SSC 0x79*/{NULL},
1068 /*SSC 0x7a*/{NULL},
1069 /*SSC 0x7b*/{NULL},
1070 /*SSC 0x7c*/{NULL},
1071 /*SSC 0x7d*/{NULL},
1072 /*SSC 0x7e*/{NULL},
1073 /*SSC 0x7f*/{NULL},
1074 /*SSC 0x80*/{dissect_ssc_writefilemarks16},
1075 /*SSC 0x81*/{dissect_ssc_readreverse16},
1076 /*SSC 0x82*/{NULL},
1077 /*SPC 0x83*/{dissect_spc_extcopy},
1078 /*SSC 0x84*/{NULL},
1079 /*SSC 0x85*/{NULL},
1080 /*SSC 0x86*/{NULL},
1081 /*SSC 0x87*/{NULL},
1082 /*SSC 0x88*/{dissect_ssc_read16},
1083 /*SSC 0x89*/{NULL},
1084 /*SSC 0x8a*/{dissect_ssc_write16},
1085 /*SSC 0x8b*/{NULL},
1086 /*SSC 0x8c*/{NULL},
1087 /*SSC 0x8d*/{NULL},
1088 /*SSC 0x8e*/{NULL},
1089 /*SSC 0x8f*/{dissect_ssc_verify16},
1090 /*SSC 0x90*/{NULL},
1091 /*SSC 0x91*/{dissect_ssc_space16},
1092 /*SSC 0x92*/{dissect_ssc_locate16},
1093 /*SSC 0x93*/{dissect_ssc_erase16},
1094 /*SSC 0x94*/{NULL},
1095 /*SSC 0x95*/{NULL},
1096 /*SSC 0x96*/{NULL},
1097 /*SSC 0x97*/{NULL},
1098 /*SSC 0x98*/{NULL},
1099 /*SSC 0x99*/{NULL},
1100 /*SSC 0x9a*/{NULL},
1101 /*SSC 0x9b*/{NULL},
1102 /*SSC 0x9c*/{NULL},
1103 /*SSC 0x9d*/{NULL},
1104 /*SSC 0x9e*/{NULL},
1105 /*SSC 0x9f*/{NULL},
1106 /*SPC 0xa0*/{dissect_spc_reportluns},
1107 /*SSC 0xa1*/{NULL},
1108 /*SSC 0xa2*/{NULL},
1109 /*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
1110 /*SSC 0xa4*/{NULL},
1111 /*SSC 0xa5*/{dissect_smc_movemedium},
1112 /*SSC 0xa6*/{NULL},
1113 /*SSC 0xa7*/{dissect_smc_movemedium},
1114 /*SSC 0xa8*/{NULL},
1115 /*SSC 0xa9*/{NULL},
1116 /*SSC 0xaa*/{NULL},
1117 /*SSC 0xab*/{NULL},
1118 /*SSC 0xac*/{NULL},
1119 /*SSC 0xad*/{NULL},
1120 /*SSC 0xae*/{NULL},
1121 /*SSC 0xaf*/{NULL},
1122 /*SSC 0xb0*/{NULL},
1123 /*SSC 0xb1*/{NULL},
1124 /*SSC 0xb2*/{NULL},
1125 /*SSC 0xb3*/{NULL},
1126 /*SSC 0xb4*/{dissect_smc_readelementstatus},
1127 /*SSC 0xb5*/{NULL},
1128 /*SSC 0xb6*/{NULL},
1129 /*SSC 0xb7*/{NULL},
1130 /*SSC 0xb8*/{dissect_smc_readelementstatus},
1131 /*SSC 0xb9*/{NULL},
1132 /*SSC 0xba*/{NULL},
1133 /*SSC 0xbb*/{NULL},
1134 /*SSC 0xbc*/{NULL},
1135 /*SSC 0xbd*/{NULL},
1136 /*SSC 0xbe*/{NULL},
1137 /*SSC 0xbf*/{NULL},
1138 /*SSC 0xc0*/{NULL},
1139 /*SSC 0xc1*/{NULL},
1140 /*SSC 0xc2*/{NULL},
1141 /*SSC 0xc3*/{NULL},
1142 /*SSC 0xc4*/{NULL},
1143 /*SSC 0xc5*/{NULL},
1144 /*SSC 0xc6*/{NULL},
1145 /*SSC 0xc7*/{NULL},
1146 /*SSC 0xc8*/{NULL},
1147 /*SSC 0xc9*/{NULL},
1148 /*SSC 0xca*/{NULL},
1149 /*SSC 0xcb*/{NULL},
1150 /*SSC 0xcc*/{NULL},
1151 /*SSC 0xcd*/{NULL},
1152 /*SSC 0xce*/{NULL},
1153 /*SSC 0xcf*/{NULL},
1154 /*SSC 0xd0*/{NULL},
1155 /*SSC 0xd1*/{NULL},
1156 /*SSC 0xd2*/{NULL},
1157 /*SSC 0xd3*/{NULL},
1158 /*SSC 0xd4*/{NULL},
1159 /*SSC 0xd5*/{NULL},
1160 /*SSC 0xd6*/{NULL},
1161 /*SSC 0xd7*/{NULL},
1162 /*SSC 0xd8*/{NULL},
1163 /*SSC 0xd9*/{NULL},
1164 /*SSC 0xda*/{NULL},
1165 /*SSC 0xdb*/{NULL},
1166 /*SSC 0xdc*/{NULL},
1167 /*SSC 0xdd*/{NULL},
1168 /*SSC 0xde*/{NULL},
1169 /*SSC 0xdf*/{NULL},
1170 /*SSC 0xe0*/{NULL},
1171 /*SSC 0xe1*/{NULL},
1172 /*SSC 0xe2*/{NULL},
1173 /*SSC 0xe3*/{NULL},
1174 /*SSC 0xe4*/{NULL},
1175 /*SSC 0xe5*/{NULL},
1176 /*SSC 0xe6*/{NULL},
1177 /*SSC 0xe7*/{NULL},
1178 /*SSC 0xe8*/{NULL},
1179 /*SSC 0xe9*/{NULL},
1180 /*SSC 0xea*/{NULL},
1181 /*SSC 0xeb*/{NULL},
1182 /*SSC 0xec*/{NULL},
1183 /*SSC 0xed*/{NULL},
1184 /*SSC 0xee*/{NULL},
1185 /*SSC 0xef*/{NULL},
1186 /*SSC 0xf0*/{NULL},
1187 /*SSC 0xf1*/{NULL},
1188 /*SSC 0xf2*/{NULL},
1189 /*SSC 0xf3*/{NULL},
1190 /*SSC 0xf4*/{NULL},
1191 /*SSC 0xf5*/{NULL},
1192 /*SSC 0xf6*/{NULL},
1193 /*SSC 0xf7*/{NULL},
1194 /*SSC 0xf8*/{NULL},
1195 /*SSC 0xf9*/{NULL},
1196 /*SSC 0xfa*/{NULL},
1197 /*SSC 0xfb*/{NULL},
1198 /*SSC 0xfc*/{NULL},
1199 /*SSC 0xfd*/{NULL},
1200 /*SSC 0xfe*/{NULL},
1201 /*SSC 0xff*/{NULL}
1206 void
1207 proto_register_scsi_ssc(void)
1209 static hf_register_info hf[] = {
1210 { &hf_scsi_ssc_opcode,
1211 {"SSC Opcode", "scsi_ssc.opcode", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
1212 &scsi_ssc_vals_ext, 0x0, NULL, HFILL}},
1213 { &hf_scsi_ssc_rdwr6_xferlen,
1214 {"Transfer Length", "scsi_ssc.rdwr6.xferlen", FT_UINT24, BASE_DEC, NULL, 0x0,
1215 NULL, HFILL}},
1216 { &hf_scsi_ssc_ver16_verlen,
1217 {"Verification Length", "scsi_ssc.verify16.verify_len", FT_UINT24, BASE_DEC, NULL, 0x0,
1218 NULL, HFILL}},
1219 { &hf_scsi_ssc_locate10_loid,
1220 {"Logical Object Identifier", "scsi_ssc.locate10.loid", FT_UINT32, BASE_DEC, NULL, 0x0,
1221 NULL, HFILL}},
1222 { &hf_scsi_ssc_locate16_loid,
1223 {"Logical Identifier", "scsi_ssc.locate16.loid", FT_UINT64, BASE_DEC, NULL, 0x0,
1224 NULL, HFILL}},
1225 { &hf_scsi_ssc_space6_count,
1226 {"Count", "scsi_ssc.space6.count", FT_INT24, BASE_DEC, NULL, 0x0,
1227 NULL, HFILL}},
1228 { &hf_scsi_ssc_space6_code,
1229 {"Code", "scsi_ssc.space6.code", FT_UINT8, BASE_HEX,
1230 VALS(space6_code_vals), 0x0f,
1231 NULL, HFILL}},
1232 { &hf_scsi_ssc_space16_count,
1233 {"Count", "scsi_ssc.space16.count", FT_UINT64, BASE_DEC, NULL, 0x0,
1234 NULL, HFILL}},
1235 { &hf_scsi_ssc_rdwr10_xferlen,
1236 {"Transfer Length", "scsi_ssc.rdwr10.xferlen", FT_UINT16, BASE_DEC, NULL,
1237 0x0, NULL, HFILL}},
1238 { &hf_scsi_ssc_erase_flags,
1239 {"Flags", "scsi_ssc.erase_flags", FT_UINT8, BASE_HEX,
1240 NULL, 0x0, NULL, HFILL}},
1241 { &hf_scsi_ssc_fcs,
1242 {"FCS", "scsi_ssc.fcs", FT_BOOLEAN, 8,
1243 NULL, 0x08, NULL, HFILL}},
1244 { &hf_scsi_ssc_lcs,
1245 {"LCS", "scsi_ssc.lcs", FT_BOOLEAN, 8,
1246 NULL, 0x04, NULL, HFILL}},
1247 { &hf_scsi_ssc_erase_immed,
1248 {"IMMED", "scsi_ssc.erase_immed", FT_BOOLEAN, 8,
1249 NULL, 0x02, NULL, HFILL}},
1250 { &hf_scsi_ssc_long,
1251 {"LONG", "scsi_ssc.long", FT_BOOLEAN, 8,
1252 NULL, 0x01, NULL, HFILL}},
1253 { &hf_scsi_ssc_partition,
1254 {"Partition", "scsi_ssc.partition", FT_UINT8, BASE_HEX,
1255 NULL, 0x0, NULL, HFILL}},
1256 { &hf_scsi_ssc_lbi,
1257 {"Logical Block Identifier", "scsi_ssc.lbi", FT_UINT64, BASE_HEX,
1258 NULL, 0x0, NULL, HFILL}},
1259 { &hf_scsi_ssc_verify,
1260 {"VERIFY", "scsi_ssc.verify", FT_BOOLEAN, 8,
1261 NULL, 0x02, NULL, HFILL}},
1262 { &hf_scsi_ssc_immed,
1263 {"IMMED", "scsi_ssc.immed", FT_BOOLEAN, 8,
1264 NULL, 0x01, NULL, HFILL}},
1265 { &hf_scsi_ssc_formatmedium_flags,
1266 {"Flags", "scsi_ssc.formatmedium_flags", FT_UINT8, BASE_HEX,
1267 NULL, 0x0, NULL, HFILL}},
1268 { &hf_scsi_ssc_format,
1269 {"Format", "scsi_ssc.format", FT_UINT8, BASE_HEX,
1270 VALS(format_vals), 0x0f, NULL, HFILL}},
1271 { &hf_scsi_ssc_loadunload_immed_flags,
1272 {"Immed", "scsi_ssc.loadunload_immed_flags", FT_UINT8, BASE_HEX,
1273 NULL, 0x0, NULL, HFILL}},
1274 { &hf_scsi_ssc_loadunload_flags,
1275 {"Flags", "scsi_ssc.loadunload_flags", FT_UINT8, BASE_HEX,
1276 NULL, 0x0, NULL, HFILL}},
1277 { &hf_scsi_ssc_hold,
1278 {"HOLD", "scsi_ssc.hold", FT_BOOLEAN, 8,
1279 NULL, 0x08, NULL, HFILL}},
1280 { &hf_scsi_ssc_eot,
1281 {"EOT", "scsi_ssc.eot", FT_BOOLEAN, 8,
1282 NULL, 0x04, NULL, HFILL}},
1283 { &hf_scsi_ssc_reten,
1284 {"RETEN", "scsi_ssc.reten", FT_BOOLEAN, 8,
1285 NULL, 0x02, NULL, HFILL}},
1286 { &hf_scsi_ssc_load,
1287 {"LOAD", "scsi_ssc.load", FT_BOOLEAN, 8,
1288 NULL, 0x01, NULL, HFILL}},
1289 { &hf_scsi_ssc_locate_flags,
1290 {"Flags", "scsi_ssc.locate_flags", FT_UINT8, BASE_HEX,
1291 NULL, 0x0, NULL, HFILL}},
1292 { &hf_scsi_ssc_bt,
1293 {"BT", "scsi_ssc.bt", FT_BOOLEAN, 8,
1294 NULL, 0x04, NULL, HFILL}},
1295 { &hf_scsi_ssc_cp,
1296 {"CP", "scsi_ssc.cp", FT_BOOLEAN, 8,
1297 NULL, 0x02, NULL, HFILL}},
1298 { &hf_scsi_ssc_dest_type,
1299 {"Dest Type", "scsi_ssc.dest_type", FT_UINT8, BASE_HEX,
1300 VALS(dest_type_vals), 0x18, NULL, HFILL}},
1301 { &hf_scsi_ssc_bam_flags,
1302 {"Flags", "scsi_ssc.bam_flags", FT_UINT8, BASE_HEX,
1303 NULL, 0x0, NULL, HFILL}},
1304 { &hf_scsi_ssc_bam,
1305 {"BAM", "scsi_ssc.bam", FT_BOOLEAN, 8,
1306 NULL, 0x01, NULL, HFILL}},
1307 { &hf_scsi_ssc_read6_flags,
1308 {"Flags", "scsi_ssc.read6_flags", FT_UINT8, BASE_HEX,
1309 NULL, 0x0, NULL, HFILL}},
1310 { &hf_scsi_ssc_sili,
1311 {"SILI", "scsi_ssc.sili", FT_BOOLEAN, 8,
1312 NULL, 0x02, NULL, HFILL}},
1313 { &hf_scsi_ssc_fixed,
1314 {"FIXED", "scsi_ssc.fixed", FT_BOOLEAN, 8,
1315 NULL, 0x01, NULL, HFILL}},
1316 { &hf_scsi_ssc_bytord,
1317 {"BYTORD", "scsi_ssc.bytord", FT_BOOLEAN, 8,
1318 NULL, 0x04, NULL, HFILL}},
1319 { &hf_scsi_ssc_bytcmp,
1320 {"BYTCMP", "scsi_ssc.bytcmp", FT_BOOLEAN, 8,
1321 NULL, 0x02, NULL, HFILL}},
1322 { &hf_scsi_ssc_verify16_immed,
1323 {"IMMED", "scsi_ssc.verify16_immed", FT_BOOLEAN, 8,
1324 NULL, 0x04, NULL, HFILL}},
1325 { &hf_scsi_ssc_medium_type,
1326 {"Medium Type", "scsi_ssc.medium_type", FT_BOOLEAN, 8,
1327 NULL, 0x02, NULL, HFILL}},
1328 { &hf_scsi_ssc_media,
1329 {"Media", "scsi_ssc.media", FT_BOOLEAN, 8,
1330 NULL, 0x01, NULL, HFILL}},
1331 { &hf_scsi_ssc_capacity_prop_value,
1332 {"Capacity Proportion Value", "scsi_ssc.cpv", FT_UINT16, BASE_DEC,
1333 NULL, 0, NULL, HFILL}},
1334 /* Generated from convert_proto_tree_add_text.pl */
1335 { &hf_scsi_ssc_readblocklimits_granularity, { "Granularity", "scsi_ssc.readblocklimits.granularity", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, NULL, HFILL }},
1336 { &hf_scsi_ssc_readblocklimits_max_block_length_limit, { "Maximum Block Length Limit", "scsi_ssc.readblocklimits.max_block_length_limit", FT_UINT24, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, NULL, HFILL }},
1337 { &hf_scsi_ssc_readblocklimits_min_block_length_limit, { "Minimum Block Length Limit", "scsi_ssc.readblocklimits.min_block_length_limit", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, NULL, HFILL }},
1338 { &hf_scsi_ssc_erase6_immed, { "IMMED", "scsi_ssc.erase6.immed", FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }},
1339 { &hf_scsi_ssc_erase6_long, { "LONG", "scsi_ssc.erase6.long", FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
1340 { &hf_scsi_ssc_space16_parameter_len, { "Parameter Len", "scsi_ssc.space16.parameter_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1341 { &hf_scsi_ssc_readposition_service_action, { "Service Action", "scsi_ssc.readposition.service_action", FT_UINT8, BASE_DEC, VALS(service_action_vals), 0x1F, NULL, HFILL }},
1342 { &hf_scsi_ssc_readposition_parameter_len, { "Parameter Len", "scsi_ssc.readposition.parameter_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1343 { &hf_scsi_ssc_readposition_flags, { "Flags", "scsi_ssc.readposition.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1344 { &hf_scsi_ssc_readposition_bop, { "BOP", "scsi_ssc.readposition.bop", FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL }},
1345 { &hf_scsi_ssc_readposition_eop, { "EOP", "scsi_ssc.readposition.eop", FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL }},
1346 { &hf_scsi_ssc_readposition_mpu, { "EOP", "scsi_ssc.readposition.mpu", FT_UINT8, BASE_DEC, NULL, MPU, NULL, HFILL }},
1347 { &hf_scsi_ssc_readposition_bcu, { "BCU", "scsi_ssc.readposition.bcu", FT_UINT8, BASE_DEC, NULL, BCU, NULL, HFILL }},
1348 { &hf_scsi_ssc_readposition_bycu, { "BYCU", "scsi_ssc.readposition.bycu", FT_UINT8, BASE_DEC, NULL, BYCU, NULL, HFILL }},
1349 { &hf_scsi_ssc_readposition_bpu, { "BPU", "scsi_ssc.readposition.bpu", FT_UINT8, BASE_DEC, NULL, BPU, NULL, HFILL }},
1350 { &hf_scsi_ssc_readposition_perr, { "PERR", "scsi_ssc.readposition.perr", FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }},
1351 { &hf_scsi_ssc_readposition_first_block_location, { "First Block Location", "scsi_ssc.readposition.first_block_location", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1352 { &hf_scsi_ssc_readposition_last_block_location, { "Last Block Location", "scsi_ssc.readposition.last_block_location", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1353 { &hf_scsi_ssc_readposition_num_blocks_buffer, { "Number of Blocks in Buffer", "scsi_ssc.readposition.num_blocks_buffer", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1354 { &hf_scsi_ssc_readposition_num_bytes_buffer, { "Number of Bytes in Buffer", "scsi_ssc.readposition.num_bytes_buffer", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1355 { &hf_scsi_ssc_readposition_partition_number, { "Partition Number", "scsi_ssc.readposition.partition_number", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1356 { &hf_scsi_ssc_readposition_block_number, { "Block Number", "scsi_ssc.readposition.block_number", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1357 { &hf_scsi_ssc_readposition_file_number, { "File Number", "scsi_ssc.readposition.file_number", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1358 { &hf_scsi_ssc_readposition_set_number, { "Set Number", "scsi_ssc.readposition.set_number", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1359 { &hf_scsi_ssc_readposition_additional_length, { "Additional Length", "scsi_ssc.readposition.additional_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1363 /* Setup protocol subtree array */
1364 static int *ett[] = {
1365 &ett_scsi_erase,
1366 &ett_scsi_formatmedium,
1367 &ett_scsi_loadunload_immed,
1368 &ett_scsi_loadunload,
1369 &ett_scsi_locate,
1370 &ett_scsi_bam,
1371 &ett_scsi_read6,
1372 &ett_scsi_ssc_readposition_flags
1376 /* Register the protocol name and description */
1377 proto_scsi_ssc = proto_register_protocol("SCSI_SSC", "SCSI_SSC", "scsi_ssc");
1379 /* Required function calls to register the header fields and subtrees used */
1380 proto_register_field_array(proto_scsi_ssc, hf, array_length(hf));
1382 proto_register_subtree_array(ett, array_length(ett));
1387 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1389 * Local variables:
1390 * c-basic-offset: 4
1391 * tab-width: 8
1392 * indent-tabs-mode: nil
1393 * End:
1395 * vi: set shiftwidth=4 tabstop=8 expandtab:
1396 * :indentSize=4:tabSize=8:noTabs=true: