1/* This idl file originally came from the DCE project  but has been
2   significantly refactored to pass through the idl2wrs   idl-lite
3   compiler.
4
5   DCE has been released as LGPL,   hats off to TheOpenGroup
6
7
8   The original copyright of the IDL file follos below:
9*/
10
11/*
12 * @OSF_COPYRIGHT@
13 * COPYRIGHT NOTICE
14 * Copyright (c) 1990, 1991, 1992, 1993, 1994 Open Software Foundation, Inc.
15 * ALL RIGHTS RESERVED (DCE).  See the file named COPYRIGHT.DCE for
16 * the full copyright text.
17 */
18/*
19 * HISTORY
20 * $Log: butc.idl,v $
21 * Revision 1.1.41.1  1996/10/02  17:05:24  damon
22 * 	Newest DFS from Transarc
23 * 	[1996/10/01  18:05:16  damon]
24 *
25 * Revision 1.1.35.2  1994/06/09  13:52:46  annie
26 * 	fixed copyright in src/file
27 * 	[1994/06/08  21:26:40  annie]
28 *
29 * Revision 1.1.35.1  1994/02/04  20:06:46  devsrc
30 * 	Merged from 1.0.3a to 1.1
31 * 	[1994/02/04  15:06:52  devsrc]
32 *
33 * Revision 1.1.33.1  1993/12/07  17:13:22  jaffe
34 * 	1.0.3a update from Transarc
35 * 	[1993/12/03  12:59:50  jaffe]
36 *
37 * Revision 1.1.2.5  1993/01/18  20:47:57  cjd
38 * 	embedded copyright notice
39 * 	[1993/01/18  17:33:13  cjd]
40 *
41 * Revision 1.1.2.4  1993/01/13  15:53:56  shl
42 * 	Transarc delta: cfe-ot6054-genl-and-i18n-spares 1.1
43 * 	  Selected comments:
44 * 	    Add spares to several RPC structures, with two goals:
45 * 	    - general future usage
46 * 	    - allow for at least some internationalization designs
47 * 	    The only tricky part of this work is that the on-the-wire representation for
48 * 	    directory contents is expanded.
49 * 	Transarc delta: vijay-ot6381-correct-handling-of-device-queue-lock 1.4
50 * 	  Selected comments:
51 *
52 * 	    The aim of this delta is to get bak restore to succeed. The problems in restore
53 * 	    were some spurious thread exceptions and assertions that made bak dump core.
54 * 	    Upon investigation it turned out that there were some locking problems in
55 * 	    backup and butc. The delta cleans up locking in backup and butc.
56 * 	    The delta is not ready for export. Much more needs to be done to get all the
57 * 	    locking issues right. This is just a checkpoint.
58 * 	    Second set of changes to get locking issues in order. This time the changes
59 * 	    are mostly in bakserver. The changes introduced are
60 * 	    1. Establish a global lock so that two RPCs do not interfere with each other.
61 * 	    This was introduced because there are some global data structures in
62 * 	    backup that might get affected. These global structures now have
63 * 	    individual locks to serialize changes. The global lock in temporary, and
64 * 	    will go away once we have serialized all accesses to all global data
65 * 	    structures.
66 * 	    2. Disable cancels in bakserver RPCs. Care is taken to not disable cancels in
67 * 	    operations that can be cancelled. There is some more work that needs to be
68 * 	    done in this area.
69 * 	    3. Accesses to the database are controlled by memoryDB.lock. The accesses are
70 * 	    by means of dbread and dbwrite. The hash tables too are protected by this
71 * 	    mechanism.
72 * 	    4. Changes to the backup database dump code to simplify the dump operation. In
73 * 	    particular, the Unix pipe mechanism is used to synchronize reader and
74 * 	    writer without need for condition variables.
75 * 	    5. Get rid of any pthread_mutex and pthread_cond operations. Use afslk and
76 * 	    afsos routines instead.
77 * 	    6. Continue the work described by the previous revision of the delta in bak
78 * 	    and butc. This should be it for changes in bak and butc.
79 * 	    Fix compilation problems on the RIOS.
80 * 	    This is hopefully the final revision of this delta. The fixes here are
81 * 	    1. Changes to the bakserver and butc RPC interfaces.
82 * 	    The RPCs that handle variable size arrays now use conformant arrays.
83 * 	    This avoids allocating lots of memory on the client thread stack which
84 * 	    was the cause of the exceptions in restoreft. The server allocates
85 * 	    memory which is freed by the server stub on the way out. The client thread
86 * 	    frees the memory allocated by the client stub.
87 * 	    2. get database dump and restore to handle status correctly.
88 * 	    3. Get the locking hierarchy right in bakserver, bak and butc.
89 * 	    4. Other minor nits.
90 * 	    There is still a problem with scantape -dbadd that has to be addressed. With
91 * 	    this delta, all backup commands should work when used in a straightforward
92 * 	    manner. Some error cases are still not handled properly though. Subsequent
93 * 	    deltas would fix those.
94 * 	Transarc delta: vijay-ot6604-butc-add-spares 1.1
95 * 	  Selected comments:
96 *
97 * 	    Add spares to butc structures wherever necessary.
98 * 	[1993/01/12  18:39:46  shl]
99 *
100 * Revision 1.1.2.3  1992/11/24  15:42:03  bolinger
101 * 	Change include file install directory from .../afs to .../dcedfs.
102 * 	[1992/11/22  16:10:10  bolinger]
103 *
104 * Revision 1.1.2.2  1992/08/31  18:37:26  jaffe
105 * 	Transarc delta: cfe-ot4029-portable-rpc-data-types 1.2
106 * 	  Selected comments:
107 * 	    If ``long'' could possibly mean ``64 bits'' any time soon, we need to keep
108 * 	    our RPC interfaces from breaking.
109 * 	    More of the same.  Forgot a couple of .idl files, and needed to change
110 * 	    a couple of procedure signatures to match.
111 * 	    forgot this one too
112 * 	[1992/08/28  20:59:01  jaffe]
113 *
114 * Revision 1.1  1992/01/19  02:57:17  devrcs
115 * 	Initial revision
116 *
117 * $EndLog$
118 */
119
120
121/* changed to the following types:
122   time_t     4 bytes, aligned at 4 bytes holding a unix time_t
123   uint32     4 byte unsigned integer
124   int32      4 byte signed integer
125
126   renamed error_status_t  WERROR  a 32bit integer ststus code
127   removed handle_t   it has no wire encoding
128
129   rewrote the unions so that idl2wrs can parse them
130
131   changed all varying strings to the type butcNameString_t which is
132   implemented in the template
133
134   changed the structs so they are compatible with idl2wrs
135
136   afshyper is called udlong  in idl2wrs   8 bytes, aligned at 4 bytes
137
138   added afsnetaddr definition
139
140*/
141[
142uuid("1d193c08-000b-11ca-ba1d-02608c2ea96e"),
143version(4.0),
144/*provider_version(1)*/
145pointer_default(ptr)	/* All pointers are by default Full pointers */
146] interface butc
147{
148
149const long TC_DEFAULT_STACK_SIZE = 153600; /* stack size for tc threads */
150const long TC_MAXGENNAMELEN = 512;	/* length of generic name */
151const long TC_MAXDUMPPATH   = 256;     	/* dump path names*/
152const long TC_MAXNAMELEN    = 128;	/* name length */
153const long TC_MAXFORMATLEN  = 100;	/*size of the format statement */
154const long TC_MAXHOSTLEN    = 128;	/*for server/machine names */
155const long TC_MAXTAPELEN    = 256;	/*max tape name allowed */
156const long TC_STAT_DONE     = 1;	/* all done */
157const long TC_STAT_OPRWAIT  = 2;	/* waiting for user interaction */
158const long TC_STAT_DUMP     = 4;	/* true if dump, false if restore */
159const long TC_STAT_ABORTED  = 8;	/* the operation was aborted */
160const long TC_STAT_ERROR    = 16;	/* error ocuured in the operation */
161const long TSK_STAT_FIRST   = 0x1;	/* get id of first task */
162const long TSK_STAT_END     = 0x2;	/* no more tasks */
163const long TSK_STAT_NOTFOUND= 0x4;	/* couldn't find task id requested */
164
165const long TCOP_NONE		= 0;
166const long TCOP_READLABEL	= 1;
167const long TCOP_LABELTAPE	= 2;
168const long TCOP_DUMP		= 3;
169const long TCOP_RESTORE		= 4;
170const long TCOP_SCANTAPE	= 5;
171const long TCOP_SAVEDB		= 6;
172const long TCOP_RESTOREDB	= 7;
173const long TCOP_STATUS		= 8;
174const long TCOP_SPARE		= 9;
175
176
177/* restore flags */
178typedef [bitmap32bit] bitmap {
179	TC_RESTORE_CREATE = 0x00000001,	/* create new volume; fail if there */
180	TC_RESTORE_INCR   = 0x00000002	/* incremental, must already exist */
181} butc_Restore_flags;
182
183
184/*typedef [string] byte butcNameString_t[TC_MAXGENNAMELEN];*/
185
186typedef struct {
187    uint16 type;
188    uint8  data[14];
189} afsNetAddr;
190
191typedef struct {
192    udlong vid;		/* volume to dump */
193    butcNameString_t name;      /* name of volume whose clone is to
194					   be dumped*/
195    int32 partition;		/* partition at which to find the volume */
196    time_t date;		/* date from which to do the dump */
197    time_t cloneDate;		/* clone date of the volume */
198    afsNetAddr hostAddr;	/* file server for this volume */
199    uint32 spare1;
200    uint32 spare2;
201    uint32 spare3;
202    uint32 spare4;
203} tc_dumpDesc;
204
205typedef struct {
206	int32 frag;			/* fragment number, 1..n */
207	butcNameString_t tapeName;      /*name of tape frag is on*/
208	int32 position;  		/*start position of frag on tape */
209	udlong origVid;		/* original volume id */
210	udlong vid;			/* 0 means allocate new volid */
211	int32 partition;		/* where to restore the volume */
212	butc_Restore_flags flags;	/* flags */
213	afsNetAddr hostAddr;		/* file server to restore volume to */
214	uint32 realDumpId;		/* dump id associated with this tape */
215	uint32 spare2;
216	uint32 spare3;
217	uint32 spare4;
218	butcNameString_t oldName;       /* volume whose clone is to
219						  be dumped */
220	butcNameString_t newName;	/* new name suffix */
221} tc_restoreDesc;
222
223/*describes the current status of a dump */
224typedef struct {
225	int32 dumpID;		/* dump id we're returning */
226	int32 bytesDumped;		/* bytes dumped so far */
227	udlong volumeBeingDumped;	/* guess ?*/
228	int32 numVolErrs;		/* # of volumes that had errors */
229	int32 flags;			/* true if the dump is done */
230	uint32 spare1;
231	uint32 spare2;
232	uint32 spare3;
233	uint32 spare4;
234} tc_dumpStat;
235
236/*identifier for a tape */
237typedef struct {
238	uint32 size;			/* size of tape in bytes */
239	uint32 size_ext;
240	uint32 spare1;
241	uint32 spare2;
242	uint32 spare3;
243	uint32 spare4;
244	uint32 nameLen;			/* length of tape name */
245	butcNameString_t name;
246} tc_tapeLabel;
247
248
249typedef struct { 		/* describes a tape sequence */
250    int32  id;			/* unique id of tapeSet,
251					   assigned by budb */
252    butcNameString_t tapeServer;	/* name of server where
253						   this tape is */
254    butcNameString_t format; 	/* using printf to make
255						   tape name */
256    int32   maxTapes;		/* maximum number of tapes in seq. */
257    int32  a; int32 b;		/* linear transforms for tape */
258    int32  expDate;			/* expiration date */
259    int32  expType;			/* absolute or relative expiration */
260    uint32 spare1;
261    uint32 spare2;
262    uint32 spare3;
263    uint32 spare4;
264} tc_tapeSet;
265
266/* identifies the tape coordinator interface */
267typedef struct {
268    int32	tcVersion;		/* for the interface & this struct */
269    uint32 spare1;
270    uint32 spare2;
271    uint32 spare3;
272    uint32 spare4;
273} tc_tcInfo;
274
275typedef struct {
276    uint32 tc_restoreArray_len; 	/* count of restore descriptors */
277    [size_is(tc_restoreArray_len),ptr] tc_restoreDesc tc_restoreArray_val[*];
278} tc_restoreArray;
279
280typedef struct {
281    uint32 tc_dumpArray_len;	/* count of dump descriptors */
282    [size_is(tc_dumpArray_len),ptr] tc_dumpDesc tc_dumpArray[*];
283} tc_dumpArray;
284
285/* interface structure */
286typedef struct {
287    butcNameString_t dumpPath;		/* full dump path */
288    butcNameString_t volumeSetName;	/* volume set name */
289    butcNameString_t dumpName;		/* volset.dump */
290    tc_tapeSet tapeSet;
291    int32 parentDumpId;
292    int32 dumpLevel;
293    uint32 spare1;
294    uint32 spare2;
295    uint32 spare3;
296    uint32 spare4;
297} tc_dumpInterface;
298
299/* The status structure returns information about the task running in butc.
300   It contains a union that returns the info about the particular operation
301   currently running in butc.
302*/
303typedef struct {
304      uint32    nKBytes;                 	/* bytes xferred */
305      butcNameString_t volumeName;	/* current volume (if any) */
306      int32	  volsFailed;			/* # operation failures */
307      uint32    spare1;
308} tc_statusInfoSwitchVol;
309typedef struct {
310      tc_tapeLabel  tapeLabel;
311      uint32    spare1;
312} tc_statusInfoSwitchLabel;
313
314/* 32bit tag */
315typedef union {
316  [case(TCOP_NONE)]      uint32 none;
317  [case(TCOP_DUMP)]      tc_statusInfoSwitchVol vol;
318  [case(TCOP_RESTORE)]   tc_statusInfoSwitchVol vol;
319  [case(TCOP_LABELTAPE)] tc_statusInfoSwitchLabel label;
320  [case(TCOP_READLABEL)] tc_statusInfoSwitchLabel label;
321  [case(TCOP_SCANTAPE)]  uint32    spare1;
322  [case(TCOP_STATUS)]    uint32    spare2;
323  [case(TCOP_SAVEDB)]    uint32    spare3;
324  [case(TCOP_RESTOREDB)] uint32    spare4;
325  [case(TCOP_SPARE)]     uint32    spare5;
326} tc_statusInfoSwitch;
327
328typedef struct {
329    /* general info */
330    butcNameString_t taskName;	/* task name */
331    uint32    flags;                   	/* as above */
332    time_t    lastPolled;                  	/* last successful poll */
333
334    /* op specific info */
335    tc_statusInfoSwitch info;
336    uint32 taskId;
337
338
339    /* nominal spares */
340    uint32 spare2;
341    uint32 spare3;
342    uint32 spare4;
343} tciStatusS;
344
345/*
346 * Procedure Definitions
347 */
348
349/* Start a dump, given a dump set name, a tape set name and the volumes to
350 * dump.
351 */
352/*
353 * provider_version(1)
354 */
355WERROR BUTC_PerformDump
356(
357      [ref, in] tc_dumpInterface 	*tcdiPtr,
358      [ref, in]      tc_dumpArray 	*dumps,
359      [ref, out]     int32 		*dumpID
360);
361
362/* Start a restore, given a dump set name, a tape set name and the volumes to
363 * dump.
364 */
365/*
366 * provider_version(1)
367 */
368WERROR BUTC_PerformRestore
369(
370      [in]   	butcNameString_t 	*dumpSetName,
371      [ref, in] tc_restoreArray 	*restores,
372      [ref, out] int32 		*dumpID
373);
374
375/* abort a dump */
376
377/*
378 * provider_version(1)
379 */
380WERROR BUTC_AbortDump
381(
382      [in]       int32 		dumpID
383);
384
385/*
386 * provider_version(1)
387 */
388WERROR BUTC_LabelTape
389(
390      [ref, in]      tc_tapeLabel 	*label,
391      [ref, out]     uint32       	*taskId
392);
393
394/*
395 * provider_version(1)
396 */
397WERROR BUTC_ReadLabel
398(
399      [ref, out]     uint32 	*taskId /* unused */
400);
401
402/*
403 * provider_version(1)
404 */
405WERROR BUTC_ScanDumps
406(
407      [in]      int32 		addDbFlag,
408      [ref, out]     uint32 	*taskId
409);
410
411/* For returning information about the butc interface.
412 * Currently this is just the version number
413 */
414
415/*
416 * provider_version(1)
417 */
418WERROR BUTC_TCInfo
419(
420      [ref, out]     tc_tcInfo 		*tciptr
421);
422
423/* for database dump/restores */
424
425/*
426 * provider_version(1)
427 */
428WERROR BUTC_SaveDb
429(
430      [ref, out]     uint32 	*taskId
431);
432
433/*
434 * provider_version(1)
435 */
436WERROR BUTC_RestoreDb
437(
438      [ref, out]     uint32 	*taskId
439);
440
441/* new status management */
442/*
443 * provider_version(1)
444 */
445WERROR BUTC_EndStatus
446(
447      [in]      uint32 		taskId
448);
449
450/*
451 * provider_version(1)
452 */
453WERROR BUTC_GetStatus
454(
455      [in]      uint32 		taskId,
456      [ref, out]     tciStatusS 	*statusPtr
457);
458
459/*
460 * provider_version(1)
461 */
462WERROR BUTC_RequestAbort
463(
464      [in]      uint32 		taskId
465);
466
467/*
468 * provider_version(1)
469 */
470WERROR BUTC_ScanStatus
471(
472      [ref, in, out] uint32 	*taskId,
473      [ref, out]     tciStatusS 	*statusPtr,
474      [ref, in, out] uint32 	*flags
475);
476
477
478/*
479 * provider_version(1)
480 */
481
482WERROR BUTC_GetServerInterfaces
483(
484/*  [ref, in, out] dfs_interfaceList *serverInterfacesP*/
485);
486
487}
488