XRootD
XrdOucName2Name.hh File Reference
#include <string>
#include <vector>
+ Include dependency graph for XrdOucName2Name.hh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  XrdOucName2Name
 
class  XrdOucName2NameVec
 XrdOucName2NameVec *Name2NameVec;. More...
 

Macros

#define XrdOucgetName2NameArgs
 

Functions

XrdOucName2NameXrdOucgetName2Name (XrdOucgetName2NameArgs)
 

Macro Definition Documentation

◆ XrdOucgetName2NameArgs

#define XrdOucgetName2NameArgs
Value:
const char *confg, \
const char *parms, \
const char *lroot, \
const char *rroot
static XrdSysError eDest(0,"crypto_")

Definition at line 213 of file XrdOucName2Name.hh.

Function Documentation

◆ XrdOucgetName2Name()

XrdOucName2Name* XrdOucgetName2Name ( XrdOucgetName2NameArgs  )

Definition at line 197 of file XrdOucN2No2p.cc.

198 {
199  struct bHelper {char *p; bHelper(const char *bP) : p(bP ? strdup(bP) : 0) {}
200  ~bHelper() {if (p) free(p);}
201  };
202  bHelper prms(parms);
203  const char *oPfx;
204  char *val, *eP;
205  std::string ostr;
206  int fnMax = 0, n;
207  char sChar = '\\';
208 
209 // Process options
210 //
211  XrdOucTokenizer toks(prms.p);
212  toks.GetLine();
213  while((val = toks.GetToken()) && *val)
214  { if (!strcmp(val, "-slash"))
215  {if (!(val = toks.GetToken()) || !(*val))
216  {eDest->Emsg("N2No2p", "-slash argument not specified.");
217  return 0;
218  }
219  if (strlen(val) == 1) {sChar = *val; continue;}
220  n = strtol(val, &eP, 16);
221  if (n & 0xff || *eP)
222  {eDest->Emsg("N2No2p", "Invalid -slash argument -",val);
223  return 0;
224  }
225  sChar = static_cast<char>(n);
226  }
227  else if (!strcmp(val, "-maxfnlen"))
228  {if (!(val = toks.GetToken()) || !(*val))
229  {eDest->Emsg("N2No2p", "-maxfnlen argument not specified.");
230  return 0;
231  }
232  fnMax = strtol(val, &eP, 16);
233  if (fnMax <= 0 || *eP)
234  {eDest->Emsg("N2No2p", "Invalid -maxfnlen argument -",val);
235  return 0;
236  }
237  }
238  else break;
239  }
240 
241 // Obtain the objectid prefix we are to use (default is '/')
242 //
243  if (!val || !(*val)) oPfx = "/";
244  else {if (*val != '/')
245  {eDest->Emsg("N2No2p", "Invalid object ID path prefix -", val);
246  return 0;
247  }
248  oPfx = val;
249  n = strlen(val);
250  if (val[n-1] != '/') {ostr = val; ostr += '/'; oPfx = ostr.c_str();}
251  }
252 
253 // Now determine what the maximum filename length if not specified
254 //
255  if (!fnMax)
256  if ((fnMax = pathconf("/", _PC_NAME_MAX)) < 0)
257  {eDest->Emsg("N2No2p", errno, "determine -fnmaxlen for '/'; using 255.");
258  fnMax = 255;
259  }
260 
261 // Return a new n2n object
262 //
263  return new XrdOucN2No2p(eDest, lroot, oPfx, fnMax, sChar);
264 }
long pathconf(const char *path, int name)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95

References eDest, XrdSysError::Emsg(), XrdOucTokenizer::GetLine(), XrdOucTokenizer::GetToken(), pathconf(), and XrdOucN2NVec_P.

Referenced by XrdOucN2NLoader::Load().

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