xrootd
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Attributes | Private Attributes | Friends | List of all members
XrdSsiResponder Class Referenceabstract

#include <XrdSsiResponder.hh>

Inheritance diagram for XrdSsiResponder:
Inheritance graph
[legend]
Collaboration diagram for XrdSsiResponder:
Collaboration graph
[legend]

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

void Alert (XrdSsiRespInfoMsg &aMsg)
 
virtual void Finished (XrdSsiRequest &rqstR, const XrdSsiRespInfo &rInfo, bool cancel=false)=0
 
char * GetRequest (int &dlen)
 
void ReleaseRequestBuffer ()
 
Status SetMetadata (const char *buff, int blen)
 
Status SetErrResponse (const char *eMsg, int eNum)
 
Status SetNilResponse ()
 
Status SetResponse (const char *buff, int blen)
 
Status SetResponse (long long fsize, int fdnum)
 
Status SetResponse (XrdSsiStream *strmP)
 
 XrdSsiResponder ()
 
virtual ~XrdSsiResponder ()
 

Static Protected Attributes

static const int MaxMetaDataSZ = 2097152
 2MB metadata limit
 

Private Attributes

XrdSsiMutex spMutex
 
XrdSsiRequestreqP
 
long long rsvd1
 
long long rsvd2
 
long long rsvd3
 

Friends

class XrdSsiRequest
 
class XrdSsiRRAgent
 

Member Enumeration Documentation

◆ Status

enum XrdSsiResponder::Status
protected

The following enums are returned by SetMetadata() and SetResponse() to indicate ending status.

Enumerator
wasPosted 

Success: The response was successfully posted.

notPosted 

Failure: A request was not bound to this object or a response has already been posted or the metadata length was invalid

notActive 

Failure: Request is no longer active.

Constructor & Destructor Documentation

◆ XrdSsiResponder()

XrdSsiResponder::XrdSsiResponder ( )
protected

This class is meant to be inherited by an object that will actually posts responses.

◆ ~XrdSsiResponder()

virtual XrdSsiResponder::~XrdSsiResponder ( )
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.

Member Function Documentation

◆ Alert()

void XrdSsiResponder::Alert ( XrdSsiRespInfoMsg aMsg)
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.

Parameters
aMsgreference to the message to be sent.

◆ BindRequest()

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.

Parameters
rqstRreference to the request object.

◆ Finished()

virtual void XrdSsiResponder::Finished ( XrdSsiRequest rqstR,
const XrdSsiRespInfo rInfo,
bool  cancel = false 
)
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.

Parameters
rqstRreference to the object describing the request.
rInforeference to the object describing the response.
cancelFalse -> 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 XrdSsiTaskReal.

◆ GetRequest()

char * XrdSsiResponder::GetRequest ( int &  dlen)
protected

Obtain the request data sent by a client.

Note: This method is called with the object's recursive mutex unlocked!

Parameters
dlenholds the length of the request after the call.
Returns
=0 No request data available, dlen has been set to zero.
!0 Pointer to the buffer holding the request, dlen has the length

◆ ReleaseRequestBuffer()

void XrdSsiResponder::ReleaseRequestBuffer ( )
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.

◆ SetErrResponse()

Status XrdSsiResponder::SetErrResponse ( const char *  eMsg,
int  eNum 
)
protected

Set an error response for a request.

Parameters
eMsgthe message describing the error. The message is copied to private storage.
eNumthe errno associated with the error.
Returns
See Status enum for possible values.

◆ SetMetadata()

Status XrdSsiResponder::SetMetadata ( const char *  buff,
int  blen 
)
protected

◆ SetNilResponse()

Status XrdSsiResponder::SetNilResponse ( )
inlineprotected

Set a nil response for a request (used for sending only metadata).

Returns
See Status enum for possible values.

References SetResponse().

◆ SetResponse() [1/3]

Status XrdSsiResponder::SetResponse ( const char *  buff,
int  blen 
)
protected

Set a memory buffer containing data as the request response.

Parameters
buffpointer to a buffer holding the response. The buffer must remain valid until XrdSsiResponder::Finished() is called.
blenthe length of the response in buff that is to be sent.
Returns
See Status enum for possible values.

Referenced by SetNilResponse().

◆ SetResponse() [2/3]

Status XrdSsiResponder::SetResponse ( long long  fsize,
int  fdnum 
)
protected

Set a file containing data as the response.

Parameters
fsizethe size of the file containing the response.
fdnumthe file descriptor of the open file.
Returns
See Status enum for possible values.

◆ SetResponse() [3/3]

Status XrdSsiResponder::SetResponse ( XrdSsiStream strmP)
protected

Set a stream object that is to provide data as the response.

Parameters
strmPpointer to stream object that is to be used to supply response data. See XrdSsiStream for more details.
Returns
See Status enum for possible values.

◆ UnBindRequest()

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.

Returns
true Request successfully unbound. false UnBindRequest already called or called prior to Finish().

Friends And Related Symbol Documentation

◆ XrdSsiRequest

friend class XrdSsiRequest
friend

◆ XrdSsiRRAgent

friend class XrdSsiRRAgent
friend

Member Data Documentation

◆ MaxDirectXfr

const int XrdSsiResponder::MaxDirectXfr = 2097152
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.

◆ MaxMetaDataSZ

const int XrdSsiResponder::MaxMetaDataSZ = 2097152
staticprotected

2MB metadata limit

Set a pointer to metadata to be sent out-of-band ahead of the response.

Parameters
buffpointer to a buffer holding the metadata. The buffer must remain valid until XrdSsiResponder::Finished() is called.
blenthe length of the metadata in buff that is to be sent. It must in the range 0 <= blen <= MaxMetaDataSZ.
Returns
See Status enum for possible values.

◆ reqP

XrdSsiRequest* XrdSsiResponder::reqP
private

◆ rsvd1

long long XrdSsiResponder::rsvd1
private

◆ rsvd2

long long XrdSsiResponder::rsvd2
private

◆ rsvd3

long long XrdSsiResponder::rsvd3
private

◆ spMutex

XrdSsiMutex XrdSsiResponder::spMutex
private

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