|
xrootd
|
00001 #ifndef _XRD_FRMCONFIG_H 00002 #define _XRD_FRMCONFIG_H 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d F r m C o n f i g . h h */ 00006 /* */ 00007 /* (C) 2009 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Deprtment of Energy */ 00011 /******************************************************************************/ 00012 00013 #include <string.h> 00014 #include <unistd.h> 00015 00016 #include "XrdOss/XrdOssSpace.hh" 00017 00018 class XrdCks; 00019 class XrdCksConfig; 00020 class XrdNetCmsNotify; 00021 class XrdOss; 00022 class XrdOucMsubs; 00023 class XrdOucName2Name; 00024 class XrdOucProg; 00025 class XrdOucStream; 00026 class XrdOucTList; 00027 class XrdSysLogger; 00028 00029 class XrdFrmConfigSE; 00030 00031 class XrdFrmConfig 00032 { 00033 public: 00034 00035 const char *myProg; 00036 const char *myName; 00037 const char *myInst; 00038 const char *myFrmid; 00039 const char *myFrmID; 00040 const char *lockFN; 00041 char *AdminPath; 00042 char *QPath; 00043 char *PidPath; 00044 char *myInstance; 00045 char *StopPurge; 00046 char *MSSCmd; 00047 XrdOucProg *MSSProg; 00048 00049 struct Cmd 00050 {const char *Desc; 00051 char *theCmd; 00052 XrdOucMsubs *theVec; 00053 int TLimit; 00054 int Opts; 00055 } xfrCmd[4]; 00056 static const int cmdAlloc = 0x0001; 00057 static const int cmdMDP = 0x0002; 00058 static const int cmdStats = 0x0004; 00059 00060 int xfrIN; 00061 int xfrOUT; 00062 00063 char *CksAlg; 00064 XrdCksConfig *CksCfg; // -> Checksum Configurator 00065 XrdCks *CksMan; // -> Checksum Manager 00066 XrdOucName2Name *the_N2N; // -> File mapper object 00067 XrdOss *ossFS; 00068 XrdNetCmsNotify *cmsPath; 00069 uid_t myUid; 00070 gid_t myGid; 00071 long long cmdFree; 00072 int cmdHold; 00073 int AdminMode; 00074 int isAgent; 00075 int xfrMax; 00076 int FailHold; 00077 int IdleHold; 00078 int WaitQChk; 00079 int WaitPurge; 00080 int WaitMigr; 00081 int monStage; 00082 int haveCMS; 00083 int isOTO; 00084 int Fix; 00085 int Test; 00086 int TrackDC; 00087 int Verbose; 00088 int runOld; // Backward compatability 00089 int runNew; // Forward compatability 00090 int nonXA; // Backward compatability for noXA spaces 00091 int hasCache; // Backward compatability for noXA spaces 00092 char **vectArg; 00093 int nextArg; 00094 int numcArg; 00095 00096 struct VPInfo 00097 {VPInfo *Next; 00098 char *Name; 00099 XrdOucTList *Dir; 00100 int Val; 00101 VPInfo(char *n, int m=0, struct VPInfo *p=0) 00102 : Next(p), Name(strdup(n)), Dir(0), Val(m) {} 00103 ~VPInfo() {} // Deletes are not important 00104 } *VPList; 00105 VPInfo *pathList; // Migr/Purg list of paths 00106 XrdOucTList *spacList; // Migr/Purg list of spaces 00107 00108 struct Policy 00109 {long long minFree; 00110 long long maxFree; 00111 int Hold; 00112 int Ext; 00113 Policy *Next; 00114 char Sname[XrdOssSpace::minSNbsz]; 00115 Policy(const char *snv, long long minV, long long maxV, 00116 int hV, int xV) : minFree(minV), maxFree(maxV), 00117 Hold(hV), Ext(xV), Next(0) {strcpy(Sname, snv);} 00118 ~Policy() {} 00119 }; 00120 Policy dfltPolicy; 00121 00122 int dirHold; 00123 int pVecNum; // Number of policy variables 00124 static const int pVecMax=8; 00125 char pVec[pVecMax]; 00126 char *pProg; 00127 00128 enum PPVar {PP_atime=0, PP_ctime, PP_fname, PP_fsize, PP_fspace, 00129 PP_mtime, PP_pfn, PP_sname, PP_tspace, PP_usage}; 00130 00131 int Configure(int argc, char **argv, int (*ppf)()); 00132 00133 int LocalPath (const char *oldp, char *newp, int newpsz); 00134 00135 int LogicalPath(const char *oldp, char *newp, int newpsz); 00136 00137 unsigned 00138 long long PathOpts(const char *Lfn); 00139 00140 int RemotePath (const char *oldp, char *newp, int newpsz); 00141 00142 XrdOucTList *Space(const char *Name, const char *Path=0); 00143 00144 enum SubSys {ssAdmin, ssMigr, ssPstg, ssPurg, ssXfr}; 00145 00146 XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo); 00147 ~XrdFrmConfig() {} 00148 00149 private: 00150 int ConfigCks(); 00151 XrdOucMsubs *ConfigCmd(const char *cname, char *cdata); 00152 int ConfigMum(XrdFrmConfigSE &theSE); 00153 int ConfigN2N(); 00154 int ConfigMP(const char *); 00155 int ConfigMss(); 00156 int ConfigOTO(char *Parms); 00157 int ConfigPaths(); 00158 void ConfigPF(const char *pFN); 00159 int ConfigProc(); 00160 int ConfigXeq(char *var, int mbok); 00161 int ConfigXfr(); 00162 int getTime(const char *, const char *, int *, int mnv=-1, int mxv=-1); 00163 int Grab(const char *var, char **Dest, int nosubs); 00164 XrdOucTList *InsertPL(XrdOucTList *pP, const char *Path, int Plen, int isRW); 00165 void InsertXD(const char *Path); 00166 void Usage(int rc); 00167 int xapath(); 00168 int xcks(int isOfs=0); 00169 int xcnsd(); 00170 int xcopy(); 00171 int xcopy(int &TLim); 00172 int xcmax(); 00173 int xdpol(); 00174 int xitm(const char *What, int &tDest); 00175 int xnml(); 00176 int xmon(); 00177 int xpol(); 00178 int xpolprog(); 00179 int xqchk(); 00180 int xspace(int isPrg=0, int isXA=1); 00181 void xspaceBuild(char *grp, char *fn, int isxa); 00182 int xxfr(); 00183 00184 char *ConfigFN; 00185 char *ossLib; 00186 char *LocalRoot; 00187 char *RemoteRoot; 00188 XrdOucStream *cFile; 00189 00190 int plnDTS; 00191 const char *pfxDTS; 00192 const char *vOpts; 00193 const char *uInfo; 00194 char *N2N_Lib; // -> Name2Name Library Path 00195 char *N2N_Parms; // -> Name2Name Object Parameters 00196 XrdOucName2Name *lcl_N2N; // -> File mapper for local files 00197 XrdOucName2Name *rmt_N2N; // -> File mapper for remote files 00198 SubSys ssID; 00199 }; 00200 namespace XrdFrm 00201 { 00202 extern XrdFrmConfig Config; 00203 } 00204 #endif
1.7.5