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 
13 // $Id$
14 
15 #include <stdlib.h>
16 
17 #include "XrdSys/XrdSysError.hh"
18 #include "XrdOuc/XrdOucEnv.hh"
20 
21 /******************************************************************************/
22 /* 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 */
23 /******************************************************************************/
24 
25 #define CMS_CID "cms&cid"
26 #define SEC_USER "sec&user"
27 #define SEC_HOST "sec&host"
28 #define SEC_POLICY "sec&policy"
29 #define XRD_INS "xrd&ins"
30 
31 /******************************************************************************/
32 /* X r d O u c M s u b s */
33 /******************************************************************************/
34 
36 {
37 const char *Tid; // $TID or $RID unless Rid is defined.
40 const char *lfn; // $LFN
41 const char *lfn2; // $LFN2 or $NOTIFY or $SRC
42 const char *pfn; // $PFN
43 const char *pfn2; // $PFN2 or $DST
44 const char *misc; // $OPTS or $MDP
45 const char *Rid; // $RID for real
46 const char *Src; // $SRC
47 const char *Dst; // $DST
48 char *pfnbuff;
49 char *rfnbuff;
50 char *pfn2buff;
51 char *rfn2buff;
52 mode_t Mode; // $FMODE or $PRTY
53 int Oflag; // $OFLAG
54 char mbuff[12];
55 char obuff[4];
56 
57  XrdOucMsubsInfo(const char *tid, XrdOucEnv *envP,
58  XrdOucName2Name *n2np,
59  const char *lfnP, const char *lfn2P,
60  mode_t mode=0, int ofl=0,
61  const char *Opts=0, const char *ridP=0,
62  const char *pfnP=0, const char *pfn2P=0)
63  : Tid(tid), Env(envP), N2N(n2np),
64  lfn(lfnP), lfn2(lfn2P), pfn(pfnP), pfn2(pfn2P),
65  misc(Opts), Rid(ridP), Mode(mode), Oflag(ofl)
66  {pfnbuff = rfnbuff = pfn2buff = rfn2buff = 0;}
68  if (rfnbuff ) free(rfnbuff);
69  if (pfn2buff) free(pfn2buff);
70  if (rfn2buff) free(rfn2buff);
71  }
72 };
73 
75 {
76 public:
77 
78 static const int maxElem = 32;
79 
80 int Parse(const char *oname, char *msg);
81 
82 int Subs(XrdOucMsubsInfo &Info, char **Data, int *Dlen);
83 
84  XrdOucMsubs(XrdSysError *errp);
85  ~XrdOucMsubs();
86 
87 private:
88 char *getVal(XrdOucMsubsInfo &Info, int vNum);
89 
90 enum vNum {vLFN = 1, vPFN = 2, vRFN = 3, vLFN2 = 4, vPFN2 = 5, vRFN2 = 6,
91  vFM = 7, vOFL = 8, vUSR = 9, vHST = 10, vTID = 11,
92  vNFY = 12, vOPT = 13, vPTY = 14, vRID = 15, vCGI = 16,
93  vMDP = 17, vSRC = 18, vDST = 19, vCID = 20, vINS = 21};
94 
95 static const int vMax = 22;
96 static const char *vName[vMax];
97 
99 char *mText;
100 char *mData[maxElem+1];
101 int mDlen[maxElem+1];
103 };
104 #endif