xrootd
XrdOfsConfigPI.hh
Go to the documentation of this file.
1 #ifndef __XRDOFSCONFIGPI_HH__
2 #define __XRDOFSCONFIGPI_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d O f s C o n f i g P I . h h */
6 /* */
7 /* (c) 2014 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include <vector>
34 
35 #include "XrdCms/XrdCmsClient.hh"
36 
37 class XrdAccAuthorize;
38 class XrdCks;
39 class XrdCksConfig;
40 class XrdOfs;
41 class XrdOfsFSctl_PI;
42 class XrdOfsPrepare;
43 class XrdOss;
44 class XrdOucEnv;
45 class XrdOucStream;
46 class XrdSfsFileSystem;
47 class XrdSysError;
48 class XrdSysXAttr;
49 struct XrdVersionInfo;
50 
51 //-----------------------------------------------------------------------------
58 //-----------------------------------------------------------------------------
59 
61 {
62 public:
63 
64 //-----------------------------------------------------------------------------
67 //-----------------------------------------------------------------------------
68 
69 enum TheLib {theAtrLib = 0x0100,
70  theAutLib = 0x0201,
71  theCksLib = 0x0402,
72  theCmsLib = 0x0803,
73  theCtlLib = 0x1004,
74  theOssLib = 0x2005,
75  thePrpLib = 0x4006,
76  allXXXLib = 0x7f07,
77  maxXXXLib = 0x0007,
78  libIXMask = 0x00ff
79  };
80 
81 //-----------------------------------------------------------------------------
89 //-----------------------------------------------------------------------------
90 
91 bool Configure(XrdCmsClient *cmscP, XrdOucEnv *envP);
92 
93 //-----------------------------------------------------------------------------
98 //-----------------------------------------------------------------------------
99 
100 bool ConfigCtl(XrdCmsClient *cmscP, XrdOucEnv *envP=0);
101 
102 //-----------------------------------------------------------------------------
109 //-----------------------------------------------------------------------------
110 
111 void Default(TheLib what, const char *lpath, const char *lparm=0);
112 
113 //-----------------------------------------------------------------------------
118 //-----------------------------------------------------------------------------
119 
120 void DefaultCS(const char *alg);
121 
122 //-----------------------------------------------------------------------------
124 //-----------------------------------------------------------------------------
125 
126 void Display();
127 
128 //-----------------------------------------------------------------------------
137 //-----------------------------------------------------------------------------
138 
139 bool Load(int what, XrdOucEnv *envP=0);
140 
141 //-----------------------------------------------------------------------------
156 //-----------------------------------------------------------------------------
157 
158 static
159 XrdOfsConfigPI *New(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP,
160  XrdVersionInfo *verP=0, XrdSfsFileSystem *sfsP=0);
161 
162 //-----------------------------------------------------------------------------
166 //-----------------------------------------------------------------------------
167 
168 bool LclCks() {return cksLcl;}
169 
170 //-----------------------------------------------------------------------------
174 //-----------------------------------------------------------------------------
175 
176 bool OssCks();
177 
178 //-----------------------------------------------------------------------------
183 //-----------------------------------------------------------------------------
184 
185 bool Parse(TheLib what);
186 
187 //-----------------------------------------------------------------------------
194 //-----------------------------------------------------------------------------
195 
196 bool Plugin(XrdAccAuthorize *&piP);
197 bool Plugin(XrdCks *&pip);
198 bool Plugin(XrdCmsClient_t &piP);
199 bool Plugin(XrdOfsFSctl_PI *&piP);
200 bool Plugin(XrdOfsPrepare *&piP);
201 bool Plugin(XrdOss *&piP);
202 
203 //-----------------------------------------------------------------------------
207 //-----------------------------------------------------------------------------
208 
209 bool PrepAuth();
210 
211 //-----------------------------------------------------------------------------
219 //-----------------------------------------------------------------------------
220 
221 bool Push(TheLib what, const char *plugP, const char *parmP=0);
222 
223 //-----------------------------------------------------------------------------
227 //-----------------------------------------------------------------------------
228 
229 void SetCksRdSz(int rdsz);
230 
231 //-----------------------------------------------------------------------------
233 //-----------------------------------------------------------------------------
234 
235  ~XrdOfsConfigPI();
236 
237 private:
238 
239 //-----------------------------------------------------------------------------
250 //-----------------------------------------------------------------------------
251 
252  XrdOfsConfigPI(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP,
253  XrdSfsFileSystem *sfsP, XrdVersionInfo *verP=0);
254 
255 bool AddLib(TheLib what);
256 bool AddLibAtr(XrdOucEnv *envP, XrdSysXAttr *&atrPI);
257 bool AddLibAut(XrdOucEnv *envP);
258 bool AddLibCtl(XrdOucEnv *envP);
259 bool AddLibOss(XrdOucEnv *envP);
260 bool AddLibPrp(XrdOucEnv *envP);
261 bool ParseAtrLib();
262 bool ParseOssLib();
263 bool ParsePrpLib();
264 bool RepLib(TheLib what, const char *newLib, const char *newParms=0, bool parseParms=true);
265 bool SetupAttr(TheLib what, XrdOucEnv *envP);
266 bool SetupAuth(XrdOucEnv *envP);
267 bool SetupCtl(XrdOucEnv *envP);
268 bool SetupCms();
269 bool SetupPrp(XrdOucEnv *envP);
270 
277 XrdSfsFileSystem *sfsPI;
278 XrdVersionInfo *urVer;
279 
283 const char *ConfigFN;
284 
285 struct xxxLP
286  {char *lib;
287  char *parms;
288  char *opts;
289  xxxLP() : lib(0), parms(0), opts(0) {}
290  ~xxxLP() {if (lib) free(lib);
291  if (parms) free(parms);
292  if (opts) free(opts);
293  }
294  xxxLP& operator=(const xxxLP& rhs)
295  {if (this != &rhs)
296  {lib = (rhs.lib ? strdup(rhs.lib) : 0);
297  parms = (rhs.parms ? strdup(rhs.parms) : 0);
298  opts = (rhs.opts ? strdup(rhs.opts) : 0);
299  }
300  return *this;
301  }
302  xxxLP(const xxxLP& rhs) {*this = rhs;}
303 
304  } LP[maxXXXLib];
305 std::vector<xxxLP> ALP[maxXXXLib];
306 
307 struct ctlLP {XrdOfsFSctl_PI *ctlPI; const char *parms;};
308 
309 std::vector<ctlLP> ctlVec;
310 
311 char *CksAlg;
315 bool ossXAttr;
316 char ossCksio;
317 bool prpAuth;
318 bool Loaded;
319 bool LoadOK;
320 bool cksLcl;
321 };
322 #endif
char * parms
Definition: XrdOfsConfigPI.hh:287
XrdSysError * Eroute
Definition: XrdOfsConfigPI.hh:281
XrdOfsConfigPI(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP, XrdSfsFileSystem *sfsP, XrdVersionInfo *verP=0)
XrdOucStream * Config
Definition: XrdOfsConfigPI.hh:280
XrdCmsClient *(* XrdCmsClient_t)(XrdSysLogger *, int, int, XrdOss *)
Definition: XrdCmsClient.hh:427
bool AddLibAut(XrdOucEnv *envP)
XrdOfsPrepare * prpPI
-> Prp plugin (prepare)
Definition: XrdOfsConfigPI.hh:275
bool AddLibPrp(XrdOucEnv *envP)
bool ParseAtrLib()
~xxxLP()
Definition: XrdOfsConfigPI.hh:290
bool Plugin(XrdAccAuthorize *&piP)
Get Authorization plugin.
void SetCksRdSz(int rdsz)
XrdCks * cksPI
-> Checksum manager plugin
Definition: XrdOfsConfigPI.hh:272
Definition: XrdCks.hh:91
bool SetupAuth(XrdOucEnv *envP)
char * lib
Definition: XrdOfsConfigPI.hh:286
Maximum different plugins.
Definition: XrdOfsConfigPI.hh:77
XrdCksConfig * CksConfig
Definition: XrdOfsConfigPI.hh:282
Cms client plugin.
Definition: XrdOfsConfigPI.hh:72
Definition: XrdCksConfig.hh:43
Definition: XrdOucStream.hh:46
bool SetupCtl(XrdOucEnv *envP)
Prp plugin (prepare)
Definition: XrdOfsConfigPI.hh:75
char * opts
Definition: XrdOfsConfigPI.hh:288
Definition: XrdSysXAttr.hh:42
bool cksLcl
Definition: XrdOfsConfigPI.hh:320
bool ossXAttr
Definition: XrdOfsConfigPI.hh:315
Definition: XrdOfsConfigPI.hh:285
All plugins (Load() only)
Definition: XrdOfsConfigPI.hh:76
Definition: XrdCmsClient.hh:115
bool RepLib(TheLib what, const char *newLib, const char *newParms=0, bool parseParms=true)
Definition: XrdAccAuthorize.hh:65
Ctl plugin (FSCtl)
Definition: XrdOfsConfigPI.hh:73
bool SetupPrp(XrdOucEnv *envP)
bool Parse(TheLib what)
Definition: XrdSysError.hh:89
xxxLP(const xxxLP &rhs)
Definition: XrdOfsConfigPI.hh:302
XrdSfsFileSystem * sfsPI
-> Ofs plugin
Definition: XrdOfsConfigPI.hh:277
TheLib
Definition: XrdOfsConfigPI.hh:69
XrdVersionInfo * urVer
-> Version information
Definition: XrdOfsConfigPI.hh:278
Oss plugin.
Definition: XrdOfsConfigPI.hh:74
bool LoadOK
Definition: XrdOfsConfigPI.hh:319
bool ParsePrpLib()
char ossCksio
Definition: XrdOfsConfigPI.hh:316
XrdOfsFSctl_PI * ctlPI
-> Ctl plugin (FSCtl)
Definition: XrdOfsConfigPI.hh:274
XrdOss * ossPI
-> Oss plugin
Definition: XrdOfsConfigPI.hh:276
xxxLP()
Definition: XrdOfsConfigPI.hh:289
struct XrdOfsConfigPI::xxxLP LP[maxXXXLib]
bool Load(int what, XrdOucEnv *envP=0)
Definition: XrdOfsConfigPI.hh:60
std::vector< xxxLP > ALP[maxXXXLib]
Definition: XrdOfsConfigPI.hh:305
Definition: XrdOucEnv.hh:41
bool LclCks()
Definition: XrdOfsConfigPI.hh:168
char * CksAlg
Definition: XrdOfsConfigPI.hh:311
bool AddLibAtr(XrdOucEnv *envP, XrdSysXAttr *&atrPI)
Definition: XrdOfsFSctl_PI.hh:51
Definition: XrdOfs.hh:217
void Display()
Display configuration settings.
XrdOfsFSctl_PI * ctlPI
Definition: XrdOfsConfigPI.hh:307
bool AddLibCtl(XrdOucEnv *envP)
const char * ConfigFN
Definition: XrdOfsConfigPI.hh:283
bool ConfigCtl(XrdCmsClient *cmscP, XrdOucEnv *envP=0)
Authorization plugin.
Definition: XrdOfsConfigPI.hh:70
bool ParseOssLib()
xxxLP & operator=(const xxxLP &rhs)
Definition: XrdOfsConfigPI.hh:294
XrdAccAuthorize * autPI
-> Authorization plugin
Definition: XrdOfsConfigPI.hh:271
bool Push(TheLib what, const char *plugP, const char *parmP=0)
bool AddLib(TheLib what)
static XrdOfsConfigPI * New(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP, XrdVersionInfo *verP=0, XrdSfsFileSystem *sfsP=0)
int CksRdsz
Definition: XrdOfsConfigPI.hh:312
Extended attribute plugin.
Definition: XrdOfsConfigPI.hh:69
bool AddLibOss(XrdOucEnv *envP)
bool pushOK[maxXXXLib]
Definition: XrdOfsConfigPI.hh:313
Definition: XrdOss.hh:498
bool defLib[maxXXXLib]
Definition: XrdOfsConfigPI.hh:314
bool SetupAttr(TheLib what, XrdOucEnv *envP)
Definition: XrdOfsConfigPI.hh:307
~XrdOfsConfigPI()
Destructor.
bool Loaded
Definition: XrdOfsConfigPI.hh:318
const char * parms
Definition: XrdOfsConfigPI.hh:307
Definition: XrdOfsPrepare.hh:46
Checksum manager plugin.
Definition: XrdOfsConfigPI.hh:71
void DefaultCS(const char *alg)
void Default(TheLib what, const char *lpath, const char *lparm=0)
bool Configure(XrdCmsClient *cmscP, XrdOucEnv *envP)
XrdCmsClient_t cmsPI
-> Cms client object generator plugin
Definition: XrdOfsConfigPI.hh:273
bool prpAuth
Definition: XrdOfsConfigPI.hh:317
std::vector< ctlLP > ctlVec
Definition: XrdOfsConfigPI.hh:309
Definition: XrdOfsConfigPI.hh:78