xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdBwm
XrdBwm.hh
Go to the documentation of this file.
1
#ifndef __BWM_API_H__
2
#define __BWM_API_H__
3
/******************************************************************************/
4
/* */
5
/* X r d B w m . h h */
6
/* */
7
/* (c) 2008 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* Produced by Andrew Hanushevsky for Stanford University under contract */
9
/* DE-AC02-76-SFO0515 with the Department of Energy */
10
/* */
11
/* This file is part of the XRootD software suite. */
12
/* */
13
/* XRootD is free software: you can redistribute it and/or modify it under */
14
/* the terms of the GNU Lesser General Public License as published by the */
15
/* Free Software Foundation, either version 3 of the License, or (at your */
16
/* option) any later version. */
17
/* */
18
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21
/* License for more details. */
22
/* */
23
/* You should have received a copy of the GNU Lesser General Public License */
24
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26
/* */
27
/* The copyright holder's institutional names and contributor's names may not */
28
/* be used to endorse or promote products derived from this software without */
29
/* specific prior written permission of the institution or contributor. */
30
/******************************************************************************/
31
32
#include <string.h>
33
#include <dirent.h>
34
#include <sys/types.h>
35
36
#include "
XrdBwm/XrdBwmHandle.hh
"
37
#include "
XrdSys/XrdSysPthread.hh
"
38
#include "
XrdSfs/XrdSfsInterface.hh
"
39
40
class
XrdOucEnv
;
41
class
XrdSysError
;
42
class
XrdSysLogger
;
43
class
XrdOucStream
;
44
class
XrdSfsAio
;
45
46
struct
XrdVersionInfo
;
47
48
/******************************************************************************/
49
/* X r d B w m D i r e c t o r y */
50
/******************************************************************************/
51
52
class
XrdBwmDirectory
:
public
XrdSfsDirectory
53
{
54
public
:
55
56
int
open
(
const
char
*dirName,
57
const
XrdSecEntity
*client,
58
const
char
*opaque = 0);
59
60
const
char
*
nextEntry
();
61
62
int
close
();
63
64
inline
void
copyError
(
XrdOucErrInfo
&einfo) {einfo =
error
;}
65
66
const
char
*
FName
() {
return
""
;}
67
68
XrdBwmDirectory
(
const
char
*user,
int
monid)
69
:
XrdSfsDirectory
(user, monid),
70
tident
(user ? user :
""
) {}
71
72
virtual
~XrdBwmDirectory
() {}
73
74
protected
:
75
const
char
*
tident
;
76
};
77
78
/******************************************************************************/
79
/* X r d B w m F i l e */
80
/******************************************************************************/
81
82
class
XrdBwmFile
:
public
XrdSfsFile
83
{
84
public
:
85
86
int
open
(
const
char
*fileName,
87
XrdSfsFileOpenMode
openMode,
88
mode_t createMode,
89
const
XrdSecEntity
*client,
90
const
char
*opaque = 0);
91
92
int
close
();
93
94
int
fctl
(
const
int
cmd,
95
const
char
*args,
96
XrdOucErrInfo
&out_error);
97
98
const
char
*
FName
() {
return
(
oh
?
oh
->
Name
() :
"?"
);}
99
100
int
getMmap
(
void
**Addr, off_t &Size);
101
102
int
read
(
XrdSfsFileOffset
fileOffset,
// Preread only
103
XrdSfsXferSize
amount);
104
105
XrdSfsXferSize
read
(
XrdSfsFileOffset
fileOffset,
106
char
*buffer,
107
XrdSfsXferSize
buffer_size);
108
109
int
read
(
XrdSfsAio
*aioparm);
110
111
XrdSfsXferSize
write
(
XrdSfsFileOffset
fileOffset,
112
const
char
*buffer,
113
XrdSfsXferSize
buffer_size);
114
115
int
write
(
XrdSfsAio
*aioparm);
116
117
int
sync
();
118
119
int
sync
(
XrdSfsAio
*aiop);
120
121
int
stat
(
struct
stat
*buf);
122
123
int
truncate
(
XrdSfsFileOffset
fileOffset);
124
125
int
getCXinfo
(
char
cxtype[4],
int
&cxrsz);
126
127
XrdBwmFile
(
const
char
*user,
int
monid);
128
129
virtual
~XrdBwmFile
() {
if
(
oh
)
close
();}
130
131
protected
:
132
const
char
*
tident
;
133
134
private
:
135
136
XrdBwmHandle
*
oh
;
137
};
138
139
/******************************************************************************/
140
/* C l a s s X r d B w m */
141
/******************************************************************************/
142
143
class
XrdAccAuthorize
;
144
class
XrdBwmLogger
;
145
class
XrdBwmPolicy
;
146
147
class
XrdBwm
:
public
XrdSfsFileSystem
148
{
149
friend
class
XrdBwmDirectory
;
150
friend
class
XrdBwmFile
;
151
152
public
:
153
154
// Object allocation
155
//
156
XrdSfsDirectory
*
newDir
(
char
*user=0,
int
monid=0)
157
{
return
(
XrdSfsDirectory
*)
new
XrdBwmDirectory
(user,monid);}
158
159
XrdSfsFile
*
newFile
(
char
*user=0,
int
monid=0)
160
{
return
(
XrdSfsFile
*)
new
XrdBwmFile
(user,monid);}
161
162
// Other functions
163
//
164
int
chmod
(
const
char
*Name,
165
XrdSfsMode
Mode
,
166
XrdOucErrInfo
&out_error,
167
const
XrdSecEntity
*client,
168
const
char
*opaque = 0);
169
170
int
exists
(
const
char
*fileName,
171
XrdSfsFileExistence
&exists_flag,
172
XrdOucErrInfo
&out_error,
173
const
XrdSecEntity
*client,
174
const
char
*opaque = 0);
175
176
int
fsctl
(
const
int
cmd,
177
const
char
*args,
178
XrdOucErrInfo
&out_error,
179
const
XrdSecEntity
*client);
180
181
int
getStats
(
char
*buff,
int
blen) {
return
0;}
182
183
const
char
*
getVersion
();
184
185
int
mkdir
(
const
char
*dirName,
186
XrdSfsMode
Mode
,
187
XrdOucErrInfo
&out_error,
188
const
XrdSecEntity
*client,
189
const
char
*opaque = 0);
190
191
int
prepare
(
XrdSfsPrep
&pargs,
192
XrdOucErrInfo
&out_error,
193
const
XrdSecEntity
*client = 0);
194
195
int
rem
(
const
char
*path,
196
XrdOucErrInfo
&out_error,
197
const
XrdSecEntity
*client,
198
const
char
*info = 0)
199
{
return
remove
(
'f'
, path, out_error, client, info);}
200
201
int
remdir
(
const
char
*dirName,
202
XrdOucErrInfo
&out_error,
203
const
XrdSecEntity
*client,
204
const
char
*info = 0)
205
{
return
remove
(
'd'
,dirName,out_error,client,info);}
206
207
int
rename
(
const
char
*oldFileName,
208
const
char
*newFileName,
209
XrdOucErrInfo
&out_error,
210
const
XrdSecEntity
*client,
211
const
char
*infoO = 0,
212
const
char
*infoN = 0);
213
214
int
stat
(
const
char
*Name,
215
struct
stat
*buf,
216
XrdOucErrInfo
&out_error,
217
const
XrdSecEntity
*client,
218
const
char
*opaque = 0);
219
220
int
stat
(
const
char
*Name,
221
mode_t &mode,
222
XrdOucErrInfo
&out_error,
223
const
XrdSecEntity
*client,
224
const
char
*opaque = 0);
225
226
int
truncate
(
const
char
*Name,
227
XrdSfsFileOffset
fileOffset,
228
XrdOucErrInfo
&out_error,
229
const
XrdSecEntity
*client = 0,
230
const
char
*opaque = 0);
231
// Management functions
232
//
233
virtual
int
Configure
(
XrdSysError
&);
234
235
XrdBwm
();
236
virtual
~XrdBwm
() {}
// Too complicate to delete :-)
237
238
/******************************************************************************/
239
/* C o n f i g u r a t i o n V a l u e s */
240
/******************************************************************************/
241
242
XrdVersionInfo
*
myVersion
;
// ->Version compiled with
243
244
char
*
ConfigFN
;
// ->Configuration filename
245
char
*
HostName
;
// ->Our hostname
246
char
*
HostPref
;
// ->Our hostname with domain removed
247
char
*
myDomain
;
// ->Our domain name
248
int
myDomLen
;
//
249
char
Authorize
;
250
char
Reserved
[7];
251
252
/******************************************************************************/
253
/* P r o t e c t e d I t e m s */
254
/******************************************************************************/
255
256
protected
:
257
258
virtual
int
ConfigXeq
(
char
*var,
XrdOucStream
&,
XrdSysError
&);
259
int
Emsg
(
const
char
*,
XrdOucErrInfo
&,
int
,
260
const
char
*,
const
char
*y=
""
);
261
int
Emsg
(
const
char
*,
XrdOucErrInfo
&,
const
char
*,
262
const
char
*,
const
char
*y=
""
);
263
int
Stall
(
XrdOucErrInfo
&,
int
,
const
char
*);
264
265
/******************************************************************************/
266
/* P r i v a t e C o n f i g u r a t i o n */
267
/******************************************************************************/
268
269
private
:
270
271
XrdAccAuthorize
*
Authorization
;
// ->Authorization Service
272
char
*
AuthLib
;
// ->Authorization Library
273
char
*
AuthParm
;
// ->Authorization Parameters
274
XrdBwmLogger
*
Logger
;
// ->Logger
275
XrdBwmPolicy
*
Policy
;
// ->Policy
276
char
*
PolLib
;
277
char
*
PolParm
;
278
char
*
locResp
;
// ->Locate Response
279
int
locRlen
;
// Length of locResp;
280
int
PolSlotsIn
;
281
int
PolSlotsOut
;
282
283
static
XrdBwmHandle
*
dummyHandle
;
284
XrdSysMutex
ocMutex
;
// Global mutex for open/close
285
286
/******************************************************************************/
287
/* O t h e r D a t a */
288
/******************************************************************************/
289
290
int
remove
(
const
char
type,
const
char
*path,
291
XrdOucErrInfo
&out_error,
const
XrdSecEntity
*client,
292
const
char
*opaque);
293
// Function used during Configuration
294
//
295
int
setupAuth
(
XrdSysError
&);
296
int
setupPolicy
(
XrdSysError
&);
297
int
xalib
(
XrdOucStream
&,
XrdSysError
&);
298
int
xlog
(
XrdOucStream
&,
XrdSysError
&);
299
int
xpol
(
XrdOucStream
&,
XrdSysError
&);
300
int
xtrace
(
XrdOucStream
&,
XrdSysError
&);
301
};
302
#endif
Generated by
1.8.3.1