![]() |
XRootD
|
#include <XrdSsiResponder.hh>
Public Member Functions | |
void | BindRequest (XrdSsiRequest &rqstR) |
bool | UnBindRequest () |
Static Public Attributes | |
static const int | MaxDirectXfr = 2097152 |
Protected Types | |
enum | Status { wasPosted =0 , notPosted , notActive } |
Protected Member Functions | |
XrdSsiResponder () | |
virtual | ~XrdSsiResponder () |
void | Alert (XrdSsiRespInfoMsg &aMsg) |
virtual void | Finished (XrdSsiRequest &rqstR, const XrdSsiRespInfo &rInfo, bool cancel=false)=0 |
char * | GetRequest (int &dlen) |
void | ReleaseRequestBuffer () |
Status | SetErrResponse (const char *eMsg, int eNum) |
Status | SetMetadata (const char *buff, int blen) |
Status | SetNilResponse () |
Status | SetResponse (const char *buff, int blen) |
Status | SetResponse (long long fsize, int fdnum) |
Status | SetResponse (XrdSsiStream *strmP) |
Static Protected Attributes | |
static const int | MaxMetaDataSZ = 2097152 |
2MB metadata limit More... | |
Friends | |
class | XrdSsiRequest |
class | XrdSsiRRAgent |
Definition at line 68 of file XrdSsiResponder.hh.
|
protected |
The following enums are returned by SetMetadata() and SetResponse() to indicate ending status.
Definition at line 162 of file XrdSsiResponder.hh.
|
protected |
This class is meant to be inherited by an object that will actually posts responses.
Definition at line 96 of file XrdSsiResponder.cc.
|
protectedvirtual |
Destructor is protected. You cannot use delete on a responder object, as it is meant to be inherited by a class and not separately instantiated.
Definition at line 105 of file XrdSsiResponder.cc.
References XrdSsiMutex::Lock(), and XrdSsiMutex::UnLock().
|
protected |
Send an alert message to the request. This is a convenience method that avoids race conditions with Finished() so it is safe to use in all cases. This is a server-side call. The service is responsible for creating a RespInfoMsg object containing the message and supplying a RecycleMsg() method.
aMsg | reference to the message to be sent. |
Definition at line 136 of file XrdSsiResponder.cc.
References XrdSsiRequest::Alert(), and XrdSsiRespInfoMsg::RecycleMsg().
void XrdSsiResponder::BindRequest | ( | XrdSsiRequest & | rqstR | ) |
Take ownership of a request object by binding the request object to a responder object. This method must be called by the responder before posting any responses.
rqstR | reference to the request object. |
Definition at line 150 of file XrdSsiResponder.cc.
References XrdSsiErrInfo::Clr(), XrdSsiRespInfo::Init(), XrdSsiMutex::Lock(), and XrdSsiMutex::UnLock().
|
protectedpure virtual |
Notify the responder that a request either completed or was canceled. This allows the responder to release any resources given to the request object (e.g. data response buffer or a stream). This method is invoked when XrdSsiRequest::Finished() is called by the client.
rqstR | reference to the object describing the request. |
rInfo | reference to the object describing the response. |
cancel | False -> the request/response interaction completed. True -> the request/response interaction aborted because of an error or the client requested that the request be canceled. |
Implemented in PostError, and XrdSsiTaskReal.
Referenced by XrdSsiRequest::Finished().
|
protected |
Obtain the request data sent by a client.
Note: This method is called with the object's recursive mutex unlocked!
dlen | holds the length of the request after the call. |
Definition at line 179 of file XrdSsiResponder.cc.
References XrdSsiRequest::GetRequest().
|
protected |
Release the request buffer of the request bound to this object. This method duplicates the protected method of the same name in XrdSsiRequest and exists here for calling safety and consistency relative to the responder.
Definition at line 194 of file XrdSsiResponder.cc.
References XrdSsiRequest::ReleaseRequestBuffer().
|
protected |
Set an error response for a request.
eMsg | the message describing the error. The message is copied to private storage. |
eNum | the errno associated with the error. |
Definition at line 229 of file XrdSsiResponder.cc.
References eMsg, XrdSsiErrInfo::Get(), XrdSsiRespInfo::isError, XrdSsiRespInfo::rType, XrdSsiErrInfo::Set(), SSI_VAL_RESPONSE, and SSI_XEQ_RESPONSE.
|
protected |
Definition at line 208 of file XrdSsiResponder.cc.
References XrdSsiMutex::Lock(), MaxMetaDataSZ, XrdSsiRespInfo::mdata, XrdSsiRespInfo::mdlen, notPosted, XrdSsiMutex::UnLock(), and wasPosted.
|
inlineprotected |
Set a nil response for a request (used for sending only metadata).
Definition at line 202 of file XrdSsiResponder.hh.
References SetResponse().
|
protected |
Set a memory buffer containing data as the request response.
buff | pointer to a buffer holding the response. The buffer must remain valid until XrdSsiResponder::Finished() is called. |
blen | the length of the response in buff that is to be sent. |
Definition at line 252 of file XrdSsiResponder.cc.
References XrdSsiRespInfo::isData, XrdSsiRespInfo::rType, SSI_VAL_RESPONSE, and SSI_XEQ_RESPONSE.
Referenced by SetNilResponse().
|
protected |
Set a file containing data as the response.
fsize | the size of the file containing the response. |
fdnum | the file descriptor of the open file. |
Definition at line 272 of file XrdSsiResponder.cc.
References XrdSsiRespInfo::isFile, XrdSsiRespInfo::rType, SSI_VAL_RESPONSE, and SSI_XEQ_RESPONSE.
|
protected |
Set a stream object that is to provide data as the response.
strmP | pointer to stream object that is to be used to supply response data. See XrdSsiStream for more details. |
Definition at line 292 of file XrdSsiResponder.cc.
References XrdSsiRespInfo::isStream, XrdSsiRespInfo::rType, SSI_VAL_RESPONSE, and SSI_XEQ_RESPONSE.
bool XrdSsiResponder::UnBindRequest | ( | ) |
Unbind this responder from the request object it is bound to. Upon return ownership of the associated request object reverts back to the creator of the object who is responsible for deleting or recycling the request object. UnBindRequest() is also called when the responder object is deleted.
Definition at line 314 of file XrdSsiResponder.cc.
References XrdSsiMutex::Lock(), and XrdSsiMutex::UnLock().
|
friend |
Definition at line 71 of file XrdSsiResponder.hh.
|
friend |
Definition at line 72 of file XrdSsiResponder.hh.
|
static |
The maximum amount of metadata+data (i.e. the sum of two blen arguments in SetMetadata() and and SetResponse(const char *buff, int blen), respectively) that may be directly sent to the client without the SSI framework converting the data buffer response into a stream response.
Definition at line 81 of file XrdSsiResponder.hh.
Referenced by XrdSsiFileSess::AttnInfo().
|
staticprotected |
2MB metadata limit
Set a pointer to metadata to be sent out-of-band ahead of the response.
buff | pointer to a buffer holding the metadata. The buffer must remain valid until XrdSsiResponder::Finished() is called. |
blen | the length of the metadata in buff that is to be sent. It must in the range 0 <= blen <= MaxMetaDataSZ. |
Definition at line 180 of file XrdSsiResponder.hh.
Referenced by SetMetadata().