xrootd
Loading...
Searching...
No Matches
XrdXrootdBridge.hh
Go to the documentation of this file.
1#ifndef __XRDXROOTDBRIDGE_HH_
2#define __XRDXROOTDBRIDGE_HH_
3/******************************************************************************/
4/* */
5/* X r d X r o o t d B r i d g e . h h */
6/* */
7/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <cstring>
34
35#include "XProtocol/XPtypes.hh"
36
37//-----------------------------------------------------------------------------
47//-----------------------------------------------------------------------------
48
49struct iovec;
50class XrdLink;
51class XrdSecEntity;
53
54namespace XrdXrootd
55{
56
57/******************************************************************************/
58/* X r d X r o o t d : : B r i d g e */
59/******************************************************************************/
60
61class Bridge
62{
63public:
64class Result;
65
66//-----------------------------------------------------------------------------
101//-----------------------------------------------------------------------------
102
103static
105 XrdLink *linkP,
106 XrdSecEntity *seceP,
107 const char *nameP,
108 const char *protP
109 );
110
111//-----------------------------------------------------------------------------
150//-----------------------------------------------------------------------------
151
152virtual bool Run(const char *xreqP,
153 char *xdataP=0,
154 int xdataL=0
155 ) = 0;
156
157//-----------------------------------------------------------------------------
170//-----------------------------------------------------------------------------
171
172virtual bool Disc() = 0;
173
174//-----------------------------------------------------------------------------
187//-----------------------------------------------------------------------------
188
189virtual int setSF(kXR_char *fhandle, bool seton=false) = 0;
190
191//-----------------------------------------------------------------------------
208//-----------------------------------------------------------------------------
209
210virtual void SetWait(int wtime, bool notify=false) = 0;
211
212/******************************************************************************/
213/* X r d X r o o t d : : B r i d g e : : C o n t e x t */
214/******************************************************************************/
215
216//-----------------------------------------------------------------------------
223//-----------------------------------------------------------------------------
224
226{
227public:
228
233 } sID;
234
235//-----------------------------------------------------------------------------
256//-----------------------------------------------------------------------------
257
258virtual int Send(const
259 struct iovec *headP,
260 int headN,
261 const
262 struct iovec *tailP,
263 int tailN
264 )
265{
266 (void)headP; (void)headN; (void)tailP; (void)tailN;
267 return 1;
268}
269
270//-----------------------------------------------------------------------------
272//-----------------------------------------------------------------------------
273
275 : linkP(lP), rCode(req)
276 {memcpy(sID.chr, sid, sizeof(sID.chr));}
277virtual ~Context() {}
278};
279
280/******************************************************************************/
281/* X r d X r o o t d : : B r i d g e : : R e s u l t */
282/******************************************************************************/
283
284//-----------------------------------------------------------------------------
291//-----------------------------------------------------------------------------
292
294{
295public:
296
297//-----------------------------------------------------------------------------
324//-----------------------------------------------------------------------------
325
326virtual bool Data(Bridge::Context &info,
327 const
328 struct iovec *iovP,
329 int iovN,
330 int iovL,
331 bool final
332 ) = 0;
333
334//-----------------------------------------------------------------------------
344//-----------------------------------------------------------------------------
345
346virtual bool Done(Bridge::Context &info)=0;
347
348//-----------------------------------------------------------------------------
361//-----------------------------------------------------------------------------
362
363virtual bool Error(Bridge::Context &info,
364 int ecode,
365 const char *etext
366 ) = 0;
367
368//-----------------------------------------------------------------------------
381//-----------------------------------------------------------------------------
382
383virtual int File(Bridge::Context &info,
384 int dlen
385 ) = 0;
386
387//-----------------------------------------------------------------------------
399//-----------------------------------------------------------------------------
400
401virtual void Free(Bridge::Context &info,
402 char *buffP,
403 int buffL
404 )
405{
406 (void)info; (void)buffP; (void)buffL;
407}
408
409//-----------------------------------------------------------------------------
422//-----------------------------------------------------------------------------
423
424virtual bool Redir(Bridge::Context &info,
425 int port,
426 const char *hname
427 ) = 0;
428
429//-----------------------------------------------------------------------------
442//-----------------------------------------------------------------------------
443
444virtual bool Wait(Bridge::Context &info,
445 int wtime,
446 const char *wtext
447 )
448{
449 (void)info; (void)wtime; (void)wtext;
450 return false;
451}
452
453//-----------------------------------------------------------------------------
471//-----------------------------------------------------------------------------
472virtual
474 int wtime,
475 const char *wtext
476 )
477{
478 (void)info; (void)wtime; (void)wtext;
479 return 0;
480}
481
482//-----------------------------------------------------------------------------
484//-----------------------------------------------------------------------------
485
487virtual ~Result() {}
488};
489
490//-----------------------------------------------------------------------------
492//-----------------------------------------------------------------------------
493
495protected:
496virtual ~Bridge() {}
497};
498}
499#endif
unsigned short kXR_unt16
Definition XPtypes.hh:67
unsigned char kXR_char
Definition XPtypes.hh:65
Definition XrdSecEntity.hh:65
Definition XrdXrootdProtocol.hh:156
Definition XrdXrootdBridge.hh:226
kXR_char chr[2]
associated stream ID as the original char[2]
Definition XrdXrootdBridge.hh:232
Context(XrdLink *lP, kXR_char *sid, kXR_unt16 req)
Constructor and Destructor.
Definition XrdXrootdBridge.hh:274
kXR_unt16 rCode
associated "kXR" request code in host byte order
Definition XrdXrootdBridge.hh:230
virtual ~Context()
Definition XrdXrootdBridge.hh:277
XrdLink * linkP
-> associated session link object (i.e. connection)
Definition XrdXrootdBridge.hh:229
kXR_unt16 num
associated stream ID as a short
Definition XrdXrootdBridge.hh:231
virtual int Send(const struct iovec *headP, int headN, const struct iovec *tailP, int tailN)
Definition XrdXrootdBridge.hh:258
union XrdXrootd::Bridge::Context::@155 sID
associated request stream ID
Definition XrdXrootdBridge.hh:294
virtual Bridge::Result * WaitResp(Bridge::Context &info, int wtime, const char *wtext)
Definition XrdXrootdBridge.hh:473
virtual ~Result()
Definition XrdXrootdBridge.hh:487
virtual int File(Bridge::Context &info, int dlen)=0
virtual bool Data(Bridge::Context &info, const struct iovec *iovP, int iovN, int iovL, bool final)=0
Result()
Constructor & Destructor.
Definition XrdXrootdBridge.hh:486
virtual bool Error(Bridge::Context &info, int ecode, const char *etext)=0
virtual bool Done(Bridge::Context &info)=0
the result context
virtual bool Redir(Bridge::Context &info, int port, const char *hname)=0
virtual bool Wait(Bridge::Context &info, int wtime, const char *wtext)
Definition XrdXrootdBridge.hh:444
virtual void Free(Bridge::Context &info, char *buffP, int buffL)
Definition XrdXrootdBridge.hh:401
Definition XrdXrootdBridge.hh:62
virtual ~Bridge()
Definition XrdXrootdBridge.hh:496
Bridge()
Constructor & Destructor.
Definition XrdXrootdBridge.hh:494
virtual bool Disc()=0
virtual int setSF(kXR_char *fhandle, bool seton=false)=0
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 void SetWait(int wtime, bool notify=false)=0
Definition XrdXrootdBridge.hh:55