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)
 

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)
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 61 of file XrdCksConfig.hh.

61  {XrdOucTList *tP;
62  if (CksLib) free(CksLib);
63  if (CksParm) free(CksParm);
64  while((tP = CksList)) {CksList = tP->next; delete tP;}
65  while((tP = LibList)) {LibList = tP->next; delete tP;}
66  }
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 193 of file XrdCksConfig.cc.

194 {
195 // Replace the library path and parameters
196 //
197  if (CksLib) free(CksLib);
198  CksLib = strdup(Path);
199  if (CksParm) free(CksParm);
200  CksParm = (Parms && *Parms ? strdup(Parms) : 0);
201  return 0;
202 }
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 220 of file XrdCksConfig.cc.

221 {
222  static const int nameSize = XrdCksData::NameSize;
223  static const int pathSize = MAXPATHLEN;
224  static const int parmSize = 1024;
225  XrdOucTList *tP;
226  char *val, buff[nameSize + pathSize + parmSize + 8], parms[parmSize], *bP;
227  int n;
228 
229 // Get the digest
230 //
231  if (!(val = Config.GetWord()) || !val[0])
232  {eDest->Emsg("Config", "ckslib digest not specified"); return 1;}
233  n = strlen(val);
234  if (n >= nameSize)
235  {eDest->Emsg("Config", "ckslib digest name too long -", val); return 1;}
236  strcpy(buff, val); XrdOucUtils::toLower(buff); bP = buff+n; *bP++ = ' ';
237 
238 // Get the path
239 //
240  if (!(val = Config.GetWord()) || !val[0])
241  {eDest->Emsg("Config", "ckslib path not specified for", buff); return 1;}
242  n = strlen(val);
243  if (n > pathSize)
244  {eDest->Emsg("Config", "ckslib path name too long -", val); return 1;}
245  strcpy(bP, val); bP += n;
246 
247 // Record any parms
248 //
249  *parms = 0;
250  if (!Config.GetRest(parms, parmSize))
251  {eDest->Emsg("Config", "ckslib parameters too long for", buff); return 1;}
252 
253 // Check if this is for the manager
254 //
255  if ((*buff == '*' || *buff == '=') && *(buff+1) == ' ')
256  {libType = (*buff == '*' ? -1 : 1);
257  return Manager(buff+2, parms);
258  } else libType = 0;
259 
260 // Create a new TList object either for a digest or stackable library
261 //
262  n = (strncmp(buff, "++ ", 3) ? 0 : 3);
263  *bP = ' '; strcpy(bP+1, parms);
264  tP = new XrdOucTList(buff + n);
265 
266 // Add this digest to the list of digests or stackable library list
267 //
268  if (n)
269  {n = (bP - buff) - n;
270  tP->text[n] = 0;
271  tP->val = (*parms ? n+1 : 0);
272  if (LibLast) LibLast->next = tP;
273  else LibList = tP;
274  LibLast = tP;
275  } else {
276  if (CksLast) CksLast->next = tP;
277  else CksList = tP;
278  CksLast = tP;
279  }
280  return 0;
281 }
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, 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:

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