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)
00096 {fd = -1;}
00097
00098 virtual ~XrdPssFile() {if (fd >= 0) Close();
00099 if (tpcPath) free(tpcPath);
00100 }
00101
00102 private:
00103
00104 const char *tident;
00105 char *tpcPath;
00106 };
00107
00108
00109
00110
00111
00112 class XrdNetSecurity;
00113 class XrdOucEnv;
00114 class XrdOucStream;
00115 class XrdOucTList;
00116 class XrdPssUrlInfo;
00117 class XrdSysError;
00118
00119 struct XrdVersionInfo;
00120
00121 class XrdPssSys : public XrdOss
00122 {
00123 public:
00124 virtual XrdOssDF *newDir(const char *tident)
00125 {return (XrdOssDF *)new XrdPssDir(tident);}
00126 virtual XrdOssDF *newFile(const char *tident)
00127 {return (XrdOssDF *)new XrdPssFile(tident);}
00128
00129 int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0);
00130 virtual
00131 int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0);
00132 void EnvInfo(XrdOucEnv *envP);
00133 int Init(XrdSysLogger *, const char *);
00134 int Lfn2Pfn(const char *Path, char *buff, int blen);
00135 const
00136 char *Lfn2Pfn(const char *Path, char *buff, int blen, int &rc);
00137 int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0);
00138 int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0);
00139 int Rename(const char *, const char *,
00140 XrdOucEnv *eP1=0, XrdOucEnv *eP2=0);
00141 int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0);
00142 int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0);
00143 int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0);
00144
00145 static const int PolNum = 2;
00146 enum PolAct {PolPath = 0, PolObj = 1};
00147
00148 static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType,
00149 const char *path);
00150 static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo);
00151 static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo,
00152 bool doN2N=true);
00153 static
00154 const char *valProt(const char *pname, int &plen, int adj=0);
00155
00156 static const char *ConfigFN;
00157 static const char *myHost;
00158 static const char *myName;
00159 static
00160 XrdOucPListAnchor XPList;
00161
00162 static XrdNetSecurity *Police[PolNum];
00163 static XrdOucTList *ManList;
00164 static const char *protName;
00165 static const char *hdrData;
00166 static int hdrLen;
00167 static int Streams;
00168 static int Workers;
00169 static int Trace;
00170 static int dcaCTime;
00171
00172 static bool outProxy;
00173 static bool pfxProxy;
00174 static bool xLfn2Pfn;
00175 static bool dcaCheck;
00176 static bool dcaWorld;
00177
00178 XrdPssSys();
00179 virtual ~XrdPssSys() {}
00180
00181 private:
00182
00183 char *LocalRoot;
00184 XrdOucName2Name *theN2N;
00185 unsigned long long DirFlags;
00186 XrdVersionInfo *myVersion;
00187
00188 int Configure(const char *);
00189 int ConfigProc(const char *ConfigFN);
00190 int ConfigXeq(char*, XrdOucStream&);
00191 const
00192 char *getDomain(const char *hName);
00193 int xconf(XrdSysError *Eroute, XrdOucStream &Config);
00194 int xdef( XrdSysError *Eroute, XrdOucStream &Config);
00195 int xdca( XrdSysError *errp, XrdOucStream &Config);
00196 int xexp( XrdSysError *Eroute, XrdOucStream &Config);
00197 int xperm(XrdSysError *errp, XrdOucStream &Config);
00198 int xorig(XrdSysError *errp, XrdOucStream &Config);
00199 };
00200 #endif