00001 #ifndef _XRD_FRMCONFIG_H
00002 #define _XRD_FRMCONFIG_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 #include <string.h>
00033 #include <unistd.h>
00034
00035 #include "XrdOss/XrdOssSpace.hh"
00036
00037 class XrdCks;
00038 class XrdNetCmsNotify;
00039 class XrdOfsConfigPI;
00040 class XrdOss;
00041 class XrdOucMsubs;
00042 class XrdOucName2Name;
00043 class XrdOucProg;
00044 class XrdOucStream;
00045 class XrdOucTList;
00046 class XrdSysLogger;
00047
00048 class XrdFrmConfigSE;
00049
00050 struct XrdVersionInfo;
00051 struct stat;
00052
00053 class XrdFrmConfig
00054 {
00055 public:
00056
00057 const char *myProg;
00058 const char *myName;
00059 const char *myInst;
00060 const char *mySite;
00061 const char *myFrmid;
00062 const char *myFrmID;
00063 const char *lockFN;
00064 char *AdminPath;
00065 char *QPath;
00066 char *PidPath;
00067 char *myInstance;
00068 char *StopPurge;
00069 char *MSSCmd;
00070 XrdOucProg *MSSProg;
00071
00072 struct Cmd
00073 {const char *Desc;
00074 char *theCmd;
00075 XrdOucMsubs *theVec;
00076 int TLimit;
00077 int Opts;
00078 } xfrCmd[4];
00079 static const int cmdAlloc = 0x0001;
00080 static const int cmdMDP = 0x0002;
00081 static const int cmdStats = 0x0004;
00082 static const int cmdXPD = 0x0008;
00083 static const int cmdRME = 0x0010;
00084
00085 int xfrIN;
00086 int xfrOUT;
00087
00088 XrdOfsConfigPI *OfsCfg;
00089 XrdCks *CksMan;
00090 XrdOucName2Name *the_N2N;
00091 XrdOss *ossFS;
00092 XrdNetCmsNotify *cmsPath;
00093 uid_t myUid;
00094 gid_t myGid;
00095 long long cmdFree;
00096 int cmdHold;
00097 int AdminMode;
00098 int isAgent;
00099 int xfrMax;
00100 int xfrMaxIn;
00101 int xfrMaxOt;
00102 int FailHold;
00103 int IdleHold;
00104 int WaitQChk;
00105 int WaitPurge;
00106 int WaitMigr;
00107 int haveCMS;
00108 int isOTO;
00109 int Fix;
00110 int Test;
00111 int TrackDC;
00112 int Verbose;
00113 int runOld;
00114 int runNew;
00115 int nonXA;
00116 int hasCache;
00117 char **vectArg;
00118 int nextArg;
00119 int numcArg;
00120
00121 struct VPInfo
00122 {VPInfo *Next;
00123 char *Name;
00124 XrdOucTList *Dir;
00125 int Val;
00126 VPInfo(char *n, int m=0, struct VPInfo *p=0)
00127 : Next(p), Name(strdup(n)), Dir(0), Val(m) {}
00128 ~VPInfo() {}
00129 } *VPList;
00130 VPInfo *pathList;
00131 XrdOucTList *spacList;
00132
00133 struct Policy
00134 {long long minFree;
00135 long long maxFree;
00136 int Hold;
00137 int Ext;
00138 Policy *Next;
00139 char Sname[XrdOssSpace::minSNbsz];
00140 Policy(const char *snv, long long minV, long long maxV,
00141 int hV, int xV) : minFree(minV), maxFree(maxV),
00142 Hold(hV), Ext(xV), Next(0) {strcpy(Sname, snv);}
00143 ~Policy() {}
00144 };
00145 Policy dfltPolicy;
00146
00147 int dirHold;
00148 int pVecNum;
00149 static const int pVecMax=8;
00150 char pVec[pVecMax];
00151 char *pProg;
00152 char *xfrFdir;
00153 int xfrFdln;
00154
00155 enum PPVar {PP_atime=0, PP_ctime, PP_fname, PP_fsize, PP_fspace,
00156 PP_mtime, PP_pfn, PP_sname, PP_tspace, PP_usage};
00157
00158 int Configure(int argc, char **argv, int (*ppf)());
00159
00160 int LocalPath (const char *oldp, char *newp, int newpsz);
00161
00162 int LogicalPath(const char *oldp, char *newp, int newpsz);
00163
00164 int NeedsCTA(const char *Lfn);
00165
00166 unsigned
00167 long long PathOpts(const char *Lfn);
00168
00169 int RemotePath (const char *oldp, char *newp, int newpsz);
00170
00171 XrdOucTList *Space(const char *Name, const char *Path=0);
00172
00173 int Stat(const char *xLfn, const char *xPfn, struct stat *buff);
00174
00175 enum SubSys {ssAdmin, ssMigr, ssPstg, ssPurg, ssXfr};
00176
00177 XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo);
00178 ~XrdFrmConfig() {}
00179
00180 private:
00181 XrdOucMsubs *ConfigCmd(const char *cname, char *cdata);
00182 int ConfigMum(XrdFrmConfigSE &theSE);
00183 int ConfigN2N();
00184 int ConfigMon(int isxfr);
00185 int ConfigMP(const char *);
00186 int ConfigMss();
00187 int ConfigOTO(char *Parms);
00188 int ConfigPaths();
00189 void ConfigPF(const char *pFN);
00190 int ConfigProc();
00191 int ConfigXeq(char *var, int mbok);
00192 int ConfigXfr();
00193 int getTime(const char *, const char *, int *, int mnv=-1, int mxv=-1);
00194 int Grab(const char *var, char **Dest, int nosubs);
00195 XrdOucTList *InsertPL(XrdOucTList *pP, const char *Path, int Plen, int isRW);
00196 void InsertXD(const char *Path);
00197 void Usage(int rc);
00198 int xapath();
00199 int xcks();
00200 int xcnsd();
00201 int xcopy();
00202 int xcopy(int &TLim);
00203 int xcmax();
00204 int xdpol();
00205 int xitm(const char *What, int &tDest);
00206 int xnml();
00207 int xmon();
00208 int xpol();
00209 int xpolprog();
00210 int xqchk();
00211 int xsit();
00212 int xspace(int isPrg=0, int isXA=1);
00213 void xspaceBuild(char *grp, char *fn, int isxa);
00214 int xxfr();
00215
00216 char *ConfigFN;
00217 char *LocalRoot;
00218 char *RemoteRoot;
00219 XrdOucStream *cFile;
00220 XrdVersionInfo *myVersion;
00221
00222 bool doStatPF;
00223 int plnDTS;
00224 const char *pfxDTS;
00225 const char *vOpts;
00226 const char *uInfo;
00227 char *N2N_Lib;
00228 char *N2N_Parms;
00229 XrdOucName2Name *lcl_N2N;
00230 XrdOucName2Name *rmt_N2N;
00231 SubSys ssID;
00232 };
00233 namespace XrdFrm
00234 {
00235 extern XrdFrmConfig Config;
00236 }
00237 #endif