1 /* TODO: fixup LUN tracking so we can pass the proper LUN across to
5 * Routines for NDMP dissection
6 * 2001 Ronnie Sahlberg (see AUTHORS for email)
10 * Ethereal - Network traffic analyzer
11 * By Gerald Combs <gerald@ethereal.com>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /* see www.ndmp.org for protocol specifications.
30 this file implements version 3 of ndmp
41 #include <epan/packet.h>
42 #include <epan/conversation.h>
43 #include "packet-rpc.h"
44 #include "packet-tcp.h"
45 #include "packet-scsi.h"
46 #include "packet-frame.h"
47 #include <epan/prefs.h>
48 #include <epan/reassemble.h>
49 #include <epan/dissectors/rpc_defrag.h>
51 #define TCP_PORT_NDMP 10000
53 static int proto_ndmp = -1;
54 static int hf_ndmp_lastfrag = -1;
55 static int hf_ndmp_fraglen = -1;
56 static int hf_ndmp_version = -1;
57 static int hf_ndmp_header = -1;
58 static int hf_ndmp_sequence = -1;
59 static int hf_ndmp_reply_sequence = -1;
60 static int hf_ndmp_timestamp = -1;
61 static int hf_ndmp_msgtype = -1;
62 static int hf_ndmp_msg = -1;
63 static int hf_ndmp_error = -1;
64 static int hf_ndmp_hostname = -1;
65 static int hf_ndmp_os_type = -1;
66 static int hf_ndmp_os_vers = -1;
67 static int hf_ndmp_hostid = -1;
68 static int hf_ndmp_addr_types = -1;
69 static int hf_ndmp_addr_type = -1;
70 static int hf_ndmp_auth_type = -1;
71 static int hf_ndmp_auth_types = -1;
72 static int hf_ndmp_auth_challenge = -1;
73 static int hf_ndmp_auth_digest = -1;
74 static int hf_ndmp_auth_id = -1;
75 static int hf_ndmp_auth_password = -1;
76 static int hf_ndmp_butype_info = -1;
77 static int hf_ndmp_butype_name = -1;
78 static int hf_ndmp_butype_default_env = -1;
79 static int hf_ndmp_butype_attr_backup_file_history = -1;
80 static int hf_ndmp_butype_attr_backup_filelist = -1;
81 static int hf_ndmp_butype_attr_recover_filelist = -1;
82 static int hf_ndmp_butype_attr_backup_direct = -1;
83 static int hf_ndmp_butype_attr_recover_direct = -1;
84 static int hf_ndmp_butype_attr_backup_incremental = -1;
85 static int hf_ndmp_butype_attr_recover_incremental = -1;
86 static int hf_ndmp_butype_attr_backup_utf8 = -1;
87 static int hf_ndmp_butype_attr_recover_utf8 = -1;
88 static int hf_ndmp_butype_env_name = -1;
89 static int hf_ndmp_butype_env_value = -1;
90 static int hf_ndmp_tcp_env_name = -1;
91 static int hf_ndmp_tcp_env_value = -1;
92 static int hf_ndmp_tcp_default_env = -1;
93 static int hf_ndmp_tcp_addr_list = -1;
94 static int hf_ndmp_fs_info = -1;
95 static int hf_ndmp_fs_invalid_total_size = -1;
96 static int hf_ndmp_fs_invalid_used_size = -1;
97 static int hf_ndmp_fs_invalid_avail_size = -1;
98 static int hf_ndmp_fs_invalid_total_inodes = -1;
99 static int hf_ndmp_fs_invalid_used_inodes = -1;
100 static int hf_ndmp_fs_fs_type = -1;
101 static int hf_ndmp_fs_logical_device = -1;
102 static int hf_ndmp_fs_physical_device = -1;
103 static int hf_ndmp_fs_total_size = -1;
104 static int hf_ndmp_fs_used_size = -1;
105 static int hf_ndmp_fs_avail_size = -1;
106 static int hf_ndmp_fs_total_inodes = -1;
107 static int hf_ndmp_fs_used_inodes = -1;
108 static int hf_ndmp_fs_env = -1;
109 static int hf_ndmp_fs_env_name = -1;
110 static int hf_ndmp_fs_env_value = -1;
111 static int hf_ndmp_fs_status = -1;
112 static int hf_ndmp_tape_info = -1;
113 static int hf_ndmp_tape_model = -1;
114 static int hf_ndmp_tape_dev_cap = -1;
115 static int hf_ndmp_tape_device = -1;
116 static int hf_ndmp_tape_open_mode = -1;
117 static int hf_ndmp_tape_attr_rewind = -1;
118 static int hf_ndmp_tape_attr_unload = -1;
119 static int hf_ndmp_tape_capability = -1;
120 static int hf_ndmp_tape_capability_name = -1;
121 static int hf_ndmp_tape_capability_value = -1;
122 static int hf_ndmp_scsi_info = -1;
123 static int hf_ndmp_scsi_model = -1;
124 static int hf_ndmp_server_vendor = -1;
125 static int hf_ndmp_server_product = -1;
126 static int hf_ndmp_server_revision = -1;
127 static int hf_ndmp_scsi_device = -1;
128 static int hf_ndmp_scsi_controller = -1;
129 static int hf_ndmp_scsi_id = -1;
130 static int hf_ndmp_scsi_lun = -1;
131 static int hf_ndmp_execute_cdb_flags_data_in = -1;
132 static int hf_ndmp_execute_cdb_flags_data_out = -1;
133 static int hf_ndmp_execute_cdb_timeout = -1;
134 static int hf_ndmp_execute_cdb_datain_len = -1;
135 static int hf_ndmp_execute_cdb_cdb_len = -1;
136 static int hf_ndmp_execute_cdb_dataout = -1;
137 static int hf_ndmp_execute_cdb_status = -1;
138 static int hf_ndmp_execute_cdb_dataout_len = -1;
139 static int hf_ndmp_execute_cdb_datain = -1;
140 static int hf_ndmp_execute_cdb_sns_len = -1;
141 static int hf_ndmp_tape_invalid_file_num = -1;
142 static int hf_ndmp_tape_invalid_soft_errors = -1;
143 static int hf_ndmp_tape_invalid_block_size = -1;
144 static int hf_ndmp_tape_invalid_block_no = -1;
145 static int hf_ndmp_tape_invalid_total_space = -1;
146 static int hf_ndmp_tape_invalid_space_remain = -1;
147 static int hf_ndmp_tape_invalid_partition = -1;
148 static int hf_ndmp_tape_flags_no_rewind = -1;
149 static int hf_ndmp_tape_flags_write_protect = -1;
150 static int hf_ndmp_tape_flags_error = -1;
151 static int hf_ndmp_tape_flags_unload = -1;
152 static int hf_ndmp_tape_file_num = -1;
153 static int hf_ndmp_tape_soft_errors = -1;
154 static int hf_ndmp_tape_block_size = -1;
155 static int hf_ndmp_tape_block_no = -1;
156 static int hf_ndmp_tape_total_space = -1;
157 static int hf_ndmp_tape_space_remain = -1;
158 static int hf_ndmp_tape_partition = -1;
159 static int hf_ndmp_tape_mtio_op = -1;
160 static int hf_ndmp_count = -1;
161 static int hf_ndmp_resid_count = -1;
162 static int hf_ndmp_mover_state = -1;
163 static int hf_ndmp_mover_pause = -1;
164 static int hf_ndmp_halt = -1;
165 static int hf_ndmp_halt_reason = -1;
166 static int hf_ndmp_record_size = -1;
167 static int hf_ndmp_record_num = -1;
168 static int hf_ndmp_data_written = -1;
169 static int hf_ndmp_seek_position = -1;
170 static int hf_ndmp_bytes_left_to_read = -1;
171 static int hf_ndmp_window_offset = -1;
172 static int hf_ndmp_window_length = -1;
173 static int hf_ndmp_addr_ip = -1;
174 static int hf_ndmp_addr_tcp = -1;
175 static int hf_ndmp_addr_fcal_loop_id = -1;
176 static int hf_ndmp_addr_ipc = -1;
177 static int hf_ndmp_mover_mode = -1;
178 static int hf_ndmp_file_name = -1;
179 static int hf_ndmp_nt_file_name = -1;
180 static int hf_ndmp_dos_file_name = -1;
181 static int hf_ndmp_log_type = -1;
182 static int hf_ndmp_log_message_id = -1;
183 static int hf_ndmp_log_message = -1;
184 static int hf_ndmp_connected = -1;
185 static int hf_ndmp_connected_reason = -1;
186 static int hf_ndmp_data = -1;
187 static int hf_ndmp_files = -1;
188 static int hf_ndmp_file_fs_type = -1;
189 static int hf_ndmp_file_names = -1;
190 static int hf_ndmp_file_stats = -1;
191 static int hf_ndmp_file_node = -1;
192 static int hf_ndmp_file_parent = -1;
193 static int hf_ndmp_file_fh_info = -1;
194 static int hf_ndmp_file_invalid_atime = -1;
195 static int hf_ndmp_file_invalid_ctime = -1;
196 static int hf_ndmp_file_invalid_group = -1;
197 static int hf_ndmp_file_type = -1;
198 static int hf_ndmp_file_mtime = -1;
199 static int hf_ndmp_file_atime = -1;
200 static int hf_ndmp_file_ctime = -1;
201 static int hf_ndmp_file_owner = -1;
202 static int hf_ndmp_file_group = -1;
203 static int hf_ndmp_file_fattr = -1;
204 static int hf_ndmp_file_size = -1;
205 static int hf_ndmp_file_links = -1;
206 static int hf_ndmp_dirs = -1;
207 static int hf_ndmp_nodes = -1;
208 static int hf_ndmp_nlist = -1;
209 static int hf_ndmp_bu_original_path = -1;
210 static int hf_ndmp_bu_destination_dir = -1;
211 static int hf_ndmp_bu_new_name = -1;
212 static int hf_ndmp_bu_other_name = -1;
213 static int hf_ndmp_state_invalid_ebr = -1;
214 static int hf_ndmp_state_invalid_etr = -1;
215 static int hf_ndmp_bu_operation = -1;
216 static int hf_ndmp_data_state = -1;
217 static int hf_ndmp_data_halted = -1;
218 static int hf_ndmp_data_bytes_processed = -1;
219 static int hf_ndmp_data_est_bytes_remain = -1;
220 static int hf_ndmp_data_est_time_remain = -1;
222 static gint ett_ndmp = -1;
223 static gint ett_ndmp_fraghdr = -1;
224 static gint ett_ndmp_header = -1;
225 static gint ett_ndmp_butype_attrs = -1;
226 static gint ett_ndmp_fs_invalid = -1;
227 static gint ett_ndmp_tape_attr = -1;
228 static gint ett_ndmp_execute_cdb_flags = -1;
229 static gint ett_ndmp_execute_cdb_cdb = -1;
230 static gint ett_ndmp_execute_cdb_sns = -1;
231 static gint ett_ndmp_execute_cdb_payload = -1;
232 static gint ett_ndmp_tape_invalid = -1;
233 static gint ett_ndmp_tape_flags = -1;
234 static gint ett_ndmp_addr = -1;
235 static gint ett_ndmp_file = -1;
236 static gint ett_ndmp_file_name = -1;
237 static gint ett_ndmp_file_stats = -1;
238 static gint ett_ndmp_file_invalids = -1;
239 static gint ett_ndmp_state_invalids = -1;
241 static struct true_false_string yesno = { "Yes", "No" };
243 /* XXX someone should start adding the new stuff from v3, v4 and v5*/
244 #define NDMP_PROTOCOL_V2 1
245 #define NDMP_PROTOCOL_V3 2
246 #define NDMP_PROTOCOL_V4 3
247 #define NDMP_PROTOCOL_V5 4
249 static enum_val_t ndmp_protocol_versions[] = {
250 { "version2", "Version 2", NDMP_PROTOCOL_V2 },
251 { "version3", "Version 3", NDMP_PROTOCOL_V3 },
252 { "version4", "Version 4", NDMP_PROTOCOL_V4 },
253 { "version5", "Version 5", NDMP_PROTOCOL_V5 },
257 static gint ndmp_protocol_version = NDMP_PROTOCOL_V2;
269 /* desegmentation of NDMP packets */
270 static gboolean ndmp_desegment = TRUE;
272 /* defragmentation of fragmented NDMP records */
273 static gboolean ndmp_defragment = TRUE;
275 #define NDMP_MESSAGE_REQUEST 0x00
276 #define NDMP_MESSAGE_REPLY 0x01
277 static const value_string msg_type_vals[] = {
278 {NDMP_MESSAGE_REQUEST, "Request"},
279 {NDMP_MESSAGE_REPLY, "Reply"},
283 #define NDMP_NO_ERR 0x00
284 #define NDMP_NOT_SUPPORTED_ERR 0x01
285 #define NDMP_DEVICE_BUSY_ERR 0x02
286 #define NDMP_DEVICE_OPENED_ERR 0x03
287 #define NDMP_NOT_AUTHORIZED_ERR 0x04
288 #define NDMP_PERMISSION_ERR 0x05
289 #define NDMP_DEV_NOT_OPEN_ERR 0x06
290 #define NDMP_IO_ERR 0x07
291 #define NDMP_TIMEOUT_ERR 0x08
292 #define NDMP_ILLEGAL_ARGS_ERR 0x09
293 #define NDMP_NO_TAPE_LOADED_ERR 0x0a
294 #define NDMP_WRITE_PROTECT_ERR 0x0b
295 #define NDMP_EOF_ERR 0x0c
296 #define NDMP_EOM_ERR 0x0d
297 #define NDMP_FILE_NOT_FOUND_ERR 0x0e
298 #define NDMP_BAD_FILE_ERR 0x0f
299 #define NDMP_NO_DEVICE_ERR 0x10
300 #define NDMP_NO_BUS_ERR 0x11
301 #define NDMP_XDR_DECODE_ERR 0x12
302 #define NDMP_ILLEGAL_STATE_ERR 0x13
303 #define NDMP_UNDEFINED_ERR 0x14
304 #define NDMP_XDR_ENCODE_ERR 0x15
305 #define NDMP_NO_MEM_ERR 0x16
306 #define NDMP_CONNECT_ERR 0x17
308 static const value_string error_vals[] = {
309 {NDMP_NO_ERR, "NO_ERR"},
310 {NDMP_NOT_SUPPORTED_ERR, "NOT_SUPPORTED_ERR"},
311 {NDMP_DEVICE_BUSY_ERR, "DEVICE_BUSY_ERR"},
312 {NDMP_DEVICE_OPENED_ERR, "DEVICE_OPENED_ERR"},
313 {NDMP_NOT_AUTHORIZED_ERR, "NOT_AUTHORIZED_ERR"},
314 {NDMP_PERMISSION_ERR, "PERMISSION_ERR"},
315 {NDMP_DEV_NOT_OPEN_ERR, "DEV_NOT_OPEN_ERR"},
316 {NDMP_IO_ERR, "IO_ERR"},
317 {NDMP_TIMEOUT_ERR, "TIMEOUT_ERR"},
318 {NDMP_ILLEGAL_ARGS_ERR, "ILLEGAL_ARGS_ERR"},
319 {NDMP_NO_TAPE_LOADED_ERR, "NO_TAPE_LOADED_ERR"},
320 {NDMP_WRITE_PROTECT_ERR, "WRITE_PROTECT_ERR"},
321 {NDMP_EOF_ERR, "EOF_ERR"},
322 {NDMP_EOM_ERR, "EOM_ERR"},
323 {NDMP_FILE_NOT_FOUND_ERR, "FILE_NOT_FOUND_ERR"},
324 {NDMP_BAD_FILE_ERR, "BAD_FILE_ERR"},
325 {NDMP_NO_DEVICE_ERR, "NO_DEVICE_ERR"},
326 {NDMP_NO_BUS_ERR, "NO_BUS_ERR"},
327 {NDMP_XDR_DECODE_ERR, "XDR_DECODE_ERR"},
328 {NDMP_ILLEGAL_STATE_ERR, "ILLEGAL_STATE_ERR"},
329 {NDMP_UNDEFINED_ERR, "UNDEFINED_ERR"},
330 {NDMP_XDR_ENCODE_ERR, "XDR_ENCODE_ERR"},
331 {NDMP_NO_MEM_ERR, "NO_MEM_ERR"},
332 {NDMP_CONNECT_ERR, "CONNECT_ERR"},
338 #define NDMP_CONFIG_GET_HOST_INFO 0x100
339 #define NDMP_CONFIG_GET_CONNECTION_TYPE 0x102
340 #define NDMP_CONFIG_GET_AUTH_ATTR 0x103
341 #define NDMP_CONFIG_GET_BUTYPE_INFO 0x104
342 #define NDMP_CONFIG_GET_FS_INFO 0x105
343 #define NDMP_CONFIG_GET_TAPE_INFO 0x106
344 #define NDMP_CONFIG_GET_SCSI_INFO 0x107
345 #define NDMP_CONFIG_GET_SERVER_INFO 0x108
346 #define NDMP_SCSI_OPEN 0x200
347 #define NDMP_SCSI_CLOSE 0x201
348 #define NDMP_SCSI_GET_STATE 0x202
349 #define NDMP_SCSI_SET_TARGET 0x203
350 #define NDMP_SCSI_RESET_DEVICE 0x204
351 #define NDMP_SCSI_RESET_BUS 0x205
352 #define NDMP_SCSI_EXECUTE_CDB 0x206
353 #define NDMP_TAPE_OPEN 0x300
354 #define NDMP_TAPE_CLOSE 0x301
355 #define NDMP_TAPE_GET_STATE 0x302
356 #define NDMP_TAPE_MTIO 0x303
357 #define NDMP_TAPE_WRITE 0x304
358 #define NDMP_TAPE_READ 0x305
359 #define NDMP_TAPE_EXECUTE_CDB 0x307
360 #define NDMP_DATA_GET_STATE 0x400
361 #define NDMP_DATA_START_BACKUP 0x401
362 #define NDMP_DATA_START_RECOVER 0x402
363 #define NDMP_DATA_ABORT 0x403
364 #define NDMP_DATA_GET_ENV 0x404
365 #define NDMP_DATA_STOP 0x407
366 #define NDMP_DATA_LISTEN 0x409
367 #define NDMP_DATA_CONNECT 0x40a
368 #define NDMP_NOTIFY_DATA_HALTED 0x501
369 #define NDMP_NOTIFY_CONNECTED 0x502
370 #define NDMP_NOTIFY_MOVER_HALTED 0x503
371 #define NDMP_NOTIFY_MOVER_PAUSED 0x504
372 #define NDMP_NOTIFY_DATA_READ 0x505
373 #define NDMP_LOG_FILE 0x602
374 #define NDMP_LOG_MESSAGE 0x603
375 #define NDMP_FH_ADD_FILE 0x703
376 #define NDMP_FH_ADD_DIR 0x704
377 #define NDMP_FH_ADD_NODE 0x705
378 #define NDMP_CONNECT_OPEN 0x900
379 #define NDMP_CONNECT_CLIENT_AUTH 0x901
380 #define NDMP_CONNECT_CLOSE 0x902
381 #define NDMP_CONNECT_SERVER_AUTH 0x903
382 #define NDMP_MOVER_GET_STATE 0xa00
383 #define NDMP_MOVER_LISTEN 0xa01
384 #define NDMP_MOVER_CONTINUE 0xa02
385 #define NDMP_MOVER_ABORT 0xa03
386 #define NDMP_MOVER_STOP 0xa04
387 #define NDMP_MOVER_SET_WINDOW 0xa05
388 #define NDMP_MOVER_READ 0xa06
389 #define NDMP_MOVER_CLOSE 0xa07
390 #define NDMP_MOVER_SET_RECORD_SIZE 0xa08
391 #define NDMP_MOVER_CONNECT 0xa09
396 static const value_string msg_vals[] = {
397 {NDMP_CONFIG_GET_HOST_INFO, "CONFIG_GET_HOST_INFO"},
398 {NDMP_CONFIG_GET_CONNECTION_TYPE, "CONFIG_GET_CONNECTION_TYPE"},
399 {NDMP_CONFIG_GET_AUTH_ATTR, "CONFIG_GET_AUTH_ATTR"},
400 {NDMP_CONFIG_GET_BUTYPE_INFO, "CONFIG_GET_BUTYPE_INFO"},
401 {NDMP_CONFIG_GET_FS_INFO, "CONFIG_GET_FS_INFO"},
402 {NDMP_CONFIG_GET_TAPE_INFO, "CONFIG_GET_TAPE_INFO"},
403 {NDMP_CONFIG_GET_SCSI_INFO, "CONFIG_GET_SCSI_INFO"},
404 {NDMP_CONFIG_GET_SERVER_INFO, "CONFIG_GET_SERVER_INFO"},
405 {NDMP_SCSI_OPEN, "SCSI_OPEN"},
406 {NDMP_SCSI_CLOSE, "SCSI_CLOSE"},
407 {NDMP_SCSI_GET_STATE, "SCSI_GET_STATE"},
408 {NDMP_SCSI_SET_TARGET, "SCSI_SET_TARGET"},
409 {NDMP_SCSI_RESET_DEVICE, "SCSI_RESET_DEVICE"},
410 {NDMP_SCSI_RESET_BUS, "SCSI_RESET_BUS"},
411 {NDMP_SCSI_EXECUTE_CDB, "SCSI_EXECUTE_CDB"},
412 {NDMP_TAPE_OPEN, "TAPE_OPEN"},
413 {NDMP_TAPE_CLOSE, "TAPE_CLOSE"},
414 {NDMP_TAPE_GET_STATE, "TAPE_GET_STATE"},
415 {NDMP_TAPE_MTIO, "TAPE_MTIO"},
416 {NDMP_TAPE_WRITE, "TAPE_WRITE"},
417 {NDMP_TAPE_READ, "TAPE_READ"},
418 {NDMP_TAPE_EXECUTE_CDB, "TAPE_EXECUTE_CDB"},
419 {NDMP_DATA_GET_STATE, "DATA_GET_STATE"},
420 {NDMP_DATA_START_BACKUP, "DATA_START_BACKUP"},
421 {NDMP_DATA_START_RECOVER, "DATA_START_RECOVER"},
422 {NDMP_DATA_ABORT, "DATA_ABORT"},
423 {NDMP_DATA_GET_ENV, "DATA_GET_ENV"},
424 {NDMP_DATA_STOP, "DATA_STOP"},
425 {NDMP_DATA_LISTEN, "DATA_LISTEN"},
426 {NDMP_DATA_CONNECT, "DATA_CONNECT"},
427 {NDMP_NOTIFY_DATA_HALTED, "NOTIFY_DATA_HALTED"},
428 {NDMP_NOTIFY_CONNECTED, "NOTIFY_CONNECTED"},
429 {NDMP_NOTIFY_MOVER_HALTED, "NOTIFY_MOVER_HALTED"},
430 {NDMP_NOTIFY_MOVER_PAUSED, "NOTIFY_MOVER_PAUSED"},
431 {NDMP_NOTIFY_DATA_READ, "NOTIFY_DATA_READ"},
432 {NDMP_LOG_FILE, "LOG_FILE"},
433 {NDMP_LOG_MESSAGE, "LOG_MESSAGE"},
434 {NDMP_FH_ADD_FILE, "FH_ADD_FILE"},
435 {NDMP_FH_ADD_DIR, "FH_ADD_DIR"},
436 {NDMP_FH_ADD_NODE, "FH_ADD_NODE"},
437 {NDMP_CONNECT_OPEN, "CONNECT_OPEN"},
438 {NDMP_CONNECT_CLIENT_AUTH, "CONNECT_CLIENT_AUTH"},
439 {NDMP_CONNECT_CLOSE, "CONNECT_CLOSE"},
440 {NDMP_CONNECT_SERVER_AUTH, "CONNECT_SERVER_AUTH"},
441 {NDMP_MOVER_GET_STATE, "MOVER_GET_STATE"},
442 {NDMP_MOVER_LISTEN, "MOVER_LISTEN"},
443 {NDMP_MOVER_CONTINUE, "MOVER_CONTINUE"},
444 {NDMP_MOVER_ABORT, "MOVER_ABORT"},
445 {NDMP_MOVER_STOP, "MOVER_STOP"},
446 {NDMP_MOVER_SET_WINDOW, "MOVER_SET_WINDOW"},
447 {NDMP_MOVER_READ, "MOVER_READ"},
448 {NDMP_MOVER_CLOSE, "MOVER_CLOSE"},
449 {NDMP_MOVER_SET_RECORD_SIZE, "MOVER_SET_RECORD_SIZE"},
450 {NDMP_MOVER_CONNECT, "MOVER_CONNECT"},
455 dissect_connect_open_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
456 proto_tree *tree, guint32 seq _U_)
459 proto_tree_add_item(tree, hf_ndmp_version, tvb, offset, 4, FALSE);
466 dissect_error(tvbuff_t *tvb, int offset, packet_info *pinfo,
467 proto_tree *tree, guint32 seq _U_)
472 err=tvb_get_ntohl(tvb, offset);
473 proto_tree_add_item(tree, hf_ndmp_error, tvb, offset, 4, FALSE);
474 if(err && check_col(pinfo->cinfo, COL_INFO)) {
475 col_append_fstr(pinfo->cinfo, COL_INFO,
477 val_to_str(err, error_vals,
478 "Unknown NDMP error code %#x"));
487 dissect_ndmp_get_host_info_reply(tvbuff_t *tvb, int offset,
488 packet_info *pinfo, proto_tree *tree, guint32 seq)
491 offset=dissect_error(tvb, offset, pinfo, tree, seq);
494 offset = dissect_rpc_string(tvb, tree,
495 hf_ndmp_hostname, offset, NULL);
498 offset = dissect_rpc_string(tvb, tree,
499 hf_ndmp_os_type, offset, NULL);
502 offset = dissect_rpc_string(tvb, tree,
503 hf_ndmp_os_vers, offset, NULL);
506 offset = dissect_rpc_string(tvb, tree,
507 hf_ndmp_hostid, offset, NULL);
512 #define NDMP_ADDR_LOCAL 0
513 #define NDMP_ADDR_TCP 1
514 #define NDMP_ADDR_FC 2
515 #define NDMP_ADDR_IPC 3
516 static const value_string addr_type_vals[] = {
517 {NDMP_ADDR_LOCAL, "Local"},
518 {NDMP_ADDR_TCP, "TCP"},
519 {NDMP_ADDR_FC, "FC"},
520 {NDMP_ADDR_IPC, "IPC"},
525 dissect_ndmp_addr_type(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
528 proto_tree_add_item(tree, hf_ndmp_addr_type, tvb, offset, 4, FALSE);
535 dissect_ndmp_addr_msg(tvbuff_t *tvb, int offset, packet_info *pinfo,
536 proto_tree *tree, guint32 seq _U_)
539 return dissect_ndmp_addr_type(tvb, offset, pinfo, tree);
543 dissect_ndmp_config_get_connection_type_reply(tvbuff_t *tvb, int offset,
544 packet_info *pinfo, proto_tree *tree, guint32 seq)
547 offset=dissect_error(tvb, offset, pinfo, tree, seq);
550 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
551 dissect_ndmp_addr_type, hf_ndmp_addr_types);
556 #define NDMP_AUTH_NONE 0
557 #define NDMP_AUTH_TEXT 1
558 #define NDMP_AUTH_MD5 2
559 static const value_string auth_type_vals[] = {
560 {NDMP_AUTH_NONE, "None"},
561 {NDMP_AUTH_TEXT, "Text"},
562 {NDMP_AUTH_MD5, "MD5"},
566 dissect_auth_type(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
569 proto_tree_add_item(tree, hf_ndmp_auth_type, tvb, offset, 4, FALSE);
576 dissect_get_auth_type_request(tvbuff_t *tvb, int offset, packet_info *pinfo,
577 proto_tree *tree, guint32 seq _U_)
580 return dissect_auth_type(tvb, offset, pinfo, tree);
584 dissect_auth_attr_msg(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
585 proto_tree *tree, guint32 seq _U_)
589 type=tvb_get_ntohl(tvb,offset);
592 proto_tree_add_item(tree, hf_ndmp_auth_type, tvb, offset, 4, FALSE);
601 proto_tree_add_item(tree, hf_ndmp_auth_challenge,
602 tvb, offset, 64, FALSE);
610 dissect_default_env(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
614 offset = dissect_rpc_string(tvb, tree,
615 hf_ndmp_butype_env_name, offset, NULL);
618 offset = dissect_rpc_string(tvb, tree,
619 hf_ndmp_butype_env_value, offset, NULL);
625 static const true_false_string tfs_butype_attr_backup_file_history = {
626 "Backup FILE HISTORY",
627 "Do NOT backup file history"
629 static const true_false_string tfs_butype_attr_backup_filelist = {
631 "Do NOT backup filelist"
633 static const true_false_string tfs_butype_attr_recover_filelist = {
635 "Do NOT recover filelist"
637 static const true_false_string tfs_butype_attr_backup_direct = {
638 "Perform DIRECT backup",
639 "Do NOT perform direct backup"
641 static const true_false_string tfs_butype_attr_recover_direct = {
642 "Perform DIRECT recovery",
643 "Do NOT perform direct recovery"
645 static const true_false_string tfs_butype_attr_backup_incremental = {
646 "Perform INCREMENTAL backup",
647 "Perform FULL backup"
649 static const true_false_string tfs_butype_attr_recover_incremental = {
650 "Perform INCREMENTAL revocery",
651 "Perform FULL recovery"
653 static const true_false_string tfs_butype_attr_backup_utf8 = {
655 "Normal backup. Do NOT use utf8"
657 static const true_false_string tfs_butype_attr_recover_utf8 = {
658 "Recover using UTF8",
659 "Normal recover. Do NOT use utf8"
662 dissect_butype_attrs(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
663 proto_tree *parent_tree)
665 proto_item* item = NULL;
666 proto_tree* tree = NULL;
669 flags=tvb_get_ntohl(tvb, offset);
671 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
672 "Attributes: 0x%08x", flags);
673 tree = proto_item_add_subtree(item, ett_ndmp_butype_attrs);
676 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_recover_utf8,
677 tvb, offset, 4, flags);
678 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_backup_utf8,
679 tvb, offset, 4, flags);
680 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_recover_incremental,
681 tvb, offset, 4, flags);
682 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_backup_incremental,
683 tvb, offset, 4, flags);
684 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_recover_direct,
685 tvb, offset, 4, flags);
686 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_backup_direct,
687 tvb, offset, 4, flags);
688 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_recover_filelist,
689 tvb, offset, 4, flags);
690 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_backup_filelist,
691 tvb, offset, 4, flags);
692 proto_tree_add_boolean(tree, hf_ndmp_butype_attr_backup_file_history,
693 tvb, offset, 4, flags);
700 dissect_butype_info(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
703 offset = dissect_rpc_string(tvb, tree,
704 hf_ndmp_butype_name, offset, NULL);
707 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
708 dissect_default_env, hf_ndmp_butype_default_env);
711 offset = dissect_butype_attrs(tvb, offset, pinfo, tree);
717 dissect_get_butype_info_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
718 proto_tree *tree, guint32 seq)
721 offset=dissect_error(tvb, offset, pinfo, tree, seq);
724 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
725 dissect_butype_info, hf_ndmp_butype_info);
730 static const true_false_string tfs_fs_invalid_total_size = {
731 "Total size is INVALID",
732 "Total size is VALID"
734 static const true_false_string tfs_fs_invalid_used_size = {
735 "Used size is INVALID",
738 static const true_false_string tfs_fs_invalid_avail_size = {
739 "Available size is INVALID",
740 "Available size is VALID"
742 static const true_false_string tfs_fs_invalid_total_inodes = {
743 "Total inode count is INVALID",
744 "Total inode count is VALID"
746 static const true_false_string tfs_fs_invalid_used_inodes = {
747 "Used inode count is INVALID",
748 "Used inode count is VALID"
751 dissect_fs_invalid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
752 proto_tree *parent_tree)
754 proto_item* item = NULL;
755 proto_tree* tree = NULL;
758 flags=tvb_get_ntohl(tvb, offset);
760 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
761 "Invalids: 0x%08x", flags);
762 tree = proto_item_add_subtree(item, ett_ndmp_fs_invalid);
765 proto_tree_add_boolean(tree, hf_ndmp_fs_invalid_used_inodes,
766 tvb, offset, 4, flags);
767 proto_tree_add_boolean(tree, hf_ndmp_fs_invalid_total_inodes,
768 tvb, offset, 4, flags);
769 proto_tree_add_boolean(tree, hf_ndmp_fs_invalid_avail_size,
770 tvb, offset, 4, flags);
771 proto_tree_add_boolean(tree, hf_ndmp_fs_invalid_used_size,
772 tvb, offset, 4, flags);
773 proto_tree_add_boolean(tree, hf_ndmp_fs_invalid_total_size,
774 tvb, offset, 4, flags);
781 dissect_fs_env(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
785 offset = dissect_rpc_string(tvb, tree,
786 hf_ndmp_fs_env_name, offset, NULL);
789 offset = dissect_rpc_string(tvb, tree,
790 hf_ndmp_fs_env_value, offset, NULL);
796 dissect_fs_info(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
799 offset=dissect_fs_invalid(tvb, offset, pinfo, tree);
802 offset = dissect_rpc_string(tvb, tree,
803 hf_ndmp_fs_fs_type, offset, NULL);
805 /* fs logical device */
806 offset = dissect_rpc_string(tvb, tree,
807 hf_ndmp_fs_logical_device, offset, NULL);
809 /* fs physical device */
810 offset = dissect_rpc_string(tvb, tree,
811 hf_ndmp_fs_physical_device, offset, NULL);
814 offset = dissect_rpc_uint64(tvb, tree, hf_ndmp_fs_total_size,
818 offset = dissect_rpc_uint64(tvb, tree, hf_ndmp_fs_used_size,
822 offset = dissect_rpc_uint64(tvb, tree, hf_ndmp_fs_avail_size,
826 offset = dissect_rpc_uint64(tvb, tree, hf_ndmp_fs_total_inodes,
830 offset = dissect_rpc_uint64(tvb, tree, hf_ndmp_fs_used_inodes,
834 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
835 dissect_fs_env, hf_ndmp_fs_env);
838 offset = dissect_rpc_string(tvb, tree,
839 hf_ndmp_fs_status, offset, NULL);
845 dissect_get_fs_info_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
846 proto_tree *tree, guint32 seq)
849 offset=dissect_error(tvb, offset, pinfo, tree, seq);
852 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
853 dissect_fs_info, hf_ndmp_fs_info);
858 static const true_false_string tfs_tape_attr_rewind = {
859 "Device supports REWIND",
860 "Device does NOT support rewind"
862 static const true_false_string tfs_tape_attr_unload = {
863 "Device supports UNLOAD",
864 "Device does NOT support unload"
867 dissect_tape_attr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
868 proto_tree *parent_tree)
870 proto_item* item = NULL;
871 proto_tree* tree = NULL;
874 flags=tvb_get_ntohl(tvb, offset);
876 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
877 "Attributes: 0x%08x", flags);
878 tree = proto_item_add_subtree(item, ett_ndmp_tape_attr);
881 proto_tree_add_boolean(tree, hf_ndmp_tape_attr_unload,
882 tvb, offset, 4, flags);
883 proto_tree_add_boolean(tree, hf_ndmp_tape_attr_rewind,
884 tvb, offset, 4, flags);
891 dissect_tape_capability(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
895 offset = dissect_rpc_string(tvb, tree,
896 hf_ndmp_tape_capability_name, offset, NULL);
899 offset = dissect_rpc_string(tvb, tree,
900 hf_ndmp_tape_capability_value, offset, NULL);
906 dissect_tape_dev_cap(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
909 offset = dissect_rpc_string(tvb, tree,
910 hf_ndmp_tape_device, offset, NULL);
912 /* tape attributes */
913 offset = dissect_tape_attr(tvb, offset, pinfo, tree);
916 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
917 dissect_tape_capability, hf_ndmp_tape_capability);
923 dissect_tape_info(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
926 offset = dissect_rpc_string(tvb, tree,
927 hf_ndmp_tape_model, offset, NULL);
929 /* device capabilites */
930 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
931 dissect_tape_dev_cap, hf_ndmp_tape_dev_cap);
937 dissect_get_tape_info_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
938 proto_tree *tree, guint32 seq)
941 offset=dissect_error(tvb, offset, pinfo, tree, seq);
944 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
945 dissect_tape_info, hf_ndmp_tape_info);
951 dissect_scsi_info(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
954 offset = dissect_rpc_string(tvb, tree,
955 hf_ndmp_scsi_model, offset, NULL);
957 /* device capabilites */
958 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
959 dissect_tape_dev_cap, hf_ndmp_tape_dev_cap);
965 dissect_get_scsi_info_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
966 proto_tree *tree, guint32 seq)
969 offset=dissect_error(tvb, offset, pinfo, tree, seq);
972 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
973 dissect_scsi_info, hf_ndmp_scsi_info);
979 dissect_get_server_info_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
980 proto_tree *tree, guint32 seq)
983 offset=dissect_error(tvb, offset, pinfo, tree, seq);
986 offset = dissect_rpc_string(tvb, tree,
987 hf_ndmp_server_vendor, offset, NULL);
990 offset = dissect_rpc_string(tvb, tree,
991 hf_ndmp_server_product, offset, NULL);
994 offset = dissect_rpc_string(tvb, tree,
995 hf_ndmp_server_revision, offset, NULL);
999 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
1000 dissect_auth_type, hf_ndmp_auth_types);
1006 dissect_scsi_open_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1007 proto_tree *tree, guint32 seq _U_)
1010 offset = dissect_rpc_string(tvb, tree,
1011 hf_ndmp_scsi_device, offset, NULL);
1017 dissect_scsi_get_state_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1018 proto_tree *tree, guint32 seq)
1021 offset=dissect_error(tvb, offset, pinfo, tree, seq);
1024 proto_tree_add_item(tree, hf_ndmp_scsi_controller, tvb, offset, 4, FALSE);
1028 proto_tree_add_item(tree, hf_ndmp_scsi_id, tvb, offset, 4, FALSE);
1032 proto_tree_add_item(tree, hf_ndmp_scsi_lun, tvb, offset, 4, FALSE);
1039 dissect_scsi_set_state_request(tvbuff_t *tvb, int offset,
1040 packet_info *pinfo _U_, proto_tree *tree, guint32 seq _U_)
1043 offset = dissect_rpc_string(tvb, tree,
1044 hf_ndmp_scsi_device, offset, NULL);
1047 proto_tree_add_item(tree, hf_ndmp_scsi_controller, tvb, offset, 4, FALSE);
1051 proto_tree_add_item(tree, hf_ndmp_scsi_id, tvb, offset, 4, FALSE);
1055 proto_tree_add_item(tree, hf_ndmp_scsi_lun, tvb, offset, 4, FALSE);
1062 dissect_execute_cdb_flags(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1063 proto_tree *parent_tree)
1065 proto_item* item = NULL;
1066 proto_tree* tree = NULL;
1069 flags = tvb_get_ntohl(tvb, offset);
1071 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
1072 "Flags: 0x%08x", flags);
1073 tree = proto_item_add_subtree(item, ett_ndmp_execute_cdb_flags);
1076 proto_tree_add_boolean(tree, hf_ndmp_execute_cdb_flags_data_in,
1077 tvb, offset, 4, flags);
1078 proto_tree_add_boolean(tree, hf_ndmp_execute_cdb_flags_data_out,
1079 tvb, offset, 4, flags);
1085 dissect_execute_cdb_cdb(tvbuff_t *tvb, int offset, packet_info *pinfo,
1086 proto_tree *parent_tree, gint devtype)
1088 proto_item* item = NULL;
1089 proto_tree* tree = NULL;
1091 guint32 cdb_len_full;
1093 cdb_len = tvb_get_ntohl(tvb, offset);
1094 cdb_len_full = rpc_roundup(cdb_len);
1097 item = proto_tree_add_text(parent_tree, tvb, offset,
1098 4+cdb_len_full, "CDB");
1099 tree = proto_item_add_subtree(item, ett_ndmp_execute_cdb_cdb);
1102 proto_tree_add_uint(tree, hf_ndmp_execute_cdb_cdb_len, tvb, offset, 4,
1108 int tvb_len, tvb_rlen;
1110 tvb_len=tvb_length_remaining(tvb, offset);
1113 tvb_rlen=tvb_reported_length_remaining(tvb, offset);
1116 cdb_tvb=tvb_new_subset(tvb, offset, tvb_len, tvb_rlen);
1117 dissect_scsi_cdb(cdb_tvb, pinfo, tree, devtype, 0xffff);
1118 offset += cdb_len_full;
1126 dissect_execute_cdb_payload(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree,
1127 const char *name, int hf_len, gboolean isreq)
1129 proto_item* item = NULL;
1130 proto_tree* tree = NULL;
1131 guint32 payload_len;
1132 guint32 payload_len_full;
1134 payload_len = tvb_get_ntohl(tvb, offset);
1135 payload_len_full = rpc_roundup(payload_len);
1138 item = proto_tree_add_text(parent_tree, tvb, offset,
1139 4+payload_len_full, "%s", name);
1140 tree = proto_item_add_subtree(item,
1141 ett_ndmp_execute_cdb_payload);
1144 proto_tree_add_uint(tree, hf_len, tvb, offset, 4, payload_len);
1147 if (payload_len != 0) {
1149 int tvb_len, tvb_rlen;
1151 tvb_len=tvb_length_remaining(tvb, offset);
1152 if(tvb_len>(int)payload_len)
1153 tvb_len=payload_len;
1154 tvb_rlen=tvb_reported_length_remaining(tvb, offset);
1155 if(tvb_rlen>(int)payload_len)
1156 tvb_rlen=payload_len;
1157 data_tvb=tvb_new_subset(tvb, offset, tvb_len, tvb_rlen);
1159 dissect_scsi_payload(data_tvb, pinfo, tree, isreq,
1161 offset += payload_len_full;
1168 * XXX - we assume that NDMP_SCSI_EXECUTE_CDB requests only go to SCSI Media
1169 * Changer devices and NDMP_TAPE_EXECUTE_CDB only go to SCSI Sequential
1172 * If that's not the case, we'll have to use the SCSI dissector's mechanisms
1173 * for saving inquiry data for devices, and use inquiry data when available.
1174 * Unfortunately, that means we need to save the name of the device, and
1175 * use it as a device identifier; as the name isn't available in the
1176 * NDMP_SCSI_EXECUTE_CDB or NDMP_TAPE_EXECUTE_CDB messages, that means
1177 * we need to remember the currently-opened "SCSI" and "TAPE" devices
1178 * from NDMP_SCSI_OPEN and NDMP_TAPE_OPEN, and attach to all frames
1179 * that are the ones that trigger the dissection of NDMP_SCSI_EXECUTE_CDB
1180 * or NDMP_TAPE_EXECUTE_CDB requests pointers to those names.
1183 dissect_execute_cdb_request(tvbuff_t *tvb, int offset, packet_info *pinfo,
1184 proto_tree *tree, guint32 seq, gint devtype)
1186 conversation_t *conversation;
1187 scsi_task_id_t task_key;
1190 * We need to provide SCSI task information to the SCSI
1191 * dissection routines. We use a conversation plus the
1192 * sequence number in requests and the reply sequence
1193 * number in replies to identify SCSI tasks.
1195 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
1196 pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
1197 if (conversation == NULL) {
1198 conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
1199 pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
1201 task_key.conv_id = conversation->index;
1202 task_key.task_id = seq;
1203 pinfo->private_data = &task_key;
1206 offset = dissect_execute_cdb_flags(tvb, offset, pinfo, tree);
1209 proto_tree_add_item(tree, hf_ndmp_execute_cdb_timeout, tvb, offset, 4, FALSE);
1213 proto_tree_add_item(tree, hf_ndmp_execute_cdb_datain_len, tvb, offset, 4, FALSE);
1217 offset = dissect_execute_cdb_cdb(tvb, offset, pinfo, tree, devtype);
1220 offset = dissect_execute_cdb_payload(tvb, offset, pinfo, tree,
1221 "Data out", hf_ndmp_execute_cdb_dataout_len, TRUE);
1227 dissect_execute_cdb_request_mc(tvbuff_t *tvb, int offset, packet_info *pinfo,
1228 proto_tree *tree, guint32 seq)
1230 return dissect_execute_cdb_request(tvb, offset, pinfo, tree, seq,
1235 dissect_execute_cdb_request_tape(tvbuff_t *tvb, int offset, packet_info *pinfo,
1236 proto_tree *tree, guint32 seq)
1238 return dissect_execute_cdb_request(tvb, offset, pinfo, tree, seq,
1243 dissect_execute_cdb_sns(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree)
1245 proto_item* item = NULL;
1246 proto_tree* tree = NULL;
1248 guint32 sns_len_full;
1250 sns_len = tvb_get_ntohl(tvb, offset);
1251 sns_len_full = rpc_roundup(sns_len);
1254 item = proto_tree_add_text(parent_tree, tvb, offset,
1255 4+sns_len_full, "Sense data");
1256 tree = proto_item_add_subtree(item, ett_ndmp_execute_cdb_sns);
1259 proto_tree_add_uint(tree, hf_ndmp_execute_cdb_sns_len, tvb, offset, 4,
1264 dissect_scsi_snsinfo(tvb, pinfo, tree, offset, sns_len, 0xffff);
1265 offset += sns_len_full;
1272 dissect_execute_cdb_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1273 proto_tree *tree, guint32 seq)
1275 conversation_t *conversation;
1276 scsi_task_id_t task_key;
1279 * We need to provide SCSI task information to the SCSI
1280 * dissection routines. We use a conversation plus the
1281 * sequence number in requests and the reply sequence
1282 * number in replies to identify SCSI tasks.
1284 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
1285 pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
1286 if (conversation != NULL) {
1287 task_key.conv_id = conversation->index;
1288 task_key.task_id = seq;
1289 pinfo->private_data = &task_key;
1291 /* no conversation, meaning we didn't see the request */
1292 pinfo->private_data = NULL;
1296 offset=dissect_error(tvb, offset, pinfo, tree, seq);
1299 proto_tree_add_item(tree, hf_ndmp_execute_cdb_status, tvb, offset, 4, FALSE);
1303 proto_tree_add_item(tree, hf_ndmp_execute_cdb_dataout_len, tvb, offset, 4, FALSE);
1307 offset = dissect_execute_cdb_payload(tvb, offset, pinfo, tree,
1308 "Data in", hf_ndmp_execute_cdb_datain_len, FALSE);
1311 offset = dissect_execute_cdb_sns(tvb, offset, pinfo, tree);
1316 #define NDMP_TAPE_OPEN_MODE_READ 0
1317 #define NDMP_TAPE_OPEN_MODE_RDWR 1
1318 static const value_string tape_open_mode_vals[] = {
1319 {NDMP_TAPE_OPEN_MODE_READ, "Read"},
1320 {NDMP_TAPE_OPEN_MODE_RDWR, "Read/Write"},
1325 dissect_tape_open_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1326 proto_tree *tree, guint32 seq _U_)
1329 offset = dissect_rpc_string(tvb, tree,
1330 hf_ndmp_tape_device, offset, NULL);
1333 proto_tree_add_item(tree, hf_ndmp_tape_open_mode, tvb, offset, 4, FALSE);
1340 static const true_false_string tfs_ndmp_tape_invalid_file_num = {
1341 "File num is valid",
1342 "File num is INVALID"
1344 static const true_false_string tfs_ndmp_tape_invalid_soft_errors = {
1345 "Soft errors is valid",
1346 "Soft errors is INVALID"
1348 static const true_false_string tfs_ndmp_tape_invalid_block_size = {
1349 "Block size is valid",
1350 "Block size is INVALID"
1352 static const true_false_string tfs_ndmp_tape_invalid_block_no = {
1353 "Block no is valid",
1354 "Block no is INVALID"
1356 static const true_false_string tfs_ndmp_tape_invalid_total_space = {
1357 "Total space is valid",
1358 "Total space is INVALID"
1360 static const true_false_string tfs_ndmp_tape_invalid_space_remain = {
1361 "Space remaining is INVALID",
1362 "Space remaining is valid"
1364 static const true_false_string tfs_ndmp_tape_invalid_partition = {
1365 "Partition is INVALID",
1366 "Partition is valid"
1369 dissect_tape_invalid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1370 proto_tree *parent_tree)
1372 proto_item* item = NULL;
1373 proto_tree* tree = NULL;
1376 flags=tvb_get_ntohl(tvb, offset);
1378 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
1379 "Invalids: 0x%08x", flags);
1380 tree = proto_item_add_subtree(item, ett_ndmp_tape_invalid);
1383 proto_tree_add_boolean(tree, hf_ndmp_tape_invalid_partition,
1384 tvb, offset, 4, flags);
1385 proto_tree_add_boolean(tree, hf_ndmp_tape_invalid_space_remain,
1386 tvb, offset, 4, flags);
1387 proto_tree_add_boolean(tree, hf_ndmp_tape_invalid_total_space,
1388 tvb, offset, 4, flags);
1389 proto_tree_add_boolean(tree, hf_ndmp_tape_invalid_block_no,
1390 tvb, offset, 4, flags);
1391 proto_tree_add_boolean(tree, hf_ndmp_tape_invalid_block_size,
1392 tvb, offset, 4, flags);
1393 proto_tree_add_boolean(tree, hf_ndmp_tape_invalid_soft_errors,
1394 tvb, offset, 4, flags);
1395 proto_tree_add_boolean(tree, hf_ndmp_tape_invalid_file_num,
1396 tvb, offset, 4, flags);
1402 static const true_false_string tfs_ndmp_tape_flags_no_rewind = {
1403 "This is a NON-REWINDING device",
1404 "This device supports rewind"
1406 static const true_false_string tfs_ndmp_tape_flags_write_protect = {
1407 "This device is WRITE-PROTECTED",
1408 "This device is NOT write-protected"
1410 static const true_false_string tfs_ndmp_tape_flags_error = {
1411 "This device shows ERROR",
1412 "This device shows NO errors"
1414 static const true_false_string tfs_ndmp_tape_flags_unload = {
1415 "This device supports UNLOAD",
1416 "This device does NOT support unload"
1419 dissect_tape_flags(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1420 proto_tree *parent_tree)
1422 proto_item* item = NULL;
1423 proto_tree* tree = NULL;
1426 flags=tvb_get_ntohl(tvb, offset);
1428 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
1429 "Flags: 0x%08x", flags);
1430 tree = proto_item_add_subtree(item, ett_ndmp_tape_flags);
1434 proto_tree_add_boolean(tree, hf_ndmp_tape_flags_unload,
1435 tvb, offset, 4, flags);
1436 proto_tree_add_boolean(tree, hf_ndmp_tape_flags_error,
1437 tvb, offset, 4, flags);
1438 proto_tree_add_boolean(tree, hf_ndmp_tape_flags_write_protect,
1439 tvb, offset, 4, flags);
1440 proto_tree_add_boolean(tree, hf_ndmp_tape_flags_no_rewind,
1441 tvb, offset, 4, flags);
1448 dissect_tape_get_state_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1449 proto_tree *tree, guint32 seq)
1452 offset=dissect_tape_invalid(tvb, offset, pinfo, tree);
1455 offset=dissect_error(tvb, offset, pinfo, tree, seq);
1458 offset=dissect_tape_flags(tvb, offset, pinfo, tree);
1461 proto_tree_add_item(tree, hf_ndmp_tape_file_num, tvb, offset, 4, FALSE);
1465 proto_tree_add_item(tree, hf_ndmp_tape_soft_errors, tvb, offset, 4, FALSE);
1469 proto_tree_add_item(tree, hf_ndmp_tape_block_size, tvb, offset, 4, FALSE);
1473 proto_tree_add_item(tree, hf_ndmp_tape_block_no, tvb, offset, 4, FALSE);
1477 offset = dissect_rpc_uint64(tvb, tree,hf_ndmp_tape_total_space,
1481 offset = dissect_rpc_uint64(tvb, tree,hf_ndmp_tape_space_remain,
1485 proto_tree_add_item(tree, hf_ndmp_tape_partition, tvb, offset, 4, FALSE);
1491 #define NDMP_TAPE_MTIO_FSF 0
1492 #define NDMP_TAPE_MTIO_BSF 1
1493 #define NDMP_TAPE_MTIO_FSR 2
1494 #define NDMP_TAPE_MTIO_BSR 3
1495 #define NDMP_TAPE_MTIO_REW 4
1496 #define NDMP_TAPE_MTIO_EOF 5
1497 #define NDMP_TAPE_MTIO_OFF 6
1498 static const value_string tape_mtio_vals[] = {
1499 {NDMP_TAPE_MTIO_FSF, "FSF"},
1500 {NDMP_TAPE_MTIO_BSF, "BSF"},
1501 {NDMP_TAPE_MTIO_FSR, "FSR"},
1502 {NDMP_TAPE_MTIO_BSR, "BSR"},
1503 {NDMP_TAPE_MTIO_REW, "REW"},
1504 {NDMP_TAPE_MTIO_EOF, "EOF"},
1505 {NDMP_TAPE_MTIO_OFF, "OFF"},
1510 dissect_tape_mtio_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1511 proto_tree *tree, guint32 seq _U_)
1514 proto_tree_add_item(tree, hf_ndmp_tape_mtio_op, tvb, offset, 4, FALSE);
1518 proto_tree_add_item(tree, hf_ndmp_count, tvb, offset, 4, FALSE);
1525 dissect_tape_mtio_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1526 proto_tree *tree, guint32 seq)
1529 offset=dissect_error(tvb, offset, pinfo, tree, seq);
1532 proto_tree_add_item(tree, hf_ndmp_resid_count, tvb, offset, 4, FALSE);
1538 #define NDMP_MOVER_STATE_IDLE 0
1539 #define NDMP_MOVER_STATE_LISTEN 1
1540 #define NDMP_MOVER_STATE_ACTIVE 2
1541 #define NDMP_MOVER_STATE_PAUSED 3
1542 #define NDMP_MOVER_STATE_HALTED 4
1543 static const value_string mover_state_vals[] = {
1544 {NDMP_MOVER_STATE_IDLE, "MOVER_STATE_IDLE"},
1545 {NDMP_MOVER_STATE_LISTEN, "MOVER_STATE_LISTEN"},
1546 {NDMP_MOVER_STATE_ACTIVE, "MOVER_STATE_ACTIVE"},
1547 {NDMP_MOVER_STATE_PAUSED, "MOVER_STATE_PAUSED"},
1548 {NDMP_MOVER_STATE_HALTED, "MOVER_STATE_HALTED"},
1552 #define NDMP_MOVER_PAUSE_NA 0
1553 #define NDMP_MOVER_PAUSE_EOM 1
1554 #define NDMP_MOVER_PAUSE_EOF 2
1555 #define NDMP_MOVER_PAUSE_SEEK 3
1556 #define NDMP_MOVER_PAUSE_MEDIA_ERROR 4
1557 #define NDMP_MOVER_PAUSE_EOW 5
1558 static const value_string mover_pause_vals[] = {
1559 {NDMP_MOVER_PAUSE_NA, "MOVER_PAUSE_NA"},
1560 {NDMP_MOVER_PAUSE_EOM, "MOVER_PAUSE_EOM"},
1561 {NDMP_MOVER_PAUSE_EOF, "MOVER_PAUSE_EOF"},
1562 {NDMP_MOVER_PAUSE_SEEK, "MOVER_PAUSE_SEEK"},
1563 {NDMP_MOVER_PAUSE_MEDIA_ERROR, "MOVER_PAUSE_MEDIA_ERROR"},
1564 {NDMP_MOVER_PAUSE_EOW, "MOVER_PAUSE_EOW"},
1568 #define NDMP_HALT_NA 0
1569 #define NDMP_HALT_CONNECT_CLOSE 1
1570 #define NDMP_HALT_ABORTED 2
1571 #define NDMP_HALT_INTERNAL_ERROR 3
1572 #define NDMP_HALT_CONNECT_ERROR 4
1573 static const value_string halt_vals[] = {
1574 {NDMP_HALT_NA, "HALT_NA"},
1575 {NDMP_HALT_CONNECT_CLOSE, "HALT_CONNECT_CLOSE"},
1576 {NDMP_HALT_ABORTED, "HALT_ABORTED"},
1577 {NDMP_HALT_INTERNAL_ERROR, "HALT_INTERNAL_ERROR"},
1578 {NDMP_HALT_CONNECT_ERROR, "HALT_CONNECT_ERROR"},
1583 dissect_tcp_env(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1586 offset = dissect_rpc_string(tvb, tree,
1587 hf_ndmp_tcp_env_name, offset, NULL);
1590 offset = dissect_rpc_string(tvb, tree,
1591 hf_ndmp_tcp_env_value, offset, NULL);
1598 dissect_ndmp_v4_tcp_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1601 proto_tree_add_item(tree, hf_ndmp_addr_ip, tvb, offset, 4, FALSE);
1605 proto_tree_add_item(tree, hf_ndmp_addr_tcp, tvb, offset, 4, FALSE);
1609 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
1610 dissect_tcp_env, hf_ndmp_tcp_default_env);
1616 dissect_ndmp_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1617 proto_tree *parent_tree)
1619 proto_item* item = NULL;
1620 proto_tree* tree = NULL;
1623 type=tvb_get_ntohl(tvb, offset);
1625 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
1626 "Type: %s ", val_to_str(type, addr_type_vals,"Unknown addr type (0x%02x)") );
1627 tree = proto_item_add_subtree(item, ett_ndmp_addr);
1631 proto_tree_add_item(tree, hf_ndmp_addr_type, tvb, offset, 4, FALSE);
1636 case NDMP_ADDR_LOCAL:
1639 /* this became an array in version 4 and beyond */
1640 if(ndmp_protocol_version<NDMP_PROTOCOL_V4){
1642 proto_tree_add_item(tree, hf_ndmp_addr_ip, tvb, offset, 4, FALSE);
1646 proto_tree_add_item(tree, hf_ndmp_addr_tcp, tvb, offset, 4, FALSE);
1649 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
1650 dissect_ndmp_v4_tcp_addr, hf_ndmp_tcp_addr_list);
1657 proto_tree_add_item(tree, hf_ndmp_addr_fcal_loop_id, tvb, offset, 4, FALSE);
1663 offset = dissect_rpc_data(tvb, tree, hf_ndmp_addr_ipc, offset);
1671 dissect_data_connect_msg(tvbuff_t *tvb, int offset, packet_info *pinfo,
1672 proto_tree *tree, guint32 seq _U_)
1675 offset=dissect_ndmp_addr(tvb, offset, pinfo, tree);
1681 dissect_mover_get_state_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1682 proto_tree *tree, guint32 seq)
1685 offset=dissect_error(tvb, offset, pinfo, tree, seq);
1687 /* mode is only present in version 4 and beyond */
1688 if(ndmp_protocol_version>=NDMP_PROTOCOL_V4){
1689 proto_tree_add_item(tree, hf_ndmp_mover_mode, tvb, offset, 4, FALSE);
1694 proto_tree_add_item(tree, hf_ndmp_mover_state, tvb, offset, 4, FALSE);
1698 proto_tree_add_item(tree, hf_ndmp_mover_pause, tvb, offset, 4, FALSE);
1702 proto_tree_add_item(tree, hf_ndmp_halt, tvb, offset, 4, FALSE);
1706 proto_tree_add_item(tree, hf_ndmp_record_size, tvb, offset, 4, FALSE);
1710 proto_tree_add_item(tree, hf_ndmp_record_num, tvb, offset, 4, FALSE);
1714 proto_tree_add_item(tree, hf_ndmp_data_written, tvb, offset, 8, FALSE);
1718 proto_tree_add_item(tree, hf_ndmp_seek_position, tvb, offset, 8, FALSE);
1721 /* bytes left to read */
1722 proto_tree_add_item(tree, hf_ndmp_bytes_left_to_read, tvb, offset, 8, FALSE);
1726 proto_tree_add_item(tree, hf_ndmp_window_offset, tvb, offset, 8, FALSE);
1730 proto_tree_add_item(tree, hf_ndmp_window_length, tvb, offset, 8, FALSE);
1733 /* this is where v2 ends */
1734 if(ndmp_protocol_version==NDMP_PROTOCOL_V2){
1740 offset=dissect_ndmp_addr(tvb, offset, pinfo, tree);
1745 #define NDMP_MOVER_MODE_READ 0
1746 #define NDMP_MOVER_MODE_WRITE 1
1747 #define NDMP_MOVER_MODE_NOACTION 2
1748 static const value_string mover_mode_vals[] = {
1749 {NDMP_MOVER_MODE_READ, "MOVER_MODE_READ"},
1750 {NDMP_MOVER_MODE_WRITE, "MOVER_MODE_WRITE"},
1751 {NDMP_MOVER_MODE_NOACTION, "MOVER_MODE_NOACTION"},
1756 dissect_mover_listen_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1757 proto_tree *tree, guint32 seq _U_)
1760 proto_tree_add_item(tree, hf_ndmp_mover_mode, tvb, offset, 4, FALSE);
1764 proto_tree_add_item(tree, hf_ndmp_addr_type, tvb, offset, 4, FALSE);
1771 dissect_mover_listen_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1772 proto_tree *tree, guint32 seq)
1775 offset=dissect_error(tvb, offset, pinfo, tree, seq);
1778 offset=dissect_ndmp_addr(tvb, offset, pinfo, tree);
1784 dissect_mover_set_window_request(tvbuff_t *tvb, int offset,
1785 packet_info *pinfo _U_, proto_tree *tree, guint32 seq _U_)
1788 proto_tree_add_item(tree, hf_ndmp_window_offset, tvb, offset, 8, FALSE);
1792 proto_tree_add_item(tree, hf_ndmp_window_length, tvb, offset, 8, FALSE);
1799 dissect_mover_set_record_size_request(tvbuff_t *tvb, int offset,
1800 packet_info *pinfo _U_, proto_tree *tree, guint32 seq _U_)
1803 proto_tree_add_item(tree, hf_ndmp_record_size, tvb, offset, 4, FALSE);
1810 dissect_mover_connect_request(tvbuff_t *tvb, int offset, packet_info *pinfo,
1811 proto_tree *tree, guint32 seq _U_)
1814 proto_tree_add_item(tree, hf_ndmp_mover_mode, tvb, offset, 4, FALSE);
1818 offset=dissect_ndmp_addr(tvb, offset, pinfo, tree);
1824 dissect_log_file_request(tvbuff_t *tvb, int offset, packet_info *pinfo,
1825 proto_tree *tree, guint32 seq)
1828 offset = dissect_rpc_string(tvb, tree,
1829 hf_ndmp_file_name, offset, NULL);
1832 offset=dissect_error(tvb, offset, pinfo, tree, seq);
1837 #define NDMP_LOG_TYPE_NORMAL 0
1838 #define NDMP_LOG_TYPE_DEBUG 1
1839 #define NDMP_LOG_TYPE_ERROR 2
1840 #define NDMP_LOG_TYPE_WARNING 3
1841 static const value_string log_type_vals[] = {
1842 {NDMP_LOG_TYPE_NORMAL, "NORMAL"},
1843 {NDMP_LOG_TYPE_DEBUG, "DEBUG"},
1844 {NDMP_LOG_TYPE_ERROR, "ERROR"},
1845 {NDMP_LOG_TYPE_WARNING, "WARNING"},
1850 dissect_log_message_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1851 proto_tree *tree, guint32 seq _U_)
1854 proto_tree_add_item(tree, hf_ndmp_log_type, tvb, offset, 4, FALSE);
1858 proto_tree_add_item(tree, hf_ndmp_log_message_id, tvb, offset, 4, FALSE);
1862 offset = dissect_rpc_string(tvb, tree,
1863 hf_ndmp_log_message, offset, NULL);
1869 dissect_notify_data_halted_request(tvbuff_t *tvb, int offset,
1870 packet_info *pinfo _U_, proto_tree *tree, guint32 seq _U_)
1873 proto_tree_add_item(tree, hf_ndmp_halt, tvb, offset, 4, FALSE);
1877 offset = dissect_rpc_string(tvb, tree,
1878 hf_ndmp_halt_reason, offset, NULL);
1883 #define NDMP_CONNECTED_CONNECTED 0
1884 #define NDMP_CONNECTED_SHUTDOWN 1
1885 #define NDMP_CONNECTED_REFUSED 2
1886 static const value_string connected_vals[] = {
1887 {NDMP_CONNECTED_CONNECTED, "CONNECTED"},
1888 {NDMP_CONNECTED_SHUTDOWN, "SHUTDOWN"},
1889 {NDMP_CONNECTED_REFUSED, "REFUSED"},
1894 dissect_notify_connected_request(tvbuff_t *tvb, int offset,
1895 packet_info *pinfo _U_, proto_tree *tree, guint32 seq _U_)
1898 proto_tree_add_item(tree, hf_ndmp_connected, tvb, offset, 4, FALSE);
1901 /* version number */
1902 proto_tree_add_item(tree, hf_ndmp_version, tvb, offset, 4, FALSE);
1906 offset = dissect_rpc_string(tvb, tree,
1907 hf_ndmp_connected_reason, offset, NULL);
1914 dissect_notify_mover_paused_request(tvbuff_t *tvb, int offset,
1915 packet_info *pinfo _U_, proto_tree *tree, guint32 seq _U_)
1918 proto_tree_add_item(tree, hf_ndmp_mover_pause, tvb, offset, 4, FALSE);
1922 proto_tree_add_item(tree, hf_ndmp_seek_position, tvb, offset, 8, FALSE);
1929 dissect_auth_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1934 type=tvb_get_ntohl(tvb,offset);
1937 proto_tree_add_item(tree, hf_ndmp_auth_type, tvb, offset, 4, FALSE);
1941 case NDMP_AUTH_NONE:
1943 case NDMP_AUTH_TEXT:
1945 offset = dissect_rpc_string(tvb, tree,
1946 hf_ndmp_auth_id, offset, NULL);
1949 offset = dissect_rpc_string(tvb, tree,
1950 hf_ndmp_auth_password, offset, NULL);
1956 offset = dissect_rpc_string(tvb, tree,
1957 hf_ndmp_auth_id, offset, NULL);
1960 proto_tree_add_item(tree, hf_ndmp_auth_digest,
1961 tvb, offset, 16, FALSE);
1969 dissect_connect_client_auth_request(tvbuff_t *tvb, int offset,
1970 packet_info *pinfo, proto_tree *tree, guint32 seq _U_)
1972 return dissect_auth_data(tvb, offset, pinfo, tree);
1976 dissect_connect_server_auth_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1977 proto_tree *tree, guint32 seq)
1980 offset=dissect_error(tvb, offset, pinfo, tree, seq);
1983 offset = dissect_auth_data(tvb, offset, pinfo, tree);
1989 dissect_tape_write_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1990 proto_tree *tree, guint32 seq _U_)
1993 offset = dissect_rpc_data(tvb, tree, hf_ndmp_data, offset);
1999 dissect_tape_write_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2000 proto_tree *tree, guint32 seq)
2003 offset=dissect_error(tvb, offset, pinfo, tree, seq);
2006 proto_tree_add_item(tree, hf_ndmp_count, tvb, offset, 4, FALSE);
2013 dissect_tape_read_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2014 proto_tree *tree, guint32 seq _U_)
2017 proto_tree_add_item(tree, hf_ndmp_count, tvb, offset, 4, FALSE);
2024 dissect_tape_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2025 proto_tree *tree, guint32 seq)
2028 offset=dissect_error(tvb, offset, pinfo, tree, seq);
2031 offset = dissect_rpc_data(tvb, tree, hf_ndmp_data, offset);
2036 #define NDMP_FS_UNIX 0
2037 #define NDMP_FS_NT 1
2038 #define NDMP_FS_OTHER 2
2039 static const value_string file_fs_type_vals[] = {
2040 {NDMP_FS_UNIX, "UNIX"},
2042 {NDMP_FS_OTHER, "OTHER"},
2047 dissect_file_name(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree)
2049 proto_item* item = NULL;
2050 proto_tree* tree = NULL;
2051 int old_offset=offset;
2056 item = proto_tree_add_text(parent_tree, tvb, offset, -1,
2058 tree = proto_item_add_subtree(item, ett_ndmp_file_name);
2062 type=tvb_get_ntohl(tvb, offset);
2063 proto_tree_add_item(tree, hf_ndmp_file_fs_type, tvb, offset, 4, FALSE);
2069 offset = dissect_rpc_string(tvb, tree,
2070 hf_ndmp_file_name, offset, &name);
2071 if (check_col(pinfo->cinfo, COL_INFO)){
2072 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name);
2077 offset = dissect_rpc_string(tvb, tree,
2078 hf_ndmp_nt_file_name, offset, &name);
2079 if (check_col(pinfo->cinfo, COL_INFO)){
2080 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name);
2084 offset = dissect_rpc_string(tvb, tree,
2085 hf_ndmp_dos_file_name, offset, NULL);
2089 offset = dissect_rpc_string(tvb, tree,
2090 hf_ndmp_file_name, offset, &name);
2091 if (check_col(pinfo->cinfo, COL_INFO)){
2092 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name);
2096 if (check_col(pinfo->cinfo, COL_INFO)){
2097 col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
2098 val_to_str(type, file_fs_type_vals, "Unknown type") );
2101 proto_item_set_len(item, offset-old_offset);
2106 static const true_false_string tfs_ndmp_file_invalid_atime = {
2110 static const true_false_string tfs_ndmp_file_invalid_ctime = {
2114 static const true_false_string tfs_ndmp_file_invalid_group = {
2119 dissect_file_invalids(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2120 proto_tree *parent_tree)
2122 proto_item* item = NULL;
2123 proto_tree* tree = NULL;
2126 flags=tvb_get_ntohl(tvb, offset);
2128 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
2129 "Invalids: 0x%08x", flags);
2130 tree = proto_item_add_subtree(item, ett_ndmp_file_invalids);
2133 proto_tree_add_boolean(tree, hf_ndmp_file_invalid_group,
2134 tvb, offset, 4, flags);
2135 proto_tree_add_boolean(tree, hf_ndmp_file_invalid_ctime,
2136 tvb, offset, 4, flags);
2137 proto_tree_add_boolean(tree, hf_ndmp_file_invalid_atime,
2138 tvb, offset, 4, flags);
2144 #define NDMP_FILE_TYPE_DIR 0
2145 #define NDMP_FILE_TYPE_FIFO 1
2146 #define NDMP_FILE_TYPE_CSPEC 2
2147 #define NDMP_FILE_TYPE_BSPEC 3
2148 #define NDMP_FILE_TYPE_REG 4
2149 #define NDMP_FILE_TYPE_SLINK 5
2150 #define NDMP_FILE_TYPE_SOCK 6
2151 #define NDMP_FILE_TYPE_REGISTRY 7
2152 #define NDMP_FILE_TYPE_OTHER 8
2153 static const value_string file_type_vals[] = {
2154 {NDMP_FILE_TYPE_DIR, "DIR"},
2155 {NDMP_FILE_TYPE_FIFO, "FIFO"},
2156 {NDMP_FILE_TYPE_CSPEC, "CSPEC"},
2157 {NDMP_FILE_TYPE_BSPEC, "BSPEC"},
2158 {NDMP_FILE_TYPE_REG, "REG"},
2159 {NDMP_FILE_TYPE_SLINK, "SLINK"},
2160 {NDMP_FILE_TYPE_SOCK, "SOCK"},
2161 {NDMP_FILE_TYPE_REGISTRY, "REGISTRY"},
2162 {NDMP_FILE_TYPE_OTHER, "OTHER"},
2167 dissect_file_stats(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree)
2169 proto_item* item = NULL;
2170 proto_tree* tree = NULL;
2171 int old_offset=offset;
2175 item = proto_tree_add_text(parent_tree, tvb, offset, -1,
2177 tree = proto_item_add_subtree(item, ett_ndmp_file_stats);
2181 offset = dissect_file_invalids(tvb, offset, pinfo, tree);
2184 proto_tree_add_item(tree, hf_ndmp_file_fs_type, tvb, offset, 4, FALSE);
2188 proto_tree_add_item(tree, hf_ndmp_file_type, tvb, offset, 4, FALSE);
2192 ns.secs=tvb_get_ntohl(tvb, offset);
2194 proto_tree_add_time(tree, hf_ndmp_file_mtime, tvb, offset, 4, &ns);
2198 ns.secs=tvb_get_ntohl(tvb, offset);
2200 proto_tree_add_time(tree, hf_ndmp_file_atime, tvb, offset, 4, &ns);
2204 ns.secs=tvb_get_ntohl(tvb, offset);
2206 proto_tree_add_time(tree, hf_ndmp_file_ctime, tvb, offset, 4, &ns);
2210 proto_tree_add_item(tree, hf_ndmp_file_owner, tvb, offset, 4, FALSE);
2214 proto_tree_add_item(tree, hf_ndmp_file_group, tvb, offset, 4, FALSE);
2217 /*XXX here we should do proper dissection of mode for unix or
2218 fattr for nt, call appropriate functions in nfs/smb*/
2220 proto_tree_add_item(tree, hf_ndmp_file_fattr, tvb, offset, 4, FALSE);
2224 offset = dissect_rpc_uint64(tvb, tree, hf_ndmp_file_size,
2228 proto_tree_add_item(tree, hf_ndmp_file_links, tvb, offset, 4, FALSE);
2231 proto_item_set_len(item, offset-old_offset);
2237 dissect_file(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree)
2239 proto_item* item = NULL;
2240 proto_tree* tree = NULL;
2241 int old_offset=offset;
2244 item = proto_tree_add_text(parent_tree, tvb, offset, -1,
2246 tree = proto_item_add_subtree(item, ett_ndmp_file);
2250 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2251 dissect_file_name, hf_ndmp_file_names);
2254 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2255 dissect_file_stats, hf_ndmp_file_stats);
2258 proto_tree_add_item(tree, hf_ndmp_file_node, tvb, offset, 8, FALSE);
2262 proto_tree_add_item(tree, hf_ndmp_file_fh_info, tvb, offset, 8, FALSE);
2265 proto_item_set_len(item, offset-old_offset);
2270 dissect_fh_add_file_request(tvbuff_t *tvb, int offset, packet_info *pinfo,
2271 proto_tree *tree, guint32 seq _U_)
2274 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2275 dissect_file, hf_ndmp_files);
2281 dissect_dir(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2284 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2285 dissect_file_name, hf_ndmp_file_names);
2288 proto_tree_add_item(tree, hf_ndmp_file_node, tvb, offset, 8, FALSE);
2292 proto_tree_add_item(tree, hf_ndmp_file_parent, tvb, offset, 8, FALSE);
2299 dissect_fh_add_dir_request(tvbuff_t *tvb, int offset, packet_info *pinfo,
2300 proto_tree *tree, guint32 seq _U_)
2303 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2304 dissect_dir, hf_ndmp_dirs);
2310 dissect_node(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2313 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2314 dissect_file_stats, hf_ndmp_file_stats);
2317 proto_tree_add_item(tree, hf_ndmp_file_node, tvb, offset, 8, FALSE);
2321 proto_tree_add_item(tree, hf_ndmp_file_fh_info, tvb, offset, 8, FALSE);
2329 dissect_fh_add_node_request(tvbuff_t *tvb, int offset, packet_info *pinfo,
2330 proto_tree *tree, guint32 seq _U_)
2333 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2334 dissect_node, hf_ndmp_nodes);
2340 dissect_data_start_backup_request(tvbuff_t *tvb, int offset, packet_info *pinfo,
2341 proto_tree *tree, guint32 seq _U_)
2344 offset = dissect_rpc_string(tvb, tree,
2345 hf_ndmp_butype_name, offset, NULL);
2348 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2349 dissect_default_env, hf_ndmp_butype_default_env);
2355 dissect_nlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2359 offset = dissect_rpc_string(tvb, tree,
2360 hf_ndmp_bu_original_path, offset, NULL);
2363 offset = dissect_rpc_string(tvb, tree,
2364 hf_ndmp_bu_destination_dir, offset, NULL);
2366 if(ndmp_protocol_version==NDMP_PROTOCOL_V2){
2367 /* just 2 reserved bytes (4 with padding) */
2371 offset = dissect_rpc_string(tvb, tree,
2372 hf_ndmp_bu_new_name, offset, NULL);
2375 offset = dissect_rpc_string(tvb, tree,
2376 hf_ndmp_bu_other_name, offset, NULL);
2379 proto_tree_add_item(tree, hf_ndmp_file_node, tvb, offset, 8, FALSE);
2384 proto_tree_add_item(tree, hf_ndmp_file_fh_info, tvb, offset, 8, FALSE);
2392 dissect_data_start_recover_request(tvbuff_t *tvb, int offset,
2393 packet_info *pinfo, proto_tree *tree, guint32 seq _U_)
2395 if(ndmp_protocol_version==NDMP_PROTOCOL_V2){
2397 offset=dissect_ndmp_addr(tvb, offset, pinfo, tree);
2401 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2402 dissect_default_env, hf_ndmp_butype_default_env);
2405 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2406 dissect_nlist, hf_ndmp_nlist);
2409 offset = dissect_rpc_string(tvb, tree,
2410 hf_ndmp_butype_name, offset, NULL);
2416 dissect_data_get_env_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2417 proto_tree *tree, guint32 seq)
2420 offset=dissect_error(tvb, offset, pinfo, tree, seq);
2423 offset = dissect_rpc_array(tvb, pinfo, tree, offset,
2424 dissect_default_env, hf_ndmp_butype_default_env);
2430 static const true_false_string tfs_ndmp_state_invalid_ebr = {
2431 "Estimated Bytes Remaining is INVALID",
2432 "Estimated Bytes Remaining is valid"
2434 static const true_false_string tfs_ndmp_state_invalid_etr = {
2435 "Estimated Time Remaining is INVALID",
2436 "Estimated Time Remaining is valid"
2439 dissect_state_invalids(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2440 proto_tree *parent_tree)
2442 proto_item* item = NULL;
2443 proto_tree* tree = NULL;
2446 flags=tvb_get_ntohl(tvb, offset);
2448 item = proto_tree_add_text(parent_tree, tvb, offset, 4,
2449 "Invalids: 0x%08x", flags);
2450 tree = proto_item_add_subtree(item, ett_ndmp_state_invalids);
2453 proto_tree_add_boolean(tree, hf_ndmp_state_invalid_etr,
2454 tvb, offset, 4, flags);
2455 proto_tree_add_boolean(tree, hf_ndmp_state_invalid_ebr,
2456 tvb, offset, 4, flags);
2462 #define NDMP_DATA_OP_NOACTION 0
2463 #define NDMP_DATA_OP_BACKUP 1
2464 #define NDMP_DATA_OP_RESTORE 2
2465 static const value_string bu_operation_vals[] = {
2466 {NDMP_DATA_OP_NOACTION, "NOACTION"},
2467 {NDMP_DATA_OP_BACKUP, "BACKUP"},
2468 {NDMP_DATA_OP_RESTORE, "RESTORE"},
2472 #define NDMP_DATA_STATE_IDLE 0
2473 #define NDMP_DATA_STATE_ACTIVE 1
2474 #define NDMP_DATA_STATE_HALTED 2
2475 #define NDMP_DATA_STATE_LISTEN 3
2476 #define NDMP_DATA_STATE_CONNECTED 4
2477 static const value_string data_state_vals[] = {
2478 {NDMP_DATA_STATE_IDLE, "IDLE"},
2479 {NDMP_DATA_STATE_ACTIVE, "ACTIVE"},
2480 {NDMP_DATA_STATE_HALTED, "HALTED"},
2481 {NDMP_DATA_STATE_LISTEN, "LISTEN"},
2482 {NDMP_DATA_STATE_CONNECTED, "CONNECTED"},
2486 #define NDMP_DATA_HALTED_NA 0
2487 #define NDMP_DATA_HALTED_SUCCESSFUL 1
2488 #define NDMP_DATA_HALTED_ABORTED 2
2489 #define NDMP_DATA_HALTED_INTERNAL_ERROR 3
2490 #define NDMP_DATA_HALTED_CONNECT_ERROR 4
2491 static const value_string data_halted_vals[] = {
2492 {NDMP_DATA_HALTED_NA, "HALTED_NA"},
2493 {NDMP_DATA_HALTED_SUCCESSFUL, "HALTED_SUCCESSFUL"},
2494 {NDMP_DATA_HALTED_ABORTED, "HALTED_ABORTED"},
2495 {NDMP_DATA_HALTED_INTERNAL_ERROR, "HALTED_INTERNAL_ERROR"},
2496 {NDMP_DATA_HALTED_CONNECT_ERROR, "HALTED_CONNECT_ERROR"},
2501 dissect_data_get_state_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2502 proto_tree *tree, guint32 seq)
2507 offset = dissect_state_invalids(tvb, offset, pinfo, tree);
2510 offset=dissect_error(tvb, offset, pinfo, tree, seq);
2513 proto_tree_add_item(tree, hf_ndmp_bu_operation, tvb, offset, 4, FALSE);
2517 proto_tree_add_item(tree, hf_ndmp_data_state, tvb, offset, 4, FALSE);
2521 proto_tree_add_item(tree, hf_ndmp_data_halted, tvb, offset, 4, FALSE);
2525 offset = dissect_rpc_uint64(tvb, tree, hf_ndmp_data_bytes_processed,
2528 /*est bytes remain*/
2529 offset = dissect_rpc_uint64(tvb, tree, hf_ndmp_data_est_bytes_remain,
2532 /* est time remain */
2533 ns.secs=tvb_get_ntohl(tvb, offset);
2535 proto_tree_add_time(tree, hf_ndmp_data_est_time_remain, tvb, offset, 4, &ns);
2539 offset=dissect_ndmp_addr(tvb, offset, pinfo, tree);
2542 proto_tree_add_item(tree, hf_ndmp_window_offset, tvb, offset, 8, FALSE);
2546 proto_tree_add_item(tree, hf_ndmp_window_length, tvb, offset, 8, FALSE);
2553 typedef struct _ndmp_command {
2555 int (*request) (tvbuff_t *tvb, int offset, packet_info *pinfo,
2556 proto_tree *tree, guint32 seq);
2557 int (*response)(tvbuff_t *tvb, int offset, packet_info *pinfo,
2558 proto_tree *tree, guint32 seq);
2561 static const ndmp_command ndmp_commands[] = {
2562 {NDMP_CONFIG_GET_HOST_INFO,
2563 NULL, dissect_ndmp_get_host_info_reply},
2564 {NDMP_CONFIG_GET_CONNECTION_TYPE,
2565 NULL, dissect_ndmp_config_get_connection_type_reply},
2566 {NDMP_CONFIG_GET_AUTH_ATTR,
2567 dissect_get_auth_type_request, dissect_auth_attr_msg},
2568 {NDMP_CONFIG_GET_BUTYPE_INFO,
2569 NULL, dissect_get_butype_info_reply},
2570 {NDMP_CONFIG_GET_FS_INFO,
2571 NULL, dissect_get_fs_info_reply},
2572 {NDMP_CONFIG_GET_TAPE_INFO,
2573 NULL, dissect_get_tape_info_reply},
2574 {NDMP_CONFIG_GET_SCSI_INFO,
2575 NULL, dissect_get_scsi_info_reply},
2576 {NDMP_CONFIG_GET_SERVER_INFO,
2577 NULL, dissect_get_server_info_reply},
2579 dissect_scsi_open_request, dissect_error},
2581 NULL, dissect_error},
2582 {NDMP_SCSI_GET_STATE,
2583 NULL, dissect_scsi_get_state_reply},
2584 {NDMP_SCSI_SET_TARGET,
2585 dissect_scsi_set_state_request, dissect_error},
2586 {NDMP_SCSI_RESET_DEVICE,
2587 NULL, dissect_error},
2588 {NDMP_SCSI_RESET_BUS,
2589 NULL, dissect_error},
2590 {NDMP_SCSI_EXECUTE_CDB,
2591 dissect_execute_cdb_request_mc, dissect_execute_cdb_reply},
2593 dissect_tape_open_request, dissect_error},
2595 NULL, dissect_error},
2596 {NDMP_TAPE_GET_STATE,
2597 NULL, dissect_tape_get_state_reply},
2599 dissect_tape_mtio_request, dissect_tape_mtio_reply},
2601 dissect_tape_write_request, dissect_tape_write_reply},
2603 dissect_tape_read_request, dissect_tape_read_reply},
2604 {NDMP_TAPE_EXECUTE_CDB,
2605 dissect_execute_cdb_request_tape, dissect_execute_cdb_reply},
2606 {NDMP_DATA_GET_STATE,
2607 NULL, dissect_data_get_state_reply},
2608 {NDMP_DATA_START_BACKUP,
2609 dissect_data_start_backup_request, dissect_error },
2610 {NDMP_DATA_START_RECOVER,
2611 dissect_data_start_recover_request, dissect_error },
2613 NULL, dissect_error},
2615 NULL, dissect_data_get_env_reply},
2617 NULL, dissect_error},
2619 dissect_ndmp_addr_msg, dissect_mover_listen_reply},
2621 dissect_data_connect_msg, dissect_error},
2622 {NDMP_NOTIFY_DATA_HALTED,
2623 dissect_notify_data_halted_request, NULL},
2624 {NDMP_NOTIFY_CONNECTED,
2625 dissect_notify_connected_request, NULL},
2626 {NDMP_NOTIFY_MOVER_HALTED,
2627 dissect_notify_data_halted_request, NULL},
2628 {NDMP_NOTIFY_MOVER_PAUSED,
2629 dissect_notify_mover_paused_request, NULL},
2630 {NDMP_NOTIFY_DATA_READ,
2631 dissect_mover_set_window_request, NULL},
2633 dissect_log_file_request, NULL},
2635 dissect_log_message_request, NULL},
2637 dissect_fh_add_file_request, NULL},
2639 dissect_fh_add_dir_request, NULL},
2641 dissect_fh_add_node_request, NULL},
2643 dissect_connect_open_request, dissect_error},
2644 {NDMP_CONNECT_CLIENT_AUTH,
2645 dissect_connect_client_auth_request, dissect_error},
2646 {NDMP_CONNECT_CLOSE,
2648 {NDMP_CONNECT_SERVER_AUTH,
2649 dissect_auth_attr_msg, dissect_connect_server_auth_reply},
2650 {NDMP_MOVER_GET_STATE,
2651 NULL, dissect_mover_get_state_reply},
2653 dissect_mover_listen_request, dissect_mover_listen_reply},
2654 {NDMP_MOVER_CONTINUE,
2655 NULL, dissect_error},
2657 NULL, dissect_error},
2659 NULL, dissect_error},
2660 {NDMP_MOVER_SET_WINDOW,
2661 dissect_mover_set_window_request, dissect_error},
2663 dissect_mover_set_window_request, dissect_error},
2665 NULL, dissect_error},
2666 {NDMP_MOVER_SET_RECORD_SIZE,
2667 dissect_mover_set_record_size_request, dissect_error},
2668 {NDMP_MOVER_CONNECT,
2669 dissect_mover_connect_request, dissect_error},
2675 dissect_ndmp_header(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, struct ndmp_header *nh)
2677 proto_item* item = NULL;
2678 proto_tree* tree = NULL;
2682 item = proto_tree_add_item(parent_tree, hf_ndmp_header, tvb,
2684 tree = proto_item_add_subtree(item, ett_ndmp_header);
2687 /* sequence number */
2688 proto_tree_add_uint(tree, hf_ndmp_sequence, tvb, offset, 4, nh->seq);
2694 proto_tree_add_time(tree, hf_ndmp_timestamp, tvb, offset, 4, &ns);
2698 proto_tree_add_uint(tree, hf_ndmp_msgtype, tvb, offset, 4, nh->type);
2702 proto_tree_add_uint(tree, hf_ndmp_msg, tvb, offset, 4, nh->msg);
2705 /* Reply sequence number */
2706 proto_tree_add_uint(tree, hf_ndmp_reply_sequence, tvb, offset, 4, nh->rep_seq);
2710 offset=dissect_error(tvb, offset, pinfo, tree, nh->seq);
2712 if (check_col(pinfo->cinfo, COL_INFO)){
2713 col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s",
2714 val_to_str(nh->msg, msg_vals, "Unknown Message (0x%02x)"),
2715 val_to_str(nh->type, msg_type_vals, "Unknown Type (0x%02x)")
2724 dissect_ndmp_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct ndmp_header *nh)
2727 proto_item *cmd_item=NULL;
2728 proto_tree *cmd_tree=NULL;
2730 offset=dissect_ndmp_header(tvb, offset, pinfo, tree, nh);
2732 for(i=0;ndmp_commands[i].cmd!=0;i++){
2733 if(ndmp_commands[i].cmd==nh->msg){
2739 if(ndmp_commands[i].cmd==0){
2740 /* we do not know this message */
2741 proto_tree_add_text(tree, tvb, offset, -1, "Unknown type of NDMP message: 0x%02x", nh->msg);
2742 offset+=tvb_length_remaining(tvb, offset);
2746 if (tvb_reported_length_remaining(tvb, offset) > 0) {
2748 cmd_item = proto_tree_add_text(tree, tvb, offset, -1,
2749 msg_vals[i].strptr);
2750 cmd_tree = proto_item_add_subtree(cmd_item, ett_ndmp);
2754 if(nh->type==NDMP_MESSAGE_REQUEST){
2755 if(ndmp_commands[i].request){
2756 offset=ndmp_commands[i].request(tvb, offset, pinfo, cmd_tree,
2760 if(ndmp_commands[i].response){
2761 offset=ndmp_commands[i].response(tvb, offset, pinfo, cmd_tree,
2770 dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2774 struct ndmp_header nh;
2776 proto_item *ndmp_item = NULL;
2777 proto_tree *ndmp_tree = NULL;
2778 proto_item *hdr_item = NULL;
2779 proto_tree *hdr_tree = NULL;
2781 /* size of this NDMP PDU */
2782 size = tvb_length_remaining(tvb, offset);
2784 /* too short to be NDMP */
2789 * Read the NDMP header, if we have it.
2791 ndmp_rm=tvb_get_ntohl(tvb, offset);
2792 nh.seq = tvb_get_ntohl(tvb, offset+4);
2793 nh.time = tvb_get_ntohl(tvb, offset+8);
2794 nh.type = tvb_get_ntohl(tvb, offset+12);
2795 nh.msg = tvb_get_ntohl(tvb, offset+16);
2796 nh.rep_seq = tvb_get_ntohl(tvb, offset+20);
2797 nh.err = tvb_get_ntohl(tvb, offset+24);
2800 * Check if this is the last fragment.
2802 if (!(ndmp_rm & RPC_RM_LASTFRAG)) {
2804 * This isn't the last fragment.
2805 * If we're doing reassembly, just return
2806 * TRUE to indicate that this looks like
2807 * the beginning of an NDMP message,
2808 * and let them do reassembly.
2810 if (ndmp_defragment)
2814 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2815 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDMP");
2816 if (check_col(pinfo->cinfo, COL_INFO)) {
2817 col_clear(pinfo->cinfo, COL_INFO);
2821 ndmp_item = proto_tree_add_item(tree, proto_ndmp,
2823 ndmp_tree = proto_item_add_subtree(ndmp_item, ett_ndmp);
2826 hdr_item = proto_tree_add_text(ndmp_tree, tvb, 0, 4,
2827 "Fragment header: %s%u %s",
2828 (ndmp_rm & RPC_RM_LASTFRAG) ? "Last fragment, " : "",
2829 ndmp_rm & RPC_RM_FRAGLEN, plurality(ndmp_rm & RPC_RM_FRAGLEN, "byte", "bytes"));
2830 hdr_tree = proto_item_add_subtree(hdr_item, ett_ndmp_fraghdr);
2831 proto_tree_add_boolean(hdr_tree, hf_ndmp_lastfrag, tvb, 0, 4, ndmp_rm);
2832 proto_tree_add_uint(hdr_tree, hf_ndmp_fraglen, tvb, 0, 4, ndmp_rm);
2835 * We cannot trust what dissect_ndmp_cmd() tells us, as there
2836 * are implementations which pad some additional data after
2837 * the PDU. We MUST use size.
2839 dissect_ndmp_cmd(tvb, offset+4, pinfo, ndmp_tree, &nh);
2844 get_ndmp_pdu_len(tvbuff_t *tvb, int offset)
2848 len=tvb_get_ntohl(tvb, offset)&0x7fffffff;
2849 /* Get the length of the NDMP packet. */
2851 /*XXX check header for sanity */
2856 dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2862 /* check that the hgeader looks sane */
2863 len=tvb_length(tvb);
2864 /* check the record marker that it looks sane.
2865 * It has to be >=24 bytes or (arbitrary limit) <1Mbyte
2868 tmp=(tvb_get_ntohl(tvb, 0)&RPC_RM_FRAGLEN);
2869 if( (tmp<24)||(tmp>1000000) ){
2873 /* check the timestamp, timestamps are valid if they
2874 * (arbitrary) lie between 1980-jan-1 and 2030-jan-1
2877 tmp=tvb_get_ntohl(tvb, 8);
2878 if( (tmp<0x12ceec50)||(tmp>0x70dc1ed0) ){
2882 /* check the type */
2884 tmp=tvb_get_ntohl(tvb, 12);
2891 tmp=tvb_get_ntohl(tvb, 16);
2892 if( (tmp>0xa09) || (tmp==0) ){
2898 tmp=tvb_get_ntohl(tvb, 24);
2905 tcp_dissect_pdus(tvb, pinfo, tree, ndmp_desegment, 28,
2906 get_ndmp_pdu_len, dissect_ndmp_message);
2907 return tvb_length(tvb);
2911 proto_register_ndmp(void)
2914 static hf_register_info hf_ndmp[] = {
2915 { &hf_ndmp_header, {
2916 "NDMP Header", "ndmp.header", FT_NONE, 0,
2917 NULL, 0, "NDMP Header", HFILL }},
2919 { &hf_ndmp_sequence, {
2920 "Sequence", "ndmp.sequence", FT_UINT32, BASE_DEC,
2921 NULL, 0, "Sequence number for NDMP PDU", HFILL }},
2923 { &hf_ndmp_reply_sequence, {
2924 "Reply Sequence", "ndmp.reply_sequence", FT_UINT32, BASE_DEC,
2925 NULL, 0, "Reply Sequence number for NDMP PDU", HFILL }},
2927 { &hf_ndmp_timestamp, {
2928 "Time", "ndmp.timestamp", FT_ABSOLUTE_TIME, BASE_NONE,
2929 NULL, 0, "Timestamp for this NDMP PDU", HFILL }},
2931 { &hf_ndmp_msgtype, {
2932 "Type", "ndmp.msg_type", FT_UINT32, BASE_DEC,
2933 VALS(msg_type_vals), 0, "Is this a Request or Response?", HFILL }},
2936 "Message", "ndmp.msg", FT_UINT32, BASE_HEX,
2937 VALS(msg_vals), 0, "Type of NDMP PDU", HFILL }},
2940 "Error", "ndmp.error", FT_UINT32, BASE_DEC,
2941 VALS(error_vals), 0, "Error code for this NDMP PDU", HFILL }},
2943 { &hf_ndmp_version, {
2944 "Version", "ndmp.version", FT_UINT32, BASE_DEC,
2945 NULL, 0, "Version of NDMP protocol", HFILL }},
2947 { &hf_ndmp_hostname, {
2948 "Hostname", "ndmp.hostname", FT_STRING, BASE_NONE,
2949 NULL, 0, "Hostname", HFILL }},
2951 { &hf_ndmp_hostid, {
2952 "HostID", "ndmp.hostid", FT_STRING, BASE_NONE,
2953 NULL, 0, "HostID", HFILL }},
2955 { &hf_ndmp_os_type, {
2956 "OS Type", "ndmp.os.type", FT_STRING, BASE_NONE,
2957 NULL, 0, "OS Type", HFILL }},
2959 { &hf_ndmp_os_vers, {
2960 "OS Version", "ndmp.os.version", FT_STRING, BASE_NONE,
2961 NULL, 0, "OS Version", HFILL }},
2963 { &hf_ndmp_addr_types, {
2964 "Addr Types", "ndmp.addr_types", FT_NONE, BASE_NONE,
2965 NULL, 0, "List Of Address Types", HFILL }},
2967 { &hf_ndmp_addr_type, {
2968 "Addr Type", "ndmp.addr_type", FT_UINT32, BASE_DEC,
2969 VALS(addr_type_vals), 0, "Address Type", HFILL }},
2971 { &hf_ndmp_auth_type, {
2972 "Auth Type", "ndmp.auth_type", FT_UINT32, BASE_DEC,
2973 VALS(auth_type_vals), 0, "Authentication Type", HFILL }},
2975 { &hf_ndmp_auth_challenge, {
2976 "Challenge", "ndmp.auth.challenge", FT_BYTES, BASE_HEX,
2977 NULL, 0, "Authentication Challenge", HFILL }},
2979 { &hf_ndmp_auth_digest, {
2980 "Digest", "ndmp.auth.digest", FT_BYTES, BASE_HEX,
2981 NULL, 0, "Authentication Digest", HFILL }},
2983 { &hf_ndmp_butype_info, {
2984 "Butype Info", "ndmp.butype.info", FT_NONE, BASE_NONE,
2985 NULL, 0, "Butype Info", HFILL }},
2987 { &hf_ndmp_butype_name, {
2988 "Butype Name", "ndmp.butype.name", FT_STRING, BASE_NONE,
2989 NULL, 0, "Name of Butype", HFILL }},
2991 { &hf_ndmp_butype_default_env, {
2992 "Default Env", "ndmp.butype.default_env", FT_NONE, BASE_NONE,
2993 NULL, 0, "Default Env's for this Butype Info", HFILL }},
2995 { &hf_ndmp_tcp_addr_list, {
2996 "TCP Ports", "ndmp.tcp.port_list", FT_NONE, BASE_NONE,
2997 NULL, 0, "List of TCP ports", HFILL }},
2999 { &hf_ndmp_tcp_default_env, {
3000 "Default Env", "ndmp.tcp.default_env", FT_NONE, BASE_NONE,
3001 NULL, 0, "Default Env's for this Butype Info", HFILL }},
3003 { &hf_ndmp_butype_attr_backup_file_history, {
3004 "", "ndmp.butype.attr.backup_file_history", FT_BOOLEAN, 32,
3005 TFS(&tfs_butype_attr_backup_file_history), 0x00000001, "backup_file_history", HFILL }},
3007 { &hf_ndmp_butype_attr_backup_filelist, {
3008 "", "ndmp.butype.attr.backup_filelist", FT_BOOLEAN, 32,
3009 TFS(&tfs_butype_attr_backup_filelist), 0x00000002, "backup_filelist", HFILL }},
3011 { &hf_ndmp_butype_attr_recover_filelist, {
3012 "", "ndmp.butype.attr.recover_filelist", FT_BOOLEAN, 32,
3013 TFS(&tfs_butype_attr_recover_filelist), 0x00000004, "recover_filelist", HFILL }},
3015 { &hf_ndmp_butype_attr_backup_direct, {
3016 "", "ndmp.butype.attr.backup_direct", FT_BOOLEAN, 32,
3017 TFS(&tfs_butype_attr_backup_direct), 0x00000008, "backup_direct", HFILL }},
3019 { &hf_ndmp_butype_attr_recover_direct, {
3020 "", "ndmp.butype.attr.recover_direct", FT_BOOLEAN, 32,
3021 TFS(&tfs_butype_attr_recover_direct), 0x00000010, "recover_direct", HFILL }},
3023 { &hf_ndmp_butype_attr_backup_incremental, {
3024 "", "ndmp.butype.attr.backup_incremental", FT_BOOLEAN, 32,
3025 TFS(&tfs_butype_attr_backup_incremental), 0x00000020, "backup_incremental", HFILL }},
3027 { &hf_ndmp_butype_attr_recover_incremental, {
3028 "", "ndmp.butype.attr.recover_incremental", FT_BOOLEAN, 32,
3029 TFS(&tfs_butype_attr_recover_incremental), 0x00000040, "recover_incremental", HFILL }},
3031 { &hf_ndmp_butype_attr_backup_utf8, {
3032 "", "ndmp.butype.attr.backup_utf8", FT_BOOLEAN, 32,
3033 TFS(&tfs_butype_attr_backup_utf8), 0x00000080, "backup_utf8", HFILL }},
3035 { &hf_ndmp_butype_attr_recover_utf8, {
3036 "", "ndmp.butype.attr.recover_utf8", FT_BOOLEAN, 32,
3037 TFS(&tfs_butype_attr_recover_utf8), 0x00000100, "recover_utf8", HFILL }},
3039 { &hf_ndmp_butype_env_name, {
3040 "Name", "ndmp.butype.env.name", FT_STRING, BASE_NONE,
3041 NULL, 0, "Name for this env-variable", HFILL }},
3043 { &hf_ndmp_butype_env_value, {
3044 "Value", "ndmp.butype.env.value", FT_STRING, BASE_NONE,
3045 NULL, 0, "Value for this env-variable", HFILL }},
3047 { &hf_ndmp_tcp_env_name, {
3048 "Name", "ndmp.tcp.env.name", FT_STRING, BASE_NONE,
3049 NULL, 0, "Name for this env-variable", HFILL }},
3051 { &hf_ndmp_tcp_env_value, {
3052 "Value", "ndmp.tcp.env.value", FT_STRING, BASE_NONE,
3053 NULL, 0, "Value for this env-variable", HFILL }},
3055 { &hf_ndmp_fs_info, {
3056 "FS Info", "ndmp.fs.info", FT_NONE, BASE_NONE,
3057 NULL, 0, "FS Info", HFILL }},
3059 { &hf_ndmp_fs_invalid_total_size, {
3060 "", "ndmp.fs.invalid.total_size", FT_BOOLEAN, 32,
3061 TFS(&tfs_fs_invalid_total_size), 0x00000001, "If total size is invalid", HFILL }},
3063 { &hf_ndmp_fs_invalid_used_size, {
3064 "", "ndmp.fs.invalid.used_size", FT_BOOLEAN, 32,
3065 TFS(&tfs_fs_invalid_used_size), 0x00000002, "If used size is invalid", HFILL }},
3067 { &hf_ndmp_fs_invalid_avail_size, {
3068 "", "ndmp.fs.invalid.avail_size", FT_BOOLEAN, 32,
3069 TFS(&tfs_fs_invalid_avail_size), 0x00000004, "If available size is invalid", HFILL }},
3071 { &hf_ndmp_fs_invalid_total_inodes, {
3072 "", "ndmp.fs.invalid.total_inodes", FT_BOOLEAN, 32,
3073 TFS(&tfs_fs_invalid_total_inodes), 0x00000008, "If total number of inodes is invalid", HFILL }},
3075 { &hf_ndmp_fs_invalid_used_inodes, {
3076 "", "ndmp.fs.invalid.used_inodes", FT_BOOLEAN, 32,
3077 TFS(&tfs_fs_invalid_used_inodes), 0x00000010, "If used number of inodes is invalid", HFILL }},
3079 { &hf_ndmp_fs_fs_type, {
3080 "Type", "ndmp.fs.type", FT_STRING, BASE_NONE,
3081 NULL, 0, "Type of FS", HFILL }},
3083 { &hf_ndmp_fs_logical_device, {
3084 "Logical Device", "ndmp.fs.logical_device", FT_STRING, BASE_NONE,
3085 NULL, 0, "Name of logical device", HFILL }},
3087 { &hf_ndmp_fs_physical_device, {
3088 "Physical Device", "ndmp.fs.physical_device", FT_STRING, BASE_NONE,
3089 NULL, 0, "Name of physical device", HFILL }},
3091 { &hf_ndmp_fs_total_size, {
3092 "Total Size", "ndmp.fs.total_size", FT_UINT64, BASE_DEC,
3093 NULL, 0, "Total size of FS", HFILL }},
3095 { &hf_ndmp_fs_used_size, {
3096 "Used Size", "ndmp.fs.used_size", FT_UINT64, BASE_DEC,
3097 NULL, 0, "Total used size of FS", HFILL }},
3099 { &hf_ndmp_fs_avail_size, {
3100 "Avail Size", "ndmp.fs.avail_size", FT_UINT64, BASE_DEC,
3101 NULL, 0, "Total available size on FS", HFILL }},
3103 { &hf_ndmp_fs_total_inodes, {
3104 "Total Inodes", "ndmp.fs.total_inodes", FT_UINT64, BASE_DEC,
3105 NULL, 0, "Total number of inodes on FS", HFILL }},
3107 { &hf_ndmp_fs_used_inodes, {
3108 "Used Inodes", "ndmp.fs.used_inodes", FT_UINT64, BASE_DEC,
3109 NULL, 0, "Number of used inodes on FS", HFILL }},
3111 { &hf_ndmp_fs_env, {
3112 "Env variables", "ndmp.fs.env", FT_NONE, BASE_NONE,
3113 NULL, 0, "Environment variables for FS", HFILL }},
3115 { &hf_ndmp_fs_env_name, {
3116 "Name", "ndmp.fs.env.name", FT_STRING, BASE_NONE,
3117 NULL, 0, "Name for this env-variable", HFILL }},
3119 { &hf_ndmp_fs_env_value, {
3120 "Value", "ndmp.fs.env.value", FT_STRING, BASE_NONE,
3121 NULL, 0, "Value for this env-variable", HFILL }},
3123 { &hf_ndmp_fs_status, {
3124 "Status", "ndmp.fs.status", FT_STRING, BASE_NONE,
3125 NULL, 0, "Status for this FS", HFILL }},
3127 { &hf_ndmp_tape_info, {
3128 "Tape Info", "ndmp.tape.info", FT_NONE, BASE_NONE,
3129 NULL, 0, "Tape Info", HFILL }},
3131 { &hf_ndmp_tape_model, {
3132 "Model", "ndmp.tape.model", FT_STRING, BASE_NONE,
3133 NULL, 0, "Model of the TAPE drive", HFILL }},
3135 { &hf_ndmp_tape_dev_cap, {
3136 "Device Capability", "ndmp.tape.dev_cap", FT_NONE, BASE_NONE,
3137 NULL, 0, "Tape Device Capability", HFILL }},
3139 { &hf_ndmp_tape_device, {
3140 "Device", "ndmp.tape.device", FT_STRING, BASE_NONE,
3141 NULL, 0, "Name of TAPE Device", HFILL }},
3143 { &hf_ndmp_tape_attr_rewind, {
3144 "", "ndmp.tape.attr.rewind", FT_BOOLEAN, 32,
3145 TFS(&tfs_tape_attr_rewind), 0x00000001, "If this device supports rewind", HFILL }},
3147 { &hf_ndmp_tape_attr_unload, {
3148 "", "ndmp.tape.attr.unload", FT_BOOLEAN, 32,
3149 TFS(&tfs_tape_attr_unload), 0x00000002, "If this device supports unload", HFILL }},
3151 { &hf_ndmp_tape_capability, {
3152 "Tape Capabilities", "ndmp.tape.capability", FT_NONE, BASE_NONE,
3153 NULL, 0, "Tape Capabilities", HFILL }},
3155 { &hf_ndmp_tape_capability_name, {
3156 "Name", "ndmp.tape.cap.name", FT_STRING, BASE_NONE,
3157 NULL, 0, "Name for this env-variable", HFILL }},
3159 { &hf_ndmp_tape_capability_value, {
3160 "Value", "ndmp.tape.cap.value", FT_STRING, BASE_NONE,
3161 NULL, 0, "Value for this env-variable", HFILL }},
3163 { &hf_ndmp_scsi_info, {
3164 "SCSI Info", "ndmp.scsi.info", FT_NONE, BASE_NONE,
3165 NULL, 0, "SCSI Info", HFILL }},
3167 { &hf_ndmp_scsi_model, {
3168 "Model", "ndmp.scsi.model", FT_STRING, BASE_NONE,
3169 NULL, 0, "Model of the SCSI device", HFILL }},
3171 { &hf_ndmp_server_vendor, {
3172 "Vendor", "ndmp.server.vendor", FT_STRING, BASE_NONE,
3173 NULL, 0, "Name of vendor", HFILL }},
3175 { &hf_ndmp_server_product, {
3176 "Product", "ndmp.server.product", FT_STRING, BASE_NONE,
3177 NULL, 0, "Name of product", HFILL }},
3179 { &hf_ndmp_server_revision, {
3180 "Revision", "ndmp.server.revision", FT_STRING, BASE_NONE,
3181 NULL, 0, "Revision of this product", HFILL }},
3183 { &hf_ndmp_auth_types, {
3184 "Auth types", "ndmp.auth.types", FT_NONE, BASE_NONE,
3185 NULL, 0, "Auth types", HFILL }},
3187 { &hf_ndmp_scsi_device, {
3188 "Device", "ndmp.scsi.device", FT_STRING, BASE_NONE,
3189 NULL, 0, "Name of SCSI Device", HFILL }},
3191 { &hf_ndmp_scsi_controller, {
3192 "Controller", "ndmp.scsi.controller", FT_UINT32, BASE_DEC,
3193 NULL, 0, "Target Controller", HFILL }},
3195 { &hf_ndmp_scsi_id, {
3196 "ID", "ndmp.scsi.id", FT_UINT32, BASE_DEC,
3197 NULL, 0, "Target ID", HFILL }},
3199 { &hf_ndmp_scsi_lun, {
3200 "LUN", "ndmp.scsi.lun", FT_UINT32, BASE_DEC,
3201 NULL, 0, "Target LUN", HFILL }},
3203 { &hf_ndmp_execute_cdb_flags_data_in, {
3204 "DATA_IN", "ndmp.execute_cdb.flags.data_in", FT_BOOLEAN, 32,
3205 NULL, 0x00000001, "DATA_IN", HFILL }},
3207 { &hf_ndmp_execute_cdb_flags_data_out, {
3208 "DATA_OUT", "ndmp.execute_cdb.flags.data_out", FT_BOOLEAN, 32,
3209 NULL, 0x00000002, "DATA_OUT", HFILL }},
3211 { &hf_ndmp_execute_cdb_timeout, {
3212 "Timeout", "ndmp.execute_cdb.timeout", FT_UINT32, BASE_DEC,
3213 NULL, 0, "Reselect timeout, in milliseconds", HFILL }},
3215 { &hf_ndmp_execute_cdb_datain_len, {
3216 "Data in length", "ndmp.execute_cdb.datain_len", FT_UINT32, BASE_DEC,
3217 NULL, 0, "Expected length of data bytes to read", HFILL }},
3219 { &hf_ndmp_execute_cdb_cdb_len, {
3220 "CDB length", "ndmp.execute_cdb.cdb_len", FT_UINT32, BASE_DEC,
3221 NULL, 0, "Length of CDB", HFILL }},
3223 { &hf_ndmp_execute_cdb_dataout, {
3224 "Data out", "ndmp.execute_cdb.dataout", FT_BYTES, BASE_NONE,
3225 NULL, 0, "Data to be transferred to the SCSI device", HFILL }},
3227 { &hf_ndmp_execute_cdb_status, {
3228 "Status", "ndmp.execute_cdb.status", FT_UINT8, BASE_DEC,
3229 VALS(scsi_status_val), 0, "SCSI status", HFILL }},
3231 { &hf_ndmp_execute_cdb_dataout_len, {
3232 "Data out length", "ndmp.execute_cdb.dataout_len", FT_UINT32, BASE_DEC,
3233 NULL, 0, "Number of bytes transferred to the device", HFILL }},
3235 { &hf_ndmp_execute_cdb_datain, {
3236 "Data in", "ndmp.execute_cdb.datain", FT_BYTES, BASE_NONE,
3237 NULL, 0, "Data transferred from the SCSI device", HFILL }},
3239 { &hf_ndmp_execute_cdb_sns_len, {
3240 "Sense data length", "ndmp.execute_cdb.sns_len", FT_UINT32, BASE_DEC,
3241 NULL, 0, "Length of sense data", HFILL }},
3243 { &hf_ndmp_tape_open_mode, {
3244 "Mode", "ndmp.tape.open_mode", FT_UINT32, BASE_DEC,
3245 VALS(tape_open_mode_vals), 0, "Mode to open tape in", HFILL }},
3247 { &hf_ndmp_tape_invalid_file_num, {
3248 "", "ndmp.tape.invalid.file_num", FT_BOOLEAN, 32,
3249 TFS(&tfs_ndmp_tape_invalid_file_num), 0x00000001, "invalid_file_num", HFILL }},
3251 { &hf_ndmp_tape_invalid_soft_errors, {
3252 "", "ndmp.tape.invalid.soft_errors", FT_BOOLEAN, 32,
3253 TFS(&tfs_ndmp_tape_invalid_soft_errors), 0x00000002, "soft_errors", HFILL }},
3255 { &hf_ndmp_tape_invalid_block_size, {
3256 "", "ndmp.tape.invalid.block_size", FT_BOOLEAN, 32,
3257 TFS(&tfs_ndmp_tape_invalid_block_size), 0x00000004, "block_size", HFILL }},
3259 { &hf_ndmp_tape_invalid_block_no, {
3260 "", "ndmp.tape.invalid.block_no", FT_BOOLEAN, 32,
3261 TFS(&tfs_ndmp_tape_invalid_block_no), 0x00000008, "block_no", HFILL }},
3263 { &hf_ndmp_tape_invalid_total_space, {
3264 "", "ndmp.tape.invalid.total_space", FT_BOOLEAN, 32,
3265 TFS(&tfs_ndmp_tape_invalid_total_space), 0x00000010, "total_space", HFILL }},
3267 { &hf_ndmp_tape_invalid_space_remain, {
3268 "", "ndmp.tape.invalid.space_remain", FT_BOOLEAN, 32,
3269 TFS(&tfs_ndmp_tape_invalid_space_remain), 0x00000020, "space_remain", HFILL }},
3271 { &hf_ndmp_tape_invalid_partition, {
3272 "", "ndmp.tape.invalid.partition", FT_BOOLEAN, 32,
3273 TFS(&tfs_ndmp_tape_invalid_partition), 0x00000040, "partition", HFILL }},
3275 { &hf_ndmp_tape_flags_no_rewind, {
3276 "", "ndmp.tape.flags.no_rewind", FT_BOOLEAN, 32,
3277 TFS(&tfs_ndmp_tape_flags_no_rewind), 0x00000008, "no_rewind", HFILL, }},
3279 { &hf_ndmp_tape_flags_write_protect, {
3280 "", "ndmp.tape.flags.write_protect", FT_BOOLEAN, 32,
3281 TFS(&tfs_ndmp_tape_flags_write_protect), 0x00000010, "write_protect", HFILL, }},
3283 { &hf_ndmp_tape_flags_error, {
3284 "", "ndmp.tape.flags.error", FT_BOOLEAN, 32,
3285 TFS(&tfs_ndmp_tape_flags_error), 0x00000020, "error", HFILL, }},
3287 { &hf_ndmp_tape_flags_unload, {
3288 "", "ndmp.tape.flags.unload", FT_BOOLEAN, 32,
3289 TFS(&tfs_ndmp_tape_flags_unload), 0x00000040, "unload", HFILL, }},
3291 { &hf_ndmp_tape_file_num, {
3292 "file_num", "ndmp.tape.status.file_num", FT_UINT32, BASE_DEC,
3293 NULL, 0, "file_num", HFILL }},
3295 { &hf_ndmp_tape_soft_errors, {
3296 "soft_errors", "ndmp.tape.status.soft_errors", FT_UINT32, BASE_DEC,
3297 NULL, 0, "soft_errors", HFILL }},
3299 { &hf_ndmp_tape_block_size, {
3300 "block_size", "ndmp.tape.status.block_size", FT_UINT32, BASE_DEC,
3301 NULL, 0, "block_size", HFILL }},
3303 { &hf_ndmp_tape_block_no, {
3304 "block_no", "ndmp.tape.status.block_no", FT_UINT32, BASE_DEC,
3305 NULL, 0, "block_no", HFILL }},
3307 { &hf_ndmp_tape_total_space, {
3308 "total_space", "ndmp.tape.status.total_space", FT_UINT64, BASE_DEC,
3309 NULL, 0, "total_space", HFILL }},
3311 { &hf_ndmp_tape_space_remain, {
3312 "space_remain", "ndmp.tape.status.space_remain", FT_UINT64, BASE_DEC,
3313 NULL, 0, "space_remain", HFILL }},
3315 { &hf_ndmp_tape_partition, {
3316 "partition", "ndmp.tape.status.partition", FT_UINT32, BASE_DEC,
3317 NULL, 0, "partition", HFILL }},
3319 { &hf_ndmp_tape_mtio_op, {
3320 "Operation", "ndmp.tape.mtio.op", FT_UINT32, BASE_DEC,
3321 VALS(tape_mtio_vals), 0, "MTIO Operation", HFILL }},
3324 "Count", "ndmp.count", FT_UINT32, BASE_DEC,
3325 NULL, 0, "Number of bytes/objects/operations", HFILL }},
3327 { &hf_ndmp_resid_count, {
3328 "Resid Count", "ndmp.resid_count", FT_UINT32, BASE_DEC,
3329 NULL, 0, "Number of remaining bytes/objects/operations", HFILL }},
3331 { &hf_ndmp_mover_state, {
3332 "State", "ndmp.mover.state", FT_UINT32, BASE_DEC,
3333 VALS(mover_state_vals), 0, "State of the selected mover", HFILL }},
3335 { &hf_ndmp_mover_pause, {
3336 "Pause", "ndmp.mover.pause", FT_UINT32, BASE_DEC,
3337 VALS(mover_pause_vals), 0, "Reason why the mover paused", HFILL }},
3340 "Halt", "ndmp.halt", FT_UINT32, BASE_DEC,
3341 VALS(halt_vals), 0, "Reason why it halted", HFILL }},
3343 { &hf_ndmp_record_size, {
3344 "Record Size", "ndmp.record.size", FT_UINT32, BASE_DEC,
3345 NULL, 0, "Record size in bytes", HFILL }},
3347 { &hf_ndmp_record_num, {
3348 "Record Num", "ndmp.record.num", FT_UINT32, BASE_DEC,
3349 NULL, 0, "Number of records", HFILL }},
3351 { &hf_ndmp_data_written, {
3352 "Data Written", "ndmp.data.written", FT_UINT64, BASE_DEC,
3353 NULL, 0, "Number of data bytes written", HFILL }},
3355 { &hf_ndmp_seek_position, {
3356 "Seek Position", "ndmp.seek.position", FT_UINT64, BASE_DEC,
3357 NULL, 0, "Current seek position on device", HFILL }},
3359 { &hf_ndmp_bytes_left_to_read, {
3360 "Bytes left to read", "ndmp.bytes_left_to_read", FT_INT64, BASE_DEC,
3361 NULL, 0, "Number of bytes left to be read from the device", HFILL }},
3363 { &hf_ndmp_window_offset, {
3364 "Window Offset", "ndmp.window.offset", FT_UINT64, BASE_DEC,
3365 NULL, 0, "Offset to window in bytes", HFILL }},
3367 { &hf_ndmp_window_length, {
3368 "Window Length", "ndmp.window.length", FT_UINT64, BASE_DEC,
3369 NULL, 0, "Size of window in bytes", HFILL }},
3371 { &hf_ndmp_addr_ip, {
3372 "IP Address", "ndmp.addr.ip", FT_IPv4, BASE_DEC,
3373 NULL, 0, "IP Address", HFILL }},
3375 { &hf_ndmp_addr_tcp, {
3376 "TCP Port", "ndmp.addr.tcp_port", FT_UINT32, BASE_DEC,
3377 NULL, 0, "TCP Port", HFILL }},
3379 { &hf_ndmp_addr_fcal_loop_id, {
3380 "Loop ID", "ndmp.addr.loop_id", FT_UINT32, BASE_HEX,
3381 NULL, 0, "FCAL Loop ID", HFILL }},
3383 { &hf_ndmp_addr_ipc, {
3384 "IPC", "ndmp.addr.ipc", FT_BYTES, BASE_HEX,
3385 NULL, 0, "IPC identifier", HFILL }},
3387 { &hf_ndmp_mover_mode, {
3388 "Mode", "ndmp.mover.mode", FT_UINT32, BASE_HEX,
3389 VALS(mover_mode_vals), 0, "Mover Mode", HFILL }},
3391 { &hf_ndmp_file_name, {
3392 "File", "ndmp.file", FT_STRING, BASE_NONE,
3393 NULL, 0, "Name of File", HFILL }},
3395 { &hf_ndmp_nt_file_name, {
3396 "NT File", "ndmp.file", FT_STRING, BASE_NONE,
3397 NULL, 0, "NT Name of File", HFILL }},
3399 { &hf_ndmp_dos_file_name, {
3400 "DOS File", "ndmp.file", FT_STRING, BASE_NONE,
3401 NULL, 0, "DOS Name of File", HFILL }},
3403 { &hf_ndmp_log_type, {
3404 "Type", "ndmp.log.type", FT_UINT32, BASE_HEX,
3405 VALS(log_type_vals), 0, "Type of log entry", HFILL }},
3407 { &hf_ndmp_log_message_id, {
3408 "Message ID", "ndmp.log.message.id", FT_UINT32, BASE_DEC,
3409 NULL, 0, "ID of this log entry", HFILL }},
3411 { &hf_ndmp_log_message, {
3412 "Message", "ndmp.log.message", FT_STRING, BASE_NONE,
3413 NULL, 0, "Log entry", HFILL }},
3415 { &hf_ndmp_halt_reason, {
3416 "Reason", "ndmp.halt.reason", FT_STRING, BASE_NONE,
3417 NULL, 0, "Textual reason for why it halted", HFILL }},
3419 { &hf_ndmp_connected, {
3420 "Connected", "ndmp.connected", FT_UINT32, BASE_DEC,
3421 VALS(connected_vals), 0, "Status of connection", HFILL }},
3423 { &hf_ndmp_connected_reason, {
3424 "Reason", "ndmp.connected.reason", FT_STRING, BASE_NONE,
3425 NULL, 0, "Textual description of the connection status", HFILL }},
3427 { &hf_ndmp_auth_id, {
3428 "ID", "ndmp.auth.id", FT_STRING, BASE_NONE,
3429 NULL, 0, "ID of client authenticating", HFILL }},
3431 { &hf_ndmp_auth_password, {
3432 "Password", "ndmp.auth.password", FT_STRING, BASE_NONE,
3433 NULL, 0, "Password of client authenticating", HFILL }},
3436 "Data", "ndmp.data", FT_BYTES, BASE_HEX,
3437 NULL, 0, "Data written/read", HFILL }},
3440 "Files", "ndmp.files", FT_NONE, 0,
3441 NULL, 0, "List of files", HFILL }},
3443 { &hf_ndmp_file_names, {
3444 "File Names", "ndmp.file.names", FT_NONE, 0,
3445 NULL, 0, "List of file names", HFILL }},
3447 { &hf_ndmp_file_fs_type, {
3448 "File FS Type", "ndmp.file.fs_type", FT_UINT32, BASE_DEC,
3449 VALS(file_fs_type_vals), 0, "Type of file permissions (UNIX or NT)", HFILL }},
3451 { &hf_ndmp_file_type, {
3452 "File Type", "ndmp.file.type", FT_UINT32, BASE_DEC,
3453 VALS(file_type_vals), 0, "Type of file", HFILL }},
3455 { &hf_ndmp_file_stats, {
3456 "File Stats", "ndmp.file.stats", FT_NONE, 0,
3457 NULL, 0, "List of file stats", HFILL }},
3459 { &hf_ndmp_file_node, {
3460 "Node", "ndmp.file.node", FT_UINT64, BASE_DEC,
3461 NULL, 0, "Node used for direct access", HFILL }},
3463 { &hf_ndmp_file_parent, {
3464 "Parent", "ndmp.file.parent", FT_UINT64, BASE_DEC,
3465 NULL, 0, "Parent node(directory) for this node", HFILL }},
3467 { &hf_ndmp_file_fh_info, {
3468 "FH Info", "ndmp.file.fh_info", FT_UINT64, BASE_DEC,
3469 NULL, 0, "FH Info used for direct access", HFILL }},
3471 { &hf_ndmp_file_invalid_atime, {
3472 "", "ndmp.file.invalid_atime", FT_BOOLEAN, 32,
3473 TFS(&tfs_ndmp_file_invalid_atime), 0x00000001, "invalid_atime", HFILL, }},
3475 { &hf_ndmp_file_invalid_ctime, {
3476 "", "ndmp.file.invalid_ctime", FT_BOOLEAN, 32,
3477 TFS(&tfs_ndmp_file_invalid_ctime), 0x00000002, "invalid_ctime", HFILL, }},
3479 { &hf_ndmp_file_invalid_group, {
3480 "", "ndmp.file.invalid_group", FT_BOOLEAN, 32,
3481 TFS(&tfs_ndmp_file_invalid_group), 0x00000004, "invalid_group", HFILL, }},
3483 { &hf_ndmp_file_mtime, {
3484 "mtime", "ndmp.file.mtime", FT_ABSOLUTE_TIME, BASE_NONE,
3485 NULL, 0, "Timestamp for mtime for this file", HFILL }},
3487 { &hf_ndmp_file_atime, {
3488 "atime", "ndmp.file.atime", FT_ABSOLUTE_TIME, BASE_NONE,
3489 NULL, 0, "Timestamp for atime for this file", HFILL }},
3491 { &hf_ndmp_file_ctime, {
3492 "ctime", "ndmp.file.ctime", FT_ABSOLUTE_TIME, BASE_NONE,
3493 NULL, 0, "Timestamp for ctime for this file", HFILL }},
3495 { &hf_ndmp_file_owner, {
3496 "Owner", "ndmp.file.owner", FT_UINT32, BASE_DEC,
3497 NULL, 0, "UID for UNIX, owner for NT", HFILL }},
3499 { &hf_ndmp_file_group, {
3500 "Group", "ndmp.file.group", FT_UINT32, BASE_DEC,
3501 NULL, 0, "GID for UNIX, NA for NT", HFILL }},
3503 { &hf_ndmp_file_fattr, {
3504 "Fattr", "ndmp.file.fattr", FT_UINT32, BASE_HEX,
3505 NULL, 0, "Mode for UNIX, fattr for NT", HFILL }},
3507 { &hf_ndmp_file_size, {
3508 "Size", "ndmp.file.size", FT_UINT64, BASE_DEC,
3509 NULL, 0, "File Size", HFILL }},
3511 { &hf_ndmp_file_links, {
3512 "Links", "ndmp.file.links", FT_UINT32, BASE_DEC,
3513 NULL, 0, "Number of links to this file", HFILL }},
3516 "Dirs", "ndmp.dirs", FT_NONE, 0,
3517 NULL, 0, "List of directories", HFILL }},
3520 "Nodes", "ndmp.nodes", FT_NONE, 0,
3521 NULL, 0, "List of nodes", HFILL }},
3524 "Nlist", "ndmp.nlist", FT_NONE, 0,
3525 NULL, 0, "List of names", HFILL }},
3527 { &hf_ndmp_bu_original_path, {
3528 "Original Path", "ndmp.bu.original_path", FT_STRING, BASE_NONE,
3529 NULL, 0, "Original path where backup was created", HFILL }},
3531 { &hf_ndmp_bu_destination_dir, {
3532 "Destination Dir", "ndmp.bu.destination_dir", FT_STRING, BASE_NONE,
3533 NULL, 0, "Destination directory to restore backup to", HFILL }},
3535 { &hf_ndmp_bu_new_name, {
3536 "New Name", "ndmp.bu.new_name", FT_STRING, BASE_NONE,
3537 NULL, 0, "New Name", HFILL }},
3539 { &hf_ndmp_bu_other_name, {
3540 "Other Name", "ndmp.bu.other_name", FT_STRING, BASE_NONE,
3541 NULL, 0, "Other Name", HFILL }},
3543 { &hf_ndmp_state_invalid_ebr, {
3544 "", "ndmp.bu.state.invalid_ebr", FT_BOOLEAN, 32,
3545 TFS(&tfs_ndmp_state_invalid_ebr), 0x00000001, "Whether EstimatedBytesLeft is valid or not", HFILL, }},
3547 { &hf_ndmp_state_invalid_etr, {
3548 "", "ndmp.bu.state.invalid_etr", FT_BOOLEAN, 32,
3549 TFS(&tfs_ndmp_state_invalid_etr), 0x00000002, "Whether EstimatedTimeLeft is valid or not", HFILL, }},
3551 { &hf_ndmp_bu_operation, {
3552 "Operation", "ndmp.bu.operation", FT_UINT32, BASE_DEC,
3553 VALS(bu_operation_vals), 0, "BU Operation", HFILL, }},
3555 { &hf_ndmp_data_state, {
3556 "State", "ndmp.data.state", FT_UINT32, BASE_DEC,
3557 VALS(data_state_vals), 0, "Data state", HFILL, }},
3559 { &hf_ndmp_data_halted, {
3560 "Halted Reason", "ndmp.data.halted", FT_UINT32, BASE_DEC,
3561 VALS(data_halted_vals), 0, "Data halted reason", HFILL, }},
3563 { &hf_ndmp_data_bytes_processed, {
3564 "Bytes Processed", "ndmp.data.bytes_processed", FT_UINT64, BASE_DEC,
3565 NULL, 0, "Number of bytes processed", HFILL }},
3567 { &hf_ndmp_data_est_bytes_remain, {
3568 "Est Bytes Remain", "ndmp.data.est_bytes_remain", FT_UINT64, BASE_DEC,
3569 NULL, 0, "Estimated number of bytes remaining", HFILL }},
3571 { &hf_ndmp_data_est_time_remain, {
3572 "Est Time Remain", "ndmp.data.est_time_remain", FT_RELATIVE_TIME, BASE_DEC,
3573 NULL, 0, "Estimated time remaining", HFILL }},
3574 { &hf_ndmp_lastfrag, {
3575 "Last Fragment", "ndmp.lastfrag", FT_BOOLEAN, 32,
3576 &yesno, RPC_RM_LASTFRAG, "Last Fragment", HFILL }},
3577 { &hf_ndmp_fraglen, {
3578 "Fragment Length", "ndmp.fraglen", FT_UINT32, BASE_DEC,
3579 NULL, RPC_RM_FRAGLEN, "Fragment Length", HFILL }},
3582 static gint *ett[] = {
3586 &ett_ndmp_butype_attrs,
3587 &ett_ndmp_fs_invalid,
3588 &ett_ndmp_tape_attr,
3589 &ett_ndmp_execute_cdb_flags,
3590 &ett_ndmp_execute_cdb_cdb,
3591 &ett_ndmp_execute_cdb_sns,
3592 &ett_ndmp_execute_cdb_payload,
3593 &ett_ndmp_tape_invalid,
3594 &ett_ndmp_tape_flags,
3597 &ett_ndmp_file_name,
3598 &ett_ndmp_file_stats,
3599 &ett_ndmp_file_invalids,
3600 &ett_ndmp_state_invalids,
3603 module_t *ndmp_module;
3605 proto_ndmp = proto_register_protocol("Network Data Management Protocol", "NDMP", "ndmp");
3606 proto_register_field_array(proto_ndmp, hf_ndmp, array_length(hf_ndmp));
3608 proto_register_subtree_array(ett, array_length(ett));
3610 /* desegmentation */
3611 ndmp_module = prefs_register_protocol(proto_ndmp, NULL);
3612 prefs_register_enum_preference(ndmp_module,
3615 "Version of the NDMP protocol",
3616 &ndmp_protocol_version,
3617 ndmp_protocol_versions,
3619 prefs_register_bool_preference(ndmp_module, "desegment",
3620 "Reassemble NDMP messages spanning multiple TCP segments",
3621 "Whether the NDMP dissector should reassemble messages spanning multiple TCP segments."
3622 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
3624 prefs_register_bool_preference(ndmp_module, "defragment",
3625 "Reassemble fragmented NDMP messages spanning multiple packets",
3626 "Whether the dissector should defragment NDMP messages spanning multiple packets.",
3631 proto_reg_handoff_ndmp(void)
3633 dissector_handle_t ndmp_handle;
3635 ndmp_handle = new_create_dissector_handle(dissect_ndmp, proto_ndmp);
3636 dissector_add("tcp.port",TCP_PORT_NDMP, ndmp_handle);