Imported Upstream version 3.1.0
[debian/amanda] / ndmp-src / ndmp4.x
1 /*
2  * Copyright (c) 2000,2001
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  * ndmp4.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_NDMP4
51
52 const NDMP4VER = 4;
53 const NDMP4PORT = 10000;
54
55 %#define ndmp4_u_quad unsigned long long
56 %extern bool_t xdr_ndmp4_u_quad();
57
58 struct _ndmp4_u_quad
59 {
60         u_long          high;
61         u_long          low;
62 };
63
64
65
66 enum ndmp4_header_message_type
67 {
68         NDMP4_MESSAGE_REQUEST,
69         NDMP4_MESSAGE_REPLY
70 };
71
72 const NDMP4_MESSAGE_POST = NDMP4_MESSAGE_REQUEST;
73
74
75 /* Note: because of extensibility, this is */
76 /* Not a complete list of errors. */
77
78 enum ndmp4_error {
79         NDMP4_NO_ERR                    = 0,
80         NDMP4_NOT_SUPPORTED_ERR         = 1,
81         NDMP4_DEVICE_BUSY_ERR           = 2,
82         NDMP4_DEVICE_OPENED_ERR         = 3,
83         NDMP4_NOT_AUTHORIZED_ERR        = 4,
84         NDMP4_PERMISSION_ERR            = 5,
85         NDMP4_DEV_NOT_OPEN_ERR          = 6,
86         NDMP4_IO_ERR                    = 7,
87         NDMP4_TIMEOUT_ERR               = 8,
88         NDMP4_ILLEGAL_ARGS_ERR          = 9,
89         NDMP4_NO_TAPE_LOADED_ERR        = 10,
90         NDMP4_WRITE_PROTECT_ERR         = 11,
91         NDMP4_EOF_ERR                   = 12,
92         NDMP4_EOM_ERR                   = 13,
93         NDMP4_FILE_NOT_FOUND_ERR        = 14,
94         NDMP4_BAD_FILE_ERR              = 15,
95         NDMP4_NO_DEVICE_ERR             = 16,
96         NDMP4_NO_BUS_ERR                = 17,
97         NDMP4_XDR_DECODE_ERR            = 18,
98         NDMP4_ILLEGAL_STATE_ERR         = 19,
99         NDMP4_UNDEFINED_ERR             = 20,
100         NDMP4_XDR_ENCODE_ERR            = 21,
101         NDMP4_NO_MEM_ERR                = 22,
102         NDMP4_CONNECT_ERR               = 23,
103         NDMP4_SEQUENCE_NUM_ERR          = 24,
104         NDMP4_READ_IN_PROGRESS_ERR      = 25,
105         NDMP4_PRECONDITION_ERR          = 26,
106         NDMP4_CLASS_NOT_SUPPORTED       = 27,
107         NDMP4_VERSION_NOT_SUPPORTED     = 28,
108         NDMP4_EXT_DUPL_CLASSES          = 29,
109         NDMP4_EXT_DN_ILLEGAL            = 30
110 };
111
112
113
114 /* Note: Because of extensibility, this */
115 /* is not a complete list of messages */
116
117 enum ndmp4_message {
118
119 /* CONNECT INTERFACE */
120         NDMP4_CONNECT_OPEN              = 0x900,
121         NDMP4_CONNECT_CLIENT_AUTH       = 0x901,
122         NDMP4_CONNECT_CLOSE             = 0x902,
123         NDMP4_CONNECT_SERVER_AUTH       = 0x903,
124
125 /* CONFIG INTERFACE */
126         NDMP4_CONFIG_GET_HOST_INFO      = 0x100,
127         NDMP4_CONFIG_GET_CONNECTION_TYPE = 0x102,
128         NDMP4_CONFIG_GET_AUTH_ATTR      = 0x103,
129         NDMP4_CONFIG_GET_BUTYPE_INFO    = 0x104,
130         NDMP4_CONFIG_GET_FS_INFO        = 0x105,
131         NDMP4_CONFIG_GET_TAPE_INFO      = 0x106,
132         NDMP4_CONFIG_GET_SCSI_INFO      = 0x107,
133         NDMP4_CONFIG_GET_SERVER_INFO    = 0x108,
134         NDMP4_CONFIG_SET_EXT_LIST       = 0x109,
135         NDMP4_CONFIG_GET_EXT_LIST       = 0x10A,
136
137 /* SCSI INTERFACE */
138         NDMP4_SCSI_OPEN                 = 0x200,
139         NDMP4_SCSI_CLOSE                = 0x201,
140         NDMP4_SCSI_GET_STATE            = 0x202,
141         NDMP4_SCSI_RESET_DEVICE         = 0x204,
142         NDMP4_SCSI_EXECUTE_CDB          = 0x206,
143
144 /* TAPE INTERFACE */
145         NDMP4_TAPE_OPEN                 = 0x300,
146         NDMP4_TAPE_CLOSE                = 0x301,
147         NDMP4_TAPE_GET_STATE            = 0x302,
148         NDMP4_TAPE_MTIO                 = 0x303,
149         NDMP4_TAPE_WRITE                = 0x304,
150         NDMP4_TAPE_READ                 = 0x305,
151         NDMP4_TAPE_EXECUTE_CDB          = 0x307,
152
153 /* DATA INTERFACE */
154         NDMP4_DATA_GET_STATE            = 0x400,
155         NDMP4_DATA_START_BACKUP         = 0x401,
156         NDMP4_DATA_START_RECOVER        = 0x402,
157         NDMP4_DATA_ABORT                = 0x403,
158         NDMP4_DATA_GET_ENV              = 0x404,
159         NDMP4_DATA_STOP                 = 0x407,
160         NDMP4_DATA_LISTEN               = 0x409,
161         NDMP4_DATA_CONNECT              = 0x40A,
162         NDMP4_DATA_START_RECOVER_FILEHIST = 0x40B,
163
164 /* NOTIFY INTERFACE */
165         NDMP4_NOTIFY_DATA_HALTED        = 0x501,
166         NDMP4_NOTIFY_CONNECTION_STATUS  = 0x502,
167         NDMP4_NOTIFY_MOVER_HALTED       = 0x503,
168         NDMP4_NOTIFY_MOVER_PAUSED       = 0x504,
169         NDMP4_NOTIFY_DATA_READ          = 0x505,
170
171 /* LOGGING INTERFACE */
172         NDMP4_LOG_FILE                  = 0x602,
173         NDMP4_LOG_MESSAGE               = 0x603,
174
175 /* FILE HISTORY INTERFACE */
176         NDMP4_FH_ADD_FILE               = 0x703,
177         NDMP4_FH_ADD_DIR                = 0x704,
178         NDMP4_FH_ADD_NODE               = 0x705,
179
180 /* MOVER INTERFACE */
181         NDMP4_MOVER_GET_STATE           = 0xA00,
182         NDMP4_MOVER_LISTEN              = 0xA01,
183         NDMP4_MOVER_CONTINUE            = 0xA02,
184         NDMP4_MOVER_ABORT               = 0xA03,
185         NDMP4_MOVER_STOP                = 0xA04,
186         NDMP4_MOVER_SET_WINDOW          = 0xA05,
187         NDMP4_MOVER_READ                = 0xA06,
188         NDMP4_MOVER_CLOSE               = 0xA07,
189         NDMP4_MOVER_SET_RECORD_SIZE     = 0xA08,
190         NDMP4_MOVER_CONNECT             = 0xA09,
191
192 /* EXTENSIBILITY */
193
194 /* Reserved for Standard extensions */
195         NDMP4_EXT_STANDARD_BASE         = 0x10000,
196
197 /* Reserved for Proprietary extensions */
198         NDMP4_EXT_PROPRIETARY_BASE      = 0x20000000
199 };
200
201
202 struct ndmp4_header
203 {
204         u_long                  sequence;
205         u_long                  time_stamp;
206         ndmp4_header_message_type message_type;
207         ndmp4_message           message_code;
208         u_long                  reply_sequence;
209         ndmp4_error             error_code;
210 };
211
212 struct ndmp4_pval
213 {
214         string          name<>;
215         string          value<>;
216 };
217
218
219 /* Connect messages */
220 struct ndmp4_connect_open_request
221 {
222         u_short         protocol_version;
223 };
224
225 struct ndmp4_connect_open_reply
226 {
227         ndmp4_error     error;
228 };
229
230
231 enum ndmp4_auth_type
232 {
233         NDMP4_AUTH_NONE=0,
234         NDMP4_AUTH_TEXT=1,
235         NDMP4_AUTH_MD5=2
236 };
237
238 struct ndmp4_auth_text
239 {
240         string          auth_id<>;
241         string          auth_password<>;
242 };
243
244 struct ndmp4_auth_md5
245 {
246         string          auth_id<>;
247         opaque          auth_digest[16];
248 };
249
250 union ndmp4_auth_data switch (enum ndmp4_auth_type auth_type)
251 {
252         case NDMP4_AUTH_NONE:
253                 void;
254         case NDMP4_AUTH_TEXT:
255                 struct ndmp4_auth_text  auth_text;
256         case NDMP4_AUTH_MD5:
257                 struct ndmp4_auth_md5   auth_md5;
258 };
259
260 union ndmp4_auth_attr switch (enum ndmp4_auth_type auth_type)
261 {
262         case NDMP4_AUTH_NONE:
263                 void;
264         case NDMP4_AUTH_TEXT:
265                 void;
266         case NDMP4_AUTH_MD5:
267                 opaque  challenge[64];
268 };
269
270
271 struct ndmp4_connect_client_auth_request
272 {
273         ndmp4_auth_data auth_data;
274 };
275
276 struct ndmp4_connect_client_auth_reply
277 {
278         ndmp4_error     error;
279 };
280
281
282 struct ndmp4_connect_server_auth_request
283 {
284         ndmp4_auth_attr client_attr;
285 };
286
287 struct ndmp4_connect_server_auth_reply
288 {
289         ndmp4_error     error;
290         ndmp4_auth_data server_result;
291 };
292
293
294 struct ndmp4_config_get_host_info_reply
295 {
296         ndmp4_error     error;
297         string          hostname<>;
298         string          os_type<>;
299         string          os_vers<>;
300         string          hostid<>;
301 };
302
303
304 struct ndmp4_config_get_server_info_reply
305 {
306         ndmp4_error     error;
307         string          vendor_name<>;
308         string          product_name<>;
309         string          revision_number<>;
310         ndmp4_auth_type auth_type<>;
311 };
312
313
314 enum ndmp4_addr_type
315 {
316         NDMP4_ADDR_LOCAL=0,
317         NDMP4_ADDR_TCP=1,
318         NDMP4_ADDR_RESERVED=2,
319         NDMP4_ADDR_IPC=3
320 };
321
322 struct ndmp4_config_get_connection_type_reply
323 {
324         ndmp4_error     error;
325         ndmp4_addr_type addr_types<>;
326 };
327
328
329 struct ndmp4_config_get_auth_attr_request
330 {
331         ndmp4_auth_type auth_type;
332 };
333
334
335
336 struct ndmp4_config_get_auth_attr_reply
337 {
338         ndmp4_error     error;
339         ndmp4_auth_attr server_attr;
340 };
341
342
343 const NDMP4_BUTYPE_BACKUP_FILELIST      = 0x0002;
344 const NDMP4_BUTYPE_RECOVER_FILELIST     = 0x0004;
345 const NDMP4_BUTYPE_BACKUP_DIRECT        = 0x0008;
346 const NDMP4_BUTYPE_RECOVER_DIRECT       = 0x0010;
347 const NDMP4_BUTYPE_BACKUP_INCREMENTAL   = 0x0020;
348 const NDMP4_BUTYPE_RECOVER_INCREMENTAL  = 0x0040;
349 const NDMP4_BUTYPE_BACKUP_UTF8          = 0x0080;
350 const NDMP4_BUTYPE_RECOVER_UTF8         = 0x0100;
351 const NDMP4_BUTYPE_BACKUP_FH_FILE       = 0x0200;
352 const NDMP4_BUTYPE_BACKUP_FH_DIR        = 0x0400;
353 const NDMP4_BUTYPE_RECOVER_FILEHIST     = 0x0800;
354 const NDMP4_BUTYPE_RECOVER_FH_FILE      = 0x1000;
355 const NDMP4_BUTYPE_RECOVER_FH_DIR       = 0x2000;
356
357
358 struct ndmp4_butype_info
359 {
360         string          butype_name<>;
361         ndmp4_pval      default_env<>;
362         u_long          attrs;
363 };
364
365 struct ndmp4_config_get_butype_info_reply
366 {
367         ndmp4_error             error;
368         ndmp4_butype_info       butype_info<>;
369 };
370
371
372 const NDMP4_FS_INFO_TOTAL_SIZE_UNS      = 0x00000001;
373 const NDMP4_FS_INFO_USED_SIZE_UNS       = 0x00000002;
374 const NDMP4_FS_INFO_AVAIL_SIZE_UNS      = 0x00000004;
375 const NDMP4_FS_INFO_TOTAL_INODES_UNS    = 0x00000008;
376 const NDMP4_FS_INFO_USED_INODES_UNS     = 0x00000010;
377
378 struct ndmp4_fs_info
379 {
380         u_long          unsupported;
381         string          fs_type<>;
382         string          fs_logical_device<>;
383         string          fs_physical_device<>;
384         ndmp4_u_quad    total_size;
385         ndmp4_u_quad    used_size;
386         ndmp4_u_quad    avail_size;
387         ndmp4_u_quad    total_inodes;
388         ndmp4_u_quad    used_inodes;
389         ndmp4_pval      fs_env<>;
390         string          fs_status<>;
391 };
392
393 struct ndmp4_config_get_fs_info_reply
394 {
395         ndmp4_error     error;
396         ndmp4_fs_info   fs_info<>;
397 };
398
399
400 const NDMP4_TAPE_ATTR_REWIND    = 0x00000001;
401 const NDMP4_TAPE_ATTR_UNLOAD    = 0x00000002;
402 const NDMP4_TAPE_ATTR_RAW       = 0x00000004;
403
404 struct ndmp4_device_capability
405 {
406         string                  device<>;
407         u_long                  attr;
408         ndmp4_pval              capability<>;
409 };
410
411 struct ndmp4_device_info
412 {
413         string                  model<>;
414         ndmp4_device_capability caplist<>;
415 };
416
417 struct ndmp4_config_get_tape_info_reply
418 {
419         ndmp4_error             error;
420         ndmp4_device_info       tape_info<>;
421 };
422
423 struct ndmp4_config_get_scsi_info_reply
424 {
425         ndmp4_error             error;
426         ndmp4_device_info       scsi_info<>;
427 };
428
429 struct ndmp4_class_list
430 {
431         u_short         class_id;
432         u_short         class_version<>;
433 };
434
435 struct ndmp4_class_version
436 {
437         u_short         class_id;
438         u_short         class_version;
439 };
440
441 struct ndmp4_config_get_ext_list_reply
442 {
443         ndmp4_error             error;
444         ndmp4_class_list        class_list<>;
445 };
446
447 struct ndmp4_config_set_ext_list_request
448 {
449         ndmp4_error             error;
450         ndmp4_class_list        ndmp4_accepted_ext<>;
451 };
452
453 struct ndmp4_config_set_ext_list_reply
454 {
455         ndmp4_error     error;
456 };
457
458
459
460
461 struct ndmp4_scsi_open_request
462 {
463         string          device<>;
464 };
465
466 struct ndmp4_scsi_open_reply
467 {
468         ndmp4_error     error;
469 };
470
471
472 struct ndmp4_scsi_close_reply
473 {
474         ndmp4_error     error;
475 };
476
477
478 struct ndmp4_scsi_get_state_reply
479 {
480         ndmp4_error     error;
481         short           target_controller;
482         short           target_id;
483         short           target_lun;
484 };
485
486
487 struct ndmp4_scsi_reset_device_reply
488 {
489         ndmp4_error     error;
490 };
491
492 const NDMP4_SCSI_DATA_IN        = 0x00000001;
493 const NDMP4_SCSI_DATA_OUT       = 0x00000002;
494
495 struct ndmp4_execute_cdb_request
496 {
497         u_long          flags;
498         u_long          timeout;
499         u_long          datain_len;
500         opaque          cdb<>;
501         opaque          dataout<>;
502 };
503
504 struct ndmp4_execute_cdb_reply
505 {
506         ndmp4_error     error;
507         u_char          status;
508         u_long          dataout_len;
509         opaque          datain<>;
510         opaque          ext_sense<>;
511 };
512
513 typedef ndmp4_execute_cdb_request       ndmp4_scsi_execute_cdb_request;
514 typedef ndmp4_execute_cdb_reply         ndmp4_scsi_execute_cdb_reply;
515
516 enum ndmp4_tape_open_mode
517 {
518         NDMP4_TAPE_READ_MODE    = 0,
519         NDMP4_TAPE_RDWR_MODE    = 1,
520         NDMP4_TAPE_RAW_MODE     = 2
521 };
522
523
524 struct ndmp4_tape_open_request {
525         string                  device<>;
526         ndmp4_tape_open_mode    mode;
527 };
528
529 struct ndmp4_tape_open_reply {
530         ndmp4_error     error;
531 };
532
533
534 struct ndmp4_tape_close_reply
535 {
536         ndmp4_error     error;
537 };
538
539
540 /* flags */
541 const NDMP4_TAPE_STATE_NOREWIND = 0x0008;       /* non-rewind   device */
542 const NDMP4_TAPE_STATE_WR_PROT  = 0x0010;       /* write-protected */
543 const NDMP4_TAPE_STATE_ERROR    = 0x0020;       /* media        error */
544 const NDMP4_TAPE_STATE_UNLOAD   = 0x0040;       /* tape unloaded        upon
545         close */
546
547 /* unsupported bits */
548 const NDMP4_TAPE_STATE_FILE_NUM_UNS     = 0x00000001;
549 const NDMP4_TAPE_STATE_SOFT_ERRORS_UNS  = 0x00000002;
550 const NDMP4_TAPE_STATE_BLOCK_SIZE_UNS   = 0x00000004;
551 const NDMP4_TAPE_STATE_BLOCKNO_UNS      = 0x00000008;
552 const NDMP4_TAPE_STATE_TOTAL_SPACE_UNS  = 0x00000010;
553 const NDMP4_TAPE_STATE_SPACE_REMAIN_UNS = 0x00000020;
554
555 struct ndmp4_tape_get_state_reply
556 {
557         u_long          unsupported;
558         ndmp4_error     error;
559         u_long          flags;
560         u_long          file_num;
561         u_long          soft_errors;
562         u_long          block_size;
563         u_long          blockno;
564
565         ndmp4_u_quad    total_space;
566         ndmp4_u_quad    space_remain;
567 };
568
569
570 enum ndmp4_tape_mtio_op
571 {
572         NDMP4_MTIO_FSF=0,
573         NDMP4_MTIO_BSF=1,
574         NDMP4_MTIO_FSR=2,
575         NDMP4_MTIO_BSR=3,
576         NDMP4_MTIO_REW=4,
577         NDMP4_MTIO_EOF=5,
578         NDMP4_MTIO_OFF=6,
579         NDMP4_MTIO_TUR=7
580 };
581
582 struct ndmp4_tape_mtio_request
583 {
584         ndmp4_tape_mtio_op      tape_op;
585         u_long                  count;
586 };
587
588 struct ndmp4_tape_mtio_reply
589 {
590         ndmp4_error     error;
591         u_long          resid_count;
592 };
593
594
595 struct ndmp4_tape_write_request
596 {
597         opaque          data_out<>;
598 };
599
600 struct ndmp4_tape_write_reply
601 {
602         ndmp4_error     error;
603         u_long          count;
604 };
605
606
607 struct ndmp4_tape_read_request
608 {
609         u_long          count;
610 };
611
612 struct ndmp4_tape_read_reply
613 {
614         ndmp4_error     error;
615         opaque          data_in<>;
616 };
617
618
619 typedef ndmp4_scsi_execute_cdb_request  ndmp4_tape_execute_cdb_request;
620 typedef ndmp4_scsi_execute_cdb_reply    ndmp4_tape_execute_cdb_reply;
621
622
623 enum ndmp4_data_operation
624 {
625         NDMP4_DATA_OP_NOACTION          = 0,
626         NDMP4_DATA_OP_BACKUP            = 1,
627         NDMP4_DATA_OP_RECOVER           = 2,
628         NDMP4_DATA_OP_RECOVER_FILEHIST  = 3
629
630 };
631
632 enum ndmp4_data_state
633 {
634         NDMP4_DATA_STATE_IDLE=0,
635         NDMP4_DATA_STATE_ACTIVE=1,
636         NDMP4_DATA_STATE_HALTED=2,
637         NDMP4_DATA_STATE_LISTEN=3,
638         NDMP4_DATA_STATE_CONNECTED=4
639 };
640
641 enum ndmp4_data_halt_reason
642 {
643         NDMP4_DATA_HALT_NA=0,
644         NDMP4_DATA_HALT_SUCCESSFUL=1,
645         NDMP4_DATA_HALT_ABORTED=2,
646         NDMP4_DATA_HALT_INTERNAL_ERROR=3,
647         NDMP4_DATA_HALT_CONNECT_ERROR=4
648 };
649
650 /* ndmp4_addr */
651 struct ndmp4_tcp_addr
652 {
653         u_long          ip_addr;
654         u_short         port;
655         ndmp4_pval      addr_env<>;
656 };
657
658 struct ndmp4_ipc_addr
659 {
660         opaque          comm_data<>;
661 };
662
663 union ndmp4_addr switch (ndmp4_addr_type addr_type)
664 {
665         case NDMP4_ADDR_LOCAL:
666                 void;
667         case NDMP4_ADDR_TCP:
668                 ndmp4_tcp_addr  tcp_addr<>;
669         case NDMP4_ADDR_IPC:
670                 ndmp4_ipc_addr  ipc_addr;
671 };
672
673 /* unsupported bitmask bits */
674 const NDMP4_DATA_STATE_EST_BYTES_REMAIN_UNS     = 0x00000001;
675 const NDMP4_DATA_STATE_EST_TIME_REMAIN_UNS      = 0x00000002;
676
677 struct ndmp4_data_get_state_reply
678 {
679         u_long                  unsupported;
680         ndmp4_error             error;
681         ndmp4_data_operation    operation;
682         ndmp4_data_state        state;
683         ndmp4_data_halt_reason  halt_reason;
684         ndmp4_u_quad            bytes_processed;
685         ndmp4_u_quad            est_bytes_remain;
686         u_long                  est_time_remain;
687         ndmp4_addr              data_connection_addr;
688         ndmp4_u_quad            read_offset;
689         ndmp4_u_quad            read_length;
690 };
691
692
693
694 struct ndmp4_data_listen_request
695 {
696         ndmp4_addr_type addr_type;
697 };
698
699 struct ndmp4_data_listen_reply
700 {
701         ndmp4_error     error;
702         ndmp4_addr      connect_addr;
703 };
704
705
706 struct ndmp4_data_connect_request
707 {
708         ndmp4_addr      addr;
709 };
710
711 struct ndmp4_data_connect_reply
712 {
713         ndmp4_error     error;
714 };
715
716
717 struct ndmp4_data_start_backup_request
718 {
719         string          butype_name<>;
720         ndmp4_pval      env<>;
721 };
722
723 struct ndmp4_data_start_backup_reply
724 {
725         ndmp4_error     error;
726 };
727
728
729 struct ndmp4_name
730 {
731         string          original_path<>;
732         string          destination_path<>;
733         string          name<>;
734         string          other_name<>;
735         ndmp4_u_quad    node;
736         ndmp4_u_quad    fh_info;
737 };
738
739 struct ndmp4_data_start_recover_request
740 {
741         ndmp4_pval      env<>;
742         ndmp4_name      nlist<>;
743         string          butype_name<>;
744 };
745
746 struct ndmp4_data_start_recover_reply
747 {
748         ndmp4_error     error;
749 };
750
751 struct ndmp4_data_start_recover_filehist_request
752 {
753         ndmp4_pval      env<>;
754         ndmp4_name      nlist<>;
755         string          butype_name<>;
756 };
757
758 struct ndmp4_data_start_recover_filehist_reply
759 {
760         ndmp4_error     error;
761 };
762
763
764
765 struct ndmp4_data_abort_reply
766 {
767         ndmp4_error     error;
768 };
769
770
771 struct ndmp4_data_stop_reply
772 {
773         ndmp4_error     error;
774 };
775
776
777 struct ndmp4_data_get_env_reply
778 {
779         ndmp4_error     error;
780         ndmp4_pval      env<>;
781 };
782
783
784 enum ndmp4_mover_mode
785 {
786         NDMP4_MOVER_MODE_READ           = 0,
787         NDMP4_MOVER_MODE_WRITE          = 1,
788         NDMP4_MOVER_MODE_NOACTION       = 2
789 };
790
791 enum ndmp4_mover_state
792 {
793         NDMP4_MOVER_STATE_IDLE,
794         NDMP4_MOVER_STATE_LISTEN,
795         NDMP4_MOVER_STATE_ACTIVE,
796         NDMP4_MOVER_STATE_PAUSED,
797         NDMP4_MOVER_STATE_HALTED
798 };
799
800 enum ndmp4_mover_pause_reason
801 {
802         NDMP4_MOVER_PAUSE_NA            = 0,
803         NDMP4_MOVER_PAUSE_EOM           = 1,
804         NDMP4_MOVER_PAUSE_EOF           = 2,
805         NDMP4_MOVER_PAUSE_SEEK          = 3,
806         /* NDMPv4 does not have MOVER_PAUSE_MEDIA_ERROR = 4 */
807         NDMP4_MOVER_PAUSE_EOW           = 5
808 };
809
810 enum ndmp4_mover_halt_reason
811 {
812         NDMP4_MOVER_HALT_NA,
813         NDMP4_MOVER_HALT_CONNECT_CLOSED,
814         NDMP4_MOVER_HALT_ABORTED,
815         NDMP4_MOVER_HALT_INTERNAL_ERROR,
816         NDMP4_MOVER_HALT_CONNECT_ERROR,
817         NDMP4_MOVER_HALT_MEDIA_ERROR
818 };
819
820
821
822
823 struct ndmp4_mover_set_record_size_request
824 {
825         u_long          len;
826 };
827
828 struct ndmp4_mover_set_record_size_reply
829 {
830         ndmp4_error     error;
831 };
832
833
834 struct ndmp4_mover_set_window_request
835 {
836         ndmp4_u_quad    offset;
837         ndmp4_u_quad    length;
838 };
839
840
841 struct ndmp4_mover_set_window_reply
842 {
843         ndmp4_error     error;
844 };
845
846
847 struct ndmp4_mover_connect_request
848 {
849         ndmp4_mover_mode        mode;
850         ndmp4_addr              addr;
851 };
852
853 struct ndmp4_mover_connect_reply
854 {
855         ndmp4_error     error;
856 };
857
858
859 struct ndmp4_mover_listen_request
860 {
861         ndmp4_mover_mode        mode;
862         ndmp4_addr_type         addr_type;
863 };
864
865 struct ndmp4_mover_listen_reply
866 {
867         ndmp4_error     error;
868         ndmp4_addr      connect_addr;
869 };
870
871
872 struct ndmp4_mover_read_request
873 {
874         ndmp4_u_quad    offset;
875         ndmp4_u_quad    length;
876 };
877
878 struct ndmp4_mover_read_reply
879 {
880         ndmp4_error     error;
881 };
882
883
884
885 struct ndmp4_mover_get_state_reply
886 {
887         ndmp4_error             error;
888         ndmp4_mover_mode        mode;
889         ndmp4_mover_state       state;
890         ndmp4_mover_pause_reason pause_reason;
891         ndmp4_mover_halt_reason halt_reason;
892         u_long                  record_size;
893         u_long                  record_num;
894         ndmp4_u_quad            bytes_moved;
895         ndmp4_u_quad            seek_position;
896         ndmp4_u_quad            bytes_left_to_read;
897         ndmp4_u_quad            window_offset;
898         ndmp4_u_quad            window_length;
899         ndmp4_addr              data_connection_addr;
900 };
901
902
903 struct ndmp4_mover_continue_reply
904 {
905         ndmp4_error     error;
906 };
907
908
909 struct ndmp4_mover_close_reply
910 {
911         ndmp4_error     error;
912 };
913
914
915 struct ndmp4_mover_abort_reply
916 {
917         ndmp4_error     error;
918 };
919
920
921 struct ndmp4_mover_stop_reply
922 {
923         ndmp4_error     error;
924 };
925
926
927 struct ndmp4_notify_data_halted_post
928 {
929         ndmp4_data_halt_reason  reason;
930 };
931
932
933 enum ndmp4_connection_status_reason
934 {
935         NDMP4_CONNECTED=0,
936         NDMP4_SHUTDOWN=1,
937         NDMP4_REFUSED=2
938 };
939
940 struct ndmp4_notify_connection_status_post
941 {
942         ndmp4_connection_status_reason  reason;
943         u_short                         protocol_version;
944         string                          text_reason<>;
945 };
946
947
948 struct ndmp4_notify_mover_halted_post
949 {
950         ndmp4_mover_halt_reason         reason;
951 };
952
953
954 struct ndmp4_notify_mover_paused_post
955 {
956         ndmp4_mover_pause_reason        reason;
957         ndmp4_u_quad                    seek_position;
958 };
959
960
961 struct ndmp4_notify_data_read_post
962 {
963         ndmp4_u_quad    offset;
964         ndmp4_u_quad    length;
965 };
966
967
968 enum ndmp4_has_associated_message
969 {
970         NDMP4_NO_ASSOCIATED_MESSAGE     = 0,
971         NDMP4_HAS_ASSOCIATED_MESSAGE    = 1
972 };
973
974 enum ndmp4_log_type
975 {
976         NDMP4_LOG_NORMAL        = 0,
977         NDMP4_LOG_DEBUG         = 1,
978         NDMP4_LOG_ERROR         = 2,
979         NDMP4_LOG_WARNING       = 3
980 };
981
982 struct ndmp4_log_message_post
983 {
984         ndmp4_log_type          log_type;
985         u_long                  message_id;
986         string                  entry<>;
987         ndmp4_has_associated_message associated_message_valid;
988         u_long                  associated_message_sequence;
989 };
990
991
992 enum ndmp4_recovery_status
993 {
994         NDMP4_RECOVERY_SUCCESSFUL               = 0,
995         NDMP4_RECOVERY_FAILED_PERMISSION        = 1,
996         NDMP4_RECOVERY_FAILED_NOT_FOUND         = 2,
997         NDMP4_RECOVERY_FAILED_NO_DIRECTORY      = 3,
998         NDMP4_RECOVERY_FAILED_OUT_OF_MEMORY     = 4,
999         NDMP4_RECOVERY_FAILED_IO_ERROR          = 5,
1000         NDMP4_RECOVERY_FAILED_UNDEFINED_ERROR   = 6
1001 };
1002
1003 struct ndmp4_log_file_post
1004 {
1005         string                  name<>;
1006         ndmp4_recovery_status   recovery_status;
1007 };
1008
1009
1010 enum ndmp4_fs_type
1011 {
1012         NDMP4_FS_UNIX=0,
1013         NDMP4_FS_NT=1,
1014         NDMP4_FS_OTHER=2
1015 };
1016
1017 typedef string  ndmp4_path<>;
1018
1019 struct ndmp4_nt_path
1020 {
1021         ndmp4_path      nt_path;
1022         ndmp4_path      dos_path;
1023 };
1024
1025 union ndmp4_file_name   switch  (ndmp4_fs_type  fs_type)
1026 {
1027         case NDMP4_FS_UNIX:
1028                 ndmp4_path      unix_name;
1029         case NDMP4_FS_NT:
1030                 ndmp4_nt_path   nt_name;
1031         default:
1032                 ndmp4_path      other_name;
1033 };
1034
1035 /* file type */
1036 enum ndmp4_file_type
1037 {
1038         NDMP4_FILE_DIR=0,
1039         NDMP4_FILE_FIFO=1,
1040         NDMP4_FILE_CSPEC=2,
1041         NDMP4_FILE_BSPEC=3,
1042         NDMP4_FILE_REG=4,
1043         NDMP4_FILE_SLINK=5,
1044         NDMP4_FILE_SOCK=6,
1045         NDMP4_FILE_REGISTRY=7,
1046         NDMP4_FILE_OTHER=8
1047 };
1048
1049 /* file stat */
1050 /* unsupported bitmask */
1051 const NDMP4_FILE_STAT_ATIME_UNS = 0x00000001;
1052 const NDMP4_FILE_STAT_CTIME_UNS = 0x00000002;
1053 const NDMP4_FILE_STAT_GROUP_UNS = 0x00000004;
1054
1055 struct ndmp4_file_stat
1056 {
1057         u_long          unsupported;
1058         ndmp4_fs_type   fs_type;
1059         ndmp4_file_type ftype;
1060         u_long          mtime;
1061         u_long          atime;
1062         u_long          ctime;
1063         u_long          owner;
1064         u_long          group;
1065         u_long          fattr;
1066         ndmp4_u_quad    size;
1067         u_long          links;
1068 };
1069
1070 struct ndmp4_file
1071 {
1072         ndmp4_file_name names<>;
1073         ndmp4_file_stat stats<>;
1074         ndmp4_u_quad    node;
1075         ndmp4_u_quad    fh_info;
1076 };
1077
1078 struct ndmp4_fh_add_file_post
1079 {
1080         ndmp4_file      files<>;
1081 };
1082
1083 struct ndmp4_dir
1084 {
1085         ndmp4_file_name names<>;
1086         ndmp4_u_quad    node;
1087         ndmp4_u_quad    parent;
1088 };
1089
1090 struct ndmp4_fh_add_dir_post
1091 {
1092         ndmp4_dir       dirs<>;
1093 };
1094
1095
1096 struct ndmp4_node
1097 {
1098         ndmp4_file_stat stats<>;
1099         ndmp4_u_quad    node;
1100         ndmp4_u_quad    fh_info;
1101 };
1102
1103 struct ndmp4_fh_add_node_post
1104 {
1105         ndmp4_node      nodes<>;
1106 };
1107
1108 %#endif /* !NDMOS_OPTION_NO_NDMP4 */