|
| XrdOucN2No2p (XrdSysError *erp, const char *lroot, const char *pfx, int fnmax, char sc) |
|
virtual | ~XrdOucN2No2p () |
|
virtual int | lfn2pfn (const char *lfn, char *buff, int blen) |
|
virtual int | lfn2rfn (const char *lfn, char *buff, int blen) |
|
virtual int | pfn2lfn (const char *pfn, char *buff, int blen) |
|
| XrdOucName2Name () |
| Constructor. More...
|
|
virtual | ~XrdOucName2Name () |
| Destructor. More...
|
|
Definition at line 68 of file XrdOucN2No2p.cc.
◆ XrdOucN2No2p()
XrdOucN2No2p::XrdOucN2No2p |
( |
XrdSysError * |
erp, |
|
|
const char * |
lroot, |
|
|
const char * |
pfx, |
|
|
int |
fnmax, |
|
|
char |
sc |
|
) |
| |
|
inline |
Definition at line 78 of file XrdOucN2No2p.cc.
80 : eDest(erp), sChar(sc),
81 oidPfx(strdup(pfx)), oidPsz(strlen(pfx)), oidMax(fnmax)
82 {
if (!lroot) {lRoot = 0; lRLen = 0;}
83 else {lRoot = strdup(lroot);
84 lRLen = strlen(lroot);
85 if (lRoot[lRLen-1] ==
'/')
86 {lRoot[lRLen-1] = 0; lRLen--;}
◆ ~XrdOucN2No2p()
virtual XrdOucN2No2p::~XrdOucN2No2p |
( |
| ) |
|
|
inlinevirtual |
Definition at line 90 of file XrdOucN2No2p.cc.
90 {
if (oidPfx) free(oidPfx);
91 if (lRoot) free(lRoot);
◆ lfn2pfn()
int XrdOucN2No2p::lfn2pfn |
( |
const char * |
lfn, |
|
|
char * |
buff, |
|
|
int |
blen |
|
) |
| |
|
virtual |
Map a logical file name to a physical file name.
- Parameters
-
lfn | -> Logical file name. |
buff | -> Buffer where the physical file name of an existing file is to be placed. It must end with a null byte. |
blen | The length of the buffer. |
- Returns
- Success: Zero. Failure: An errno number describing the failure; typically EINVAL - The supplied lfn is invalid. ENAMETOOLONG - The buffer is too small for the pfn.
Implements XrdOucName2Name.
Definition at line 108 of file XrdOucN2No2p.cc.
113 {
if (lRLen >= blen-1)
return ENAMETOOLONG;
115 buff += lRLen; blen -= lRLen;
120 return pfn2lfn(lfn, buff, blen);
virtual int pfn2lfn(const char *pfn, char *buff, int blen)
References pfn2lfn().
◆ lfn2rfn()
virtual int XrdOucN2No2p::lfn2rfn |
( |
const char * |
lfn, |
|
|
char * |
buff, |
|
|
int |
blen |
|
) |
| |
|
inlinevirtual |
Map a logical file name to the name the file would have in a remote storage system (e.g. Mass Storage System at a remote location).
- Parameters
-
lfn | -> Logical file name. |
buff | -> Buffer where the remote file name is to be placed. It need not actually exist in that location but could be created there with that name. It must end with a null byte. |
blen | The length of the buffer. |
- Returns
- Success: Zero. Failure: An errno number describing the failure; typically EINVAL - The supplied lfn is invalid. ENAMETOOLONG - The buffer is too small for the pfn.
Implements XrdOucName2Name.
Definition at line 74 of file XrdOucN2No2p.cc.
◆ pfn2lfn()
int XrdOucN2No2p::pfn2lfn |
( |
const char * |
pfn, |
|
|
char * |
buff, |
|
|
int |
blen |
|
) |
| |
|
virtual |
Map a physical file name to it's logical file name.
- Parameters
-
pfn | -> Physical file name. This is always a valid name of either an existing file or a file that could been created. |
buff | -> Buffer where the logical file name is to be placed. It need not actually exist but could be created with that name. It must end with a null byte. |
blen | The length of the buffer. |
- Returns
- Success: Zero. Failure: An errno number describing the failure; typically EINVAL - The supplied lfn is invalid. ENAMETOOLONG - The buffer is too small for the pfn.
Implements XrdOucName2Name.
Definition at line 127 of file XrdOucN2No2p.cc.
132 int pfnLen = strlen(pfn);
137 {
if (pfnLen >= blen)
return ENAMETOOLONG;
144 if ((sP = index(pfn,
'/')))
146 std::replace(pstr.begin(), pstr.end(),
'/', sChar);
154 if (pfnLen <= oidMax)
156 unsigned long sVal = ((int)
sizeof(
unsigned long) > 4 ? 32 : 16);
158 if (pfnLen <= (
int)
sizeof(
unsigned long)) hVal = hVal ^ (hVal >> sVal);
159 subP[1] = h2c[(hVal & 0x0f)]; hVal >>= 4; subP[0] = h2c[(hVal & 0x0f)];
160 subP[2] =
'/'; hVal >>= 4;
161 subP[4] = h2c[(hVal & 0x0f)]; hVal >>= 4; subP[3] = h2c[(hVal & 0x0f)];
162 subP[5] =
'/'; subP[6] = 0;
163 int n = snprintf(buff, blen,
"%s%s%s", oidPfx, subP, pfn);
164 return (n < blen ? 0 : ENAMETOOLONG);
171 if ((oidPsz + pfnLen + (pfnLen/oidMax)) >= blen)
return ENAMETOOLONG;
175 strcpy(buff, oidPfx); bP = buff + oidPsz; blen -= oidPsz;
179 while(blen > oidMax && pfnLen > oidMax)
180 {strncpy(bP, pfn, oidMax);
181 bP += oidMax; blen -= oidMax;
182 pfn += oidMax; pfnLen -= oidMax;
183 if (blen > 0) {*bP++ =
'/'; blen--;}
188 if (blen <= pfnLen)
return ENAMETOOLONG;
unsigned long XrdOucHashVal2(const char *KeyVal, int KeyLen)
References XrdOucHashVal2().
Referenced by lfn2pfn().
The documentation for this class was generated from the following file: