Loading...
Searching...
No Matches
XrdOucN2N Class Reference
Inheritance diagram for XrdOucN2N:
Collaboration diagram for XrdOucN2N:

## Public Member Functions

| XrdOucN2N (XrdSysError *erp, const char *lpfx, const char *rpfx)
virtual int | lfn2pfn (const char *lfn, char *buff, int blen)
virtual int | lfn2rfn (const char *lfn, char *buff, int blen)
virtual std::vector< std::string * > * | n2nVec (const char *lfn)
virtual int | pfn2lfn (const char *lfn, char *buff, int blen)
Public Member Functions inherited from XrdOucName2Name
| XrdOucName2Name ()
| Constructor.
virtual | ~XrdOucName2Name ()
| Destructor.
Public Member Functions inherited from XrdOucName2NameVec
| XrdOucName2NameVec ()
| Constructor and Destructor.
virtual | ~XrdOucName2NameVec ()
virtual void | Recycle (std::vector< std::string * > *nvP)

## Detailed Description

Definition at line 50 of file XrdOucName2Name.cc.

## Constructor & Destructor Documentation

## XrdOucN2N()

XrdOucN2N::XrdOucN2N | ( | XrdSysError * | erp,
|  | const char * | lpfx,
|  | const char * | rpfx )

Definition at line 82 of file XrdOucName2Name.cc.

{
eDest = erp;
// Local root must not have any trailing slahes
//
if (!lpfx) {LocalRoot = 0; LocalRootLen = 0;}
else if (!(LocalRootLen = strlen(lpfx))) LocalRoot = 0;
else {LocalRoot = strdup(lpfx);
while(LocalRootLen && LocalRoot[LocalRootLen-1] == '/')
{LocalRootLen--; LocalRoot[LocalRootLen] = '\0';}
}
// Remote root must not have any trailing slases unless it a URL
//
if (!rpfx) {RemotRoot = 0; RemotRootLen = 0;}
else if (!(RemotRootLen = strlen(rpfx))) RemotRoot = 0;
else {RemotRoot = strdup(rpfx);
if (*RemotRoot == '/')
while(RemotRootLen && RemotRoot[RemotRootLen-1] == '/')
{RemotRootLen--; RemotRoot[RemotRootLen] = '\0';}
}
}

## Member Function Documentation

## lfn2pfn()

int XrdOucN2N::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 110 of file XrdOucName2Name.cc.

{
if (concat_fn(LocalRoot, LocalRootLen, lfn, buff, blen))
return eDest->Emsg("glp",-ENAMETOOLONG,"generate local path",lfn);
return 0;
}

References XrdSysError::Emsg().

Referenced by n2nVec().

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

## lfn2rfn()

int XrdOucN2N::lfn2rfn | ( | const char * | lfn,
|  | char * | buff,
|  | int | blen )

virtual

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 121 of file XrdOucName2Name.cc.

{
if (concat_fn(RemotRoot, RemotRootLen, lfn, buff, blen))
return eDest->Emsg("grp",-ENAMETOOLONG,"generate remote path",lfn);
return 0;
}

## n2nVec()

std::vector< std::string * > * XrdOucN2N::n2nVec | ( | const char * | lfn | ) |

virtual

Map a logical file name to all of its possible physical file names.

Parameters

  lfn | -> Logical file name.

Returns
  Success: Pointer to a vector of strings of physical file names. Failure: A nil pointer indicating that no translation exists.

Implements XrdOucName2NameVec.

Definition at line 171 of file XrdOucName2Name.cc.

{
char pfnBuff[2048];
std::string *s;
// Perform translation
//
if (lfn2pfn(lfn, pfnBuff, sizeof(pfnBuff))) return 0;
// Return a vector of one
//
s = new std::string(pfnBuff);
return new std::vector<std::string *>(1, s);
}
XrdOucN2N::lfn2pfn
virtual int lfn2pfn(const char *lfn, char *buff, int blen)
Definition XrdOucName2Name.cc:110

References lfn2pfn().

Here is the call graph for this function:

## pfn2lfn()

int XrdOucN2N::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 153 of file XrdOucName2Name.cc.

{
char *tp;
if (!LocalRoot
|| strncmp(pfn, LocalRoot, LocalRootLen)
|| pfn[LocalRootLen] != '/')
tp = (char *)pfn;
else tp = (char *)(pfn+LocalRootLen);
if (strlcpy(buff, tp, blen) >= (unsigned int)blen) return ENAMETOOLONG;
return 0;
}
strlcpy
size_t strlcpy(char *dst, const char *src, size_t sz)
Definition XrdSysPlatform.cc:60

References strlcpy().

Here is the call graph for this function:

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

- XrdOucName2Name.cc