xrootd
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
XrdXrootd::Bridge Class Referenceabstract

#include <XrdXrootdBridge.hh>

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

Classes

class  Context
 
class  Result
 

Public Member Functions

virtual bool Run (const char *xreqP, char *xdataP=0, int xdataL=0)=0
 
virtual bool Disc ()=0
 
virtual int setSF (kXR_char *fhandle, bool seton=false)=0
 
virtual void SetWait (int wtime, bool notify=false)=0
 
 Bridge ()
 Constructor & Destructor.
 

Static Public Member Functions

static BridgeLogin (Result *rsltP, XrdLink *linkP, XrdSecEntity *seceP, const char *nameP, const char *protP)
 

Protected Member Functions

virtual ~Bridge ()
 

Constructor & Destructor Documentation

◆ Bridge()

XrdXrootd::Bridge::Bridge ( )
inline

Constructor & Destructor.

◆ ~Bridge()

virtual XrdXrootd::Bridge::~Bridge ( )
inlineprotectedvirtual

Member Function Documentation

◆ Disc()

virtual bool XrdXrootd::Bridge::Disc ( )
pure virtual

Disconnect the session from the bridge.

The Disc() method allows you to disconnect the session from the bridge and free the storage associated with this object. It may be called when you want to regain control of the connection and delete the Bridge object (note that you cannot use delete on Bridge). The Disc() method must not be called in your protocol Recycle() method as protocol object recycling already implies a Disc() call (i.e. the connection is disbanding the associated protocol).

Returns
true the bridge has been dismantled. false the bridge cannot be dismantled because it is still processing a previous request.

Implemented in XrdXrootdTransit.

◆ Login()

static Bridge * XrdXrootd::Bridge::Login ( Result rsltP,
XrdLink linkP,
XrdSecEntity seceP,
const char *  nameP,
const char *  protP 
)
static

Create a Bridge object.

The first step is to create a Bridge object via a Login() call. The object should correspond to a session (i.e. tied to a particular client) real or not. The returned object must be used to inject xrootd requests into the protocol stack. Response rewrites are handled by the Result object passed as an argument. A successful Login() takes control of the connection. You can still write using the Link object but reads may only occur when your protocol's Process() method is called. Use Disc() to disband the bridge and free its storage. The bridge is automatically disbanded when your protocol's Recycle() method is called. This happens when you explicitly close the link or implicitly when the Process() method returns a negative error code or a callback method returns false.

Parameters
rsltPa pointer to the result object. This object is used to to rewrite xrootd responses to protocol specific responses. It must be allocated by the caller. One such object can be created for each session or, if the protocol allows, be shared by all sessions. It cannot be deleted until all references to the object disappear (see the Result class).
linkPa pointer to the link object that the protocol driver created to the client connection.
secePa pointer to the XrdSecEntity object that describes the client's identity.
namePAn arbitrary 1-to-8 character client name. The Bridge will uniquefy this name so that log file messages will track the the associated client. The link's identity is set to correspond to this name with additional information.
protPa 1-to-7 character name of the protocol using this bridge (e.g. "http").
Returns
bridgeP a pointer to a new instance of this class if a bridge could be created, null otherwise. If null is returned, the retc variable holds the errno indicating why it failed.
Parameters
rsltPThe result callback object
linkPClient's network connection
secePClient's identity
namePClient's name for tracking
protPProtocol name for tracking

◆ Run()

virtual bool XrdXrootd::Bridge::Run ( const char *  xreqP,
char *  xdataP = 0,
int  xdataL = 0 
)
pure virtual

Inject an xrootd request into the protocol stack.

The Run() method allows you to inject an xrootd-style request into the stack. It must use the same format as a real xrootd client would use across the network. The xroot protocol reference describes these requests. The Run() method handles the request as if it came through the network with some notable exceptions (see the xdataP and xdataL arguments).

Parameters
xreqPpointer to the xrootd request. This is the standard 24-byte request header common to all xrootd requests in network format. The contents of the buffer may be modified by the this method. The buffer must not be modified by the caller before a response is solicited via the Result object.
xdataPthe associated data for this request. Full or partial data may be supplied as indicated by the xdataL argument. See explanation of xdataL. For write requests, this buffer may not be altered or deleted until the Result Free() callback is invoked. For other requests, it doesn't matter.

If the pointer is zero but the "dlen" field is not zero, dlen's worth of data is read from the network using the associated XdLink object to complete the request.

Parameters
xdataLspecifies the length of data in the buffer pointed to by xdataP. Depending on the value and the value in the "dlen" field, additional data may be read from the network.

xdataL < "dlen": dlen-xdataL additional bytes will be read from the network to complete the request. xdataL >= "dlen": no additional bytes will be read from the network. The request data is complete.

Returns
true the request has been accepted. Processing will start when the caller returns from the Process() method. A response will come via a Result object callback. false the request has been rejected because the bridge is still processing a previous request.
Parameters
xreqPxrootd request header
xdataPxrootd request data (optional)
xdataLxrootd request data length

Implemented in XrdXrootdTransit.

◆ setSF()

virtual int XrdXrootd::Bridge::setSF ( kXR_char fhandle,
bool  seton = false 
)
pure virtual

Set file's sendfile capability.

The setSF() method allows you to turn on or off the ability of an open file to be used with the sendfile() system call. This is useful when you must see the data prior to sending to the client (e.g. for encryption).

Parameters
fhandlethe filehandle as returned by kXR_open.
setonWhen true, enables sendfile() otherwise it is disabled.
Returns
=0 Sucessful.
<0 Call failed. The return code is -errno and usually will indicate that the filehandle is not valid.

Implemented in XrdXrootdTransit.

◆ SetWait()

virtual void XrdXrootd::Bridge::SetWait ( int  wtime,
bool  notify = false 
)
pure virtual

Set the maximum delay.

The setWait() method allows you to specify the maximum amount of time a request may be delayed (i.e. via kXR_wait result) before it generates a kXR_Cancelled error with the associated Error() result callback. The default maximum time is 1 hour. If you specify a time less than or equal to zero, wait requests are reflected back via the Wait() result callback method and you are responsible for handling them. You can request wait notification while still having the wait internally handled using the second parameter. Maximum delays are bridge specific. There is no global value. If you desire something other than the default you must call SetWait for each Login().

Parameters
wtimethe maximum wait time in seconds.
notifyWhen true, issues a Wait callback whenever a wait occurs. This is the default when wtime is <= 0.

Implemented in XrdXrootdTransit.


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