2 * Routines for RSVD dissection
3 * Copyright 2015, Richard Sharpe <realrichardsharpe@gmail.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
13 * RSVD, documented in [MS-RSVD].pdf, by Microsoft, the Remote Shared Virtual
19 #include <epan/conversation.h>
20 #include <epan/packet.h>
22 #include "packet-smb-common.h"
24 #include "packet-windows-common.h"
25 #include "packet-scsi.h"
27 void proto_register_rsvd(void);
29 static int proto_rsvd
;
30 static int hf_svhdx_protocol_id
;
31 static int hf_svhdx_protocol_version
;
32 static int hf_svhdx_operation_code
;
33 static int hf_svhdx_status
;
34 static int hf_svhdx_request_id
;
35 static int hf_svhdx_tunnel_scsi_length
;
36 static int hf_svhdx_tunnel_scsi_reserved1
;
37 static int hf_svhdx_tunnel_scsi_cdb_length
;
38 static int hf_svhdx_tunnel_scsi_sense_info_ex_length
;
39 static int hf_svhdx_tunnel_scsi_data_in
;
40 static int hf_svhdx_tunnel_scsi_reserved2
;
41 static int hf_svhdx_tunnel_scsi_srb_flags
;
42 static int hf_svhdx_tunnel_scsi_data_transfer_length
;
43 static int hf_svhdx_tunnel_scsi_reserved3
;
44 static int hf_svhdx_tunnel_scsi_cdb
;
45 static int hf_svhdx_tunnel_scsi_cdb_padding
;
46 static int hf_svhdx_tunnel_scsi_data
;
47 static int hf_svhdx_tunnel_scsi_auto_generated_sense
;
48 static int hf_svhdx_tunnel_scsi_srb_status
;
49 static int hf_svhdx_tunnel_scsi_sense_data_ex
;
50 static int hf_svhdx_tunnel_scsi_status
;
51 static int hf_svhdx_tunnel_file_info_server_version
;
52 static int hf_svhdx_tunnel_file_info_sector_size
;
53 static int hf_svhdx_tunnel_file_info_physical_sector_size
;
54 static int hf_svhdx_tunnel_file_info_reserved
;
55 static int hf_svhdx_tunnel_file_info_virtual_size
;
56 static int hf_svhdx_tunnel_disk_info_reserved1
;
57 static int hf_svhdx_tunnel_disk_info_blocksize
;
58 static int hf_svhdx_tunnel_disk_info_linkage_id
;
59 static int hf_svhdx_tunnel_disk_info_disk_type
;
60 static int hf_svhdx_tunnel_disk_info_disk_format
;
61 static int hf_svhdx_tunnel_disk_info_is_mounted
;
62 static int hf_svhdx_tunnel_disk_info_is_4k_aligned
;
63 static int hf_svhdx_tunnel_disk_info_reserved
;
64 static int hf_svhdx_tunnel_disk_info_file_size
;
65 static int hf_svhdx_tunnel_disk_info_virtual_disk_id
;
66 static int hf_svhdx_tunnel_validate_disk_reserved
;
67 static int hf_svhdx_tunnel_validate_disk_is_valid_disk
;
68 static int hf_svhdx_tunnel_srb_status_status_key
;
69 static int hf_svhdx_tunnel_srb_status_reserved
;
70 static int hf_svhdx_tunnel_srb_status_sense_info_auto_generated
;
71 static int hf_svhdx_tunnel_srb_status_srb_status
;
72 static int hf_svhdx_tunnel_srb_status_scsi_status
;
73 static int hf_svhdx_tunnel_srb_status_sense_info_ex_length
;
74 static int hf_svhdx_tunnel_srb_status_sense_data_ex
;
75 static int hf_svhdx_tunnel_safe_virtual_size
;
76 static int hf_svhdx_tunnel_transaction_id
;
77 static int hf_svhdx_tunnel_meta_operation_type
;
78 static int hf_svhdx_tunnel_padding
;
79 static int hf_svhdx_tunnel_resize_new_size
;
80 static int hf_svhdx_tunnel_resize_expand_only_flag
;
81 static int hf_svhdx_tunnel_resize_allow_unsafe_virt_size_flag
;
82 static int hf_svhdx_tunnel_resize_shrink_to_minimum_safe_size_flag
;
83 static int hf_svhdx_tunnel_meta_operation_start_reserved
;
84 static int hf_svhdx_tunnel_snapshot_type
;
85 static int hf_svhdx_tunnel_snapshot_id
;
86 static int hf_svhdx_tunnel_create_snapshot_flags
;
87 static int hf_svhdx_tunnel_create_snapshot_flag_enable_change_tracking
;
88 static int hf_svhdx_tunnel_create_snapshot_stage1
;
89 static int hf_svhdx_tunnel_create_snapshot_stage2
;
90 static int hf_svhdx_tunnel_create_snapshot_stage3
;
91 static int hf_svhdx_tunnel_create_snapshot_stage4
;
92 static int hf_svhdx_tunnel_create_snapshot_stage5
;
93 static int hf_svhdx_tunnel_create_snapshot_stage6
;
94 static int hf_svhdx_tunnel_create_snapshot_parameters_payload_size
;
95 static int hf_svhdx_tunnel_convert_dst_vhdset_name_len
;
96 static int hf_svhdx_tunnel_convert_dst_vhdset_name
;
97 static int hf_svhdx_tunnel_delete_snapshot_persist_reference
;
98 static int hf_svhdx_tunnel_meta_op_query_progress_current_progress
;
99 static int hf_svhdx_tunnel_meta_op_query_progress_complete_value
;
100 static int hf_svhdx_tunnel_vhdset_information_type
;
101 static int hf_svhdx_tunnel_vhdset_snapshot_creation_time
;
102 static int hf_svhdx_tunnel_vhdset_is_valid_snapshot
;
103 static int hf_svhdx_tunnel_vhdset_parent_snapshot_id
;
104 static int hf_svhdx_tunnel_vhdset_log_file_id
;
107 static int ett_svhdx_tunnel_op_header
;
108 static int ett_svhdx_tunnel_scsi_request
;
109 static int ett_rsvd_create_snapshot_flags
;
111 static const value_string rsvd_operation_code_vals
[] = {
112 { 0x02001001, "RSVD_TUNNEL_GET_INITIAL_INFO" },
113 { 0x02001002, "RSVD_TUNNEL_SCSI" },
114 { 0x02001003, "RSVD_TUNNEL_CHECK_CONNECTION_STATUS" },
115 { 0x02001004, "RSVD_TUNNEL_SRB_STATUS" },
116 { 0x02001005, "RSVD_TUNNEL_GET_DISK_INFO" },
117 { 0x02001006, "RSVD_TUNNEL_VALIDATE_DISK" },
118 { 0x02002101, "RSVD_TUNNEL_META_OPERATION_START" },
119 { 0x02002002, "RSVD_TUNNEL_META_OPERATION_QUERY_PROGRESS" },
120 { 0x02002005, "RSVD_TUNNEL_VHDSET_QUERY_INFORMATION" },
121 { 0x02002006, "RSVD_TUNNEL_DELETE_SNAPSHOT" },
122 { 0x02002008, "RSVD_TUNNEL_CHANGE_TRACKING_GET_PARAMETERS" },
123 { 0x02002009, "RSVD_TUNNEL_CHANGE_TRACKING_START" },
124 { 0x0200200A, "RSVD_TUNNEL_CHANGE_TRACKING_STOP" },
125 { 0x0200200C, "RSVD_TUNNEL_QUERY_VIRTUAL_DISK_CHANGES" },
126 { 0x0200200D, "RSVD_TUNNEL_QUERY_SAFE_SIZE" },
130 static const value_string rsvd_sense_info_vals
[] = {
131 { 0x0, "Sense Info Not Auto Generated" },
132 { 0x1, "Sense Info Auto Generated" },
136 static const value_string rsvd_disk_type_vals
[] = {
137 { 0x02, "VHD_TYPE_FIXED" },
138 { 0x03, "VHD_TYPE_DYNAMIC" },
142 static const value_string rsvd_disk_format_vals
[] = {
143 { 0x03, "VIRTUAL_STORAGE_TYPE_DEVICE_VHDX" },
144 { 0x04, "VIRTUAL_STORAGE_TYPE_DEVICE_VHDSET" },
149 * We need this data to handle SCSI requests and responses, I think
151 typedef struct _rsvd_task_data_t
{
152 uint32_t request_frame
;
153 uint32_t response_frame
;
157 typedef struct _rsvd_conv_data_t
{
160 rsvd_task_data_t
*task
;
161 conversation_t
*conversation
;
164 static rsvd_conv_data_t
*rsvd_conv_data
;
166 static proto_tree
*top_tree
;
169 get_itl_nexus(packet_info
*pinfo
)
171 itl_nexus_t
*itl
= NULL
;
173 if (!(itl
= (itl_nexus_t
*)wmem_tree_lookup32_le(rsvd_conv_data
->itl
, pinfo
->num
))) {
174 itl
= wmem_new(wmem_file_scope(), itl_nexus_t
);
176 itl
->conversation
= rsvd_conv_data
->conversation
;
177 wmem_tree_insert32(rsvd_conv_data
->itl
, pinfo
->num
, itl
);
184 dissect_RSVD_GET_INITIAL_INFO(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
)
186 proto_tree
*gfi_sub_tree
;
187 proto_item
*gfi_sub_item
;
190 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_GET_INITIAL_INFO_RESPONSE");
192 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_file_info_server_version
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
195 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_file_info_sector_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
198 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_file_info_physical_sector_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
201 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_file_info_reserved
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
204 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_file_info_virtual_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
211 static const value_string rsvd_data_in_vals
[] = {
212 { 0x00, "Client is requesting data from the server" },
213 { 0x01, "Client is sending data to the server" },
214 { 0x02, "Client is neither sending nor requesting an additional data buffer" },
219 dissect_scsi_payload_databuffer(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, uint32_t data_transfer_length
, bool request
)
221 tvbuff_t
*data_tvb
= NULL
;
222 int tvb_len
, tvb_rlen
;
224 tvb_len
= tvb_captured_length_remaining(tvb
, offset
);
225 if (tvb_len
> (int)data_transfer_length
)
226 tvb_len
= data_transfer_length
;
228 tvb_rlen
= tvb_reported_length_remaining(tvb
, offset
);
229 if (tvb_rlen
> (int)data_transfer_length
)
230 tvb_rlen
= data_transfer_length
;
232 data_tvb
= tvb_new_subset_length_caplen(tvb
, offset
, tvb_len
, tvb_rlen
);
234 if (rsvd_conv_data
->task
&& rsvd_conv_data
->task
->itlq
) {
235 rsvd_conv_data
->task
->itlq
->task_flags
= SCSI_DATA_READ
|
237 rsvd_conv_data
->task
->itlq
->data_length
= data_transfer_length
;
238 rsvd_conv_data
->task
->itlq
->bidir_data_length
= data_transfer_length
;
239 dissect_scsi_payload(data_tvb
, pinfo
, top_tree
, request
,
240 rsvd_conv_data
->task
->itlq
,
241 get_itl_nexus(pinfo
), 0);
246 * Dissect a tunnelled SCSI request and call the SCSI dissector where
250 dissect_RSVD_TUNNEL_SCSI(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
, uint64_t request_id
)
252 proto_tree
*sub_tree
;
253 proto_item
*sub_item
;
257 uint32_t data_transfer_length
;
258 uint32_t sense_info_ex_length
;
259 conversation_t
*conversation
;
261 conversation
= find_or_create_conversation(pinfo
);
262 rsvd_conv_data
= (rsvd_conv_data_t
*)conversation_get_proto_data(conversation
, proto_rsvd
);
264 if (!rsvd_conv_data
) {
265 rsvd_conv_data
= wmem_new(wmem_file_scope(), rsvd_conv_data_t
);
266 rsvd_conv_data
->tasks
= wmem_map_new(wmem_file_scope(),
269 rsvd_conv_data
->itl
= wmem_tree_new(wmem_file_scope());
270 rsvd_conv_data
->conversation
= conversation
;
271 conversation_add_proto_data(conversation
, proto_rsvd
, rsvd_conv_data
);
274 rsvd_conv_data
->task
= NULL
;
275 rsvd_conv_data
->task
= (rsvd_task_data_t
*)wmem_map_lookup(rsvd_conv_data
->tasks
, (const void *)&request_id
);
276 if (!pinfo
->fd
->visited
) {
277 if (rsvd_conv_data
->task
== NULL
) {
278 uint64_t *key_copy
= wmem_new(wmem_file_scope(), uint64_t);
280 *key_copy
= request_id
;
281 rsvd_conv_data
->task
= wmem_new0(wmem_file_scope(), rsvd_task_data_t
);
282 rsvd_conv_data
->task
->itlq
= wmem_new0(wmem_file_scope(),
284 rsvd_conv_data
->task
->itlq
->lun
= 0xffff;
285 rsvd_conv_data
->task
->itlq
->scsi_opcode
= 0xffff;
286 rsvd_conv_data
->task
->itlq
->fc_time
= pinfo
->abs_ts
;
287 wmem_map_insert(rsvd_conv_data
->tasks
, (const void *)key_copy
,
288 rsvd_conv_data
->task
);
291 rsvd_conv_data
->task
->request_frame
= pinfo
->num
;
292 rsvd_conv_data
->task
->itlq
->first_exchange_frame
= pinfo
->num
;
294 rsvd_conv_data
->task
->response_frame
= pinfo
->num
;
295 rsvd_conv_data
->task
->itlq
->last_exchange_frame
= pinfo
->num
;
299 sub_tree
= proto_tree_add_subtree_format(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_scsi_request
, &sub_item
, "SVHDX_TUNNEL_SCSI_%s", (request
? "REQUEST" : "RESPONSE"));
302 tvbuff_t
*scsi_cdb
= NULL
;
305 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_length
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
309 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_reserved1
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
313 cdb_length
= tvb_get_uint8(tvb
, offset
);
314 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_cdb_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
317 /* SensInfoExLength */
318 /* You'll notice that there is no SenseDataEx field in the request.
319 * This field is pointless and ignored. In some versions Microsoft
320 * said that this field MUST be set to zero; recent versions say
321 * that it SHOULD be set to 20 (which is the size of the CDBBuffer
322 * plus Reserved3.) */
323 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_sense_info_ex_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
327 data_in
= tvb_get_uint8(tvb
, offset
);
328 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_data_in
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
332 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_reserved2
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
336 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_srb_flags
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
339 /* DataTransferLength */
340 data_transfer_length
= tvb_get_letohl(tvb
, offset
);
341 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_data_transfer_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
345 scsi_cdb
= tvb_new_subset_length_caplen(tvb
,
348 tvb_reported_length_remaining(tvb
, offset
));
349 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_cdb
, tvb
, offset
, cdb_length
, ENC_NA
);
350 offset
+= cdb_length
;
351 if (cdb_length
< 16) {
353 * CDBBuffer is always 16 bytes - see MS-RSVD section 2.2.4.7
354 * "SVHDX_TUNNEL_SCSI_REQUEST Structure":
356 * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rsvd/e8bcb003-97b3-41ef-9689-cd2d1668a9cc
358 * If CDB is actually smaller, we need to define padding bytes
360 uint32_t cdb_padding_length
= 16 - cdb_length
;
361 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_cdb_padding
, tvb
, offset
, cdb_padding_length
, ENC_NA
);
362 offset
+= cdb_padding_length
;
366 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_reserved3
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
370 if (data_transfer_length
) {
371 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_data
, tvb
, offset
, data_transfer_length
, ENC_NA
);
375 * Now the SCSI Request
377 if (rsvd_conv_data
->task
&& rsvd_conv_data
->task
->itlq
) {
378 dissect_scsi_cdb(scsi_cdb
, pinfo
, top_tree
, SCSI_DEV_SMC
, rsvd_conv_data
->task
->itlq
, get_itl_nexus(pinfo
));
379 if (data_in
== 0) { /* Only OUT operations have meaningful SCSI payload in request packet */
380 dissect_scsi_payload_databuffer(tvb
, pinfo
, offset
, data_transfer_length
, request
);
384 /* increment after DataBuffer */
385 offset
+= data_transfer_length
;
387 uint8_t scsi_status
= 0;
390 proto_tree_add_item_ret_uint(sub_tree
, hf_svhdx_tunnel_scsi_length
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &length
);
394 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_auto_generated_sense
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
397 proto_tree_add_bits_item(sub_tree
, hf_svhdx_tunnel_scsi_srb_status
, tvb
, offset
* 8 + 1, 7, ENC_BIG_ENDIAN
);
401 scsi_status
= tvb_get_uint8(tvb
, offset
);
402 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_status
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
406 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_cdb_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
409 /* SensInfoExLength */
410 sense_info_ex_length
= tvb_get_uint8(tvb
, offset
);
411 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_sense_info_ex_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
415 data_in
= tvb_get_uint8(tvb
, offset
);
416 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_data_in
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
420 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_reserved2
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
424 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_srb_flags
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
427 /* DataTransferLength */
428 data_transfer_length
= tvb_get_letohl(tvb
, offset
);
429 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_data_transfer_length
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
433 /* Microsoft kept going back and forth with this field. Up through
434 * version 6.0 of the MS-RSVD specification, SenseInfoExLength had
435 * the length of SenseDataEx, a variable length fields. In 7.0,
436 * it was changed so that SenseDataEx was a fixed length 20 byte
437 * field, and SenseInfoExLength had the number of bytes, of the
438 * data actually contained in the field, which had to be 20 or fewer.
439 * Then in 11.0 it was changed back.
440 * In the 7.0-10.0 case, the 20 byte field seemed to actually
441 * contain the CDB + padding + Reserved3 from the Request copied back.
442 * Luckily there's also a Length field that measures the size of
443 * the structure excluding the DataBuffer. In the versions with the
444 * 20 byte fixed SenseDataEx field, the protocol notes that it MUST
445 * MUST be set to the appropriate value of 36. (DataBuffer is the
446 * only other possibly variable length field.)
448 if (length
== 36 && sense_info_ex_length
< 20) {
449 sense_info_ex_length
= 20;
451 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_sense_data_ex
, tvb
, offset
, sense_info_ex_length
, ENC_NA
);
452 offset
+= sense_info_ex_length
;
455 if (data_transfer_length
) {
456 proto_tree_add_item(sub_tree
, hf_svhdx_tunnel_scsi_data
, tvb
, offset
, data_transfer_length
, ENC_NA
);
458 if (data_in
== 1) { /* Only IN operations have meaningful SCSI payload in reply packet */
459 dissect_scsi_payload_databuffer(tvb
, pinfo
, offset
, data_transfer_length
, request
);
462 offset
+= data_transfer_length
;
466 * Now, the SCSI response
468 if (rsvd_conv_data
->task
&& rsvd_conv_data
->task
->itlq
) {
469 dissect_scsi_rsp(tvb
, pinfo
, top_tree
, rsvd_conv_data
->task
->itlq
, get_itl_nexus(pinfo
), scsi_status
);
477 dissect_RSVD_SRB_STATUS(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
)
479 proto_tree
*gfi_sub_tree
;
480 proto_item
*gfi_sub_item
;
483 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_SRB_STATUS_REQUEST");
486 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_srb_status_status_key
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
490 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_srb_status_reserved
, tvb
, offset
, 1, ENC_NA
);
493 uint8_t sense_info_length
;
495 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_SRB_STATUS_RESPONSE");
498 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_srb_status_status_key
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
501 /* SenseInfoAutoGenerated and SrbStatus */
502 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_srb_status_sense_info_auto_generated
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
503 proto_tree_add_bits_item(gfi_sub_tree
, hf_svhdx_tunnel_srb_status_srb_status
, tvb
, offset
* 8 + 1, 7, ENC_BIG_ENDIAN
);
507 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_srb_status_scsi_status
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
510 /* SenseInfoExLength */
511 sense_info_length
= tvb_get_uint8(tvb
, offset
);
512 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_srb_status_sense_info_ex_length
, tvb
, offset
, 1, ENC_NA
);
516 /* For the same reasons as discussed in RSVD_TUNNEL_SCSI, in some
517 * versions this field is a fixed 20 octets, and the length just
518 * indicates the number of bytes of real sense data in it.
519 * At least it's at the end; we'll just ignore the padding.
521 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_srb_status_sense_data_ex
, tvb
, offset
, sense_info_length
, ENC_NA
);
522 offset
+= sense_info_length
;
529 dissect_RSVD_GET_DISK_INFO(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
)
531 proto_tree
*gfi_sub_tree
;
532 proto_item
*gfi_sub_item
;
535 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_GET_DISK_INFO_REQUEST");
537 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_reserved1
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
540 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_blocksize
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
543 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_linkage_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
546 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_is_mounted
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
549 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_is_4k_aligned
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
552 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_reserved
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
555 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_file_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
558 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_virtual_disk_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
561 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_GET_DISK_INFO_RESPONSE");
563 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_disk_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
566 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_disk_format
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
569 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_blocksize
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
572 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_linkage_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
575 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_is_mounted
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
578 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_is_4k_aligned
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
581 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_reserved
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
584 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_file_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
587 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_disk_info_virtual_disk_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
595 dissect_RSVD_VALIDATE_DISK(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
)
597 proto_tree
*gfi_sub_tree
;
598 proto_item
*gfi_sub_item
;
601 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_VALIDATE_DISK_REQUEST");
603 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_validate_disk_reserved
, tvb
, offset
, 56, ENC_NA
);
606 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_VALIDATE_DISK_RESPONSE");
608 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_validate_disk_is_valid_disk
, tvb
, offset
, 1, ENC_NA
);
615 static const value_string rsvd_meta_operation_type_vals
[] = {
616 { 0x00, "SvhdxMetaOperationTypeResize" },
617 { 0x01, "SvhdxMetaOperationTypeCreateSnapshot" },
618 { 0x02, "SvhdxMetaOperationTypeOptimize" },
619 { 0x03, "SvhdxMetaOperationTypeExtractVHD" },
620 { 0x04, "SvhdxMetaOperationTypeConvertToVHDSet" },
621 { 0x05, "SvhdxMetaOperationTypeApplySnapshot" },
625 static const value_string svhdx_snapshot_type_vals
[] = {
626 { 0x01, "SvhdxSnapshotTypeVM" },
627 { 0x03, "SvhdxSnapshotTypeCDP" },
628 { 0x04, "SvhdxSnapshotTypeWriteable" },
632 static const value_string svhdx_snapshot_stage_vals
[] = {
633 { 0x00, "SvhdxSnapshotStageInvalid" },
634 { 0x01, "SvhdxSnapshotStageInitialize" },
635 { 0x02, "SvhdxSnapshotStageBlockIO" },
636 { 0x03, "SvhdxSnapshotStageSwitchObjectStore" },
637 { 0x04, "SvhdxSnapshotStageUnblockIO" },
638 { 0x05, "SvhdxSnapshotStageFinalize" },
642 #define SVHDX_SNAPSHOT_DISK_FLAG_ENABLE_CHANGE_TRACKING 0x00000001
645 dissect_RSVD2_META_OPERATION_START(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
)
647 static int * const meta_operation_create_snapshot_flags
[] = {
648 &hf_svhdx_tunnel_create_snapshot_flag_enable_change_tracking
,
652 uint32_t operation_type
= 0;
654 proto_tree
*gfi_sub_tree
;
655 proto_item
*gfi_sub_item
;
659 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_META_OPERATION_START_REQUEST");
661 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_transaction_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
664 operation_type
= tvb_get_letohl(tvb
, offset
);
665 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_meta_operation_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
668 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_padding
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
671 switch (operation_type
) {
672 case 0x00: /* SvhdxMetaOperationTypeResize */
673 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_resize_new_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
676 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_resize_expand_only_flag
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
679 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_resize_allow_unsafe_virt_size_flag
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
682 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_resize_shrink_to_minimum_safe_size_flag
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
685 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_meta_operation_start_reserved
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
688 case 0x01: /* SvhdxMetaOperationTypeCreateSnapshot */
689 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
692 proto_tree_add_bitmask(gfi_sub_tree
, tvb
, offset
, hf_svhdx_tunnel_create_snapshot_flags
,
693 ett_rsvd_create_snapshot_flags
, meta_operation_create_snapshot_flags
, ENC_LITTLE_ENDIAN
);
696 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_create_snapshot_stage1
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
699 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_create_snapshot_stage2
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
702 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_create_snapshot_stage3
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
705 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_create_snapshot_stage4
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
708 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_create_snapshot_stage5
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
711 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_create_snapshot_stage6
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
714 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
717 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_create_snapshot_parameters_payload_size
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
721 case 0x02: /* SvhdxMetaOperationTypeOptimize */
722 /* No Data, field MUST be empty */
724 case 0x03: /* SvhdxMetaOperationTypeExtractVHD */
727 case 0x04: /* SvhdxMetaOperationTypeConvertToVHDSet */
728 length
= tvb_get_letohl(tvb
, offset
);
729 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_convert_dst_vhdset_name_len
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
733 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_convert_dst_vhdset_name
, tvb
, offset
, length
, ENC_UTF_16
|ENC_LITTLE_ENDIAN
);
737 case 0x05: /* SvhdxMetaOperationTypeApplySnapshot */
738 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
741 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
751 dissect_RSVD2_META_OPERATION_QUERY_PROGRESS(tvbuff_t
*tvb
,
752 proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
, uint32_t status
)
754 proto_tree
*gfi_sub_tree
;
755 proto_item
*gfi_sub_item
;
758 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_META_OPERATION_QUERY_PROGRESS_REQUEST");
760 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_transaction_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
763 if (status
== 0) { /* If status is not successful, RSVD response buffer is filled by data from request buffer and we should not parse output structure */
764 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_META_OPERATION_QUERY_PROGRESS_RESPONSE");
766 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_meta_op_query_progress_current_progress
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
769 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_meta_op_query_progress_complete_value
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
776 static const value_string svhdx_vhdset_information_type_vals
[] = {
777 { 0x02, "SvhdxVHDSetInformationTypeSnapshotList" },
778 { 0x05, "SvhdxVHDSetInformationTypeSnapshotEntry" },
779 { 0x08, "SvhdxVHDSetInformationTypeOptimizeNeeded" },
780 { 0x09, "SvhdxVHDSetInformationTypeCdpSnapshotRoot" },
781 { 0x0A, "SvhdxVHDSetInformationTypeCdpSnapshotActiveList" },
782 { 0x0C, "SvhdxVHDSetInformationTypeCdpSnapshotInactiveList" },
786 dissect_RSVD2_VHDSET_QUERY_INFORMATION(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
)
788 proto_tree
*gfi_sub_tree
;
789 proto_item
*gfi_sub_item
;
792 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_VHDSET_QUERY_INFORMATION_REQUEST");
794 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_vhdset_information_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
797 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
800 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
803 uint32_t vhdset_info_type
= tvb_get_letohl(tvb
, offset
);
804 switch (vhdset_info_type
) {
805 case 0x02: /* SvhdxVHDSetInformationTypeSnapshotList */
806 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_VHDSET_QUERY_INFORMATION_SNAPSHOT_LIST_RESPONSE");
808 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_vhdset_information_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
810 /* TODO: make full dissection */
813 case 0x05: /* SvhdxVHDSetInformationTypeSnapshotEntry */
814 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_VHDSET_QUERY_INFORMATION_SNAPSHOT_ENTRY_RESPONSE");
816 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_vhdset_information_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
819 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_padding
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
822 dissect_nttime(tvb
, gfi_sub_tree
, offset
, hf_svhdx_tunnel_vhdset_snapshot_creation_time
, ENC_LITTLE_ENDIAN
);
825 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
828 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_vhdset_is_valid_snapshot
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
831 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
834 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_vhdset_parent_snapshot_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
837 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_vhdset_log_file_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
847 dissect_RSVD2_DELETE_SNAPSHOT(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
)
849 proto_tree
*gfi_sub_tree
;
850 proto_item
*gfi_sub_item
;
853 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_DELETE_SNAPSHOT_REQUEST");
855 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_id
, tvb
, offset
, 16, ENC_LITTLE_ENDIAN
);
858 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_delete_snapshot_persist_reference
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
861 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_snapshot_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
868 dissect_RSVD2_QUERY_SAFE_SIZE(tvbuff_t
*tvb
, proto_tree
*parent_tree
, int offset
, int16_t len
, bool request
)
870 proto_tree
*gfi_sub_tree
;
871 proto_item
*gfi_sub_item
;
874 gfi_sub_tree
= proto_tree_add_subtree(parent_tree
, tvb
, offset
, len
, ett_svhdx_tunnel_op_header
, &gfi_sub_item
, "RSVD_TUNNEL_QUERY_SAFE_SIZE_RESPONSE");
876 proto_tree_add_item(gfi_sub_tree
, hf_svhdx_tunnel_safe_virtual_size
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
883 dissect_rsvd(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, void *data
)
885 uint32_t header_bytes
= 0;
886 unsigned proto_id
= 0;
887 unsigned proto_version
= 0;
888 uint32_t operation_code
= 0;
891 proto_tree
*rsvd_tree
;
892 proto_item
*sub_item
;
893 proto_tree
*sub_tree
;
896 uint64_t request_id
= 0;
897 bool request
= *(bool *)data
;
899 top_tree
= parent_tree
;
901 len
= tvb_reported_length(tvb
);
903 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "RSVD");
905 col_clear(pinfo
->cinfo
, COL_INFO
);
908 * The header bytes need to be pulled in as a 32bit LE value. And the
909 * header is the same in a request or a response ...
911 header_bytes
= tvb_get_letohl(tvb
, 0); /* Get the header bytes */
912 proto_id
= header_bytes
>> 24;
913 proto_version
= (header_bytes
>> 12) & 0x0FFF;
914 operation_code
= header_bytes
;
916 ti
= proto_tree_add_item(parent_tree
, proto_rsvd
, tvb
, offset
, -1, ENC_NA
);
918 rsvd_tree
= proto_item_add_subtree(ti
, ett_rsvd
);
920 sub_tree
= proto_tree_add_subtree(rsvd_tree
, tvb
, offset
, (len
>16) ? 16 : len
, ett_svhdx_tunnel_op_header
, &sub_item
, "SVHDX_TUNNEL_OPERATION_HEADER");
923 proto_tree_add_uint(sub_tree
, hf_svhdx_protocol_id
, tvb
, offset
, 4, proto_id
);
925 /* ProtocolVersion */
926 proto_tree_add_uint(sub_tree
, hf_svhdx_protocol_version
, tvb
, offset
, 4, proto_version
);
929 proto_tree_add_uint(sub_tree
, hf_svhdx_operation_code
, tvb
, offset
, 4, operation_code
);
933 status
= tvb_get_letohl(tvb
, offset
);
934 proto_tree_add_item(sub_tree
, hf_svhdx_status
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
938 request_id
= tvb_get_ntoh64(tvb
, offset
);
939 proto_tree_add_item(sub_tree
, hf_svhdx_request_id
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
942 col_append_fstr(pinfo
->cinfo
, COL_INFO
, "%s %s",
943 val_to_str(operation_code
,
944 rsvd_operation_code_vals
,
945 "Unknown Operation Code (0x%08X)"),
946 request
? "Request" : "Response");
948 proto_item_append_text(ti
, ", %s %s",
949 val_to_str(operation_code
,
950 rsvd_operation_code_vals
,
951 "Unknown Operation Code (0x%08X)"),
952 request
? "Request" : "Response");
954 * Now process the individual requests ...
956 switch (operation_code
) {
958 offset
+= dissect_RSVD_GET_INITIAL_INFO(tvb
, rsvd_tree
, offset
, len
- offset
, request
);
962 offset
+= dissect_RSVD_TUNNEL_SCSI(tvb
, pinfo
, rsvd_tree
, offset
, len
- offset
, request
, request_id
);
968 * There is nothing more here.
974 offset
+= dissect_RSVD_SRB_STATUS(tvb
, rsvd_tree
, offset
, len
- offset
, request
);
978 offset
+= dissect_RSVD_GET_DISK_INFO(tvb
, rsvd_tree
, offset
, len
- offset
, request
);
982 offset
+= dissect_RSVD_VALIDATE_DISK(tvb
, rsvd_tree
, offset
, len
- offset
, request
);
984 /* RSVD v2 operations */
986 offset
+= dissect_RSVD2_META_OPERATION_START(tvb
, rsvd_tree
, offset
, len
- offset
, request
);
990 offset
+= dissect_RSVD2_META_OPERATION_QUERY_PROGRESS(tvb
, rsvd_tree
, offset
, len
- offset
, request
, status
);
994 offset
+= dissect_RSVD2_VHDSET_QUERY_INFORMATION(tvb
, rsvd_tree
, offset
, len
- offset
, request
);
998 offset
+= dissect_RSVD2_DELETE_SNAPSHOT(tvb
, rsvd_tree
, offset
, len
- offset
, request
);
1002 offset
+= dissect_RSVD2_QUERY_SAFE_SIZE(tvb
, rsvd_tree
, offset
, len
- offset
, request
);
1005 /* TODO: implement more dissectors for RSVD v2 */
1015 proto_register_rsvd(void)
1018 static hf_register_info hf
[] = {
1019 { &hf_svhdx_protocol_id
,
1020 { "ProtocolId", "rsvd.svhdx_protocol_id", FT_UINT8
, BASE_DEC
,
1021 NULL
, 0, NULL
, HFILL
}},
1023 { &hf_svhdx_protocol_version
,
1024 { "ProtocolVersion", "rsvd.svhdx_protocol_version", FT_UINT16
, BASE_DEC
,
1025 NULL
, 0, NULL
, HFILL
}},
1027 { &hf_svhdx_operation_code
,
1028 { "OperationCode", "rsvd.svhdx_operation_code", FT_UINT32
, BASE_HEX
,
1029 VALS(rsvd_operation_code_vals
), 0, "Operation Code", HFILL
}},
1032 { "Status", "rsvd.svhdx_status", FT_UINT32
, BASE_HEX
| BASE_EXT_STRING
,
1033 &NT_errors_ext
, 0, NULL
, HFILL
}},
1036 { &hf_svhdx_request_id
,
1037 { "RequestId", "rsvd.svhdx_request_id", FT_UINT64
, BASE_HEX
,
1038 NULL
, 0, NULL
, HFILL
}},
1040 { &hf_svhdx_tunnel_scsi_length
,
1041 { "Length", "rsvd.svhdx_length", FT_UINT16
, BASE_DEC
,
1042 NULL
, 0, NULL
, HFILL
}},
1044 { &hf_svhdx_tunnel_scsi_reserved1
,
1045 { "Reserved1", "rsvd.svhdx_scsi_reserved1", FT_UINT16
, BASE_HEX
,
1046 NULL
, 0, NULL
, HFILL
}},
1048 { &hf_svhdx_tunnel_scsi_cdb_length
,
1049 { "CDBLength", "rsvd.svhdx_scsi_cdb_length", FT_UINT8
, BASE_DEC
,
1050 NULL
, 0, NULL
, HFILL
}},
1052 { &hf_svhdx_tunnel_scsi_sense_info_ex_length
,
1053 { "SenseInfoExLength", "rsvd.svhdx_scsi_sense_info_ex_length", FT_UINT8
, BASE_DEC
,
1054 NULL
, 0, NULL
, HFILL
}},
1056 { &hf_svhdx_tunnel_scsi_data_in
,
1057 { "DataIn", "rsvd.svhdx_scsi_data_in", FT_UINT8
, BASE_HEX
,
1058 VALS(rsvd_data_in_vals
), 0, "SCSI CDB transfer type", HFILL
}},
1060 { &hf_svhdx_tunnel_scsi_reserved2
,
1061 { "Reserved2", "rsvd.svhdx_scsi_reserved2", FT_UINT8
, BASE_HEX
,
1062 NULL
, 0, NULL
, HFILL
}},
1064 { &hf_svhdx_tunnel_scsi_srb_flags
,
1065 { "SRBFlags", "rsvd.svhdx_scsi_srbflags", FT_UINT32
, BASE_HEX
,
1066 NULL
, 0, NULL
, HFILL
}},
1068 { &hf_svhdx_tunnel_scsi_data_transfer_length
,
1069 { "DataTransferLength", "rsvd.svhdx_scsi_data_transfer_length", FT_UINT32
, BASE_DEC
,
1070 NULL
, 0, NULL
, HFILL
}},
1072 { &hf_svhdx_tunnel_scsi_reserved3
,
1073 { "Reserved3", "rsvd.svhdx_scsi_reserved3", FT_UINT32
, BASE_HEX
,
1074 NULL
, 0, NULL
, HFILL
}},
1076 { &hf_svhdx_tunnel_scsi_cdb
,
1077 { "CDB", "rsvd.svhdx_scsi_cdb", FT_BYTES
, BASE_NONE
,
1078 NULL
, 0, NULL
, HFILL
}},
1080 { &hf_svhdx_tunnel_scsi_cdb_padding
,
1081 { "CDBPadding", "rsvd.svhdx_scsi_cdb_padding", FT_BYTES
, BASE_NONE
,
1082 NULL
, 0, NULL
, HFILL
}},
1084 { &hf_svhdx_tunnel_scsi_data
,
1085 {"Data", "rsvd.svhdx_scsi_data", FT_BYTES
, BASE_NONE
,
1086 NULL
, 0, NULL
, HFILL
}},
1088 { &hf_svhdx_tunnel_scsi_auto_generated_sense
,
1089 {"AutoGeneratedSenseInfo", "rsvd.svhdx_auto_generated_sense_info", FT_UINT8
, BASE_HEX
,
1090 VALS(rsvd_sense_info_vals
), 0x80, NULL
, HFILL
}},
1092 { &hf_svhdx_tunnel_scsi_srb_status
,
1093 { "SrbStatus", "rsvd.svhdx_srb_status", FT_UINT8
, BASE_HEX
,
1094 NULL
, 0, NULL
, HFILL
}},
1096 { &hf_svhdx_tunnel_scsi_status
,
1097 { "ScsiStatus", "rsvd.svhdx_scsi_status", FT_UINT8
, BASE_HEX
,
1098 NULL
, 0, NULL
, HFILL
}},
1100 { &hf_svhdx_tunnel_scsi_sense_data_ex
,
1101 { "SenseDataEx", "rsvd.svhdx_scsi_sense_data_ex", FT_BYTES
, BASE_NONE
,
1102 NULL
, 0, NULL
, HFILL
}},
1104 { &hf_svhdx_tunnel_file_info_server_version
,
1105 { "ServerVersion", "rsvd.svhdx_file_info_server_version", FT_UINT32
, BASE_DEC
,
1106 NULL
, 0, NULL
, HFILL
}},
1108 { &hf_svhdx_tunnel_file_info_sector_size
,
1109 { "SectorSize", "rsvd.svhdx_file_info_sector_size", FT_UINT32
, BASE_DEC
,
1110 NULL
, 0, NULL
, HFILL
}},
1112 { &hf_svhdx_tunnel_file_info_physical_sector_size
,
1113 { "PhysicalSectorSize", "rsvd.svhdx_file_info_physical_sector_size", FT_UINT32
, BASE_DEC
,
1114 NULL
, 0, NULL
, HFILL
}},
1116 { &hf_svhdx_tunnel_file_info_reserved
,
1117 { "Reserved", "rsvd.svhdx_file_info_reserved", FT_UINT32
, BASE_DEC
,
1118 NULL
, 0, NULL
, HFILL
}},
1120 { &hf_svhdx_tunnel_file_info_virtual_size
,
1121 { "VirtualSize", "rsvd.svhdx_file_info_virtual_size", FT_UINT64
, BASE_DEC
,
1122 NULL
, 0, NULL
, HFILL
}},
1125 { &hf_svhdx_tunnel_disk_info_reserved1
,
1126 { "Reserved1", "rsvd.svhdx_disk_info_reserved1", FT_UINT64
, BASE_DEC
,
1127 NULL
, 0, NULL
, HFILL
}},
1129 { &hf_svhdx_tunnel_disk_info_blocksize
,
1130 { "BlockSize", "rsvd.svhdx_disk_info_blocksize", FT_UINT32
, BASE_DEC
,
1131 NULL
, 0, NULL
, HFILL
}},
1133 { &hf_svhdx_tunnel_disk_info_linkage_id
,
1134 { "LinkageID", "rsvd.svhdx_disk_info_linkage_id", FT_GUID
, BASE_NONE
,
1135 NULL
, 0, NULL
, HFILL
}},
1137 { &hf_svhdx_tunnel_disk_info_disk_type
,
1138 { "DiskType", "rsvd.svhdx_disk_info_disk_type", FT_UINT32
, BASE_HEX
,
1139 VALS(rsvd_disk_type_vals
), 0, "Disk Type", HFILL
}},
1141 { &hf_svhdx_tunnel_disk_info_disk_format
,
1142 { "DiskFormat", "rsvd.svhdx_disk_info_disk_format", FT_UINT32
, BASE_HEX
,
1143 VALS(rsvd_disk_format_vals
), 0, "Disk Format", HFILL
}},
1145 { &hf_svhdx_tunnel_disk_info_is_mounted
,
1146 { "IsMounted", "rsvd.svhdx_tunnel_disk_info_is_mounted", FT_UINT8
, BASE_DEC
,
1147 NULL
, 0, NULL
, HFILL
}},
1149 { &hf_svhdx_tunnel_disk_info_is_4k_aligned
,
1150 { "Is4KAligned", "rsvd.svhdx_tunnel_disk_info_is_4k_aligned", FT_UINT8
, BASE_DEC
,
1151 NULL
, 0, NULL
, HFILL
}},
1153 { &hf_svhdx_tunnel_disk_info_reserved
,
1154 { "Reserved", "rsvd.svhdx_disk_info_reserved", FT_UINT16
, BASE_DEC
,
1155 NULL
, 0, NULL
, HFILL
}},
1157 { &hf_svhdx_tunnel_disk_info_file_size
,
1158 { "FileSize", "rsvd.svhdx_disk_info_file_size", FT_UINT64
, BASE_DEC
,
1159 NULL
, 0, NULL
, HFILL
}},
1161 { &hf_svhdx_tunnel_disk_info_virtual_disk_id
,
1162 { "VirtualDiskId", "rsvd.svhdx_disk_info_virtual_disk_id", FT_GUID
, BASE_NONE
,
1163 NULL
, 0, NULL
, HFILL
}},
1165 { &hf_svhdx_tunnel_validate_disk_reserved
,
1166 { "Reserved", "rsvd.svhdx_tunnel_validate_disk_reserved", FT_BYTES
, BASE_NONE
,
1167 NULL
, 0, NULL
, HFILL
}},
1169 { &hf_svhdx_tunnel_validate_disk_is_valid_disk
,
1170 { "IsValidDisk", "rsvd.svhdx_validate_disk_is_valid_disk", FT_BYTES
, BASE_NONE
,
1171 NULL
, 0, NULL
, HFILL
}},
1173 { &hf_svhdx_tunnel_srb_status_status_key
,
1174 { "StatusKey", "rsvd.svhdx_srb_status_key", FT_UINT8
, BASE_DEC
,
1175 NULL
, 0, NULL
, HFILL
}},
1177 { &hf_svhdx_tunnel_srb_status_reserved
,
1178 { "Reserved", "rsvd.svhdx_srb_status_reserved", FT_BYTES
, BASE_NONE
,
1179 NULL
, 0, NULL
, HFILL
}},
1181 { &hf_svhdx_tunnel_srb_status_sense_info_auto_generated
,
1182 { "SenseInfoAutoGenerated", "rsvd.svhdx_sense_info_auto_generated", FT_UINT8
, BASE_HEX
,
1183 VALS(rsvd_sense_info_vals
), 0x80, NULL
, HFILL
}},
1185 { &hf_svhdx_tunnel_srb_status_srb_status
,
1186 { "SrbStatus", "rsvd.svhdx_srb_status_srb_status", FT_UINT8
, BASE_HEX
,
1187 NULL
, 0x7f, NULL
, HFILL
}},
1189 { &hf_svhdx_tunnel_srb_status_scsi_status
,
1190 { "SrbStatus", "rsvd.svhdx_srb_status_scsi_status", FT_UINT8
, BASE_DEC
,
1191 NULL
, 0, NULL
, HFILL
}},
1193 { &hf_svhdx_tunnel_srb_status_sense_info_ex_length
,
1194 { "SenseInfoExLength", "rsvd.svhdx_srb_status_sense_info_ex_length", FT_UINT8
, BASE_DEC
,
1195 NULL
, 0, NULL
, HFILL
}},
1197 { &hf_svhdx_tunnel_srb_status_sense_data_ex
,
1198 { "Reserved", "rsvd.svhdx_srb_status_sense_data_ex", FT_BYTES
, BASE_NONE
,
1199 NULL
, 0, NULL
, HFILL
}},
1201 { &hf_svhdx_tunnel_safe_virtual_size
,
1202 { "SafeVirtualSize", "rsvd.svhdx_safe_size", FT_UINT64
, BASE_DEC
,
1203 NULL
, 0, NULL
, HFILL
}},
1205 { &hf_svhdx_tunnel_transaction_id
,
1206 { "TransactionId", "rsvd.svhdx_meta_operation.transaction_id", FT_GUID
, BASE_NONE
,
1207 NULL
, 0, NULL
, HFILL
}},
1209 { &hf_svhdx_tunnel_meta_operation_type
,
1210 { "OperationType", "rsvd.svhdx_meta_operation.type", FT_UINT32
, BASE_HEX
,
1211 VALS(rsvd_meta_operation_type_vals
), 0, "Type of meta-operation", HFILL
}},
1213 { &hf_svhdx_tunnel_padding
,
1214 { "Padding", "rsvd.svhdx_padding", FT_UINT32
, BASE_DEC
,
1215 NULL
, 0, NULL
, HFILL
}},
1217 { &hf_svhdx_tunnel_resize_new_size
,
1218 { "NewSize", "rsvd.svhdx_meta_operation.new_size", FT_UINT64
, BASE_DEC
,
1219 NULL
, 0, NULL
, HFILL
}},
1221 { &hf_svhdx_tunnel_resize_expand_only_flag
,
1222 { "ExpandOnly", "rsvd.svhdx_meta_operation.expand_only", FT_BOOLEAN
, BASE_NONE
,
1223 NULL
, 0, "Indicates that shared virtual disk size can only expand", HFILL
}},
1225 { &hf_svhdx_tunnel_resize_allow_unsafe_virt_size_flag
,
1226 { "AllowUnsafeVirtualSize", "rsvd.svhdx_meta_operation.allow_unsafe_virt_size", FT_BOOLEAN
, BASE_NONE
,
1227 NULL
, 0, "Indicates that the shared virtual disk size can be less than the data it currently contains", HFILL
}},
1229 { &hf_svhdx_tunnel_resize_shrink_to_minimum_safe_size_flag
,
1230 { "ShrinkToMinimumSafeSize", "rsvd.svhdx_meta_operation.shrink_to_minimum_safe_size", FT_BOOLEAN
, BASE_NONE
,
1231 NULL
, 0, "Indicates that the shared virtual disk size can be shrunk to the data it currently contains", HFILL
}},
1233 { &hf_svhdx_tunnel_meta_operation_start_reserved
,
1234 { "Reserved", "rsvd.svhdx_meta_operation.reserved", FT_UINT8
, BASE_DEC
,
1235 NULL
, 0, NULL
, HFILL
}},
1237 { &hf_svhdx_tunnel_snapshot_type
,
1238 { "SnapshotType", "rsvd.svhdx_snapshot_type", FT_UINT32
, BASE_HEX
,
1239 VALS(svhdx_snapshot_type_vals
), 0, "Type of snapshot", HFILL
}},
1241 { &hf_svhdx_tunnel_snapshot_id
,
1242 { "SnapshotId", "rsvd.svhdx_snapshot_id", FT_GUID
, BASE_NONE
,
1243 NULL
, 0, NULL
, HFILL
}},
1245 { &hf_svhdx_tunnel_create_snapshot_flags
,
1246 { "Flags", "rsvd.svhdx_meta_operation.create_snapshot_flags", FT_UINT32
, BASE_HEX
,
1247 NULL
, 0, NULL
, HFILL
}},
1249 { &hf_svhdx_tunnel_create_snapshot_flag_enable_change_tracking
,
1250 { "SVHDX_SNAPSHOT_DISK_FLAG_ENABLE_CHANGE_TRACKING", "rsvd.svhdx_meta_operation.create_snapshot_flag_enable_change_tracking", FT_BOOLEAN
, 32,
1251 NULL
, SVHDX_SNAPSHOT_DISK_FLAG_ENABLE_CHANGE_TRACKING
, "Change tracking to be enabled when snapshot is taken", HFILL
}},
1253 { &hf_svhdx_tunnel_create_snapshot_stage1
,
1254 { "Stage1", "rsvd.svhdx_meta_operation.create_snapshot_stage1", FT_UINT32
, BASE_HEX
,
1255 VALS(svhdx_snapshot_stage_vals
), 0, "The first stage", HFILL
}},
1257 { &hf_svhdx_tunnel_create_snapshot_stage2
,
1258 { "Stage2", "rsvd.svhdx_meta_operation.create_snapshot_stage2", FT_UINT32
, BASE_HEX
,
1259 VALS(svhdx_snapshot_stage_vals
), 0, "The second stage", HFILL
}},
1261 { &hf_svhdx_tunnel_create_snapshot_stage3
,
1262 { "Stage3", "rsvd.svhdx_meta_operation.create_snapshot_stage3", FT_UINT32
, BASE_HEX
,
1263 VALS(svhdx_snapshot_stage_vals
), 0, "The third stage", HFILL
}},
1265 { &hf_svhdx_tunnel_create_snapshot_stage4
,
1266 { "Stage4", "rsvd.svhdx_meta_operation.create_snapshot_stage4", FT_UINT32
, BASE_HEX
,
1267 VALS(svhdx_snapshot_stage_vals
), 0, "The fourth stage", HFILL
}},
1269 { &hf_svhdx_tunnel_create_snapshot_stage5
,
1270 { "Stage5", "rsvd.svhdx_meta_operation.create_snapshot_stage5", FT_UINT32
, BASE_HEX
,
1271 VALS(svhdx_snapshot_stage_vals
), 0, "The fifth stage", HFILL
}},
1273 { &hf_svhdx_tunnel_create_snapshot_stage6
,
1274 { "Stage6", "rsvd.svhdx_meta_operation.create_snapshot_stage6", FT_UINT32
, BASE_HEX
,
1275 VALS(svhdx_snapshot_stage_vals
), 0, "The sixth stage", HFILL
}},
1277 { &hf_svhdx_tunnel_create_snapshot_parameters_payload_size
,
1278 { "ParametersPayloadSize", "rsvd.svhdx_meta_operation.create_snapshot_params_payload_size", FT_UINT32
, BASE_DEC
,
1279 NULL
, 0, NULL
, HFILL
}},
1281 { &hf_svhdx_tunnel_convert_dst_vhdset_name_len
,
1282 { "DestinationVhdSetNameLength", "rsvd.svhdx_meta_operation.dst_vhdset_name_len", FT_UINT32
, BASE_DEC
,
1283 NULL
, 0, NULL
, HFILL
}},
1285 { &hf_svhdx_tunnel_convert_dst_vhdset_name
,
1286 { "DestinationVhdSetName", "rsvd.svhdx_meta_operation.dst_vhdset_name", FT_STRING
, BASE_NONE
,
1287 NULL
, 0, "Name for the new VHD set be created", HFILL
}},
1289 { &hf_svhdx_tunnel_delete_snapshot_persist_reference
,
1290 { "PersistReference", "rsvd.svhdx_delete_snapshot_persist_reference", FT_BOOLEAN
, BASE_NONE
,
1291 NULL
, 0, "Indicate if the snapshot needs to be persisted", HFILL
}},
1293 { &hf_svhdx_tunnel_meta_op_query_progress_current_progress
,
1294 { "CurrentProgressValue", "rsvd.svhdx_query_progress.current_progress", FT_UINT64
, BASE_DEC
,
1295 NULL
, 0, NULL
, HFILL
}},
1297 { &hf_svhdx_tunnel_meta_op_query_progress_complete_value
,
1298 { "CompleteValue", "rsvd.svhdx_query_progress.complete_value", FT_UINT64
, BASE_DEC
,
1299 NULL
, 0, NULL
, HFILL
}},
1301 { &hf_svhdx_tunnel_vhdset_information_type
,
1302 { "VHDSetInformationType", "rsvd.svhdx_vhdset_information_type", FT_UINT32
, BASE_HEX
,
1303 VALS(svhdx_vhdset_information_type_vals
), 0, "The information type requested", HFILL
}},
1305 { &hf_svhdx_tunnel_vhdset_snapshot_creation_time
,
1306 { "SnapshotCreationTime", "rsvd.svhdx_vhdset_snapshot_creation_time", FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
,
1307 NULL
, 0, "Time when this object was created", HFILL
}},
1309 { &hf_svhdx_tunnel_vhdset_is_valid_snapshot
,
1310 { "IsValidSnapshot", "rsvd.svhdx_vhdset_is_valid_snapshot", FT_BOOLEAN
, BASE_NONE
,
1311 NULL
, 0, "Set to 1 when the snapshot is valid", HFILL
}},
1313 { &hf_svhdx_tunnel_vhdset_parent_snapshot_id
,
1314 { "ParentSnapshotId", "rsvd.svhdx_vhdxset_parent_snapshot_id", FT_GUID
, BASE_NONE
,
1315 NULL
, 0, NULL
, HFILL
}},
1317 { &hf_svhdx_tunnel_vhdset_log_file_id
,
1318 { "LogFileId", "rsvd.svhdx_vhdxset_log_file_id", FT_GUID
, BASE_NONE
,
1319 NULL
, 0, NULL
, HFILL
}}
1322 static int *ett
[] = {
1324 &ett_svhdx_tunnel_op_header
,
1325 &ett_svhdx_tunnel_scsi_request
,
1326 &ett_rsvd_create_snapshot_flags
1329 proto_rsvd
= proto_register_protocol("Remote Shared Virtual Disk",
1332 register_dissector("rsvd", dissect_rsvd
, proto_rsvd
);
1333 proto_register_field_array(proto_rsvd
, hf
, array_length(hf
));
1334 proto_register_subtree_array(ett
, array_length(ett
));
1338 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1343 * indent-tabs-mode: nil
1346 * vi: set shiftwidth=4 tabstop=8 expandtab:
1347 * :indentSize=4:tabSize=8:noTabs=true: