xrootd
Loading...
Searching...
No Matches
XrdOssPath.hh
Go to the documentation of this file.
1#ifndef _OSS_PATH_H
2#define _OSS_PATH_H
3/******************************************************************************/
4/* */
5/* X r d O s s P a t h . h h */
6/* */
7/* (c) 2008 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/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <cstring>
34
36{
37public:
38
39struct fnInfo
40{
41const char *Path;
42const char *Sfx; // Of length sfxLen!
43 char *Slash;
44 int Plen;
45};
46
47static const char xChar = '%';
48
49static const int sfxLen = 4;
50
51static int Convert(char *dst, int dln, const char *oldP, const char *newP);
52
53static
54const char *Extract(char *path, char *lbuf, int &lbsz);
55
56static char *genPath(const char *inPath, const char *cgrp, char *sfx);
57
58static char *genPFN(fnInfo &Info, char *buff, int blen, const char *Path=0);
59
60static char *genPFN(char *dst, int dln, const char *src);
61
62static int getCname(const char *path, char *Cache, char *lbuf=0, int lbsz=0);
63
64static int isXA(const char *path) {return path[strlen(path)-1] == xChar;}
65
66static int InitPrefix();
67
68enum theSfx {isBase =0, isAnew =1,
72 };
73
74static
75const char *Sfx[sfxNum];
76
77static const int chkMem = 0x01;
78static const int chkMig = 0x02;
79static const int chkPfn = 0x04;
80static const int chkAll = 0x07;
81
82static theSfx pathType(const char *Path, int chkWhat=chkAll);
83
84static void Trim2Base(char *eP);
85
88
89private:
90static char *bin2hex(char *inbuff, int dlen, char *buff);
91static char *posCname(char *lbuf, int lbsz, int &cnsz);
92
93static char h2c[16];
94static char pfnPfx[60];
95};
96#endif
Definition: XrdOssPath.hh:36
static char * posCname(char *lbuf, int lbsz, int &cnsz)
static const int chkAll
Definition: XrdOssPath.hh:80
static char * genPFN(char *dst, int dln, const char *src)
static const char * Extract(char *path, char *lbuf, int &lbsz)
XrdOssPath()
Definition: XrdOssPath.hh:86
static char * genPFN(fnInfo &Info, char *buff, int blen, const char *Path=0)
static char * genPath(const char *inPath, const char *cgrp, char *sfx)
static const int sfxLen
Definition: XrdOssPath.hh:49
static int isXA(const char *path)
Definition: XrdOssPath.hh:64
static const int chkPfn
Definition: XrdOssPath.hh:79
static const int chkMem
Definition: XrdOssPath.hh:77
static char * bin2hex(char *inbuff, int dlen, char *buff)
static char h2c[16]
Definition: XrdOssPath.hh:93
static int Convert(char *dst, int dln, const char *oldP, const char *newP)
theSfx
Definition: XrdOssPath.hh:68
@ isFail
Definition: XrdOssPath.hh:69
@ sfxMigF
Definition: XrdOssPath.hh:69
@ sfxMemL
Definition: XrdOssPath.hh:70
@ isMmap
Definition: XrdOssPath.hh:70
@ isMlock
Definition: XrdOssPath.hh:70
@ isPin
Definition: XrdOssPath.hh:69
@ isBase
Definition: XrdOssPath.hh:68
@ sfxMemF
Definition: XrdOssPath.hh:70
@ sfxLast
Definition: XrdOssPath.hh:71
@ isMkeep
Definition: XrdOssPath.hh:70
@ sfxMigL
Definition: XrdOssPath.hh:69
@ isAnew
Definition: XrdOssPath.hh:68
@ isLock
Definition: XrdOssPath.hh:69
@ sfxNum
Definition: XrdOssPath.hh:71
@ isPfn
Definition: XrdOssPath.hh:71
~XrdOssPath()
Definition: XrdOssPath.hh:87
static int InitPrefix()
static theSfx pathType(const char *Path, int chkWhat=chkAll)
static char pfnPfx[60]
Definition: XrdOssPath.hh:94
static const char * Sfx[sfxNum]
Definition: XrdOssPath.hh:75
static const int chkMig
Definition: XrdOssPath.hh:78
static int getCname(const char *path, char *Cache, char *lbuf=0, int lbsz=0)
static const char xChar
Definition: XrdOssPath.hh:47
static void Trim2Base(char *eP)
Definition: XrdOssPath.hh:40
char * Slash
Definition: XrdOssPath.hh:43
int Plen
Definition: XrdOssPath.hh:44
const char * Path
Definition: XrdOssPath.hh:41
const char * Sfx
Definition: XrdOssPath.hh:42