xrootd
Loading...
Searching...
No Matches
XrdXrootdTransit.hh
Go to the documentation of this file.
1#ifndef __XRDXROOTDTRANSIT_HH_
2#define __XRDXROOTDTRANSIT_HH_
3/******************************************************************************/
4/* */
5/* X r d X r o o t d T r a n s i t . 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 <sys/types.h>
34
38
39#include "Xrd/XrdObject.hh"
40
41//-----------------------------------------------------------------------------
45//-----------------------------------------------------------------------------
46
47class XrdOucSFVec;
48class XrdScheduler;
50struct iovec;
51
53{
54public:
55
56//-----------------------------------------------------------------------------
58//-----------------------------------------------------------------------------
59
60static
62 XrdLink *linkP,
63 XrdSecEntity *seceP,
64 const char *nameP,
65 const char *protP
66 );
67
68//-----------------------------------------------------------------------------
70//-----------------------------------------------------------------------------
71
72static int Attn(XrdLink *lP, short *theSID, int rcode,
73 const struct iovec *ioVec, int ioNum, int ioLen);
74
75//-----------------------------------------------------------------------------
77//-----------------------------------------------------------------------------
78
79bool Disc();
80
81//-----------------------------------------------------------------------------
83//-----------------------------------------------------------------------------
84
85static void Init(XrdScheduler *schedP, int qMax, int qTTL);
86
87//-----------------------------------------------------------------------------
89//-----------------------------------------------------------------------------
90
91void Proceed();
92
93//-----------------------------------------------------------------------------
95//-----------------------------------------------------------------------------
96
97int Process(XrdLink *lp); // XrdProtocol override
98
99//-----------------------------------------------------------------------------
101//-----------------------------------------------------------------------------
102
103void Recycle(XrdLink *lp, int consec, const char *reason);
104
105//-----------------------------------------------------------------------------
107//-----------------------------------------------------------------------------
108
109void Redrive();
110
111//-----------------------------------------------------------------------------
113//-----------------------------------------------------------------------------
114
115static
116const char *ReqTable();
117
118//-----------------------------------------------------------------------------
120//-----------------------------------------------------------------------------
121
122bool Run(const char *xreqP,
123 char *xdataP=0,
124 int xdataL=0
125 );
126
127//-----------------------------------------------------------------------------
129//-----------------------------------------------------------------------------
130
131int Send(int rcode, const struct iovec *ioVec, int ioNum, int ioLen);
132
133//-----------------------------------------------------------------------------
135//-----------------------------------------------------------------------------
136
137int Send(long long offset, int dlen, int fdnum);
138
139int Send(XrdOucSFVec *sfvec, int sfvnum, int dlen);
140
141//-----------------------------------------------------------------------------
143//-----------------------------------------------------------------------------
144
145int setSF(kXR_char *fhandle, bool seton=false)
146 {return SetSF(fhandle, seton);}
147
148//-----------------------------------------------------------------------------
150//-----------------------------------------------------------------------------
151
152void SetWait(int wtime, bool notify=false)
153 {runWMax = wtime; runWCall = notify;}
154
155//-----------------------------------------------------------------------------
157//-----------------------------------------------------------------------------
158
161 "Transit proceed"),
163 "Transit redrive")
164 {}
166
167private:
168int AttnCont(XrdXrootdTransPend *tP, int rcode,
169 const struct iovec *ioV, int ioN, int ioL);
170bool Fail(int ecode, const char *etext);
171int Fatal(int rc);
172void Init(Result *rsltP, XrdLink *linkP, XrdSecEntity *seceP,
173 const char *nameP, const char *protP
174 );
175bool ReqWrite(char *xdataP, int xdataL);
176bool RunCopy(char *buffP, int buffL);
178 const struct iovec *ioV, int ioN, int ioL);
180 const struct iovec *ioV, int ioN, int ioL);
181
182class SchedReq : public XrdJob
183 {public:
184 typedef void (XrdXrootdTransit::*callbackFP)();
185 void DoIt() {(spanP->*cbFunc)();}
186
187 SchedReq(XrdXrootdTransit *tP, callbackFP cbP, const char *why)
188 : XrdJob(why), spanP(tP), cbFunc(cbP) {}
190 private:
193 };
194
197
201static const char *reqTab;
204const char *runEText;
217char *wBuff;
218const char *pName;
219time_t cTime;
220};
221#endif
unsigned char kXR_char
Definition XPtypes.hh:65
Definition XrdJob.hh:43
Definition XrdObject.hh:90
Definition XrdObject.hh:52
Definition XrdProtocol.hh:125
Definition XrdScheduler.hh:46
Definition XrdSecEntity.hh:65
Definition XrdSysPthread.hh:165
Definition XrdXrootdProtocol.hh:156
int SetSF(kXR_char *fhandle, bool seton=false)
Definition XrdXrootdTransPend.hh:43
Definition XrdXrootdTransit.hh:183
~SchedReq()
Definition XrdXrootdTransit.hh:189
void DoIt()
Definition XrdXrootdTransit.hh:185
SchedReq(XrdXrootdTransit *tP, callbackFP cbP, const char *why)
Definition XrdXrootdTransit.hh:187
void(XrdXrootdTransit::* callbackFP)()
Definition XrdXrootdTransit.hh:184
XrdXrootdTransit * spanP
Definition XrdXrootdTransit.hh:191
callbackFP cbFunc
Definition XrdXrootdTransit.hh:192
Definition XrdXrootdTransit.hh:53
int Send(long long offset, int dlen, int fdnum)
Handle request sendfile response.
bool Run(const char *xreqP, char *xdataP=0, int xdataL=0)
Inject an xrootd request into the protocol stack.
bool runDone
Definition XrdXrootdTransit.hh:213
int Wait(XrdXrootd::Bridge::Context &rInfo, const struct iovec *ioV, int ioN, int ioL)
bool Fail(int ecode, const char *etext)
void Redrive()
Redrive a request after a wait.
int runALen
Definition XrdXrootdTransit.hh:206
static void Init(XrdScheduler *schedP, int qMax, int qTTL)
Perform one-time initialization.
XrdXrootd::Bridge::Result * respObj
Definition XrdXrootdTransit.hh:203
time_t cTime
Definition XrdXrootdTransit.hh:219
int runError
Definition XrdXrootdTransit.hh:208
int runStatus
Definition XrdXrootdTransit.hh:209
int Send(int rcode, const struct iovec *ioVec, int ioNum, int ioLen)
Handle request data response.
bool ReqWrite(char *xdataP, int xdataL)
int runABsz
Definition XrdXrootdTransit.hh:207
XrdSysMutex runMutex
Definition XrdXrootdTransit.hh:200
void Init(Result *rsltP, XrdLink *linkP, XrdSecEntity *seceP, const char *nameP, const char *protP)
int WaitResp(XrdXrootd::Bridge::Context &rInfo, const struct iovec *ioV, int ioN, int ioL)
bool reInvoke
Definition XrdXrootdTransit.hh:214
void Recycle(XrdLink *lp, int consec, const char *reason)
Handle link shutdown.
int runWMax
Definition XrdXrootdTransit.hh:212
int setSF(kXR_char *fhandle, bool seton=false)
Set sendfile() enablement.
Definition XrdXrootdTransit.hh:145
SchedReq respJob
Definition XrdXrootdTransit.hh:198
static XrdObjectQ< XrdXrootdTransit > TranStack
Definition XrdXrootdTransit.hh:195
static int Attn(XrdLink *lP, short *theSID, int rcode, const struct iovec *ioVec, int ioNum, int ioLen)
Handle attention response (i.e. async response)
static const char * ReqTable()
Initialize the valid request table.
virtual ~XrdXrootdTransit()
Definition XrdXrootdTransit.hh:165
bool runWCall
Definition XrdXrootdTransit.hh:215
const char * runEText
Definition XrdXrootdTransit.hh:204
XrdObject< XrdXrootdTransit > TranLink
Definition XrdXrootdTransit.hh:196
char * wBuff
Definition XrdXrootdTransit.hh:217
void SetWait(int wtime, bool notify=false)
Set maximum wait time.
Definition XrdXrootdTransit.hh:152
XrdProtocol * realProt
Definition XrdXrootdTransit.hh:202
int AttnCont(XrdXrootdTransPend *tP, int rcode, const struct iovec *ioV, int ioN, int ioL)
char * runArgs
Definition XrdXrootdTransit.hh:205
XrdXrootdTransit()
Constructor & Destructor.
Definition XrdXrootdTransit.hh:159
bool RunCopy(char *buffP, int buffL)
void Proceed()
Resume processing after a waitresp completion.
int runWTot
Definition XrdXrootdTransit.hh:211
int wBLen
Definition XrdXrootdTransit.hh:216
int runWait
Definition XrdXrootdTransit.hh:210
bool Disc()
Handle dismantlement.
int Send(XrdOucSFVec *sfvec, int sfvnum, int dlen)
int Fatal(int rc)
static XrdXrootdTransit * Alloc(XrdXrootd::Bridge::Result *respP, XrdLink *linkP, XrdSecEntity *seceP, const char *nameP, const char *protP)
Get a new transit object.
static const char * reqTab
Definition XrdXrootdTransit.hh:201
int Process(XrdLink *lp)
Handle link activation (replaces parent activation).
SchedReq waitJob
Definition XrdXrootdTransit.hh:199
const char * pName
Definition XrdXrootdTransit.hh:218
Definition XrdXrootdBridge.hh:226
Definition XrdXrootdBridge.hh:294
Definition XrdXrootdBridge.hh:62
Definition XrdOucSFVec.hh:43