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