xrootd
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 <errno.h>
34#include <unistd.h>
35#include <sys/types.h>
39#include "XrdOuc/XrdOucPList.hh"
40#include "XrdOuc/XrdOucSid.hh"
41#include "XrdOss/XrdOss.hh"
42
43/******************************************************************************/
44/* X r d P s s D i r */
45/******************************************************************************/
46
47class XrdPssDir : public XrdOssDF
48{
49public:
50int Close(long long *retsz=0);
51int Opendir(const char *, XrdOucEnv &);
52int Readdir(char *buff, int blen);
53
54 // Constructor and destructor
55 XrdPssDir(const char *tid) : tident(tid), myDir(0) {}
57private:
58const char *tident;
59 DIR *myDir;
60};
61
62/******************************************************************************/
63/* X r d P s s F i l e */
64/******************************************************************************/
65
66struct XrdOucIOVec;
67class XrdSfsAio;
68
69class XrdPssFile : public XrdOssDF
70{
71public:
72
73// The following two are virtual functions to allow for upcasting derivations
74// of this implementation
75//
76virtual int Close(long long *retsz=0);
77virtual int Open(const char *, int, mode_t, XrdOucEnv &);
78
79int Fchmod(mode_t mode) {return XrdOssOK;}
80int Fstat(struct stat *);
81int Fsync();
82int Fsync(XrdSfsAio *aiop);
83int Ftruncate(unsigned long long);
84off_t getMmap(void **addr);
85int isCompressed(char *cxidp=0);
86ssize_t Read( off_t, size_t);
87ssize_t Read( void *, off_t, size_t);
88int Read(XrdSfsAio *aiop);
89ssize_t ReadV(XrdOucIOVec *readV, int n);
90ssize_t ReadRaw( void *, off_t, size_t);
91ssize_t Write(const void *, off_t, size_t);
92int Write(XrdSfsAio *aiop);
93
94 // Constructor and destructor
95 XrdPssFile(const char *tid) : tident(tid), tpcPath(0)
96 {fd = -1;}
97
98virtual ~XrdPssFile() {if (fd >= 0) Close();
99 if (tpcPath) free(tpcPath);
100 }
101
102private:
103
104const char *tident;
105 char *tpcPath;
106};
107
108/******************************************************************************/
109/* X r d P s s S y s */
110/******************************************************************************/
111
112class XrdNetSecurity;
113class XrdOucEnv;
114class XrdOucStream;
115class XrdOucTList;
116class XrdPssUrlInfo;
117class XrdSysError;
118
119struct XrdVersionInfo;
120
121class XrdPssSys : public XrdOss
122{
123public:
124virtual XrdOssDF *newDir(const char *tident)
125 {return (XrdOssDF *)new XrdPssDir(tident);}
126virtual XrdOssDF *newFile(const char *tident)
127 {return (XrdOssDF *)new XrdPssFile(tident);}
128
129int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0);
130virtual
131int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0);
132void EnvInfo(XrdOucEnv *envP);
133int Init(XrdSysLogger *, const char *);
134int Lfn2Pfn(const char *Path, char *buff, int blen);
135const
136char *Lfn2Pfn(const char *Path, char *buff, int blen, int &rc);
137int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0);
138int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0);
139int Rename(const char *, const char *,
140 XrdOucEnv *eP1=0, XrdOucEnv *eP2=0);
141int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0);
142int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0);
143int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0);
144
145static const int PolNum = 2;
146enum PolAct {PolPath = 0, PolObj = 1};
147
148static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType,
149 const char *path);
150static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo);
151static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo,
152 bool doN2N=true);
153static
154const char *valProt(const char *pname, int &plen, int adj=0);
155
156static const char *ConfigFN; // -> Pointer to the config file name
157static const char *myHost;
158static const char *myName;
159static
160XrdOucPListAnchor XPList; // Exported path list
161
164static const char *protName;
165static const char *hdrData;
166static int hdrLen;
167static int Streams;
168static int Workers;
169static int Trace;
170static int dcaCTime;
171
172static bool outProxy; // True means outgoing proxy
173static bool pfxProxy; // True means outgoing proxy is prefixed
174static bool xLfn2Pfn;
175static bool dcaCheck;
176static bool dcaWorld;
177
179virtual ~XrdPssSys() {}
180
181private:
182
183char *LocalRoot;// -> pss Local n2n root, if any
184XrdOucName2Name *theN2N; // -> File mapper object
185unsigned long long DirFlags; // Defaults for exports
186XrdVersionInfo *myVersion;// -> Compilation version
187
188int Configure(const char *);
189int ConfigProc(const char *ConfigFN);
191const
192char *getDomain(const char *hName);
199};
200#endif
#define XrdOssOK
Definition: XrdOss.hh:47
#define stat(a, b)
Definition: XrdPosix.hh:96
Definition: XrdNetSecurity.hh:44
Definition: XrdOss.hh:60
int fd
Definition: XrdOss.hh:132
Definition: XrdOss.hh:174
Definition: XrdOucEnv.hh:42
Definition: XrdOucName2Name.hh:49
Definition: XrdOucPList.hh:89
Definition: XrdOucStream.hh:46
Definition: XrdOucTList.hh:42
Definition: XrdPss.hh:48
DIR * myDir
Definition: XrdPss.hh:59
~XrdPssDir()
Definition: XrdPss.hh:56
int Close(long long *retsz=0)
const char * tident
Definition: XrdPss.hh:58
int Opendir(const char *, XrdOucEnv &)
int Readdir(char *buff, int blen)
XrdPssDir(const char *tid)
Definition: XrdPss.hh:55
Definition: XrdPss.hh:70
virtual int Close(long long *retsz=0)
ssize_t ReadRaw(void *, off_t, size_t)
virtual ~XrdPssFile()
Definition: XrdPss.hh:98
ssize_t Read(void *, off_t, size_t)
const char * tident
Definition: XrdPss.hh:104
int isCompressed(char *cxidp=0)
int Write(XrdSfsAio *aiop)
virtual int Open(const char *, int, mode_t, XrdOucEnv &)
off_t getMmap(void **addr)
ssize_t Read(off_t, size_t)
int Fstat(struct stat *)
int Fchmod(mode_t mode)
Definition: XrdPss.hh:79
ssize_t Write(const void *, off_t, size_t)
XrdPssFile(const char *tid)
Definition: XrdPss.hh:95
int Fsync(XrdSfsAio *aiop)
int Read(XrdSfsAio *aiop)
ssize_t ReadV(XrdOucIOVec *readV, int n)
int Ftruncate(unsigned long long)
char * tpcPath
Definition: XrdPss.hh:105
Definition: XrdPss.hh:122
virtual ~XrdPssSys()
Definition: XrdPss.hh:179
virtual XrdOssDF * newDir(const char *tident)
Definition: XrdPss.hh:124
static const char * valProt(const char *pname, int &plen, int adj=0)
static const int PolNum
Definition: XrdPss.hh:145
int xdca(XrdSysError *errp, XrdOucStream &Config)
const char * getDomain(const char *hName)
static const char * protName
Definition: XrdPss.hh:164
int Lfn2Pfn(const char *Path, char *buff, int blen)
int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0)
int Configure(const char *)
static const char * ConfigFN
Definition: XrdPss.hh:156
static XrdOucTList * ManList
Definition: XrdPss.hh:163
static int dcaCTime
Definition: XrdPss.hh:170
static int Streams
Definition: XrdPss.hh:167
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
int xperm(XrdSysError *errp, XrdOucStream &Config)
static const char * myName
Definition: XrdPss.hh:158
int ConfigProc(const char *ConfigFN)
static const char * hdrData
Definition: XrdPss.hh:165
int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0)
virtual int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0)
XrdVersionInfo * myVersion
Definition: XrdPss.hh:186
static int hdrLen
Definition: XrdPss.hh:166
int ConfigXeq(char *, XrdOucStream &)
int xdef(XrdSysError *Eroute, XrdOucStream &Config)
unsigned long long DirFlags
Definition: XrdPss.hh:185
static bool dcaCheck
Definition: XrdPss.hh:175
int xorig(XrdSysError *errp, XrdOucStream &Config)
int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0)
static int Workers
Definition: XrdPss.hh:168
PolAct
Definition: XrdPss.hh:146
@ PolObj
Definition: XrdPss.hh:146
@ PolPath
Definition: XrdPss.hh:146
int xexp(XrdSysError *Eroute, XrdOucStream &Config)
static int Trace
Definition: XrdPss.hh:169
XrdOucName2Name * theN2N
Definition: XrdPss.hh:184
static bool pfxProxy
Definition: XrdPss.hh:173
int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0)
char * LocalRoot
Definition: XrdPss.hh:183
static XrdOucPListAnchor XPList
Definition: XrdPss.hh:160
static bool outProxy
Definition: XrdPss.hh:172
int Rename(const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0)
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0)
const char * Lfn2Pfn(const char *Path, char *buff, int blen, int &rc)
int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0)
static bool xLfn2Pfn
Definition: XrdPss.hh:174
static XrdNetSecurity * Police[PolNum]
Definition: XrdPss.hh:162
int Init(XrdSysLogger *, const char *)
void EnvInfo(XrdOucEnv *envP)
virtual XrdOssDF * newFile(const char *tident)
Definition: XrdPss.hh:126
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
static const char * myHost
Definition: XrdPss.hh:157
static bool dcaWorld
Definition: XrdPss.hh:176
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
int xconf(XrdSysError *Eroute, XrdOucStream &Config)
Definition: XrdPssUrlInfo.hh:38
Definition: XrdSfsAio.hh:58
Definition: XrdSysError.hh:90
Definition: XrdSysLogger.hh:53
XrdCmsConfig Config
Definition: XrdOucIOVec.hh:41