XRootD
XrdOfsTPCInfo.hh
Go to the documentation of this file.
1 #ifndef __XRDOFSTPCINFO_HH__
2 #define __XRDOFSTPCINFO_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d O f s T P C I n f o . h h */
6 /* */
7 /* (c) 2012 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 #include <cstring>
35 
36 #include "XrdOuc/XrdOucCallBack.hh"
37 
38 class XrdOucErrInfo;
39 class XrdSysMutex;
40 
42 {
43 public:
44 
45 void Engage() {inWtR = true;} // Must be called w/ a serialization lock!
46 
47 int Fail(XrdOucErrInfo *eRR, const char *eMsg, int eCode);
48 
49 void isDest() {isDST = true;}
50 
51 int Match(const char *cKey, const char *cOrg,
52  const char *xLfn, const char *xDst);
53 
54 void Reply(int rC, int eC, const char *eMsg, XrdSysMutex *mP=0);
55 
56 const char *Set(const char *cKey, const char *cOrg,
57  const char *xLfn, const char *xDst,
58  const char *xCks=0);
59 
60 int SetCB(XrdOucErrInfo *eRR);
61 
62 void SetCreds(const char *evar, const char *creds, int crdsz)
63  {Env = evar;
64  Crd = (char *)malloc(crdsz);
65  memcpy(Crd, creds, crdsz);
66  Csz = crdsz;
67  }
68 
69 void SetRPath(const char *rpath)
70  {if (Rpx) free(Rpx);
71  Rpx = strdup(rpath);
72  }
73 
74 void SetStreams(char sval) {Str = sval;}
75 
76 void Success() {isAOK = true;}
77 
78  XrdOfsTPCInfo(const char *vKey=0, const char *vOrg=0,
79  const char *vLfn=0, const char *vDst=0,
80  const char *vCks=0, const char *vSpr=0,
81  const char *vTpr=0) : cbP(0),
82  Cks(vCks ? strdup(vCks) :0),
83  Key(vKey ? strdup(vKey) :0),
84  Org(vOrg ? strdup(vOrg) :0),
85  Lfn(vLfn ? strdup(vLfn) :0),
86  Dst(vDst ? strdup(vDst) :0),
87  Spr(vSpr ? strdup(vSpr) :0),
88  Tpr(vTpr ? strdup(vTpr) :0),
89  Rpx(0), Env(0), Crd(0), Csz(0), Str(0),
90  inWtR(false), isDST(false), isAOK(false)
91  {}
92 
94 
95 XrdOucCallBack *cbP; // Callback object
96 char *Cks; // Checksum information (only at dest)
97 char *Key; // Rendezvous key or src URL
98 char *Org; // Rendezvous origin
99 char *Lfn; // Rendezvous path or dest LFN
100 char *Dst; // Rendezvous dest or dest PFN
101 char *Spr; // Source protocol
102 char *Tpr; // Target protocol
103 char *Rpx; // -> Reproxy path
104 const char *Env; // -> creds envar name
105 char *Crd; // Credentials to be forwarded dst->src
106 int Csz; // Size of credentials
107 char Str; // Number of streams to use
108 bool inWtR; // Traget in waitresp status, async reply is valid.
109 bool isDST; // This info is about the destination file (PFN)
110 bool isAOK; // The copy succeeded
111 };
112 #endif
#define eMsg(x)
void SetRPath(const char *rpath)
int Match(const char *cKey, const char *cOrg, const char *xLfn, const char *xDst)
XrdOucCallBack * cbP
XrdOfsTPCInfo(const char *vKey=0, const char *vOrg=0, const char *vLfn=0, const char *vDst=0, const char *vCks=0, const char *vSpr=0, const char *vTpr=0)
void SetStreams(char sval)
int SetCB(XrdOucErrInfo *eRR)
void SetCreds(const char *evar, const char *creds, int crdsz)
const char * Env
const char * Set(const char *cKey, const char *cOrg, const char *xLfn, const char *xDst, const char *xCks=0)
void Reply(int rC, int eC, const char *eMsg, XrdSysMutex *mP=0)
int Fail(XrdOucErrInfo *eRR, const char *eMsg, int eCode)