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 /* Produced by Andrew Hanushevsky for Stanford University under contract */
9 /* DE-AC02-76-SFO0515 with the Deprtment of Energy */
10 /* */
11 /* This file is part of the XRootD software suite. */
12 /* */
13 /* XRootD is free software: you can redistribute it and/or modify it under */
14 /* the terms of the GNU Lesser General Public License as published by the */
15 /* Free Software Foundation, either version 3 of the License, or (at your */
16 /* option) any later version. */
17 /* */
18 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21 /* License for more details. */
22 /* */
23 /* You should have received a copy of the GNU Lesser General Public License */
24 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26 /* */
27 /* The copyright holder's institutional names and contributor's names may not */
28 /* be used to endorse or promote products derived from this software without */
29 /* specific prior written permission of the institution or contributor. */
30 /******************************************************************************/
31 
32 #include <string.h>
33 #include <unistd.h>
34 
35 #include "XrdOss/XrdOssSpace.hh"
36 
37 class XrdCks;
38 class XrdCksConfig;
39 class XrdNetCmsNotify;
40 class XrdOss;
41 class XrdOucMsubs;
42 class XrdOucName2Name;
43 class XrdOucProg;
44 class XrdOucStream;
45 class XrdOucTList;
46 class XrdSysLogger;
47 
48 class XrdFrmConfigSE;
49 
50 struct XrdVersionInfo;
51 
53 {
54 public:
55 
56 const char *myProg;
57 const char *myName;
58 const char *myInst;
59 const char *mySite;
60 const char *myFrmid;
61 const char *myFrmID;
62 const char *lockFN;
63 char *AdminPath;
64 char *QPath;
65 char *PidPath;
66 char *myInstance;
67 char *StopPurge;
68 char *MSSCmd;
70 
71 struct Cmd
72  {const char *Desc;
73  char *theCmd;
75  int TLimit;
76  int Opts;
77  } xfrCmd[4];
78 static const int cmdAlloc = 0x0001;
79 static const int cmdMDP = 0x0002;
80 static const int cmdStats = 0x0004;
81 static const int cmdXPD = 0x0008;
82 
83 int xfrIN;
84 int xfrOUT;
85 
86 char *CksAlg;
87 XrdCksConfig *CksCfg; // -> Checksum Configurator
88 XrdCks *CksMan; // -> Checksum Manager
89 XrdOucName2Name *the_N2N; // -> File mapper object
92 uid_t myUid;
93 gid_t myGid;
94 long long cmdFree;
95 int cmdHold;
97 int isAgent;
98 int xfrMax;
105 int isOTO;
106 int Fix;
107 int Test;
110 int runOld; // Backward compatability
111 int runNew; // Forward compatability
112 int nonXA; // Backward compatability for noXA spaces
113 int hasCache; // Backward compatability for noXA spaces
114 char **vectArg;
117 
118 struct VPInfo
120  char *Name;
122  int Val;
123  VPInfo(char *n, int m=0, struct VPInfo *p=0)
124  : Next(p), Name(strdup(n)), Dir(0), Val(m) {}
125  ~VPInfo() {} // Deletes are not important
126  } *VPList;
127 VPInfo *pathList; // Migr/Purg list of paths
128 XrdOucTList *spacList; // Migr/Purg list of spaces
129 
130 struct Policy
131  {long long minFree;
132  long long maxFree;
133  int Hold;
134  int Ext;
137  Policy(const char *snv, long long minV, long long maxV,
138  int hV, int xV) : minFree(minV), maxFree(maxV),
139  Hold(hV), Ext(xV), Next(0) {strcpy(Sname, snv);}
140  ~Policy() {}
141  };
143 
145 int pVecNum; // Number of policy variables
146 static const int pVecMax=8;
147 char pVec[pVecMax];
148 char *pProg;
149 char *xfrFdir;
151 
154 
155 int Configure(int argc, char **argv, int (*ppf)());
156 
157 int LocalPath (const char *oldp, char *newp, int newpsz);
158 
159 int LogicalPath(const char *oldp, char *newp, int newpsz);
160 
161 int NeedsCTA(const char *Lfn);
162 
163 unsigned
164 long long PathOpts(const char *Lfn);
165 
166 int RemotePath (const char *oldp, char *newp, int newpsz);
167 
168 XrdOucTList *Space(const char *Name, const char *Path=0);
169 
171 
172  XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo);
174 
175 private:
176 int ConfigCks();
177 XrdOucMsubs *ConfigCmd(const char *cname, char *cdata);
178 int ConfigMum(XrdFrmConfigSE &theSE);
179 int ConfigN2N();
180 int ConfigMon(int isxfr);
181 int ConfigMP(const char *);
182 int ConfigMss();
183 int ConfigOTO(char *Parms);
184 int ConfigPaths();
185 void ConfigPF(const char *pFN);
186 int ConfigProc();
187 int ConfigXeq(char *var, int mbok);
188 int ConfigXfr();
189 int getTime(const char *, const char *, int *, int mnv=-1, int mxv=-1);
190 int Grab(const char *var, char **Dest, int nosubs);
191 XrdOucTList *InsertPL(XrdOucTList *pP, const char *Path, int Plen, int isRW);
192 void InsertXD(const char *Path);
193 void Usage(int rc);
194 int xapath();
195 int xcks(int isOfs=0);
196 int xcnsd();
197 int xcopy();
198 int xcopy(int &TLim);
199 int xcmax();
200 int xdpol();
201 int xitm(const char *What, int &tDest);
202 int xnml();
203 int xmon();
204 int xoss();
205 int xpol();
206 int xpolprog();
207 int xqchk();
208 int xsit();
209 int xspace(int isPrg=0, int isXA=1);
210 void xspaceBuild(char *grp, char *fn, int isxa);
211 int xxfr();
212 
213 char *ConfigFN;
214 char *ossLib;
215 char *ossParms;
216 char *LocalRoot;
220 
221 int plnDTS;
222 const char *pfxDTS;
223 const char *vOpts;
224 const char *uInfo;
225 char *N2N_Lib; // -> Name2Name Library Path
226 char *N2N_Parms; // -> Name2Name Object Parameters
227 XrdOucName2Name *lcl_N2N; // -> File mapper for local files
228 XrdOucName2Name *rmt_N2N; // -> File mapper for remote files
230 };
231 namespace XrdFrm
232 {
233 extern XrdFrmConfig Config;
234 }
235 #endif