XRootD
XrdOfsTPCInfo Class Reference

#include <XrdOfsTPCInfo.hh>

+ Collaboration diagram for XrdOfsTPCInfo:

Public Member Functions

 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)
 
 ~XrdOfsTPCInfo ()
 
void Engage ()
 
int Fail (XrdOucErrInfo *eRR, const char *eMsg, int eCode)
 
void isDest ()
 
int Match (const char *cKey, const char *cOrg, const char *xLfn, const char *xDst)
 
void Reply (int rC, int eC, const char *eMsg, XrdSysMutex *mP=0)
 
const char * Set (const char *cKey, const char *cOrg, const char *xLfn, const char *xDst, const char *xCks=0)
 
int SetCB (XrdOucErrInfo *eRR)
 
void SetCreds (const char *evar, const char *creds, int crdsz)
 
void SetRPath (const char *rpath)
 
void SetStreams (char sval)
 
void Success ()
 

Public Attributes

XrdOucCallBackcbP
 
char * Cks
 
char * Crd
 
int Csz
 
char * Dst
 
const char * Env
 
bool inWtR
 
bool isAOK
 
bool isDST
 
char * Key
 
char * Lfn
 
char * Org
 
char * Rpx
 
char * Spr
 
char Str
 
char * Tpr
 

Detailed Description

Definition at line 41 of file XrdOfsTPCInfo.hh.

Constructor & Destructor Documentation

◆ XrdOfsTPCInfo()

XrdOfsTPCInfo::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 
)
inline

Definition at line 78 of file XrdOfsTPCInfo.hh.

81  : 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  {}
XrdOucCallBack * cbP
const char * Env

◆ ~XrdOfsTPCInfo()

XrdOfsTPCInfo::~XrdOfsTPCInfo ( )

Definition at line 61 of file XrdOfsTPCInfo.cc.

62 {
63 // Check if we should remove the file
64 //
65  if (isDST && !isAOK && XrdOfsTPCParms::Cfg.autoRM && Lfn)
67 
68 // Delete all appendages
69 //
70  if (Key) {free(Key); Key = 0;}
71  if (Org) {free(Org); Org = 0;}
72  if (Lfn) {free(Lfn); Lfn = 0;}
73  if (Dst) {free(Dst); Dst = 0;}
74  if (Spr) {free(Spr); Spr = 0;}
75  if (Tpr) {free(Tpr); Tpr = 0;}
76  if (Cks) {free(Cks); Cks = 0;}
77  if (Rpx) {free(Rpx); Rpx = 0;}
78  if (Crd) {free(Crd); Crd = 0; Csz = 0;}
79  if (cbP) delete cbP;
80 }
XrdOss * XrdOfsOss
Definition: XrdOfs.cc:163
virtual int Unlink(const char *path, int Opts=0, XrdOucEnv *envP=0)=0
XrdOfsTPCConfig Cfg
Definition: XrdOfsTPC.cc:85

References cbP, XrdOfsTPCParms::Cfg, Cks, Crd, Csz, Dst, isAOK, isDST, Key, Lfn, Org, Rpx, Spr, Tpr, XrdOss::Unlink(), and XrdOfsOss.

+ Here is the call graph for this function:

Member Function Documentation

◆ Engage()

void XrdOfsTPCInfo::Engage ( )
inline

Definition at line 45 of file XrdOfsTPCInfo.hh.

45 {inWtR = true;} // Must be called w/ a serialization lock!

References inWtR.

Referenced by XrdOfsTPCJob::Sync().

+ Here is the caller graph for this function:

◆ Fail()

int XrdOfsTPCInfo::Fail ( XrdOucErrInfo eRR,
const char *  eMsg,
int  eCode 
)

Definition at line 86 of file XrdOfsTPCInfo.cc.

87 {
88  char Buff[2048];
89 
90 // Format the error message
91 //
92  snprintf(Buff, sizeof(Buff), "Unable to copy %s; %s", Lfn, eMsg);
93 
94 // Print it out if debugging is enabled
95 //
96 #ifndef NODEBUG
97  OfsEroute.Emsg("TPC", Org, Buff);
98 #endif
99 
100 // Place the error message in the error object and return
101 //
102  if (eRR) eRR->setErrInfo(eCode, Buff);
104  return SFS_ERROR;
105 }
XrdOfsStats OfsStats
Definition: XrdOfs.cc:113
XrdSysError OfsEroute
#define eMsg(x)
#define SFS_ERROR
struct XrdOfsStats::StatsData Data
void Add(int &Cntr)
Definition: XrdOfsStats.hh:62
int setErrInfo(int code, const char *emsg)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95

References XrdOfsStats::Add(), XrdOfsStats::Data, XrdSysError::Emsg(), eMsg, Lfn, XrdOfsStats::StatsData::numTPCerrs, OfsEroute, OfsStats, Org, XrdOucErrInfo::setErrInfo(), and SFS_ERROR.

Referenced by SetCB(), and XrdOfsTPCJob::Sync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isDest()

void XrdOfsTPCInfo::isDest ( )
inline

Definition at line 49 of file XrdOfsTPCInfo.hh.

49 {isDST = true;}

References isDST.

Referenced by XrdOfsTPC::Validate().

+ Here is the caller graph for this function:

◆ Match()

int XrdOfsTPCInfo::Match ( const char *  cKey,
const char *  cOrg,
const char *  xLfn,
const char *  xDst 
)

Definition at line 111 of file XrdOfsTPCInfo.cc.

113 {
114  if (cKey) {if (!Key || strcmp(Key, cKey)) return 0;}
115  else if (Key) return 0;
116 
117  if (cOrg) {if (!Org || strcmp(Org, cOrg)) return 0;}
118  else if (Org) return 0;
119 
120  if (xLfn) {if (!Lfn || strcmp(Lfn, xLfn)) return 0;}
121  else if (Lfn) return 0;
122 
123  if (xDst) {if (!Dst || strcmp(Dst, xDst)) return 0;}
124  else if (Dst) return 0;
125 
126  return 1;
127 }

References Dst, Key, Lfn, and Org.

◆ Reply()

void XrdOfsTPCInfo::Reply ( int  rC,
int  eC,
const char *  eMsg,
XrdSysMutex mP = 0 
)

Definition at line 133 of file XrdOfsTPCInfo.cc.

134 {
135  XrdOucCallBack *myCB = cbP;
136 
137 // Clear pointer to call back prior to unlocking any locks
138 //
139  cbP = 0;
140 
141 // Make sure a reply is valid here (i.e. client is in waitresop). If not,
142 // then we need to scuttle the whole shebang (must be done with a lock).
143 //
144  if (inWtR)
145  {inWtR = false;
146  if (mP) mP->UnLock();
147  if (myCB) myCB->Reply(rC, eC, eMsg, Lfn);
148  } else if (mP) mP->UnLock();
149  delete myCB;
150 }
int Reply(int retVal, int eValue, const char *eText, const char *Path=0)

References cbP, eMsg, inWtR, Lfn, XrdOucCallBack::Reply(), and XrdSysMutex::UnLock().

Referenced by XrdOfsTPCJob::Del(), and XrdOfsTPCJob::Done().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Set()

const char * XrdOfsTPCInfo::Set ( const char *  cKey,
const char *  cOrg,
const char *  xLfn,
const char *  xDst,
const char *  xCks = 0 
)

Definition at line 156 of file XrdOfsTPCInfo.cc.

159 {
160  const char *etext;
161 
162 // Set the key
163 //
164  if (Key) free(Key);
165  Key = (cKey ? strdup(cKey) : 0);
166 
167 // Set the origin
168 //
169  if (Org) free(Org);
170  Org = (cOrg ? strdup(cOrg) : 0);
171 
172 // Set the lfn
173 //
174  if (Lfn) free(Lfn);
175  Lfn = (xLfn ? strdup(xLfn) : 0);
176 
177 // Set optional dst
178 //
179  if (Dst) {free(Dst); Dst = 0;}
180  if (xDst)
181  {XrdNetAddr dAddr;
182  if (!(etext = dAddr.Set(xDst,0)))
183  Dst = strdup(dAddr.Name("0.0.0.0",&etext));
184  if (etext) return etext;
185  }
186 
187 // Set the cks
188 //
189  if (Cks) free(Cks);
190  Cks = (xCks ? strdup(xCks) : 0);
191 
192 // All done
193 //
194  return 0;
195 }
const char * Name(const char *eName=0, const char **eText=0)
const char * Set(const char *hSpec, int pNum=PortInSpec)
Definition: XrdNetAddr.cc:216

References Cks, Dst, Key, Lfn, XrdNetAddrInfo::Name(), Org, and XrdNetAddr::Set().

+ Here is the call graph for this function:

◆ SetCB()

int XrdOfsTPCInfo::SetCB ( XrdOucErrInfo eRR)

Definition at line 201 of file XrdOfsTPCInfo.cc.

202 {
203  if (cbP) delete cbP;
204  cbP = new XrdOucCallBack();
205  if ((cbP->Init(eRR))) return 0;
206  delete cbP; cbP = 0;
207  return Fail(eRR, "tpc callback logic error", EPROTO);
208 }
int Fail(XrdOucErrInfo *eRR, const char *eMsg, int eCode)
int Init(XrdOucErrInfo *eInfo)

References cbP, Fail(), and XrdOucCallBack::Init().

Referenced by XrdOfsTPCJob::Sync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCreds()

void XrdOfsTPCInfo::SetCreds ( const char *  evar,
const char *  creds,
int  crdsz 
)
inline

Definition at line 62 of file XrdOfsTPCInfo.hh.

63  {Env = evar;
64  Crd = (char *)malloc(crdsz);
65  memcpy(Crd, creds, crdsz);
66  Csz = crdsz;
67  }

References Crd, Csz, and Env.

Referenced by XrdOfsTPC::Validate().

+ Here is the caller graph for this function:

◆ SetRPath()

void XrdOfsTPCInfo::SetRPath ( const char *  rpath)
inline

Definition at line 69 of file XrdOfsTPCInfo.hh.

70  {if (Rpx) free(Rpx);
71  Rpx = strdup(rpath);
72  }

References Rpx.

Referenced by XrdOfsTPC::Validate().

+ Here is the caller graph for this function:

◆ SetStreams()

void XrdOfsTPCInfo::SetStreams ( char  sval)
inline

Definition at line 74 of file XrdOfsTPCInfo.hh.

74 {Str = sval;}

References Str.

Referenced by XrdOfsTPC::Validate().

+ Here is the caller graph for this function:

◆ Success()

void XrdOfsTPCInfo::Success ( )
inline

Definition at line 76 of file XrdOfsTPCInfo.hh.

76 {isAOK = true;}

References isAOK.

Referenced by XrdOfsTPCProg::Xeq().

+ Here is the caller graph for this function:

Member Data Documentation

◆ cbP

XrdOucCallBack* XrdOfsTPCInfo::cbP

Definition at line 95 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), XrdOfsTPCJob::Del(), XrdOfsTPCJob::Done(), Reply(), and SetCB().

◆ Cks

char* XrdOfsTPCInfo::Cks

Definition at line 96 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), Set(), and XrdOfsTPCProg::Xeq().

◆ Crd

char* XrdOfsTPCInfo::Crd

Definition at line 105 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), and SetCreds().

◆ Csz

int XrdOfsTPCInfo::Csz

Definition at line 106 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), and SetCreds().

◆ Dst

char* XrdOfsTPCInfo::Dst

Definition at line 100 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), Match(), XrdOfsTPCProg::Run(), Set(), and XrdOfsTPCProg::Xeq().

◆ Env

const char* XrdOfsTPCInfo::Env

Definition at line 104 of file XrdOfsTPCInfo.hh.

Referenced by SetCreds().

◆ inWtR

bool XrdOfsTPCInfo::inWtR

Definition at line 108 of file XrdOfsTPCInfo.hh.

Referenced by Engage(), and Reply().

◆ isAOK

bool XrdOfsTPCInfo::isAOK

Definition at line 110 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), and Success().

◆ isDST

bool XrdOfsTPCInfo::isDST

Definition at line 109 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), and isDest().

◆ Key

char* XrdOfsTPCInfo::Key

◆ Lfn

char* XrdOfsTPCInfo::Lfn

◆ Org

char* XrdOfsTPCInfo::Org

◆ Rpx

char* XrdOfsTPCInfo::Rpx

Definition at line 103 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), SetRPath(), and XrdOfsTPCProg::Xeq().

◆ Spr

char* XrdOfsTPCInfo::Spr

Definition at line 101 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), and XrdOfsTPCProg::Xeq().

◆ Str

char XrdOfsTPCInfo::Str

Definition at line 107 of file XrdOfsTPCInfo.hh.

Referenced by XrdOfsTPCProg::Run(), SetStreams(), and XrdOfsTPCProg::Xeq().

◆ Tpr

char* XrdOfsTPCInfo::Tpr

Definition at line 102 of file XrdOfsTPCInfo.hh.

Referenced by ~XrdOfsTPCInfo(), and XrdOfsTPCProg::Xeq().


The documentation for this class was generated from the following files: