xrootd
XrdOucName2Name.hh
Go to the documentation of this file.
1 #ifndef __XRDOUCNAME2NAME_H__
2 #define __XRDOUCNAME2NAME_H__
3 /******************************************************************************/
4 /* */
5 /* X r d O u c n a m e 2 n a m e . h h */
6 /* */
7 /* (c) 2006 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
16 {
17 public:
18 
19 // All of the following functions place any results in the buffer supplied by
20 // the first argument which is of the length supplied by the 2nd srgument. If
21 // the function succeeded, it must return 0. Otherwise, it must return an error
22 // number corresponding to one in errno.h. The most common error numbers are:
23 
24 // EINVAL - The supplied lfn (or pfn) is invalid.
25 // ENAMETOOLONG - The result would not fit in the supplied buffer.
26 
27 // lfn2pfn() is called to map a logical file name to a physical file name.
28 // If the file exists, the pfn must refer to the existing file.
29 // If the file does not exist, the pfn should correspond to the name
30 // of the file that could have existed.
31 //
32 virtual int lfn2pfn(const char *lfn, char *buff, int blen) = 0;
33 
34 // lfn2rfn() is called to map a logical file name to the name that the file
35 // would have in a Mass Storage System (i.e., remote location). The
36 // format must be consistent with the SRM being used to access the MSS.
37 // The file may or may not actually exist in the target MSS.
38 //
39 virtual int lfn2rfn(const char *lfn, char *buff, int blen) = 0;
40 
41 // pfn2lfn() is called to map a physical file name to a logical file name.
42 // If the file exists, the pfn refers to the existing file.
43 // If the file does not exist, the pfn corresponds to the name
44 // of the file that could have existed.
45 //
46 virtual int pfn2lfn(const char *pfn, char *buff, int blen) = 0;
47 
49 virtual ~XrdOucName2Name() {}
50 };
51 
52 /******************************************************************************/
53 /* X r d O u c g e t N a m e 2 N a m e */
54 /******************************************************************************/
55 
56 // The XrdOucgetName2Name() function is called when the shared library containing
57 // implementation of this class is loaded. It must exist in the library as an
58 // 'extern "C"' defined function.
59 
60 // The 1st argument is a pointer to the error object that must be used to
61 // print any errors or other messages (see XrdSysError.hh).
62 
63 // The 2nd argument is the name of the configuration file that was used.
64 // This value may be null though that would be impossible.
65 
66 // The 3rd argument is the argument string that was specified on the namelib
67 // directive. It is never null but may point to a null string.
68 
69 // The 4th argument is the path specified by the remoteroot directive. It is
70 // a null pointer if the directive was not specified.
71 
72 // The 5th argument is the path specified by the localroot directive. It is
73 // a null pointer if the directive was not specified.
74 
75 // The function must return an instance of this class upon success and a null
76 // pointer upon failure.
77 
78 class XrdSysError;
79 
80 #define XrdOucgetName2NameArgs XrdSysError *eDest, \
81  const char *confg, \
82  const char *parms, \
83  const char *lroot, \
84  const char *rroot
85 
86 extern "C"
87 {
89 }
90 
91 // Warnings and admonitions!
92 
93 // All object methods *must* be thread-safe!
94 
95 // The Name2Name object is used frequently in the course of opening files
96 // as well as other meta-file operations (e.g., stat(), rename(), etc.).
97 // The algorithms used by this object *must* be effecient and speedy; otherwise,
98 // system performance will be severely degraded.
99 #endif