XRootD
XrdOucMsubs.hh
Go to the documentation of this file.
1 #ifndef __XRDOUCMSUBS_H__
2 #define __XRDOUCMSUBS_H__
3 /******************************************************************************/
4 /* */
5 /* X r d O u c M S u b s . 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 /* 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 <cstdlib>
34 
35 #include "XrdSys/XrdSysError.hh"
36 #include "XrdOuc/XrdOucEnv.hh"
38 
39 /******************************************************************************/
40 /* P r e d e f i n e d E n v i r o n m e n t V a r i a b l e s */
41 /******************************************************************************/
42 
43 #define CMS_CID "cms&cid"
44 #define SEC_USER "sec&user"
45 #define SEC_HOST "sec&host"
46 #define SEC_POLICY "sec&policy"
47 #define XRD_INS "xrd&ins"
48 
49 /******************************************************************************/
50 /* X r d O u c M s u b s */
51 /******************************************************************************/
52 
54 {
55 const char *Tid; // $TID or $RID unless Rid is defined.
58 const char *lfn; // $LFN
59 const char *lfn2; // $LFN2 or $NOTIFY or $SRC
60 const char *pfn; // $PFN
61 const char *pfn2; // $PFN2 or $DST
62 const char *misc; // $OPTS or $MDP
63 const char *Rid; // $RID for real
64 char *pfnbuff;
65 char *rfnbuff;
66 char *pfn2buff;
67 char *rfn2buff;
68 mode_t Mode; // $FMODE or $PRTY
69 int Oflag; // $OFLAG
70 char mbuff[12];
71 char obuff[4];
72 
73  XrdOucMsubsInfo(const char *tid, XrdOucEnv *envP,
74  XrdOucName2Name *n2np,
75  const char *lfnP, const char *lfn2P,
76  mode_t mode=0, int ofl=0,
77  const char *Opts=0, const char *ridP=0,
78  const char *pfnP=0, const char *pfn2P=0)
79  : Tid(tid), Env(envP), N2N(n2np),
80  lfn(lfnP), lfn2(lfn2P), pfn(pfnP), pfn2(pfn2P),
81  misc(Opts), Rid(ridP), Mode(mode), Oflag(ofl)
82  {pfnbuff = rfnbuff = pfn2buff = rfn2buff = 0;}
84  if (rfnbuff ) free(rfnbuff);
85  if (pfn2buff) free(pfn2buff);
86  if (rfn2buff) free(rfn2buff);
87  }
88 };
89 
91 {
92 public:
93 
94 static const int maxElem = 32;
95 
96 int Parse(const char *oname, char *msg);
97 
98 int Subs(XrdOucMsubsInfo &Info, char **Data, int *Dlen);
99 
100  XrdOucMsubs(XrdSysError *errp);
101  ~XrdOucMsubs();
102 
103 private:
104 char *getVal(XrdOucMsubsInfo &Info, int vNum);
105 
106 enum vNum {vLFN = 1, vPFN = 2, vRFN = 3, vLFN2 = 4, vPFN2 = 5, vRFN2 = 6,
107  vFM = 7, vOFL = 8, vUSR = 9, vHST = 10, vTID = 11,
108  vNFY = 12, vOPT = 13, vPTY = 14, vRID = 15, vCGI = 16,
109  vMDP = 17, vSRC = 18, vDST = 19, vCID = 20, vINS = 21};
110 
111 static const int vMax = 22;
112 static const char *vName[vMax];
113 
114 XrdSysError *eDest;
115 char *mText;
116 char *mData[maxElem+1];
117 int mDlen[maxElem+1];
118 int numElem;
119 };
120 #endif
@ Info
int Parse(const char *oname, char *msg)
Definition: XrdOucMsubs.cc:100
int Subs(XrdOucMsubsInfo &Info, char **Data, int *Dlen)
Definition: XrdOucMsubs.cc:146
XrdOucMsubs(XrdSysError *errp)
Definition: XrdOucMsubs.cc:51
static const int maxElem
Definition: XrdOucMsubs.hh:94
int Opts
Definition: XrdMpxStats.cc:58
XrdOucEnv * envP
Definition: XrdPss.cc:109
XrdOucName2Name * N2N
Definition: XrdOucMsubs.hh:57
const char * lfn
Definition: XrdOucMsubs.hh:58
const char * pfn
Definition: XrdOucMsubs.hh:60
const char * Rid
Definition: XrdOucMsubs.hh:63
const char * misc
Definition: XrdOucMsubs.hh:62
const char * lfn2
Definition: XrdOucMsubs.hh:59
const char * pfn2
Definition: XrdOucMsubs.hh:61
const char * Tid
Definition: XrdOucMsubs.hh:55
char mbuff[12]
Definition: XrdOucMsubs.hh:70
XrdOucEnv * Env
Definition: XrdOucMsubs.hh:56
XrdOucMsubsInfo(const char *tid, XrdOucEnv *envP, XrdOucName2Name *n2np, const char *lfnP, const char *lfn2P, mode_t mode=0, int ofl=0, const char *Opts=0, const char *ridP=0, const char *pfnP=0, const char *pfn2P=0)
Definition: XrdOucMsubs.hh:73