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 //-----------------------------------------------------------------------------
215 //-----------------------------------------------------------------------------
216 
217 void SetCksRdSz(int rdsz);
218 
219 //-----------------------------------------------------------------------------
221 //-----------------------------------------------------------------------------
222 
224 
225 private:
226 
227 //-----------------------------------------------------------------------------
238 //-----------------------------------------------------------------------------
239 
240  XrdOfsConfigPI(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP,
241  XrdSfsFileSystem *sfsP, XrdVersionInfo *verP=0);
242 
243 bool AddLib(TheLib what);
244 bool AddLibAtr(XrdOucEnv *envP, XrdSysXAttr *&atrPI);
245 bool AddLibAut(XrdOucEnv *envP);
246 bool AddLibCtl(XrdOucEnv *envP);
247 bool AddLibOss(XrdOucEnv *envP);
248 bool AddLibPrp(XrdOucEnv *envP);
249 bool ParseAtrLib();
250 bool ParseOssLib();
251 bool ParsePrpLib();
252 bool RepLib(TheLib what, const char *newLib, const char *newParms=0, bool parseParms=true);
253 bool SetupAttr(TheLib what, XrdOucEnv *envP);
254 bool SetupAuth(XrdOucEnv *envP);
255 bool SetupCtl(XrdOucEnv *envP);
256 bool SetupCms();
257 bool SetupPrp(XrdOucEnv *envP);
258 
266 XrdVersionInfo *urVer;
267 
271 const char *ConfigFN;
272 
273 struct xxxLP
274  {char *lib;
275  char *parms;
276  char *opts;
277  xxxLP() : lib(0), parms(0), opts(0) {}
278  ~xxxLP() {if (lib) free(lib);
279  if (parms) free(parms);
280  if (opts) free(opts);
281  }
282  xxxLP& operator=(const xxxLP& rhs)
283  {if (this != &rhs)
284  {lib = (rhs.lib ? strdup(rhs.lib) : 0);
285  parms = (rhs.parms ? strdup(rhs.parms) : 0);
286  opts = (rhs.opts ? strdup(rhs.opts) : 0);
287  }
288  return *this;
289  }
290  xxxLP(const xxxLP& rhs) {*this = rhs;}
291 
293 std::vector<xxxLP> ALP[maxXXXLib];
294 
295 struct ctlLP {XrdOfsFSctl_PI *ctlPI; const char *parms;};
296 
297 std::vector<ctlLP> ctlVec;
298 
299 char *CksAlg;
303 bool ossXAttr;
304 bool ossCksio;
305 bool prpAuth;
306 bool Loaded;
307 bool LoadOK;
308 bool cksLcl;
309 };
310 #endif
XrdOfsConfigPI::Parse
bool Parse(TheLib what)
XrdOss
Definition: XrdOss.hh:488
XrdOfsConfigPI::ctlLP::ctlPI
XrdOfsFSctl_PI * ctlPI
Definition: XrdOfsConfigPI.hh:295
XrdOfsConfigPI::ossCksio
bool ossCksio
Definition: XrdOfsConfigPI.hh:304
XrdOfsConfigPI::xxxLP::~xxxLP
~xxxLP()
Definition: XrdOfsConfigPI.hh:278
XrdOfsConfigPI::theCksLib
@ theCksLib
Checksum manager plugin.
Definition: XrdOfsConfigPI.hh:71
XrdOfsConfigPI::ParseOssLib
bool ParseOssLib()
XrdOfsConfigPI::SetupCms
bool SetupCms()
XrdOfsConfigPI::SetupAuth
bool SetupAuth(XrdOucEnv *envP)
XrdOfsConfigPI
Definition: XrdOfsConfigPI.hh:61
XrdOfsConfigPI::XrdOfsConfigPI
XrdOfsConfigPI(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP, XrdSfsFileSystem *sfsP, XrdVersionInfo *verP=0)
XrdOfsConfigPI::xxxLP::xxxLP
xxxLP(const xxxLP &rhs)
Definition: XrdOfsConfigPI.hh:290
XrdOfsConfigPI::maxXXXLib
@ maxXXXLib
Maximum different plugins.
Definition: XrdOfsConfigPI.hh:77
XrdOfsConfigPI::ParseAtrLib
bool ParseAtrLib()
XrdOfsConfigPI::Plugin
bool Plugin(XrdCks *&pip)
Get Checksum manager plugin.
XrdOfsConfigPI::New
static XrdOfsConfigPI * New(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP, XrdVersionInfo *verP=0, XrdSfsFileSystem *sfsP=0)
XrdOfsConfigPI::AddLibAtr
bool AddLibAtr(XrdOucEnv *envP, XrdSysXAttr *&atrPI)
XrdSfsFileSystem
Definition: XrdSfsInterface.hh:816
XrdOfsConfigPI::sfsPI
XrdSfsFileSystem * sfsPI
-> Ofs plugin
Definition: XrdOfsConfigPI.hh:265
XrdOfsConfigPI::ParsePrpLib
bool ParsePrpLib()
XrdOfsConfigPI::OssCks
bool OssCks()
XrdOfsConfigPI::ctlPI
XrdOfsFSctl_PI * ctlPI
-> Ctl plugin (FSCtl)
Definition: XrdOfsConfigPI.hh:262
XrdOfsConfigPI::allXXXLib
@ allXXXLib
All plugins (Load() only)
Definition: XrdOfsConfigPI.hh:76
XrdOfsConfigPI::Plugin
bool Plugin(XrdOss *&piP)
Get Oss plugin.
XrdOfsConfigPI::pushOK
bool pushOK[maxXXXLib]
Definition: XrdOfsConfigPI.hh:301
XrdCmsClient
Definition: XrdCmsClient.hh:116
XrdOfsConfigPI::theCmsLib
@ theCmsLib
Cms client plugin.
Definition: XrdOfsConfigPI.hh:72
XrdOfsConfigPI::SetupAttr
bool SetupAttr(TheLib what, XrdOucEnv *envP)
XrdOfsConfigPI::cksPI
XrdCks * cksPI
-> Checksum manager plugin
Definition: XrdOfsConfigPI.hh:260
XrdOfsConfigPI::AddLib
bool AddLib(TheLib what)
XrdOfsConfigPI::Plugin
bool Plugin(XrdCmsClient_t &piP)
Get Cms client object generator.
XrdOfsConfigPI::theCtlLib
@ theCtlLib
Ctl plugin (FSCtl)
Definition: XrdOfsConfigPI.hh:73
XrdOfsConfigPI::cksLcl
bool cksLcl
Definition: XrdOfsConfigPI.hh:308
XrdOfsConfigPI::thePrpLib
@ thePrpLib
Prp plugin (prepare)
Definition: XrdOfsConfigPI.hh:75
XrdOfsConfigPI::autPI
XrdAccAuthorize * autPI
-> Authorization plugin
Definition: XrdOfsConfigPI.hh:259
XrdOfsConfigPI::Plugin
bool Plugin(XrdOfsPrepare *&piP)
Get Prp plugin (prepare)
XrdOucStream
Definition: XrdOucStream.hh:47
XrdOfsConfigPI::Configure
bool Configure(XrdCmsClient *cmscP, XrdOucEnv *envP)
XrdOfsConfigPI::AddLibAut
bool AddLibAut(XrdOucEnv *envP)
XrdCks
Definition: XrdCks.hh:78
XrdOfsConfigPI::SetCksRdSz
void SetCksRdSz(int rdsz)
XrdOfsConfigPI::SetupCtl
bool SetupCtl(XrdOucEnv *envP)
XrdOfsConfigPI::CksRdsz
int CksRdsz
Definition: XrdOfsConfigPI.hh:300
XrdOfsConfigPI::LP
struct XrdOfsConfigPI::xxxLP LP[maxXXXLib]
XrdOfsConfigPI::AddLibPrp
bool AddLibPrp(XrdOucEnv *envP)
XrdCksConfig
Definition: XrdCksConfig.hh:43
XrdOfsConfigPI::ConfigCtl
bool ConfigCtl(XrdCmsClient *cmscP, XrdOucEnv *envP=0)
XrdOfsConfigPI::CksAlg
char * CksAlg
Definition: XrdOfsConfigPI.hh:299
XrdOfsConfigPI::Plugin
bool Plugin(XrdOfsFSctl_PI *&piP)
Get Ctl plugin.
XrdOfsConfigPI::xxxLP::xxxLP
xxxLP()
Definition: XrdOfsConfigPI.hh:277
XrdOfsConfigPI::AddLibOss
bool AddLibOss(XrdOucEnv *envP)
XrdOfsConfigPI::Display
void Display()
Display configuration settings.
XrdOfsConfigPI::ctlVec
std::vector< ctlLP > ctlVec
Definition: XrdOfsConfigPI.hh:297
XrdCmsClient.hh
XrdAccAuthorize
Definition: XrdAccAuthorize.hh:66
XrdOfsConfigPI::prpAuth
bool prpAuth
Definition: XrdOfsConfigPI.hh:305
XrdOfsConfigPI::LclCks
bool LclCks()
Definition: XrdOfsConfigPI.hh:168
XrdOfsConfigPI::CksConfig
XrdCksConfig * CksConfig
Definition: XrdOfsConfigPI.hh:270
XrdOucEnv
Definition: XrdOucEnv.hh:42
XrdOfsConfigPI::Plugin
bool Plugin(XrdAccAuthorize *&piP)
Get Authorization plugin.
XrdOfsConfigPI::Loaded
bool Loaded
Definition: XrdOfsConfigPI.hh:306
XrdSysXAttr
Definition: XrdSysXAttr.hh:43
XrdOfsConfigPI::xxxLP::opts
char * opts
Definition: XrdOfsConfigPI.hh:276
XrdOfsFSctl_PI
Definition: XrdOfsFSctl_PI.hh:52
XrdOfsConfigPI::PrepAuth
bool PrepAuth()
XrdOfsConfigPI::defLib
bool defLib[maxXXXLib]
Definition: XrdOfsConfigPI.hh:302
XrdOfsConfigPI::theOssLib
@ theOssLib
Oss plugin.
Definition: XrdOfsConfigPI.hh:74
XrdOfsConfigPI::xxxLP::parms
char * parms
Definition: XrdOfsConfigPI.hh:275
XrdOfsConfigPI::DefaultCS
void DefaultCS(const char *alg)
XrdOfsConfigPI::prpPI
XrdOfsPrepare * prpPI
-> Prp plugin (prepare)
Definition: XrdOfsConfigPI.hh:263
XrdOfsConfigPI::xxxLP::operator=
xxxLP & operator=(const xxxLP &rhs)
Definition: XrdOfsConfigPI.hh:282
XrdOfsConfigPI::urVer
XrdVersionInfo * urVer
-> Version information
Definition: XrdOfsConfigPI.hh:266
XrdOfsConfigPI::ctlLP
Definition: XrdOfsConfigPI.hh:295
XrdOfsConfigPI::xxxLP::lib
char * lib
Definition: XrdOfsConfigPI.hh:274
XrdOfsConfigPI::cmsPI
XrdCmsClient_t cmsPI
-> Cms client object generator plugin
Definition: XrdOfsConfigPI.hh:261
XrdOfsConfigPI::theAutLib
@ theAutLib
Authorization plugin.
Definition: XrdOfsConfigPI.hh:70
XrdOfsConfigPI::RepLib
bool RepLib(TheLib what, const char *newLib, const char *newParms=0, bool parseParms=true)
XrdOfsConfigPI::Eroute
XrdSysError * Eroute
Definition: XrdOfsConfigPI.hh:269
XrdOfsConfigPI::Load
bool Load(int what, XrdOucEnv *envP=0)
XrdOfsConfigPI::ossXAttr
bool ossXAttr
Definition: XrdOfsConfigPI.hh:303
XrdOfsConfigPI::ossPI
XrdOss * ossPI
-> Oss plugin
Definition: XrdOfsConfigPI.hh:264
XrdOfsConfigPI::theAtrLib
@ theAtrLib
Extended attribute plugin.
Definition: XrdOfsConfigPI.hh:69
XrdOfsConfigPI::TheLib
TheLib
Definition: XrdOfsConfigPI.hh:69
XrdOfsConfigPI::ConfigFN
const char * ConfigFN
Definition: XrdOfsConfigPI.hh:271
XrdOfsConfigPI::ctlLP::parms
const char * parms
Definition: XrdOfsConfigPI.hh:295
XrdOfs
Definition: XrdOfs.hh:211
XrdOfsConfigPI::~XrdOfsConfigPI
~XrdOfsConfigPI()
Destructor.
XrdOfsConfigPI::AddLibCtl
bool AddLibCtl(XrdOucEnv *envP)
XrdSysError
Definition: XrdSysError.hh:90
XrdCmsClient_t
XrdCmsClient *(* XrdCmsClient_t)(XrdSysLogger *, int, int, XrdOss *)
Definition: XrdCmsClient.hh:427
XrdOfsConfigPI::SetupPrp
bool SetupPrp(XrdOucEnv *envP)
XrdOfsConfigPI::ALP
std::vector< xxxLP > ALP[maxXXXLib]
Definition: XrdOfsConfigPI.hh:293
XrdOfsConfigPI::libIXMask
@ libIXMask
Definition: XrdOfsConfigPI.hh:78
XrdOfsPrepare
Definition: XrdOfsPrepare.hh:47
XrdOfsConfigPI::LoadOK
bool LoadOK
Definition: XrdOfsConfigPI.hh:307
XrdOfsConfigPI::Default
void Default(TheLib what, const char *lpath, const char *lparm=0)
XrdOfsConfigPI::Config
XrdOucStream * Config
Definition: XrdOfsConfigPI.hh:268
XrdOfsConfigPI::xxxLP
Definition: XrdOfsConfigPI.hh:274