diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-12-23 21:36:58 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-12-23 21:36:58 +0000 |
commit | 6f0d79c0d7afe5556b9ac4f3b6ccc71a5264b352 (patch) | |
tree | b2a7ba59dd059ac2046918a562b76068b697b6aa | |
parent | 914061d436b0bb20c192860c0e557e302c79b915 (diff) |
From Ronnie Sahlberg: initial NDMPv3 support, and an update to his
e-mail address.
svn path=/trunk/; revision=4444
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | Makefile.nmake | 3 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | packet-dvmrp.c | 4 | ||||
-rw-r--r-- | packet-dvmrp.h | 4 | ||||
-rw-r--r-- | packet-igmp.c | 4 | ||||
-rw-r--r-- | packet-klm.c | 4 | ||||
-rw-r--r-- | packet-klm.h | 4 | ||||
-rw-r--r-- | packet-mrdisc.c | 4 | ||||
-rw-r--r-- | packet-mrdisc.h | 4 | ||||
-rw-r--r-- | packet-msnip.c | 4 | ||||
-rw-r--r-- | packet-msnip.h | 4 | ||||
-rw-r--r-- | packet-ndmp.c | 522 | ||||
-rw-r--r-- | packet-nisplus.c | 4 | ||||
-rw-r--r-- | packet-nisplus.h | 4 | ||||
-rw-r--r-- | packet-nlm.c | 4 | ||||
-rw-r--r-- | packet-spray.c | 4 | ||||
-rw-r--r-- | packet-spray.h | 4 | ||||
-rw-r--r-- | packet-stat-notify.c | 4 | ||||
-rw-r--r-- | packet-stat-notify.h | 4 | ||||
-rw-r--r-- | packet-stat.c | 4 | ||||
-rw-r--r-- | packet-ypserv.c | 4 |
23 files changed, 565 insertions, 39 deletions
@@ -531,7 +531,7 @@ Kent Engström <kent[AT]unit.liu.se> { CDP VTP Management Domain item support } -Ronnie Sahlberg <rsahlber[AT]bigpond.net.au> { +Ronnie Sahlberg <sahlberg[AT]optushome.com.au> { NLM dissector enhancements Mount dissector enhancements Support for status monitor protocol and status monitor callback @@ -565,6 +565,7 @@ Ronnie Sahlberg <rsahlber[AT]bigpond.net.au> { Diameter, L2TP, NFS, and NLM dissectors to use it and to the ONC RPC dissector to allow ONC RPC subdissectors to use it SMB tvbuffication + NDMPv3 support } Borosa Tomislav <tomislav.borosa[AT]SIEMENS.HR> { diff --git a/Makefile.am b/Makefile.am index fb9f9a7a1b..88ed499473 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.399 2001/12/19 21:14:49 guy Exp $ +# $Id: Makefile.am,v 1.400 2001/12/23 21:36:57 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -194,6 +194,7 @@ DISSECTOR_SRC = \ packet-nbns.c \ packet-ncp.c \ packet-ncp2222.c \ + packet-ndmp.c \ packet-netbios.c \ packet-nfs.c \ packet-nisplus.c \ diff --git a/Makefile.nmake b/Makefile.nmake index 207e2fa22c..48f9f2c112 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -1,7 +1,7 @@ ## Makefile for building ethereal.exe with Microsoft C and nmake ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake # -# $Id: Makefile.nmake,v 1.157 2001/12/19 21:14:49 guy Exp $ +# $Id: Makefile.nmake,v 1.158 2001/12/23 21:36:57 guy Exp $ include config.nmake include <win32.mak> @@ -145,6 +145,7 @@ DISSECTOR_SRC = \ packet-nbns.c \ packet-ncp.c \ packet-ncp2222.c \ + packet-ndmp.c \ packet-netbios.c \ packet-nfs.c \ packet-nisplus.c \ @@ -1,5 +1,6 @@ Overview of changes in Ethereal 0.9.0: +* Initial NDMPv3 support. (Ronnie) * packet-l2tp.c - Vendor-specific attribute fixes. (Motonori) * Fix timestamp processing in packet-ucp.c, other UCP fixes. (Steffen Weinreich) diff --git a/packet-dvmrp.c b/packet-dvmrp.c index 663f646d48..79e03f4e0c 100644 --- a/packet-dvmrp.c +++ b/packet-dvmrp.c @@ -1,7 +1,7 @@ -/* packet-dvmrp.c 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-dvmrp.c 2001 Ronnie Sahlberg <See AUTHORS for email> * Routines for IGMP/DVMRP packet disassembly * - * $Id: packet-dvmrp.c,v 1.4 2001/12/10 00:25:27 guy Exp $ + * $Id: packet-dvmrp.c,v 1.5 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-dvmrp.h b/packet-dvmrp.h index f8c1a889ed..f4ea79cfd8 100644 --- a/packet-dvmrp.h +++ b/packet-dvmrp.h @@ -1,7 +1,7 @@ -/* packet-dvmrp.h 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-dvmrp.h 2001 Ronnie Sahlberg <See AUTHORS for email> * Declarations of routines for IGMP/DVMRP packet disassembly * - * $Id: packet-dvmrp.h,v 1.1 2001/06/12 06:21:55 guy Exp $ + * $Id: packet-dvmrp.h,v 1.2 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-igmp.c b/packet-igmp.c index d9525ee72f..8e8caaa126 100644 --- a/packet-igmp.c +++ b/packet-igmp.c @@ -1,7 +1,7 @@ -/* packet-igmp.c 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-igmp.c 2001 Ronnie Sahlberg <See AUTHORS for email> * Routines for IGMP packet disassembly * - * $Id: packet-igmp.c,v 1.14 2001/12/10 00:25:28 guy Exp $ + * $Id: packet-igmp.c,v 1.15 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-klm.c b/packet-klm.c index b08bbcb509..bbec6f4e7d 100644 --- a/packet-klm.c +++ b/packet-klm.c @@ -1,7 +1,7 @@ -/* packet-klm.c 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-klm.c 2001 Ronnie Sahlberg <See AUTHORS for email> * Routines for klm dissection * - * $Id: packet-klm.c,v 1.5 2001/11/27 22:37:20 guy Exp $ + * $Id: packet-klm.c,v 1.6 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-klm.h b/packet-klm.h index 32e3309aad..e7f3c92492 100644 --- a/packet-klm.h +++ b/packet-klm.h @@ -1,6 +1,6 @@ -/* packet-klm.h 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-klm.h 2001 Ronnie Sahlberg <See AUTHORS for email> * - * $Id: packet-klm.h,v 1.2 2001/06/12 06:31:14 guy Exp $ + * $Id: packet-klm.h,v 1.3 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-mrdisc.c b/packet-mrdisc.c index 3312fc8198..39e764b17e 100644 --- a/packet-mrdisc.c +++ b/packet-mrdisc.c @@ -1,7 +1,7 @@ -/* packet-mrdisc.c 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-mrdisc.c 2001 Ronnie Sahlberg <See AUTHORS for email> * Routines for IGMP/MRDISC packet disassembly * - * $Id: packet-mrdisc.c,v 1.3 2001/12/10 00:25:30 guy Exp $ + * $Id: packet-mrdisc.c,v 1.4 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-mrdisc.h b/packet-mrdisc.h index 118397e105..e640c884bd 100644 --- a/packet-mrdisc.h +++ b/packet-mrdisc.h @@ -1,7 +1,7 @@ -/* packet-mrdisc.h 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-mrdisc.h 2001 Ronnie Sahlberg <See AUTHORS for email> * Declarations of routines for IGMP/MRDISC packet disassembly * - * $Id: packet-mrdisc.h,v 1.1 2001/06/27 20:19:19 guy Exp $ + * $Id: packet-mrdisc.h,v 1.2 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-msnip.c b/packet-msnip.c index 6bf4d32477..87dd76fbd3 100644 --- a/packet-msnip.c +++ b/packet-msnip.c @@ -1,7 +1,7 @@ -/* packet-msnip.c 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-msnip.c 2001 Ronnie Sahlberg <See AUTHORS for email> * Routines for IGMP/MSNIP packet disassembly * - * $Id: packet-msnip.c,v 1.2 2001/12/10 00:25:30 guy Exp $ + * $Id: packet-msnip.c,v 1.3 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-msnip.h b/packet-msnip.h index 6bb5d56a1d..d7da588096 100644 --- a/packet-msnip.h +++ b/packet-msnip.h @@ -1,7 +1,7 @@ -/* packet-msnip.h 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> +/* packet-msnip.h 2001 Ronnie Sahlberg <See AUTHORS for email> * Declarations of routines for IGMP/MSNIP packet disassembly * - * $Id: packet-msnip.h,v 1.1 2001/06/29 18:55:50 guy Exp $ + * $Id: packet-msnip.h,v 1.2 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-ndmp.c b/packet-ndmp.c new file mode 100644 index 0000000000..ecee3927d5 --- /dev/null +++ b/packet-ndmp.c @@ -0,0 +1,522 @@ +/* packet-ndmp.c + * Routines for NDMP + * Ronnie Sahlberg (see AUTHORS for email) + * + * $Id: packet-ndmp.c,v 1.1 2001/12/23 21:36:57 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* see www.ndmp.org for protocol specifications. + this file implements version 3 of ndmp +*/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <glib.h> + +#include "packet.h" +#include "prefs.h" + +#define TCP_PORT_NDMP 10000 + +static int proto_ndmp = -1; +static int hf_ndmp_version = -1; +static int hf_ndmp_size = -1; +static int hf_ndmp_header = -1; +static int hf_ndmp_sequence = -1; +static int hf_ndmp_reply_sequence = -1; +static int hf_ndmp_timestamp = -1; +static int hf_ndmp_msgtype = -1; +static int hf_ndmp_msg = -1; +static int hf_ndmp_error = -1; + +static gint ett_ndmp = -1; +static gint ett_ndmp_header = -1; + +/* desegmentation of NDMP packets */ +static gboolean ndmp_desegment = FALSE; + + +#define NDMP_MESSAGE_REQUEST 0x00 +#define NDMP_MESSAGE_REPLY 0x01 +static const value_string msg_type_vals[] = { + {NDMP_MESSAGE_REQUEST, "Request"}, + {NDMP_MESSAGE_REPLY, "Reply"}, + {0, NULL} +}; + +#define NDMP_NO_ERR 0x00 +#define NDMP_NOT_SUPPORTED_ERR 0x01 +#define NDMP_DEVICE_BUSY_ERR 0x02 +#define NDMP_DEVICE_OPENED_ERR 0x03 +#define NDMP_NOT_AUTHORIZED_ERR 0x04 +#define NDMP_PERMISSION_ERR 0x05 +#define NDMP_DEV_NOT_OPEN_ERR 0x06 +#define NDMP_IO_ERR 0x07 +#define NDMP_TIMEOUT_ERR 0x08 +#define NDMP_ILLEGAL_ARGS_ERR 0x09 +#define NDMP_NO_TAPE_LOADED_ERR 0x0a +#define NDMP_WRITE_PROTECT_ERR 0x0b +#define NDMP_EOF_ERR 0x0c +#define NDMP_EOM_ERR 0x0d +#define NDMP_FILE_NOT_FOUND_ERR 0x0e +#define NDMP_BAD_FILE_ERR 0x0f +#define NDMP_NO_DEVICE_ERR 0x10 +#define NDMP_NO_BUS_ERR 0x11 +#define NDMP_XDR_DECODE_ERR 0x12 +#define NDMP_ILLEGAL_STATE_ERR 0x13 +#define NDMP_UNDEFINED_ERR 0x14 +#define NDMP_XDR_ENCODE_ERR 0x15 +#define NDMP_NO_MEM_ERR 0x16 +#define NDMP_CONNECT_ERR 0x17 + +static const value_string error_vals[] = { + {NDMP_NO_ERR, "NO_ERR"}, + {NDMP_NOT_SUPPORTED_ERR, "NOT_SUPPORTED_ERR"}, + {NDMP_DEVICE_BUSY_ERR, "DEVICE_BUSY_ERR"}, + {NDMP_DEVICE_OPENED_ERR, "DEVICE_OPENED_ERR"}, + {NDMP_NOT_AUTHORIZED_ERR, "NOT_AUTHORIZED_ERR"}, + {NDMP_PERMISSION_ERR, "PERMISSION_ERR"}, + {NDMP_DEV_NOT_OPEN_ERR, "DEV_NOT_OPEN_ERR"}, + {NDMP_IO_ERR, "IO_ERR"}, + {NDMP_TIMEOUT_ERR, "TIMEOUT_ERR"}, + {NDMP_ILLEGAL_ARGS_ERR, "ILLEGAL_ARGS_ERR"}, + {NDMP_NO_TAPE_LOADED_ERR, "NO_TAPE_LOADED_ERR"}, + {NDMP_WRITE_PROTECT_ERR, "WRITE_PROTECT_ERR"}, + {NDMP_EOF_ERR, "EOF_ERR"}, + {NDMP_EOM_ERR, "EOM_ERR"}, + {NDMP_FILE_NOT_FOUND_ERR, "FILE_NOT_FOUND_ERR"}, + {NDMP_BAD_FILE_ERR, "BAD_FILE_ERR"}, + {NDMP_NO_DEVICE_ERR, "NO_DEVICE_ERR"}, + {NDMP_NO_BUS_ERR, "NO_BUS_ERR"}, + {NDMP_XDR_DECODE_ERR, "XDR_DECODE_ERR"}, + {NDMP_ILLEGAL_STATE_ERR, "ILLEGAL_STATE_ERR"}, + {NDMP_UNDEFINED_ERR, "UNDEFINED_ERR"}, + {NDMP_XDR_ENCODE_ERR, "XDR_ENCODE_ERR"}, + {NDMP_NO_MEM_ERR, "NO_MEM_ERR"}, + {NDMP_CONNECT_ERR, "CONNECT_ERR"}, + {0, NULL} +}; + + + +#define NDMP_CONFIG_GET_HOST_INFO 0x100 +#define NDMP_CONFIG_GET_CONNECTION_TYPE 0x102 +#define NDMP_CONFIG_GET_AUTH_ATTR 0x103 +#define NDMP_CONFIG_GET_BUTYPE_INFO 0x104 +#define NDMP_CONFIG_GET_FS_INFO 0x105 +#define NDMP_CONFIG_GET_TAPE_INFO 0x106 +#define NDMP_CONFIG_GET_SCSI_INFO 0x107 +#define NDMP_CONFIG_GET_SERVER_INFO 0x108 +#define NDMP_SCSI_OPEN 0x200 +#define NDMP_SCSI_CLOSE 0x201 +#define NDMP_SCSI_GET_STATE 0x202 +#define NDMP_SCSI_SET_TARGET 0x203 +#define NDMP_SCSI_RESET_DEVICE 0x204 +#define NDMP_SCSI_RESET_BUS 0x205 +#define NDMP_SCSI_EXECUTE_CDB 0x206 +#define NDMP_TAPE_OPEN 0x300 +#define NDMP_TAPE_CLOSE 0x301 +#define NDMP_TAPE_GET_STATE 0x302 +#define NDMP_TAPE_MTIO 0x303 +#define NDMP_TAPE_WRITE 0x304 +#define NDMP_TAPE_READ 0x305 +#define NDMP_TAPE_EXECUTE_CDB 0x307 +#define NDMP_DATA_GET_STATE 0x400 +#define NDMP_DATA_START_BACKUP 0x401 +#define NDMP_DATA_START_RECOVER 0x402 +#define NDMP_DATA_ABORT 0x403 +#define NDMP_DATA_GET_ENV 0x404 +#define NDMP_DATA_STOP 0x407 +#define NDMP_DATA_LISTEN 0x409 +#define NDMP_DATA_CONNECT 0x40a +#define NDMP_NOTIFY_DATA_HALTED 0x501 +#define NDMP_NOTIFY_CONNECTED 0x502 +#define NDMP_NOTIFY_MOVER_HALTED 0x503 +#define NDMP_NOTIFY_MOVER_PAUSED 0x504 +#define NDMP_NOTIFY_DATA_READ 0x505 +#define NDMP_LOG_FILE 0x602 +#define NDMP_LOG_MESSAGE 0x603 +#define NDMP_FH_ADD_FILE 0x703 +#define NDMP_FH_ADD_DIR 0x704 +#define NDMP_FH_ADD_NODE 0x705 +#define NDMP_CONNECT_OPEN 0x900 +#define NDMP_CONNECT_CLIENT_AUTH 0x901 +#define NDMP_CONNECT_CLOSE 0x902 +#define NDMP_CONNECT_SERVER_AUTH 0x903 +#define NDMP_MOVER_GET_STATE 0xa00 +#define NDMP_MOVER_LISTEN 0xa01 +#define NDMP_MOVER_CONTINUE 0xa02 +#define NDMP_MOVER_ABORT 0xa03 +#define NDMP_MOVER_STOP 0xa04 +#define NDMP_MOVER_SET_WINDOW 0xa05 +#define NDMP_MOVER_READ 0xa06 +#define NDMP_MOVER_CLOSE 0xa07 +#define NDMP_MOVER_SET_RECORD_SIZE 0xa08 +#define NDMP_MOVER_CONNECT 0xa09 + + + + +static const value_string msg_vals[] = { + {NDMP_CONFIG_GET_HOST_INFO, "CONFIG_GET_HOST_INFO"}, + {NDMP_CONFIG_GET_CONNECTION_TYPE, "CONFIG_GET_CONNECTION_TYPE"}, + {NDMP_CONFIG_GET_AUTH_ATTR, "CONFIG_GET_AUTH_ATTR"}, + {NDMP_CONFIG_GET_BUTYPE_INFO, "CONFIG_GET_BUTYPE_INFO"}, + {NDMP_CONFIG_GET_FS_INFO, "CONFIG_GET_FS_INFO"}, + {NDMP_CONFIG_GET_TAPE_INFO, "CONFIG_GET_TAPE_INFO"}, + {NDMP_CONFIG_GET_SCSI_INFO, "CONFIG_GET_SCSI_INFO"}, + {NDMP_CONFIG_GET_SERVER_INFO, "CONFIG_GET_SERVER_INFO"}, + {NDMP_SCSI_OPEN, "SCSI_OPEN"}, + {NDMP_SCSI_CLOSE, "SCSI_CLOSE"}, + {NDMP_SCSI_GET_STATE, "SCSI_GET_STATE"}, + {NDMP_SCSI_SET_TARGET, "SCSI_SET_TARGET"}, + {NDMP_SCSI_RESET_DEVICE, "SCSI_RESET_DEVICE"}, + {NDMP_SCSI_RESET_BUS, "SCSI_RESET_BUS"}, + {NDMP_SCSI_EXECUTE_CDB, "SCSI_EXECUTE_CDB"}, + {NDMP_TAPE_OPEN, "TAPE_OPEN"}, + {NDMP_TAPE_CLOSE, "TAPE_CLOSE"}, + {NDMP_TAPE_GET_STATE, "TAPE_GET_STATE"}, + {NDMP_TAPE_MTIO, "TAPE_MTIO"}, + {NDMP_TAPE_WRITE, "TAPE_WRITE"}, + {NDMP_TAPE_READ, "TAPE_READ"}, + {NDMP_TAPE_EXECUTE_CDB, "TAPE_EXECUTE_CDB"}, + {NDMP_DATA_GET_STATE, "DATA_GET_STATE"}, + {NDMP_DATA_START_BACKUP, "DATA_START_BACKUP"}, + {NDMP_DATA_START_RECOVER, "DATA_START_RECOVER"}, + {NDMP_DATA_ABORT, "DATA_ABORT"}, + {NDMP_DATA_GET_ENV, "DATA_GET_ENV"}, + {NDMP_DATA_STOP, "DATA_STOP"}, + {NDMP_DATA_LISTEN, "DATA_LISTEN"}, + {NDMP_DATA_CONNECT, "DATA_CONNECT"}, + {NDMP_NOTIFY_DATA_HALTED, "NOTIFY_DATA_HALTED"}, + {NDMP_NOTIFY_CONNECTED, "NOTIFY_CONNECTED"}, + {NDMP_NOTIFY_MOVER_HALTED, "NOTIFY_MOVER_HALTED"}, + {NDMP_NOTIFY_MOVER_PAUSED, "NOTIFY_MOVER_PAUSED"}, + {NDMP_NOTIFY_DATA_READ, "NOTIFY_DATA_READ"}, + {NDMP_LOG_FILE, "LOG_FILE"}, + {NDMP_LOG_MESSAGE, "LOG_MESSAGE"}, + {NDMP_FH_ADD_FILE, "FH_ADD_FILE"}, + {NDMP_FH_ADD_DIR, "FH_ADD_DIR"}, + {NDMP_FH_ADD_NODE, "FH_ADD_NODE"}, + {NDMP_CONNECT_OPEN, "CONNECT_OPEN"}, + {NDMP_CONNECT_CLIENT_AUTH, "CONNECT_CLIENT_AUTH"}, + {NDMP_CONNECT_CLOSE, "CONNECT_CLOSE"}, + {NDMP_CONNECT_SERVER_AUTH, "CONNECT_SERVER_AUTH"}, + {NDMP_MOVER_GET_STATE, "MOVER_GET_STATE"}, + {NDMP_MOVER_LISTEN, "MOVER_LISTEN"}, + {NDMP_MOVER_CONTINUE, "MOVER_CONTINUE"}, + {NDMP_MOVER_ABORT, "MOVER_ABORT"}, + {NDMP_MOVER_STOP, "MOVER_STOP"}, + {NDMP_MOVER_SET_WINDOW, "MOVER_SET_WINDOW"}, + {NDMP_MOVER_READ, "MOVER_READ"}, + {NDMP_MOVER_CLOSE, "MOVER_CLOSE"}, + {NDMP_MOVER_SET_RECORD_SIZE, "MOVER_SET_RECORD_SIZE"}, + {NDMP_MOVER_CONNECT, "MOVER_CONNECT"}, + {0, NULL} +}; + + +static int +dissect_connect_open_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +{ + /* version number */ + proto_tree_add_item(tree, hf_ndmp_version, tvb, offset, 4, FALSE); + offset += 4; + + return offset; +} + +static int +dissect_error(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +{ + /* error */ + proto_tree_add_item(tree, hf_ndmp_error, tvb, offset, 4, FALSE); + offset += 4; + + return offset; +} + + +typedef struct _ndmp_command { + guint32 cmd; + int (*request) (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree); + int (*response)(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree); +} ndmp_command; + +static const ndmp_command ndmp_commands[] = { + {NDMP_CONFIG_GET_HOST_INFO, NULL,NULL}, + {NDMP_CONFIG_GET_CONNECTION_TYPE, NULL,NULL}, + {NDMP_CONFIG_GET_AUTH_ATTR, NULL,NULL}, + {NDMP_CONFIG_GET_BUTYPE_INFO, NULL,NULL}, + {NDMP_CONFIG_GET_FS_INFO, NULL,NULL}, + {NDMP_CONFIG_GET_TAPE_INFO, NULL,NULL}, + {NDMP_CONFIG_GET_SCSI_INFO, NULL,NULL}, + {NDMP_CONFIG_GET_SERVER_INFO, NULL,NULL}, + {NDMP_SCSI_OPEN, NULL,NULL}, + {NDMP_SCSI_CLOSE, NULL,NULL}, + {NDMP_SCSI_GET_STATE, NULL,NULL}, + {NDMP_SCSI_SET_TARGET, NULL,NULL}, + {NDMP_SCSI_RESET_DEVICE, NULL,NULL}, + {NDMP_SCSI_RESET_BUS, NULL,NULL}, + {NDMP_SCSI_EXECUTE_CDB, NULL,NULL}, + {NDMP_TAPE_OPEN, NULL,NULL}, + {NDMP_TAPE_CLOSE, NULL,NULL}, + {NDMP_TAPE_GET_STATE, NULL,NULL}, + {NDMP_TAPE_MTIO, NULL,NULL}, + {NDMP_TAPE_WRITE, NULL,NULL}, + {NDMP_TAPE_READ, NULL,NULL}, + {NDMP_TAPE_EXECUTE_CDB, NULL,NULL}, + {NDMP_DATA_GET_STATE, NULL,NULL}, + {NDMP_DATA_START_BACKUP, NULL,NULL}, + {NDMP_DATA_START_RECOVER, NULL,NULL}, + {NDMP_DATA_ABORT, NULL,NULL}, + {NDMP_DATA_GET_ENV, NULL,NULL}, + {NDMP_DATA_STOP, NULL,NULL}, + {NDMP_DATA_LISTEN, NULL,NULL}, + {NDMP_DATA_CONNECT, NULL,NULL}, + {NDMP_NOTIFY_DATA_HALTED, NULL,NULL}, + {NDMP_NOTIFY_CONNECTED, NULL,NULL}, + {NDMP_NOTIFY_MOVER_HALTED, NULL,NULL}, + {NDMP_NOTIFY_MOVER_PAUSED, NULL,NULL}, + {NDMP_NOTIFY_DATA_READ, NULL,NULL}, + {NDMP_LOG_FILE, NULL,NULL}, + {NDMP_LOG_MESSAGE, NULL,NULL}, + {NDMP_FH_ADD_FILE, NULL,NULL}, + {NDMP_FH_ADD_DIR, NULL,NULL}, + {NDMP_FH_ADD_NODE, NULL,NULL}, + {NDMP_CONNECT_OPEN, dissect_connect_open_request, dissect_error}, + {NDMP_CONNECT_CLIENT_AUTH, NULL,NULL}, + {NDMP_CONNECT_CLOSE, NULL,NULL}, + {NDMP_CONNECT_SERVER_AUTH, NULL,NULL}, + {NDMP_MOVER_GET_STATE, NULL,NULL}, + {NDMP_MOVER_LISTEN, NULL,NULL}, + {NDMP_MOVER_CONTINUE, NULL,NULL}, + {NDMP_MOVER_ABORT, NULL,NULL}, + {NDMP_MOVER_STOP, NULL,NULL}, + {NDMP_MOVER_SET_WINDOW, NULL,NULL}, + {NDMP_MOVER_READ, NULL,NULL}, + {NDMP_MOVER_CLOSE, NULL,NULL}, + {NDMP_MOVER_SET_RECORD_SIZE, NULL,NULL}, + {NDMP_MOVER_CONNECT, NULL,NULL}, + {0, NULL,NULL} +}; + + +static int +dissect_ndmp_header(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree) +{ + proto_item* item = NULL; + proto_tree* tree = NULL; + guint32 msgtype, msg; + + if (parent_tree) { + item = proto_tree_add_item(tree, hf_ndmp_header, tvb, + offset, 24, FALSE); + tree = proto_item_add_subtree(item, ett_ndmp_header); + } + + /* sequence number */ + proto_tree_add_item(tree, hf_ndmp_sequence, tvb, offset, 4, FALSE); + offset += 4; + + /* timestamp */ + proto_tree_add_item(tree, hf_ndmp_timestamp, tvb, offset, 4, FALSE); + offset += 4; + + /* Message Type */ + msgtype = tvb_get_ntohl(tvb, offset); + proto_tree_add_item(tree, hf_ndmp_msgtype, tvb, offset, 4, FALSE); + offset += 4; + + /* Message */ + msg = tvb_get_ntohl(tvb, offset); + proto_tree_add_item(tree, hf_ndmp_msg, tvb, offset, 4, FALSE); + offset += 4; + + /* Reply sequence number */ + proto_tree_add_item(tree, hf_ndmp_reply_sequence, tvb, offset, 4, FALSE); + offset += 4; + + /* error */ + proto_tree_add_item(tree, hf_ndmp_error, tvb, offset, 4, FALSE); + offset += 4; + + if (check_col(pinfo->cinfo, COL_INFO)){ + col_clear(pinfo->cinfo, COL_INFO); + col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s", + val_to_str(msg, msg_vals, "Unknown Message (0x%02x)"), + val_to_str(msgtype, msg_type_vals, "Unknown Type (0x%02x)") + ); + } + + return offset; +} + + +static int +dissect_ndmp_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +{ + int i; + guint32 msg, msgtype; + + msg=tvb_get_ntohl(tvb, offset+12); + msgtype=tvb_get_ntohl(tvb, offset+8); + + offset=dissect_ndmp_header(tvb, offset, pinfo, tree); + + + for(i=0;ndmp_commands[i].cmd!=0;i++){ + if(ndmp_commands[i].cmd==msg){ + break; + } + } + + + if(ndmp_commands[i].cmd==0){ + /* we do not know this message */ + proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Unknown type of NDMP message: 0x%02x", msg); + offset+=tvb_length_remaining(tvb, offset); + return offset; + } + + + if(msgtype==NDMP_MESSAGE_REQUEST){ + offset=ndmp_commands[i].request(tvb, offset, pinfo, tree); + } else { + offset=ndmp_commands[i].response(tvb, offset, pinfo, tree); + } + + return offset; +} + +static void +dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + int offset = 0; + guint32 size, available_bytes; + + /* loop through the packet, dissecting multiple NDMP pdus*/ + do { + available_bytes = tvb_length_remaining(tvb, offset); + + /* size of this NDMP PDU */ + size = tvb_get_ntohl(tvb, offset); + + /* desegmentation */ + if(ndmp_desegment){ + if(pinfo->can_desegment + && size>available_bytes) { + pinfo->desegment_offset = offset; + pinfo->desegment_len = size-available_bytes; + return; + } + } + + /* the size of the current PDU */ + proto_tree_add_item(tree, hf_ndmp_size, tvb, offset, 4, size); + offset += 4; + + offset = dissect_ndmp_cmd(tvb, offset, pinfo, tree); + } while(offset<(int)tvb_reported_length(tvb)); + +} + + + + +void +proto_register_ndmp(void) +{ + + static hf_register_info hf_ndmp[] = { + { &hf_ndmp_size, { + "Size", "ndmp.size", FT_UINT32, BASE_DEC, + NULL, 0, "Size of this NDMP PDU", HFILL }}, + + { &hf_ndmp_header, { + "NDMP Header", "ndmp.header", FT_NONE, 0, + NULL, 0, "NDMP Header", HFILL }}, + + { &hf_ndmp_sequence, { + "Sequence", "ndmp.sequence", FT_UINT32, BASE_DEC, + NULL, 0, "Sequence number for NDMP PDU", HFILL }}, + + { &hf_ndmp_reply_sequence, { + "Reply Sequence", "ndmp.reply_sequence", FT_UINT32, BASE_DEC, + NULL, 0, "Reply Sequence number for NDMP PDU", HFILL }}, + + { &hf_ndmp_timestamp, { + "Time", "ndmp.timestamp", FT_ABSOLUTE_TIME, BASE_NONE, + NULL, 0, "Timestamp for this NDMP PDU", HFILL }}, + + { &hf_ndmp_msgtype, { + "Type", "ndmp.msg_type", FT_UINT32, BASE_DEC, + VALS(msg_type_vals), 0, "Is this a Request or Response?", HFILL }}, + + { &hf_ndmp_msg, { + "Message", "ndmp.msg", FT_UINT32, BASE_DEC, + VALS(msg_vals), 0, "Type of NDMP PDU", HFILL }}, + + { &hf_ndmp_error, { + "Error", "ndmp.error", FT_UINT32, BASE_DEC, + VALS(error_vals), 0, "Error code for this NDMP PDU", HFILL }}, + + { &hf_ndmp_version, { + "Version", "ndmp.version", FT_UINT32, BASE_DEC, + NULL, 0, "Version of NDMP protocol", HFILL }}, + + + }; + + static gint *ett[] = { + &ett_ndmp, + &ett_ndmp_header, + }; + + module_t *ndmp_module; + + proto_ndmp = proto_register_protocol("Network Data Management Protocol", "NDMP", "ndmp"); + proto_register_field_array(proto_ndmp, hf_ndmp, array_length(hf_ndmp)); + + proto_register_subtree_array(ett, array_length(ett)); + + /* desegmentation */ + ndmp_module = prefs_register_protocol(proto_ndmp, NULL); + prefs_register_bool_preference(ndmp_module, "ndmp.desegment", "Desegment all NDMP messages spanning multiple TCP segments", "Whether the dissector should desegment NDMP over TCP PDUs or not", &ndmp_desegment); + +} + +void +proto_reg_handoff_ndmp(void) +{ + dissector_handle_t ndmp_handle; + + ndmp_handle = create_dissector_handle(dissect_ndmp, proto_ndmp); + dissector_add("tcp.port",TCP_PORT_NDMP, ndmp_handle); +} diff --git a/packet-nisplus.c b/packet-nisplus.c index 52fd14fd34..ba1cc75f12 100644 --- a/packet-nisplus.c +++ b/packet-nisplus.c @@ -1,7 +1,7 @@ /* packet-nisplus.c - * 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> + * 2001 Ronnie Sahlberg <See AUTHORS for email> * - * $Id: packet-nisplus.c,v 1.8 2001/09/14 07:10:05 guy Exp $ + * $Id: packet-nisplus.c,v 1.9 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-nisplus.h b/packet-nisplus.h index 984231f44d..01f4c8d26a 100644 --- a/packet-nisplus.h +++ b/packet-nisplus.h @@ -1,7 +1,7 @@ /* packet-nisplus.h - * 2001 Ronnie Sahlberg <rsahelber@bigpond.net.au> + * 2001 Ronnie Sahlberg <See AUTHORS for email> * - * $Id: packet-nisplus.h,v 1.2 2001/06/12 06:31:14 guy Exp $ + * $Id: packet-nisplus.h,v 1.3 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-nlm.c b/packet-nlm.c index 14a9d5e9f1..3db7663cbd 100644 --- a/packet-nlm.c +++ b/packet-nlm.c @@ -1,7 +1,7 @@ /* packet-nlm.c * Routines for nlm dissection * - * $Id: packet-nlm.c,v 1.21 2001/10/29 21:13:08 guy Exp $ + * $Id: packet-nlm.c,v 1.22 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -9,7 +9,7 @@ * * Copied from packet-mount.c * - * 2001-JAN Ronnie Sahlberg <rsahlber@bigpond.net.au> + * 2001-JAN Ronnie Sahlberg <See AUTHORS for email> * Updates to version 1 of the protocol. * Added version 3 of the protocol. * Added version 4 of the protocol. diff --git a/packet-spray.c b/packet-spray.c index dc1a1f53c3..17c7cef9b2 100644 --- a/packet-spray.c +++ b/packet-spray.c @@ -1,7 +1,7 @@ /* packet-spray.c - * 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> + * 2001 Ronnie Sahlberg <See AUTHORS for email> * - * $Id: packet-spray.c,v 1.5 2001/06/18 02:17:53 guy Exp $ + * $Id: packet-spray.c,v 1.6 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-spray.h b/packet-spray.h index cf5b634c89..2cae17a7c6 100644 --- a/packet-spray.h +++ b/packet-spray.h @@ -1,7 +1,7 @@ /* packet-spray.h - * 2001 Ronnie Sahlberg <rsahelber@bigpond.net.au> + * 2001 Ronnie Sahlberg <See AUTHORS for email> * - * $Id: packet-spray.h,v 1.2 2001/06/12 06:31:14 guy Exp $ + * $Id: packet-spray.h,v 1.3 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-stat-notify.c b/packet-stat-notify.c index 24f2b34902..a177713971 100644 --- a/packet-stat-notify.c +++ b/packet-stat-notify.c @@ -1,8 +1,8 @@ /* packet-stat.c * Routines for async NSM stat callback dissection - * 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> + * 2001 Ronnie Sahlberg <See AUTHORS for email> * - * $Id: packet-stat-notify.c,v 1.7 2001/09/13 08:14:45 guy Exp $ + * $Id: packet-stat-notify.c,v 1.8 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-stat-notify.h b/packet-stat-notify.h index 84a8a07fb8..b11178189f 100644 --- a/packet-stat-notify.h +++ b/packet-stat-notify.h @@ -1,8 +1,8 @@ /* packet-stat-notify.h * Async callback to notify NSM servers of changes in client status - * 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> + * 2001 Ronnie Sahlberg <See AUTHORS for email> * - * $Id: packet-stat-notify.h,v 1.2 2001/06/12 06:31:14 guy Exp $ + * $Id: packet-stat-notify.h,v 1.3 2001/12/23 21:36:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> diff --git a/packet-stat.c b/packet-stat.c index 6a019ea002..0cc1dd5197 100644 --- a/packet-stat.c +++ b/packet-stat.c @@ -1,7 +1,7 @@ /* packet-stat.c * Routines for stat dissection * - * $Id: packet-stat.c,v 1.10 2001/06/18 02:17:53 guy Exp $ + * $Id: packet-stat.c,v 1.11 2001/12/23 21:36:58 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -9,7 +9,7 @@ * * Copied from packet-smb.c * - * 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> + * 2001 Ronnie Sahlberg <See AUTHORS for email> * Added the dissectors for STAT protocol * * This program is free software; you can redistribute it and/or diff --git a/packet-ypserv.c b/packet-ypserv.c index a56214237b..5dd4770b18 100644 --- a/packet-ypserv.c +++ b/packet-ypserv.c @@ -1,7 +1,7 @@ /* packet-ypserv.c * Routines for ypserv dissection * - * $Id: packet-ypserv.c,v 1.17 2001/06/18 02:17:58 guy Exp $ + * $Id: packet-ypserv.c,v 1.18 2001/12/23 21:36:58 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -9,7 +9,7 @@ * * Copied from packet-smb.c * - * 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> + * 2001 Ronnie Sahlberg <See AUTHORS for email> * Added all remaining dissectors for this protocol * * This program is free software; you can redistribute it and/or |