1 /* based on the SMC 3 standard */
3 * Dissector for the SCSI SMC commandset
4 * Extracted from packet-scsi.c
6 * Dinesh G Dutt (ddutt@cisco.com)
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 2002 Gerald Combs
13 * SPDX-License-Identifier: GPL-2.0-or-later
18 #include <epan/packet.h>
19 #include <epan/conversation.h>
20 #include "packet-scsi.h"
21 #include "packet-scsi-smc.h"
23 void proto_register_scsi_smc(void);
25 static int proto_scsi_smc
;
26 int hf_scsi_smc_opcode
;
27 static int hf_scsi_smc_mta
;
28 static int hf_scsi_smc_sa
;
29 static int hf_scsi_smc_da
;
30 static int hf_scsi_smc_fda
;
31 static int hf_scsi_smc_sda
;
32 static int hf_scsi_smc_medium_flags
;
33 static int hf_scsi_smc_inv1
;
34 static int hf_scsi_smc_inv2
;
35 static int hf_scsi_smc_range_flags
;
36 static int hf_scsi_smc_fast
;
37 static int hf_scsi_smc_range
;
38 /* static int hf_scsi_smc_sea; */
39 static int hf_scsi_smc_num_elements
;
40 static int hf_scsi_smc_invert
;
41 static int hf_scsi_smc_ea
;
42 static int hf_scsi_smc_action_code
;
43 /* Generated from convert_proto_tree_add_text.pl */
44 static int hf_scsi_smc_allocation_length
;
45 static int hf_scsi_smc_first_element_address_reported
;
46 static int hf_scsi_smc_voltag
;
47 static int hf_scsi_smc_element_descriptor_length
;
48 static int hf_scsi_smc_byte_count_of_descriptor_data_available
;
49 static int hf_scsi_smc_pvoltag
;
50 static int hf_scsi_smc_code_set
;
51 static int hf_scsi_smc_starting_element_address
;
52 static int hf_scsi_smc_curdata
;
53 static int hf_scsi_smc_element_type_code
;
54 static int hf_scsi_smc_element_type_code_0F
;
55 static int hf_scsi_smc_identifier
;
56 static int hf_scsi_smc_vendor_specific_data
;
57 static int hf_scsi_smc_source_storage_element_address
;
58 static int hf_scsi_smc_number_of_elements_available
;
59 static int hf_scsi_smc_identifier_type
;
60 static int hf_scsi_smc_number_of_elements
;
61 static int hf_scsi_smc_identifier_length
;
62 static int hf_scsi_smc_scsi_bus_address
;
63 static int hf_scsi_smc_byte_count_of_report_available
;
64 static int hf_scsi_smc_cmc
;
65 static int hf_scsi_smc_svalid
;
66 static int hf_scsi_smc_avoltag
;
67 static int hf_scsi_smc_access
;
68 static int hf_scsi_smc_additional_sense_code_qualifier
;
69 static int hf_scsi_smc_lu_valid
;
70 static int hf_scsi_smc_dvcid
;
71 static int hf_scsi_smc_except
;
72 static int hf_scsi_smc_id_valid
;
73 static int hf_scsi_smc_not_bus
;
74 static int hf_scsi_smc_exenab
;
75 static int hf_scsi_smc_lun
;
76 static int hf_scsi_smc_inenab
;
77 static int hf_scsi_smc_full
;
78 static int hf_scsi_smc_impexp
;
79 static int hf_scsi_smc_primary_vol_tag_id
;
80 static int hf_scsi_smc_primary_vol_seq_num
;
81 static int hf_scsi_smc_alternate_vol_tag_id
;
82 static int hf_scsi_smc_alternate_vol_seq_num
;
84 static int ett_scsi_exchange_medium
;
85 static int ett_scsi_range
;
86 static int ett_scsi_move
;
89 dissect_smc_exchangemedium (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
90 unsigned offset
, bool isreq
, bool iscdb
,
91 unsigned payload_len _U_
, scsi_task_data_t
*cdata _U_
)
93 static int * const exchg_fields
[] = {
102 if (isreq
&& iscdb
) {
103 proto_tree_add_item (tree
, hf_scsi_smc_mta
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
104 proto_tree_add_item (tree
, hf_scsi_smc_sa
, tvb
, offset
+3, 2, ENC_BIG_ENDIAN
);
105 proto_tree_add_item (tree
, hf_scsi_smc_fda
, tvb
, offset
+5, 2, ENC_BIG_ENDIAN
);
106 proto_tree_add_item (tree
, hf_scsi_smc_sda
, tvb
, offset
+7, 2, ENC_BIG_ENDIAN
);
107 proto_tree_add_bitmask(tree
, tvb
, offset
+9, hf_scsi_smc_medium_flags
,
108 ett_scsi_exchange_medium
, exchg_fields
, ENC_BIG_ENDIAN
);
109 proto_tree_add_bitmask(tree
, tvb
, offset
+10, hf_scsi_control
,
110 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
115 dissect_smc_position_to_element (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
116 unsigned offset
, bool isreq
, bool iscdb
,
117 unsigned payload_len _U_
, scsi_task_data_t
*cdata _U_
)
119 static int * const pte_fields
[] = {
127 if (isreq
&& iscdb
) {
128 proto_tree_add_item (tree
, hf_scsi_smc_mta
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
129 proto_tree_add_item (tree
, hf_scsi_smc_da
, tvb
, offset
+3, 2, ENC_BIG_ENDIAN
);
130 proto_tree_add_bitmask(tree
, tvb
, offset
+7, hf_scsi_smc_medium_flags
,
131 ett_scsi_exchange_medium
, pte_fields
, ENC_BIG_ENDIAN
);
132 proto_tree_add_bitmask(tree
, tvb
, offset
+8, hf_scsi_control
,
133 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
138 dissect_smc_initialize_element_status (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
139 unsigned offset
, bool isreq
, bool iscdb
,
140 unsigned payload_len _U_
, scsi_task_data_t
*cdata _U_
)
145 if (isreq
&& iscdb
) {
146 proto_tree_add_bitmask(tree
, tvb
, offset
+4, hf_scsi_control
,
147 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
152 dissect_smc_initialize_element_status_with_range (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
153 unsigned offset
, bool isreq
, bool iscdb
,
154 unsigned payload_len _U_
, scsi_task_data_t
*cdata _U_
)
156 static int * const range_fields
[] = {
165 if (isreq
&& iscdb
) {
166 proto_tree_add_bitmask(tree
, tvb
, offset
, hf_scsi_smc_range_flags
,
167 ett_scsi_range
, range_fields
, ENC_BIG_ENDIAN
);
168 proto_tree_add_item (tree
, hf_scsi_smc_sa
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
169 proto_tree_add_item (tree
, hf_scsi_smc_num_elements
, tvb
, offset
+5, 2, ENC_BIG_ENDIAN
);
170 proto_tree_add_bitmask(tree
, tvb
, offset
+8, hf_scsi_control
,
171 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
176 dissect_smc_openclose_importexport_element (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
177 unsigned offset
, bool isreq
, bool iscdb
,
178 unsigned payload_len _U_
, scsi_task_data_t
*cdata _U_
)
183 if (isreq
&& iscdb
) {
184 proto_tree_add_item (tree
, hf_scsi_smc_ea
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
185 proto_tree_add_item (tree
, hf_scsi_smc_action_code
, tvb
, offset
+3, 1, ENC_BIG_ENDIAN
);
186 proto_tree_add_bitmask(tree
, tvb
, offset
+4, hf_scsi_control
,
187 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
191 dissect_smc_movemedium (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
192 unsigned offset
, bool isreq
, bool iscdb
,
193 unsigned payload_len _U_
, scsi_task_data_t
*cdata _U_
)
195 static int * const move_fields
[] = {
203 if (isreq
&& iscdb
) {
204 proto_tree_add_item (tree
, hf_scsi_smc_mta
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
205 proto_tree_add_item (tree
, hf_scsi_smc_sa
, tvb
, offset
+3, 2, ENC_BIG_ENDIAN
);
206 proto_tree_add_item (tree
, hf_scsi_smc_da
, tvb
, offset
+5, 2, ENC_BIG_ENDIAN
);
207 proto_tree_add_bitmask(tree
, tvb
, offset
+9, hf_scsi_smc_range_flags
,
208 ett_scsi_move
, move_fields
, ENC_BIG_ENDIAN
);
209 proto_tree_add_bitmask(tree
, tvb
, offset
+10, hf_scsi_control
,
210 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
219 static const value_string element_type_code_vals
[] = {
220 {0x0, "All element types"},
221 {MT_ELEM
, "Medium transport element"},
222 {ST_ELEM
, "Storage element"},
223 {I_E_ELEM
, "Import/export element"},
224 {DT_ELEM
, "Data transfer element"},
228 static const value_string action_code_vals
[] = {
229 {0, "OPEN Import/Export Element"},
230 {1, "CLOSE Import/Export Element"},
239 #define ID_VALID 0x20
240 #define LU_VALID 0x10
245 dissect_scsi_smc_volume_tag (tvbuff_t
*tvb
, packet_info
*pinfo
,
246 proto_tree
*tree
, unsigned offset
, int hf_vol_id
, int hf_vol_seq_num
)
250 for (length
= 32; length
> 0; length
--) {
251 if (tvb_get_uint8(tvb
, offset
+ length
- 1) != ' ')
255 volid
= tvb_get_string_enc(pinfo
->pool
, tvb
, offset
, length
, ENC_ASCII
);
256 proto_tree_add_string(tree
, hf_vol_id
, tvb
, offset
, 32, volid
);
257 proto_tree_add_item(tree
, hf_vol_seq_num
, tvb
, offset
+34, 2, ENC_BIG_ENDIAN
);
262 dissect_scsi_smc_element (tvbuff_t
*tvb
, packet_info
*pinfo _U_
,
263 proto_tree
*tree
, unsigned offset
,
264 unsigned elem_bytecnt
, uint8_t elem_type
,
265 uint8_t voltag_flags
)
270 proto_tree_add_item(tree
, hf_scsi_smc_ea
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
274 if (elem_bytecnt
< 1)
276 flags
= tvb_get_uint8 (tvb
, offset
);
280 proto_tree_add_item(tree
, hf_scsi_smc_except
, tvb
, offset
, 1, ENC_NA
);
281 proto_tree_add_item(tree
, hf_scsi_smc_full
, tvb
, offset
, 1, ENC_NA
);
286 proto_tree_add_item(tree
, hf_scsi_smc_access
, tvb
, offset
, 1, ENC_NA
);
287 proto_tree_add_item(tree
, hf_scsi_smc_except
, tvb
, offset
, 1, ENC_NA
);
288 proto_tree_add_item(tree
, hf_scsi_smc_full
, tvb
, offset
, 1, ENC_NA
);
292 proto_tree_add_item(tree
, hf_scsi_smc_cmc
, tvb
, offset
, 1, ENC_NA
);
293 proto_tree_add_item(tree
, hf_scsi_smc_inenab
, tvb
, offset
, 1, ENC_NA
);
294 proto_tree_add_item(tree
, hf_scsi_smc_exenab
, tvb
, offset
, 1, ENC_NA
);
295 proto_tree_add_item(tree
, hf_scsi_smc_impexp
, tvb
, offset
, 1, ENC_NA
);
296 proto_tree_add_item(tree
, hf_scsi_smc_access
, tvb
, offset
, 1, ENC_NA
);
297 proto_tree_add_item(tree
, hf_scsi_smc_except
, tvb
, offset
, 1, ENC_NA
);
298 proto_tree_add_item(tree
, hf_scsi_smc_full
, tvb
, offset
, 1, ENC_NA
);
304 if (elem_bytecnt
< 1)
306 offset
+= 1; /* reserved */
309 if (elem_bytecnt
< 2)
311 if (flags
& EXCEPT
) {
312 proto_tree_add_item(tree
, hf_scsi_smc_additional_sense_code_qualifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
317 if (elem_bytecnt
< 3)
322 flags
= tvb_get_uint8 (tvb
, offset
);
323 if (flags
& LU_VALID
) {
324 proto_tree_add_item(tree
, hf_scsi_smc_lun
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
326 proto_tree_add_item(tree
, hf_scsi_smc_not_bus
, tvb
, offset
, 1, ENC_NA
);
327 proto_tree_add_item(tree
, hf_scsi_smc_id_valid
, tvb
, offset
, 1, ENC_NA
);
328 proto_tree_add_item(tree
, hf_scsi_smc_lu_valid
, tvb
, offset
, 1, ENC_NA
);
331 if (flags
& ID_VALID
) {
332 proto_tree_add_item(tree
, hf_scsi_smc_scsi_bus_address
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
335 offset
+= 1; /* reserved */
339 offset
+= 3; /* reserved */
344 if (elem_bytecnt
< 3)
346 flags
= tvb_get_uint8 (tvb
, offset
);
347 proto_tree_add_item(tree
, hf_scsi_smc_svalid
, tvb
, offset
, 1, ENC_NA
);
348 if (flags
& SVALID
) {
349 proto_tree_add_item(tree
, hf_scsi_smc_invert
, tvb
, offset
, 1, ENC_NA
);
351 proto_tree_add_item(tree
, hf_scsi_smc_source_storage_element_address
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
358 if (voltag_flags
& PVOLTAG
) {
359 if (elem_bytecnt
< 36)
361 dissect_scsi_smc_volume_tag (tvb
, pinfo
, tree
, offset
, hf_scsi_smc_primary_vol_tag_id
,
362 hf_scsi_smc_primary_vol_seq_num
);
367 if (voltag_flags
& AVOLTAG
) {
368 if (elem_bytecnt
< 36)
370 dissect_scsi_smc_volume_tag (tvb
, pinfo
, tree
, offset
, hf_scsi_smc_alternate_vol_tag_id
,
371 hf_scsi_smc_alternate_vol_seq_num
);
376 if (elem_bytecnt
< 1)
378 proto_tree_add_item(tree
, hf_scsi_smc_code_set
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
382 if (elem_bytecnt
< 1)
384 proto_tree_add_item(tree
, hf_scsi_smc_identifier_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
388 if (elem_bytecnt
< 1)
390 offset
+= 1; /* reserved */
393 if (elem_bytecnt
< 1)
395 ident_len
= tvb_get_uint8 (tvb
, offset
);
396 proto_tree_add_item(tree
, hf_scsi_smc_identifier_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
400 if (ident_len
!= 0) {
401 if (elem_bytecnt
< ident_len
)
403 proto_tree_add_item(tree
, hf_scsi_smc_identifier
, tvb
, offset
, ident_len
, ENC_NA
);
405 elem_bytecnt
-= ident_len
;
407 if (elem_bytecnt
!= 0) {
408 proto_tree_add_item(tree
, hf_scsi_smc_vendor_specific_data
, tvb
, offset
, elem_bytecnt
, ENC_NA
);
414 dissect_scsi_smc_elements (tvbuff_t
*tvb
, packet_info
*pinfo
,
415 proto_tree
*tree
, unsigned offset
,
416 unsigned desc_bytecnt
, uint8_t elem_type
,
417 uint8_t voltag_flags
, uint16_t elem_desc_len
)
419 unsigned elem_bytecnt
;
421 while (desc_bytecnt
!= 0) {
422 elem_bytecnt
= elem_desc_len
;
424 if (elem_bytecnt
> desc_bytecnt
)
425 elem_bytecnt
= desc_bytecnt
;
427 if (elem_bytecnt
< 2)
430 dissect_scsi_smc_element (tvb
, pinfo
, tree
, offset
, elem_bytecnt
,
431 elem_type
, voltag_flags
);
432 offset
+= elem_bytecnt
;
433 desc_bytecnt
-= elem_bytecnt
;
439 dissect_smc_readelementstatus (tvbuff_t
*tvb
, packet_info
*pinfo
,
440 proto_tree
*tree
, unsigned offset
, bool isreq
,
442 unsigned payload_len _U_
, scsi_task_data_t
*cdata _U_
)
444 unsigned bytecnt
, desc_bytecnt
;
446 uint8_t voltag_flags
;
447 uint16_t elem_desc_len
;
452 if (isreq
&& iscdb
) {
453 proto_tree_add_item(tree
, hf_scsi_smc_voltag
, tvb
, offset
, 1, ENC_NA
);
454 proto_tree_add_item(tree
, hf_scsi_smc_element_type_code_0F
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
455 proto_tree_add_item(tree
, hf_scsi_smc_starting_element_address
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
456 proto_tree_add_item(tree
, hf_scsi_smc_number_of_elements
, tvb
, offset
+3, 2, ENC_BIG_ENDIAN
);
457 proto_tree_add_item(tree
, hf_scsi_smc_curdata
, tvb
, offset
+4, 1, ENC_NA
);
458 proto_tree_add_item(tree
, hf_scsi_smc_dvcid
, tvb
, offset
+4, 1, ENC_NA
);
459 proto_tree_add_item(tree
, hf_scsi_smc_allocation_length
, tvb
, offset
+6, 3, ENC_BIG_ENDIAN
);
460 proto_tree_add_bitmask(tree
, tvb
, offset
+10, hf_scsi_control
,
461 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
464 proto_tree_add_item(tree
, hf_scsi_smc_first_element_address_reported
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
466 proto_tree_add_item(tree
, hf_scsi_smc_number_of_elements_available
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
468 offset
+= 1; /* reserved */
469 bytecnt
= tvb_get_ntoh24 (tvb
, offset
);
470 proto_tree_add_item(tree
, hf_scsi_smc_byte_count_of_report_available
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
472 while (bytecnt
!= 0) {
473 elem_type
= tvb_get_uint8 (tvb
, offset
);
474 proto_tree_add_item(tree
, hf_scsi_smc_element_type_code
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
480 voltag_flags
= tvb_get_uint8 (tvb
, offset
);
481 proto_tree_add_item(tree
, hf_scsi_smc_pvoltag
, tvb
, offset
, 1, ENC_NA
);
482 proto_tree_add_item(tree
, hf_scsi_smc_avoltag
, tvb
, offset
, 1, ENC_NA
);
488 elem_desc_len
= tvb_get_ntohs (tvb
, offset
);
489 proto_tree_add_item(tree
, hf_scsi_smc_element_descriptor_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
495 offset
+= 1; /* reserved */
500 desc_bytecnt
= tvb_get_ntoh24 (tvb
, offset
);
501 proto_tree_add_item(tree
, hf_scsi_smc_byte_count_of_descriptor_data_available
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
505 if (desc_bytecnt
> bytecnt
)
506 desc_bytecnt
= bytecnt
;
507 dissect_scsi_smc_elements (tvb
, pinfo
, tree
, offset
,
508 desc_bytecnt
, elem_type
,
509 voltag_flags
, elem_desc_len
);
510 offset
+= desc_bytecnt
;
511 bytecnt
-= desc_bytecnt
;
519 static const value_string scsi_smc_vals
[] = {
520 /* 0x00 */ {SCSI_SPC_TESTUNITRDY
, "Test Unit Ready"},
521 /* 0x03 */ {SCSI_SPC_REQSENSE
, "Request Sense"},
522 /* 0x07 */ {SCSI_SMC_INITIALIZE_ELEMENT_STATUS
, "Initialize Element Status"},
523 /* 0x12 */ {SCSI_SPC_INQUIRY
, "Inquiry"},
524 /* 0x15 */ {SCSI_SPC_MODESELECT6
, "Mode Select(6)"},
525 /* 0x16 */ {SCSI_SPC_RESERVE6
, "Reserve(6)"},
526 /* 0x17 */ {SCSI_SPC_RELEASE6
, "Release(6)"},
527 /* 0x1A */ {SCSI_SPC_MODESENSE6
, "Mode Sense(6)"},
528 /* 0x1B */ {SCSI_SMC_OPENCLOSE_ELEMENT
, "Open/Close Import/Export Element"},
529 /* 0x1C */ {SCSI_SPC_RCVDIAGRESULTS
, "Receive Diagnostics Results"},
530 /* 0x1D */ {SCSI_SPC_SENDDIAG
, "Send Diagnostic"},
531 /* 0x1E */ {SCSI_SPC_PREVMEDREMOVAL
, "Prevent/Allow Medium Removal"},
532 /* 0x2B */ {SCSI_SMC_POSITION_TO_ELEMENT
, "Position To Element"},
533 /* 0x37 */ {SCSI_SMC_INITIALIZE_ELEMENT_STATUS_RANGE
, "Initialize Element Status With Range"},
534 /* 0x3B */ {SCSI_SPC_WRITEBUFFER
, "Write Buffer"},
535 /* 0x3C */ {SCSI_SPC_READBUFFER
, "Read Buffer"},
536 /* 0x40 */ {SCSI_SMC_EXCHANGE_MEDIUM
, "Exchange Medium"},
537 /* 0x44 */ {SCSI_SMC_REPORT_VOLUME_TYPES_SUPPORTED
, "Report Volume Types Supported"},
538 /* 0x4C */ {SCSI_SPC_LOGSELECT
, "Log Select"},
539 /* 0x4D */ {SCSI_SPC_LOGSENSE
, "Log Sense"},
540 /* 0x55 */ {SCSI_SPC_MODESELECT10
, "Mode Select(10)"},
541 /* 0x56 */ {SCSI_SPC_RESERVE10
, "Reserve(10)"},
542 /* 0x57 */ {SCSI_SPC_RELEASE10
, "Release(10)"},
543 /* 0x5A */ {SCSI_SPC_MODESENSE10
, "Mode Sense(10)"},
544 /* 0x5E */ {SCSI_SPC_PERSRESVIN
, "Persistent Reserve In"},
545 /* 0x5F */ {SCSI_SPC_PERSRESVOUT
, "Persistent Reserve Out"},
546 /* 0x86 */ {SCSI_SPC_ACCESS_CONTROL_IN
, "Access Control In"},
547 /* 0x87 */ {SCSI_SPC_ACCESS_CONTROL_OUT
, "Access Control Out"},
548 /* 0x8C */ {SCSI_SMC_READ_ATTRIBUTE
, "Read Attribute"},
549 /* 0x8D */ {SCSI_SMC_WRITE_ATTRIBUTE
, "Write Attribute"},
550 /* 0xA0 */ {SCSI_SPC_REPORTLUNS
, "Report LUNs"},
551 /* 0xA3 */ {SCSI_SPC_MGMT_PROTOCOL_IN
, "Mgmt Protocol In"},
552 /* 0xA5 */ {SCSI_SMC_MOVE_MEDIUM
, "Move Medium"},
553 /* 0xA7 */ {SCSI_SMC_MOVE_MEDIUM_ATTACHED
, "Move Medium Attached"},
554 /* 0xB4 */ {SCSI_SMC_READ_ELEMENT_STATUS_ATTACHED
, "Read Element Status Attached"},
555 /* 0xB5 */ {SCSI_SMC_REQUEST_VOLUME_ELEMENT_ADDRESS
, "Request Volume Element Address"},
556 /* 0xB6 */ {SCSI_SMC_SEND_VOLUME_TAG
, "Send Volume Tag"},
557 /* 0xB8 */ {SCSI_SMC_READ_ELEMENT_STATUS
, "Read Element Status"},
560 value_string_ext scsi_smc_vals_ext
= VALUE_STRING_EXT_INIT(scsi_smc_vals
);
562 const scsi_cdb_table_t scsi_smc_table
[256] = {
563 /*SPC 0x00*/{dissect_spc_testunitready
},
566 /*SPC 0x03*/{dissect_spc_requestsense
},
570 /*SMC 0x07*/{dissect_smc_initialize_element_status
},
581 /*SPC 0x12*/{dissect_spc_inquiry
},
584 /*SPC 0x15*/{dissect_spc_modeselect6
},
585 /*SPC 0x16*/{dissect_spc_reserve6
},
586 /*SPC 0x17*/{dissect_spc_release6
},
589 /*SPC 0x1a*/{dissect_spc_modesense6
},
590 /*SMC 0x1b*/{dissect_smc_openclose_importexport_element
},
592 /*SPC 0x1d*/{dissect_spc_senddiagnostic
},
593 /*SMC 0x1e*/{dissect_spc_preventallowmediaremoval
},
606 /*SMC 0x2b*/{dissect_smc_position_to_element
},
618 /*SMC 0x37*/{dissect_smc_initialize_element_status_with_range
},
622 /*SPC 0x3b*/{dissect_spc_writebuffer
},
639 /*SPC 0x4c*/{dissect_spc_logselect
},
640 /*SPC 0x4d*/{dissect_spc_logsense
},
648 /*SPC 0x55*/{dissect_spc_modeselect10
},
649 /*SPC 0x56*/{dissect_spc_reserve10
},
650 /*SPC 0x57*/{dissect_spc_release10
},
653 /*SPC 0x5a*/{dissect_spc_modesense10
},
657 /*SPC 0x5e*/{dissect_spc_persistentreservein
},
658 /*SPC 0x5f*/{dissect_spc_persistentreserveout
},
723 /*SPC 0xa0*/{dissect_spc_reportluns
},
726 /*SPC 0xa3*/{dissect_spc_mgmt_protocol_in
},
728 /*SMC 0xa5*/{dissect_smc_movemedium
},
729 /*SMC 0xa6*/{dissect_smc_exchangemedium
},
730 /*SMC 0xa7*/{dissect_smc_movemedium
},
743 /*SMC 0xb4*/{dissect_smc_readelementstatus
},
747 /*SMC 0xb8*/{dissect_smc_readelementstatus
},
823 proto_register_scsi_smc(void)
825 static hf_register_info hf
[] = {
826 { &hf_scsi_smc_opcode
,
827 {"SMC Opcode", "scsi_smc.opcode",
828 FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, &scsi_smc_vals_ext
, 0x0,
832 {"Medium Transport Address", "scsi_smc.mta",
833 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
837 {"Source Address", "scsi_smc.sa",
838 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
842 {"Destination Address", "scsi_smc.da",
843 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
847 {"First Destination Address", "scsi_smc.fda",
848 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
852 {"Second Destination Address", "scsi_smc.sda",
853 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
856 { &hf_scsi_smc_medium_flags
,
857 {"Flags", "scsi_smc.medium_flags",
858 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
862 {"INV1", "scsi_smc.inv1",
863 FT_BOOLEAN
, 8, NULL
, 0x02,
867 {"INV2", "scsi_smc.inv2",
868 FT_BOOLEAN
, 8, NULL
, 0x01,
871 { &hf_scsi_smc_range_flags
,
872 {"Flags", "scsi_smc.range_flags",
873 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
877 {"FAST", "scsi_smc.fast",
878 FT_BOOLEAN
, 8, NULL
, 0x02,
881 { &hf_scsi_smc_range
,
882 {"RANGE", "scsi_smc.range",
883 FT_BOOLEAN
, 8, NULL
, 0x01,
888 {"Starting Element Address", "scsi_smc.sea",
889 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
893 { &hf_scsi_smc_num_elements
,
894 {"Number of Elements", "scsi_smc.num_elements",
895 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
898 { &hf_scsi_smc_invert
,
899 {"INVERT", "scsi_smc.invert",
900 FT_BOOLEAN
, 8, NULL
, 0x01,
904 {"Element Address", "scsi_smc.ea",
905 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
908 { &hf_scsi_smc_action_code
,
909 {"Action Code", "scsi_smc.action_code",
910 FT_UINT8
, BASE_HEX
, VALS(action_code_vals
), 0x1f,
914 /* Generated from convert_proto_tree_add_text.pl */
915 { &hf_scsi_smc_scsi_bus_address
,
916 { "SCSI Bus Address", "scsi_smc.scsi_bus_address",
917 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
920 { &hf_scsi_smc_source_storage_element_address
,
921 { "Source Storage Element Address", "scsi_smc.source_storage_element_address",
922 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
925 { &hf_scsi_smc_code_set
,
926 { "Code Set", "scsi_smc.code_set",
927 FT_UINT8
, BASE_DEC
, VALS(scsi_devid_codeset_val
), 0x0F,
930 { &hf_scsi_smc_identifier_type
,
931 { "Identifier Type", "scsi_smc.identifier_type",
932 FT_UINT8
, BASE_DEC
, VALS(scsi_devid_idtype_val
), 0x0F,
935 { &hf_scsi_smc_identifier_length
,
936 { "Identifier Length", "scsi_smc.identifier_length",
937 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
940 { &hf_scsi_smc_identifier
,
941 { "Identifier", "scsi_smc.identifier",
942 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
945 { &hf_scsi_smc_vendor_specific_data
,
946 { "Vendor-specific Data", "scsi_smc.vendor_specific_data",
947 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
950 { &hf_scsi_smc_voltag
,
951 { "VOLTAG", "scsi_smc.voltag",
952 FT_BOOLEAN
, 8, NULL
, 0x10,
955 { &hf_scsi_smc_starting_element_address
,
956 { "Starting Element Address", "scsi_smc.starting_element_address",
957 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
960 { &hf_scsi_smc_number_of_elements
,
961 { "Number of Elements", "scsi_smc.number_of_elements",
962 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
965 { &hf_scsi_smc_curdata
,
966 { "CURDATA", "scsi_smc.curdata",
967 FT_BOOLEAN
, 8, NULL
, 0x02,
970 { &hf_scsi_smc_allocation_length
,
971 { "Allocation Length", "scsi_smc.allocation_length",
972 FT_UINT24
, BASE_DEC
, NULL
, 0x0,
975 { &hf_scsi_smc_first_element_address_reported
,
976 { "First Element Address Reported", "scsi_smc.first_element_address_reported",
977 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
980 { &hf_scsi_smc_number_of_elements_available
,
981 { "Number of Elements Available", "scsi_smc.number_of_elements_available",
982 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
985 { &hf_scsi_smc_byte_count_of_report_available
,
986 { "Byte Count of Report Available", "scsi_smc.byte_count_of_report_available",
987 FT_UINT24
, BASE_DEC
, NULL
, 0x0,
990 { &hf_scsi_smc_element_type_code
,
991 { "Element Type Code", "scsi_smc.element_type_code",
992 FT_UINT8
, BASE_DEC
, VALS(element_type_code_vals
), 0x0,
995 { &hf_scsi_smc_element_type_code_0F
,
996 { "Element Type Code", "scsi_smc.element_type_code",
997 FT_UINT8
, BASE_DEC
, VALS(element_type_code_vals
), 0x0F,
1000 { &hf_scsi_smc_pvoltag
,
1001 { "PVOLTAG", "scsi_smc.pvoltag",
1002 FT_BOOLEAN
, 8, NULL
, PVOLTAG
,
1005 { &hf_scsi_smc_element_descriptor_length
,
1006 { "Element Descriptor Length", "scsi_smc.element_descriptor_length",
1007 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1010 { &hf_scsi_smc_byte_count_of_descriptor_data_available
,
1011 { "Byte Count Of Descriptor Data Available", "scsi_smc.byte_count_of_descriptor_data_available",
1012 FT_UINT24
, BASE_DEC
, NULL
, 0x0,
1015 { &hf_scsi_smc_except
,
1016 { "EXCEPT", "scsi_smc.except",
1017 FT_BOOLEAN
, 8, NULL
, EXCEPT
,
1020 { &hf_scsi_smc_access
,
1021 { "ACCESS", "scsi_smc.access",
1022 FT_BOOLEAN
, 8, NULL
, 0x08,
1026 { "cmc", "scsi_smc.cmc",
1027 FT_BOOLEAN
, 8, NULL
, 0x40,
1030 { &hf_scsi_smc_additional_sense_code_qualifier
,
1031 { "Additional Sense Code+Qualifier", "scsi_smc.additional_sense_code_qualifier",
1032 FT_UINT16
, BASE_HEX
|BASE_EXT_STRING
, &scsi_asc_val_ext
, 0x0,
1035 { &hf_scsi_smc_not_bus
,
1036 { "NOT BUS", "scsi_smc.not_bus",
1037 FT_BOOLEAN
, 8, NULL
, 0x80,
1040 { &hf_scsi_smc_id_valid
,
1041 { "ID VALID", "scsi_smc.id_valid",
1042 FT_BOOLEAN
, 8, NULL
, ID_VALID
,
1045 { &hf_scsi_smc_lu_valid
,
1046 { "LU VALID", "scsi_smc.lu_valid",
1047 FT_BOOLEAN
, 8, NULL
, LU_VALID
,
1050 { &hf_scsi_smc_svalid
,
1051 { "SVALID", "scsi_smc.svalid",
1052 FT_BOOLEAN
, 8, NULL
, SVALID
,
1055 { &hf_scsi_smc_dvcid
,
1056 { "DVCID", "scsi_smc.dvcid",
1057 FT_BOOLEAN
, 8, NULL
, 0x01,
1060 { &hf_scsi_smc_avoltag
,
1061 { "AVOLTAG", "scsi_smc.pvoltag",
1062 FT_BOOLEAN
, 8, NULL
, AVOLTAG
,
1065 { &hf_scsi_smc_full
,
1066 { "FULL", "scsi_smc.full",
1067 FT_BOOLEAN
, 8, NULL
, 0x01,
1070 { &hf_scsi_smc_exenab
,
1071 { "EXENAB", "scsi_smc.exenab",
1072 FT_BOOLEAN
, 8, NULL
, 0x10,
1075 { &hf_scsi_smc_inenab
,
1076 { "INENAB", "scsi_smc.inenab",
1077 FT_BOOLEAN
, 8, NULL
, 0x20,
1080 { &hf_scsi_smc_impexp
,
1081 { "IMPEXP", "scsi_smc.impexp",
1082 FT_BOOLEAN
, 8, NULL
, 0x02,
1086 { "LUN", "scsi_smc.lun",
1087 FT_UINT8
, BASE_DEC
, NULL
, 0x07,
1090 { &hf_scsi_smc_primary_vol_tag_id
,
1091 { "Primary Volume Identification", "scsi_smc.primary_vol_tag_id",
1092 FT_STRING
, BASE_NONE
, NULL
, 0x0,
1095 { &hf_scsi_smc_alternate_vol_tag_id
,
1096 { "Alternate Volume Identification", "scsi_smc.alternate_vol_tag_id",
1097 FT_STRING
, BASE_NONE
, NULL
, 0x0,
1100 { &hf_scsi_smc_primary_vol_seq_num
,
1101 { "Primary Volume Sequence Number", "scsi_smc.primary_vol_seq_num",
1102 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1105 { &hf_scsi_smc_alternate_vol_seq_num
,
1106 { "Alternate Volume Sequence Number", "scsi_smc.alternate_vol_seq_num",
1107 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1113 /* Setup protocol subtree array */
1114 static int *ett
[] = {
1115 &ett_scsi_exchange_medium
,
1120 /* Register the protocol name and description */
1121 proto_scsi_smc
= proto_register_protocol("SCSI_SMC", "SCSI_SMC", "scsi_smc");
1123 /* Required function calls to register the header fields and subtrees used */
1124 proto_register_field_array(proto_scsi_smc
, hf
, array_length(hf
));
1126 proto_register_subtree_array(ett
, array_length(ett
));
1130 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1135 * indent-tabs-mode: nil
1138 * vi: set shiftwidth=4 tabstop=8 expandtab:
1139 * :indentSize=4:tabSize=8:noTabs=true: