Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / butc / afsxbsa.h
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 #ifndef _BSA_XBSA_H_
11 #define _BSA_XBSA_H_
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #include <time.h>
18
19 #ifdef bool_t
20 #undef bool_t
21 #endif
22
23 /* include TSM Header Files. */
24 #include <dsmapitd.h>
25 #include <dsmapifp.h>
26 #include <dsmrc.h>
27
28 /* BSA_Boolean */
29 typedef char BSA_Boolean;
30
31 /* BSA_Int16 */
32 typedef short BSA_Int16;
33
34 /* BSA_Int32 */
35 typedef long BSA_Int32;
36
37 /* BSA_Int64 */
38 typedef struct { /* defined as two 32-bit integers */
39 BSA_Int32 left;
40 BSA_Int32 right;
41 } BSA_Int64;
42
43 /* BSA_UInt16 */
44 typedef unsigned short BSA_UInt16;
45
46 /* BSA_UInt32 */
47 typedef unsigned long BSA_UInt32;
48
49 /* BSA_UInt64 */
50 typedef struct { /* defined as two unsigned 32-bit integers*/
51 BSA_UInt32 left;
52 BSA_UInt32 right;
53 } BSA_UInt64;
54
55 /*-------------------------------------------------------------------------+
56 | ADSM specific constants and return codes |
57 +-------------------------------------------------------------------------*/
58 /* TSM library version, release, level
59 */
60 #define BSA_API_VERSION 5
61 #define BSA_API_RELEASE 2
62 #define BSA_API_LEVEL 0
63
64 /* Constants used */
65 #define ADSM_MAX_DESC 100 /* ADSM max Desc size */
66 #define ADSM_MAX_OBJINFO 100 /* ADSM max object info size */
67 #define ADSM_LOWEST_BOUND 0x0000 /* value for LowerBound min */
68 #define ADSM_HIGHEST_BOUND 0xFFFF /* value for UpperBound max */
69 #define ADSM_ENV_STRS 3 /* number of env strings */
70 #define ObjectDescriptorVersion 1 /* ver for ObjectDescriptor */
71 #define UserDescriptorVersion 1 /* ver for UserDescriptor */
72
73 /* Return Codes Used
74 */
75 #define BSA_RC_OK 0x00
76 #define BSA_RC_SUCCESS 0x00
77
78 #define ADSM_RC_ERROR 0x60 /* see ADSM error log */
79 #define ADSM_RC_INVALID_NODE 0x61 /* BSAObjOwner not match Init*/
80 #define ADSM_RC_INVALID_COPYTYPE 0x62 /* invalid copyType */
81 #define ADSM_RC_INVALID_OBJTYPE 0x63 /* invalid objectType */
82 #define ADSM_RC_INVALID_STATUS 0x64 /* invalid object status */
83 #define ADSM_RC_INVALID_ST_VER 0x65 /* invalid structure version */
84 #define ADSM_RC_OWNER_TOO_LONG 0x66 /* owner too long */
85 #define ADSM_RC_PSWD_TOO_LONG 0x67 /* pswd too long */
86 #define ADSM_RC_PSWD_GEN 0x68 /* pswd access = generate */
87
88 /* Constants used
89 *
90 * Maximum string lengths (lower bound), including trailing null
91 */
92 #define BSA_LIST_ELEMENT_DELIMITER null /* Element delimiter in list */
93 #define BSA_MAX_ADMIN_NAME 64 /* Administrator name */
94 #define BSA_MAX_APPOBJECT_OWNER 64 /* Max end-object owner length */
95 #define BSA_MAX_BSAOBJECT_OWNER 64 /* Max BSA object owner length */
96 #define BSA_MAX_CG_DEST 31 /* Copy group destination */
97 #define BSA_MAX_CG_NAME 31 /* Max copy group name length */
98 #define BSA_MAX_COPYGROUPS 16 /* Max number of copy groups */
99 /* which can be specified in a */
100 /* lifecycle group */
101 #define BSA_MAX_DESC 256 /* Description field */
102 #define BSA_MAX_ENCODINGMETHOD 31 /* Max encoding method length */
103 #define BSA_MAX_EVENTINFO 256 /* Max event info size */
104 #define BSA_MAX_FILTERRULESET 8192 /* Max filter rule set size */
105 #define BSA_MAX_OSNAME 1024 /* Max Objectspace name length */
106 #define BSA_MAX_LG_NAME 31 /* Life cycle group name */
107 #define BSA_MAX_LIFECYCLEGROUPS 64 /* Max number of life cycle */
108 /* groups in a policy set */
109 #define BSA_MAX_OBJINFO 512 /* Max object info size */
110 #define BSA_MAX_PATHNAME 1024 /* Max path name length */
111 #define BSA_MAX_POLICYDOMAINS 256 /* Max number of specific policy */
112 /* domains an administrator may */
113 /* be responsible for */
114 #define BSA_MAX_POLICYDOMAIN_NAME 31 /* Policy domain name */
115 #define BSA_MAX_POLICYSETS 16 /* Max number of policy sets */
116 /* in a domain */
117 #define BSA_MAX_POLICYSET_NAME 31 /* Policy set name */
118 #define BSA_MAX_RESOURCETYPE 31 /* Max resource mgr name length */
119 #define BSA_MAX_TOKEN_SIZE 64 /* Max size of a security token */
120 #define BSA_PUBLIC "BSA_ANY" /* Default string */
121
122 /* Return Codes Used
123 *
124 * Return Code descriptions are given in Section 4.3.
125 */
126 #define BSA_RC_ABORT_ACTIVE_NOT_FOUND 0x02
127 #define BSA_RC_ABORT_SYSTEM_ERROR 0x03
128 #define BSA_RC_AUTHENTICATION_FAILURE 0x04
129 #define BSA_RC_BAD_CALL_SEQUENCE 0x05
130 #define BSA_RC_BAD_HANDLE 0x06
131 #define BSA_RC_BUFFER_TOO_SMALL 0x07
132 #define BSA_RC_DESC_TOO_LONG 0x08
133 #define BSA_RC_OBJECTSPACE_TOO_LONG 0x09
134 #define BSA_RC_INVALID_TOKEN 0x0a
135 #define BSA_RC_INVALID_VOTE 0x0b
136 #define BSA_RC_INVALID_KEYWORD 0x0c
137 #define BSA_RC_MATCH_EXISTS 0x0d
138 #define BSA_RC_MORE_DATA 0x0e
139 #define BSA_RC_MORE_RULES 0x0f
140 #define BSA_RC_NEWTOKEN_REQD 0x10
141 #define BSA_RC_NO_MATCH 0x11
142 #define BSA_RC_NO_MORE_DATA 0x12
143 #define BSA_RC_NO_RESOURCES 0x13
144 #define BSA_RC_NULL_DATABLKPTR 0x14
145 #define BSA_RC_NULL_OBJNAME 0x15
146 #define BSA_RC_NULL_POINTER 0x16
147 #define BSA_RC_NULL_RULEID 0x17
148 #define BSA_RC_OBJECT_NAME_TOO_LONG 0x18
149 #define BSA_RC_OBJECT_NOT_EMPTY 0x19
150 #define BSA_RC_OBJECT_NOT_FOUND 0x1a
151 #define BSA_RC_OBJINFO_TOO_LONG 0x1b
152 #define BSA_RC_OBJNAME_TOO_LONG 0x1c
153 #define BSA_RC_OPERATION_NOT_AUTHORIZED 0x1d
154 #define BSA_RC_OLDTOKEN_REQD 0x1e
155 #define BSA_RC_TOKEN_EXPIRED 0x1f
156 #define BSA_RC_TXN_ABORTED 0x20
157 #define BSA_RC_UNMATCHED_QUOTE 0x21
158 #define BSA_RC_USER_OWNS_OBJECTS 0x22
159
160 /* AppObjectOwner
161 */
162 typedef char AppObjectOwner[BSA_MAX_APPOBJECT_OWNER];
163
164 /* BSAObjectOwner
165 */
166 typedef char BSAObjectOwner[BSA_MAX_BSAOBJECT_OWNER];
167
168 /* CopyGpDest
169 */
170 typedef char CopyGpDest[BSA_MAX_CG_DEST];
171
172 /* CopyGpName
173 */
174 typedef char CopyGpName[BSA_MAX_CG_NAME];
175
176 /* CopyMode
177 *
178 * Constant Value Explanation
179 * -------- ----- -----------
180 * INCREMENTAL 1 Specifies that the Backup Services should make a
181 * copy only if the application object has been
182 * modified since the last time this copy group was
183 * used to create the object's copy.
184 * ABSOLUTE 2 Specifies that the Backup Services should make a
185 * copy even if the application object has not been
186 * modified since the last time this copy group was
187 * used to create the object's copy.
188 */
189 typedef enum {
190 BSACopyMode_INCREMENTAL = 1,
191 BSACopyMode_ABSOLUTE = 2
192 } CopyMode;
193
194 /* CopySerialization
195 *
196 * Constant Value Explanation
197 * -------- ----- -----------
198 * STATIC 1 Specifies that the Backup Services must create a
199 * consistent (unmodified during the operation) copy of
200 * the object. If the application is unable to create a
201 * consistent copy then it should skip the operation
202 * (creating backup or archive copy) for the object.
203 * SHAREDSTATIC 2 Specifies that the Backup Services must create a
204 * consistent copy of the object. It can retry the
205 * operation a number of times (application dependent).
206 * If the Backup Services is unable to create a
207 * consistent copy even after retries, then it should
208 * skip creating a backup or archive copy of the
209 * object.
210 * SHAREDDYNAMIC 3 Specifies that the Backup Services must create a
211 * copy of the object. It can retry the operation a
212 * number of times in an attempt to create a consistent
213 * copy; however, if it fails to make a consistent
214 * copy, a copy must still be made, ignoring the fact
215 * that the copy may have been modified during the
216 * operation. Such copies are useful for log file
217 * objects which are being continuously modified.
218 * DYNAMIC 4 Specifies that the Backup Services must create a
219 * copy of the obbject even if the source object is
220 * modified during the operation. No retries should be
221 * attempted to create a consistent copy.
222 */
223 typedef enum {
224 BSACopySerialization_STATIC = 1,
225 BSACopySerialization_SHAREDSTATIC = 2,
226 BSACopySerialization_SHAREDDYNAMIC = 3,
227 BSACopySerialization_DYNAMIC = 4
228 } CopySerialization;
229
230 /* CopyType
231 *
232 * Constant Value Explanation
233 * -------- ----- -----------
234 * ANY 1 Used for matching any copy type (e.g. "backup" or
235 * "archive" in the copy type field of structures for
236 * selecting query results).
237 * ARCHIVE 2 Specifies that the copy type should be "archive".
238 * When used in the copy type field of the CopyGroup,
239 * it identifies the copy data as of type
240 * ArchiveCopyData, which is used to create archive
241 * copies.
242 * BACKUP 3 Specifies that the copy type should be "backup".
243 * When used in the copy type field of the CopyGroup,
244 * it identifies the copy data as of type
245 * BackupCopyData, which is used to create backup
246 * copies.
247 */
248 typedef enum {
249 BSACopyType_ANY = 1,
250 BSACopyType_ARCHIVE = 2,
251 BSACopyType_BACKUP = 3
252 } CopyType;
253
254 /* Description
255 */
256 typedef char Description[BSA_MAX_DESC];
257
258 /* DomainName
259 */
260 typedef char * DomainName[BSA_MAX_POLICYDOMAIN_NAME];
261
262 /* EventInfo
263 */
264 typedef char EventInfo[BSA_MAX_EVENTINFO];
265
266 /* LGName
267 */
268 typedef char LGName[BSA_MAX_LG_NAME];
269
270 /* ObjectInfo
271 */
272 typedef char ObjectInfo[BSA_MAX_OBJINFO];
273
274 /* ObjectName
275 */
276 typedef struct {
277 char objectSpaceName[BSA_MAX_OSNAME]; /* Highest-level name qualifier */
278 char pathName[BSA_MAX_PATHNAME]; /* Object name within */
279 /* objectspace */
280 } ObjectName;
281
282 /* ObjectOwner
283 */
284 typedef struct {
285 BSAObjectOwner bsaObjectOwner; /* BSA Owner name - this is the name */
286 /* that Backup Services authenticates */
287 AppObjectOwner appObjectOwner; /* End-owner name, this is the name */
288 /* defined by the application */
289 } ObjectOwner;
290
291 /* ObjectSize
292 */
293 typedef BSA_UInt64 ObjectSize; /* Unsigned 64-bit integer */
294
295 /* ObjectStatus
296 *
297 * Constant Value Explanation
298 * -------- ----- -----------
299 * ANY 1 Provides a wild card function. Can only be used in
300 * queries.
301 * ACTIVE 2 Indicates that this is the most recent backup copy
302 * of an object.
303 * INACTIVE 3 Indicates that this is not the most recent backup
304 * copy, or that the object itself no longer exists.
305 */
306 typedef enum {
307 BSAObjectStatus_ANY = 1,
308 BSAObjectStatus_ACTIVE = 2,
309 BSAObjectStatus_INACTIVE = 3
310 } ObjectStatus;
311
312 /* ObjectType
313 *
314 * Constant Value Explanation
315 * -------- ----- -----------
316 * any 1 Used for matching any object type (e.g. "file" or
317 * "directory") value in the object type field of
318 * structures for selecting query results.
319 * file 2 Used by the application to indicate that the type of
320 * application object is a "file" or single object.
321 * directory 3 Used by the application to indicate that the type of
322 * application object is a "directory" or container of
323 * objects.
324 */
325
326 typedef enum {
327 BSAObjectType_ANY = 1,
328 BSAObjectType_FILE = 2,
329 BSAObjectType_DIRECTORY = 3,
330 BSAObjectType_DATABASE = 4,
331 } ObjectType;
332
333 /* Operation
334 *
335 * Constant Value Explanation
336 * -------- ----- -----------
337 * archive 1 Used to indicate that a scheduled operation is of
338 * type "archive".
339 * backup 2 Used to indicate that a scheduled operation is of
340 * type "backup".
341 */
342 typedef enum {
343 BSAOperation_ARCHIVE = 1,
344 BSAOperation_BACKUP = 2
345 } Operation;
346
347 /* Period
348 *
349 * Use of the Period structure in a Schedule for an event:
350 * 1. The Schedule structure specifies 3 timing elements:
351 * a. "firstStartTime" - a timestamp showing the "earliest"
352 * possible time the event could take place
353 * b. "day" - the day of the week the event should occur
354 * c. "frequency" - the period between successive events
355 * 2. To determine the day the event should occur (this does
356 * not change the time of the event in the day):
357 * a. Determine the requested day from "firstStartTime".
358 * b. If "day" does not equal XBSA_DAYOFWEEK_ANY
359 * i. Compare "day" to the day of the week corresponding
360 * to "firstStartTime" determined in 2a above.
361 * ii.If the days match, then use "firstStartTime" else
362 * use the first "day" *following* the day shown
363 * in "firstStartTime" as the day of the event.
364 * 3. If the PeriodWhich field in the Period structure is other
365 * than XBSA_PERIOD_UNDEFINED, then successive events are
366 * determined using the value of "periodData".
367 * a. For seconds and days, the appropriate seconds or days
368 * are added to the "firstStartTime" and step 2 to correct
369 * for the day of the week (if needed) is applied again.
370 * b. If a monthly period is specified, then the appropriate
371 * number of months are added by incrementing the month index is
372 * made (for example, a one month increment from February to
373 * March). If the monthly date is not valid (for example, January
374 * 30 --> February 30) then the last day of the desired month is
375 * used (example January 30 --> February 28). Then step 2 is
376 * followed to adjust for the requested day (which might move the
377 * event time into the following month).
378 */
379 typedef enum {
380 BSAPeriod_SECONDS = 1,
381 BSAPeriod_DAYS = 2,
382 BSAPeriod_MONTHS = 3,
383 BSAPeriod_UNDEFINED = -9,
384 BSAPeriod_DAILY = 4, BSAPeriod_WEEKLY = 5, BSAPeriod_MONTHLY = 6,
385 BSAPeriod_QUARTERLY = 7, BSAPeriod_ANNUALLY = 8
386 } PeriodWhich;
387
388 typedef struct {
389 PeriodWhich which;
390 union {
391 time_t nSeconds;
392 BSA_Int16 nDays;
393 BSA_Int16 nMonths;
394 } periodData;
395 } Period;
396
397 /* ResourceType
398 */
399 typedef char ResourceType[BSA_MAX_RESOURCETYPE];
400
401 /* RuleId
402 */
403 typedef BSA_UInt64 RuleId;
404
405 /* Scheduleid
406 */
407 typedef BSA_UInt64 ScheduleId;
408
409 /* AccessRight
410 *
411 * Constant Value Explanation
412 * -------- ----- -----------
413 * GET 1 Access right for getting an object from Backup
414 * Services, also includes access right for querying
415 * (getting attributes) an object from Backup Services.
416 * QUERY 2 Access right for querying (getting attributes) an
417 * object from Backup Services.
418 */
419 typedef enum {
420 BSAAccessRight_GET = 1,
421 BSAAcessRight_QUERY = 2
422 } AccessRight;
423
424 /* AccessRule
425 */
426 typedef struct {
427 RuleId ruleId; /* Provided by Backup Services */
428 ObjectName objName; /* Object name to be given access */
429 ObjectOwner objectOwner; /* BSA object owner and Applicaton object */
430 /* owner to be given access */
431 AccessRight rights; /* The access rights to be given */
432 } AccessRule;
433
434 /* ApiVersion
435 */
436 typedef struct {
437 BSA_UInt16 version; /* Version of this API */
438 BSA_UInt16 release; /* Release of this API */
439 BSA_UInt16 level; /* Level of this API */
440 } ApiVersion;
441
442 /* ArchiveCopyData
443 */
444 typedef struct {
445 CopyGpName cGName; /* Copy group name */
446 BSA_UInt16 freq; /* Archive frequency */
447 CopySerialization copySer; /* Copy serialization code */
448 CopyMode copyMode; /* Copy mode */
449 CopyGpDest destName; /* Copy destination name */
450 BSA_UInt16 retVersion; /* Retention time for the version */
451 } ArchiveCopyData;
452
453 /* BackupCopyData
454 */
455 typedef struct {
456 CopyGpName cGName; /* Copy group name */
457 BSA_UInt16 freq; /* Backup frequency */
458 CopySerialization copySer; /* Copy serialization code */
459 CopyMode copyMode; /* Copy mode: 1=modified, 2=absolute */
460 CopyGpDest destName; /* Copy destination name */
461 BSA_UInt16 verDataEx; /* Versions (number of versions */
462 /* retained) */
463 BSA_UInt16 verDataDel; /* Versions (data deleted) */
464 Period retXtraVer; /* Retain extra versions */
465 Period retOnlyVer; /* Retain only versions */
466 } BackupCopyData;
467
468 /* CopyGroup
469 */
470 typedef struct {
471 CopyType copyType; /* Type of copy group: archive, backup, etc */
472 union {
473 ArchiveCopyData archive;
474 BackupCopyData backup;
475 } copyData;
476 } CopyGroup;
477
478 /* CopyId
479 */
480 typedef BSA_UInt64 CopyId;
481
482 /* DataBlock
483 */
484 typedef struct {
485 BSA_UInt16 bufferLen;
486 BSA_UInt16 numBytes; /* Actual number of bytes read from */
487 /* or written to the buffer, or the */
488 /* minimum number of bytes needed */
489 char * bufferPtr;
490 } DataBlock;
491
492 /* DayOfWeek
493 */
494 typedef enum {
495 BSADayOfWeek_Monday = 1, BSADayOfWeek_Tuesday = 2,
496 BSADayOfWeek_Wednesday = 3, BSADayOfWeek_Thursday = 4,
497 BSADayOfWeek_Friday = 5, BSADayOfWeek_Saturday = 6,
498 BSADayOfWeek_Sunday = 7
499 } DayOfWeek;
500
501 /* Environment
502 */
503 typedef struct {
504 char * envVariables; /* Identifies the Backup Services instance and other */
505 /* implementation-dependent variables such as */
506 /* communication ports, etc. Each variable is a */
507 /* (keyword, value) pair separated by a space. */
508 /* If a value contains spaces, it must be */
509 /* enclosed in single or double quotes. */
510 } BSAEnvironment;
511
512 /* Event
513 */
514 typedef struct {
515 BSA_UInt32 eventId; /* This is an internal (to Backup Services) id*/
516 ObjectOwner objectOwner;/* Identifies the owner of the event */
517 struct tm time; /* Identifies the time the action is to start */
518 Operation action; /* Identifies the action (backup, archive) */
519 ObjectName objName; /* Identifies objects to be acted on */
520 ResourceType resourceType;/* Identifies the resource manager for the */
521 /* event */
522 EventInfo eventInfo; /* User- and resource-manager-specific info */
523 } BSAEvent;
524
525 /* MethodName
526 */
527 typedef char EncodingMethod[BSA_MAX_ENCODINGMETHOD];
528
529 /* ObjectDescriptor
530 */
531 typedef struct {
532 BSA_UInt32 version; /* Version number for this structure */
533 ObjectOwner Owner; /* Owner of the object */
534 ObjectName objName; /* Object name */
535 struct tm createTime; /* Supplied by Backup Services */
536 CopyType copyType; /* Copy type: archive or backup */
537 CopyId copyId; /* Supplied by Backup Services */
538 BSA_UInt64 restoreOrder; /* Supplied by Backup Services */
539 LGName lGName; /* Associated Lifecycle Group name */
540 CopyGpName cGName; /* Copy group within the lifecycle group */
541 ObjectSize size; /* Object size may be up to 63 bits */
542 ResourceType resourceType; /* e.g. UNIX file system */
543 ObjectType objectType; /* e.g. file, directory, etc. */
544 ObjectStatus status; /* Active/inactive, supplied by */
545 /* Backup Services */
546 EncodingMethod * encodingList; /* List of encoding Methods used, in */
547 /* application-defined order, */
548 /* terminated with a null entry */
549 Description desc; /* Descriptive label for the object */
550 ObjectInfo objectInfo; /* Application information */
551 } ObjectDescriptor;
552
553 /* QueryDescriptor
554 */
555 typedef struct {
556 ObjectOwner owner; /* Owner of the object */
557 ObjectName objName; /* Object name */
558 struct tm createTimeLB; /* Lower bound on create time */
559 struct tm createTimeUB; /* Upper bound on create time */
560 struct tm expireTimeLB; /* Lower bound on expiration time */
561 struct tm expireTimeUB; /* Upper bound on expiration time */
562 CopyType copyType; /* Copy type: archive or backup */
563 LGName lGName; /* Associated Lifecycle Group name */
564 CopyGpName cGName; /* Copy group within the lifecycle group */
565 ResourceType resourceType; /* e.g. UNIX file system */
566 ObjectType objectType; /* e.g. file, directory, etc. */
567 ObjectStatus status; /* Active/inactive, supplied by Backup */
568 /* Services */
569 Description desc; /* Descriptive label for the object */
570 } QueryDescriptor; /* "*" is interpreted as a meta character */
571 /* wild card. */
572 /* Any undefined value is interpreted as */
573 /* an error. */
574
575 /* Schedule
576 */
577 typedef struct {
578 ScheduleId schedId; /* Provided by Backup Services */
579 ObjectOwner objectOwner; /* Specifies the owner of the schedule */
580 Operation operation; /* Specifies the action to be taken */
581 struct tm firstStartTime; /* Specifies the first time the action */
582 /* is to take place */
583 DayOfWeek day; /* Specifies the day of week for the event*/
584 Period frequency; /* Specifies the frequency, e.g. daily */
585 ObjectName objectName; /* Identifies objects to be acted on */
586 ResourceType resourceType; /* Identifies the resource manager for the*/
587 /* schedule */
588 EventInfo scheduleInfo; /* Resource manager specific information */
589 } Schedule;
590
591 /* Security Token
592 */
593 typedef char SecurityToken[BSA_MAX_TOKEN_SIZE];
594
595 /* StreamHandle
596 */
597 typedef int StreamHandle;
598
599 /* UserDescriptor
600 */
601 typedef struct t_UserDescriptor {
602 BSA_UInt16 version; /* Version num of this structure */
603 BSAObjectOwner bsaObjectOwner; /* BSA Object owner name */
604 DomainName domainName; /* Policy domain for the user */
605 Description desc; /* User information */
606 } UserDescriptor;
607
608 /* Vote
609 */
610 typedef enum {
611 BSAVote_COMMIT = 1,
612 BSAVote_ABORT = 2
613 } Vote;
614
615 /* Function Prototypes for Data Movement API Subset
616 * Note that int and long have been replaced with typedefs
617 * from custom.h.
618 */
619
620 extern BSA_Int16
621 BSABeginTxn
622 ( long bsaHandle
623 );
624
625 extern BSA_Int16
626 BSAChangeToken
627 ( long bsaHandle,
628 SecurityToken *oldTokenPtr,
629 SecurityToken *newTokenPtr
630 );
631
632 extern BSA_Int16
633 BSACreateObject
634 ( long bsaHandle,
635 ObjectDescriptor *objectDescriptorPtr,
636 DataBlock *dataBlockPtr
637 );
638
639 extern BSA_Int16
640 BSACreateObjectF
641 ( long bsaHandle,
642 ObjectDescriptor *objectDescriptorPtr,
643 StreamHandle *streamPtr
644 );
645
646 extern BSA_Int16
647 BSADeleteObject
648 ( long bsaHandle,
649 CopyType copyType,
650 ObjectName *objectName,
651 CopyId *copyId
652 );
653
654 extern BSA_Int16
655 BSAEndData
656 ( long bsaHandle
657 );
658
659 extern BSA_Int16
660 BSAEndTxn
661 ( long bsaHandle,
662 Vote vote
663 );
664
665 extern BSA_Int16
666 BSAGetData
667 ( long bsaHandle,
668 DataBlock *dataBlockPtr
669 );
670
671 extern BSA_Int16
672 BSAGetEnvironment
673 ( long bsaHandle,
674 ObjectOwner *objectOwnerPtr,
675 char **environmentPtr
676 );
677
678 extern BSA_Int16
679 BSAGetNextQueryObject
680 ( long bsaHandle,
681 ObjectDescriptor *objectDescriptorPtr
682 );
683
684 extern BSA_Int16
685 BSAGetObject
686 ( long bsaHandle,
687 ObjectDescriptor *objectDescriptorPtr,
688 DataBlock *dataBlockPtr
689 );
690
691 extern BSA_Int16
692 BSAGetObjectF
693 ( long bsaHandle,
694 ObjectDescriptor *objectDescriptorPtr,
695 StreamHandle *streamPtr
696 );
697
698 extern BSA_Int16
699 BSAInit
700 ( long *bsaHandleP,
701 SecurityToken *tokenPtr,
702 ObjectOwner *objectOwnerPtr,
703 char **environmentPtr
704 );
705
706 extern BSA_Int16
707 BSAMarkObjectInactive
708 ( long bsaHandle,
709 ObjectName *objectNamePtr
710 );
711
712 extern void
713 BSAQueryApiVersion
714 ( ApiVersion *apiVersionPtr
715 );
716
717 extern BSA_Int16
718 BSAQueryObject
719 ( long bsaHandle,
720 QueryDescriptor *queryDescriptorPtr,
721 ObjectDescriptor *objectDescriptorPtr
722 );
723
724 extern BSA_Int16
725 BSASendData
726 ( long bsaHandle,
727 DataBlock *dataBlockPtr
728 );
729
730 extern BSA_Int16
731 BSASetEnvironment
732 ( long bsaHandle,
733 char **environmentPtr
734 );
735
736 extern BSA_Int16
737 BSATerminate
738 ( long bsaHandle
739 );
740
741 extern BSA_Int16
742 BSAResolveLifecycleGroup(
743 long BSAHandle,
744 ObjectDescriptor *BSAobjDescP
745 );
746
747 #ifdef __cplusplus
748 }
749 #endif
750
751 typedef struct
752 {
753 ApiSessInfo dsmSessInfo;
754 BSAObjectOwner bsaObjectOwner; /* node value on BSAInit */
755 dsUint16_t sessFlags; /* misc flags */
756 dsUint8_t oper; /* send or recv operation */
757 CopyType copyType; /* Backup or Archive type */
758 char *nextQryP; /* ptr to respArchive or respBackup */
759 } xGlobal;
760
761 /* flag masks for sessFlags */
762 /* to set on use sessFlags = (sessFlags | FL_IN_BSA_TXN) */
763 /* to set off use sessFlags = (sessFlags ^ FL_IN_BSA_TXN) */
764 /* to test on use if (sessFlags & FL_IN_BSA_TXN) */
765 #define FL_IN_BSA_TXN 0x0001 /* within a BSA type txn */
766 #define FL_IN_DSM_TXN 0x0002 /* within a actual ADSM txn */
767 #define FL_IN_BSA_QRY 0x0004 /* within a query txn */
768 #define FL_PSWD_EXPIRE 0x0008 /* pswd has expired */
769 #define FL_RC_WILL_ABORT 0x0010 /* recvd 157 on SendObj or SendData */
770 #define FL_END_DATA_DONE 0x0020 /* Get error already did EndData */
771
772 #define OPER_NONE 0 /* values for oper field */
773 #define OPER_SEND_START 1
774 #define OPER_SEND_ISSUED 2
775 #define OPER_RECV_START 3
776 #define OPER_RECV_ISSUED 4
777
778 /* structure def for objInfo - max len = 255 */
779 typedef struct
780 {
781 ResourceType resourceType; /* 31 bytes */
782 ObjectSize size; /* 8 bytes */
783 char partDesc[ADSM_MAX_DESC]; /* 100 bytes */
784 char partObjInfo[ADSM_MAX_OBJINFO]; /* 100 bytes */
785 } XAPIObjInfo;
786
787 /* ******* G l o b a l s ******** */
788
789 /* xGlobal xopenGbl; */
790
791 extern BSA_Int16 xlateRC(
792 long BSAHandle,
793 BSA_Int16 dsmRC,
794 BSA_Int16 *bsaRCP);
795
796 extern BSA_Int16 xparsePath(
797 long BSAHandle,
798 char *pathname,
799 char *hl,
800 char *ll);
801
802 extern xGlobal xopenGbl;
803 extern char traceStr[];
804 extern char traceStr1[];
805 extern char traceStr2[];
806
807 #define dsMalloc(a) malloc(a)
808 #define dsFree(a) free(a)
809
810 extern void StrUpper(char *s);
811 /* Min() and Max() macros */
812 #ifndef min
813 #define min(a,b) (((a) < (b)) ? (a) : (b))
814 #endif
815
816 #ifndef max
817 #define max(a,b) (((a) > (b)) ? (a) : (b))
818 #endif
819
820 /* Combined file name w/ line number */
821 #define TrFL __FILE__, __LINE__
822
823 /*=== MACRO for exit tracing ===*/
824 #define XOPENRETURN(BSAHandle,functionName,bsaRC,fileName,lineNumber) {sprintf(traceStr2,"%s EXIT: rc = >%d<.",functionName, bsaRC); ourTrace(BSAHandle,fileName,lineNumber,traceStr2); return(bsaRC);}
825
826 /* Define license error log file name */
827 #define TSMLicLog "tsmlic.log"
828
829 #define custMin_retcode 96
830 #define custMax_retcode 104
831
832 /*=======================================================
833 Function to places a trace message in the API tracefile,
834 the message includes the xopen file name and line number.
835 ======================================================*/
836 void ourTrace(long BSAHandle,
837 char *fileName,
838 int lineNumber,
839 char *traceStr2);
840
841 /*================================================
842 Function to log events with call to dsmLogEventEx
843 ===============================================*/
844 void ourLogEvent_Ex(dsUint32_t handle, dsmLogType type, char* msg,
845 char *appMsg, dsmLogSeverity severity);
846
847 /*=================================================================
848 Function to retrieve a message by routing to dsmRCMsg or stdXOpenMsgMap.
849 ===============================================================*/
850 char* ourRCMsg(dsInt16_t dsmRC, char *msg);
851
852 /*====================================================
853 Function to build fully qualified license file name.
854 void build_lfname(char *lfname
855 ========================================================*/
856 extern void build_lfname(char *lfname);
857
858 /*=== Function to deliver standard XOpen API message above API range. */
859 void stdXOpenMsgMap(dsInt16_t, char*);
860
861
862 #endif /* xbsa */