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