XRootD
XrdCksConfig Class Reference

#include <XrdCksConfig.hh>

+ Collaboration diagram for XrdCksConfig:

Public Member Functions

 XrdCksConfig (const char *cFN, XrdSysError *Eroute, int &aOK, XrdVersionInfo &vInfo)
 
 ~XrdCksConfig ()
 
XrdCksConfigure (const char *dfltCalc=0, int rdsz=0, XrdOss *ossP=0, XrdOucEnv *envP=0)
 
int Manager ()
 
int Manager (const char *Path, const char *Parms)
 
const char * ManLib ()
 
int ParseLib (XrdOucStream &Config, int &libType)
 
bool ParseOpt (XrdOucStream &Config)
 

Detailed Description

Definition at line 43 of file XrdCksConfig.hh.

Constructor & Destructor Documentation

◆ XrdCksConfig()

XrdCksConfig::XrdCksConfig ( const char *  cFN,
XrdSysError Eroute,
int &  aOK,
XrdVersionInfo &  vInfo 
)

Definition at line 57 of file XrdCksConfig.cc.

59  : eDest(Eroute), cfgFN(cFN), CksLib(0), CksParm(0),
60  CksList(0), CksLast(0), LibList(0), LibLast(0),
61  myVersion(vInfo), CKSopts(0)
62 {
63  static XrdVERSIONINFODEF(myVer, XrdCks, XrdVNUMBER, XrdVERSION);
64 
65 // Verify caller's version against ours
66 //
67  if (vInfo.vNum <= 0 || vInfo.vNum == myVer.vNum
68  || XrdSysPlugin::VerCmp(vInfo, myVer)) aOK = 1;
69  else aOK = 0;
70 }
Definition: XrdCks.hh:92
static bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false)
XrdVERSIONINFODEF(myVersion, cmsclient, XrdVNUMBER, XrdVERSION)

References XrdSysPlugin::VerCmp(), and XrdCms::XrdVERSIONINFODEF().

+ Here is the call graph for this function:

◆ ~XrdCksConfig()

XrdCksConfig::~XrdCksConfig ( )
inline

Definition at line 63 of file XrdCksConfig.hh.

63  {XrdOucTList *tP;
64  if (CksLib) free(CksLib);
65  if (CksParm) free(CksParm);
66  while((tP = CksList)) {CksList = tP->next; delete tP;}
67  while((tP = LibList)) {LibList = tP->next; delete tP;}
68  }
XrdOucTList * next
Definition: XrdOucTList.hh:45

References XrdOucTList::next.

Member Function Documentation

◆ Configure()

XrdCks * XrdCksConfig::Configure ( const char *  dfltCalc = 0,
int  rdsz = 0,
XrdOss ossP = 0,
XrdOucEnv envP = 0 
)

Definition at line 116 of file XrdCksConfig.cc.

118 {
119  XrdCks *myCks = getCks(ossP, rdsz);
120  XrdOucTList *tP = CksList;
121  int NoGo = 0;
122 
123 // Check if we have a cks object
124 //
125  if (!myCks) return 0;
126 
127 // Stack all pugins
128 //
129  myCks = addCks(myCks, envP);
130  if (!myCks) return 0;
131 
132 // Configure the object
133 //
134  while(tP) {NoGo |= myCks->Config("ckslib", tP->text); tP = tP->next;}
135 
136 // Configure if all went well
137 //
138  if (!NoGo) NoGo = !myCks->Init(cfgFN, dfltCalc);
139 
140 // All done
141 //
142  if (NoGo) {delete myCks; myCks = 0;}
143  return myCks;
144 }
virtual int Init(const char *ConfigFN, const char *DfltCalc=0)=0
virtual int Config(const char *Token, char *Line)=0
char * text
Definition: XrdOucTList.hh:46
XrdOucEnv * envP
Definition: XrdPss.cc:109

References XrdCks::Config(), XrdProxy::envP, XrdCks::Init(), XrdOucTList::next, XrdOfsPrepGPIReal::ossP, and XrdOucTList::text.

Referenced by XrdOfsConfigPI::Load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Manager() [1/2]

int XrdCksConfig::Manager ( )
inline

Definition at line 50 of file XrdCksConfig.hh.

50 {return CksLib != 0;}

Referenced by ParseLib().

+ Here is the caller graph for this function:

◆ Manager() [2/2]

int XrdCksConfig::Manager ( const char *  Path,
const char *  Parms 
)

Definition at line 196 of file XrdCksConfig.cc.

197 {
198 // Replace the library path and parameters. Note that for default plugins
199 // we reset the path to null to indicate we want the default plugin.
200 //
201  if (CksLib) free(CksLib);
202  CksLib = (Path ? strdup(Path) : 0);
203  if (CksParm) free(CksParm);
204  CksParm = (Parms && *Parms ? strdup(Parms) : 0);
205  return 0;
206 }
XrdOucString Path

References Path.

◆ ManLib()

const char* XrdCksConfig::ManLib ( )
inline

Definition at line 55 of file XrdCksConfig.hh.

55 {return CksLib;}

Referenced by XrdOfsConfigPI::Parse().

+ Here is the caller graph for this function:

◆ ParseLib()

int XrdCksConfig::ParseLib ( XrdOucStream Config,
int &  libType 
)

Definition at line 224 of file XrdCksConfig.cc.

225 {
226  static const int nameSize = XrdCksData::NameSize;
227  static const int pathSize = MAXPATHLEN;
228  static const int parmSize = 1024;
229  XrdOucTList *tP;
230  char *val, buff[nameSize + pathSize + parmSize + 8], parms[parmSize], *bP;
231  int n;
232 
233 // Get the digest
234 //
235  if (!(val = Config.GetWord()) || !val[0])
236  {eDest->Emsg("Config", "ckslib digest not specified"); return 1;}
237  n = strlen(val);
238  if (n >= nameSize)
239  {eDest->Emsg("Config", "ckslib digest name too long -", val); return 1;}
240  strcpy(buff, val); XrdOucUtils::toLower(buff); bP = buff+n; *bP++ = ' ';
241 
242 // Determine the library type
243 //
244  if (!strcmp(val, "*")) libType = -1;
245  else if (!strcmp(val, "=")) libType = 1;
246  else libType = 0;
247 
248 // Get the path
249 //
250  if (!(val = Config.GetWord()) || !val[0])
251  {eDest->Emsg("Config", "ckslib path not specified for", buff); return 1;}
252  n = strlen(val);
253  if (n > pathSize)
254  {eDest->Emsg("Config", "ckslib path name too long -", val); return 1;}
255  strcpy(bP, val); bP += n;
256 
257 // Check if path is 'default' and is appropriate for this context
258 //
259  if (!strcmp("default", val))
260  {if (!libType)
261  {eDest->Emsg("Config","ckslib 'default' is only valid for '*' and '='");
262  return 1;
263  }
264  if (!ParseOpt(Config)) return 1;
265  return Manager(0,0);
266  }
267 
268 // Record any parms
269 //
270  *parms = 0;
271  if (!Config.GetRest(parms, parmSize))
272  {eDest->Emsg("Config", "ckslib parameters too long for", buff); return 1;}
273 
274 // Check if this is for the manager
275 //
276  if (libType) return Manager(buff+2, parms);
277 
278 // Create a new TList object either for a digest or stackable library
279 //
280  n = (strncmp(buff, "++ ", 3) ? 0 : 3);
281  *bP = ' '; strcpy(bP+1, parms);
282  tP = new XrdOucTList(buff + n);
283 
284 // Add this digest to the list of digests or stackable library list
285 //
286  if (n)
287  {n = (bP - buff) - n;
288  tP->text[n] = 0;
289  tP->val = (*parms ? n+1 : 0);
290  if (LibLast) LibLast->next = tP;
291  else LibList = tP;
292  LibLast = tP;
293  } else {
294  if (CksLast) CksLast->next = tP;
295  else CksList = tP;
296  CksLast = tP;
297  }
298  return 0;
299 }
bool ParseOpt(XrdOucStream &Config)
static const int NameSize
Definition: XrdCksData.hh:41
static void toLower(char *str)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdCmsConfig Config

References XrdCms::Config, XrdSysError::Emsg(), Manager(), XrdCksData::NameSize, XrdOucTList::next, ParseOpt(), XrdOucTList::text, and XrdOucUtils::toLower().

Referenced by XrdOfsConfigPI::Parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParseOpt()

bool XrdCksConfig::ParseOpt ( XrdOucStream Config)

Definition at line 313 of file XrdCksConfig.cc.

314 {
315  char* val = Config.GetWord();
316 
317 // Get the next word, if any
318 //
319  while(val)
320  {if (!strcmp(val, "nomtchk")) CKSopts |= XrdCksManager::Cks_nomtchk;
321  else break;
322  val = Config.GetWord();
323  }
324 
325 // Check for errors
326 //
327  if (val)
328  {eDest->Emsg("Config", "Invalid default ckslib plugin parameter -", val);
329  return false;
330  }
331  return true;
332 }

References XrdCksManager::Cks_nomtchk, XrdCms::Config, and XrdSysError::Emsg().

Referenced by ParseLib().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: