xrootd
XrdFrmConfig.hh
Go to the documentation of this file.
1 #ifndef _XRD_FRMCONFIG_H
2 #define _XRD_FRMCONFIG_H
3 /******************************************************************************/
4 /* */
5 /* X r d F r m C o n f i g . h h */
6 /* */
7 /* (C) 2009 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Deprtment of Energy */
11 /******************************************************************************/
12 
13 #include <string.h>
14 #include <unistd.h>
15 
16 #include "XrdOss/XrdOssSpace.hh"
17 
18 class XrdCks;
19 class XrdCksConfig;
20 class XrdNetCmsNotify;
21 class XrdOss;
22 class XrdOucMsubs;
23 class XrdOucName2Name;
24 class XrdOucProg;
25 class XrdOucStream;
26 class XrdOucTList;
27 class XrdSysLogger;
28 
29 class XrdFrmConfigSE;
30 
32 {
33 public:
34 
35 const char *myProg;
36 const char *myName;
37 const char *myInst;
38 const char *myFrmid;
39 const char *myFrmID;
40 const char *lockFN;
41 char *AdminPath;
42 char *QPath;
43 char *PidPath;
44 char *myInstance;
45 char *StopPurge;
46 char *MSSCmd;
48 
49 struct Cmd
50  {const char *Desc;
51  char *theCmd;
53  int TLimit;
54  int Opts;
55  } xfrCmd[4];
56 static const int cmdAlloc = 0x0001;
57 static const int cmdMDP = 0x0002;
58 static const int cmdStats = 0x0004;
59 static const int cmdXPD = 0x0008;
60 
61 int xfrIN;
62 int xfrOUT;
63 
64 char *CksAlg;
65 XrdCksConfig *CksCfg; // -> Checksum Configurator
66 XrdCks *CksMan; // -> Checksum Manager
67 XrdOucName2Name *the_N2N; // -> File mapper object
70 uid_t myUid;
71 gid_t myGid;
72 long long cmdFree;
73 int cmdHold;
75 int isAgent;
76 int xfrMax;
82 int haveCMS;
83 int isOTO;
84 int Fix;
85 int Test;
86 int TrackDC;
87 int Verbose;
88 int runOld; // Backward compatability
89 int runNew; // Forward compatability
90 int nonXA; // Backward compatability for noXA spaces
91 int hasCache; // Backward compatability for noXA spaces
92 char **vectArg;
93 int nextArg;
94 int numcArg;
95 
96 struct VPInfo
98  char *Name;
100  int Val;
101  VPInfo(char *n, int m=0, struct VPInfo *p=0)
102  : Next(p), Name(strdup(n)), Dir(0), Val(m) {}
103  ~VPInfo() {} // Deletes are not important
104  } *VPList;
105 VPInfo *pathList; // Migr/Purg list of paths
106 XrdOucTList *spacList; // Migr/Purg list of spaces
107 
108 struct Policy
109  {long long minFree;
110  long long maxFree;
111  int Hold;
112  int Ext;
115  Policy(const char *snv, long long minV, long long maxV,
116  int hV, int xV) : minFree(minV), maxFree(maxV),
117  Hold(hV), Ext(xV), Next(0) {strcpy(Sname, snv);}
118  ~Policy() {}
119  };
121 
123 int pVecNum; // Number of policy variables
124 static const int pVecMax=8;
125 char pVec[pVecMax];
126 char *pProg;
127 
130 
131 int Configure(int argc, char **argv, int (*ppf)());
132 
133 int LocalPath (const char *oldp, char *newp, int newpsz);
134 
135 int LogicalPath(const char *oldp, char *newp, int newpsz);
136 
137 int NeedsCTA(const char *Lfn);
138 
139 unsigned
140 long long PathOpts(const char *Lfn);
141 
142 int RemotePath (const char *oldp, char *newp, int newpsz);
143 
144 XrdOucTList *Space(const char *Name, const char *Path=0);
145 
147 
148  XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo);
150 
151 private:
152 int ConfigCks();
153 XrdOucMsubs *ConfigCmd(const char *cname, char *cdata);
154 int ConfigMum(XrdFrmConfigSE &theSE);
155 int ConfigN2N();
156 int ConfigMon(int isxfr);
157 int ConfigMP(const char *);
158 int ConfigMss();
159 int ConfigOTO(char *Parms);
160 int ConfigPaths();
161 void ConfigPF(const char *pFN);
162 int ConfigProc();
163 int ConfigXeq(char *var, int mbok);
164 int ConfigXfr();
165 int getTime(const char *, const char *, int *, int mnv=-1, int mxv=-1);
166 int Grab(const char *var, char **Dest, int nosubs);
167 XrdOucTList *InsertPL(XrdOucTList *pP, const char *Path, int Plen, int isRW);
168 void InsertXD(const char *Path);
169 void Usage(int rc);
170 int xapath();
171 int xcks(int isOfs=0);
172 int xcnsd();
173 int xcopy();
174 int xcopy(int &TLim);
175 int xcmax();
176 int xdpol();
177 int xitm(const char *What, int &tDest);
178 int xnml();
179 int xmon();
180 int xpol();
181 int xpolprog();
182 int xqchk();
183 int xspace(int isPrg=0, int isXA=1);
184 void xspaceBuild(char *grp, char *fn, int isxa);
185 int xxfr();
186 
187 char *ConfigFN;
188 char *ossLib;
189 char *LocalRoot;
192 
193 int plnDTS;
194 const char *pfxDTS;
195 const char *vOpts;
196 const char *uInfo;
197 char *N2N_Lib; // -> Name2Name Library Path
198 char *N2N_Parms; // -> Name2Name Object Parameters
199 XrdOucName2Name *lcl_N2N; // -> File mapper for local files
200 XrdOucName2Name *rmt_N2N; // -> File mapper for remote files
202 };
203 namespace XrdFrm
204 {
205 extern XrdFrmConfig Config;
206 }
207 #endif