Loading...
Searching...
No Matches
XrdXrootdBridge.hh
Go to the documentation of this file.
#ifndef __XRDXROOTDBRIDGE_HH_
#define __XRDXROOTDBRIDGE_HH_
/******************************************************************************/
/* */
/* X r d X r o o t d B r i d g e . h h */
/* */
/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */
/* All Rights Reserved */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
/* This file is part of the XRootD software suite. */
/* */
/* XRootD is free software: you can redistribute it and/or modify it under */
/* the terms of the GNU Lesser General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
/* */
/* The copyright holder's institutional names and contributor's names may not */
/* be used to endorse or promote products derived from this software without */
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/
#include <cstring>
#include "XProtocol/XPtypes.hh"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
struct iovec;
class XrdLink;
class XrdSecEntity;
class XrdXrootdProtocol;
namespace XrdXrootd
{
/******************************************************************************/
/* X r d X r o o t d : : B r i d g e */
/******************************************************************************/
class Bridge
{
public:
class Result;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
static
Bridge *Login(Result *rsltP,
XrdLink *linkP,
XrdSecEntity *seceP,
const char *nameP,
const char *protP
);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
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;
/******************************************************************************/
/* X r d X r o o t d : : B r i d g e : : C o n t e x t */
/******************************************************************************/
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class Context
{
public:
XrdLink *linkP;
kXR_unt16 rCode;
union{kXR_unt16 num;
kXR_char chr[2];
} sID;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual int Send(const
struct iovec *headP,
int headN,
const
struct iovec *tailP,
int tailN
)
{
(void)headP; (void)headN; (void)tailP; (void)tailN;
return 1;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
Context(XrdLink *lP, kXR_char *sid, kXR_unt16 req)
: linkP(lP), rCode(req)
{memcpy(sID.chr, sid, sizeof(sID.chr));}
virtual ~Context() {}
};
/******************************************************************************/
/* X r d X r o o t d : : B r i d g e : : R e s u l t */
/******************************************************************************/
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class Result
{
public:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual bool Data(Bridge::Context &info,
const
struct iovec *iovP,
int iovN,
int iovL,
bool final
) = 0;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual bool Done(Bridge::Context &info)=0;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
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
)
{
(void)info; (void)buffP; (void)buffL;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual bool Redir(Bridge::Context &info,
int port,
const char *hname
) = 0;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual bool Wait(Bridge::Context &info,
int wtime,
const char *wtext
)
{
(void)info; (void)wtime; (void)wtext;
return false;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual
Bridge::Result *WaitResp(Bridge::Context &info,
int wtime,
const char *wtext
)
{
(void)info; (void)wtime; (void)wtext;
return 0;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
Result() {}
virtual ~Result() {}
};
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
Bridge() {}
protected:
virtual ~Bridge() {}
};
}
#endif
XPtypes.hh
kXR_unt16
unsigned short kXR_unt16
Definition XPtypes.hh:67
kXR_char
unsigned char kXR_char
Definition XPtypes.hh:65
XrdLink
Definition XrdLink.hh:52
XrdSecEntity
Definition XrdSecEntity.hh:65
XrdXrootdProtocol
Definition XrdXrootdProtocol.hh:160
XrdXrootd::Bridge::Context
Definition XrdXrootdBridge.hh:226
XrdXrootd::Bridge::Context::Context
Context(XrdLink *lP, kXR_char *sid, kXR_unt16 req)
Constructor and Destructor.
Definition XrdXrootdBridge.hh:274
XrdXrootd::Bridge::Context::rCode
kXR_unt16 rCode
associated "kXR" request code in host byte order
Definition XrdXrootdBridge.hh:230
XrdXrootd::Bridge::Context::sID
union XrdXrootd::Bridge::Context::@216053020250347016153077031152206173164054152024 sID
associated request stream ID
XrdXrootd::Bridge::Context::~Context
virtual ~Context()
Definition XrdXrootdBridge.hh:277
XrdXrootd::Bridge::Context::linkP
XrdLink * linkP
-> associated session link object (i.e. connection)
Definition XrdXrootdBridge.hh:229
XrdXrootd::Bridge::Context::Send
virtual int Send(const struct iovec *headP, int headN, const struct iovec *tailP, int tailN)
Definition XrdXrootdBridge.hh:258
XrdXrootd::Bridge::Result
Definition XrdXrootdBridge.hh:294
XrdXrootd::Bridge::Result::WaitResp
virtual Bridge::Result * WaitResp(Bridge::Context &info, int wtime, const char *wtext)
Definition XrdXrootdBridge.hh:473
XrdXrootd::Bridge::Result::~Result
virtual ~Result()
Definition XrdXrootdBridge.hh:487
XrdXrootd::Bridge::Result::File
virtual int File(Bridge::Context &info, int dlen)=0
XrdXrootd::Bridge::Result::Data
virtual bool Data(Bridge::Context &info, const struct iovec *iovP, int iovN, int iovL, bool final)=0
XrdXrootd::Bridge::Result::Result
Result()
Constructor & Destructor.
Definition XrdXrootdBridge.hh:486
XrdXrootd::Bridge::Result::Error
virtual bool Error(Bridge::Context &info, int ecode, const char *etext)=0
XrdXrootd::Bridge::Result::Done
virtual bool Done(Bridge::Context &info)=0
the result context
XrdXrootd::Bridge::Result::Redir
virtual bool Redir(Bridge::Context &info, int port, const char *hname)=0
XrdXrootd::Bridge::Result::Wait
virtual bool Wait(Bridge::Context &info, int wtime, const char *wtext)
Definition XrdXrootdBridge.hh:444
XrdXrootd::Bridge::Result::Free
virtual void Free(Bridge::Context &info, char *buffP, int buffL)
Definition XrdXrootdBridge.hh:401
XrdXrootd::Bridge::~Bridge
virtual ~Bridge()
Definition XrdXrootdBridge.hh:496
XrdXrootd::Bridge::Context.sID::num
kXR_unt16 num
associated stream ID as a short
XrdXrootd::Bridge::Bridge
Bridge()
Constructor & Destructor.
Definition XrdXrootdBridge.hh:494
XrdXrootd::Bridge::Disc
virtual bool Disc()=0
XrdXrootd::Bridge::Login
static Bridge * Login(Result *rsltP, XrdLink *linkP, XrdSecEntity *seceP, const char *nameP, const char *protP)
Definition XrdXrootdBridge.cc:38
XrdXrootd::Bridge::setSF
virtual int setSF(kXR_char *fhandle, bool seton=false)=0
XrdXrootd::Bridge::Run
virtual bool Run(const char *xreqP, char *xdataP=0, int xdataL=0)=0
XrdXrootd::Bridge::Context.sID::chr
kXR_char chr[2]
associated stream ID as the original char[2]
XrdXrootd::Bridge::SetWait
virtual void SetWait(int wtime, bool notify=false)=0
XrdXrootd
Definition XrdXrootdAioBuff.cc:49