XrdSsiResponder Class Reference

#include <XrdSsiResponder.hh>

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

List of all members.

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

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 (  )  [protected]

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

virtual XrdSsiResponder::~XrdSsiResponder (  )  [protected, virtual]

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

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:
aMsg reference to the message to be sent.
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:
rqstR reference to the request object.
virtual void XrdSsiResponder::Finished ( XrdSsiRequest rqstR,
const XrdSsiRespInfo rInfo,
bool  cancel = false 
) [protected, pure 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:
rqstP 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 XrdSsiTaskReal.

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:
dlen holds 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
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.

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

Set an error response for a request.

Parameters:
eMsg the message describing the error. The message is copied to private storage.
eNum the errno associated with the error.
Returns:
See Status enum for possible values.
Status XrdSsiResponder::SetMetadata ( const char *  buff,
int  blen 
) [protected]
Status XrdSsiResponder::SetNilResponse (  )  [inline, protected]

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

Returns:
See Status enum for possible values.

References SetResponse().

Status XrdSsiResponder::SetResponse ( XrdSsiStream strmP  )  [protected]

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

Parameters:
strmP pointer to stream object that is to be used to supply response data. See XrdSsiStream for more details.
Returns:
See Status enum for possible values.
Status XrdSsiResponder::SetResponse ( long long  fsize,
int  fdnum 
) [protected]

Set a file containing data as the response.

Parameters:
fsize the size of the file containing the response.
fdnum the file descriptor of the open file.
Returns:
See Status enum for possible values.
Status XrdSsiResponder::SetResponse ( const char *  buff,
int  blen 
) [protected]

Set a memory buffer containing data as the request response.

Parameters:
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.
Returns:
See Status enum for possible values.

Referenced by SetNilResponse().

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 Function Documentation

friend class XrdSsiRequest [friend]
friend class XrdSsiRRAgent [friend]

Member Data Documentation

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.

const int XrdSsiResponder::MaxMetaDataSZ = 2097152 [static, protected]

2MB metadata limit

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

Parameters:
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.
Returns:
See Status enum for possible values.
long long XrdSsiResponder::rsvd1 [private]
long long XrdSsiResponder::rsvd2 [private]
long long XrdSsiResponder::rsvd3 [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 19 Oct 2019 for xrootd by  doxygen 1.6.1