|
xrootd
|
00001 #ifndef _OSS_PATH_H 00002 #define _OSS_PATH_H 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O s s P a t h . h h */ 00006 /* */ 00007 /* (c) 2008 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 /* This file is part of the XRootD software suite. */ 00013 /* */ 00014 /* XRootD is free software: you can redistribute it and/or modify it under */ 00015 /* the terms of the GNU Lesser General Public License as published by the */ 00016 /* Free Software Foundation, either version 3 of the License, or (at your */ 00017 /* option) any later version. */ 00018 /* */ 00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00022 /* License for more details. */ 00023 /* */ 00024 /* You should have received a copy of the GNU Lesser General Public License */ 00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00027 /* */ 00028 /* The copyright holder's institutional names and contributor's names may not */ 00029 /* be used to endorse or promote products derived from this software without */ 00030 /* specific prior written permission of the institution or contributor. */ 00031 /******************************************************************************/ 00032 00033 #include <string.h> 00034 00035 class XrdOssPath 00036 { 00037 public: 00038 00039 struct fnInfo 00040 { 00041 const char *Path; 00042 const char *Sfx; // Of length sfxLen! 00043 char *Slash; 00044 int Plen; 00045 }; 00046 00047 static const char xChar = '%'; 00048 00049 static const int sfxLen = 4; 00050 00051 static int Convert(char *dst, int dln, const char *oldP, const char *newP); 00052 00053 static 00054 const char *Extract(char *path, char *lbuf, int &lbsz); 00055 00056 static char *genPath(const char *inPath, const char *cgrp, char *sfx); 00057 00058 static char *genPFN(fnInfo &Info, char *buff, int blen, const char *Path=0); 00059 00060 static char *genPFN(char *dst, int dln, const char *src); 00061 00062 static int getCname(const char *path, char *Cache, char *lbuf=0, int lbsz=0); 00063 00064 static 00065 inline int isXA(const char *path) {return path[strlen(path)-1] == xChar;} 00066 00067 enum theSfx {isBase =0, isAnew =1, 00068 sfxMigF=1, isFail=2, isLock =3, isPin =4, sfxMigL=4, 00069 sfxMemF=4, isMkeep=5, isMlock=6, isMmap=7, sfxMemL=7, 00070 isPfn=8, sfxLast=8, sfxNum =9 00071 }; 00072 00073 static 00074 const char *Sfx[sfxNum]; 00075 00076 static const int chkMem = 0x01; 00077 static const int chkMig = 0x02; 00078 static const int chkPfn = 0x04; 00079 static const int chkAll = 0x07; 00080 00081 static theSfx pathType(const char *Path, int chkWhat=chkAll); 00082 00083 static void Trim2Base(char *eP); 00084 00085 XrdOssPath() {} 00086 ~XrdOssPath() {} 00087 00088 private: 00089 static char *bin2hex(char *inbuff, int dlen, char *buff); 00090 static int Init(char *pfnPfx); 00091 static char *posCname(char *lbuf, int lbsz, int &cnsz); 00092 00093 static char h2c[16]; 00094 }; 00095 #endif
1.7.6.1