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