00001 #ifndef __XRDOUCNAME2NAME_H__ 00002 #define __XRDOUCNAME2NAME_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O u c n a m e 2 n a m e . h h */ 00006 /* */ 00007 /* (c) 2006 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id: XrdOucName2Name.hh 22437 2008-03-04 14:35:16Z rdm $ 00014 00015 class XrdOucName2Name 00016 { 00017 public: 00018 00019 // All of the following functions place any results in the buffer supplied by 00020 // the first argument which is of the length supplied by the 2nd srgument. If 00021 // the function succeeded, it must return 0. Otherwise, it must return an error 00022 // number corresponding to one in errno.h. The most common error numbers are: 00023 00024 // EINVAL - The supplied lfn (or pfn) is invalid. 00025 // ENAMETOOLONG - The result would not fit in the supplied buffer. 00026 00027 // lfn2pfn() is called to map a logical file name to a physical file name. 00028 // If the file exists, the pfn must refer to the existing file. 00029 // If the file does not exist, the pfn should correspond to the name 00030 // of the file that could have existed. 00031 // 00032 virtual int lfn2pfn(const char *lfn, char *buff, int blen) = 0; 00033 00034 // lfn2rfn() is called to map a logical file name to the name that the file 00035 // would have in a Mass Storage System (i.e., remote location). The 00036 // format must be consistent with the SRM being used to access the MSS. 00037 // The file may or may not actually exist in the target MSS. 00038 // 00039 virtual int lfn2rfn(const char *lfn, char *buff, int blen) = 0; 00040 00041 // pfn2lfn() is called to map a physical file name to a logical file name. 00042 // If the file exists, the pfn refers to the existing file. 00043 // If the file does not exist, the pfn corresponds to the name 00044 // of the file that could have existed. 00045 // 00046 virtual int pfn2lfn(const char *pfn, char *buff, int blen) = 0; 00047 00048 XrdOucName2Name() {} 00049 virtual ~XrdOucName2Name() {} 00050 }; 00051 00052 /******************************************************************************/ 00053 /* X r d O u c g e t N a m e 2 N a m e */ 00054 /******************************************************************************/ 00055 00056 // The XrdOucgetName2Name() function is called when the shared library containing 00057 // implementation of this class is loaded. It must exist in the library as an 00058 // 'extern "C"' defined function. 00059 00060 // The 1st argument is a pointer to the error object that must be used to 00061 // print any errors or other messages (see XrdSysError.hh). 00062 00063 // The 2nd argument is the name of the configuration file that was used. 00064 // This value may be null though that would be impossible. 00065 00066 // The 3rd argument is the argument string that was specified on the namelib 00067 // directive. It is never null but may point to a null string. 00068 00069 // The 4th argument is the path specified by the remoteroot directive. It is 00070 // a null pointer if the directive was not specified. 00071 00072 // The 5th argument is the path specified by the localroot directive. It is 00073 // a null pointer if the directive was not specified. 00074 00075 // The function must return an instance of this class upon success and a null 00076 // pointer upon failure. 00077 00078 class XrdSysError; 00079 00080 #define XrdOucgetName2NameArgs XrdSysError *eDest, \ 00081 const char *confg, \ 00082 const char *parms, \ 00083 const char *lroot, \ 00084 const char *rroot 00085 00086 extern "C" 00087 { 00088 XrdOucName2Name *XrdOucgetName2Name(XrdOucgetName2NameArgs); 00089 } 00090 00091 // Warnings and admonitions! 00092 00093 // All object methods *must* be thread-safe! 00094 00095 // The Name2Name object is used frequently in the course of opening files 00096 // as well as other meta-file operations (e.g., stat(), rename(), etc.). 00097 // The algorithms used by this object *must* be effecient and speedy; otherwise, 00098 // system performance will be severely degraded. 00099 #endif