Finish removing sunos 4.x references and build cruft
[openafs.git] / src / butc / afsxbsa.h
index 5d437da..1ac3e57 100644 (file)
@@ -1,24 +1,20 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
-#ifndef _BSA_XBSA_H_                                                            
-#define _BSA_XBSA_H_                                                            
-                                                                                
+#ifndef _BSA_XBSA_H_
+#define _BSA_XBSA_H_
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#if (SYS_V > 3) || defined(BERK4_2) || defined(SUN4)
-#include <sys/time.h>
-#else
 #include <time.h>
-#endif
 
 #ifdef bool_t
 #undef bool_t
@@ -28,7 +24,7 @@ extern "C" {
 #include <dsmapitd.h>
 #include <dsmapifp.h>
 #include <dsmrc.h>
-                                                                                
+
 /* BSA_Boolean  */
 typedef char BSA_Boolean;
 
@@ -36,7 +32,7 @@ typedef char BSA_Boolean;
 typedef short BSA_Int16;
 
 /* BSA_Int32 */
-typedef long BSA_Int32;     
+typedef long BSA_Int32;
 
 /* BSA_Int64  */
 typedef struct {    /* defined as two 32-bit integers */
@@ -90,10 +86,10 @@ typedef struct {        /* defined as two unsigned 32-bit integers*/
 #define ADSM_RC_PSWD_TOO_LONG               0x67 /* pswd  too long            */
 #define ADSM_RC_PSWD_GEN                    0x68 /* pswd access = generate    */
 
-/* Constants used                                                               
- *                                                                              
- * Maximum string lengths (lower bound), including trailing null                
- */                                                                             
+/* Constants used
+ *
+ * Maximum string lengths (lower bound), including trailing null
+ */
 #define BSA_LIST_ELEMENT_DELIMITER  null    /* Element delimiter in list      */
 #define BSA_MAX_ADMIN_NAME          64      /* Administrator name             */
 #define BSA_MAX_APPOBJECT_OWNER     64      /* Max end-object owner length    */
@@ -123,340 +119,340 @@ typedef struct {        /* defined as two unsigned 32-bit integers*/
 #define BSA_MAX_RESOURCETYPE        31      /* Max resource mgr name length   */
 #define BSA_MAX_TOKEN_SIZE          64      /* Max size of a security token   */
 #define BSA_PUBLIC              "BSA_ANY"   /* Default string                 */
-                                                                                
-/* Return Codes Used                                                            
- *                                                                              
- * Return Code descriptions are given in Section 4.3.                           
- */                                                                             
-#define BSA_RC_ABORT_ACTIVE_NOT_FOUND       0x02                                
-#define BSA_RC_ABORT_SYSTEM_ERROR           0x03                                
-#define BSA_RC_AUTHENTICATION_FAILURE       0x04                                
-#define BSA_RC_BAD_CALL_SEQUENCE            0x05                                
-#define BSA_RC_BAD_HANDLE                   0x06                                
-#define BSA_RC_BUFFER_TOO_SMALL             0x07                                
-#define BSA_RC_DESC_TOO_LONG                0x08                                
-#define BSA_RC_OBJECTSPACE_TOO_LONG         0x09                                
-#define BSA_RC_INVALID_TOKEN                0x0a                                
-#define BSA_RC_INVALID_VOTE                 0x0b                                
-#define BSA_RC_INVALID_KEYWORD              0x0c                                
-#define BSA_RC_MATCH_EXISTS                 0x0d                                
-#define BSA_RC_MORE_DATA                    0x0e                                
-#define BSA_RC_MORE_RULES                   0x0f                                
-#define BSA_RC_NEWTOKEN_REQD                0x10                                
-#define BSA_RC_NO_MATCH                     0x11                                
-#define BSA_RC_NO_MORE_DATA                 0x12                                
-#define BSA_RC_NO_RESOURCES                 0x13                                
-#define BSA_RC_NULL_DATABLKPTR              0x14                                
-#define BSA_RC_NULL_OBJNAME                 0x15                                
-#define BSA_RC_NULL_POINTER                 0x16                                
-#define BSA_RC_NULL_RULEID                  0x17                                
-#define BSA_RC_OBJECT_NAME_TOO_LONG         0x18                                
-#define BSA_RC_OBJECT_NOT_EMPTY             0x19                                
-#define BSA_RC_OBJECT_NOT_FOUND             0x1a                                
-#define BSA_RC_OBJINFO_TOO_LONG             0x1b                                
-#define BSA_RC_OBJNAME_TOO_LONG             0x1c                                
-#define BSA_RC_OPERATION_NOT_AUTHORIZED     0x1d                                
-#define BSA_RC_OLDTOKEN_REQD                0x1e                                
-#define BSA_RC_TOKEN_EXPIRED                0x1f                                
-#define BSA_RC_TXN_ABORTED                  0x20                                
-#define BSA_RC_UNMATCHED_QUOTE              0x21                                
-#define BSA_RC_USER_OWNS_OBJECTS            0x22                                
-                                                                                
-/* AppObjectOwner                                                               
- */                                                                             
-typedef char AppObjectOwner[BSA_MAX_APPOBJECT_OWNER];                           
-                                                                                
-/* BSAObjectOwner                                                               
- */                                                                             
-typedef char BSAObjectOwner[BSA_MAX_BSAOBJECT_OWNER];                           
-                                                                                
-/* CopyGpDest                                                                   
- */                                                                             
-typedef char CopyGpDest[BSA_MAX_CG_DEST];                                       
-                                                                                
-/* CopyGpName                                                                   
- */                                                                             
-typedef char CopyGpName[BSA_MAX_CG_NAME];                                       
-                                                                                
-/* CopyMode                                                                     
- *                                                                              
- * Constant     Value     Explanation                                           
- * --------     -----     -----------                                           
- * INCREMENTAL  1         Specifies that the Backup Services should make a      
- *                        copy only if the application object has been          
- *                        modified since the last time this copy group was      
- *                        used to create the object's copy.                     
- * ABSOLUTE     2         Specifies that the Backup Services should make a      
- *                        copy even if the application object has not been      
- *                        modified since the last time this copy group was      
- *                        used to create the object's copy.                     
- */                                                                             
-typedef enum {                                                                  
-    BSACopyMode_INCREMENTAL = 1,                                                
-    BSACopyMode_ABSOLUTE = 2                                                    
-} CopyMode;                                                                     
-                                                                                
-/* CopySerialization                                                            
- *                                                                              
- * Constant     Value     Explanation                                           
- * --------     -----     -----------                                           
- * STATIC       1         Specifies that the Backup Services must create a      
- *                        consistent (unmodified during the operation) copy of  
- *                        the object.  If the application is unable to create a 
- *                        consistent copy then it should skip the operation     
- *                        (creating backup or archive copy) for the object.     
- * SHAREDSTATIC 2         Specifies that the Backup Services must create a      
- *                        consistent copy of the object.  It can retry the      
- *                        operation a number of times (application dependent).  
- *                        If the Backup Services is unable to create a          
- *                        consistent copy even after retries, then it should    
- *                        skip creating a backup or archive copy of the         
- *                        object.                                               
- * SHAREDDYNAMIC 3        Specifies that the Backup Services must create a      
- *                        copy of the object.  It can retry the operation a     
- *                        number of times in an attempt to create a consistent  
- *                        copy; however, if it fails to make a consistent       
- *                        copy, a copy must still be made, ignoring the fact    
- *                        that the copy may have been modified during the       
- *                        operation.  Such copies are useful for log file       
- *                        objects which are being continuously modified.        
- * DYNAMIC      4         Specifies that the Backup Services must create a      
- *                        copy of the obbject even if the source object is      
- *                        modified during the operation.  No retries should be  
- *                        attempted to create a consistent copy.                
- */                                                                             
-typedef enum {                                                                  
-    BSACopySerialization_STATIC = 1,                                            
-    BSACopySerialization_SHAREDSTATIC = 2,                                      
-    BSACopySerialization_SHAREDDYNAMIC = 3,                                     
-    BSACopySerialization_DYNAMIC = 4                                            
-} CopySerialization;                                                            
-                                                                                
-/* CopyType                                                                     
- *                                                                              
- * Constant     Value     Explanation                                           
- * --------     -----     -----------                                           
- * ANY          1         Used for matching any copy type (e.g. "backup" or     
- *                        "archive" in the copy type field of structures for    
- *                        selecting query results).                             
- * ARCHIVE      2         Specifies that the copy type should be "archive".     
- *                        When used in the copy type field of the CopyGroup,    
- *                        it identifies the copy data as of type                
- *                        ArchiveCopyData, which is used to create archive      
- *                        copies.                                               
- * BACKUP       3         Specifies that the copy type should be "backup".      
- *                        When used in the copy type field of the CopyGroup,    
- *                        it identifies the copy data as of type                
- *                        BackupCopyData, which is used to create backup        
- *                        copies.                                               
- */                                                                             
-typedef enum {                                                                  
-    BSACopyType_ANY = 1,                                                        
-    BSACopyType_ARCHIVE = 2,                                                    
-    BSACopyType_BACKUP = 3                                                      
-} CopyType;                                                                     
-                                                                                
-/* Description                                                                  
- */                                                                             
-typedef char Description[BSA_MAX_DESC];                                         
-                                                                                
-/* DomainName                                                                   
- */                                                                             
-typedef char * DomainName[BSA_MAX_POLICYDOMAIN_NAME];                           
-                                                                                
-/* EventInfo                                                                    
- */                                                                             
-typedef char EventInfo[BSA_MAX_EVENTINFO];                                      
-                                                                                
-/* LGName                                                                       
- */                                                                             
-typedef char LGName[BSA_MAX_LG_NAME];                                           
-                                                                                
-/* ObjectInfo                                                                   
- */                                                                             
-typedef char ObjectInfo[BSA_MAX_OBJINFO];                                       
-                                                                                
-/* ObjectName                                                                   
- */                                                                             
-typedef struct {                                                                
-    char    objectSpaceName[BSA_MAX_OSNAME]; /* Highest-level name qualifier */ 
-    char    pathName[BSA_MAX_PATHNAME];      /* Object name within           */ 
-                                             /* objectspace                  */ 
-} ObjectName;                                                                   
-                                                                                
-/* ObjectOwner                                                                  
- */                                                                             
-typedef struct {                                                                
-    BSAObjectOwner  bsaObjectOwner;    /* BSA Owner name - this is the name  */ 
-                                       /* that Backup Services authenticates */ 
-    AppObjectOwner  appObjectOwner;    /* End-owner name, this is the name   */ 
-                                       /* defined by the application         */ 
-} ObjectOwner;                                                                  
-                                                                                
-/* ObjectSize                                                                   
- */                                                                             
-typedef BSA_UInt64 ObjectSize;         /* Unsigned 64-bit integer */            
-                                                                                
-/* ObjectStatus                                                                 
- *                                                                              
- * Constant     Value     Explanation                                           
- * --------     -----     -----------                                           
- * ANY          1         Provides a wild card function.  Can only be used in   
- *                        queries.                                              
- * ACTIVE       2         Indicates that this is the most recent backup copy    
- *                        of an object.                                         
- * INACTIVE     3         Indicates that this is not the most recent backup     
- *                        copy, or that the object itself no longer exists.     
- */                                                                             
-typedef enum {                                                                  
-    BSAObjectStatus_ANY = 1,                                                    
-    BSAObjectStatus_ACTIVE = 2,                                                 
-    BSAObjectStatus_INACTIVE = 3                                                
-} ObjectStatus;                                                                 
-                                                                                
-/* ObjectType                                                                   
- *                                                                              
- * Constant     Value     Explanation                                           
- * --------     -----     -----------                                           
- * any          1         Used for matching any object type (e.g. "file" or     
- *                        "directory") value in the object type field of        
- *                        structures for selecting query results.               
- * file         2         Used by the application to indicate that the type of  
- *                        application object is a "file" or single object.      
- * directory    3         Used by the application to indicate that the type of  
- *                        application object is a "directory" or container of   
- *                        objects.                                              
- */                                                                             
+
+/* Return Codes Used
+ *
+ * Return Code descriptions are given in Section 4.3.
+ */
+#define BSA_RC_ABORT_ACTIVE_NOT_FOUND       0x02
+#define BSA_RC_ABORT_SYSTEM_ERROR           0x03
+#define BSA_RC_AUTHENTICATION_FAILURE       0x04
+#define BSA_RC_BAD_CALL_SEQUENCE            0x05
+#define BSA_RC_BAD_HANDLE                   0x06
+#define BSA_RC_BUFFER_TOO_SMALL             0x07
+#define BSA_RC_DESC_TOO_LONG                0x08
+#define BSA_RC_OBJECTSPACE_TOO_LONG         0x09
+#define BSA_RC_INVALID_TOKEN                0x0a
+#define BSA_RC_INVALID_VOTE                 0x0b
+#define BSA_RC_INVALID_KEYWORD              0x0c
+#define BSA_RC_MATCH_EXISTS                 0x0d
+#define BSA_RC_MORE_DATA                    0x0e
+#define BSA_RC_MORE_RULES                   0x0f
+#define BSA_RC_NEWTOKEN_REQD                0x10
+#define BSA_RC_NO_MATCH                     0x11
+#define BSA_RC_NO_MORE_DATA                 0x12
+#define BSA_RC_NO_RESOURCES                 0x13
+#define BSA_RC_NULL_DATABLKPTR              0x14
+#define BSA_RC_NULL_OBJNAME                 0x15
+#define BSA_RC_NULL_POINTER                 0x16
+#define BSA_RC_NULL_RULEID                  0x17
+#define BSA_RC_OBJECT_NAME_TOO_LONG         0x18
+#define BSA_RC_OBJECT_NOT_EMPTY             0x19
+#define BSA_RC_OBJECT_NOT_FOUND             0x1a
+#define BSA_RC_OBJINFO_TOO_LONG             0x1b
+#define BSA_RC_OBJNAME_TOO_LONG             0x1c
+#define BSA_RC_OPERATION_NOT_AUTHORIZED     0x1d
+#define BSA_RC_OLDTOKEN_REQD                0x1e
+#define BSA_RC_TOKEN_EXPIRED                0x1f
+#define BSA_RC_TXN_ABORTED                  0x20
+#define BSA_RC_UNMATCHED_QUOTE              0x21
+#define BSA_RC_USER_OWNS_OBJECTS            0x22
+
+/* AppObjectOwner
+ */
+typedef char AppObjectOwner[BSA_MAX_APPOBJECT_OWNER];
+
+/* BSAObjectOwner
+ */
+typedef char BSAObjectOwner[BSA_MAX_BSAOBJECT_OWNER];
+
+/* CopyGpDest
+ */
+typedef char CopyGpDest[BSA_MAX_CG_DEST];
+
+/* CopyGpName
+ */
+typedef char CopyGpName[BSA_MAX_CG_NAME];
+
+/* CopyMode
+ *
+ * Constant     Value     Explanation
+ * --------     -----     -----------
+ * INCREMENTAL  1         Specifies that the Backup Services should make a
+ *                        copy only if the application object has been
+ *                        modified since the last time this copy group was
+ *                        used to create the object's copy.
+ * ABSOLUTE     2         Specifies that the Backup Services should make a
+ *                        copy even if the application object has not been
+ *                        modified since the last time this copy group was
+ *                        used to create the object's copy.
+ */
+typedef enum {
+    BSACopyMode_INCREMENTAL = 1,
+    BSACopyMode_ABSOLUTE = 2
+} CopyMode;
+
+/* CopySerialization
+ *
+ * Constant     Value     Explanation
+ * --------     -----     -----------
+ * STATIC       1         Specifies that the Backup Services must create a
+ *                        consistent (unmodified during the operation) copy of
+ *                        the object.  If the application is unable to create a
+ *                        consistent copy then it should skip the operation
+ *                        (creating backup or archive copy) for the object.
+ * SHAREDSTATIC 2         Specifies that the Backup Services must create a
+ *                        consistent copy of the object.  It can retry the
+ *                        operation a number of times (application dependent).
+ *                        If the Backup Services is unable to create a
+ *                        consistent copy even after retries, then it should
+ *                        skip creating a backup or archive copy of the
+ *                        object.
+ * SHAREDDYNAMIC 3        Specifies that the Backup Services must create a
+ *                        copy of the object.  It can retry the operation a
+ *                        number of times in an attempt to create a consistent
+ *                        copy; however, if it fails to make a consistent
+ *                        copy, a copy must still be made, ignoring the fact
+ *                        that the copy may have been modified during the
+ *                        operation.  Such copies are useful for log file
+ *                        objects which are being continuously modified.
+ * DYNAMIC      4         Specifies that the Backup Services must create a
+ *                        copy of the obbject even if the source object is
+ *                        modified during the operation.  No retries should be
+ *                        attempted to create a consistent copy.
+ */
+typedef enum {
+    BSACopySerialization_STATIC = 1,
+    BSACopySerialization_SHAREDSTATIC = 2,
+    BSACopySerialization_SHAREDDYNAMIC = 3,
+    BSACopySerialization_DYNAMIC = 4
+} CopySerialization;
+
+/* CopyType
+ *
+ * Constant     Value     Explanation
+ * --------     -----     -----------
+ * ANY          1         Used for matching any copy type (e.g. "backup" or
+ *                        "archive" in the copy type field of structures for
+ *                        selecting query results).
+ * ARCHIVE      2         Specifies that the copy type should be "archive".
+ *                        When used in the copy type field of the CopyGroup,
+ *                        it identifies the copy data as of type
+ *                        ArchiveCopyData, which is used to create archive
+ *                        copies.
+ * BACKUP       3         Specifies that the copy type should be "backup".
+ *                        When used in the copy type field of the CopyGroup,
+ *                        it identifies the copy data as of type
+ *                        BackupCopyData, which is used to create backup
+ *                        copies.
+ */
+typedef enum {
+    BSACopyType_ANY = 1,
+    BSACopyType_ARCHIVE = 2,
+    BSACopyType_BACKUP = 3
+} CopyType;
+
+/* Description
+ */
+typedef char Description[BSA_MAX_DESC];
+
+/* DomainName
+ */
+typedef char * DomainName[BSA_MAX_POLICYDOMAIN_NAME];
+
+/* EventInfo
+ */
+typedef char EventInfo[BSA_MAX_EVENTINFO];
+
+/* LGName
+ */
+typedef char LGName[BSA_MAX_LG_NAME];
+
+/* ObjectInfo
+ */
+typedef char ObjectInfo[BSA_MAX_OBJINFO];
+
+/* ObjectName
+ */
+typedef struct {
+    char    objectSpaceName[BSA_MAX_OSNAME]; /* Highest-level name qualifier */
+    char    pathName[BSA_MAX_PATHNAME];      /* Object name within           */
+                                             /* objectspace                  */
+} ObjectName;
+
+/* ObjectOwner
+ */
+typedef struct {
+    BSAObjectOwner  bsaObjectOwner;    /* BSA Owner name - this is the name  */
+                                       /* that Backup Services authenticates */
+    AppObjectOwner  appObjectOwner;    /* End-owner name, this is the name   */
+                                       /* defined by the application         */
+} ObjectOwner;
+
+/* ObjectSize
+ */
+typedef BSA_UInt64 ObjectSize;         /* Unsigned 64-bit integer */
+
+/* ObjectStatus
+ *
+ * Constant     Value     Explanation
+ * --------     -----     -----------
+ * ANY          1         Provides a wild card function.  Can only be used in
+ *                        queries.
+ * ACTIVE       2         Indicates that this is the most recent backup copy
+ *                        of an object.
+ * INACTIVE     3         Indicates that this is not the most recent backup
+ *                        copy, or that the object itself no longer exists.
+ */
+typedef enum {
+    BSAObjectStatus_ANY = 1,
+    BSAObjectStatus_ACTIVE = 2,
+    BSAObjectStatus_INACTIVE = 3
+} ObjectStatus;
+
+/* ObjectType
+ *
+ * Constant     Value     Explanation
+ * --------     -----     -----------
+ * any          1         Used for matching any object type (e.g. "file" or
+ *                        "directory") value in the object type field of
+ *                        structures for selecting query results.
+ * file         2         Used by the application to indicate that the type of
+ *                        application object is a "file" or single object.
+ * directory    3         Used by the application to indicate that the type of
+ *                        application object is a "directory" or container of
+ *                        objects.
+ */
 
 typedef enum {
     BSAObjectType_ANY  = 1,
     BSAObjectType_FILE    = 2,
     BSAObjectType_DIRECTORY = 3
  } ObjectType;
-                                                                                
-/* Operation                                                                    
- *                                                                              
- * Constant     Value     Explanation                                           
- * --------     -----     -----------                                           
- * archive      1         Used to indicate that a scheduled operation is of     
- *                        type "archive".                                       
- * backup       2         Used to indicate that a scheduled operation is of     
- *                        type "backup".                                        
- */                                                                             
-typedef enum {                                                                  
-    BSAOperation_ARCHIVE = 1,                                                   
-    BSAOperation_BACKUP  = 2                                                    
-} Operation;                                                                    
-                                                                                
-/* Period                                                                       
- *                                                                              
- * Use of the Period structure in a Schedule for an event:                      
- * 1. The Schedule structure specifies 3 timing elements:                       
- *    a. "firstStartTime" - a timestamp showing the "earliest"                  
- *        possible time the event could take place                              
- *    b. "day" - the day of the week the event should occur                     
- *    c. "frequency" - the period between successive events                     
- * 2. To determine the day the event should occur (this does                    
- *    not change the time of the event in the day):                             
- *    a. Determine the requested day from "firstStartTime".                     
- *    b. If "day" does not equal XBSA_DAYOFWEEK_ANY                             
- *       i. Compare "day" to the day of the week corresponding                  
- *          to "firstStartTime" determined in 2a above.                         
- *       ii.If the days match, then use "firstStartTime" else                   
- *          use the first "day" *following* the day shown                       
- *          in "firstStartTime" as the day of the event.                        
- * 3. If the PeriodWhich field in the Period structure is other                 
- *    than XBSA_PERIOD_UNDEFINED, then successive events are                    
- *    determined using the value of "periodData".                               
- *    a. For seconds and days, the appropriate seconds or days                  
- *       are added to the "firstStartTime" and step 2 to correct                
- *       for the day of the week (if needed) is applied again.                  
- *    b. If a monthly period is specified, then the appropriate                 
- *       number of months are added by incrementing the month index is          
- *       made (for example, a one month increment from February to              
- *       March).  If the monthly date is not valid (for example, January        
- *       30 --> February 30) then the last day of the desired month is          
- *       used (example January 30 --> February 28).  Then step 2 is             
- *       followed to adjust for the requested day (which might move the         
- *       event time into the following month).                                  
- */                                                                             
-typedef enum {                                                                  
-    BSAPeriod_SECONDS = 1,                                                      
-    BSAPeriod_DAYS = 2,                                                         
-    BSAPeriod_MONTHS = 3,                                                       
-    BSAPeriod_UNDEFINED = -9,                                                   
-    BSAPeriod_DAILY = 4, BSAPeriod_WEEKLY = 5, BSAPeriod_MONTHLY = 6,           
-    BSAPeriod_QUARTERLY = 7, BSAPeriod_ANNUALLY = 8                             
-} PeriodWhich;                                                                  
-                                                                                
-typedef struct {                                                                
-    PeriodWhich     which;                                                      
-    union {                                                                     
-        time_t      nSeconds;                                                   
-        BSA_Int16   nDays;                                                      
-        BSA_Int16   nMonths;                                                    
-    } periodData;                                                               
-} Period;                                                                       
-                                                                                
-/* ResourceType                                                                 
- */                                                                             
-typedef char ResourceType[BSA_MAX_RESOURCETYPE];                                
-                                                                                
-/* RuleId                                                                       
- */                                                                             
-typedef BSA_UInt64 RuleId;                                                      
-                                                                                
-/* Scheduleid                                                                   
- */                                                                             
-typedef BSA_UInt64 ScheduleId;                                                  
-                                                                                
-/* AccessRight                                                                  
- *                                                                              
- * Constant     Value     Explanation                                           
- * --------     -----     -----------                                           
- * GET          1         Access right for getting an object from Backup        
- *                        Services, also includes access right for querying     
- *                        (getting attributes) an object from Backup Services.  
- * QUERY        2         Access right for querying (getting attributes) an     
- *                        object from Backup Services.                          
- */                                                                             
-typedef enum {                                                                  
-    BSAAccessRight_GET  = 1,                                                    
-    BSAAcessRight_QUERY = 2                                                     
-} AccessRight;                                                                  
-                                                                                
-/* AccessRule                                                                   
- */                                                                             
-typedef struct {                                                                
+
+/* Operation
+ *
+ * Constant     Value     Explanation
+ * --------     -----     -----------
+ * archive      1         Used to indicate that a scheduled operation is of
+ *                        type "archive".
+ * backup       2         Used to indicate that a scheduled operation is of
+ *                        type "backup".
+ */
+typedef enum {
+    BSAOperation_ARCHIVE = 1,
+    BSAOperation_BACKUP  = 2
+} Operation;
+
+/* Period
+ *
+ * Use of the Period structure in a Schedule for an event:
+ * 1. The Schedule structure specifies 3 timing elements:
+ *    a. "firstStartTime" - a timestamp showing the "earliest"
+ *        possible time the event could take place
+ *    b. "day" - the day of the week the event should occur
+ *    c. "frequency" - the period between successive events
+ * 2. To determine the day the event should occur (this does
+ *    not change the time of the event in the day):
+ *    a. Determine the requested day from "firstStartTime".
+ *    b. If "day" does not equal XBSA_DAYOFWEEK_ANY
+ *       i. Compare "day" to the day of the week corresponding
+ *          to "firstStartTime" determined in 2a above.
+ *       ii.If the days match, then use "firstStartTime" else
+ *          use the first "day" *following* the day shown
+ *          in "firstStartTime" as the day of the event.
+ * 3. If the PeriodWhich field in the Period structure is other
+ *    than XBSA_PERIOD_UNDEFINED, then successive events are
+ *    determined using the value of "periodData".
+ *    a. For seconds and days, the appropriate seconds or days
+ *       are added to the "firstStartTime" and step 2 to correct
+ *       for the day of the week (if needed) is applied again.
+ *    b. If a monthly period is specified, then the appropriate
+ *       number of months are added by incrementing the month index is
+ *       made (for example, a one month increment from February to
+ *       March).  If the monthly date is not valid (for example, January
+ *       30 --> February 30) then the last day of the desired month is
+ *       used (example January 30 --> February 28).  Then step 2 is
+ *       followed to adjust for the requested day (which might move the
+ *       event time into the following month).
+ */
+typedef enum {
+    BSAPeriod_SECONDS = 1,
+    BSAPeriod_DAYS = 2,
+    BSAPeriod_MONTHS = 3,
+    BSAPeriod_UNDEFINED = -9,
+    BSAPeriod_DAILY = 4, BSAPeriod_WEEKLY = 5, BSAPeriod_MONTHLY = 6,
+    BSAPeriod_QUARTERLY = 7, BSAPeriod_ANNUALLY = 8
+} PeriodWhich;
+
+typedef struct {
+    PeriodWhich     which;
+    union {
+        time_t      nSeconds;
+        BSA_Int16   nDays;
+        BSA_Int16   nMonths;
+    } periodData;
+} Period;
+
+/* ResourceType
+ */
+typedef char ResourceType[BSA_MAX_RESOURCETYPE];
+
+/* RuleId
+ */
+typedef BSA_UInt64 RuleId;
+
+/* Scheduleid
+ */
+typedef BSA_UInt64 ScheduleId;
+
+/* AccessRight
+ *
+ * Constant     Value     Explanation
+ * --------     -----     -----------
+ * GET          1         Access right for getting an object from Backup
+ *                        Services, also includes access right for querying
+ *                        (getting attributes) an object from Backup Services.
+ * QUERY        2         Access right for querying (getting attributes) an
+ *                        object from Backup Services.
+ */
+typedef enum {
+    BSAAccessRight_GET  = 1,
+    BSAAcessRight_QUERY = 2
+} AccessRight;
+
+/* AccessRule
+ */
+typedef struct {
     RuleId          ruleId;         /* Provided by Backup Services            */
     ObjectName      objName;        /* Object name to be given access         */
     ObjectOwner     objectOwner;    /* BSA object owner and Applicaton object */
                                     /* owner to be given access               */
     AccessRight     rights;         /* The access rights to be given          */
-} AccessRule;                                                                   
-                                                                                
-/* ApiVersion                                                                   
- */                                                                             
-typedef struct {                                                                
+} AccessRule;
+
+/* ApiVersion
+ */
+typedef struct {
     BSA_UInt16      version;        /* Version of this API                    */
     BSA_UInt16      release;        /* Release of this API                    */
     BSA_UInt16      level;          /* Level of this API                      */
-} ApiVersion;                                                                   
-                                                                                
-/* ArchiveCopyData                                                              
- */                                                                             
-typedef struct {                                                                
+} ApiVersion;
+
+/* ArchiveCopyData
+ */
+typedef struct {
     CopyGpName          cGName;     /* Copy group name                        */
     BSA_UInt16          freq;       /* Archive frequency                      */
     CopySerialization   copySer;    /* Copy serialization code                */
     CopyMode            copyMode;   /* Copy mode                              */
     CopyGpDest          destName;   /* Copy destination name                  */
     BSA_UInt16          retVersion; /* Retention time for the version         */
-} ArchiveCopyData;                                                              
-                                                                                
-/* BackupCopyData                                                               
- */                                                                             
-typedef struct {                                                                
+} ArchiveCopyData;
+
+/* BackupCopyData
+ */
+typedef struct {
     CopyGpName          cGName;     /* Copy group name                        */
     BSA_UInt16          freq;       /* Backup frequency                       */
     CopySerialization   copySer;    /* Copy serialization code                */
@@ -467,55 +463,55 @@ typedef struct {
     BSA_UInt16          verDataDel; /* Versions (data deleted)                */
     Period              retXtraVer; /* Retain extra versions                  */
     Period              retOnlyVer; /* Retain only versions                   */
-} BackupCopyData;                                                               
-                                                                                
-/* CopyGroup                                                                    
- */                                                                             
-typedef struct {                                                                
+} BackupCopyData;
+
+/* CopyGroup
+ */
+typedef struct {
     CopyType    copyType;       /* Type of copy group: archive, backup, etc   */
-    union {                                                                     
-        ArchiveCopyData archive;                                                
-        BackupCopyData  backup;                                                 
-    } copyData;                                                                 
-} CopyGroup;                                                                    
-                                                                                
-/* CopyId                                                                       
- */                                                                             
-typedef BSA_UInt64      CopyId;                                                 
-                                                                                
-/* DataBlock                                                                    
- */                                                                             
-typedef struct {                                                                
-    BSA_UInt16  bufferLen;                                                      
-    BSA_UInt16  numBytes;       /* Actual number of bytes read from */          
-                                /* or written to the buffer, or the */          
-                                /* minimum number of bytes needed   */          
-    char *      bufferPtr;                                                      
-} DataBlock;                                                                    
-                                                                                
-/* DayOfWeek                                                                    
- */                                                                             
-typedef enum {                                                                  
-    BSADayOfWeek_Monday = 1,    BSADayOfWeek_Tuesday = 2,                       
-    BSADayOfWeek_Wednesday = 3, BSADayOfWeek_Thursday = 4,                      
-    BSADayOfWeek_Friday = 5,    BSADayOfWeek_Saturday = 6,                      
-    BSADayOfWeek_Sunday = 7                                                     
-} DayOfWeek;                                                                    
-                                                                                
-/* Environment                                                                  
- */                                                                             
-typedef struct {                                                                
+    union {
+        ArchiveCopyData archive;
+        BackupCopyData  backup;
+    } copyData;
+} CopyGroup;
+
+/* CopyId
+ */
+typedef BSA_UInt64      CopyId;
+
+/* DataBlock
+ */
+typedef struct {
+    BSA_UInt16  bufferLen;
+    BSA_UInt16  numBytes;       /* Actual number of bytes read from */
+                                /* or written to the buffer, or the */
+                                /* minimum number of bytes needed   */
+    char *      bufferPtr;
+} DataBlock;
+
+/* DayOfWeek
+ */
+typedef enum {
+    BSADayOfWeek_Monday = 1,    BSADayOfWeek_Tuesday = 2,
+    BSADayOfWeek_Wednesday = 3, BSADayOfWeek_Thursday = 4,
+    BSADayOfWeek_Friday = 5,    BSADayOfWeek_Saturday = 6,
+    BSADayOfWeek_Sunday = 7
+} DayOfWeek;
+
+/* Environment
+ */
+typedef struct {
     char * envVariables; /* Identifies the Backup Services instance and other */
                          /* implementation-dependent variables such as        */
                          /* communication ports, etc.  Each variable is a     */
                          /* (keyword, value) pair separated by a space.       */
                          /* If a value contains spaces, it must be            */
                          /* enclosed in single or double quotes.              */
-} BSAEnvironment;                                                               
-                                                                                
-/* Event                                                                        
- */                                                                             
-typedef struct {                                                                
+} BSAEnvironment;
+
+/* Event
+ */
+typedef struct {
     BSA_UInt32      eventId;    /* This is an internal (to Backup Services) id*/
     ObjectOwner     objectOwner;/* Identifies the owner of the event          */
     struct tm       time;       /* Identifies the time the action is to start */
@@ -524,15 +520,15 @@ typedef struct {
     ResourceType    resourceType;/* Identifies the resource manager for the   */
                                  /* event                                     */
     EventInfo       eventInfo;  /* User- and resource-manager-specific info   */
-} BSAEvent;                                                                     
-                                                                                
-/* MethodName                                                                   
- */                                                                             
-typedef char EncodingMethod[BSA_MAX_ENCODINGMETHOD];                            
-                                                                                
-/* ObjectDescriptor                                                             
- */                                                                             
-typedef struct {                                                                
+} BSAEvent;
+
+/* MethodName
+ */
+typedef char EncodingMethod[BSA_MAX_ENCODINGMETHOD];
+
+/* ObjectDescriptor
+ */
+typedef struct {
     BSA_UInt32      version;        /* Version number for this structure      */
     ObjectOwner     Owner;          /* Owner of the object                    */
     ObjectName      objName;        /* Object name                            */
@@ -552,11 +548,11 @@ typedef struct {
                                     /* terminated with a null entry           */
     Description     desc;           /* Descriptive label for the object       */
     ObjectInfo      objectInfo;     /* Application information                */
-} ObjectDescriptor;                                                             
-                                                                                
-/* QueryDescriptor                                                              
- */                                                                             
-typedef struct {                                                                
+} ObjectDescriptor;
+
+/* QueryDescriptor
+ */
+typedef struct {
     ObjectOwner     owner;          /* Owner of the object                    */
     ObjectName      objName;        /* Object name                            */
     struct tm       createTimeLB;   /* Lower bound on create time             */
@@ -575,10 +571,10 @@ typedef struct {
                                     /* wild card.                             */
                                     /* Any undefined value is interpreted as  */
                                     /* an error.                              */
-                                                                                
-/* Schedule                                                                     
- */                                                                             
-typedef struct {                                                                
+
+/* Schedule
+ */
+typedef struct {
     ScheduleId      schedId;        /* Provided by Backup Services            */
     ObjectOwner     objectOwner;    /* Specifies the owner of the schedule    */
     Operation       operation;      /* Specifies the action to be taken       */
@@ -590,64 +586,64 @@ typedef struct {
     ResourceType    resourceType;   /* Identifies the resource manager for the*/
                                     /* schedule                               */
     EventInfo       scheduleInfo;   /* Resource manager specific information  */
-} Schedule;                                                                     
-                                                                                
-/* Security Token                                                               
- */                                                                             
-typedef char SecurityToken[BSA_MAX_TOKEN_SIZE];                                 
-                                                                                
-/* StreamHandle                                                                 
- */                                                                             
-typedef int StreamHandle;                                                       
-                                                                                
-/* UserDescriptor                                                               
- */                                                                             
-typedef struct t_UserDescriptor {                                               
+} Schedule;
+
+/* Security Token
+ */
+typedef char SecurityToken[BSA_MAX_TOKEN_SIZE];
+
+/* StreamHandle
+ */
+typedef int StreamHandle;
+
+/* UserDescriptor
+ */
+typedef struct t_UserDescriptor {
     BSA_UInt16      version;        /* Version num of this structure          */
-    BSAObjectOwner  bsaObjectOwner; /* BSA Object owner name              */    
-    DomainName      domainName;     /* Policy domain for the user         */    
-    Description     desc;           /* User information                   */    
-} UserDescriptor;                                                               
-                                                                                
-/* Vote                                                                         
- */                                                                             
-typedef enum {                                                                  
-    BSAVote_COMMIT = 1,                                                         
-    BSAVote_ABORT  = 2                                                          
-} Vote;                                                                         
-                                                                                
+    BSAObjectOwner  bsaObjectOwner; /* BSA Object owner name              */
+    DomainName      domainName;     /* Policy domain for the user         */
+    Description     desc;           /* User information                   */
+} UserDescriptor;
+
+/* Vote
+ */
+typedef enum {
+    BSAVote_COMMIT = 1,
+    BSAVote_ABORT  = 2
+} Vote;
+
 /* Function Prototypes for Data Movement API Subset
  * Note that int and long have been replaced with typedefs
  * from custom.h.
- */                                                                             
+ */
 
-extern BSA_Int16 
+extern BSA_Int16
 BSABeginTxn
 (      long              bsaHandle
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAChangeToken
 (      long              bsaHandle,
        SecurityToken    *oldTokenPtr,
        SecurityToken    *newTokenPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSACreateObject
 (      long              bsaHandle,
        ObjectDescriptor *objectDescriptorPtr,
        DataBlock        *dataBlockPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSACreateObjectF
 (      long              bsaHandle,
        ObjectDescriptor *objectDescriptorPtr,
        StreamHandle     *streamPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSADeleteObject
 (      long              bsaHandle,
        CopyType          copyType,
@@ -655,12 +651,12 @@ BSADeleteObject
        CopyId           *copyId
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAEndData
 (      long              bsaHandle
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAEndTxn
 (      long              bsaHandle,
        Vote              vote
@@ -672,34 +668,34 @@ BSAGetData
        DataBlock        *dataBlockPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAGetEnvironment
 (      long              bsaHandle,
        ObjectOwner      *objectOwnerPtr,
        char            **environmentPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAGetNextQueryObject
 (      long              bsaHandle,
        ObjectDescriptor *objectDescriptorPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAGetObject
 (      long              bsaHandle,
        ObjectDescriptor *objectDescriptorPtr,
        DataBlock        *dataBlockPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAGetObjectF
 (      long              bsaHandle,
        ObjectDescriptor *objectDescriptorPtr,
        StreamHandle     *streamPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAInit
 (      long             *bsaHandleP,
        SecurityToken    *tokenPtr,
@@ -707,37 +703,37 @@ BSAInit
        char            **environmentPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAMarkObjectInactive
 (      long              bsaHandle,
        ObjectName       *objectNamePtr
 );
 
-extern void 
+extern void
 BSAQueryApiVersion
 (      ApiVersion       *apiVersionPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSAQueryObject
 (      long              bsaHandle,
        QueryDescriptor  *queryDescriptorPtr,
        ObjectDescriptor *objectDescriptorPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSASendData
 (      long              bsaHandle,
        DataBlock        *dataBlockPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSASetEnvironment
 (      long              bsaHandle,
        char            **environmentPtr
 );
 
-extern BSA_Int16 
+extern BSA_Int16
 BSATerminate
 (      long              bsaHandle
 );