Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-08 10:33:33

0001 #ifndef __XRDOFSTPCINFO_HH__
0002 #define __XRDOFSTPCINFO_HH__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                      X r d O f s T P C I n f o . h h                       */
0006 /*                                                                            */
0007 /* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University  */
0008 /*                            All Rights Reserved                             */
0009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
0010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
0011 /*                                                                            */
0012 /* This file is part of the XRootD software suite.                            */
0013 /*                                                                            */
0014 /* XRootD is free software: you can redistribute it and/or modify it under    */
0015 /* the terms of the GNU Lesser General Public License as published by the     */
0016 /* Free Software Foundation, either version 3 of the License, or (at your     */
0017 /* option) any later version.                                                 */
0018 /*                                                                            */
0019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
0020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
0021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
0022 /* License for more details.                                                  */
0023 /*                                                                            */
0024 /* You should have received a copy of the GNU Lesser General Public License   */
0025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
0026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
0027 /*                                                                            */
0028 /* The copyright holder's institutional names and contributor's names may not */
0029 /* be used to endorse or promote products derived from this software without  */
0030 /* specific prior written permission of the institution or contributor.       */
0031 /******************************************************************************/
0032 
0033 #include <cstdlib>
0034 #include <cstring>
0035 
0036 #include "XrdOuc/XrdOucCallBack.hh"
0037 
0038 class XrdOucErrInfo;
0039 class XrdSysMutex;
0040 
0041 class XrdOfsTPCInfo
0042 {
0043 public:
0044 
0045 void        Engage() {inWtR = true;} // Must be called w/ a serialization lock!
0046 
0047 int         Fail(XrdOucErrInfo *eRR, const char *eMsg, int eCode);
0048 
0049 void        isDest() {isDST = true;}
0050 
0051 int         Match(const char *cKey, const char *cOrg,
0052                   const char *xLfn, const char *xDst);
0053 
0054 void        Reply(int rC, int eC, const char *eMsg, XrdSysMutex *mP=0);
0055 
0056 const char *Set(const char *cKey, const char *cOrg,
0057                 const char *xLfn, const char *xDst,
0058                 const char *xCks=0);
0059 
0060 int         SetCB(XrdOucErrInfo *eRR);
0061 
0062 void        SetCreds(const char *evar, const char *creds, int crdsz)
0063                     {Env = evar;
0064                      Crd = (char *)malloc(crdsz);
0065                      memcpy(Crd, creds, crdsz);
0066                      Csz = crdsz;
0067                     }
0068 
0069 void        SetRPath(const char *rpath)
0070                     {if (Rpx) free(Rpx);
0071                      Rpx = strdup(rpath);
0072                     }
0073 
0074 void        SetStreams(char sval) {Str = sval;}
0075 
0076 void        Success() {isAOK = true;}
0077 
0078             XrdOfsTPCInfo(const char *vKey=0, const char *vOrg=0,
0079                           const char *vLfn=0, const char *vDst=0,
0080                           const char *vCks=0, const char *vSpr=0,
0081                           const char *vTpr=0) : cbP(0),
0082                       Cks(vCks ? strdup(vCks) :0),
0083                       Key(vKey ? strdup(vKey) :0),
0084                       Org(vOrg ? strdup(vOrg) :0),
0085                       Lfn(vLfn ? strdup(vLfn) :0),
0086                       Dst(vDst ? strdup(vDst) :0),
0087                       Spr(vSpr ? strdup(vSpr) :0),
0088                       Tpr(vTpr ? strdup(vTpr) :0),
0089                       Rpx(0), Env(0), Crd(0), Csz(0), Str(0),
0090                       inWtR(false), isDST(false), isAOK(false)
0091                       {}
0092 
0093            ~XrdOfsTPCInfo();
0094 
0095 XrdOucCallBack *cbP;   // Callback object
0096 char           *Cks;   // Checksum information (only at dest)
0097 char           *Key;   // Rendezvous key    or src  URL
0098 char           *Org;   // Rendezvous origin
0099 char           *Lfn;   // Rendezvous path   or dest LFN
0100 char           *Dst;   // Rendezvous dest   or dest PFN
0101 char           *Spr;   // Source protocol
0102 char           *Tpr;   // Target protocol
0103 char           *Rpx;   // -> Reproxy path
0104 const char     *Env;   // -> creds envar name
0105 char           *Crd;   // Credentials to be forwarded dst->src
0106 int             Csz;   // Size of credentials
0107 char            Str;   // Number of streams to use
0108 bool           inWtR;  // Traget in waitresp status, async reply is valid.
0109 bool           isDST;  // This info is about the destination file (PFN)
0110 bool           isAOK;  // The copy succeeded
0111 };
0112 #endif