XRootD
XrdOucCallBack Class Reference

#include <XrdOucCallBack.hh>

+ Inheritance diagram for XrdOucCallBack:
+ Collaboration diagram for XrdOucCallBack:

Public Member Functions

 XrdOucCallBack ()
 
 ~XrdOucCallBack ()
 
void Cancel ()
 
int Init (XrdOucErrInfo *eInfo)
 
int Reply (int retVal, int eValue, const char *eText, const char *Path=0)
 
- Public Member Functions inherited from XrdOucEICB
 XrdOucEICB ()
 Constructor and destructor. More...
 
virtual ~XrdOucEICB ()
 

Static Public Member Functions

static int Allowed (XrdOucErrInfo *eInfo)
 

Public Attributes

XrdOucCallBackNext
 

Detailed Description

Definition at line 46 of file XrdOucCallBack.hh.

Constructor & Destructor Documentation

◆ XrdOucCallBack()

XrdOucCallBack::XrdOucCallBack ( )
inline

Definition at line 95 of file XrdOucCallBack.hh.

95 : Next(0), cbSync(0), cbArg(0), cbObj(0) {}
XrdOucCallBack * Next

◆ ~XrdOucCallBack()

XrdOucCallBack::~XrdOucCallBack ( )
inline

Definition at line 96 of file XrdOucCallBack.hh.

96 {if (cbObj) Cancel();}

References Cancel().

+ Here is the call graph for this function:

Member Function Documentation

◆ Allowed()

static int XrdOucCallBack::Allowed ( XrdOucErrInfo eInfo)
inlinestatic

Definition at line 57 of file XrdOucCallBack.hh.

57 {return eInfo->getErrCB() != 0;}
XrdOucEICB * getErrCB()

References XrdOucErrInfo::getErrCB().

+ Here is the call graph for this function:

◆ Cancel()

void XrdOucCallBack::Cancel ( )

Definition at line 38 of file XrdOucCallBack.cc.

39 {
40 
41 // If a callback is outstanding, send a reply indicating that the operation
42 // should be retried.
43 //
44  if (cbObj) Reply(1, 0, "");
45 }
int Reply(int retVal, int eValue, const char *eText, const char *Path=0)

References Reply().

Referenced by ~XrdOucCallBack().

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

◆ Init()

int XrdOucCallBack::Init ( XrdOucErrInfo eInfo)

Definition at line 51 of file XrdOucCallBack.cc.

52 {
53  const char *theUser;
54 
55 
56 // Make sure we can do a callback here
57 //
58  if (cbObj || eInfo->getErrCB() == 0) return 0;
59 
60 // Copy relevant data
61 //
62  if ((theUser = eInfo->getErrUser())) strlcpy(UserID,theUser,sizeof(UserID));
63  else strcpy(UserID, "???");
64  cbObj = eInfo->getErrCB(cbArg);
65 
66 // Now set the callback object in the input ErrInfo object to be ours so
67 // that we can make sure that the wait for callback response was sent
68 // before we actually effect a reply.
69 //
70  eInfo->setErrCB(this, cbArg);
71 
72 // All done
73 //
74  return 1;
75 }
size_t strlcpy(char *dst, const char *src, size_t sz)
void setErrCB(XrdOucEICB *cb, unsigned long long cbarg=0)
const char * getErrUser()

References XrdOucErrInfo::getErrCB(), XrdOucErrInfo::getErrUser(), XrdOucErrInfo::setErrCB(), and strlcpy().

Referenced by XrdOfsTPCInfo::SetCB().

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

◆ Reply()

int XrdOucCallBack::Reply ( int  retVal,
int  eValue,
const char *  eText,
const char *  Path = 0 
)

Definition at line 81 of file XrdOucCallBack.cc.

83 {
84  XrdOucErrInfo cbInfo(UserID, this, cbArg);
85  XrdOucEICB *objCB;
86 
87 // Verify that we can actually do a callback
88 //
89  if (!(objCB = cbObj)) return 0;
90  cbObj = 0;
91 
92 // Wait for the semaphore to make sure the "wait for callback" response was
93 // actually sent to preserve time causality.
94 //
95  cbSync.Wait();
96 
97 // Send the reply using the constructed ErrInfo object and then wait until we
98 // know that the response was actually sent to allow this object to be deleted.
99 //
100  cbInfo.setErrInfo(eValue, (eText ? eText : ""));
101  objCB->Done(retVal, &cbInfo, Path);
102  cbSync.Wait();
103 
104 // All done
105 //
106  return 1;
107 }
XrdOucString Path
virtual void Done(int &Result, XrdOucErrInfo *eInfo, const char *Path=0)=0

References XrdOucEICB::Done(), Path, XrdOucErrInfo::setErrInfo(), and XrdSysSemaphore::Wait().

Referenced by Cancel(), and XrdOfsTPCInfo::Reply().

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

Member Data Documentation

◆ Next

XrdOucCallBack* XrdOucCallBack::Next

Definition at line 100 of file XrdOucCallBack.hh.


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