1 /*
2  * Copyright (c) 2000
3  *      Traakan, Inc., Los Altos, CA
4  *      All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice unmodified, this list of conditions, and the following
11  *    disclaimer.
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.
15  *
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
26  * SUCH DAMAGE.
27  */
28 
29 /*
30  * Project:  NDMJOB
31  * Ident:    $Id: $
32  *
33  * Description:
34  *
35  */
36 
37 
38 
39 /*
40  * ndmp3.x
41  *
42  * Description   : NDMP protocol rpcgen file.
43  *
44  * Copyright (c) 1999 Intelliguard Software, Network Appliance.
45  * All Rights Reserved.
46  *
47  * $Id: ndmp.x,v 1.11 1998/05/26 03:52:12 tim Exp $
48  */
49 
50 %#if __clang__
51 %#pragma clang diagnostic ignored "-Wunused-variable"
52 %#pragma clang diagnostic ignored "-Wunused-const-variable"
53 %#elif __GNUC__
54 %#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
55 %#pragma GCC diagnostic ignored "-Wunused-variable"
56 %#endif
57 %#endif
58 
59 %#ifndef NDMOS_OPTION_NO_NDMP3
60 
61 const NDMP3VER = 3;
62 const NDMP3PORT = 10000;
63 
64 %#define ndmp3_u_quad uint64_t
65 %extern bool_t xdr_ndmp3_u_quad(register XDR *xdrs, ndmp3_u_quad *objp);
66 
67 struct _ndmp3_u_quad
68 {
69         uint32_t        high;
70         uint32_t        low;
71 };
72 
73 struct ndmp3_pval
74 {
75         string          name<>;
76         string          value<>;
77 };
78 
79 enum ndmp3_error
80 {
81         NDMP3_NO_ERR,                   /* No error */
82         NDMP3_NOT_SUPPORTED_ERR,        /* Call is not supported */
83         NDMP3_DEVICE_BUSY_ERR,          /* The device is in use */
84         NDMP3_DEVICE_OPENED_ERR,        /* Another tape or scsi device
85                                          * is already open */
86         NDMP3_NOT_AUTHORIZED_ERR,       /* connection has not been authorized*/
87         NDMP3_PERMISSION_ERR,           /* some sort of permission problem */
88         NDMP3_DEV_NOT_OPEN_ERR,         /* SCSI device is not open */
89         NDMP3_IO_ERR,                   /* I/O error */
90         NDMP3_TIMEOUT_ERR,              /* command timed out */
91         NDMP3_ILLEGAL_ARGS_ERR,         /* illegal arguments in request */
92         NDMP3_NO_TAPE_LOADED_ERR,       /* Cannot open because there is
93                                          * no tape loaded */
94         NDMP3_WRITE_PROTECT_ERR,        /* tape cannot be open for write */
95         NDMP3_EOF_ERR,                  /* Command encountered EOF */
96         NDMP3_EOM_ERR,                  /* Command encountered EOM */
97         NDMP3_FILE_NOT_FOUND_ERR,       /* File not found during restore */
98         NDMP3_BAD_FILE_ERR,             /* The file descriptor is invalid */
99         NDMP3_NO_DEVICE_ERR,            /* The device is not at that target */
100         NDMP3_NO_BUS_ERR,               /* Invalid controller */
101         NDMP3_XDR_DECODE_ERR,           /* Can't decode the request argument */
102         NDMP3_ILLEGAL_STATE_ERR,        /* Call can't be done at this state */
103         NDMP3_UNDEFINED_ERR,            /* Undefined Error */
104         NDMP3_XDR_ENCODE_ERR,           /* Can't encode the reply argument */
105         NDMP3_NO_MEM_ERR,               /* no memory */
106         NDMP3_CONNECT_ERR               /* Error connecting to another
107                                          * NDMP server */
108 };
109 
110 enum ndmp3_header_message_type
111 {
112         NDMP3_MESSAGE_REQUEST,
113         NDMP3_MESSAGE_REPLY
114 };
115 
116 enum ndmp3_message
117 {
118         NDMP3_CONNECT_OPEN = 0x900,     /* CONNECT INTERFACE */
119         NDMP3_CONNECT_CLIENT_AUTH = 0x901,
120         NDMP3_CONNECT_CLOSE = 0x902,
121         NDMP3_CONNECT_SERVER_AUTH = 0x903,
122 
123         NDMP3_CONFIG_GET_HOST_INFO = 0x100, /* CONFIG INTERFACE */
124         NDMP3_CONFIG_GET_CONNECTION_TYPE = 0x102, /* NDMP2_CONFIG_GET_MOVER_TYPE on v2*/
125         NDMP3_CONFIG_GET_AUTH_ATTR = 0x103,
126         NDMP3_CONFIG_GET_BUTYPE_INFO = 0x104,   /* new from v3 */
127         NDMP3_CONFIG_GET_FS_INFO = 0x105,       /* new from v3 */
128         NDMP3_CONFIG_GET_TAPE_INFO = 0x106,     /* new from v3 */
129         NDMP3_CONFIG_GET_SCSI_INFO = 0x107,     /* new from v3 */
130         NDMP3_CONFIG_GET_SERVER_INFO =0x108,    /* new from v3 */
131 
132         NDMP3_SCSI_OPEN = 0x200,        /* SCSI INTERFACE */
133         NDMP3_SCSI_CLOSE = 0x201,
134         NDMP3_SCSI_GET_STATE = 0x202,
135         NDMP3_SCSI_SET_TARGET = 0x203,
136         NDMP3_SCSI_RESET_DEVICE = 0x204,
137         NDMP3_SCSI_RESET_BUS = 0x205,
138         NDMP3_SCSI_EXECUTE_CDB = 0x206,
139 
140         NDMP3_TAPE_OPEN = 0x300,        /* TAPE INTERFACE */
141         NDMP3_TAPE_CLOSE = 0x301,
142         NDMP3_TAPE_GET_STATE = 0x302,
143         NDMP3_TAPE_MTIO = 0x303,
144         NDMP3_TAPE_WRITE = 0x304,
145         NDMP3_TAPE_READ = 0x305,
146         NDMP3_TAPE_EXECUTE_CDB = 0x307,
147 
148         NDMP3_DATA_GET_STATE = 0x400,   /* DATA INTERFACE */
149         NDMP3_DATA_START_BACKUP = 0x401,
150         NDMP3_DATA_START_RECOVER = 0x402,
151         NDMP3_DATA_ABORT = 0x403,
152         NDMP3_DATA_GET_ENV = 0x404,
153         NDMP3_DATA_STOP = 0x407,
154         NDMP3_DATA_LISTEN = 0x409,      /* new from V3 */
155         NDMP3_DATA_CONNECT = 0x40a,     /* new from V3 */
156         NDMP3_DATA_START_RECOVER_FILEHIST = 0x40b, /* same as V3.1 */
157 
158         NDMP3_NOTIFY_DATA_HALTED =0x501,/* NOTIFY INTERFACE */
159         NDMP3_NOTIFY_CONNECTED = 0x502,
160         NDMP3_NOTIFY_MOVER_HALTED = 0x503,
161         NDMP3_NOTIFY_MOVER_PAUSED = 0x504,
162         NDMP3_NOTIFY_DATA_READ =0x505,
163 
164         NDMP3_LOG_FILE = 0x602,         /* LOGGING INTERFACE */
165         NDMP3_LOG_MESSAGE = 0x603,      /* new from v3 */
166 
167         NDMP3_FH_ADD_FILE = 0x703,      /* FILE HISTORY INTERFACE */
168         NDMP3_FH_ADD_DIR = 0x704,
169         NDMP3_FH_ADD_NODE = 0x705,
170 
171         NDMP3_MOVER_GET_STATE = 0xa00,  /* MOVER INTERFACE */
172         NDMP3_MOVER_LISTEN = 0xa01,
173         NDMP3_MOVER_CONTINUE = 0xa02,
174         NDMP3_MOVER_ABORT = 0xa03,
175         NDMP3_MOVER_STOP = 0xa04,
176         NDMP3_MOVER_SET_WINDOW = 0xa05,
177         NDMP3_MOVER_READ = 0xa06,
178         NDMP3_MOVER_CLOSE =0xa07,
179         NDMP3_MOVER_SET_RECORD_SIZE =0xa08,
180         NDMP3_MOVER_CONNECT =0xa09,     /* new from V3 */
181 
182 
183         NDMP3_VENDORS_BASE = 0xf000,    /* Reserved for the vendor
184                                          * specific usage
185                                          * from 0xf000 to 0xfeff */
186 
187         NDMP3_RESERVED_BASE = 0xff00    /* Reserved for prototyping
188                                          * from 0xff00 to 0xffff */
189 };
190 
191 struct ndmp3_header
192 {
193         uint32_t                sequence;       /* monotonically increasing */
194         uint32_t                time_stamp;     /* time stamp of message */
195         ndmp3_header_message_type message_type; /* what type of message */
196         ndmp3_message           message;        /* message number */
197         uint32_t                reply_sequence; /* reply is in response to */
198         ndmp3_error             error;          /* communications errors */
199 };
200 
201 /**********************/
202 /*  CONNECT INTERFACE */
203 /**********************/
204 
205 /* NDMP3_CONNECT_OPEN */
206 struct ndmp3_connect_open_request
207 {
208         uint16_t        protocol_version;       /* the version of protocol supported */
209 };
210 
211 struct ndmp3_connect_open_reply
212 {
213         ndmp3_error     error;
214 };
215 
216 /* NDMP3_CONNECT_CLIENT_AUTH */
217 enum ndmp3_auth_type
218 {
219         NDMP3_AUTH_NONE,                /* no password is required */
220         NDMP3_AUTH_TEXT,                /* the clear text password */
221         NDMP3_AUTH_MD5                  /* md5 */
222 };
223 
224 struct ndmp3_auth_text
225 {
226         string          auth_id<>;
227         string          auth_password<>;
228 
229 };
230 
231 struct ndmp3_auth_md5
232 {
233         string          auth_id<>;
234         opaque          auth_digest[16];
235 };
236 
237 union ndmp3_auth_data switch (enum ndmp3_auth_type auth_type)
238 {
239     case NDMP3_AUTH_NONE:
240         void;
241     case NDMP3_AUTH_TEXT:
242         struct ndmp3_auth_text  auth_text;
243     case NDMP3_AUTH_MD5:
244         struct ndmp3_auth_md5   auth_md5;
245 };
246 
247 struct ndmp3_connect_client_auth_request
248 {
249         ndmp3_auth_data auth_data;
250 };
251 
252 struct ndmp3_connect_client_auth_reply
253 {
254         ndmp3_error     error;
255 };
256 
257 
258 /* NDMP3_CONNECT_CLOSE */
259 /* no request arguments */
260 /* no reply arguments */
261 
262 /* NDMP3_CONNECT_SERVER_AUTH */
263 union ndmp3_auth_attr switch (enum ndmp3_auth_type auth_type)
264 {
265     case NDMP3_AUTH_NONE:
266         void;
267     case NDMP3_AUTH_TEXT:
268         void;
269     case NDMP3_AUTH_MD5:
270         opaque  challenge[64];
271 };
272 
273 struct ndmp3_connect_server_auth_request
274 {
275         ndmp3_auth_attr client_attr;
276 };
277 
278 struct ndmp3_connect_server_auth_reply
279 {
280         ndmp3_error             error;
281         ndmp3_auth_data server_result;
282 };
283 
284 
285 /********************/
286 /* CONFIG INTERFACE */
287 /********************/
288 
289 /* NDMP3_CONFIG_GET_HOST_INFO */
290 /* no request arguments */
291 struct ndmp3_config_get_host_info_reply
292 {
293         ndmp3_error     error;
294         string          hostname<>;     /* host name */
295         string          os_type<>;      /* The O/S type (e.g. SOLARIS) */
296         string          os_vers<>;      /* The O/S version (e.g. 2.5) */
297         string          hostid<>;
298 };
299 
300 enum ndmp3_addr_type
301 {
302         NDMP3_ADDR_LOCAL,
303         NDMP3_ADDR_TCP,
304         NDMP3_ADDR_FC,
305         NDMP3_ADDR_IPC
306 };
307 
308 /* NDMP3_CONFIG_GET_CONNECTION_TYPE */
309 /* no request arguments */
310 struct ndmp3_config_get_connection_type_reply
311 {
312         ndmp3_error     error;
313         ndmp3_addr_type addr_types<>;
314 };
315 
316 /* NDMP3_CONFIG_GET_AUTH_ATTR */
317 struct ndmp3_config_get_auth_attr_request
318 {
319         ndmp3_auth_type auth_type;
320 };
321 
322 struct ndmp3_config_get_auth_attr_reply
323 {
324         ndmp3_error     error;
325         ndmp3_auth_attr server_attr;
326 };
327 
328 /* NDMP3_CONFIG_GET_SERVER_INFO */
329 /* no requset arguments */
330 struct ndmp3_config_get_server_info_reply
331 {
332         ndmp3_error     error;
333         string          vendor_name<>;
334         string          product_name<>;
335         string          revision_number<>;
336         ndmp3_auth_type auth_type<>;
337 };
338 
339 /* backup type attributes */
340 const NDMP3_BUTYPE_BACKUP_FILE_HISTORY  = 0x0001;
341 const NDMP3_BUTYPE_BACKUP_FILELIST      = 0x0002;
342 const NDMP3_BUTYPE_RECOVER_FILELIST     = 0x0004;
343 const NDMP3_BUTYPE_BACKUP_DIRECT        = 0x0008;
344 const NDMP3_BUTYPE_RECOVER_DIRECT       = 0x0010;
345 const NDMP3_BUTYPE_BACKUP_INCREMENTAL   = 0x0020;
346 const NDMP3_BUTYPE_RECOVER_INCREMENTAL  = 0x0040;
347 const NDMP3_BUTYPE_BACKUP_UTF8          = 0x0080;
348 const NDMP3_BUTYPE_RECOVER_UTF8         = 0x0100;
349 const NDMP3_BUTYPE_RECOVER_FILE_HISTORY = 0x0200;
350 
351 struct ndmp3_butype_info
352 {
353         string          butype_name<>;
354         ndmp3_pval      default_env<>;
355         uint32_t        attrs;
356 };
357 
358 /* NDMP3_CONFIG_GET_BUTYPE_INFO */
359 /* no request arguments */
360 struct ndmp3_config_get_butype_info_reply
361 {
362         ndmp3_error     error;
363         ndmp3_butype_info butype_info<>;
364 };
365 
366 /* invalid bit */
367 const   NDMP3_FS_INFO_TOTAL_SIZE_INVALID        = 0x00000001;
368 const   NDMP3_FS_INFO_USED_SIZE_INVALID         = 0x00000002;
369 const   NDMP3_FS_INFO_AVAIL_SIZE_INVALID        = 0x00000004;
370 const   NDMP3_FS_INFO_TOTAL_INODES_INVALID      = 0x00000008;
371 const   NDMP3_FS_INFO_USED_INODES_INVALID       = 0x00000010;
372 
373 struct ndmp3_fs_info
374 {
375         uint32_t        invalid;
376         string          fs_type<>;
377         string          fs_logical_device<>;
378         string          fs_physical_device<>;
379         ndmp3_u_quad    total_size;
380         ndmp3_u_quad    used_size;
381         ndmp3_u_quad    avail_size;
382         ndmp3_u_quad    total_inodes;
383         ndmp3_u_quad    used_inodes;
384         ndmp3_pval      fs_env<>;
385         string          fs_status<>;
386 };
387 
388 /* NDMP3_CONFIG_GET_FS_INFO */
389 /* no request arguments */
390 struct ndmp3_config_get_fs_info_reply
391 {
392         ndmp3_error     error;
393         ndmp3_fs_info   fs_info<>;
394 };
395 
396 /* NDMP3_CONFIG_GET_TAPE_INFO */
397 /* no request arguments */
398 /* tape attributes */
399 const NDMP3_TAPE_ATTR_REWIND    = 0x00000001;
400 const NDMP3_TAPE_ATTR_UNLOAD    = 0x00000002;
401 
402 struct ndmp3_device_capability
403 {
404         string          device<>;
405         uint32_t        attr;
406         ndmp3_pval      capability<>;
407 };
408 
409 struct ndmp3_device_info
410 {
411         string                  model<>;
412         ndmp3_device_capability caplist<>;
413 
414 };
415 struct ndmp3_config_get_tape_info_reply
416 {
417         ndmp3_error             error;
418         ndmp3_device_info       tape_info<>;
419 
420 };
421 
422 /* NDMP3_CONFIG_GET_SCSI_INFO */
423 /* jukebox attributes */
424 struct ndmp3_config_get_scsi_info_reply
425 {
426         ndmp3_error             error;
427         ndmp3_device_info       scsi_info<>;
428 };
429 
430 /******************/
431 /* SCSI INTERFACE */
432 /******************/
433 
434 /* NDMP3_SCSI_OPEN */
435 struct ndmp3_scsi_open_request
436 {
437         string          device<>;
438 };
439 
440 struct ndmp3_scsi_open_reply
441 {
442         ndmp3_error     error;
443 };
444 
445 /* NDMP3_SCSI_CLOSE */
446 /* no request arguments */
447 struct ndmp3_scsi_close_reply
448 {
449         ndmp3_error     error;
450 };
451 
452 /* NDMP3_SCSI_GET_STATE */
453 /* no request arguments */
454 struct ndmp3_scsi_get_state_reply
455 {
456         ndmp3_error     error;
457         short           target_controller;
458         short           target_id;
459         short           target_lun;
460 };
461 
462 /* NDMP3_SCSI_SET_TARGET */
463 struct ndmp3_scsi_set_target_request
464 {
465         string          device<>;
466         uint16_t        target_controller;
467         uint16_t        target_id;
468         uint16_t        target_lun;
469 };
470 
471 struct ndmp3_scsi_set_target_reply
472 {
473         ndmp3_error     error;
474 };
475 
476 /* NDMP3_SCSI_RESET_DEVICE */
477 /* no request arguments */
478 struct ndmp3_scsi_reset_device_reply
479 {
480         ndmp3_error     error;
481 };
482 
483 /* NDMP3_SCSI_RESET_BUS */
484 /* no request arguments */
485 struct ndmp3_scsi_reset_bus_reply
486 {
487         ndmp3_error     error;
488 };
489 
490 /* NDMP3_SCSI_EXECUTE_CDB */
491 const NDMP3_SCSI_DATA_IN  = 0x00000001; /* Expect data from SCSI device */
492 const NDMP3_SCSI_DATA_OUT = 0x00000002; /* Transfer data to SCSI device */
493 
494 struct ndmp3_execute_cdb_request
495 {
496         uint32_t        flags;
497         uint32_t        timeout;
498         uint32_t        datain_len;     /* Set for expected datain */
499         opaque          cdb<>;
500         opaque          dataout<>;
501 };
502 
503 struct ndmp3_execute_cdb_reply
504 {
505         ndmp3_error     error;
506         u_char          status;         /* SCSI status bytes */
507         uint32_t        dataout_len;
508         opaque          datain<>;       /* SCSI datain */
509         opaque          ext_sense<>;    /* Extended sense data */
510 };
511 typedef ndmp3_execute_cdb_request       ndmp3_scsi_execute_cdb_request;
512 typedef ndmp3_execute_cdb_reply         ndmp3_scsi_execute_cdb_reply;
513 
514 /******************/
515 /* TAPE INTERFACE */
516 /******************/
517 /* NDMP3_TAPE_OPEN */
518 enum ndmp3_tape_open_mode
519 {
520         NDMP3_TAPE_READ_MODE,
521         NDMP3_TAPE_RDWR_MODE
522 };
523 
524 struct ndmp3_tape_open_request
525 {
526         string                  device<>;
527         ndmp3_tape_open_mode    mode;
528 };
529 
530 struct ndmp3_tape_open_reply
531 {
532         ndmp3_error     error;
533 };
534 
535 /* NDMP3_TAPE_CLOSE */
536 /* no request arguments */
537 struct ndmp3_tape_close_reply
538 {
539         ndmp3_error     error;
540 };
541 
542 /*NDMP3_TAPE_GET_STATE */
543 /* no request arguments */
544 const NDMP3_TAPE_STATE_NOREWIND = 0x0008;       /* non-rewind device */
545 const NDMP3_TAPE_STATE_WR_PROT  = 0x0010;       /* write-protected */
546 const NDMP3_TAPE_STATE_ERROR    = 0x0020;       /* media error */
547 const NDMP3_TAPE_STATE_UNLOAD   = 0x0040;       /* tape will be unloaded when
548                                                  * the device is closed */
549 
550 /* invalid bit */
551 const NDMP3_TAPE_STATE_FILE_NUM_INVALID         = 0x00000001;
552 const NDMP3_TAPE_STATE_SOFT_ERRORS_INVALID      = 0x00000002;
553 const NDMP3_TAPE_STATE_BLOCK_SIZE_INVALID       = 0x00000004;
554 const NDMP3_TAPE_STATE_BLOCKNO_INVALID          = 0x00000008;
555 const NDMP3_TAPE_STATE_TOTAL_SPACE_INVALID      = 0x00000010;
556 const NDMP3_TAPE_STATE_SPACE_REMAIN_INVALID     = 0x00000020;
557 const NDMP3_TAPE_STATE_PARTITION_INVALID        = 0x00000040;
558 
559 struct ndmp3_tape_get_state_reply
560 {
561         uint32_t        invalid;
562         ndmp3_error     error;
563         uint32_t        flags;
564         uint32_t        file_num;
565         uint32_t        soft_errors;
566         uint32_t        block_size;
567         uint32_t        blockno;
568         ndmp3_u_quad    total_space;
569         ndmp3_u_quad    space_remain;
570         uint32_t        partition;
571 };
572 
573 /* NDMP3_TAPE_MTIO */
574 enum ndmp3_tape_mtio_op
575 {
576         NDMP3_MTIO_FSF,
577         NDMP3_MTIO_BSF,
578         NDMP3_MTIO_FSR,
579         NDMP3_MTIO_BSR,
580         NDMP3_MTIO_REW,
581         NDMP3_MTIO_EOF,
582         NDMP3_MTIO_OFF
583 };
584 
585 struct ndmp3_tape_mtio_request
586 {
587         ndmp3_tape_mtio_op      tape_op;
588         uint32_t                count;
589 };
590 
591 struct ndmp3_tape_mtio_reply
592 {
593         ndmp3_error     error;
594         uint32_t        resid_count;
595 };
596 
597 /* NDMP3_TAPE_WRITE */
598 struct ndmp3_tape_write_request
599 {
600         opaque          data_out<>;
601 };
602 
603 struct ndmp3_tape_write_reply
604 {
605         ndmp3_error     error;
606         uint32_t        count;
607 };
608 
609 /* NDMP3_TAPE_READ */
610 struct ndmp3_tape_read_request
611 {
612         uint32_t        count;
613 };
614 
615 struct ndmp3_tape_read_reply
616 {
617         ndmp3_error     error;
618         opaque          data_in<>;
619 };
620 
621 
622 /* NDMP3_TAPE_EXECUTE_CDB */
623 typedef ndmp3_execute_cdb_request       ndmp3_tape_execute_cdb_request;
624 typedef ndmp3_execute_cdb_reply         ndmp3_tape_execute_cdb_reply;
625 
626 
627 /********************************/
628 /* MOVER INTERFACE              */
629 /********************************/
630 /* NDMP3_MOVER_GET_STATE */
631 enum ndmp3_mover_state
632 {
633         NDMP3_MOVER_STATE_IDLE,
634         NDMP3_MOVER_STATE_LISTEN,
635         NDMP3_MOVER_STATE_ACTIVE,
636         NDMP3_MOVER_STATE_PAUSED,
637         NDMP3_MOVER_STATE_HALTED
638 };
639 
640 enum ndmp3_mover_pause_reason
641 {
642         NDMP3_MOVER_PAUSE_NA,
643         NDMP3_MOVER_PAUSE_EOM,
644         NDMP3_MOVER_PAUSE_EOF,
645         NDMP3_MOVER_PAUSE_SEEK,
646         NDMP3_MOVER_PAUSE_MEDIA_ERROR,
647         NDMP3_MOVER_PAUSE_EOW
648 };
649 
650 enum ndmp3_mover_halt_reason
651 {
652         NDMP3_MOVER_HALT_NA,
653         NDMP3_MOVER_HALT_CONNECT_CLOSED,
654         NDMP3_MOVER_HALT_ABORTED,
655         NDMP3_MOVER_HALT_INTERNAL_ERROR,
656         NDMP3_MOVER_HALT_CONNECT_ERROR
657 };
658 
659 /* mover address */
660 enum ndmp3_mover_mode
661 {
662         NDMP3_MOVER_MODE_READ,  /* read from data connection; write to tape */
663         NDMP3_MOVER_MODE_WRITE  /* write to data connection; read from tape */
664 };
665 
666 struct ndmp3_tcp_addr
667 {
668         uint32_t        ip_addr;
669         uint16_t        port;
670 };
671 
672 struct ndmp3_fc_addr
673 {
674         uint32_t        loop_id;
675 };
676 
677 struct ndmp3_ipc_addr
678 {
679         opaque  comm_data<>;
680 };
681 union ndmp3_addr switch (ndmp3_addr_type addr_type)
682 {
683     case NDMP3_ADDR_LOCAL:
684         void;
685     case NDMP3_ADDR_TCP:
686         ndmp3_tcp_addr  tcp_addr;
687     case NDMP3_ADDR_FC:
688         ndmp3_fc_addr   fc_addr;
689     case NDMP3_ADDR_IPC:
690         ndmp3_ipc_addr  ipc_addr;
691 
692 };
693 
694 /* no request arguments */
695 struct ndmp3_mover_get_state_reply
696 {
697         ndmp3_error             error;
698         ndmp3_mover_state       state;
699         ndmp3_mover_pause_reason pause_reason;
700         ndmp3_mover_halt_reason halt_reason;
701         uint32_t                record_size;
702         uint32_t                record_num;
703         ndmp3_u_quad            data_written;
704         ndmp3_u_quad            seek_position;
705         ndmp3_u_quad            bytes_left_to_read;
706         ndmp3_u_quad            window_offset;
707         ndmp3_u_quad            window_length;
708         ndmp3_addr              data_connection_addr;
709 };
710 
711 /* NDMP3_MOVER_LISTEN */
712 struct ndmp3_mover_listen_request
713 {
714         ndmp3_mover_mode        mode;
715         ndmp3_addr_type         addr_type;
716 };
717 
718 struct ndmp3_mover_listen_reply
719 {
720         ndmp3_error             error;
721         ndmp3_addr              data_connection_addr;
722 };
723 
724 /* NDMP3_MOVER_CONNECT */
725 struct ndmp3_mover_connect_request
726 {
727         ndmp3_mover_mode        mode;
728         ndmp3_addr              addr;
729 };
730 
731 struct ndmp3_mover_connect_reply
732 {
733         ndmp3_error     error;
734 };
735 /* NDMP3_MOVER_SET_RECORD_SIZE */
736 struct ndmp3_mover_set_record_size_request
737 {
738         uint32_t        len;
739 };
740 
741 struct ndmp3_mover_set_record_size_reply
742 {
743         ndmp3_error     error;
744 };
745 
746 /* NDMP3_MOVER_SET_WINDOW */
747 struct ndmp3_mover_set_window_request
748 {
749         ndmp3_u_quad    offset;
750         ndmp3_u_quad    length;
751 };
752 
753 struct ndmp3_mover_set_window_reply
754 {
755         ndmp3_error     error;
756 };
757 
758 /* NDMP3_MOVER_CONTINUE */
759 /* no request arguments */
760 struct ndmp3_mover_continue_reply
761 {
762         ndmp3_error     error;
763 };
764 
765 
766 /* NDMP3_MOVER_ABORT */
767 /* no request arguments */
768 struct ndmp3_mover_abort_reply
769 {
770         ndmp3_error     error;
771 };
772 
773 /* NDMP3_MOVER_STOP */
774 /* no request arguments */
775 struct ndmp3_mover_stop_reply
776 {
777         ndmp3_error     error;
778 };
779 
780 /* NDMP3_MOVER_READ */
781 struct ndmp3_mover_read_request
782 {
783         ndmp3_u_quad    offset;
784         ndmp3_u_quad    length;
785 };
786 
787 struct ndmp3_mover_read_reply
788 {
789         ndmp3_error     error;
790 };
791 
792 /* NDMP3_MOVER_CLOSE */
793 /* no request arguments */
794 struct ndmp3_mover_close_reply
795 {
796         ndmp3_error     error;
797 };
798 
799 /********************************/
800 /* DATA INTERFACE               */
801 /********************************/
802 /* NDMP3_DATA_GET_STATE */
803 /* no request arguments */
804 enum ndmp3_data_operation
805 {
806         NDMP3_DATA_OP_NOACTION,
807         NDMP3_DATA_OP_BACKUP,
808         NDMP3_DATA_OP_RESTORE,
809         NDMP3_DATA_OP_RESTORE_FILEHIST
810 };
811 
812 enum ndmp3_data_state
813 {
814         NDMP3_DATA_STATE_IDLE,
815         NDMP3_DATA_STATE_ACTIVE,
816         NDMP3_DATA_STATE_HALTED,
817         NDMP3_DATA_STATE_LISTEN,
818         NDMP3_DATA_STATE_CONNECTED
819 };
820 
821 enum ndmp3_data_halt_reason
822 {
823         NDMP3_DATA_HALT_NA,
824         NDMP3_DATA_HALT_SUCCESSFUL,
825         NDMP3_DATA_HALT_ABORTED,
826         NDMP3_DATA_HALT_INTERNAL_ERROR,
827         NDMP3_DATA_HALT_CONNECT_ERROR
828 };
829 
830 /* invalid bit */
831 const NDMP3_DATA_STATE_EST_BYTES_REMAIN_INVALID = 0x00000001;
832 const NDMP3_DATA_STATE_EST_TIME_REMAIN_INVALID  = 0x00000002;
833 
834 struct ndmp3_data_get_state_reply
835 {
836         uint32_t                invalid;
837         ndmp3_error             error;
838         ndmp3_data_operation    operation;
839         ndmp3_data_state        state;
840         ndmp3_data_halt_reason  halt_reason;
841         ndmp3_u_quad            bytes_processed;
842         ndmp3_u_quad            est_bytes_remain;
843         uint32_t                est_time_remain;
844         ndmp3_addr              data_connection_addr;
845         ndmp3_u_quad            read_offset;
846         ndmp3_u_quad            read_length;
847 };
848 
849 /* NDMP3_DATA_START_BACKUP */
850 struct ndmp3_data_start_backup_request
851 {
852         string          bu_type<>;      /* backup method to use */
853         ndmp3_pval      env<>;          /* Parameters that may modify backup */
854 };
855 
856 struct ndmp3_data_start_backup_reply
857 {
858         ndmp3_error     error;
859 };
860 
861 /* NDMP3_DATA_START_RECOVER */
862 struct ndmp3_name
863 {
864         string          original_path<>;
865         string          destination_dir<>;
866         string          new_name<>;     /* Direct access restore only */
867         string          other_name<>;   /* Direct access restore only */
868         ndmp3_u_quad    node;           /* Direct access restore only */
869         ndmp3_u_quad    fh_info;        /* Direct access restore only */
870 };
871 
872 struct ndmp3_data_start_recover_request
873 {
874         ndmp3_pval      env<>;
875         ndmp3_name      nlist<>;
876         string          bu_type<>;
877 };
878 
879 struct ndmp3_data_start_recover_reply
880 {
881         ndmp3_error     error;
882 };
883 
884 /* NDMP3_DATA_START_RECOVER_FILEHIST */
885 typedef ndmp3_data_start_recover_request ndmp3_data_start_recover_filehist_request;
886 typedef ndmp3_data_start_recover_reply ndmp3_data_start_recover_filehist_reply;
887 
888 
889 /* NDMP3_DATA_ABORT */
890 /* no request arguments */
891 struct ndmp3_data_abort_reply
892 {
893         ndmp3_error     error;
894 };
895 
896 /* NDMP3_DATA_STOP */
897 /* no request arguments */
898 struct ndmp3_data_stop_reply
899 {
900         ndmp3_error     error;
901 };
902 
903 /* NDMP3_DATA_GET_ENV */
904 /* no request arguments */
905 struct ndmp3_data_get_env_reply
906 {
907         ndmp3_error     error;
908         ndmp3_pval      env<>;
909 };
910 
911 /* NDMP3_DATA_LISTEN */
912 struct ndmp3_data_listen_request
913 {
914         ndmp3_addr_type addr_type;
915 };
916 
917 struct ndmp3_data_listen_reply
918 {
919         ndmp3_error     error;
920         ndmp3_addr      data_connection_addr;
921 };
922 
923 /* NDMP3_DATA_CONNECT */
924 struct ndmp3_data_connect_request
925 {
926         ndmp3_addr      addr;
927 };
928 struct ndmp3_data_connect_reply
929 {
930         ndmp3_error     error;
931 };
932 
933 /****************************************/
934 /* NOTIFY INTERFACE                     */
935 /****************************************/
936 /* NDMP3_NOTIFY_DATA_HALTED */
937 struct ndmp3_notify_data_halted_request
938 {
939         ndmp3_data_halt_reason  reason;
940         string                  text_reason<>;
941 };
942 
943 /* NDMP3_NOTIFY_CONNECTED */
944 enum ndmp3_connect_reason
945 {
946         NDMP3_CONNECTED,        /* Connect sucessfully */
947         NDMP3_SHUTDOWN,         /* Connection shutdown */
948         NDMP3_REFUSED           /* reach the maximum number of connections */
949 };
950 
951 struct ndmp3_notify_connected_request
952 {
953         ndmp3_connect_reason    reason;
954         uint16_t                protocol_version;
955         string                  text_reason<>;
956 };
957 
958 /* NDMP3_NOTIFY_MOVER_PAUSED */
959 struct ndmp3_notify_mover_paused_request
960 {
961         ndmp3_mover_pause_reason reason;
962         ndmp3_u_quad            seek_position;
963 };
964 /* No reply */
965 
966 /* NDMP3_NOTIFY_MOVER_HALTED */
967 struct ndmp3_notify_mover_halted_request
968 {
969         ndmp3_mover_halt_reason reason;
970         string                  text_reason<>;
971 };
972 /* No reply */
973 
974 /* NDMP3_NOTIFY_DATA_READ */
975 struct ndmp3_notify_data_read_request
976 {
977         ndmp3_u_quad    offset;
978         ndmp3_u_quad    length;
979 };
980 /* No reply */
981 
982 /********************************/
983 /* LOG INTERFACE                */
984 /********************************/
985 /* NDMP3_LOG_MESSAGE */
986 enum ndmp3_log_type
987 {
988         NDMP3_LOG_NORMAL,
989         NDMP3_LOG_DEBUG,
990         NDMP3_LOG_ERROR,
991         NDMP3_LOG_WARNING
992 };
993 
994 
995 struct ndmp3_log_message_request
996 {
997         ndmp3_log_type  log_type;
998         uint32_t        message_id;
999         string          entry<>;
1000 };
1001 /* No reply */
1002 
1003 /* NDMP3_LOG_FILE */
1004 struct ndmp3_log_file_request
1005 {
1006         string          name<>;
1007         ndmp3_error     error;
1008 };
1009 /* No reply */
1010 
1011 
1012 /*****************************/
1013 /* File History INTERFACE    */
1014 /*****************************/
1015 /* NDMP3_FH_ADD_FILE */
1016 enum ndmp3_fs_type
1017 {
1018         NDMP3_FS_UNIX,  /* UNIX */
1019         NDMP3_FS_NT,    /* NT */
1020         NDMP3_FS_OTHER
1021 };
1022 
1023 typedef string ndmp3_path<>;
1024 struct ndmp3_nt_path
1025 {
1026         ndmp3_path      nt_path;
1027         ndmp3_path      dos_path;
1028 };
1029 
1030 union ndmp3_file_name switch (ndmp3_fs_type fs_type)
1031 {
1032     case NDMP3_FS_UNIX:
1033         ndmp3_path      unix_name;
1034     case NDMP3_FS_NT:
1035         ndmp3_nt_path   nt_name;
1036     default:
1037         ndmp3_path      other_name;
1038 };
1039 
1040 enum ndmp3_file_type
1041 {
1042         NDMP3_FILE_DIR,
1043         NDMP3_FILE_FIFO,
1044         NDMP3_FILE_CSPEC,
1045         NDMP3_FILE_BSPEC,
1046         NDMP3_FILE_REG,
1047         NDMP3_FILE_SLINK,
1048         NDMP3_FILE_SOCK,
1049         NDMP3_FILE_REGISTRY,
1050         NDMP3_FILE_OTHER
1051 };
1052 
1053 /* invalid bit */
1054 const NDMP3_FILE_STAT_ATIME_INVALID     = 0x00000001;
1055 const NDMP3_FILE_STAT_CTIME_INVALID     = 0x00000002;
1056 const NDMP3_FILE_STAT_GROUP_INVALID     = 0x00000004;
1057 
1058 struct ndmp3_file_stat
1059 {
1060         uint32_t                invalid;
1061         ndmp3_fs_type           fs_type;
1062         ndmp3_file_type         ftype;
1063         uint32_t                mtime;
1064         uint32_t                atime;
1065         uint32_t                ctime;
1066         uint32_t                owner; /* uid for UNIX, owner for NT */
1067         uint32_t                group; /* gid for UNIX, NA for NT */
1068         uint32_t                fattr; /* mode for UNIX, fattr for NT */
1069         ndmp3_u_quad            size;
1070         uint32_t                links;
1071 };
1072 
1073 
1074 /* one file could have both UNIX and NT name and attributes */
1075 struct ndmp3_file
1076 {
1077         ndmp3_file_name         names<>;
1078         ndmp3_file_stat         stats<>;
1079         ndmp3_u_quad            node;   /* used for the direct access */
1080         ndmp3_u_quad            fh_info;/* used for the direct access */
1081 };
1082 
1083 struct ndmp3_fh_add_file_request
1084 {
1085         ndmp3_file              files<>;
1086 };
1087 
1088 /* No reply */
1089 /* NDMP3_FH_ADD_DIR */
1090 
1091 struct ndmp3_dir
1092 {
1093         ndmp3_file_name         names<>;
1094         ndmp3_u_quad            node;
1095         ndmp3_u_quad            parent;
1096 };
1097 
1098 struct ndmp3_fh_add_dir_request
1099 {
1100         ndmp3_dir               dirs<>;
1101 };
1102 /* No reply */
1103 
1104 /* NDMP3_FH_ADD_NODE */
1105 struct ndmp3_node
1106 {
1107         ndmp3_file_stat         stats<>;
1108         ndmp3_u_quad            node;
1109         ndmp3_u_quad            fh_info;
1110 };
1111 
1112 struct ndmp3_fh_add_node_request
1113 {
1114         ndmp3_node              nodes<>;
1115 };
1116 /* No reply */
1117 
1118 %#endif /* !NDMOS_OPTION_NO_NDMP3 */
1119