XRootD
Loading...
Searching...
No Matches
XrdXrootdTransit.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d X r o o t d T r a n s i t . c c */
4/* */
5/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* All Rights Reserved */
7/* Produced by Andrew Hanushevsky for Stanford University under contract */
8/* DE-AC02-76-SFO0515 with the Department of Energy */
9/* */
10/* This file is part of the XRootD software suite. */
11/* */
12/* XRootD is free software: you can redistribute it and/or modify it under */
13/* the terms of the GNU Lesser General Public License as published by the */
14/* Free Software Foundation, either version 3 of the License, or (at your */
15/* option) any later version. */
16/* */
17/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20/* License for more details. */
21/* */
22/* You should have received a copy of the GNU Lesser General Public License */
23/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25/* */
26/* The copyright holder's institutional names and contributor's names may not */
27/* be used to endorse or promote products derived from this software without */
28/* specific prior written permission of the institution or contributor. */
29/******************************************************************************/
30
31#include <cstring>
32#include <unistd.h>
33#include <sys/uio.h>
34
36
38
39#include "Xrd/XrdBuffer.hh"
40#include "Xrd/XrdLink.hh"
42#include "XrdOuc/XrdOucUtils.hh"
50
51/******************************************************************************/
52/* C l o b a l S y m b o l s */
53/******************************************************************************/
54
56
57#undef TRACELINK
58#define TRACELINK Link
59
60#define XRD_GETNUM(x)\
61 ntohl(*(static_cast<unsigned int *>(static_cast<void *>(x))))
62
63/******************************************************************************/
64/* S t a t i c M e m b e r s */
65/******************************************************************************/
66
67const char *XrdXrootdTransit::reqTab = XrdXrootdTransit::ReqTable();
68
70 XrdXrootdTransit::TranStack("TranStack",
71 "transit protocol anchor");
72
73/******************************************************************************/
74/* A l l o c */
75/******************************************************************************/
76
78 XrdLink *linkP,
79 XrdSecEntity *seceP,
80 const char *nameP,
81 const char *protP
82 )
83{
85
86// Simply return a new transit object masquerading as a bridge
87//
88 if (!(xp = TranStack.Pop())) xp = new XrdXrootdTransit();
89 xp->Init(rsltP, linkP, seceP, nameP, protP);
90 return xp;
91}
92
93/******************************************************************************/
94/* A t t n */
95/******************************************************************************/
96
97int XrdXrootdTransit::Attn(XrdLink *lP, short *theSID, int rcode,
98 const struct iovec *ioV, int ioN, int ioL)
99{
101
102// Find the request
103//
104 if (!(tP = XrdXrootdTransPend::Remove(lP, *theSID)))
105 {TRACE(REQ, "Unable to find request for " <<lP->ID <<" sid=" <<*theSID);
106 return 0;
107 }
108
109// Resume the request as we have been waiting for the response.
110//
111 return tP->bridge->AttnCont(tP, rcode, ioV, ioN, ioL);
112}
113
114/******************************************************************************/
115/* A t t n C o n t */
116/******************************************************************************/
117
118int XrdXrootdTransit::AttnCont(XrdXrootdTransPend *tP, int rcode,
119 const struct iovec *ioV, int ioN, int ioL)
120{
121 int rc;
122
123// Refresh the request structure
124//
125 memcpy(&Request, &(tP->Pend.Request), sizeof(Request));
126 delete tP;
127 runWait = 0;
128
129// Reissue the request if it's a wait 0 response.
130//
131 if (rcode==kXR_wait
132 && (!ioN || XRD_GETNUM(ioV[0].iov_base) == 0))
133 {Sched->Schedule((XrdJob *)&waitJob);
134 return 0;
135 }
136
137// Send off the deferred response
138//
139 rc = Send(rcode, ioV, ioN, ioL);
140
141// Handle end based on current state
142//
143 if (rc >= 0 && !runWait)
144 {if (runDone)
145 {AtomicBeg(runMutex);
146 AtomicZAP(runStatus);
147 AtomicEnd(runMutex);
148 }
149 if (reInvoke) Sched->Schedule((XrdJob *)&respJob);
150 else Link->Enable();
151 }
152
153// All done
154//
155 return rc;
156}
157
158/******************************************************************************/
159/* D i s c */
160/******************************************************************************/
161
163{
164 char buff[128];
165 int rc;
166
167// We do not allow disconnection while we are active
168//
169 AtomicBeg(runMutex);
170 rc = AtomicInc(runStatus);
171 AtomicEnd(runMutex);
172 if (rc) return false;
173
174// Reconnect original protocol to the link
175//
176 Link->setProtocol(realProt);
177
178// Now we need to recycle our xrootd part
179//
180 sprintf(buff, "%s disconnection", pName);
181 XrdXrootdProtocol::Recycle(Link, time(0)-cTime, buff);
182
183// Now just free up our object.
184//
185 TranStack.Push(&TranLink);
186 return true;
187}
188
189/******************************************************************************/
190/* Private: F a i l */
191/******************************************************************************/
192
193bool XrdXrootdTransit::Fail(int ecode, const char *etext)
194{
195 runError = ecode;
196 runEText = etext;
197 return true;
198}
199
200/******************************************************************************/
201/* F a t a l */
202/******************************************************************************/
203
204int XrdXrootdTransit::Fatal(int rc)
205{
208
209 return (respObj->Error(rInfo, runError, runEText) ? rc : -1);
210}
211
212/******************************************************************************/
213/* I n i t */
214/******************************************************************************/
215
216void XrdXrootdTransit::Init(XrdScheduler *schedP, int qMax, int qTTL)
217{
218 TranStack.Set(schedP, &XrdXrootdTrace, TRACE_MEM);
219 TranStack.Set(qMax, qTTL);
220}
221
222/******************************************************************************/
223
225 XrdLink *linkP,
226 XrdSecEntity *seceP,
227 const char *nameP,
228 const char *protP
229 )
230{
231 XrdNetAddrInfo *addrP;
232 const char *who;
233 char uname[sizeof(Request.login.username)+1];
234
235// Set standard stuff
236//
237 runArgs = 0;
238 runALen = 0;
239 runABsz = 0;
240 runError = 0;
241 runStatus = 0;
242 runWait = 0;
243 runWTot = 0;
244 runWMax = 3600;
245 runWCall = false;
246 runDone = false;
247 reInvoke = false;
248 wBuff = 0;
249 wBLen = 0;
250 respObj = respP;
251 pName = protP;
252 mySID = getSID();
253
254// Bind the protocol to the link
255//
256 SI->Bump(SI->Count);
257 Link = linkP;
258 Response.Set(linkP);
259 Response.Set(this);
260 strcpy(Entity.prot, "host");
261 Entity.host = (char *)linkP->Host();
262
263// Develop a trace identifier
264//
265 strncpy(uname, nameP, sizeof(uname)-1);
266 uname[sizeof(uname)-1] = 0;
268 linkP->setID(uname, mySID);
269
270// Place trace identifier everywhere is should be located
271
272// Indicate that this brige supports asynchronous responses
273//
275
276// Mark the client as IPv4 if they came in as IPv4 or mapped IPv4. Note
277// there is no way we can figure out if this is a dual-stack client.
278//
279 addrP = Link->AddrInfo();
280 if (addrP->isIPType(XrdNetAddrInfo::IPv4) || addrP->isMapped())
282
283// Mark the client as being on a private net if the address is private
284//
285 if (addrP->isPrivate()) {clientPV |= XrdOucEI::uPrip; rdType = 1;}
286 else rdType = 0;
287
288// Now tie the security information
289//
290 Client = (seceP ? seceP : &Entity);
291 Client->ueid = mySID;
293 Client->addrInfo = addrP;
294
295// Allocate a monitoring object, if needed for this connection and record login
296//
297 if (Monitor.Ready())
298 {Monitor.Register(linkP->ID, linkP->Host(), protP);
299 if (Monitor.Logins())
300 {if (Monitor.Auths() && seceP) MonAuth();
301 else Monitor.Report(Monitor.Auths() ? "" : 0);
302 }
303 }
304
305// Complete the request ID object
306//
307 ReqID.setID(Request.header.streamid, linkP->FDnum(), linkP->Inst());
308
309// Substitute our protocol for the existing one
310//
311 realProt = linkP->setProtocol(this);
312 linkP->setProtName(protP);
313 linkP->armBridge();
314
315// Document this login
316//
317 who = (seceP && seceP->name ? seceP->name : "nobody");
318 eDest.Log(SYS_LOG_01, "Bridge", Link->ID, "login as", who);
319
320// All done, indicate we are logged in
321//
323 cTime = time(0);
324
325// Propogate a connect through the whole system
326//
328}
329
330/******************************************************************************/
331/* P r o c e e d */
332/******************************************************************************/
333
335{
336 int rc;
337
338// If we were interrupted in a reinvoke state, resume that state.
339//
340 if (reInvoke) rc = Process(Link);
341 else rc = 0;
342
343// Handle ending status
344//
345 if (rc >= 0) Link->Enable();
346 else if (rc != -EINPROGRESS) Link->Close();
347}
348
349/******************************************************************************/
350/* P r o c e s s */
351/******************************************************************************/
352
354{
355 int rc;
356
357// This entry is serialized via link processing and data is now available.
358// One of the following will be returned.
359//
360// < 0 -> Stop getting requests,
361// -EINPROGRESS leave link disabled but otherwise all is well
362// -n Error, disable and close the link
363// = 0 -> OK, get next request, if allowed, o/w enable the link
364// > 0 -> Slow link, stop getting requests and enable the link
365//
366
367// Reflect data is present to the underlying protocol and if Run() has been
368// called we need to dispatch that request. This may be iterative.
369//
370do{rc = realProt->Process((reInvoke ? 0 : lp));
371 if (rc >= 0 && runStatus)
372 {reInvoke = (rc == 0);
373 if (runError) rc = Fatal(rc);
374 else {runDone = false;
376 if (rc >= 0)
377 {if (runWait) rc = -EINPROGRESS;
378 if (!runDone) return rc;
379 AtomicBeg(runMutex);
380 AtomicZAP(runStatus);
381 AtomicEnd(runMutex);
382 }
383 }
384 } else reInvoke = false;
385 } while(rc >= 0 && reInvoke);
386
387// Make sure that we indicate that we are no longer active
388//
389 if (runStatus)
390 {AtomicBeg(runMutex);
391 AtomicZAP(runStatus);
392 AtomicEnd(runMutex);
393 }
394
395// All done
396//
397 return (rc ? rc : 1);
398}
399
400/******************************************************************************/
401/* R e c y c l e */
402/******************************************************************************/
403
404void XrdXrootdTransit::Recycle(XrdLink *lp, int consec, const char *reason)
405{
406
407// Set ourselves as active so we can't get more requests
408//
409 AtomicBeg(runMutex);
410 AtomicInc(runStatus);
411 AtomicEnd(runMutex);
412
413// If we were active then we will need to quiesce before dismantling ourselves.
414// Note that Recycle() can only be called if the link is enabled. So, this bit
415// of code is improbable but we check it anyway.
416//
417 if (runWait > 0) Sched->Cancel(&waitJob);
418
419// First we need to recycle the real protocol
420//
421 if (realProt) realProt->Recycle(lp, consec, reason);
422
423// Now we need to recycle our xrootd part
424//
425 XrdXrootdProtocol::Recycle(lp, consec, reason);
426
427// Release the argument buffer
428//
429 if (runArgs) {free(runArgs); runArgs = 0;}
430
431// Delete all pending requests
432//
434
435// Now just free up our object.
436//
437 TranStack.Push(&TranLink);
438}
439
440/******************************************************************************/
441/* R e d r i v e */
442/******************************************************************************/
443
445{
446 static int eCode = htonl(kXR_NoMemory);
447 static char eText[] = "Insufficent memory to re-issue request";
448 static struct iovec ioV[] = {{(char *)&eCode,sizeof(eCode)},
449 {(char *)&eText,sizeof(eText)}};
450 int rc;
451
452// Update wait statistics
453//
454 runWTot += runWait;
455 runWait = 0;
456
457// While we are running asynchronously, there is no way that this object can
458// be deleted while a timer is outstanding as the link has been disabled. So,
459// we can reissue the request with little worry.
460//
461 if (!runALen || RunCopy(runArgs, runALen)) {
462 do{rc = Process2();
463 if (rc == 0) {
464 rc = realProt->Process(NULL);
465 }
466 } while((rc == 0) && !runError && !runWait);
467 }
468 else rc = Send(kXR_error, ioV, 2, 0);
469
470// Defer the request if need be
471//
472 if (rc >= 0 && runWait) return;
473 runWTot = 0;
474
475// Indicate we are no longer active
476//
477 if (runStatus)
478 {AtomicBeg(runMutex);
479 AtomicZAP(runStatus);
480 AtomicEnd(runMutex);
481 }
482
483// If the link needs to be terminated, terminate the link. Otherwise, we can
484// enable the link for new requests at this point.
485//
486 if (rc < 0) Link->Close();
487 else Link->Enable();
488}
489
490/******************************************************************************/
491/* R e q T a b l e */
492/******************************************************************************/
493
494#define KXR_INDEX(x) x-kXR_auth
495
497{
498 static char rTab[kXR_truncate-kXR_auth+1];
499
500// Initialize the table
501//
502 memset(rTab, 0, sizeof(rTab));
503 rTab[KXR_INDEX(kXR_chmod)] = 1;
504 rTab[KXR_INDEX(kXR_close)] = 1;
505 rTab[KXR_INDEX(kXR_dirlist)] = 1;
506 rTab[KXR_INDEX(kXR_locate)] = 1;
507 rTab[KXR_INDEX(kXR_mkdir)] = 1;
508 rTab[KXR_INDEX(kXR_mv)] = 1;
509 rTab[KXR_INDEX(kXR_open)] = 1;
510 rTab[KXR_INDEX(kXR_prepare)] = 1;
511 rTab[KXR_INDEX(kXR_protocol)] = 1;
512 rTab[KXR_INDEX(kXR_query)] = 1;
513 rTab[KXR_INDEX(kXR_read)] = 2;
514 rTab[KXR_INDEX(kXR_readv)] = 2;
515 rTab[KXR_INDEX(kXR_rm)] = 1;
516 rTab[KXR_INDEX(kXR_rmdir)] = 1;
517 rTab[KXR_INDEX(kXR_set)] = 1;
518 rTab[KXR_INDEX(kXR_stat)] = 1;
519 rTab[KXR_INDEX(kXR_statx)] = 1;
520 rTab[KXR_INDEX(kXR_sync)] = 1;
521 rTab[KXR_INDEX(kXR_truncate)] = 1;
522 rTab[KXR_INDEX(kXR_write)] = 2;
523
524// Now return the address
525//
526 return rTab;
527}
528
529/******************************************************************************/
530/* Private: R e q W r i t e */
531/******************************************************************************/
532
533bool XrdXrootdTransit::ReqWrite(char *xdataP, int xdataL)
534{
535
536// Make sure we always transit to the resume point
537//
538 myBlen = 0;
539
540// If nothing was read, then this is a straight-up write
541//
542 if (!xdataL || !xdataP || !Request.header.dlen)
543 {Resume = 0; wBuff = xdataP; wBLen = xdataL;
544 return true;
545 }
546
547// Partial data was read, we may have to split this between a direct write
548// and a network read/write -- somewhat complicated.
549//
550 myBuff = wBuff = xdataP;
551 myBlast = wBLen = xdataL;
553 return true;
554}
555
556/******************************************************************************/
557/* R u n */
558/******************************************************************************/
559
560bool XrdXrootdTransit::Run(const char *xreqP, char *xdataP, int xdataL)
561{
562 int movLen, rc;
563
564// We do not allow re-entry if we are curently processing a request.
565// It will be reset, as need, when a response is effected.
566//
567 AtomicBeg(runMutex);
568 rc = AtomicInc(runStatus);
569 AtomicEnd(runMutex);
570 if (rc) return false;
571
572// Copy the request header
573//
574 memcpy((void *)&Request, (void *)xreqP, sizeof(Request));
575
576// Validate that we can actually handle this request
577//
579 if (Request.header.requestid & 0x8000
581 || !reqTab[Request.header.requestid - kXR_auth])
582 return Fail(kXR_Unsupported, "Unsupported bridge request");
583
584// Validate the data length
585//
587 if (Request.header.dlen < 0)
588 return Fail(kXR_ArgInvalid, "Invalid request data length");
589
590// Copy the stream id and trace this request
591//
593 TRACEP(REQ, "Bridge req=" <<Request.header.requestid
594 <<" dlen=" <<Request.header.dlen <<" blen=" <<xdataL);
595
596// If this is a write request, we will need to do a lot more
597//
598 if (Request.header.requestid == kXR_write) return ReqWrite(xdataP, xdataL);
599
600// Obtain any needed buffer and handle any existing data arguments. Also, we
601// need to keep a shadow copy of the request arguments should we get a wait
602// and will need to re-issue the request (the server mangles the args).
603//
604 if (Request.header.dlen)
605 {movLen = (xdataL < Request.header.dlen ? xdataL : Request.header.dlen);
606 if (!RunCopy(xdataP, movLen)) return true;
607 if (!runArgs || movLen > runABsz)
608 {if (runArgs) free(runArgs);
609 if (!(runArgs = (char *)malloc(movLen)))
610 return Fail(kXR_NoMemory, "Insufficient memory");
611 runABsz = movLen;
612 }
613 memcpy(runArgs, xdataP, movLen); runALen = movLen;
614 if ((myBlen = Request.header.dlen - movLen))
615 {myBuff = argp->buff + movLen;
617 return true;
618 }
619 } else runALen = 0;
620
621// If we have all the data, indicate request accepted.
622//
623 runError = 0;
624 Resume = 0;
625 return true;
626}
627
628/******************************************************************************/
629/* Privae: R u n C o p y */
630/******************************************************************************/
631
632bool XrdXrootdTransit::RunCopy(char *buffP, int buffL)
633{
634
635// Allocate a buffer if we do not have one or it is too small
636//
637 if (!argp || Request.header.dlen+1 > argp->bsize)
638 {if (argp) BPool->Release(argp);
639 if (!(argp = BPool->Obtain(Request.header.dlen+1)))
640 {Fail(kXR_ArgTooLong, "Request argument too long"); return false;}
641 hcNow = hcPrev; halfBSize = argp->bsize >> 1;
642 }
643
644// Copy the arguments to the buffer
645//
646 memcpy(argp->buff, buffP, buffL);
647 argp->buff[buffL] = 0;
648 return true;
649}
650
651/******************************************************************************/
652/* S e n d */
653/******************************************************************************/
654
655int XrdXrootdTransit::Send(int rcode, const struct iovec *ioV, int ioN, int ioL)
656{
659 const char *eMsg;
660 int rc;
661 bool aOK;
662
663// Invoke the result object (we initially assume this is the final result)
664//
665 runDone = true;
666 switch(rcode)
667 {case kXR_error:
668 rc = XRD_GETNUM(ioV[0].iov_base);
669 eMsg = (ioN < 2 ? "" : (const char *)ioV[1].iov_base);
670 if (wBuff) respObj->Free(rInfo, wBuff, wBLen);
671 aOK = respObj->Error(rInfo, rc, eMsg);
672 break;
673 case kXR_ok:
674 if (wBuff) respObj->Free(rInfo, wBuff, wBLen);
675 aOK = (ioN ? respObj->Data(rInfo, ioV, ioN, ioL, true)
676 : respObj->Done(rInfo));
677 break;
678 case kXR_oksofar:
679 aOK = respObj->Data(rInfo, ioV, ioN, ioL, false);
680 runDone = false;
681 break;
682 case kXR_redirect:
683 if (wBuff) respObj->Free(rInfo, wBuff, wBLen);
684 rc = XRD_GETNUM(ioV[0].iov_base);
685 aOK = respObj->Redir(rInfo,rc,(const char *)ioV[1].iov_base);
686 break;
687 case kXR_wait:
688 return Wait(rInfo, ioV, ioN, ioL);
689 break;
690 case kXR_waitresp:
691 runDone = false;
692 return WaitResp(rInfo, ioV, ioN, ioL);
693 break;
694 default: if (wBuff) respObj->Free(rInfo, wBuff, wBLen);
695 aOK = respObj->Error(rInfo, kXR_ServerError,
696 "internal logic error");
697 break;
698 };
699
700// All done
701//
702 return (aOK ? 0 : -1);
703}
704
705/******************************************************************************/
706
707int XrdXrootdTransit::Send(long long offset, int dlen, int fdnum)
708{
711 offset, dlen, fdnum);
712
713// Effect callback (this is always a final result)
714//
715 runDone = true;
716 return (respObj->File(sfInfo, dlen) ? 0 : -1);
717}
718
719/******************************************************************************/
720
721int XrdXrootdTransit::Send(XrdOucSFVec *sfvec, int sfvnum, int dlen)
722{
725 sfvec, sfvnum, dlen);
726
727// Effect callback (this is always a final result)
728//
729 runDone = true;
730 return (respObj->File(sfInfo, dlen) ? 0 : -1);
731}
732
733/******************************************************************************/
734/* Private: W a i t */
735/******************************************************************************/
736
737int XrdXrootdTransit::Wait(XrdXrootd::Bridge::Context &rInfo,
738 const struct iovec *ioV, int ioN, int ioL)
739{
740 const char *eMsg;
741
742// Trace this request if need be
743//
744 runWait = XRD_GETNUM(ioV[0].iov_base);
745 eMsg = (ioN < 2 ? "reason unknown" : (const char *)ioV[1].iov_base);
746
747// Check if the protocol wants to handle all waits
748//
749 if (runWMax <= 0)
750 {int wtime = runWait;
751 runWait = 0;
752 return (respObj->Wait(rInfo, wtime, eMsg) ? 0 : -1);
753 }
754
755// Check if we have exceeded the maximum wait time
756//
757 if (runWTot >= runWMax)
758 {runDone = true;
759 runWait = 0;
760 return (respObj->Error(rInfo, kXR_Cancelled, eMsg) ? 0 : -1);
761 }
762
763// Readjust wait time
764//
765 if (runWait > runWMax) runWait = runWMax;
766
767// Check if the protocol wants a wait notification
768//
769 if (runWCall && !(respObj->Wait(rInfo, runWait, eMsg))) return -1;
770
771// All done, schedule the wait
772//
773 TRACEP(REQ, "Bridge delaying request " <<runWait <<" sec (" <<eMsg <<")");
774 Sched->Schedule((XrdJob *)&waitJob, time(0)+runWait);
775 return 0;
776}
777
778/******************************************************************************/
779/* Private: W a i t R e s p */
780/******************************************************************************/
781
782int XrdXrootdTransit::WaitResp(XrdXrootd::Bridge::Context &rInfo,
783 const struct iovec *ioV, int ioN, int ioL)
784{
786 const char *eMsg;
787 int wTime;
788
789// Trace this request if need be
790//
791 wTime = XRD_GETNUM(ioV[0].iov_base);
792 eMsg = (ioN < 2 ? "reason unknown" : (const char *)ioV[1].iov_base);
793 TRACEP(REQ, "Bridge waiting for resp; sid=" <<rInfo.sID.num
794 <<" wt=" <<wTime <<" (" <<eMsg <<")");
795
796// We would issue callback to see how we should handle this. However, we can't
797// predictably handle a waitresp. So that means we will just wait for a resp.
798//
799// XrdXrootd::Bridge::Result *newCBP = respObj->WaitResp(rInfo, runWait, eMsg);
800
801// Save the current state
802//
803 trP = new XrdXrootdTransPend(Link, this, &Request);
804 trP->Queue();
805
806// Effect a wait
807//
808 runWait = -1;
809 return 0;
810}
@ kXR_ArgInvalid
Definition XProtocol.hh:990
@ kXR_Unsupported
@ kXR_Cancelled
@ kXR_ServerError
@ kXR_ArgTooLong
Definition XProtocol.hh:992
@ kXR_NoMemory
Definition XProtocol.hh:998
kXR_char streamid[2]
Definition XProtocol.hh:156
kXR_char username[8]
Definition XProtocol.hh:396
@ kXR_waitresp
Definition XProtocol.hh:906
@ kXR_redirect
Definition XProtocol.hh:904
@ kXR_oksofar
Definition XProtocol.hh:900
@ kXR_ok
Definition XProtocol.hh:899
@ kXR_wait
Definition XProtocol.hh:905
@ kXR_error
Definition XProtocol.hh:903
struct ClientRequestHdr header
Definition XProtocol.hh:846
struct ClientLoginRequest login
Definition XProtocol.hh:857
kXR_unt16 requestid
Definition XProtocol.hh:157
@ kXR_read
Definition XProtocol.hh:125
@ kXR_open
Definition XProtocol.hh:122
@ kXR_readv
Definition XProtocol.hh:137
@ kXR_mkdir
Definition XProtocol.hh:120
@ kXR_sync
Definition XProtocol.hh:128
@ kXR_chmod
Definition XProtocol.hh:114
@ kXR_dirlist
Definition XProtocol.hh:116
@ kXR_rm
Definition XProtocol.hh:126
@ kXR_query
Definition XProtocol.hh:113
@ kXR_write
Definition XProtocol.hh:131
@ kXR_auth
Definition XProtocol.hh:112
@ kXR_set
Definition XProtocol.hh:130
@ kXR_rmdir
Definition XProtocol.hh:127
@ kXR_statx
Definition XProtocol.hh:134
@ kXR_truncate
Definition XProtocol.hh:140
@ kXR_protocol
Definition XProtocol.hh:118
@ kXR_mv
Definition XProtocol.hh:121
@ kXR_stat
Definition XProtocol.hh:129
@ kXR_locate
Definition XProtocol.hh:139
@ kXR_close
Definition XProtocol.hh:115
@ kXR_prepare
Definition XProtocol.hh:133
@ kXR_asyncap
Definition XProtocol.hh:378
@ kXR_ver002
Definition XProtocol.hh:386
unsigned short kXR_unt16
Definition XPtypes.hh:67
XrdOucTrace * XrdXrootdTrace
#define eMsg(x)
#define AtomicInc(x)
#define AtomicBeg(Mtx)
#define AtomicZAP(x)
#define AtomicEnd(Mtx)
const int SYS_LOG_01
#define TRACE_MEM
Definition XrdTrace.hh:38
#define TRACE(act, x)
Definition XrdTrace.hh:63
#define XRD_LOGGEDIN
#define TRACEP(act, x)
XrdSysTrace XrdXrootdTrace
#define XRD_GETNUM(x)
#define KXR_INDEX(x)
void Release(XrdBuffer *bp)
Definition XrdBuffer.cc:221
XrdBuffer * Obtain(int bsz)
Definition XrdBuffer.cc:140
char * buff
Definition XrdBuffer.hh:45
bool isMapped() const
bool isIPType(IPType ipType) const
void Set(int inQMax, time_t agemax=1800)
Definition XrdObject.icc:90
void Push(XrdObject< T > *Node)
Definition XrdObject.hh:101
T * Pop()
Definition XrdObject.hh:93
void Bump(int &val)
static void Sanitize(char *instr, char subc='_')
virtual void Recycle(XrdLink *lp=0, int consec=0, const char *reason=0)=0
virtual int Process(XrdLink *lp)=0
void Schedule(XrdJob *jp)
void Cancel(XrdJob *jp)
const char * pident
Trace identifier (originator)
XrdNetAddrInfo * addrInfo
Entity's connection details.
const char * tident
Trace identifier always preset.
char prot[XrdSecPROTOIDSIZE]
Auth protocol used (e.g. krb5)
char * name
Entity's name.
unsigned int ueid
Unique ID of entity instance.
char * host
Entity's host name dnr dependent.
virtual void Connect(const XrdSecEntity *client=0)
void Log(int mask, const char *esfx, const char *text1, const char *text2=0, const char *text3=0)
void Register(const char *Uname, const char *Hname, const char *Pname, unsigned int xSID=0)
void Report(const char *Info)
static XrdXrootdStats * SI
static XrdSysError & eDest
static unsigned int getSID()
XrdXrootdMonitor::User Monitor
int(XrdXrootdProtocol::* Resume)()
static XrdScheduler * Sched
int Process(XrdLink *lp) override
void Recycle(XrdLink *lp, int consec, const char *reason) override
XrdXrootdResponse Response
static XrdBuffManager * BPool
static XrdSfsFileSystem * osFS
void setID(unsigned long long id)
void Set(XrdLink *lp)
static XrdXrootdTransPend * Remove(XrdLink *lP, short sid)
union XrdXrootdTransPend::@181 Pend
XrdXrootdTransit * bridge
static void Clear(XrdXrootdTransit *trP)
bool Run(const char *xreqP, char *xdataP=0, int xdataL=0)
Inject an xrootd request into the protocol stack.
static const char * ReqTable()
Initialize the valid request table.
void Redrive()
Redrive a request after a wait.
int Send(int rcode, const struct iovec *ioVec, int ioNum, int ioLen)
Handle request data response.
void Recycle(XrdLink *lp, int consec, const char *reason)
Handle link shutdown.
static void Init(XrdScheduler *schedP, int qMax, int qTTL)
Perform one-time initialization.
static XrdXrootdTransit * Alloc(XrdXrootd::Bridge::Result *respP, XrdLink *linkP, XrdSecEntity *seceP, const char *nameP, const char *protP)
Get a new transit object.
static int Attn(XrdLink *lP, short *theSID, int rcode, const struct iovec *ioVec, int ioNum, int ioLen)
Handle attention response (i.e. async response)
XrdXrootdTransit()
Constructor & Destructor.
void Proceed()
Resume processing after a waitresp completion.
bool Disc()
Handle dismantlement.
int Process(XrdLink *lp)
Handle link activation (replaces parent activation).
union XrdXrootd::Bridge::Context::@162 sID
associated request stream ID
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
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)
virtual void Free(Bridge::Context &info, char *buffP, int buffL)
static const int uIPv4
ucap: Supports read redirects
static const int uPrip