xrootd
Loading...
Searching...
No Matches
XrdPss.hh
Go to the documentation of this file.
1#ifndef _XRDPSS_API_H
2#define _XRDPSS_API_H
3/******************************************************************************/
4/* */
5/* X r d P s s . h h */
6/* */
7/* (c) 2010 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <cerrno>
34#include <unistd.h>
35#include <sys/types.h>
36#include <vector>
40#include "XrdOuc/XrdOucPList.hh"
41#include "XrdOuc/XrdOucSid.hh"
42#include "XrdOss/XrdOss.hh"
43
44/******************************************************************************/
45/* X r d P s s D i r */
46/******************************************************************************/
47
48class XrdPssDir : public XrdOssDF
49{
50public:
51int Close(long long *retsz=0);
52int Opendir(const char *, XrdOucEnv &);
53int Readdir(char *buff, int blen);
54
55 // Constructor and destructor
56 XrdPssDir(const char *tid)
58 myDir(0) {}
59
61private:
62 DIR *myDir;
63};
64
65/******************************************************************************/
66/* X r d P s s F i l e */
67/******************************************************************************/
68
69struct XrdOucIOVec;
70class XrdSecEntity;
71class XrdSfsAio;
72
73class XrdPssFile : public XrdOssDF
74{
75public:
76
77// The following two are virtual functions to allow for upcasting derivations
78// of this implementation
79//
80virtual int Close(long long *retsz=0);
81virtual int Open(const char *, int, mode_t, XrdOucEnv &);
82
83int Fchmod(mode_t mode) {return XrdOssOK;}
84int Fstat(struct stat *);
85int Fsync();
86int Fsync(XrdSfsAio *aiop);
87int Ftruncate(unsigned long long);
88ssize_t pgRead (void* buffer, off_t offset, size_t rdlen,
89 uint32_t* csvec, uint64_t opts);
90int pgRead (XrdSfsAio* aioparm, uint64_t opts);
91ssize_t pgWrite(void* buffer, off_t offset, size_t wrlen,
92 uint32_t* csvec, uint64_t opts);
93int pgWrite(XrdSfsAio* aioparm, uint64_t opts);
94ssize_t Read( off_t, size_t);
95ssize_t Read( void *, off_t, size_t);
96int Read(XrdSfsAio *aiop);
97ssize_t ReadV(XrdOucIOVec *readV, int n);
98ssize_t ReadRaw( void *, off_t, size_t);
99ssize_t Write(const void *, off_t, size_t);
100int Write(XrdSfsAio *aiop);
101
102 // Constructor and destructor
103 XrdPssFile(const char *tid)
105 rpInfo(0), tpcPath(0), entity(0) {}
106
107virtual ~XrdPssFile() {if (fd >= 0) Close();
108 if (rpInfo) delete(rpInfo);
109 if (tpcPath) free(tpcPath);
110 }
111
112private:
113
115 {char *tprPath;
116 char *dstURL;
117 size_t fSize;
118
119 tprInfo(const char *fn) : tprPath(strdup(fn)),dstURL(0),fSize(0)
120 {}
121 ~tprInfo() {if (tprPath) free(tprPath);
122 if (dstURL) free(dstURL);
123 }
125
126 char *tpcPath;
128};
129
130/******************************************************************************/
131/* X r d P s s S y s */
132/******************************************************************************/
133
134class XrdNetSecurity;
135class XrdOucEnv;
136class XrdOucStream;
137class XrdOucTList;
138class XrdPssUrlInfo;
139class XrdSecsssID;
140class XrdSysError;
141
142struct XrdVersionInfo;
143
144class XrdPssSys : public XrdOss
145{
146public:
147virtual XrdOssDF *newDir(const char *tident) override
148 {return (XrdOssDF *)new XrdPssDir(tident);}
149virtual XrdOssDF *newFile(const char *tident) override
150 {return (XrdOssDF *)new XrdPssFile(tident);}
151
152virtual void Connect(XrdOucEnv &) override;
153
154virtual void Disc(XrdOucEnv &) override;
155
156int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0) override;
158virtual
159int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0) override;
160void EnvInfo(XrdOucEnv *envP) override;
161uint64_t Features() override {return myFeatures;}
162int Init(XrdSysLogger *, const char *) override {return -ENOTSUP;}
163int Init(XrdSysLogger *, const char *, XrdOucEnv *envP) override;
164int Lfn2Pfn(const char *Path, char *buff, int blen) override;
165const
166char *Lfn2Pfn(const char *Path, char *buff, int blen, int &rc) override;
167int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0) override;
168int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0) override;
169int Rename(const char *, const char *,
170 XrdOucEnv *eP1=0, XrdOucEnv *eP2=0) override;
171int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override;
172int Stats(char *bp, int bl) override;
173int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0) override;
174int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0) override;
175
176static const int PolNum = 2;
177enum PolAct {PolPath = 0, PolObj = 1};
178
179static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType,
180 const char *path);
181static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo);
182static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo,
183 bool doN2N=true);
184
185static const char *ConfigFN; // -> Pointer to the config file name
186static const char *myHost;
187static const char *myName;
188static
189XrdOucPListAnchor XPList; // Exported path list
190
193static char *fileOrgn;
194static const char *protName;
195static const char *hdrData;
196static int hdrLen;
197static int Streams;
198static int Workers;
199static int Trace;
200static int dcaCTime;
201
202static bool xLfn2Pfn;
203static bool dcaCheck;
204static bool dcaWorld;
205static bool deferID; // Defer ID mapping until needed
206static bool reProxy; // TPC requires reproxing
207
209virtual ~XrdPssSys() {}
210
211private:
212
213char *LocalRoot;// -> pss Local n2n root, if any
214XrdOucName2Name *theN2N; // -> File mapper object
215unsigned long long DirFlags; // Defaults for exports
216XrdVersionInfo *myVersion;// -> Compilation version
217XrdSecsssID *idMapper; // -> Auth ID mapper
218uint64_t myFeatures;// Our feature set
219
220int Configure(const char *, XrdOucEnv *);
221int ConfigProc(const char *ConfigFN);
223int xconf(XrdSysError *Eroute, XrdOucStream &Config);
224int xdef( XrdSysError *Eroute, XrdOucStream &Config);
225int xdca( XrdSysError *errp, XrdOucStream &Config);
226int xexp( XrdSysError *Eroute, XrdOucStream &Config);
227int xperm(XrdSysError *errp, XrdOucStream &Config);
228int xpers(XrdSysError *errp, XrdOucStream &Config);
229int xorig(XrdSysError *errp, XrdOucStream &Config);
230};
231#endif
#define XrdOssOK
Definition XrdOss.hh:50
#define stat(a, b)
Definition XrdPosix.hh:96
Definition XrdNetSecurity.hh:44
Definition XrdOss.hh:63
static const uint16_t DF_isFile
Object is for a file.
Definition XrdOss.hh:393
int fd
Definition XrdOss.hh:455
static const uint16_t DF_isDir
Object is for a directory.
Definition XrdOss.hh:392
static const uint16_t DF_isProxy
Object is a proxy object.
Definition XrdOss.hh:394
Definition XrdOss.hh:498
Definition XrdOucEnv.hh:42
Definition XrdOucName2Name.hh:49
Definition XrdOucPList.hh:89
Definition XrdOucStream.hh:47
Definition XrdOucTList.hh:42
Definition XrdPss.hh:49
DIR * myDir
Definition XrdPss.hh:62
~XrdPssDir()
Definition XrdPss.hh:60
int Close(long long *retsz=0)
int Opendir(const char *, XrdOucEnv &)
int Readdir(char *buff, int blen)
XrdPssDir(const char *tid)
Definition XrdPss.hh:56
Definition XrdPss.hh:74
virtual int Close(long long *retsz=0)
ssize_t ReadRaw(void *, off_t, size_t)
virtual ~XrdPssFile()
Definition XrdPss.hh:107
int pgRead(XrdSfsAio *aioparm, uint64_t opts)
ssize_t Read(void *, off_t, size_t)
struct XrdPssFile::tprInfo * rpInfo
int Write(XrdSfsAio *aiop)
virtual int Open(const char *, int, mode_t, XrdOucEnv &)
ssize_t Read(off_t, size_t)
int Fstat(struct stat *)
int pgWrite(XrdSfsAio *aioparm, uint64_t opts)
int Fchmod(mode_t mode)
Definition XrdPss.hh:83
ssize_t Write(const void *, off_t, size_t)
XrdPssFile(const char *tid)
Definition XrdPss.hh:103
int Fsync(XrdSfsAio *aiop)
int Read(XrdSfsAio *aiop)
ssize_t ReadV(XrdOucIOVec *readV, int n)
ssize_t pgRead(void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts)
int Ftruncate(unsigned long long)
ssize_t pgWrite(void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts)
char * tpcPath
Definition XrdPss.hh:126
const XrdSecEntity * entity
Definition XrdPss.hh:127
Definition XrdPss.hh:145
virtual ~XrdPssSys()
Definition XrdPss.hh:209
static const int PolNum
Definition XrdPss.hh:176
int Configure(const char *, XrdOucEnv *)
int xdca(XrdSysError *errp, XrdOucStream &Config)
XrdSecsssID * idMapper
Definition XrdPss.hh:217
static const char * protName
Definition XrdPss.hh:194
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0) override
static char * fileOrgn
Definition XrdPss.hh:193
uint64_t Features() override
Definition XrdPss.hh:161
static const char * ConfigFN
Definition XrdPss.hh:185
static XrdOucTList * ManList
Definition XrdPss.hh:192
static int dcaCTime
Definition XrdPss.hh:200
int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0) override
static int Streams
Definition XrdPss.hh:197
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
int xpers(XrdSysError *errp, XrdOucStream &Config)
int xperm(XrdSysError *errp, XrdOucStream &Config)
static const char * myName
Definition XrdPss.hh:187
int ConfigProc(const char *ConfigFN)
static const char * hdrData
Definition XrdPss.hh:195
int Init(XrdSysLogger *, const char *, XrdOucEnv *envP) override
int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0) override
const char * Lfn2Pfn(const char *Path, char *buff, int blen, int &rc) override
uint64_t myFeatures
Definition XrdPss.hh:218
XrdVersionInfo * myVersion
Definition XrdPss.hh:216
int Stats(char *bp, int bl) override
static bool deferID
Definition XrdPss.hh:205
static int hdrLen
Definition XrdPss.hh:196
int ConfigXeq(char *, XrdOucStream &)
int xdef(XrdSysError *Eroute, XrdOucStream &Config)
unsigned long long DirFlags
Definition XrdPss.hh:215
int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override
int Init(XrdSysLogger *, const char *) override
Definition XrdPss.hh:162
static bool dcaCheck
Definition XrdPss.hh:203
int xorig(XrdSysError *errp, XrdOucStream &Config)
virtual void Disc(XrdOucEnv &) override
static bool reProxy
Definition XrdPss.hh:206
int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0) override
static int Workers
Definition XrdPss.hh:198
virtual XrdOssDF * newDir(const char *tident) override
Definition XrdPss.hh:147
PolAct
Definition XrdPss.hh:177
@ PolObj
Definition XrdPss.hh:177
@ PolPath
Definition XrdPss.hh:177
void EnvInfo(XrdOucEnv *envP) override
virtual int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0) override
int xexp(XrdSysError *Eroute, XrdOucStream &Config)
virtual XrdOssDF * newFile(const char *tident) override
Definition XrdPss.hh:149
static int Trace
Definition XrdPss.hh:199
bool ConfigMapID()
XrdOucName2Name * theN2N
Definition XrdPss.hh:214
virtual void Connect(XrdOucEnv &) override
char * LocalRoot
Definition XrdPss.hh:213
static XrdOucPListAnchor XPList
Definition XrdPss.hh:189
int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0) override
int Lfn2Pfn(const char *Path, char *buff, int blen) override
static bool xLfn2Pfn
Definition XrdPss.hh:202
static XrdNetSecurity * Police[PolNum]
Definition XrdPss.hh:191
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
int Rename(const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0) override
static const char * myHost
Definition XrdPss.hh:186
static bool dcaWorld
Definition XrdPss.hh:204
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
int xconf(XrdSysError *Eroute, XrdOucStream &Config)
Definition XrdPssUrlInfo.hh:38
Definition XrdSecEntity.hh:65
Definition XrdSecsssID.hh:54
Definition XrdSfsAio.hh:59
Definition XrdSysError.hh:90
Definition XrdSysLogger.hh:53
Definition XrdOucIOVec.hh:41
Definition XrdPss.hh:115
char * dstURL
Definition XrdPss.hh:116
char * tprPath
Definition XrdPss.hh:115
size_t fSize
Definition XrdPss.hh:117
~tprInfo()
Definition XrdPss.hh:121
tprInfo(const char *fn)
Definition XrdPss.hh:119