Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / butc / butc_xbsa.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 OPENAFS_BUTC_XBSA_H
11 #define OPENAFS_BUTC_XBSA_H
12
13 /* The following serverTypes are currently supported by this interface */
14 #define XBSA_SERVER_TYPE_NONE 0x00 /* no server, use tape drive */
15 #define XBSA_SERVER_TYPE_UNKNOWN 0x01 /* server, don't know which type yet */
16 #define XBSA_SERVER_TYPE_ADSM 0x02 /* server type is ADSM */
17 #define XBSA_SERVER_TYPE_MASK 0xFF /* for (butx_transactionInfo *)->serverType (byte 1) */
18
19 #ifdef xbsa
20 #define CONF_XBSA (xbsaType != XBSA_SERVER_TYPE_NONE) /*test if butc is XBSA */
21 #else
22 #define CONF_XBSA 0
23 #endif
24
25 #ifdef xbsa
26 #define XBSA_SET_SERVER_TYPE(server, type) ((server) = ((type) & XBSA_SERVER_TYPE_MASK))
27 #define XBSA_GET_SERVER_TYPE(server) ((server) & XBSA_SERVER_TYPE_MASK)
28
29 /* The following serverType flags are currently supported by this interface */
30 #define XBSA_SERVER_FLAG_NONE 0x0000 /* don't allow multiple server connections */
31 #define XBSA_SERVER_FLAG_MULTIPLE 0x0100 /* allow multiple server connections */
32 #define XBSA_SERVER_FLAG_MASK 0xFF00 /* for (butx_transactionInfo *)->serverType (byte 2) */
33 #define XBSA_SET_SERVER_FLAG(server, flag) ((server) |= ((flag) & XBSA_SERVER_FLAG_MASK))
34 #define XBSA_GET_SERVER_FLAG(server) ((server) & XBSA_SERVER_FLAG_MASK)
35 #define XBSA_IS_SERVER_FLAG_SET(server, flag) (XBSA_GET_SERVER_FLAG(server) & flag)
36
37 #define XBSAMINBUFFER 1024 /* minimum size is 1KB */
38 #define XBSADFLTBUFFER 16384 /* default size is 16KB */
39 #define XBSAMAXBUFFER 65535 /* maximum size in 64KB-1; has to fit in 16bit integer */
40
41 #ifdef NEW_XBSA
42 #include "afsxbsa.h"
43 #else
44 #include <xbsa.h>
45 #endif
46
47 #define XBSA_NUM_ENV_STRS ADSM_ENV_STRS
48 #define XBSA_MAX_OSNAME BSA_MAX_OSNAME
49 #define XBSA_MAX_PATHNAME BSA_MAX_PATHNAME
50
51 #define XBSA_SUCCESS 0
52
53 /* The following defines the ADSM version level prior to the addition
54 * of support for multiple servers.
55 */
56 #define XBSA_ADSM_NO_MULT_SERVER_VERSION 3
57 #define XBSA_ADSM_NO_MULT_SERVER_RELEASE 7
58 #define XBSA_ADSM_NO_MULT_SERVER_LEVEL 1
59
60 /* The following defines the XBSA Technical Standard Level */
61 #define XBSA_TS_VERSION 1
62 #define XBSA_TS_RELEASE 1
63
64 /*
65 * The butx_transactionInfo structure defines the connection to an
66 * XBSA server. The fields in this structure should only be modified
67 * by the routines in file_xbsa.c.
68 *
69 * The values in here are specific to the transaction.
70 * Values specific to the objects should be passed separately.
71 * The spec says bsaHandle should be a long but ADSM has it as a ulong!
72 */
73 struct butx_transactionInfo {
74 ApiVersion apiVersion;
75 #ifdef NEW_XBSA
76 long bsaHandle;
77 #else
78 u_long bsaHandle;
79 #endif
80 afs_int32 serverType; /* Type and flags */
81 afs_int32 maxObjects; /* max objects/transaction */
82 afs_int32 numObjects; /* objects in current trans */
83 char serverName[BSA_MAX_DESC];
84 SecurityToken secToken;
85 ObjectOwner objOwner;
86 ObjectDescriptor curObject;
87 };
88
89 extern afs_int32 xbsa_MountLibrary(struct butx_transactionInfo *info,
90 afs_int32 serverType);
91
92 extern afs_int32 xbsa_Initialize(struct butx_transactionInfo *info,
93 char *bsaObjectOwner, char *appObjectOwner,
94 char *secToken, char *serverName);
95
96 extern afs_int32 xbsa_Finalize(struct butx_transactionInfo *info);
97
98 extern afs_int32 xbsa_BeginTrans(struct butx_transactionInfo *info);
99
100 extern afs_int32 xbsa_EndTrans(struct butx_transactionInfo *info);
101
102 extern afs_int32 xbsa_QueryObject(struct butx_transactionInfo *info,
103 char *objectSpaceName, char *pathName);
104
105 extern afs_int32 xbsa_ReadObjectBegin(struct butx_transactionInfo *info,
106 char *dataBuffer, afs_int32 bufferSize,
107 afs_int32 * count,
108 afs_int32 * endOfData);
109
110 extern afs_int32 xbsa_ReadObjectEnd(struct butx_transactionInfo *info);
111
112 extern afs_int32 xbsa_WriteObjectBegin(struct butx_transactionInfo *info,
113 char *objectSpaceName, char *pathName,
114 char *lGName,
115 afs_hyper_t estimatedSize,
116 char *objectDescription,
117 char *objectInfo);
118
119 extern afs_int32 xbsa_WriteObjectEnd(struct butx_transactionInfo *info);
120
121 extern afs_int32 xbsa_WriteObjectData(struct butx_transactionInfo *info,
122 char *dataBuffer, afs_int32 bufferSize,
123 afs_int32 * count);
124
125 extern afs_int32 xbsa_ReadObjectData(struct butx_transactionInfo *info,
126 char *dataBuffer, afs_int32 bufferSize,
127 afs_int32 * count,
128 afs_int32 * endOfData);
129
130 extern afs_int32 xbsa_DeleteObject(struct butx_transactionInfo *info,
131 char *objectSpaceName, char *pathName);
132
133 #endif /*xbsa */
134
135
136 /* XBSA Global Parameters */
137
138 #ifdef XBSA_TCMAIN
139 #define XBSA_EXT
140 #else
141 #define XBSA_EXT extern
142 #endif
143
144 XBSA_EXT afs_int32 xbsaType;
145 #ifdef xbsa
146 XBSA_EXT struct butx_transactionInfo butxInfo;
147
148 #define rpc_c_protect_level_default 0
149 XBSA_EXT afs_uint32 dumpRestAuthnLevel;
150 XBSA_EXT char *xbsaObjectOwner;
151 XBSA_EXT char *appObjectOwner;
152 XBSA_EXT char *adsmServerName;
153 XBSA_EXT char *xbsaSecToken;
154 XBSA_EXT char *xbsalGName;
155 #endif /*xbsa*/
156 #endif /* OPENAFS_BUTC_XBSA_H */