54 virtual int lfn2pfn(
const char *lfn,
char *buff,
int blen);
56 virtual int lfn2rfn(
const char *lfn,
char *buff,
int blen);
58 virtual int pfn2lfn(
const char *lfn,
char *buff,
int blen);
60 virtual std::vector<std::string *> *
n2nVec(
const char *lfn);
65 int concat_fn(
const char *prefix,
int pfxlen,
66 const char *path,
char *buffer,
int blen);
88 if (!lpfx) {LocalRoot = 0; LocalRootLen = 0;}
89 else if (!(LocalRootLen = strlen(lpfx))) LocalRoot = 0;
90 else {LocalRoot = strdup(lpfx);
91 while(LocalRootLen && LocalRoot[LocalRootLen-1] ==
'/')
92 {LocalRootLen--; LocalRoot[LocalRootLen] =
'\0';}
97 if (!rpfx) {RemotRoot = 0; RemotRootLen = 0;}
98 else if (!(RemotRootLen = strlen(rpfx))) RemotRoot = 0;
99 else {RemotRoot = strdup(rpfx);
100 if (*RemotRoot ==
'/')
101 while(RemotRootLen && RemotRoot[RemotRootLen-1] ==
'/')
102 {RemotRootLen--; RemotRoot[RemotRootLen] =
'\0';}
112 if (concat_fn(LocalRoot, LocalRootLen, lfn, buff, blen))
113 return eDest->
Emsg(
"glp",-ENAMETOOLONG,
"generate local path",lfn);
123 if (concat_fn(RemotRoot, RemotRootLen, lfn, buff, blen))
124 return eDest->
Emsg(
"grp",-ENAMETOOLONG,
"generate remote path",lfn);
132 int XrdOucN2N::concat_fn(
const char *prefix,
138 int addslash = (*path !=
'/');
139 int pathlen = strlen(path);
141 if ((pfxlen + addslash + pathlen) >= blen)
return -1;
143 if (pfxlen) {strcpy(buffer, prefix); buffer += pfxlen;}
144 if (addslash) {*buffer =
'/'; buffer++;}
145 strcpy(buffer, path);
158 || strncmp(pfn, LocalRoot, LocalRootLen)
159 || pfn[LocalRootLen] !=
'/')
161 else tp = (
char *)(pfn+LocalRootLen);
163 if (
strlcpy(buff, tp, blen) >= (
unsigned int)blen)
return ENAMETOOLONG;
178 if (
lfn2pfn(lfn, pfnBuff,
sizeof(pfnBuff)))
return 0;
182 s =
new std::string(pfnBuff);
183 return new std::vector<std::string *>(1, s);
192 (void)confg; (void)parms;
static XrdSysError eDest(0,"crypto_")
XrdOucName2Name * XrdOucgetName2Name(XrdOucgetName2NameArgs)
XrdOucName2NameVec * XrdOucN2NVec_P
#define XrdOucgetName2NameArgs
XrdOucN2N(XrdSysError *erp, const char *lpfx, const char *rpfx)
virtual std::vector< std::string * > * n2nVec(const char *lfn)
virtual int lfn2rfn(const char *lfn, char *buff, int blen)
virtual int lfn2pfn(const char *lfn, char *buff, int blen)
virtual int pfn2lfn(const char *lfn, char *buff, int blen)
XrdOucName2NameVec *Name2NameVec;.
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)