XrdXrootd::Bridge::Result Class Reference

#include <XrdXrootdBridge.hh>

Inheritance diagram for XrdXrootd::Bridge::Result:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual bool Data (Bridge::Context &info, const struct iovec *iovP, int iovN, int iovL, bool final)=0
virtual bool Done (Bridge::Context &info)=0
 the result context
virtual bool Error (Bridge::Context &info, int ecode, const char *etext)=0
virtual int File (Bridge::Context &info, int dlen)=0
virtual void Free (Bridge::Context &info, char *buffP, int buffL)
virtual bool Redir (Bridge::Context &info, int port, const char *hname)=0
virtual bool Wait (Bridge::Context &info, int wtime, const char *wtext)
virtual Bridge::ResultWaitResp (Bridge::Context &info, int wtime, const char *wtext)
 Result ()
 Constructor & Destructor.
virtual ~Result ()

Detailed Description

Handle xrootd protocol execution results.

The Result object is an abstract class that defines the interface used by the xrootd protocol stack to effect a client response using whatever alternate protocol is needed. You must define an implementation and pass it as an argument to the Login() Bridge method.


Constructor & Destructor Documentation

XrdXrootd::Bridge::Result::Result (  )  [inline]

Constructor & Destructor.

virtual XrdXrootd::Bridge::Result::~Result (  )  [inline, virtual]

Member Function Documentation

virtual bool XrdXrootd::Bridge::Result::Data ( Bridge::Context info,
const struct iovec *  iovP,
int  iovN,
int  iovL,
bool  final 
) [pure virtual]

Effect a client data response.

The Data() method is called when Run() resulted in a successful data response. The method should rewrite the data and send it to the client using the associated XrdLink object. As an example, 1) Result::Data(info, iovP, iovN, iovL) is called. 2) Inspect iovP, rewrite the data. 3) Send the response: info->linkP->Send(new_iovP, new_iovN, new_iovL); 4) Handle send errors and cleanup(e.g. deallocate storage). 5) Return, the exchange is now complete.

Parameters:
info the context associated with the result.
iovP a pointer to the iovec structure containing the xrootd data response about to be sent to the client. The request header is not included in the iovec structure. The elements of this structure must not be modified by the method.
iovN the number of elements in the iovec structure array.
iovL total number of data bytes that would be sent to the client. This is simply the sum of all the lengths in the iovec.
final True is this is the final result. Otherwise, this is a partial result (i.e. kXR_oksofar) and more data will result causing additional callbacks. For write requests, any supplied data buffer may now be reused or freed.
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
iovP pointer to data array
iovN array count
iovL byte count
final true -> final result

Implemented in XrdHttpReq.

virtual bool XrdXrootd::Bridge::Result::Done ( Bridge::Context info  )  [pure virtual]

the result context

Effect a client acknowledgement.

The Done() method is called when Run() resulted in success and there is no associated data for the client (equivalent to a simple kXR_ok response).

Parameters:
info the context associated with the result.
Returns:
true continue normal processing. false terminate the bridge and close the link.

Implemented in XrdHttpReq.

virtual bool XrdXrootd::Bridge::Result::Error ( Bridge::Context info,
int  ecode,
const char *  etext 
) [pure virtual]

Effect a client error response.

The Error() method is called when an error was encountered while processing the Run() request. The error should be reflected to the client.

Parameters:
info the context associated with the result.
ecode the "kXR" error code describing the nature of the error. The code is in host byte format.
etext a null terminated string describing the error in human terms
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
ecode the "kXR" error code
etext associated error message

Implemented in XrdHttpReq.

virtual int XrdXrootd::Bridge::Result::File ( Bridge::Context info,
int  dlen 
) [pure virtual]

Notify callback that a sendfile() request is pending.

The File() method is called when Run() resulted in a sendfile response (i.e. sendfile() would have been used to send data to the client). This allows the callback to reframe the sendfile() data using the Send() method in the passed context object (see class Context above).

Parameters:
info the context associated with the result.
dlen total number of data bytes that would be sent to the client.
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
dlen byte count

Implemented in XrdHttpReq.

virtual void XrdXrootd::Bridge::Result::Free ( Bridge::Context info,
char *  buffP,
int  buffL 
) [inline, virtual]

Notify callback that a write buffer is now available for reuse.

The Free() method is called when Run() was called to write data and a buffer was supplied. Normally, he buffer is pinned and cannot be reused until the write completes. This callback provides the notification that the buffer is no longer in use. The callback is invoked prior to any other callbacks and is only invoked if a buffer was supplied.

Parameters:
info the context associated with this call.
buffP pointer to the buffer.
buffL the length originally supplied in the Run() call.
Parameters:
info the result context
buffP pointer to the buffer
buffL original length to Run()
virtual bool XrdXrootd::Bridge::Result::Redir ( Bridge::Context info,
int  port,
const char *  hname 
) [pure virtual]

Redirect the client to another host:port.

The Redir() method is called when the client must be redirected to another host.

Parameters:
info the context associated with the result.
port the port number in host byte format.
hname the DNS name of the host or IP address is IPV4 or IPV6 format (i.e. "n.n.n.n" or "[ipv6_addr]").
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
port the port number
hname the destination host

Implemented in XrdHttpReq.

virtual bool XrdXrootd::Bridge::Result::Wait ( Bridge::Context info,
int  wtime,
const char *  wtext 
) [inline, virtual]

Effect a client wait.

The Wait() method is called when Run() needs to delay a request. Normally, delays are internally handled. However, you can request that delays be reflected via a callback using the Bridge SetWait() method.

Parameters:
info the context associated with the result.
wtime the number of seconds to delay the request.
wtext a null terminated string describing the wait in human terms
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
wtime the wait time
wtext associated message
virtual Bridge::Result* XrdXrootd::Bridge::Result::WaitResp ( Bridge::Context info,
int  wtime,
const char *  wtext 
) [inline, virtual]

Effect a client wait response (waitresp) NOT CURRENTLY IMPLEMENTED!

The WaitResp() method is called when an operation ended with a wait for response (waitresp) condition. The wait for response condition indicates that the actual response will be delivered at a later time. You can use context object to determine the operation being delayed. This callback provides you the opportunity to say how the waitresp is to be handled.

Parameters:
info the context associated with the result.
wtime the number of seconds in which a response is expected.
wtext a null terminated string describing the delay in human terms
Returns:
!0 pointer to the callback object whose appropriate method should be called when the actual response is generated.
0 the waitresp will be handled by the bridge application. The application is responsible for re-issuing the request when the final response is a wait.
Parameters:
info the result context
wtime the wait time
wtext associated message

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

Generated on 23 Mar 2020 for xrootd by  doxygen 1.6.1