xrootd
XrdFrmConfig.hh
Go to the documentation of this file.
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 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00009 /*                DE-AC02-76-SFO0515 with the Deprtment of Energy             */
00010 /*                                                                            */
00011 /* This file is part of the XRootD software suite.                            */
00012 /*                                                                            */
00013 /* XRootD is free software: you can redistribute it and/or modify it under    */
00014 /* the terms of the GNU Lesser General Public License as published by the     */
00015 /* Free Software Foundation, either version 3 of the License, or (at your     */
00016 /* option) any later version.                                                 */
00017 /*                                                                            */
00018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00020 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00021 /* License for more details.                                                  */
00022 /*                                                                            */
00023 /* You should have received a copy of the GNU Lesser General Public License   */
00024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00025 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00026 /*                                                                            */
00027 /* The copyright holder's institutional names and contributor's names may not */
00028 /* be used to endorse or promote products derived from this software without  */
00029 /* specific prior written permission of the institution or contributor.       */
00030 /******************************************************************************/
00031 
00032 #include <string.h>
00033 #include <unistd.h>
00034 
00035 #include "XrdOss/XrdOssSpace.hh"
00036 
00037 class XrdCks;
00038 class XrdCksConfig;
00039 class XrdNetCmsNotify;
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 
00052 class XrdFrmConfig
00053 {
00054 public:
00055 
00056 const char         *myProg;
00057 const char         *myName;
00058 const char         *myInst;
00059 const char         *mySite;
00060 const char         *myFrmid;
00061 const char         *myFrmID;
00062 const char         *lockFN;
00063 char               *AdminPath;
00064 char               *QPath;
00065 char               *PidPath;
00066 char               *myInstance;
00067 char               *StopPurge;
00068 char               *MSSCmd;
00069 XrdOucProg         *MSSProg;
00070 
00071 struct Cmd
00072       {const char  *Desc;
00073        char        *theCmd;
00074        XrdOucMsubs *theVec;
00075        int          TLimit;
00076        int          Opts;
00077       }             xfrCmd[4];
00078 static const int    cmdAlloc = 0x0001;
00079 static const int    cmdMDP   = 0x0002;
00080 static const int    cmdStats = 0x0004;
00081 static const int    cmdXPD   = 0x0008;
00082 
00083 int                 xfrIN;
00084 int                 xfrOUT;
00085 
00086 char               *CksAlg;
00087 XrdCksConfig       *CksCfg;    // -> Checksum Configurator
00088 XrdCks             *CksMan;    // -> Checksum Manager
00089 XrdOucName2Name    *the_N2N;   // -> File mapper object
00090 XrdOss             *ossFS;
00091 XrdNetCmsNotify    *cmsPath;
00092 uid_t               myUid;
00093 gid_t               myGid;
00094 long long           cmdFree;
00095 int                 cmdHold;
00096 int                 AdminMode;
00097 int                 isAgent;
00098 int                 xfrMax;
00099 int                 FailHold;
00100 int                 IdleHold;
00101 int                 WaitQChk;
00102 int                 WaitPurge;
00103 int                 WaitMigr;
00104 int                 haveCMS;
00105 int                 isOTO;
00106 int                 Fix;
00107 int                 Test;
00108 int                 TrackDC;
00109 int                 Verbose;
00110 int                 runOld;    // Backward compatability
00111 int                 runNew;    // Forward  compatability
00112 int                 nonXA;     // Backward compatability for noXA spaces
00113 int                 hasCache;  // Backward compatability for noXA spaces
00114 char              **vectArg;
00115 int                 nextArg;
00116 int                 numcArg;
00117 
00118 struct VPInfo
00119       {VPInfo      *Next;
00120        char        *Name;
00121        XrdOucTList *Dir;
00122        int          Val;
00123                     VPInfo(char *n, int m=0, struct VPInfo *p=0)
00124                           : Next(p), Name(strdup(n)), Dir(0), Val(m) {}
00125                    ~VPInfo() {} // Deletes are not important
00126       }            *VPList;
00127 VPInfo             *pathList;   // Migr/Purg list of paths
00128 XrdOucTList        *spacList;   // Migr/Purg list of spaces
00129 
00130 struct Policy
00131       {long long minFree;
00132        long long maxFree;
00133        int       Hold;
00134        int       Ext;
00135        Policy   *Next;
00136        char      Sname[XrdOssSpace::minSNbsz];
00137                  Policy(const char *snv, long long minV, long long maxV,
00138                         int hV, int xV) : minFree(minV), maxFree(maxV),
00139                         Hold(hV), Ext(xV), Next(0) {strcpy(Sname, snv);}
00140                 ~Policy() {}
00141       };
00142 Policy           dfltPolicy;
00143 
00144 int              dirHold;
00145 int              pVecNum;     // Number of policy variables
00146 static const int pVecMax=8;
00147 char             pVec[pVecMax];
00148 char            *pProg;
00149 char            *xfrFdir;
00150 int              xfrFdln;
00151 
00152 enum  PPVar {PP_atime=0, PP_ctime, PP_fname, PP_fsize, PP_fspace,
00153              PP_mtime,   PP_pfn,   PP_sname, PP_tspace, PP_usage};
00154 
00155 int          Configure(int argc, char **argv, int (*ppf)());
00156 
00157 int          LocalPath  (const char *oldp, char *newp, int newpsz);
00158 
00159 int          LogicalPath(const char *oldp, char *newp, int newpsz);
00160 
00161 int          NeedsCTA(const char *Lfn);
00162 
00163 unsigned
00164 long long    PathOpts(const char *Lfn);
00165 
00166 int          RemotePath (const char *oldp, char *newp, int newpsz);
00167 
00168 XrdOucTList *Space(const char *Name, const char *Path=0);
00169 
00170 enum  SubSys {ssAdmin, ssMigr, ssPstg, ssPurg, ssXfr};
00171 
00172       XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo);
00173      ~XrdFrmConfig() {}
00174 
00175 private:
00176 int          ConfigCks();
00177 XrdOucMsubs *ConfigCmd(const char *cname, char *cdata);
00178 int          ConfigMum(XrdFrmConfigSE &theSE);
00179 int          ConfigN2N();
00180 int          ConfigMon(int isxfr);
00181 int          ConfigMP(const char *);
00182 int          ConfigMss();
00183 int          ConfigOTO(char *Parms);
00184 int          ConfigPaths();
00185 void         ConfigPF(const char *pFN);
00186 int          ConfigProc();
00187 int          ConfigXeq(char *var, int mbok);
00188 int          ConfigXfr();
00189 int          getTime(const char *, const char *, int *, int mnv=-1, int mxv=-1);
00190 int          Grab(const char *var, char **Dest, int nosubs);
00191 XrdOucTList *InsertPL(XrdOucTList *pP, const char *Path, int Plen, int isRW);
00192 void         InsertXD(const char *Path);
00193 void         Usage(int rc);
00194 int          xapath();
00195 int          xcks(int isOfs=0);
00196 int          xcnsd();
00197 int          xcopy();
00198 int          xcopy(int &TLim);
00199 int          xcmax();
00200 int          xdpol();
00201 int          xitm(const char *What, int &tDest);
00202 int          xnml();
00203 int          xmon();
00204 int          xoss();
00205 int          xpol();
00206 int          xpolprog();
00207 int          xqchk();
00208 int          xsit();
00209 int          xspace(int isPrg=0, int isXA=1);
00210 void         xspaceBuild(char *grp, char *fn, int isxa);
00211 int          xxfr();
00212 
00213 char               *ConfigFN;
00214 char               *ossLib;
00215 char               *ossParms;
00216 char               *LocalRoot;
00217 char               *RemoteRoot;
00218 XrdOucStream       *cFile;
00219 XrdVersionInfo     *myVersion;
00220 
00221 int                 plnDTS;
00222 const char         *pfxDTS;
00223 const char         *vOpts;
00224 const char         *uInfo;
00225 char               *N2N_Lib;   // -> Name2Name Library Path
00226 char               *N2N_Parms; // -> Name2Name Object Parameters
00227 XrdOucName2Name    *lcl_N2N;   // -> File mapper for local  files
00228 XrdOucName2Name    *rmt_N2N;   // -> File mapper for remote files
00229 SubSys              ssID;
00230 };
00231 namespace XrdFrm
00232 {
00233 extern XrdFrmConfig Config;
00234 }
00235 #endif