XRootD
XrdCmsResp Class Reference

#include <XrdCmsResp.hh>

+ Inheritance diagram for XrdCmsResp:
+ Collaboration diagram for XrdCmsResp:

Public Member Functions

 XrdCmsResp ()
 
 ~XrdCmsResp ()
 
void Done (int &Result, XrdOucErrInfo *eInfo, const char *Path=0)
 
int ID ()
 
void Reply (const char *Man, XrdCms::CmsRRHdr &rrhdr, XrdOucBuffer *netbuff)
 
int Same (unsigned long long arg1, unsigned long long arg2)
 
- Public Member Functions inherited from XrdOucEICB
 XrdOucEICB ()
 Constructor and destructor. More...
 
virtual ~XrdOucEICB ()
 
- Public Member Functions inherited from XrdOucErrInfo
 XrdOucErrInfo (const char *user, int MonID, int uc=0)
 
 XrdOucErrInfo (const char *user, XrdOucEnv *envp, int uc=0)
 
 XrdOucErrInfo (const char *user=0, XrdOucEICB *cb=0, unsigned long long ca=0, int mid=0, int uc=0)
 
virtual ~XrdOucErrInfo ()
 Destructor. More...
 
void clear ()
 Reset data and error information to null. Any appenadges are released. More...
 
bool extData ()
 
XrdOucEnvgetEnv ()
 
unsigned long long getErrArg ()
 
XrdOucEICBgetErrCB ()
 
XrdOucEICBgetErrCB (unsigned long long &ap)
 
const char * getErrData ()
 
int getErrInfo ()
 
int getErrMid ()
 
const char * getErrText ()
 
const char * getErrText (int &ecode)
 
int getErrTextLen ()
 
const char * getErrUser ()
 
char * getMsgBuff (int &mblen)
 
int getUCap ()
 
XrdOucErrInfooperator= (const XrdOucErrInfo &rhs)
 Assignment operator. More...
 
void Reset ()
 Reset object to no message state. Call this method to release appendages. More...
 
XrdOucEnvsetEnv (XrdOucEnv *newEnv)
 
void setErrArg (unsigned long long cbarg=0)
 
void setErrCB (XrdOucEICB *cb, unsigned long long cbarg=0)
 
int setErrCode (int code)
 
void setErrData (const char *Data, int Offs=0)
 
int setErrInfo (int code, const char *emsg)
 
int setErrInfo (int code, const char *txtlist[], int n)
 
int setErrInfo (int code, XrdOucBuffer *buffP)
 
void setErrMid (int mid)
 Set the monitoring identifier. More...
 
void setErrUser (const char *user)
 
void setUCap (int ucval)
 Set user capabilties. More...
 

Static Public Member Functions

static XrdCmsRespAlloc (XrdOucErrInfo *erp, int msgid)
 
static void Reply ()
 
static void setDelay (int repdly)
 

Friends

class XrdCmsRespQ
 

Additional Inherited Members

- Protected Attributes inherited from XrdOucErrInfo
union {
unsigned long long ErrCBarg
 
XrdOucEnvErrEnv
 
}; 
 
XrdOucBufferdataBuff
 
short dOff
 
XrdOucEICBErrCB
 
XrdOucEI ErrInfo
 
int mID
 
short reserved
 

Detailed Description

Definition at line 69 of file XrdCmsResp.hh.

Constructor & Destructor Documentation

◆ XrdCmsResp()

XrdCmsResp::XrdCmsResp ( )
inline

Definition at line 91 of file XrdCmsResp.hh.

91 : XrdOucErrInfo(UserID) {next = 0; myBuff = 0;}
XrdOucErrInfo(const char *user=0, XrdOucEICB *cb=0, unsigned long long ca=0, int mid=0, int uc=0)

◆ ~XrdCmsResp()

XrdCmsResp::~XrdCmsResp ( )
inline

Definition at line 92 of file XrdCmsResp.hh.

92 {}

Member Function Documentation

◆ Alloc()

XrdCmsResp * XrdCmsResp::Alloc ( XrdOucErrInfo erp,
int  msgid 
)
static

Definition at line 64 of file XrdCmsResp.cc.

65 {
66  XrdCmsResp *rp;
67 
68 // Allocate a response object. We must be assured that the semaphore count
69 // is zero. This will be true for freshly allocated objects. For reused
70 // objects we will need to run down the count to zero as multiple calls
71 // to sem_init may produced undefined behaviour.
72 //
73  myMutex.Lock();
74  if (nextFree)
75  {rp = nextFree;
76  nextFree = rp->next;
77  numFree--;
78  rp->SyncCB.Init();
79  }
80  else if (!(rp = new XrdCmsResp()))
81  {myMutex.UnLock();
82  return (XrdCmsResp *)0;
83  }
84  myMutex.UnLock();
85 
86 // Initialize it. We also replace the callback object pointer with a pointer
87 // to the synchronization semaphore as we have taken over the object and must
88 // provide a callback synchronization path for the caller. The OucEI object
89 // must be setup with pointers to stable areas and we will relocate any data
90 // to allow for a message to be sent back without overwriting the data (usually
91 // the path related to this request). We do this manually as the assignment
92 // operator does a bit more and a bit less than what we really need to do here.
93 //
94  strlcpy(rp->UserID, erp->getErrUser(), sizeof(rp->UserID));
95  rp->setErrUser(rp->UserID);
97  rp->setErrInfo(0, "");
98  rp->setErrMid(erp->getErrMid());
99  rp->ErrCB = erp->getErrCB(rp->ErrCBarg);
100  erp->setErrCB((XrdOucEICB *)&rp->SyncCB);
101  rp->myID = msgid;
102  rp->next = 0;
103 
104 // Return the response object
105 //
106  return rp;
107 }
size_t strlcpy(char *dst, const char *src, size_t sz)
void Init()
Definition: XrdCmsResp.hh:49
const char * getErrData()
XrdOucEICB * getErrCB()
void setErrCB(XrdOucEICB *cb, unsigned long long cbarg=0)
void setErrUser(const char *user)
void setErrMid(int mid)
Set the monitoring identifier.
int setErrInfo(int code, const char *emsg)
const char * getErrUser()
XrdOucEICB * ErrCB
void setErrData(const char *Data, int Offs=0)
static const int Path_Offset

References XrdOucErrInfo::ErrCB, XrdOucErrInfo::getErrCB(), XrdOucErrInfo::getErrData(), XrdOucErrInfo::getErrMid(), XrdOucErrInfo::getErrUser(), XrdCmsRespCB::Init(), XrdOucEI::Path_Offset, XrdOucErrInfo::setErrCB(), XrdOucErrInfo::setErrData(), XrdOucErrInfo::setErrInfo(), XrdOucErrInfo::setErrMid(), XrdOucErrInfo::setErrUser(), and strlcpy().

Referenced by XrdCmsClientMan::delayResp().

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

◆ Done()

void XrdCmsResp::Done ( int &  Result,
XrdOucErrInfo eInfo,
const char *  Path = 0 
)
inlinevirtual

Invoke a callback after an operation completes.

Parameters
Result- the original function's result (may be changed).
eInfo- Associated error information. The eInfo object may not be modified until it's own callback Done() method is called, if supplied. If the callback function in eInfo is zero, then the eInfo object is deleted by the invoked callback. Otherwise, that method must be invoked by this callback function after the actual callback message is sent. This allows the callback requestor to do post-processing and be asynchronous being assured that the callback completed.
Path- Optionally, the path related to thid request. It is used for tracing and detailed monitoring purposes.

Implements XrdOucEICB.

Definition at line 76 of file XrdCmsResp.hh.

77  {Recycle();}

◆ ID()

int XrdCmsResp::ID ( )
inline

Definition at line 79 of file XrdCmsResp.hh.

79 {return myID;}

◆ Reply() [1/2]

void XrdCmsResp::Reply ( )
static

Definition at line 164 of file XrdCmsResp.cc.

165 {
166  XrdCmsResp *rp;
167 
168 // Endless look looking for something to reply to
169 //
170  while(1)
171  {isReady.Wait();
172  rdyMutex.Lock();
173  if ((rp = First))
174  {if (!(First = rp->next)) Last = 0;
175  rdyMutex.UnLock();
176  rp->ReplyXeq();
177  } else rdyMutex.UnLock();
178  }
179 }

Referenced by XrdCmsStartResp().

+ Here is the caller graph for this function:

◆ Reply() [2/2]

void XrdCmsResp::Reply ( const char *  Man,
XrdCms::CmsRRHdr rrhdr,
XrdOucBuffer netbuff 
)

Definition at line 138 of file XrdCmsResp.cc.

139 {
140 
141 // Copy the data we need to have
142 //
143  myRRHdr = rrhdr;
144  myBuff = netbuff;
145  next = 0;
146  strlcpy(theMan, manp, sizeof(theMan));
147 
148 // Now queue this object
149 //
150  rdyMutex.Lock();
151  if (Last) {Last->next = this; Last = this;}
152  else Last=First = this;
153  rdyMutex.UnLock();
154 
155 // Now indicate we have something to process
156 //
157  isReady.Post();
158 }

References strlcpy().

+ Here is the call graph for this function:

◆ Same()

int XrdCmsResp::Same ( unsigned long long  arg1,
unsigned long long  arg2 
)
inlinevirtual

Determine if two callback arguments refer to the same client.

Parameters
arg1- The first callback argument.
arg2- The second callback argument.
Returns
!0 - The arguments refer to the same client.
=0 - The arguments refer to the different clients.

Implements XrdOucEICB.

Definition at line 86 of file XrdCmsResp.hh.

87  {return 0;}

◆ setDelay()

static void XrdCmsResp::setDelay ( int  repdly)
inlinestatic

Definition at line 89 of file XrdCmsResp.hh.

89 {RepDelay = repdly;}

Friends And Related Function Documentation

◆ XrdCmsRespQ

friend class XrdCmsRespQ
friend

Definition at line 72 of file XrdCmsResp.hh.


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