3 * Traakan, Inc., Los Altos, CA
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice unmodified, this list of conditions, and the following
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * NDMPv0, represented here, is a ficticious version
35 * used to negotiate NDMP protocol version for the
36 * remainder of the session. Early, as a connection is
37 * being set up, the version of the protocol is unknown.
38 * The first messages exchanged negotiate the protocol
39 * version, and such messages are in the NDMP format.
40 * This is different than other protocols, such as ONC RPC
41 * which negotiate version by lower layers before the
42 * objective protocol becomes involved. During the
43 * negotiation, we deem the connection to be in "v0" mode.
44 * This NDMPv0 protocol specification is the subset of
45 * the NDMP protocol(s) required for the negotiation,
46 * and necessarily must remain immutable for all time.
51 * Copyright (c) 1997 Network Appliance. All Rights Reserved.
53 * Network Appliance makes no representations concerning either
54 * the merchantability of this software or the suitability of this
55 * software for any particular purpose. It is provided "as is"
56 * without express or implied warranty of any kind.
58 * These notices must be retained in any copies of any part of this
59 * documentation and/or software.
63 const NDMPPORT = 10000;
67 NDMP0_NO_ERR, /* No error */
68 NDMP0_NOT_SUPPORTED_ERR, /* Call is not supported */
69 NDMP0_DEVICE_BUSY_ERR, /* The device is in use */
70 NDMP0_DEVICE_OPENED_ERR, /* Another tape or scsi device
72 NDMP0_NOT_AUTHORIZED_ERR, /* connection has not been authorized*/
73 NDMP0_PERMISSION_ERR, /* some sort of permission problem */
74 NDMP0_DEV_NOT_OPEN_ERR, /* SCSI device is not open */
75 NDMP0_IO_ERR, /* I/O error */
76 NDMP0_TIMEOUT_ERR, /* command timed out */
77 NDMP0_ILLEGAL_ARGS_ERR, /* illegal arguments in request */
78 NDMP0_NO_TAPE_LOADED_ERR, /* Cannot open because there is
80 NDMP0_WRITE_PROTECT_ERR, /* tape cannot be open for write */
81 NDMP0_EOF_ERR, /* Command encountered EOF */
82 NDMP0_EOM_ERR, /* Command encountered EOM */
83 NDMP0_FILE_NOT_FOUND_ERR, /* File not found during restore */
84 NDMP0_BAD_FILE_ERR, /* The file descriptor is invalid */
85 NDMP0_NO_DEVICE_ERR, /* The device is not at that target */
86 NDMP0_NO_BUS_ERR, /* Invalid controller */
87 NDMP0_XDR_DECODE_ERR, /* Can't decode the request argument */
88 NDMP0_ILLEGAL_STATE_ERR, /* Call can't be done at this state */
89 NDMP0_UNDEFINED_ERR, /* Undefined Error */
90 NDMP0_XDR_ENCODE_ERR, /* Can't encode the reply argument */
91 NDMP0_NO_MEM_ERR /* no memory */
94 enum ndmp0_header_message_type
96 NDMP0_MESSAGE_REQUEST,
102 NDMP0_CONNECT_OPEN = 0x900, /* CONNECT INTERFACE */
103 NDMP0_CONNECT_CLOSE = 0x902,
105 NDMP0_NOTIFY_CONNECTED = 0x502
110 u_long sequence; /* monotonically increasing */
111 u_long time_stamp; /* time stamp of message */
112 ndmp0_header_message_type message_type; /* what type of message */
113 ndmp0_message message; /* message number */
114 u_long reply_sequence; /* reply is in response to */
115 ndmp0_error error; /* communications errors */
118 /**********************/
119 /* CONNECT INTERFACE */
120 /**********************/
121 /* NDMP0_CONNECT_OPEN */
122 struct ndmp0_connect_open_request
124 u_short protocol_version; /* the version of protocol supported */
127 struct ndmp0_connect_open_reply
132 /* NDMP0_CONNECT_CLOSE */
133 /* no request arguments */
134 /* no reply arguments */
136 /****************************/
137 /* NOTIFY INTERFACE */
138 /****************************/
140 /* NDMP0_NOTIFY_CONNECTED */
141 enum ndmp0_connect_reason
143 NDMP0_CONNECTED, /* Connect sucessfully */
144 NDMP0_SHUTDOWN, /* Connection shutdown */
145 NDMP0_REFUSED /* reach the maximum number of connections */
148 struct ndmp0_notify_connected_request
150 ndmp0_connect_reason reason;
151 u_short protocol_version;
152 string text_reason<>;