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 FailHold;
00101 int IdleHold;
00102 int WaitQChk;
00103 int WaitPurge;
00104 int WaitMigr;
00105 int haveCMS;
00106 int isOTO;
00107 int Fix;
00108 int Test;
00109 int TrackDC;
00110 int Verbose;
00111 int runOld;
00112 int runNew;
00113 int nonXA;
00114 int hasCache;
00115 char **vectArg;
00116 int nextArg;
00117 int numcArg;
00118
00119 struct VPInfo
00120 {VPInfo *Next;
00121 char *Name;
00122 XrdOucTList *Dir;
00123 int Val;
00124 VPInfo(char *n, int m=0, struct VPInfo *p=0)
00125 : Next(p), Name(strdup(n)), Dir(0), Val(m) {}
00126 ~VPInfo() {}
00127 } *VPList;
00128 VPInfo *pathList;
00129 XrdOucTList *spacList;
00130
00131 struct Policy
00132 {long long minFree;
00133 long long maxFree;
00134 int Hold;
00135 int Ext;
00136 Policy *Next;
00137 char Sname[XrdOssSpace::minSNbsz];
00138 Policy(const char *snv, long long minV, long long maxV,
00139 int hV, int xV) : minFree(minV), maxFree(maxV),
00140 Hold(hV), Ext(xV), Next(0) {strcpy(Sname, snv);}
00141 ~Policy() {}
00142 };
00143 Policy dfltPolicy;
00144
00145 int dirHold;
00146 int pVecNum;
00147 static const int pVecMax=8;
00148 char pVec[pVecMax];
00149 char *pProg;
00150 char *xfrFdir;
00151 int xfrFdln;
00152
00153 enum PPVar {PP_atime=0, PP_ctime, PP_fname, PP_fsize, PP_fspace,
00154 PP_mtime, PP_pfn, PP_sname, PP_tspace, PP_usage};
00155
00156 int Configure(int argc, char **argv, int (*ppf)());
00157
00158 int LocalPath (const char *oldp, char *newp, int newpsz);
00159
00160 int LogicalPath(const char *oldp, char *newp, int newpsz);
00161
00162 int NeedsCTA(const char *Lfn);
00163
00164 unsigned
00165 long long PathOpts(const char *Lfn);
00166
00167 int RemotePath (const char *oldp, char *newp, int newpsz);
00168
00169 XrdOucTList *Space(const char *Name, const char *Path=0);
00170
00171 int Stat(const char *xLfn, const char *xPfn, struct stat *buff);
00172
00173 enum SubSys {ssAdmin, ssMigr, ssPstg, ssPurg, ssXfr};
00174
00175 XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo);
00176 ~XrdFrmConfig() {}
00177
00178 private:
00179 XrdOucMsubs *ConfigCmd(const char *cname, char *cdata);
00180 int ConfigMum(XrdFrmConfigSE &theSE);
00181 int ConfigN2N();
00182 int ConfigMon(int isxfr);
00183 int ConfigMP(const char *);
00184 int ConfigMss();
00185 int ConfigOTO(char *Parms);
00186 int ConfigPaths();
00187 void ConfigPF(const char *pFN);
00188 int ConfigProc();
00189 int ConfigXeq(char *var, int mbok);
00190 int ConfigXfr();
00191 int getTime(const char *, const char *, int *, int mnv=-1, int mxv=-1);
00192 int Grab(const char *var, char **Dest, int nosubs);
00193 XrdOucTList *InsertPL(XrdOucTList *pP, const char *Path, int Plen, int isRW);
00194 void InsertXD(const char *Path);
00195 void Usage(int rc);
00196 int xapath();
00197 int xcks();
00198 int xcnsd();
00199 int xcopy();
00200 int xcopy(int &TLim);
00201 int xcmax();
00202 int xdpol();
00203 int xitm(const char *What, int &tDest);
00204 int xnml();
00205 int xmon();
00206 int xpol();
00207 int xpolprog();
00208 int xqchk();
00209 int xsit();
00210 int xspace(int isPrg=0, int isXA=1);
00211 void xspaceBuild(char *grp, char *fn, int isxa);
00212 int xxfr();
00213
00214 char *ConfigFN;
00215 char *LocalRoot;
00216 char *RemoteRoot;
00217 XrdOucStream *cFile;
00218 XrdVersionInfo *myVersion;
00219
00220 bool doStatPF;
00221 int plnDTS;
00222 const char *pfxDTS;
00223 const char *vOpts;
00224 const char *uInfo;
00225 char *N2N_Lib;
00226 char *N2N_Parms;
00227 XrdOucName2Name *lcl_N2N;
00228 XrdOucName2Name *rmt_N2N;
00229 SubSys ssID;
00230 };
00231 namespace XrdFrm
00232 {
00233 extern XrdFrmConfig Config;
00234 }
00235 #endif