-
-
/* xbsa.h
*
* This is a sample C header file describing the XBSA.
*
* This appendix is not a normative part of the
* specification and is provided for illustrative
* purposes only.
*
* Implementations must ensure that the sizes of integer
* datatypes match their names, not necessarily the typedefs
* presented in this example.
*
*/
#ifndef _XBSA_
#define _XBSA_
#include <time.h>
/* BSA_Int16
*/
typedef short BSA_Int16;
/* BSA_Int32
*/
typedef int BSA_Int32;
/* BSA_Int64
*/
typedef struct { /* defined as two 32-bit integers */
BSA_Int32 left;
BSA_Int32 right;
} BSA_Int64;
/* BSA_UInt16
*/
typedef unsigned short BSA_UInt16;
/* BSA_UInt32
*/
typedef unsigned int BSA_UInt32;
/* BSA_UInt64
*/
typedef struct { /* defined as two unsigned 32-bit integers*/
BSA_UInt32 left;
BSA_UInt32 right;
} BSA_UInt64;
/* BSA_ShareId
*/
typedef BSA_ShareId /* operating system dependent*/
/* Constants used
*
* Maximum string lengths (lower bound), including trailing null
*/
#define BSA_MAX_APPOBJECT_OWNER 64
#define BSA_MAX_BSAOBJECT_OWNER 64
#define BSA_MAX_DESCRIPTION 100
#define BSA_MAX_OBJECTSPACENAME 1024
#define BSA_MAX_OBJECTINFO 256
#define BSA_MAX_PATHNAME 1024
#define BSA_MAX_RESOURCETYPE 31
#define BSA_MAX_TOKEN_SIZE 64
/* Other constants */
#define BSA_ANY 1
/*
* Return Codes Used
*/
#define BSA_RC_ABORT_SYSTEM_ERROR 0x03
#define BSA_RC_ACCESS_FAILURE 0x4D
#define BSA_RC_AUTHENTICATION_FAILURE 0x04
#define BSA_RC_BUFFER_TOO_SMALL 0x4E
#define BSA_RC_INVALID_CALL_SEQUENCE 0x05
#define BSA_RC_INVALID_COPYID 0x4F
#define BSA_RC_INVALID_DATABLOCK 0x34
#define BSA_RC_INVALID_ENV 0x50
#define BSA_RC_INVALID_HANDLE 0x06
#define BSA_RC_INVALID_OBJECTDESCRIPTOR 0x51
#define BSA_RC_INVALID_QUERYDESCRIPTOR 0x53
#define BSA_RC_INVALID_VOTE 0x0B
#define BSA_RC_NO_MATCH 0x11
#define BSA_RC_NO_MORE_DATA 0x12
#define BSA_RC_NULL_ARGUMENT 0x55
#define BSA_RC_OBJECT_NOT_FOUND 0x1A
#define BSA_RC_SUCCESS 0x00
#define BSA_RC_TRANSACTION_ABORTED 0x20
#define BSA_RC_VERSION_NOT_SUPPORTED 0x4B
typedef enum {
BSA_CopyType_ANY = 1,
BSA_CopyType_ARCHIVE = 2,
BSA_CopyType_BACKUP = 3
} BSA_CopyType;
typedef enum {
BSA_ObjectStatus_ANY = 1,
BSA_ObjectStatus_MOST_RECENT = 2,
BSA_ObjectStatus_NOT_MOST_RECENT = 3
} BSA_ObjectStatus;
typedef enum {
BSA_ObjectType_ANY = 1,
BSA_ObjectType_FILE = 2,
BSA_ObjectType_DIRECTORY = 3,
BASBSA_ObjectType_OTHER = 4
} BSA_ObjectType;
typedef enum {
BSA_Vote_COMMIT = 1,
BSA_Vote_ABORT = 2
} BSA_Vote;
typedef struct {
BSA_UInt16 issue;
BSA_UInt16 version;
BSA_UInt16 level;
} BSA_ApiVersion;
typedef struct {
BSA_UInt32 bufferLen;
BSA_UInt32 numBytes;
BSA_UInt32 headerBytes;
BSA_ShareId shareId;
BSA_UInt32 shareOffset;
void *bufferPtr;
} BSA_DataBlock32;
typedef struct {
char objectSpaceName[BSA_MAX_OBJECTSPACENAME];
char pathName[BSA_MAX_PATHNAME];
} BSA_ObjectName;
typedef struct {
char bsa_ObjectOwner{BSA_MAX_BSAOBJECT_OWNER];
char app_ObjectOwner[BSA_MAX_APPOBJECT_OWNER];
} BSA_ObjectOwner;
typedef struct {
BSA_UInt32 rsv1;
BSA_ObjectOwner objectOwner;
BSA_ObjectName objectName;
struct tm createTime;
BSA_CopyType copyType;
BSA_UInt64 copyId;
BSA_UInt64 restoreOrder;
char rsv2[31];
char rsv3[31];
BSA_UInt64 estimatedSize;
char resourceType[BSA_MAX_RESOURCETYPE];
BSA_ObjectType objectType;
BSA_ObjectStatus objectStatus;
char *rsv4[31];
char objectDescription[BSA_MAX_DESCRIPTION];
unsigned char objectInfo[BSA_MAX_OBJECTINFO];
} BSA_ObjectDescriptor;
typedef struct {
BSA_ObjectOwner objectOwner;
BSA_ObjectName objectName;
struct tm rsv1;
struct tm rsv2;
struct tm rsv3;
struct tm rsv4;
BSA_CopyType copyType;
char rsv5[31];
char rsv6[31];
char rsv7[31];
BSA_ObjectType objectType;
BSA_ObjectStatus objectStatus;
char rsv8[100];
} BSA_QueryDescriptor;
typedef BSA_SecurityToken char[BSA_MAX_TOKEN_SIZE];
/* Function Prototypes
*/
int BSABeginTxn (long);
int BSACreateObject(long, BSA_ObjectDescriptor *, BSA_DataBlock32 *);
int BSADeleteObject(long, BSA_UInt64);
int BSAEndData(long);
int BSAEndTxn(long, BSA_Vote);
int BSAGetData(long, BSA_DataBlock32 *);
int BSAGetEnvironment(long, BSA_ObjectOwner *, char **);
int BSAGetLastError(BSA_UInt32 *, int *);
int BSAGetNextQueryObject(long, BSA_ObjectDescriptor *);
int BSAGetObject(long, BSA_ObjectDescriptor *, BSA_DataBlock32 *);
int BSAInit(long *, BSA_SecurityToken *, BSA_ObjectOwner *, char **);
int BSAQueryApiVersion(BSA_ApiVersion *);
int BSAQueryObject(long, BSA_QueryDescriptor *, BSA_ObjectDescriptor *);
int BSAQueryServiceProvider(BSA_UInt32 *, char *, char *);
int BSASendData(long, BSA_DataBlock32 *);
int BSATerminate(long);
#endif
Contents | Next section | Index |