00001 #ifndef _XRDPSS_API_H
00002 #define _XRDPSS_API_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <errno.h>
00034 #include <unistd.h>
00035 #include <sys/types.h>
00036 #include "XrdSys/XrdSysHeaders.hh"
00037 #include "XrdOuc/XrdOucExport.hh"
00038 #include "XrdOuc/XrdOucName2Name.hh"
00039 #include "XrdOuc/XrdOucPList.hh"
00040 #include "XrdOuc/XrdOucSid.hh"
00041 #include "XrdOss/XrdOss.hh"
00042
00043
00044
00045
00046
00047 class XrdPssDir : public XrdOssDF
00048 {
00049 public:
00050 int Close(long long *retsz=0);
00051 int Opendir(const char *, XrdOucEnv &);
00052 int Readdir(char *buff, int blen);
00053
00054
00055 XrdPssDir(const char *tid) : tident(tid), myDir(0) {}
00056 ~XrdPssDir() {if (myDir) Close();}
00057 private:
00058 const char *tident;
00059 DIR *myDir;
00060 };
00061
00062
00063
00064
00065
00066 struct XrdOucIOVec;
00067 class XrdSfsAio;
00068
00069 class XrdPssFile : public XrdOssDF
00070 {
00071 public:
00072
00073
00074
00075
00076 virtual int Close(long long *retsz=0);
00077 virtual int Open(const char *, int, mode_t, XrdOucEnv &);
00078
00079 int Fchmod(mode_t mode) {return XrdOssOK;}
00080 int Fstat(struct stat *);
00081 int Fsync();
00082 int Fsync(XrdSfsAio *aiop);
00083 int Ftruncate(unsigned long long);
00084 off_t getMmap(void **addr);
00085 int isCompressed(char *cxidp=0);
00086 ssize_t Read( off_t, size_t);
00087 ssize_t Read( void *, off_t, size_t);
00088 int Read(XrdSfsAio *aiop);
00089 ssize_t ReadV(XrdOucIOVec *readV, int n);
00090 ssize_t ReadRaw( void *, off_t, size_t);
00091 ssize_t Write(const void *, off_t, size_t);
00092 int Write(XrdSfsAio *aiop);
00093
00094
00095 XrdPssFile(const char *tid) : tident(tid), tpcPath(0) {fd = -1;}
00096
00097 virtual ~XrdPssFile() {if (fd >= 0) Close();
00098 if (tpcPath) free(tpcPath);
00099 }
00100
00101 private:
00102
00103 const char *tident;
00104 char *tpcPath;
00105 };
00106
00107
00108
00109
00110
00111 class XrdNetSecurity;
00112 class XrdOucEnv;
00113 class XrdOucStream;
00114 class XrdOucTList;
00115 class XrdPssUrlInfo;
00116 class XrdSysError;
00117
00118 struct XrdVersionInfo;
00119
00120 class XrdPssSys : public XrdOss
00121 {
00122 public:
00123 virtual XrdOssDF *newDir(const char *tident)
00124 {return (XrdOssDF *)new XrdPssDir(tident);}
00125 virtual XrdOssDF *newFile(const char *tident)
00126 {return (XrdOssDF *)new XrdPssFile(tident);}
00127
00128 int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0);
00129 virtual
00130 int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0);
00131 void EnvInfo(XrdOucEnv *envP);
00132 int Init(XrdSysLogger *, const char *);
00133 int Lfn2Pfn(const char *Path, char *buff, int blen);
00134 const
00135 char *Lfn2Pfn(const char *Path, char *buff, int blen, int &rc);
00136 int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0);
00137 int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0);
00138 int Rename(const char *, const char *,
00139 XrdOucEnv *eP1=0, XrdOucEnv *eP2=0);
00140 int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0);
00141 int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0);
00142 int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0);
00143
00144 static const int PolNum = 2;
00145 enum PolAct {PolPath = 0, PolObj = 1};
00146
00147 static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType,
00148 const char *path);
00149 static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo);
00150 static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo,
00151 bool doN2N=true);
00152 static
00153 const char *valProt(const char *pname, int &plen, int adj=0);
00154
00155 static const char *ConfigFN;
00156 static const char *myHost;
00157 static const char *myName;
00158 static
00159 XrdOucPListAnchor XPList;
00160
00161 static XrdNetSecurity *Police[PolNum];
00162 static XrdOucTList *ManList;
00163 static const char *protName;
00164 static const char *hdrData;
00165 static int hdrLen;
00166 static int Streams;
00167 static int Workers;
00168 static int Trace;
00169
00170 static bool outProxy;
00171 static bool pfxProxy;
00172 static bool xLfn2Pfn;
00173
00174 XrdPssSys();
00175 virtual ~XrdPssSys() {}
00176
00177 private:
00178
00179 char *LocalRoot;
00180 XrdOucName2Name *theN2N;
00181 unsigned long long DirFlags;
00182 XrdVersionInfo *myVersion;
00183
00184 int Configure(const char *);
00185 int ConfigProc(const char *ConfigFN);
00186 int ConfigXeq(char*, XrdOucStream&);
00187 const
00188 char *getDomain(const char *hName);
00189 int xconf(XrdSysError *Eroute, XrdOucStream &Config);
00190 int xdef( XrdSysError *Eroute, XrdOucStream &Config);
00191 int xexp( XrdSysError *Eroute, XrdOucStream &Config);
00192 int xperm(XrdSysError *errp, XrdOucStream &Config);
00193 int xorig(XrdSysError *errp, XrdOucStream &Config);
00194 };
00195 #endif