HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-scsi-ssc.c
blob75c7d36f0a7f17e1c3e8023c078734080734b500
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 * $Id$
15 * Wireshark - Network traffic analyzer
16 * By Gerald Combs <gerald@wireshark.org>
17 * Copyright 2002 Gerald Combs
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 #include "config.h"
36 #include <glib.h>
37 #include <epan/packet.h>
38 #include <epan/conversation.h>
39 #include <epan/tap.h>
40 #include "packet-scsi.h"
41 #include "packet-fc.h"
42 #include "packet-scsi-ssc.h"
43 #include "packet-scsi-smc.h"
46 static int proto_scsi_ssc = -1;
47 int hf_scsi_ssc_opcode = -1;
48 static int hf_scsi_ssc_rdwr6_xferlen = -1;
49 static int hf_scsi_ssc_ver16_verlen = -1;
50 static int hf_scsi_ssc_locate10_loid = -1;
51 static int hf_scsi_ssc_locate16_loid = -1;
52 static int hf_scsi_ssc_space6_code = -1;
53 static int hf_scsi_ssc_space6_count = -1;
54 static int hf_scsi_ssc_space16_count = -1;
55 static int hf_scsi_ssc_erase_flags = -1;
56 static int hf_scsi_ssc_fcs = -1;
57 static int hf_scsi_ssc_lcs = -1;
58 static int hf_scsi_ssc_erase_immed = -1;
59 static int hf_scsi_ssc_long = -1;
60 static int hf_scsi_ssc_partition = -1;
61 static int hf_scsi_ssc_lbi = -1;
62 static int hf_scsi_ssc_verify = -1;
63 static int hf_scsi_ssc_immed = -1;
64 static int hf_scsi_ssc_formatmedium_flags = -1;
65 static int hf_scsi_ssc_format = -1;
66 static int hf_scsi_ssc_rdwr10_xferlen = -1;
67 static int hf_scsi_ssc_loadunload_immed_flags = -1;
68 static int hf_scsi_ssc_loadunload_flags = -1;
69 static int hf_scsi_ssc_hold = -1;
70 static int hf_scsi_ssc_eot = -1;
71 static int hf_scsi_ssc_reten = -1;
72 static int hf_scsi_ssc_load = -1;
73 static int hf_scsi_ssc_locate_flags = -1;
74 static int hf_scsi_ssc_bt = -1;
75 static int hf_scsi_ssc_cp = -1;
76 static int hf_scsi_ssc_dest_type = -1;
77 static int hf_scsi_ssc_bam_flags = -1;
78 static int hf_scsi_ssc_bam = -1;
79 static int hf_scsi_ssc_read6_flags = -1;
80 static int hf_scsi_ssc_sili = -1;
81 static int hf_scsi_ssc_fixed = -1;
82 static int hf_scsi_ssc_bytord = -1;
83 static int hf_scsi_ssc_bytcmp = -1;
84 static int hf_scsi_ssc_verify16_immed = -1;
85 static int hf_scsi_ssc_medium_type = -1;
86 static int hf_scsi_ssc_media = -1;
87 static int hf_scsi_ssc_capacity_prop_value = -1;
89 static gint ett_scsi_erase = -1;
90 static gint ett_scsi_formatmedium = -1;
91 static gint ett_scsi_loadunload_immed = -1;
92 static gint ett_scsi_loadunload = -1;
93 static gint ett_scsi_locate = -1;
94 static gint ett_scsi_bam = -1;
95 static gint ett_scsi_read6 = -1;
98 static void
99 dissect_ssc_read6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
100 guint offset, gboolean isreq, gboolean iscdb,
101 guint payload_len _U_, scsi_task_data_t *cdata _U_)
103 static const int *read6_fields[] = {
104 &hf_scsi_ssc_sili,
105 &hf_scsi_ssc_fixed,
106 NULL
109 if (isreq) {
110 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
111 tvb_get_ntoh24 (tvb, offset+1));
114 if (tree && isreq && iscdb) {
115 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
116 ett_scsi_read6, read6_fields, ENC_BIG_ENDIAN);
117 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
118 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
119 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
123 static void
124 dissect_ssc_recoverbuffereddata (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
125 guint offset, gboolean isreq, gboolean iscdb,
126 guint payload_len _U_, scsi_task_data_t *cdata _U_)
128 static const int *recover_fields[] = {
129 &hf_scsi_ssc_sili,
130 &hf_scsi_ssc_fixed,
131 NULL
134 if (isreq) {
135 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
136 tvb_get_ntoh24 (tvb, offset+1));
139 if (tree && isreq && iscdb) {
140 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
141 ett_scsi_read6, recover_fields, ENC_BIG_ENDIAN);
142 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
143 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
144 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
148 static void
149 dissect_ssc_reportdensitysupport (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
150 guint offset, gboolean isreq, gboolean iscdb,
151 guint payload_len _U_, scsi_task_data_t *cdata _U_)
153 static const int *rd_fields[] = {
154 &hf_scsi_ssc_medium_type,
155 &hf_scsi_ssc_media,
156 NULL
159 if (isreq) {
160 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
161 tvb_get_ntoh24 (tvb, offset+1));
164 if(!tree)
165 return;
167 if (isreq && iscdb) {
168 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
169 ett_scsi_read6, rd_fields, ENC_BIG_ENDIAN);
170 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+6, 2, ENC_BIG_ENDIAN);
171 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
172 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
173 } else {
174 /* XXX decode the data */
178 static void
179 dissect_ssc_readreverse6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
180 guint offset, gboolean isreq, gboolean iscdb,
181 guint payload_len _U_, scsi_task_data_t *cdata _U_)
183 static const int *rr6_fields[] = {
184 &hf_scsi_ssc_bytord,
185 &hf_scsi_ssc_sili,
186 &hf_scsi_ssc_fixed,
187 NULL
190 if (isreq) {
191 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
192 tvb_get_ntoh24 (tvb, offset+1));
195 if (tree && isreq && iscdb) {
196 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
197 ett_scsi_read6, rr6_fields, ENC_BIG_ENDIAN);
198 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
199 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
200 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
204 static void
205 dissect_ssc_read16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
206 guint offset, gboolean isreq, gboolean iscdb,
207 guint payload_len _U_, scsi_task_data_t *cdata _U_)
209 static const int *read6_fields[] = {
210 &hf_scsi_ssc_sili,
211 &hf_scsi_ssc_fixed,
212 NULL
215 if (isreq) {
216 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
217 tvb_get_ntoh24 (tvb, offset+1));
220 if (tree && isreq && iscdb) {
221 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
222 ett_scsi_read6, read6_fields, ENC_BIG_ENDIAN);
223 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
224 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
225 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
226 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
227 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
231 static void
232 dissect_ssc_write16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
233 guint offset, gboolean isreq, gboolean iscdb,
234 guint payload_len _U_, scsi_task_data_t *cdata _U_)
236 static const int *write16_fields[] = {
237 &hf_scsi_ssc_fcs,
238 &hf_scsi_ssc_lcs,
239 &hf_scsi_ssc_fixed,
240 NULL
243 if (isreq) {
244 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
245 tvb_get_ntoh24 (tvb, offset+1));
248 if (tree && isreq && iscdb) {
249 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
250 ett_scsi_read6, write16_fields, ENC_BIG_ENDIAN);
251 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
252 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
253 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
254 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
255 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
259 static void
260 dissect_ssc_writefilemarks16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
261 guint offset, gboolean isreq, gboolean iscdb,
262 guint payload_len _U_, scsi_task_data_t *cdata _U_)
264 static const int *wf16_fields[] = {
265 &hf_scsi_ssc_fcs,
266 &hf_scsi_ssc_lcs,
267 &hf_scsi_ssc_immed,
268 NULL
271 if (isreq) {
272 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
273 tvb_get_ntoh24 (tvb, offset+1));
276 if (tree && isreq && iscdb) {
277 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
278 ett_scsi_read6, wf16_fields, ENC_BIG_ENDIAN);
279 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
280 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
281 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
282 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
283 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
287 static void
288 dissect_ssc_verify16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
289 guint offset, gboolean isreq, gboolean iscdb,
290 guint payload_len _U_, scsi_task_data_t *cdata _U_)
292 static const int *verify16_fields[] = {
293 &hf_scsi_ssc_verify16_immed,
294 &hf_scsi_ssc_bytcmp,
295 &hf_scsi_ssc_fixed,
296 NULL
299 if (isreq) {
300 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
301 tvb_get_ntoh24 (tvb, offset+1));
304 if (tree && isreq && iscdb) {
305 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
306 ett_scsi_read6, verify16_fields, ENC_BIG_ENDIAN);
307 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
308 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
309 proto_tree_add_item (tree, hf_scsi_ssc_ver16_verlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
310 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
311 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
315 static void
316 dissect_ssc_verify6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
317 guint offset, gboolean isreq, gboolean iscdb,
318 guint payload_len _U_, scsi_task_data_t *cdata _U_)
320 static const int *verify6_fields[] = {
321 &hf_scsi_ssc_verify16_immed,
322 &hf_scsi_ssc_bytcmp,
323 &hf_scsi_ssc_fixed,
324 NULL
327 if (isreq) {
328 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
329 tvb_get_ntoh24 (tvb, offset+1));
332 if (tree && isreq && iscdb) {
333 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
334 ett_scsi_read6, verify6_fields, ENC_BIG_ENDIAN);
335 proto_tree_add_item (tree, hf_scsi_ssc_ver16_verlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
336 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
337 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
341 static void
342 dissect_ssc_readreverse16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
343 guint offset, gboolean isreq, gboolean iscdb,
344 guint payload_len _U_, scsi_task_data_t *cdata _U_)
346 static const int *rr16_fields[] = {
347 &hf_scsi_ssc_bytord,
348 &hf_scsi_ssc_sili,
349 &hf_scsi_ssc_fixed,
350 NULL
353 if (isreq) {
354 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
355 tvb_get_ntoh24 (tvb, offset+1));
358 if (tree && isreq && iscdb) {
359 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
360 ett_scsi_read6, rr16_fields, ENC_BIG_ENDIAN);
361 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
362 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
363 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+11, 3, ENC_BIG_ENDIAN);
364 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
365 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
369 static void
370 dissect_ssc_write6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
371 guint offset, gboolean isreq, gboolean iscdb,
372 guint payload_len _U_, scsi_task_data_t *cdata _U_)
374 static const int *write6_fields[] = {
375 &hf_scsi_ssc_immed,
376 NULL
379 if (isreq && iscdb) {
380 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
381 tvb_get_ntoh24 (tvb, offset+1));
384 if (tree && isreq && iscdb) {
385 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
386 ett_scsi_read6, write6_fields, ENC_BIG_ENDIAN);
387 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
388 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
389 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
393 static void
394 dissect_ssc_writefilemarks6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
395 guint offset, gboolean isreq, gboolean iscdb,
396 guint payload_len _U_, scsi_task_data_t *cdata _U_)
398 static const int *wf6_fields[] = {
399 &hf_scsi_ssc_immed,
400 NULL
403 if (isreq) {
404 col_append_fstr (pinfo->cinfo, COL_INFO, "(Len: %u)",
405 tvb_get_ntoh24 (tvb, offset+1));
408 if (tree && isreq && iscdb) {
409 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
410 ett_scsi_read6, wf6_fields, ENC_BIG_ENDIAN);
411 proto_tree_add_item (tree, hf_scsi_ssc_rdwr6_xferlen, tvb, offset+1, 3, ENC_BIG_ENDIAN);
412 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
413 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
417 static void
418 dissect_ssc_loadunload (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
419 guint offset, gboolean isreq, gboolean iscdb,
420 guint payload_len _U_, scsi_task_data_t *cdata _U_)
422 static const int *loadunload_immed_fields[] = {
423 &hf_scsi_ssc_immed,
424 NULL
426 static const int *loadunload_fields[] = {
427 &hf_scsi_ssc_hold,
428 &hf_scsi_ssc_eot,
429 &hf_scsi_ssc_reten,
430 &hf_scsi_ssc_load,
431 NULL
434 if (isreq && iscdb) {
435 col_append_fstr (pinfo->cinfo, COL_INFO, "(Immed: %u)",
436 tvb_get_guint8 (tvb, offset) & 0x01);
439 if (!tree)
440 return;
443 if (isreq && iscdb) {
444 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_loadunload_immed_flags,
445 ett_scsi_loadunload_immed, loadunload_immed_fields, ENC_BIG_ENDIAN);
446 proto_tree_add_bitmask(tree, tvb, offset+3, hf_scsi_ssc_loadunload_flags,
447 ett_scsi_loadunload, loadunload_fields, ENC_BIG_ENDIAN);
448 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
449 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
454 static void
455 dissect_ssc_readblocklimits (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
456 guint offset, gboolean isreq, gboolean iscdb,
457 guint payload_len _U_, scsi_task_data_t *cdata _U_)
459 guint8 granularity;
461 if (!tree)
462 return;
464 if (isreq && iscdb) {
465 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
466 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
468 else if (!iscdb) {
469 granularity = tvb_get_guint8 (tvb, offset);
470 proto_tree_add_text (tree, tvb, offset, 1, "Granularity: %u (%u %s)",
471 granularity, 1 << granularity,
472 plurality(1 << granularity, "byte", "bytes"));
473 proto_tree_add_text (tree, tvb, offset+1, 3, "Maximum Block Length Limit: %u bytes",
474 tvb_get_ntoh24 (tvb, offset+1));
475 proto_tree_add_text (tree, tvb, offset+4, 2, "Minimum Block Length Limit: %u bytes",
476 tvb_get_ntohs (tvb, offset+4));
480 static void
481 dissect_ssc_rewind (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
482 guint offset, gboolean isreq, gboolean iscdb,
483 guint payload_len _U_, scsi_task_data_t *cdata _U_)
485 static const int *rewind_fields[] = {
486 &hf_scsi_ssc_immed,
487 NULL
490 if (!tree)
491 return;
493 if (isreq && iscdb) {
494 col_append_fstr (pinfo->cinfo, COL_INFO, "(Immed: %u)",
495 tvb_get_guint8 (tvb, offset) & 0x01);
497 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags, ett_scsi_read6, rewind_fields, ENC_BIG_ENDIAN);
498 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
499 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
503 static void
504 dissect_ssc_setcapacity (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
505 guint offset, gboolean isreq, gboolean iscdb,
506 guint payload_len _U_, scsi_task_data_t *cdata _U_)
508 static const int *sc_fields[] = {
509 &hf_scsi_ssc_immed,
510 NULL
513 if (!tree)
514 return;
516 if (isreq && iscdb) {
517 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_read6_flags,
518 ett_scsi_read6, sc_fields, ENC_BIG_ENDIAN);
519 proto_tree_add_item (tree, hf_scsi_ssc_capacity_prop_value, tvb, offset+2, 2, ENC_BIG_ENDIAN);
520 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
521 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
526 static void
527 dissect_ssc_locate10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
528 guint offset, gboolean isreq, gboolean iscdb,
529 guint payload_len _U_, scsi_task_data_t *cdata _U_)
531 static const int *locate_fields[] = {
532 &hf_scsi_ssc_bt,
533 &hf_scsi_ssc_cp,
534 &hf_scsi_ssc_immed,
535 NULL
538 if (!tree)
539 return;
541 if (isreq && iscdb) {
542 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_locate_flags,
543 ett_scsi_locate, locate_fields, ENC_BIG_ENDIAN);
544 proto_tree_add_item (tree, hf_scsi_ssc_locate10_loid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
545 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+7, 1, ENC_BIG_ENDIAN);
546 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
547 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
552 static void
553 dissect_ssc_locate16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
554 guint offset, gboolean isreq, gboolean iscdb,
555 guint payload_len _U_, scsi_task_data_t *cdata _U_)
557 static const int *locate_fields[] = {
558 &hf_scsi_ssc_dest_type,
559 &hf_scsi_ssc_cp,
560 &hf_scsi_ssc_immed,
561 NULL
563 static const int *bam_fields[] = {
564 &hf_scsi_ssc_bam,
565 NULL
568 if (!tree)
569 return;
571 if (isreq && iscdb) {
572 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_locate_flags,
573 ett_scsi_locate, locate_fields, ENC_BIG_ENDIAN);
574 proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_ssc_bam_flags,
575 ett_scsi_bam, bam_fields, ENC_BIG_ENDIAN);
576 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
577 proto_tree_add_item (tree, hf_scsi_ssc_locate16_loid, tvb, offset+3, 8, ENC_BIG_ENDIAN);
578 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
579 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
584 static void
585 dissect_ssc_erase6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
586 guint offset, gboolean isreq, gboolean iscdb,
587 guint payload_len _U_, scsi_task_data_t *cdata _U_)
589 guint8 flags;
591 if (isreq && iscdb) {
592 if (!tree)
593 return;
595 flags = tvb_get_guint8 (tvb, offset);
596 proto_tree_add_text (tree, tvb, offset, 1,
597 "IMMED: %u, LONG: %u",
598 (flags & 0x02) >> 1,
599 flags & 0x01);
601 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
602 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
607 static void
608 dissect_ssc_erase16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
609 guint offset, gboolean isreq, gboolean iscdb,
610 guint payload_len _U_, scsi_task_data_t *cdata _U_)
612 static const int *erase16_fields[] = {
613 &hf_scsi_ssc_fcs,
614 &hf_scsi_ssc_lcs,
615 &hf_scsi_ssc_erase_immed,
616 &hf_scsi_ssc_long,
617 NULL
620 if (!tree)
621 return;
623 if (isreq && iscdb) {
624 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_erase_flags,
625 ett_scsi_erase, erase16_fields, ENC_BIG_ENDIAN);
626 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset+2, 1, ENC_BIG_ENDIAN);
627 proto_tree_add_item (tree, hf_scsi_ssc_lbi, tvb, offset+3, 8, ENC_BIG_ENDIAN);
628 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
629 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
633 static void
634 dissect_ssc_space6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
635 guint offset, gboolean isreq, gboolean iscdb,
636 guint payload_len _U_, scsi_task_data_t *cdata _U_)
638 if (!tree)
639 return;
641 if (isreq && iscdb) {
642 proto_tree_add_item (tree, hf_scsi_ssc_space6_code, tvb, offset, 1, ENC_BIG_ENDIAN);
643 proto_tree_add_item (tree, hf_scsi_ssc_space6_count, tvb, offset+1, 3, ENC_BIG_ENDIAN);
644 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
645 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
649 static void
650 dissect_ssc_space16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
651 guint offset, gboolean isreq, gboolean iscdb,
652 guint payload_len _U_, scsi_task_data_t *cdata _U_)
654 if (!tree)
655 return;
657 if (isreq && iscdb) {
658 proto_tree_add_item (tree, hf_scsi_ssc_space6_code, tvb, offset, 1, ENC_BIG_ENDIAN);
659 proto_tree_add_item (tree, hf_scsi_ssc_space16_count, tvb, offset+3, 8, ENC_BIG_ENDIAN);
660 proto_tree_add_text (tree, tvb, offset+11, 2,
661 "Parameter Len: %u",
662 tvb_get_ntohs (tvb, offset+11));
663 proto_tree_add_bitmask(tree, tvb, offset+14, hf_scsi_control,
664 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
668 static const value_string space6_code_vals[] = {
669 {0, "Logical Blocks"},
670 {1, "Filemarks"},
671 {2, "Sequential Filemarks"},
672 {3, "End-Of-Data"},
673 {0, NULL}
676 static const value_string format_vals[] = {
677 {0x0, "Use default format"},
678 {0x1, "Partition medium"},
679 {0x2, "Default format then partition"},
680 {0, NULL}
683 static const value_string dest_type_vals[] = {
684 {0, "Logical Object Identifier"},
685 {1, "Logical File Identifier"},
686 {0, NULL}
689 static void
690 dissect_ssc_formatmedium (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
691 guint offset, gboolean isreq, gboolean iscdb,
692 guint payload_len _U_, scsi_task_data_t *cdata _U_)
694 static const int *formatmedium_fields[] = {
695 &hf_scsi_ssc_verify,
696 &hf_scsi_ssc_immed,
697 NULL
700 if (!tree)
701 return;
703 if (isreq && iscdb) {
704 proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_ssc_formatmedium_flags,
705 ett_scsi_formatmedium, formatmedium_fields, ENC_BIG_ENDIAN);
706 proto_tree_add_item (tree, hf_scsi_ssc_format, tvb, offset+1, 1, ENC_BIG_ENDIAN);
707 proto_tree_add_item (tree, hf_scsi_ssc_rdwr10_xferlen, tvb, offset+2, 2, ENC_BIG_ENDIAN);
708 proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control,
709 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
714 #define BCU 0x20
715 #define BYCU 0x10
716 #define MPU 0x08
717 #define BPU 0x04
719 static void
720 dissect_ssc_readposition (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
721 guint offset, gboolean isreq, gboolean iscdb,
722 guint payload_len _U_, scsi_task_data_t *cdata)
724 gint service_action;
725 guint8 flags;
727 if (!tree)
728 return;
730 if (isreq && iscdb) {
731 service_action = tvb_get_guint8 (tvb, offset) & 0x1F;
732 proto_tree_add_text (tree, tvb, offset, 1,
733 "Service Action: %s",
734 val_to_str (service_action,
735 service_action_vals,
736 "Unknown (0x%02x)"));
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_text (tree, tvb, offset+6, 2,
742 "Parameter Len: %u",
743 tvb_get_ntohs (tvb, offset+6));
744 proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control,
745 ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
747 else if (!isreq) {
748 if (cdata)
749 service_action = cdata->itlq->flags;
750 else
751 service_action = -1; /* unknown */
752 switch (service_action) {
753 case SHORT_FORM_BLOCK_ID:
754 case SHORT_FORM_VENDOR_SPECIFIC:
755 flags = tvb_get_guint8 (tvb, offset);
756 proto_tree_add_text (tree, tvb, offset, 1,
757 "BOP: %u, EOP: %u, BCU: %u, BYCU: %u, BPU: %u, PERR: %u",
758 (flags & 0x80) >> 7, (flags & 0x40) >> 6,
759 (flags & BCU) >> 5, (flags & BYCU) >> 4,
760 (flags & BPU) >> 2, (flags & 0x02) >> 1);
761 offset += 1;
763 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset, 1, ENC_BIG_ENDIAN);
764 offset += 1;
766 offset += 2; /* reserved */
768 if (!(flags & BPU)) {
769 proto_tree_add_text (tree, tvb, offset, 4,
770 "First Block Location: %u",
771 tvb_get_ntohl (tvb, offset));
772 offset += 4;
774 proto_tree_add_text (tree, tvb, offset, 4,
775 "Last Block Location: %u",
776 tvb_get_ntohl (tvb, offset));
777 offset += 4;
778 } else
779 offset += 8;
781 offset += 1; /* reserved */
783 if (!(flags & BCU)) {
784 proto_tree_add_text (tree, tvb, offset, 3,
785 "Number of Blocks in Buffer: %u",
786 tvb_get_ntoh24 (tvb, offset));
788 offset += 3;
790 if (!(flags & BYCU)) {
791 proto_tree_add_text (tree, tvb, offset, 4,
792 "Number of Bytes in Buffer: %u",
793 tvb_get_ntohl (tvb, offset));
795 /*offset += 4;*/
796 break;
798 case LONG_FORM:
799 flags = tvb_get_guint8 (tvb, offset);
800 proto_tree_add_text (tree, tvb, offset, 1,
801 "BOP: %u, EOP: %u, MPU: %u, BPU: %u",
802 (flags & 0x80) >> 7, (flags & 0x40) >> 6,
803 (flags & MPU) >> 3, (flags & BPU) >> 2);
804 offset += 1;
806 offset += 3; /* reserved */
808 if (!(flags & BPU)) {
809 proto_tree_add_text (tree, tvb, offset, 4,
810 "Partition Number: %u",
811 tvb_get_ntohl (tvb, offset));
812 offset += 4;
814 proto_tree_add_text (tree, tvb, offset, 8,
815 "Block Number: %" G_GINT64_MODIFIER "u",
816 tvb_get_ntoh64 (tvb, offset));
817 offset += 8;
818 } else
819 offset += 12;
821 if (!(flags & MPU)) {
822 proto_tree_add_text (tree, tvb, offset, 8,
823 "File Number: %" G_GINT64_MODIFIER "u",
824 tvb_get_ntoh64 (tvb, offset));
825 offset += 8;
827 proto_tree_add_text (tree, tvb, offset, 8,
828 "Set Number: %" G_GINT64_MODIFIER "u",
829 tvb_get_ntoh64 (tvb, offset));
830 /*offset += 8;*/
831 } else
832 /*offset += 16;*/
833 break;
835 case EXTENDED_FORM:
836 flags = tvb_get_guint8 (tvb, offset);
837 proto_tree_add_text (tree, tvb, offset, 1,
838 "BOP: %u, EOP: %u, BCU: %u, BYCU: %u, MPU: %u, BPU: %u, PERR: %u",
839 (flags & 0x80) >> 7, (flags & 0x40) >> 6,
840 (flags & BCU) >> 5, (flags & BYCU) >> 4,
841 (flags & MPU) >> 3, (flags & BPU) >> 2,
842 (flags & 0x02) >> 1);
843 offset += 1;
845 proto_tree_add_item (tree, hf_scsi_ssc_partition, tvb, offset, 1, ENC_BIG_ENDIAN);
846 offset += 1;
848 proto_tree_add_text (tree, tvb, offset, 2,
849 "Additional Length: %u",
850 tvb_get_ntohs (tvb, offset));
851 offset += 2;
853 offset += 1; /* reserved */
855 if (!(flags & BCU)) {
856 proto_tree_add_text (tree, tvb, offset, 3,
857 "Number of Blocks in Buffer: %u",
858 tvb_get_ntoh24 (tvb, offset));
860 offset += 3;
862 if (!(flags & BPU)) {
863 proto_tree_add_text (tree, tvb, offset, 8,
864 "First Block Location: %" G_GINT64_MODIFIER "u",
865 tvb_get_ntoh64 (tvb, offset));
866 offset += 8;
868 proto_tree_add_text (tree, tvb, offset, 8,
869 "Last Block Location: %" G_GINT64_MODIFIER "u",
870 tvb_get_ntoh64 (tvb, offset));
871 offset += 8;
872 } else
873 offset += 16;
875 offset += 1; /* reserved */
877 if (!(flags & BYCU)) {
878 proto_tree_add_text (tree, tvb, offset, 8,
879 "Number of Bytes in Buffer: %" G_GINT64_MODIFIER "u",
880 tvb_get_ntoh64 (tvb, offset));
882 /*offset += 8;*/
883 break;
885 default:
886 break;
895 /* SSC Commands */
896 const value_string scsi_ssc_vals[] = {
897 {SCSI_SSC_ERASE_6 , "Erase(6)"},
898 {SCSI_SSC_ERASE_16 , "Erase(16)"},
899 {SCSI_SPC_EXTCOPY , "Extended Copy"},
900 {SCSI_SSC_FORMAT_MEDIUM , "Format Medium"},
901 {SCSI_SPC_INQUIRY , "Inquiry"},
902 {SCSI_SSC_LOAD_UNLOAD , "Load Unload"},
903 {SCSI_SSC_LOCATE_10 , "Locate(10)"},
904 {SCSI_SSC_LOCATE_16 , "Locate(16)"},
905 {SCSI_SPC_LOGSELECT , "Log Select"},
906 {SCSI_SPC_LOGSENSE , "Log Sense"},
907 {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
908 {SCSI_SPC_MODESELECT6 , "Mode Select(6)"},
909 {SCSI_SPC_RESERVE6 , "Reserve(6)"},
910 {SCSI_SPC_RELEASE6 , "Release(6)"},
911 {SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
912 {SCSI_SPC_MODESENSE6 , "Mode Sense(6)"},
913 {SCSI_SPC_MODESENSE10 , "Mode Sense(10)"},
914 {SCSI_SMC_MOVE_MEDIUM , "Move Medium"},
915 {SCSI_SMC_MOVE_MEDIUM_ATTACHED , "Move Medium Attached"},
916 {SCSI_SPC_PERSRESVIN , "Persistent Reserve In"},
917 {SCSI_SPC_PERSRESVOUT , "Persistent Reserve Out"},
918 {SCSI_SPC_PREVMEDREMOVAL , "Prevent/Allow Medium Removal"},
919 {SCSI_SSC_READ6 , "Read(6)"},
920 {SCSI_SSC_READ_16 , "Read(16)"},
921 {SCSI_SSC_READ_BLOCK_LIMITS , "Read Block Limits"},
922 {SCSI_SMC_READ_ELEMENT_STATUS , "Read Element Status"},
923 {SCSI_SMC_READ_ELEMENT_STATUS_ATTACHED , "Read Element Status Attached"},
924 {SCSI_SSC_READ_POSITION , "Read Position"},
925 {SCSI_SSC_READ_REVERSE_6 , "Read Reverse(6)"},
926 {SCSI_SSC_READ_REVERSE_16 , "Read Reverse(16)"},
927 {SCSI_SSC_RECOVER_BUFFERED_DATA , "Recover Buffered Data"},
928 {SCSI_SSC_REPORT_DENSITY_SUPPORT , "Report Density Support"},
929 {SCSI_SPC_REPORTLUNS , "Report LUNs"},
930 {SCSI_SPC_REQSENSE , "Request Sense"},
931 {SCSI_SSC_REWIND , "Rewind"},
932 {SCSI_SPC_SENDDIAG , "Send Diagnostic"},
933 {SCSI_SSC_SET_CAPACITY , "Set Capacity"},
934 {SCSI_SSC_SPACE_6 , "Space(6)"},
935 {SCSI_SSC_SPACE_16 , "Space(16)"},
936 {SCSI_SPC_TESTUNITRDY , "Test Unit Ready"},
937 {SCSI_SSC_VERIFY_6 , "Verify(6)"},
938 {SCSI_SSC_VERIFY_16 , "Verify(16)"},
939 {SCSI_SSC_WRITE6 , "Write(6)"},
940 {SCSI_SSC_WRITE_16 , "Write(16)"},
941 {SCSI_SPC_WRITEBUFFER , "Write Buffer"},
942 {SCSI_SSC_WRITE_FILEMARKS_16 , "Write Filemarks(16)"},
943 {SCSI_SSC_WRITE_FILEMARKS_6 , "Write Filemarks(6)"},
944 {0, NULL}
948 scsi_cdb_table_t scsi_ssc_table[256] = {
949 /*SPC 0x00*/{dissect_spc_testunitready},
950 /*SSC 0x01*/{dissect_ssc_rewind},
951 /*SSC 0x02*/{NULL},
952 /*SPC 0x03*/{dissect_spc_requestsense},
953 /*SSC 0x04*/{dissect_ssc_formatmedium},
954 /*SSC 0x05*/{dissect_ssc_readblocklimits},
955 /*SSC 0x06*/{NULL},
956 /*SSC 0x07*/{NULL},
957 /*SSC 0x08*/{dissect_ssc_read6},
958 /*SSC 0x09*/{NULL},
959 /*SSC 0x0a*/{dissect_ssc_write6},
960 /*SSC 0x0b*/{dissect_ssc_setcapacity},
961 /*SSC 0x0c*/{NULL},
962 /*SSC 0x0d*/{NULL},
963 /*SSC 0x0e*/{NULL},
964 /*SSC 0x0f*/{dissect_ssc_readreverse6},
965 /*SSC 0x10*/{dissect_ssc_writefilemarks6},
966 /*SSC 0x11*/{dissect_ssc_space6},
967 /*SPC 0x12*/{dissect_spc_inquiry},
968 /*SSC 0x13*/{dissect_ssc_verify6},
969 /*SSC 0x14*/{dissect_ssc_recoverbuffereddata},
970 /*SPC 0x15*/{dissect_spc_modeselect6},
971 /*SSC 0x16*/{dissect_spc_reserve6},
972 /*SSC 0x17*/{dissect_spc_release6},
973 /*SSC 0x18*/{NULL},
974 /*SSC 0x19*/{dissect_ssc_erase6},
975 /*SPC 0x1a*/{dissect_spc_modesense6},
976 /*SSC 0x1b*/{dissect_ssc_loadunload},
977 /*SSC 0x1c*/{NULL},
978 /*SPC 0x1d*/{dissect_spc_senddiagnostic},
979 /*SSC 0x1e*/{dissect_spc_preventallowmediaremoval},
980 /*SSC 0x1f*/{NULL},
981 /*SSC 0x20*/{NULL},
982 /*SSC 0x21*/{NULL},
983 /*SSC 0x22*/{NULL},
984 /*SSC 0x23*/{NULL},
985 /*SSC 0x24*/{NULL},
986 /*SSC 0x25*/{NULL},
987 /*SSC 0x26*/{NULL},
988 /*SSC 0x27*/{NULL},
989 /*SSC 0x28*/{NULL},
990 /*SSC 0x29*/{NULL},
991 /*SSC 0x2a*/{NULL},
992 /*SSC 0x2b*/{dissect_ssc_locate10},
993 /*SSC 0x2c*/{NULL},
994 /*SSC 0x2d*/{NULL},
995 /*SSC 0x2e*/{NULL},
996 /*SSC 0x2f*/{NULL},
997 /*SSC 0x30*/{NULL},
998 /*SSC 0x31*/{NULL},
999 /*SSC 0x32*/{NULL},
1000 /*SSC 0x33*/{NULL},
1001 /*SSC 0x34*/{dissect_ssc_readposition},
1002 /*SSC 0x35*/{NULL},
1003 /*SSC 0x36*/{NULL},
1004 /*SSC 0x37*/{NULL},
1005 /*SSC 0x38*/{NULL},
1006 /*SSC 0x39*/{NULL},
1007 /*SSC 0x3a*/{NULL},
1008 /*SPC 0x3b*/{dissect_spc_writebuffer},
1009 /*SSC 0x3c*/{NULL},
1010 /*SSC 0x3d*/{NULL},
1011 /*SSC 0x3e*/{NULL},
1012 /*SSC 0x3f*/{NULL},
1013 /*SSC 0x40*/{NULL},
1014 /*SSC 0x41*/{NULL},
1015 /*SSC 0x42*/{NULL},
1016 /*SSC 0x43*/{NULL},
1017 /*SSC 0x44*/{dissect_ssc_reportdensitysupport},
1018 /*SSC 0x45*/{NULL},
1019 /*SSC 0x46*/{NULL},
1020 /*SSC 0x47*/{NULL},
1021 /*SSC 0x48*/{NULL},
1022 /*SSC 0x49*/{NULL},
1023 /*SSC 0x4a*/{NULL},
1024 /*SSC 0x4b*/{NULL},
1025 /*SPC 0x4c*/{dissect_spc_logselect},
1026 /*SPC 0x4d*/{dissect_spc_logsense},
1027 /*SSC 0x4e*/{NULL},
1028 /*SSC 0x4f*/{NULL},
1029 /*SSC 0x50*/{NULL},
1030 /*SSC 0x51*/{NULL},
1031 /*SSC 0x52*/{NULL},
1032 /*SSC 0x53*/{NULL},
1033 /*SSC 0x54*/{NULL},
1034 /*SPC 0x55*/{dissect_spc_modeselect10},
1035 /*SSC 0x56*/{NULL},
1036 /*SSC 0x57*/{NULL},
1037 /*SSC 0x58*/{NULL},
1038 /*SSC 0x59*/{NULL},
1039 /*SPC 0x5a*/{dissect_spc_modesense10},
1040 /*SSC 0x5b*/{NULL},
1041 /*SSC 0x5c*/{NULL},
1042 /*SSC 0x5d*/{NULL},
1043 /*SPC 0x5e*/{dissect_spc_persistentreservein},
1044 /*SPC 0x5f*/{dissect_spc_persistentreserveout},
1045 /*SSC 0x60*/{NULL},
1046 /*SSC 0x61*/{NULL},
1047 /*SSC 0x62*/{NULL},
1048 /*SSC 0x63*/{NULL},
1049 /*SSC 0x64*/{NULL},
1050 /*SSC 0x65*/{NULL},
1051 /*SSC 0x66*/{NULL},
1052 /*SSC 0x67*/{NULL},
1053 /*SSC 0x68*/{NULL},
1054 /*SSC 0x69*/{NULL},
1055 /*SSC 0x6a*/{NULL},
1056 /*SSC 0x6b*/{NULL},
1057 /*SSC 0x6c*/{NULL},
1058 /*SSC 0x6d*/{NULL},
1059 /*SSC 0x6e*/{NULL},
1060 /*SSC 0x6f*/{NULL},
1061 /*SSC 0x70*/{NULL},
1062 /*SSC 0x71*/{NULL},
1063 /*SSC 0x72*/{NULL},
1064 /*SSC 0x73*/{NULL},
1065 /*SSC 0x74*/{NULL},
1066 /*SSC 0x75*/{NULL},
1067 /*SSC 0x76*/{NULL},
1068 /*SSC 0x77*/{NULL},
1069 /*SSC 0x78*/{NULL},
1070 /*SSC 0x79*/{NULL},
1071 /*SSC 0x7a*/{NULL},
1072 /*SSC 0x7b*/{NULL},
1073 /*SSC 0x7c*/{NULL},
1074 /*SSC 0x7d*/{NULL},
1075 /*SSC 0x7e*/{NULL},
1076 /*SSC 0x7f*/{NULL},
1077 /*SSC 0x80*/{dissect_ssc_writefilemarks16},
1078 /*SSC 0x81*/{dissect_ssc_readreverse16},
1079 /*SSC 0x82*/{NULL},
1080 /*SPC 0x83*/{dissect_spc_extcopy},
1081 /*SSC 0x84*/{NULL},
1082 /*SSC 0x85*/{NULL},
1083 /*SSC 0x86*/{NULL},
1084 /*SSC 0x87*/{NULL},
1085 /*SSC 0x88*/{dissect_ssc_read16},
1086 /*SSC 0x89*/{NULL},
1087 /*SSC 0x8a*/{dissect_ssc_write16},
1088 /*SSC 0x8b*/{NULL},
1089 /*SSC 0x8c*/{NULL},
1090 /*SSC 0x8d*/{NULL},
1091 /*SSC 0x8e*/{NULL},
1092 /*SSC 0x8f*/{dissect_ssc_verify16},
1093 /*SSC 0x90*/{NULL},
1094 /*SSC 0x91*/{dissect_ssc_space16},
1095 /*SSC 0x92*/{dissect_ssc_locate16},
1096 /*SSC 0x93*/{dissect_ssc_erase16},
1097 /*SSC 0x94*/{NULL},
1098 /*SSC 0x95*/{NULL},
1099 /*SSC 0x96*/{NULL},
1100 /*SSC 0x97*/{NULL},
1101 /*SSC 0x98*/{NULL},
1102 /*SSC 0x99*/{NULL},
1103 /*SSC 0x9a*/{NULL},
1104 /*SSC 0x9b*/{NULL},
1105 /*SSC 0x9c*/{NULL},
1106 /*SSC 0x9d*/{NULL},
1107 /*SSC 0x9e*/{NULL},
1108 /*SSC 0x9f*/{NULL},
1109 /*SPC 0xa0*/{dissect_spc_reportluns},
1110 /*SSC 0xa1*/{NULL},
1111 /*SSC 0xa2*/{NULL},
1112 /*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
1113 /*SSC 0xa4*/{NULL},
1114 /*SSC 0xa5*/{dissect_smc_movemedium},
1115 /*SSC 0xa6*/{NULL},
1116 /*SSC 0xa7*/{dissect_smc_movemedium},
1117 /*SSC 0xa8*/{NULL},
1118 /*SSC 0xa9*/{NULL},
1119 /*SSC 0xaa*/{NULL},
1120 /*SSC 0xab*/{NULL},
1121 /*SSC 0xac*/{NULL},
1122 /*SSC 0xad*/{NULL},
1123 /*SSC 0xae*/{NULL},
1124 /*SSC 0xaf*/{NULL},
1125 /*SSC 0xb0*/{NULL},
1126 /*SSC 0xb1*/{NULL},
1127 /*SSC 0xb2*/{NULL},
1128 /*SSC 0xb3*/{NULL},
1129 /*SSC 0xb4*/{dissect_smc_readelementstatus},
1130 /*SSC 0xb5*/{NULL},
1131 /*SSC 0xb6*/{NULL},
1132 /*SSC 0xb7*/{NULL},
1133 /*SSC 0xb8*/{dissect_smc_readelementstatus},
1134 /*SSC 0xb9*/{NULL},
1135 /*SSC 0xba*/{NULL},
1136 /*SSC 0xbb*/{NULL},
1137 /*SSC 0xbc*/{NULL},
1138 /*SSC 0xbd*/{NULL},
1139 /*SSC 0xbe*/{NULL},
1140 /*SSC 0xbf*/{NULL},
1141 /*SSC 0xc0*/{NULL},
1142 /*SSC 0xc1*/{NULL},
1143 /*SSC 0xc2*/{NULL},
1144 /*SSC 0xc3*/{NULL},
1145 /*SSC 0xc4*/{NULL},
1146 /*SSC 0xc5*/{NULL},
1147 /*SSC 0xc6*/{NULL},
1148 /*SSC 0xc7*/{NULL},
1149 /*SSC 0xc8*/{NULL},
1150 /*SSC 0xc9*/{NULL},
1151 /*SSC 0xca*/{NULL},
1152 /*SSC 0xcb*/{NULL},
1153 /*SSC 0xcc*/{NULL},
1154 /*SSC 0xcd*/{NULL},
1155 /*SSC 0xce*/{NULL},
1156 /*SSC 0xcf*/{NULL},
1157 /*SSC 0xd0*/{NULL},
1158 /*SSC 0xd1*/{NULL},
1159 /*SSC 0xd2*/{NULL},
1160 /*SSC 0xd3*/{NULL},
1161 /*SSC 0xd4*/{NULL},
1162 /*SSC 0xd5*/{NULL},
1163 /*SSC 0xd6*/{NULL},
1164 /*SSC 0xd7*/{NULL},
1165 /*SSC 0xd8*/{NULL},
1166 /*SSC 0xd9*/{NULL},
1167 /*SSC 0xda*/{NULL},
1168 /*SSC 0xdb*/{NULL},
1169 /*SSC 0xdc*/{NULL},
1170 /*SSC 0xdd*/{NULL},
1171 /*SSC 0xde*/{NULL},
1172 /*SSC 0xdf*/{NULL},
1173 /*SSC 0xe0*/{NULL},
1174 /*SSC 0xe1*/{NULL},
1175 /*SSC 0xe2*/{NULL},
1176 /*SSC 0xe3*/{NULL},
1177 /*SSC 0xe4*/{NULL},
1178 /*SSC 0xe5*/{NULL},
1179 /*SSC 0xe6*/{NULL},
1180 /*SSC 0xe7*/{NULL},
1181 /*SSC 0xe8*/{NULL},
1182 /*SSC 0xe9*/{NULL},
1183 /*SSC 0xea*/{NULL},
1184 /*SSC 0xeb*/{NULL},
1185 /*SSC 0xec*/{NULL},
1186 /*SSC 0xed*/{NULL},
1187 /*SSC 0xee*/{NULL},
1188 /*SSC 0xef*/{NULL},
1189 /*SSC 0xf0*/{NULL},
1190 /*SSC 0xf1*/{NULL},
1191 /*SSC 0xf2*/{NULL},
1192 /*SSC 0xf3*/{NULL},
1193 /*SSC 0xf4*/{NULL},
1194 /*SSC 0xf5*/{NULL},
1195 /*SSC 0xf6*/{NULL},
1196 /*SSC 0xf7*/{NULL},
1197 /*SSC 0xf8*/{NULL},
1198 /*SSC 0xf9*/{NULL},
1199 /*SSC 0xfa*/{NULL},
1200 /*SSC 0xfb*/{NULL},
1201 /*SSC 0xfc*/{NULL},
1202 /*SSC 0xfd*/{NULL},
1203 /*SSC 0xfe*/{NULL},
1204 /*SSC 0xff*/{NULL}
1209 void
1210 proto_register_scsi_ssc(void)
1212 static hf_register_info hf[] = {
1213 { &hf_scsi_ssc_opcode,
1214 {"SSC Opcode", "scsi_ssc.opcode", FT_UINT8, BASE_HEX,
1215 VALS (scsi_ssc_vals), 0x0, NULL, HFILL}},
1216 { &hf_scsi_ssc_rdwr6_xferlen,
1217 {"Transfer Length", "scsi_ssc.rdwr6.xferlen", FT_UINT24, BASE_DEC, NULL, 0x0,
1218 NULL, HFILL}},
1219 { &hf_scsi_ssc_ver16_verlen,
1220 {"Verification Length", "scsi_ssc.verify16.verify_len", FT_UINT24, BASE_DEC, NULL, 0x0,
1221 NULL, HFILL}},
1222 { &hf_scsi_ssc_locate10_loid,
1223 {"Logical Object Identifier", "scsi_ssc.locate10.loid", FT_UINT32, BASE_DEC, NULL, 0x0,
1224 NULL, HFILL}},
1225 { &hf_scsi_ssc_locate16_loid,
1226 {"Logical Identifier", "scsi_ssc.locate16.loid", FT_UINT64, BASE_DEC, NULL, 0x0,
1227 NULL, HFILL}},
1228 { &hf_scsi_ssc_space6_count,
1229 {"Count", "scsi_ssc.space6.count", FT_INT24, BASE_DEC, NULL, 0x0,
1230 NULL, HFILL}},
1231 { &hf_scsi_ssc_space6_code,
1232 {"Code", "scsi_ssc.space6.code", FT_UINT8, BASE_HEX,
1233 VALS(space6_code_vals), 0x0f,
1234 NULL, HFILL}},
1235 { &hf_scsi_ssc_space16_count,
1236 {"Count", "scsi_ssc.space16.count", FT_UINT64, BASE_DEC, NULL, 0x0,
1237 NULL, HFILL}},
1238 { &hf_scsi_ssc_rdwr10_xferlen,
1239 {"Transfer Length", "scsi_ssc.rdwr10.xferlen", FT_UINT16, BASE_DEC, NULL,
1240 0x0, NULL, HFILL}},
1241 { &hf_scsi_ssc_erase_flags,
1242 {"Flags", "scsi_ssc.erase_flags", FT_UINT8, BASE_HEX,
1243 NULL, 0x0, NULL, HFILL}},
1244 { &hf_scsi_ssc_fcs,
1245 {"FCS", "scsi_ssc.fcs", FT_BOOLEAN, 8,
1246 NULL, 0x08, NULL, HFILL}},
1247 { &hf_scsi_ssc_lcs,
1248 {"LCS", "scsi_ssc.lcs", FT_BOOLEAN, 8,
1249 NULL, 0x04, NULL, HFILL}},
1250 { &hf_scsi_ssc_erase_immed,
1251 {"IMMED", "scsi_ssc.erase_immed", FT_BOOLEAN, 8,
1252 NULL, 0x02, NULL, HFILL}},
1253 { &hf_scsi_ssc_long,
1254 {"LONG", "scsi_ssc.long", FT_BOOLEAN, 8,
1255 NULL, 0x01, NULL, HFILL}},
1256 { &hf_scsi_ssc_partition,
1257 {"Partition", "scsi_ssc.partition", FT_UINT8, BASE_HEX,
1258 NULL, 0x0, NULL, HFILL}},
1259 { &hf_scsi_ssc_lbi,
1260 {"Logical Block Identifier", "scsi_ssc.lbi", FT_UINT64, BASE_HEX,
1261 NULL, 0x0, NULL, HFILL}},
1262 { &hf_scsi_ssc_verify,
1263 {"VERIFY", "scsi_ssc.verify", FT_BOOLEAN, 8,
1264 NULL, 0x02, NULL, HFILL}},
1265 { &hf_scsi_ssc_immed,
1266 {"IMMED", "scsi_ssc.immed", FT_BOOLEAN, 8,
1267 NULL, 0x01, NULL, HFILL}},
1268 { &hf_scsi_ssc_formatmedium_flags,
1269 {"Flags", "scsi_ssc.formatmedium_flags", FT_UINT8, BASE_HEX,
1270 NULL, 0x0, NULL, HFILL}},
1271 { &hf_scsi_ssc_format,
1272 {"Format", "scsi_ssc.format", FT_UINT8, BASE_HEX,
1273 VALS(format_vals), 0x0f, NULL, HFILL}},
1274 { &hf_scsi_ssc_loadunload_immed_flags,
1275 {"Immed", "scsi_ssc.loadunload_immed_flags", FT_UINT8, BASE_HEX,
1276 NULL, 0x0, NULL, HFILL}},
1277 { &hf_scsi_ssc_loadunload_flags,
1278 {"Flags", "scsi_ssc.loadunload_flags", FT_UINT8, BASE_HEX,
1279 NULL, 0x0, NULL, HFILL}},
1280 { &hf_scsi_ssc_hold,
1281 {"HOLD", "scsi_ssc.hold", FT_BOOLEAN, 8,
1282 NULL, 0x08, NULL, HFILL}},
1283 { &hf_scsi_ssc_eot,
1284 {"EOT", "scsi_ssc.eot", FT_BOOLEAN, 8,
1285 NULL, 0x04, NULL, HFILL}},
1286 { &hf_scsi_ssc_reten,
1287 {"RETEN", "scsi_ssc.reten", FT_BOOLEAN, 8,
1288 NULL, 0x02, NULL, HFILL}},
1289 { &hf_scsi_ssc_load,
1290 {"LOAD", "scsi_ssc.load", FT_BOOLEAN, 8,
1291 NULL, 0x01, NULL, HFILL}},
1292 { &hf_scsi_ssc_locate_flags,
1293 {"Flags", "scsi_ssc.locate_flags", FT_UINT8, BASE_HEX,
1294 NULL, 0x0, NULL, HFILL}},
1295 { &hf_scsi_ssc_bt,
1296 {"BT", "scsi_ssc.bt", FT_BOOLEAN, 8,
1297 NULL, 0x04, NULL, HFILL}},
1298 { &hf_scsi_ssc_cp,
1299 {"CP", "scsi_ssc.cp", FT_BOOLEAN, 8,
1300 NULL, 0x02, NULL, HFILL}},
1301 { &hf_scsi_ssc_dest_type,
1302 {"Dest Type", "scsi_ssc.dest_type", FT_UINT8, BASE_HEX,
1303 VALS(dest_type_vals), 0x18, NULL, HFILL}},
1304 { &hf_scsi_ssc_bam_flags,
1305 {"Flags", "scsi_ssc.bam_flags", FT_UINT8, BASE_HEX,
1306 NULL, 0x0, NULL, HFILL}},
1307 { &hf_scsi_ssc_bam,
1308 {"BAM", "scsi_ssc.bam", FT_BOOLEAN, 8,
1309 NULL, 0x01, NULL, HFILL}},
1310 { &hf_scsi_ssc_read6_flags,
1311 {"Flags", "scsi_ssc.read6_flags", FT_UINT8, BASE_HEX,
1312 NULL, 0x0, NULL, HFILL}},
1313 { &hf_scsi_ssc_sili,
1314 {"SILI", "scsi_ssc.sili", FT_BOOLEAN, 8,
1315 NULL, 0x02, NULL, HFILL}},
1316 { &hf_scsi_ssc_fixed,
1317 {"FIXED", "scsi_ssc.fixed", FT_BOOLEAN, 8,
1318 NULL, 0x01, NULL, HFILL}},
1319 { &hf_scsi_ssc_bytord,
1320 {"BYTORD", "scsi_ssc.bytord", FT_BOOLEAN, 8,
1321 NULL, 0x04, NULL, HFILL}},
1322 { &hf_scsi_ssc_bytcmp,
1323 {"BYTCMP", "scsi_ssc.bytcmp", FT_BOOLEAN, 8,
1324 NULL, 0x02, NULL, HFILL}},
1325 { &hf_scsi_ssc_verify16_immed,
1326 {"IMMED", "scsi_ssc.verify16_immed", FT_BOOLEAN, 8,
1327 NULL, 0x04, NULL, HFILL}},
1328 { &hf_scsi_ssc_medium_type,
1329 {"Medium Type", "scsi_ssc.medium_type", FT_BOOLEAN, 8,
1330 NULL, 0x02, NULL, HFILL}},
1331 { &hf_scsi_ssc_media,
1332 {"Media", "scsi_ssc.media", FT_BOOLEAN, 8,
1333 NULL, 0x01, NULL, HFILL}},
1334 { &hf_scsi_ssc_capacity_prop_value,
1335 {"Capacity Proportion Value", "scsi_ssc.cpv", FT_UINT16, BASE_DEC,
1336 NULL, 0, NULL, HFILL}},
1340 /* Setup protocol subtree array */
1341 static gint *ett[] = {
1342 &ett_scsi_erase,
1343 &ett_scsi_formatmedium,
1344 &ett_scsi_loadunload_immed,
1345 &ett_scsi_loadunload,
1346 &ett_scsi_locate,
1347 &ett_scsi_bam,
1348 &ett_scsi_read6
1352 /* Register the protocol name and description */
1353 proto_scsi_ssc = proto_register_protocol("SCSI_SSC", "SCSI_SSC", "scsi_ssc");
1355 /* Required function calls to register the header fields and subtrees used */
1356 proto_register_field_array(proto_scsi_ssc, hf, array_length(hf));
1358 proto_register_subtree_array(ett, array_length(ett));
1362 void
1363 proto_reg_handoff_scsi_ssc(void)