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