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)
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 2002 Gerald Combs
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include <epan/packet.h>
34 #include <epan/conversation.h>
36 #include "packet-scsi.h"
37 #include "packet-fc.h"
38 #include "packet-scsi-smc.h"
41 static int proto_scsi_smc
= -1;
42 int hf_scsi_smc_opcode
= -1;
43 static int hf_scsi_smc_mta
= -1;
44 static int hf_scsi_smc_sa
= -1;
45 static int hf_scsi_smc_da
= -1;
46 static int hf_scsi_smc_fda
= -1;
47 static int hf_scsi_smc_sda
= -1;
48 static int hf_scsi_smc_medium_flags
= -1;
49 static int hf_scsi_smc_inv1
= -1;
50 static int hf_scsi_smc_inv2
= -1;
51 static int hf_scsi_smc_range_flags
= -1;
52 static int hf_scsi_smc_fast
= -1;
53 static int hf_scsi_smc_range
= -1;
54 /* static int hf_scsi_smc_sea = -1; */
55 static int hf_scsi_smc_num_elements
= -1;
56 static int hf_scsi_smc_invert
= -1;
57 static int hf_scsi_smc_ea
= -1;
58 static int hf_scsi_smc_action_code
= -1;
59 /* Generated from convert_proto_tree_add_text.pl */
60 static int hf_scsi_smc_allocation_length
= -1;
61 static int hf_scsi_smc_first_element_address_reported
= -1;
62 static int hf_scsi_smc_voltag
= -1;
63 static int hf_scsi_smc_element_descriptor_length
= -1;
64 static int hf_scsi_smc_byte_count_of_descriptor_data_available
= -1;
65 static int hf_scsi_smc_pvoltag
= -1;
66 static int hf_scsi_smc_code_set
= -1;
67 static int hf_scsi_smc_starting_element_address
= -1;
68 static int hf_scsi_smc_curdata
= -1;
69 static int hf_scsi_smc_element_type_code
= -1;
70 static int hf_scsi_smc_element_type_code_0F
= -1;
71 static int hf_scsi_smc_identifier
= -1;
72 static int hf_scsi_smc_vendor_specific_data
= -1;
73 static int hf_scsi_smc_source_storage_element_address
= -1;
74 static int hf_scsi_smc_number_of_elements_available
= -1;
75 static int hf_scsi_smc_identifier_type
= -1;
76 static int hf_scsi_smc_number_of_elements
= -1;
77 static int hf_scsi_smc_identifier_length
= -1;
78 static int hf_scsi_smc_scsi_bus_address
= -1;
79 static int hf_scsi_smc_byte_count_of_report_available
= -1;
80 static int hf_scsi_smc_cmc
= -1;
81 static int hf_scsi_smc_svalid
= -1;
82 static int hf_scsi_smc_avoltag
= -1;
83 static int hf_scsi_smc_access
= -1;
84 static int hf_scsi_smc_additional_sense_code_qualifier
= -1;
85 static int hf_scsi_smc_lu_valid
= -1;
86 static int hf_scsi_smc_dvcid
= -1;
87 static int hf_scsi_smc_except
= -1;
88 static int hf_scsi_smc_id_valid
= -1;
89 static int hf_scsi_smc_not_bus
= -1;
90 static int hf_scsi_smc_exenab
= -1;
91 static int hf_scsi_smc_lun
= -1;
92 static int hf_scsi_smc_inenab
= -1;
93 static int hf_scsi_smc_full
= -1;
94 static int hf_scsi_smc_impexp
= -1;
95 static int hf_scsi_smc_primary_vol_tag_id
= -1;
96 static int hf_scsi_smc_primary_vol_seq_num
= -1;
97 static int hf_scsi_smc_alternate_vol_tag_id
= -1;
98 static int hf_scsi_smc_alternate_vol_seq_num
= -1;
100 static gint ett_scsi_exchange_medium
= -1;
101 static gint ett_scsi_range
= -1;
102 static gint ett_scsi_move
= -1;
105 dissect_smc_exchangemedium (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
106 guint offset
, gboolean isreq
, gboolean iscdb
,
107 guint payload_len _U_
, scsi_task_data_t
*cdata _U_
)
109 static const int *exchg_fields
[] = {
118 if (isreq
&& iscdb
) {
119 proto_tree_add_item (tree
, hf_scsi_smc_mta
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
120 proto_tree_add_item (tree
, hf_scsi_smc_sa
, tvb
, offset
+3, 2, ENC_BIG_ENDIAN
);
121 proto_tree_add_item (tree
, hf_scsi_smc_fda
, tvb
, offset
+5, 2, ENC_BIG_ENDIAN
);
122 proto_tree_add_item (tree
, hf_scsi_smc_sda
, tvb
, offset
+7, 2, ENC_BIG_ENDIAN
);
123 proto_tree_add_bitmask(tree
, tvb
, offset
+9, hf_scsi_smc_medium_flags
,
124 ett_scsi_exchange_medium
, exchg_fields
, ENC_BIG_ENDIAN
);
125 proto_tree_add_bitmask(tree
, tvb
, offset
+10, hf_scsi_control
,
126 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
131 dissect_smc_position_to_element (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
132 guint offset
, gboolean isreq
, gboolean iscdb
,
133 guint payload_len _U_
, scsi_task_data_t
*cdata _U_
)
135 static const int *pte_fields
[] = {
143 if (isreq
&& iscdb
) {
144 proto_tree_add_item (tree
, hf_scsi_smc_mta
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
145 proto_tree_add_item (tree
, hf_scsi_smc_da
, tvb
, offset
+3, 2, ENC_BIG_ENDIAN
);
146 proto_tree_add_bitmask(tree
, tvb
, offset
+7, hf_scsi_smc_medium_flags
,
147 ett_scsi_exchange_medium
, pte_fields
, ENC_BIG_ENDIAN
);
148 proto_tree_add_bitmask(tree
, tvb
, offset
+8, hf_scsi_control
,
149 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
154 dissect_smc_initialize_element_status (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
155 guint offset
, gboolean isreq
, gboolean iscdb
,
156 guint payload_len _U_
, scsi_task_data_t
*cdata _U_
)
161 if (isreq
&& iscdb
) {
162 proto_tree_add_bitmask(tree
, tvb
, offset
+4, hf_scsi_control
,
163 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
168 dissect_smc_initialize_element_status_with_range (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
169 guint offset
, gboolean isreq
, gboolean iscdb
,
170 guint payload_len _U_
, scsi_task_data_t
*cdata _U_
)
172 static const int *range_fields
[] = {
181 if (isreq
&& iscdb
) {
182 proto_tree_add_bitmask(tree
, tvb
, offset
, hf_scsi_smc_range_flags
,
183 ett_scsi_range
, range_fields
, ENC_BIG_ENDIAN
);
184 proto_tree_add_item (tree
, hf_scsi_smc_sa
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
185 proto_tree_add_item (tree
, hf_scsi_smc_num_elements
, tvb
, offset
+5, 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
);
192 dissect_smc_openclose_importexport_element (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
193 guint offset
, gboolean isreq
, gboolean iscdb
,
194 guint payload_len _U_
, scsi_task_data_t
*cdata _U_
)
199 if (isreq
&& iscdb
) {
200 proto_tree_add_item (tree
, hf_scsi_smc_ea
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
201 proto_tree_add_item (tree
, hf_scsi_smc_action_code
, tvb
, offset
+3, 1, ENC_BIG_ENDIAN
);
202 proto_tree_add_bitmask(tree
, tvb
, offset
+4, hf_scsi_control
,
203 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
207 dissect_smc_movemedium (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
,
208 guint offset
, gboolean isreq
, gboolean iscdb
,
209 guint payload_len _U_
, scsi_task_data_t
*cdata _U_
)
211 static const int *move_fields
[] = {
219 if (isreq
&& iscdb
) {
220 proto_tree_add_item (tree
, hf_scsi_smc_mta
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
221 proto_tree_add_item (tree
, hf_scsi_smc_sa
, tvb
, offset
+3, 2, ENC_BIG_ENDIAN
);
222 proto_tree_add_item (tree
, hf_scsi_smc_da
, tvb
, offset
+5, 2, ENC_BIG_ENDIAN
);
223 proto_tree_add_bitmask(tree
, tvb
, offset
+9, hf_scsi_smc_range_flags
,
224 ett_scsi_move
, move_fields
, ENC_BIG_ENDIAN
);
225 proto_tree_add_bitmask(tree
, tvb
, offset
+10, hf_scsi_control
,
226 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
235 static const value_string element_type_code_vals
[] = {
236 {0x0, "All element types"},
237 {MT_ELEM
, "Medium transport element"},
238 {ST_ELEM
, "Storage element"},
239 {I_E_ELEM
, "Import/export element"},
240 {DT_ELEM
, "Data transfer element"},
244 static const value_string action_code_vals
[] = {
245 {0, "OPEN Import/Export Element"},
246 {1, "CLOSE Import/Export Element"},
255 #define ID_VALID 0x20
256 #define LU_VALID 0x10
261 dissect_scsi_smc_volume_tag (tvbuff_t
*tvb
, packet_info
*pinfo _U_
,
262 proto_tree
*tree
, guint offset
, int hf_vol_id
, int hf_vol_seq_num
)
267 tvb_memcpy (tvb
, (guint8
*)volid
, offset
, 32);
278 proto_tree_add_string(tree
, hf_vol_id
, tvb
, offset
, 32, volid
);
279 proto_tree_add_item(tree
, hf_vol_seq_num
, tvb
, offset
+34, 2, ENC_BIG_ENDIAN
);
284 dissect_scsi_smc_element (tvbuff_t
*tvb
, packet_info
*pinfo _U_
,
285 proto_tree
*tree
, guint offset
,
286 guint elem_bytecnt
, guint8 elem_type
,
292 proto_tree_add_item(tree
, hf_scsi_smc_ea
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
296 if (elem_bytecnt
< 1)
298 flags
= tvb_get_guint8 (tvb
, offset
);
302 proto_tree_add_item(tree
, hf_scsi_smc_except
, tvb
, offset
, 1, ENC_NA
);
303 proto_tree_add_item(tree
, hf_scsi_smc_full
, tvb
, offset
, 1, ENC_NA
);
308 proto_tree_add_item(tree
, hf_scsi_smc_access
, tvb
, offset
, 1, ENC_NA
);
309 proto_tree_add_item(tree
, hf_scsi_smc_except
, tvb
, offset
, 1, ENC_NA
);
310 proto_tree_add_item(tree
, hf_scsi_smc_full
, tvb
, offset
, 1, ENC_NA
);
314 proto_tree_add_item(tree
, hf_scsi_smc_cmc
, tvb
, offset
, 1, ENC_NA
);
315 proto_tree_add_item(tree
, hf_scsi_smc_inenab
, tvb
, offset
, 1, ENC_NA
);
316 proto_tree_add_item(tree
, hf_scsi_smc_exenab
, tvb
, offset
, 1, ENC_NA
);
317 proto_tree_add_item(tree
, hf_scsi_smc_impexp
, tvb
, offset
, 1, ENC_NA
);
318 proto_tree_add_item(tree
, hf_scsi_smc_access
, tvb
, offset
, 1, ENC_NA
);
319 proto_tree_add_item(tree
, hf_scsi_smc_except
, tvb
, offset
, 1, ENC_NA
);
320 proto_tree_add_item(tree
, hf_scsi_smc_full
, tvb
, offset
, 1, ENC_NA
);
326 if (elem_bytecnt
< 1)
328 offset
+= 1; /* reserved */
331 if (elem_bytecnt
< 2)
333 if (flags
& EXCEPT
) {
334 proto_tree_add_item(tree
, hf_scsi_smc_additional_sense_code_qualifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
339 if (elem_bytecnt
< 3)
344 flags
= tvb_get_guint8 (tvb
, offset
);
345 if (flags
& LU_VALID
) {
346 proto_tree_add_item(tree
, hf_scsi_smc_lun
, tvb
, offset
, 1, ENC_NA
);
348 proto_tree_add_item(tree
, hf_scsi_smc_not_bus
, tvb
, offset
, 1, ENC_NA
);
349 proto_tree_add_item(tree
, hf_scsi_smc_id_valid
, tvb
, offset
, 1, ENC_NA
);
350 proto_tree_add_item(tree
, hf_scsi_smc_lu_valid
, tvb
, offset
, 1, ENC_NA
);
353 if (flags
& ID_VALID
) {
354 proto_tree_add_item(tree
, hf_scsi_smc_scsi_bus_address
, tvb
, offset
, 1, ENC_NA
);
357 offset
+= 1; /* reserved */
361 offset
+= 3; /* reserved */
366 if (elem_bytecnt
< 3)
368 flags
= tvb_get_guint8 (tvb
, offset
);
369 proto_tree_add_item(tree
, hf_scsi_smc_svalid
, tvb
, offset
, 1, ENC_NA
);
370 if (flags
& SVALID
) {
371 proto_tree_add_item(tree
, hf_scsi_smc_invert
, tvb
, offset
, 1, ENC_NA
);
373 proto_tree_add_item(tree
, hf_scsi_smc_source_storage_element_address
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
380 if (voltag_flags
& PVOLTAG
) {
381 if (elem_bytecnt
< 36)
383 dissect_scsi_smc_volume_tag (tvb
, pinfo
, tree
, offset
, hf_scsi_smc_primary_vol_tag_id
,
384 hf_scsi_smc_primary_vol_seq_num
);
389 if (voltag_flags
& AVOLTAG
) {
390 if (elem_bytecnt
< 36)
392 dissect_scsi_smc_volume_tag (tvb
, pinfo
, tree
, offset
, hf_scsi_smc_alternate_vol_tag_id
,
393 hf_scsi_smc_alternate_vol_seq_num
);
398 if (elem_bytecnt
< 1)
400 proto_tree_add_item(tree
, hf_scsi_smc_code_set
, tvb
, offset
, 1, ENC_NA
);
404 if (elem_bytecnt
< 1)
406 proto_tree_add_item(tree
, hf_scsi_smc_identifier_type
, tvb
, offset
, 1, ENC_NA
);
410 if (elem_bytecnt
< 1)
412 offset
+= 1; /* reserved */
415 if (elem_bytecnt
< 1)
417 ident_len
= tvb_get_guint8 (tvb
, offset
);
418 proto_tree_add_item(tree
, hf_scsi_smc_identifier_length
, tvb
, offset
, 1, ENC_NA
);
422 if (ident_len
!= 0) {
423 if (elem_bytecnt
< ident_len
)
425 proto_tree_add_item(tree
, hf_scsi_smc_identifier
, tvb
, offset
, ident_len
, ENC_NA
);
427 elem_bytecnt
-= ident_len
;
429 if (elem_bytecnt
!= 0) {
430 proto_tree_add_item(tree
, hf_scsi_smc_vendor_specific_data
, tvb
, offset
, elem_bytecnt
, ENC_NA
);
436 dissect_scsi_smc_elements (tvbuff_t
*tvb
, packet_info
*pinfo
,
437 proto_tree
*tree
, guint offset
,
438 guint desc_bytecnt
, guint8 elem_type
,
439 guint8 voltag_flags
, guint16 elem_desc_len
)
443 while (desc_bytecnt
!= 0) {
444 elem_bytecnt
= elem_desc_len
;
446 if (elem_bytecnt
> desc_bytecnt
)
447 elem_bytecnt
= desc_bytecnt
;
449 if (elem_bytecnt
< 2)
452 dissect_scsi_smc_element (tvb
, pinfo
, tree
, offset
, elem_bytecnt
,
453 elem_type
, voltag_flags
);
454 offset
+= elem_bytecnt
;
455 desc_bytecnt
-= elem_bytecnt
;
461 dissect_smc_readelementstatus (tvbuff_t
*tvb
, packet_info
*pinfo
,
462 proto_tree
*tree
, guint offset
, gboolean isreq
,
464 guint payload_len _U_
, scsi_task_data_t
*cdata _U_
)
466 guint bytecnt
, desc_bytecnt
;
469 guint16 elem_desc_len
;
474 if (isreq
&& iscdb
) {
475 proto_tree_add_item(tree
, hf_scsi_smc_voltag
, tvb
, offset
, 1, ENC_NA
);
476 proto_tree_add_item(tree
, hf_scsi_smc_element_type_code_0F
, tvb
, offset
, 1, ENC_NA
);
477 proto_tree_add_item(tree
, hf_scsi_smc_starting_element_address
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
478 proto_tree_add_item(tree
, hf_scsi_smc_number_of_elements
, tvb
, offset
+3, 2, ENC_BIG_ENDIAN
);
479 proto_tree_add_item(tree
, hf_scsi_smc_curdata
, tvb
, offset
+4, 1, ENC_NA
);
480 proto_tree_add_item(tree
, hf_scsi_smc_dvcid
, tvb
, offset
+4, 1, ENC_NA
);
481 proto_tree_add_item(tree
, hf_scsi_smc_allocation_length
, tvb
, offset
+6, 3, ENC_BIG_ENDIAN
);
482 proto_tree_add_bitmask(tree
, tvb
, offset
+10, hf_scsi_control
,
483 ett_scsi_control
, cdb_control_fields
, ENC_BIG_ENDIAN
);
486 proto_tree_add_item(tree
, hf_scsi_smc_first_element_address_reported
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
488 proto_tree_add_item(tree
, hf_scsi_smc_number_of_elements_available
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
490 offset
+= 1; /* reserved */
491 bytecnt
= tvb_get_ntoh24 (tvb
, offset
);
492 proto_tree_add_item(tree
, hf_scsi_smc_byte_count_of_report_available
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
494 while (bytecnt
!= 0) {
497 elem_type
= tvb_get_guint8 (tvb
, offset
);
498 proto_tree_add_item(tree
, hf_scsi_smc_element_type_code
, tvb
, offset
, 1, ENC_NA
);
504 voltag_flags
= tvb_get_guint8 (tvb
, offset
);
505 proto_tree_add_item(tree
, hf_scsi_smc_pvoltag
, tvb
, offset
, 1, ENC_NA
);
506 proto_tree_add_item(tree
, hf_scsi_smc_avoltag
, tvb
, offset
, 1, ENC_NA
);
512 elem_desc_len
= tvb_get_ntohs (tvb
, offset
);
513 proto_tree_add_item(tree
, hf_scsi_smc_element_descriptor_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
519 offset
+= 1; /* reserved */
524 desc_bytecnt
= tvb_get_ntoh24 (tvb
, offset
);
525 proto_tree_add_item(tree
, hf_scsi_smc_byte_count_of_descriptor_data_available
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
529 if (desc_bytecnt
> bytecnt
)
530 desc_bytecnt
= bytecnt
;
531 dissect_scsi_smc_elements (tvb
, pinfo
, tree
, offset
,
532 desc_bytecnt
, elem_type
,
533 voltag_flags
, elem_desc_len
);
534 offset
+= desc_bytecnt
;
535 bytecnt
-= desc_bytecnt
;
543 const value_string scsi_smc_vals
[] = {
544 {SCSI_SPC_ACCESS_CONTROL_IN
, "Access Control In"},
545 {SCSI_SPC_ACCESS_CONTROL_OUT
, "Access Control Out"},
546 {SCSI_SMC_EXCHANGE_MEDIUM
, "Exchange Medium"},
547 {SCSI_SMC_INITIALIZE_ELEMENT_STATUS
, "Initialize Element Status"},
548 {SCSI_SMC_INITIALIZE_ELEMENT_STATUS_RANGE
, "Initialize Element Status With Range"},
549 {SCSI_SPC_INQUIRY
, "Inquiry"},
550 {SCSI_SPC_LOGSELECT
, "Log Select"},
551 {SCSI_SPC_LOGSENSE
, "Log Sense"},
552 {SCSI_SPC_MGMT_PROTOCOL_IN
, "Mgmt Protocol In"},
553 {SCSI_SPC_MODESELECT6
, "Mode Select(6)"},
554 {SCSI_SPC_MODESELECT10
, "Mode Select(10)"},
555 {SCSI_SPC_MODESENSE6
, "Mode Sense(6)"},
556 {SCSI_SPC_MODESENSE10
, "Mode Sense(10)"},
557 {SCSI_SMC_MOVE_MEDIUM
, "Move Medium"},
558 {SCSI_SMC_MOVE_MEDIUM_ATTACHED
, "Move Medium Attached"},
559 {SCSI_SMC_OPENCLOSE_ELEMENT
, "Open/Close Import/Export Element"},
560 {SCSI_SPC_PERSRESVIN
, "Persistent Reserve In"},
561 {SCSI_SPC_PERSRESVOUT
, "Persistent Reserve Out"},
562 {SCSI_SMC_POSITION_TO_ELEMENT
, "Position To Element"},
563 {SCSI_SPC_PREVMEDREMOVAL
, "Prevent/Allow Medium Removal"},
564 {SCSI_SMC_READ_ATTRIBUTE
, "Read Attribute"},
565 {SCSI_SPC_READBUFFER
, "Read Buffer"},
566 {SCSI_SMC_READ_ELEMENT_STATUS
, "Read Element Status"},
567 {SCSI_SMC_READ_ELEMENT_STATUS_ATTACHED
, "Read Element Status Attached"},
568 {SCSI_SPC_RCVDIAGRESULTS
, "Receive Diagnostics Results"},
569 {SCSI_SPC_RELEASE6
, "Release(6)"},
570 {SCSI_SPC_RELEASE10
, "Release(10)"},
571 {SCSI_SPC_REPORTLUNS
, "Report LUNs"},
572 {SCSI_SMC_REPORT_VOLUME_TYPES_SUPPORTED
, "Report Volume Types Supported"},
573 {SCSI_SPC_REQSENSE
, "Request Sense"},
574 {SCSI_SMC_REQUEST_VOLUME_ELEMENT_ADDRESS
, "Request Volume Element Address"},
575 {SCSI_SPC_RESERVE6
, "Reserve(6)"},
576 {SCSI_SPC_RESERVE10
, "Reserve(10)"},
577 {SCSI_SMC_SEND_VOLUME_TAG
, "Send Volume Tag"},
578 {SCSI_SPC_SENDDIAG
, "Send Diagnostic"},
579 {SCSI_SPC_TESTUNITRDY
, "Test Unit Ready"},
580 {SCSI_SMC_WRITE_ATTRIBUTE
, "Write Attribute"},
581 {SCSI_SPC_WRITEBUFFER
, "Write Buffer"},
585 scsi_cdb_table_t scsi_smc_table
[256] = {
586 /*SPC 0x00*/{dissect_spc_testunitready
},
589 /*SPC 0x03*/{dissect_spc_requestsense
},
593 /*SMC 0x07*/{dissect_smc_initialize_element_status
},
604 /*SPC 0x12*/{dissect_spc_inquiry
},
607 /*SPC 0x15*/{dissect_spc_modeselect6
},
608 /*SPC 0x16*/{dissect_spc_reserve6
},
609 /*SPC 0x17*/{dissect_spc_release6
},
612 /*SPC 0x1a*/{dissect_spc_modesense6
},
613 /*SMC 0x1b*/{dissect_smc_openclose_importexport_element
},
615 /*SPC 0x1d*/{dissect_spc_senddiagnostic
},
616 /*SMC 0x1e*/{dissect_spc_preventallowmediaremoval
},
629 /*SMC 0x2b*/{dissect_smc_position_to_element
},
641 /*SMC 0x37*/{dissect_smc_initialize_element_status_with_range
},
645 /*SPC 0x3b*/{dissect_spc_writebuffer
},
662 /*SPC 0x4c*/{dissect_spc_logselect
},
663 /*SPC 0x4d*/{dissect_spc_logsense
},
671 /*SPC 0x55*/{dissect_spc_modeselect10
},
672 /*SPC 0x56*/{dissect_spc_reserve10
},
673 /*SPC 0x57*/{dissect_spc_release10
},
676 /*SPC 0x5a*/{dissect_spc_modesense10
},
680 /*SPC 0x5e*/{dissect_spc_persistentreservein
},
681 /*SPC 0x5f*/{dissect_spc_persistentreserveout
},
746 /*SPC 0xa0*/{dissect_spc_reportluns
},
749 /*SPC 0xa3*/{dissect_spc_mgmt_protocol_in
},
751 /*SMC 0xa5*/{dissect_smc_movemedium
},
752 /*SMC 0xa6*/{dissect_smc_exchangemedium
},
753 /*SMC 0xa7*/{dissect_smc_movemedium
},
766 /*SMC 0xb4*/{dissect_smc_readelementstatus
},
770 /*SMC 0xb8*/{dissect_smc_readelementstatus
},
846 proto_register_scsi_smc(void)
848 static hf_register_info hf
[] = {
849 { &hf_scsi_smc_opcode
,
850 {"SMC Opcode", "scsi_smc.opcode", FT_UINT8
, BASE_HEX
,
851 VALS (scsi_smc_vals
), 0x0, NULL
, HFILL
}},
853 {"Medium Transport Address", "scsi_smc.mta", FT_UINT16
, BASE_DEC
,
854 NULL
, 0x0, NULL
, HFILL
}},
856 {"Source Address", "scsi_smc.sa", FT_UINT16
, BASE_DEC
,
857 NULL
, 0x0, NULL
, HFILL
}},
859 {"Destination Address", "scsi_smc.da", FT_UINT16
, BASE_DEC
,
860 NULL
, 0x0, NULL
, HFILL
}},
862 {"First Destination Address", "scsi_smc.fda", FT_UINT16
, BASE_DEC
,
863 NULL
, 0x0, NULL
, HFILL
}},
865 {"Second Destination Address", "scsi_smc.sda", FT_UINT16
, BASE_DEC
,
866 NULL
, 0x0, NULL
, HFILL
}},
867 { &hf_scsi_smc_medium_flags
,
868 {"Flags", "scsi_smc.medium_flags", FT_UINT8
, BASE_HEX
,
869 NULL
, 0x0, NULL
, HFILL
}},
871 {"INV1", "scsi_smc.inv1", FT_BOOLEAN
, 8,
872 NULL
, 0x02, NULL
, HFILL
}},
874 {"INV2", "scsi_smc.inv2", FT_BOOLEAN
, 8,
875 NULL
, 0x01, NULL
, HFILL
}},
876 { &hf_scsi_smc_range_flags
,
877 {"Flags", "scsi_smc.range_flags", FT_UINT8
, BASE_HEX
,
878 NULL
, 0x0, NULL
, HFILL
}},
880 {"FAST", "scsi_smc.fast", FT_BOOLEAN
, 8,
881 NULL
, 0x02, NULL
, HFILL
}},
882 { &hf_scsi_smc_range
,
883 {"RANGE", "scsi_smc.range", FT_BOOLEAN
, 8,
884 NULL
, 0x01, NULL
, HFILL
}},
887 {"Starting Element Address", "scsi_smc.sea", FT_UINT16
, BASE_DEC
,
888 NULL
, 0x0, NULL
, HFILL
}},
890 { &hf_scsi_smc_num_elements
,
891 {"Number of Elements", "scsi_smc.num_elements", FT_UINT16
, BASE_DEC
,
892 NULL
, 0x0, NULL
, HFILL
}},
893 { &hf_scsi_smc_invert
,
894 {"INVERT", "scsi_smc.invert", FT_BOOLEAN
, 8,
895 NULL
, 0x01, NULL
, HFILL
}},
897 {"Element Address", "scsi_smc.ea", FT_UINT16
, BASE_DEC
,
898 NULL
, 0x0, NULL
, HFILL
}},
899 { &hf_scsi_smc_action_code
,
900 {"Action Code", "scsi_smc.action_code", FT_UINT8
, BASE_HEX
,
901 VALS(action_code_vals
), 0x1f, NULL
, HFILL
}},
903 /* Generated from convert_proto_tree_add_text.pl */
904 { &hf_scsi_smc_scsi_bus_address
, { "SCSI Bus Address", "scsi_smc.scsi_bus_address", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
905 { &hf_scsi_smc_source_storage_element_address
, { "Source Storage Element Address", "scsi_smc.source_storage_element_address", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
906 { &hf_scsi_smc_code_set
, { "Code Set", "scsi_smc.code_set", FT_UINT8
, BASE_DEC
, VALS(scsi_devid_codeset_val
), 0x0F, NULL
, HFILL
}},
907 { &hf_scsi_smc_identifier_type
, { "Identifier Type", "scsi_smc.identifier_type", FT_UINT8
, BASE_DEC
, VALS(scsi_devid_idtype_val
), 0x0F, NULL
, HFILL
}},
908 { &hf_scsi_smc_identifier_length
, { "Identifier Length", "scsi_smc.identifier_length", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
909 { &hf_scsi_smc_identifier
, { "Identifier", "scsi_smc.identifier", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
910 { &hf_scsi_smc_vendor_specific_data
, { "Vendor-specific Data", "scsi_smc.vendor_specific_data", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
911 { &hf_scsi_smc_voltag
, { "VOLTAG", "scsi_smc.voltag", FT_BOOLEAN
, 8, NULL
, 0x10, NULL
, HFILL
}},
912 { &hf_scsi_smc_starting_element_address
, { "Starting Element Address", "scsi_smc.starting_element_address", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
913 { &hf_scsi_smc_number_of_elements
, { "Number of Elements", "scsi_smc.number_of_elements", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
914 { &hf_scsi_smc_curdata
, { "CURDATA", "scsi_smc.curdata", FT_BOOLEAN
, 8, NULL
, 0x02, NULL
, HFILL
}},
915 { &hf_scsi_smc_allocation_length
, { "Allocation Length", "scsi_smc.allocation_length", FT_UINT24
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
916 { &hf_scsi_smc_first_element_address_reported
, { "First Element Address Reported", "scsi_smc.first_element_address_reported", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
917 { &hf_scsi_smc_number_of_elements_available
, { "Number of Elements Available", "scsi_smc.number_of_elements_available", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
918 { &hf_scsi_smc_byte_count_of_report_available
, { "Byte Count of Report Available", "scsi_smc.byte_count_of_report_available", FT_UINT24
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
919 { &hf_scsi_smc_element_type_code
, { "Element Type Code", "scsi_smc.element_type_code", FT_UINT8
, BASE_DEC
, VALS(element_type_code_vals
), 0x0, NULL
, HFILL
}},
920 { &hf_scsi_smc_element_type_code_0F
, { "Element Type Code", "scsi_smc.element_type_code", FT_UINT8
, BASE_DEC
, VALS(element_type_code_vals
), 0x0F, NULL
, HFILL
}},
921 { &hf_scsi_smc_pvoltag
, { "PVOLTAG", "scsi_smc.pvoltag", FT_BOOLEAN
, 8, NULL
, PVOLTAG
, NULL
, HFILL
}},
922 { &hf_scsi_smc_element_descriptor_length
, { "Element Descriptor Length", "scsi_smc.element_descriptor_length", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
923 { &hf_scsi_smc_byte_count_of_descriptor_data_available
, { "Byte Count Of Descriptor Data Available", "scsi_smc.byte_count_of_descriptor_data_available", FT_UINT24
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
924 { &hf_scsi_smc_except
, { "EXCEPT", "scsi_smc.except", FT_BOOLEAN
, 8, NULL
, EXCEPT
, NULL
, HFILL
}},
925 { &hf_scsi_smc_access
, { "ACCESS", "scsi_smc.access", FT_BOOLEAN
, 8, NULL
, 0x08, NULL
, HFILL
}},
926 { &hf_scsi_smc_cmc
, { "cmc", "scsi_smc.cmc", FT_BOOLEAN
, 8, NULL
, 0x40, NULL
, HFILL
}},
927 { &hf_scsi_smc_additional_sense_code_qualifier
, { "Additional Sense Code+Qualifier", "scsi_smc.additional_sense_code_qualifier", FT_UINT16
, BASE_HEX
|BASE_EXT_STRING
, &scsi_asc_val_ext
, 0x0, NULL
, HFILL
}},
928 { &hf_scsi_smc_not_bus
, { "NOT BUS", "scsi_smc.not_bus", FT_BOOLEAN
, 8, NULL
, 0x80, NULL
, HFILL
}},
929 { &hf_scsi_smc_id_valid
, { "ID VALID", "scsi_smc.id_valid", FT_BOOLEAN
, 8, NULL
, ID_VALID
, NULL
, HFILL
}},
930 { &hf_scsi_smc_lu_valid
, { "LU VALID", "scsi_smc.lu_valid", FT_BOOLEAN
, 8, NULL
, LU_VALID
, NULL
, HFILL
}},
931 { &hf_scsi_smc_svalid
, { "SVALID", "scsi_smc.svalid", FT_BOOLEAN
, 8, NULL
, SVALID
, NULL
, HFILL
}},
932 { &hf_scsi_smc_dvcid
, { "DVCID", "scsi_smc.dvcid", FT_BOOLEAN
, 8, NULL
, 0x01, NULL
, HFILL
}},
933 { &hf_scsi_smc_avoltag
, { "AVOLTAG", "scsi_smc.pvoltag", FT_BOOLEAN
, 8, NULL
, AVOLTAG
, NULL
, HFILL
}},
934 { &hf_scsi_smc_full
, { "FULL", "scsi_smc.full", FT_BOOLEAN
, 8, NULL
, 0x01, NULL
, HFILL
}},
935 { &hf_scsi_smc_exenab
, { "EXENAB", "scsi_smc.exenab", FT_BOOLEAN
, 8, NULL
, 0x10, NULL
, HFILL
}},
936 { &hf_scsi_smc_inenab
, { "INENAB", "scsi_smc.inenab", FT_BOOLEAN
, 8, NULL
, 0x20, NULL
, HFILL
}},
937 { &hf_scsi_smc_impexp
, { "IMPEXP", "scsi_smc.impexp", FT_BOOLEAN
, 8, NULL
, 0x02, NULL
, HFILL
}},
938 { &hf_scsi_smc_lun
, { "LUN", "scsi_smc.lun", FT_UINT8
, BASE_DEC
, NULL
, 0x07, NULL
, HFILL
}},
939 { &hf_scsi_smc_primary_vol_tag_id
, { "Primary Volume Identification", "scsi_smc.primary_vol_tag_id", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
940 { &hf_scsi_smc_alternate_vol_tag_id
, { "Alternate Volume Identification", "scsi_smc.alternate_vol_tag_id", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
941 { &hf_scsi_smc_primary_vol_seq_num
, { "Primary Volume Sequence Number", "scsi_smc.primary_vol_seq_num", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
942 { &hf_scsi_smc_alternate_vol_seq_num
, { "Alternate Volume Sequence Number", "scsi_smc.alternate_vol_seq_num", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
946 /* Setup protocol subtree array */
947 static gint
*ett
[] = {
948 &ett_scsi_exchange_medium
,
953 /* Register the protocol name and description */
954 proto_scsi_smc
= proto_register_protocol("SCSI_SMC", "SCSI_SMC", "scsi_smc");
956 /* Required function calls to register the header fields and subtrees used */
957 proto_register_field_array(proto_scsi_smc
, hf
, array_length(hf
));
959 proto_register_subtree_array(ett
, array_length(ett
));
963 proto_reg_handoff_scsi_smc(void)