Logo ROOT  
Reference Guide
TXNetSystem.cxx
Go to the documentation of this file.
1// @(#)root/netx:$Id$
2// Author: Frank Winklmeier, Fabrizio Furano
3
4/*************************************************************************
5 * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13//////////////////////////////////////////////////////////////////////////
14// //
15// TXNetSystem //
16// //
17// Authors: Frank Winklmeier, Fabrizio Furano //
18// INFN Padova, 2005 //
19// //
20// TXNetSystem is an extension of TNetSystem able to deal with new //
21// xrootd servers. The class detects the nature of the server and //
22// redirects the calls to TNetSystem in case of a rootd server. //
23// //
24//////////////////////////////////////////////////////////////////////////
25
26#include "TEnv.h"
27#include "TFileStager.h"
28#include "TROOT.h"
29#include "TSocket.h"
30#include "TString.h"
31#include "TUrl.h"
32#include "TVirtualMutex.h"
33#include "TXNetFile.h"
34#include "TXNetSystem.h"
35
36#include "XrdOuc/XrdOucString.hh"
38#include "XrdClient/XrdClientAdmin.hh"
42#include "XProtocol/XProtocol.hh"
43
44#include "XrdProofdXrdVers.h"
45
46
47////////////////////////////////////////////////////////////////////////////////
48/// PluginManager creation function
49
50TSystem* ROOT_Plugin_TXNetSystem(const char *url, Bool_t owner) {
51 return new TXNetSystem(url, owner);
52}
53
54
56
61
63
64////////////////////////////////////////////////////////////////////////////////
65/// Create system management class without connecting to server.
66
67TXNetSystem::TXNetSystem(Bool_t owner) : TNetSystem(owner), fDirList(0)
68{
69 SetTitle("(x)rootd system administration");
72 fDir = "";
73 fDirp = 0;
74 fUrl = "";
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// Create system management class and connect to server specified by url.
79
80TXNetSystem::TXNetSystem(const char *url, Bool_t owner) : TNetSystem(owner), fDirList(0)
81{
82 SetTitle("(x)rootd system administration");
85 fDir = "";
86 fDirp = 0;
87 fUrl = url;
88
91
92 // Set debug level
93 EnvPutInt(NAME_DEBUG, gEnv->GetValue("XNet.Debug", -1));
94
95 // The first time do some global initialization
96 if (!fgInitDone)
98
99 // Fill in user, host, port
101
102 TXNetSystemConnectGuard cguard(this, url);
103 if (!cguard.IsValid() && !fIsRootd)
104 Error("TXNetSystem","fatal error: connection creation failed.");
105
106 return;
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// Init a connection to the server.
111/// Returns a pointer to the appropriate instance of XrdClientAdmin or 0
112/// in case of failure.
113
114XrdClientAdmin *TXNetSystem::Connect(const char *url)
115{
116 // We need a dummy filename after the server url to connect
117 TString dummy = url;
118 dummy += "/dummy";
119
120 XrdClientAdmin *cadm = TXNetSystem::GetClientAdmin(dummy);
121
122 if (!cadm) {
123 Error("Connect","fatal error: new object creation failed.");
124 return cadm;
125 }
126
127 // Do not block: restore old value after
129
130 // Try to connect to the server
131 gEnv->SetValue("XNet.FirstConnectMaxCnt", 1);
133 if (cadm->Connect()) {
136 } else {
138 if (fgRootdBC) {
139 Bool_t isRootd =
140 (cadm->GetClientConn()->GetServerType() == kSTRootd);
141 Int_t sd = cadm->GetClientConn()->GetOpenSockFD();
142 if (isRootd && sd > -1) {
143 //
144 // Create a TSocket on the open connection
145 TSocket *s = new TSocket(sd);
146
147 // We will clean it by ourselves
149 gROOT->GetListOfSockets()->Remove(s);
150
151 s->SetOption(kNoBlock, 0);
152
153 // Find out the remote protocol (send the client protocol first)
155 if (rproto < 0) {
156 Error("TXNetSystem", "getting protocol of the rootd server");
157 cadm = 0;
158 return 0;
159 }
160 // Finalize TSocket initialization
161 s->SetRemoteProtocol(rproto);
162 TUrl uut((cadm->GetClientConn()
163 ->GetCurrentUrl()).GetUrl().c_str());
164 TString uu;
165 TXNetFile::FormUrl(uut,uu);
166 if (gDebug > 2)
167 Info("Connect"," url: %s",uu.Data());
168
169 s->SetUrl(uu.Data());
170 s->SetService("rootd");
171 s->SetServType(TSocket::kROOTD);
172 //
173 // Now we can check if we can create a TNetFile on the
174 // open connection
175 if (rproto > 13) {
176 //
177 // Remote support for reuse of open connection
179 } else {
180 //
181 // Open connection has been closed because could
182 // not be reused; TNetSystem will open a new connection
184 }
185
186 // Type of server
187 fIsRootd = kTRUE;
188 cadm = 0;
189
190 } else {
191 Error("Connect", "some severe error occurred while opening"
192 " the connection at %s - exit", url);
193 if (cadm && cadm->LastServerError())
194 Printf(" '%s'", cadm->LastServerError()->errmsg);
195 else
196 Printf(" (error message not available)");
197 cadm = 0;
198 return cadm;
199 }
200 } else {
201 Error("Connect",
202 "while opening the connection at %s - exit", url);
203 cadm = 0;
204 return cadm;
205 }
206 }
207
208 return cadm;
209}
210
211////////////////////////////////////////////////////////////////////////////////
212/// One-time initialization of some communication variables for xrootd protocol
213
215{
216 // Init vars with default debug level -1, so we do not get warnings
218
219 // Only once
221
222 // Print the tag, if required (only once)
223 if (gEnv->GetValue("XNet.PrintTAG",0) == 1)
224 Info("TXNetFile","(C) 2005 SLAC TXNetSystem (eXtended TNetSystem) %s",
225 gROOT->GetVersion());
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Open a directory. Returns a non-zero pointer (with no special
230/// purpose) in case of success, 0 in case of error.
231
232void* TXNetSystem::OpenDirectory(const char* dir)
233{
234 if (fIsXRootd) {
235 // Check if the directory exists
236 TXNetSystemConnectGuard cg(this, dir);
237 if (cg.IsValid()) {
238 fUrl = dir;
239 // Extract the directory name
240 fDir = TUrl(dir).GetFile();
241 fDirp = (void*)&fDir; // serves as directory pointer
242
243 vecString dirs;
244 vecBool existDirs;
245 XrdOucString s(fDir.Data());
246 dirs.Push_back(s);
247 cg.ClientAdmin()->ExistDirs(dirs, existDirs);
248 cg.ClientAdmin()->GoBackToRedirector();
249 if (existDirs.GetSize()>0 && existDirs[0])
250 return fDirp;
251 else
252 cg.NotifyLastError();
253 }
254 return 0;
255 }
256
257 if (gDebug > 1)
258 Info("OpenDirectory", "calling TNetSystem::OpenDirectory");
259 return TNetSystem::OpenDirectory(dir); // for a rootd
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Free(Close) the directory referenced by dirp
264
266{
267 if (fIsXRootd) {
268 if (dirp != fDirp) {
269 Error("FreeDirectory","invalid directory pointer (%p, %p)", dirp, fDirp);
270 return;
271 }
272 fDir = "";
273 fDirp = 0;
274 fDirEntry = "";
275 if (fDirList) {
277 delete ((VecString_t*)fDirList);
278 fDirList = 0;
279 }
280 return;
281 }
282
283 if (gDebug > 1)
284 Info("FreeDirectory","calling TNetSystem::FreeDirectory");
285 return TNetSystem::FreeDirectory(dirp); // for a rootd
286}
287
288////////////////////////////////////////////////////////////////////////////////
289/// Create a directory. Return 0 on success, -1 otherwise.
290
292{
293 if (fIsXRootd) {
294 TXNetSystemConnectGuard cg(this, dir);
295 if (cg.IsValid()) {
296 // use default permissions 755 to create directory
297 Bool_t ok = cg.ClientAdmin()->Mkdir(TUrl(dir).GetFile(),7,5,5);
298 cg.ClientAdmin()->GoBackToRedirector();
299 if (ok) {
300 return 0;
301 } else {
302 cg.NotifyLastError();
303 return -1;
304 }
305 }
306 }
307
308 if (gDebug > 1)
309 Info("MakeDirectory","Calling TNetSystem::MakeDirectory");
310 return TNetSystem::MakeDirectory(dir); // for a rootd
311}
312
313////////////////////////////////////////////////////////////////////////////////
314/// Get directory entry for directory referenced by dirp.
315/// Returns 0 in case there are no more entries.
316
317const char* TXNetSystem::GetDirEntry(void *dirp)
318{
319 if (fIsXRootd) {
320 if (dirp != fDirp) {
321 Error("GetDirEntry","invalid directory pointer");
322 return 0;
323 }
324
325 // Only request new directory listing the first time called
326 if (!fDirList) {
328 if (cg.IsValid()) {
329 fDirList = new VecString_t;
330 Bool_t ok = cg.ClientAdmin()->DirList(fDir, *(VecString_t*)fDirList);
331 cg.ClientAdmin()->GoBackToRedirector();
332 if (!ok) {
333 cg.NotifyLastError();
334 delete (VecString_t*)fDirList;
335 fDirList = 0;
336 return 0;
337 }
338 }
339 }
340
341 // Return entries one by one with each call of method
342 if (fDirList && ((VecString_t*)fDirList)->GetSize() > 0) {
343 fDirEntry = ((VecString_t*)fDirList)->Pop_front().c_str();
344 return fDirEntry.Data();
345 }
346 return 0; // until all of them have been returned
347 }
348
349 if (gDebug > 1) Info("GetDirEntry","Calling TNetSystem::GetDirEntry");
350 return TNetSystem::GetDirEntry(dirp); // for a rootd
351}
352
353////////////////////////////////////////////////////////////////////////////////
354/// Get info about a file. Info is returned in the form of a FileStat_t
355/// structure (see TSystem.h).
356/// The function returns 0 in case of success and 1 if the file could
357/// not be stat'ed.
358/// NOTICE: Not all information is available with an xrootd server.
359
361{
362 if (fIsXRootd) {
363 TXNetSystemConnectGuard cg(this, path);
364 if (cg.IsValid()) {
365
366 Long_t id;
367 Long64_t size;
368 Long_t flags;
369 Long_t modtime;
370
371 // Issue the request
372 TUrl urlpath(path);
373 Bool_t ok = cg.ClientAdmin()->Stat(urlpath.GetFile(),id,size,flags,modtime);
374 if (ok) {
375 // Save the endpoint path
376 urlpath.SetProtocol(cg.ClientAdmin()->GetCurrentUrl().Proto.c_str());
377 urlpath.SetHost(cg.ClientAdmin()->GetCurrentUrl().Host.c_str());
378 urlpath.SetPort(cg.ClientAdmin()->GetCurrentUrl().Port);
379 buf.fUrl = urlpath.GetUrl();
380 }
381 cg.ClientAdmin()->GoBackToRedirector();
382
383 // Flag offline files
384 if (flags & kXR_offline) {
385 buf.fMode = kS_IFOFF;
386 } else if (ok) {
387 buf.fDev = (id >> 24);
388 buf.fIno = (id & 0x00FFFFFF);
389 buf.fUid = -1; // not all information available in xrootd
390 buf.fGid = -1; // not available
391 buf.fSize = size;
392 buf.fMtime = modtime;
393
394 if (flags == 0) buf.fMode = kS_IFREG;
395 if (flags & kXR_xset) buf.fMode = (kS_IFREG|kS_IXUSR|kS_IXGRP|kS_IXOTH);
396 if (flags & kXR_isDir) buf.fMode = kS_IFDIR;
397 if (flags & kXR_other) buf.fMode = kS_IFSOCK;
398 if (flags & kXR_readable) buf.fMode |= kS_IRUSR;
399 if (flags & kXR_writable) buf.fMode |= kS_IWUSR;
400
401 buf.fIsLink = 0; // not available
402 return 0;
403 } else {
404 if (gDebug > 0)
405 cg.NotifyLastError();
406 }
407 }
408 return 1;
409 }
410
411 if (gDebug > 1)
412 Info("GetPathInfo","Calling TNetSystem::GetPathInfo");
413 return TNetSystem::GetPathInfo(path,buf); // for a rootd
414}
415
416////////////////////////////////////////////////////////////////////////////////
417/// Check consistency of this helper with the one required
418/// by 'path' or 'dirptr'.
419
420Bool_t TXNetSystem::ConsistentWith(const char *path, void *dirptr)
421{
422 if (gDebug > 1)
423 Info("ConsistentWith",
424 "calling for path: %s, dir: %p", path, dirptr);
425
426 return TNetSystem::ConsistentWith(path,dirptr); // for a rootd
427}
428
429////////////////////////////////////////////////////////////////////////////////
430/// Returns FALSE if one can access a file using the specified access mode.
431/// NB: for the time being mode is ignored for XROOTD (just checks existence
432/// of the file or directory).
433/// Mode is the same as for the Unix access(2) function.
434/// Attention, bizarre convention of return value!!
435
437{
438 if (fIsXRootd) {
439 // Check only if the file or directory exists and
440 FileStat_t buf;
441 if (GetPathInfo(path, buf) == 0)
442 if (buf.fMode != kS_IFSOCK)
443 return kFALSE;
444 // The file could not be stated
445 return kTRUE;
446 }
447
448 if (gDebug > 1)
449 Info("AccessPathName", "calling TNetSystem::AccessPathName");
450 return TNetSystem::AccessPathName(path,mode); // for a rootd
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Unlink 'path' on the remote server system.
455/// Returns 0 on success, -1 otherwise.
456
457int TXNetSystem::Unlink(const char *path)
458{
459 if (fIsXRootd) {
460
461 TXNetSystemConnectGuard cg(this, path);
462 if (cg.IsValid()) {
463
464 Long_t id;
465 Long64_t size;
466 Long_t flags;
467 Long_t modtime;
468
469 // Extract the directory name
470 TString edir = TUrl(path).GetFile();
471 Bool_t ok = cg.ClientAdmin()->Stat(edir.Data(), id, size, flags, modtime);
472
473 // Flag offline files
474 if (ok && !(flags & kXR_offline)) {
475 if (flags & kXR_isDir)
476 ok = cg.ClientAdmin()->Rmdir(edir.Data());
477 else
478 ok = cg.ClientAdmin()->Rm(edir.Data());
479 cg.ClientAdmin()->GoBackToRedirector();
480
481 // Done
482 return ((ok) ? 0 : -1);
483 } else if (!ok) {
484 cg.ClientAdmin()->GoBackToRedirector();
485 cg.NotifyLastError();
486 }
487 }
488 }
489
490 if (gDebug > 1)
491 Info("Unlink", "calling TNetSystem::Unlink");
492 return -1; // not implemented for rootd
493}
494
495////////////////////////////////////////////////////////////////////////////////
496/// Check if the file defined by 'path' is ready to be used
497
499{
500 // This is most efficiently done using GetPathInfo
501 FileStat_t st;
502 if (GetPathInfo(path, st) != 0) {
503 if (gDebug > 0)
504 Info("IsOnline", "path '%s' cannot be stat'ed", path);
505 return kFALSE;
506 }
507 if (R_ISOFF(st.fMode)) {
508 if (gDebug > 0)
509 Info("IsOnline", "path '%s' is offline", path);
510 return kFALSE;
511 }
512 // Done
513 return kTRUE;
514}
515
516////////////////////////////////////////////////////////////////////////////////
517/// Issue a prepare request for file defined by 'path'
518
519Bool_t TXNetSystem::Prepare(const char *path, UChar_t option, UChar_t priority)
520{
521 TXNetSystemConnectGuard cg(this, path);
522 if (cg.IsValid()) {
523 XrdOucString pathname = TUrl(path).GetFileAndOptions();
524 vecString vs;
525 vs.Push_back(pathname);
526 cg.ClientAdmin()->Prepare(vs, (kXR_char)option, (kXR_char)priority);
527 cg.ClientAdmin()->GoBackToRedirector();
528 if (gDebug >0)
529 Info("Prepare", "Got Status %d for %s",
530 cg.ClientAdmin()->LastServerResp()->status, pathname.c_str());
531 if (!(cg.ClientAdmin()->LastServerResp()->status)){
532 return kTRUE;
533 }
534 cg.NotifyLastError();
535 }
536
537 // Done
538 return kFALSE;
539}
540
541////////////////////////////////////////////////////////////////////////////////
542/// Issue a prepare request for a list of files defined by 'paths', which must
543/// be of one of the following types: TFileInfo, TUrl, TObjString.
544/// On output, bufout, if defined, points to a buffer form that can be used
545/// with GetPathsInfo.
546/// Return the number of paths found or -1 if any error occured.
547
549 UChar_t opt, UChar_t prio, TString *bufout)
550{
551 if (!paths) {
552 Warning("Prepare", "input list is empty!");
553 return -1;
554 }
555
556 Int_t npaths = 0;
557
558 TXNetSystemConnectGuard cg(this, "");
559 if (cg.IsValid()) {
560
561 TString *buf = (bufout) ? bufout : new TString();
562
563 // Prepare the buffer
564 TObject *o = 0;
565 TUrl u;
566 TString path;
567 TIter nxt(paths);
568 while ((o = nxt())) {
569 // Extract the path name from the allowed object types
571 if (pn == "") {
572 Warning("Prepare", "object is of unexpected type %s - ignoring", o->ClassName());
573 continue;
574 }
575 u.SetUrl(pn);
576 // The path
577 path = u.GetFileAndOptions();
578 path.ReplaceAll("\n","\r");
579 npaths++;
580 *buf += Form("%s\n", path.Data());
581 }
582
583 Info("Prepare","buffer ready: issuing prepare (opt=%d, prio=%d) ...",
584 opt, prio);
585 cg.ClientAdmin()->Prepare(buf->Data(), (kXR_char)opt, (kXR_char)prio);
586 cg.ClientAdmin()->GoBackToRedirector();
587 if (!bufout)
588 delete buf;
589 if (gDebug >0)
590 Info("Prepare", "Got Status %d",
591 cg.ClientAdmin()->LastServerResp()->status);
592 if (!(cg.ClientAdmin()->LastServerResp()->status)){
593 return npaths;
594 }
595 cg.NotifyLastError();
596 }
597
598 // Done
599 return -1;
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Retrieve status of a '\n'-separated list of files in 'paths'.
604/// The information is returned as one UChar_t per file in 'info';
605/// 'info' must be allocated by the caller.
606
607Bool_t TXNetSystem::GetPathsInfo(const char *paths, UChar_t *info)
608{
609 if (!paths) {
610 Warning("GetPathsInfo", "input list is empty!");
611 return kFALSE;
612 }
613
614 TXNetSystemConnectGuard cg(this, "");
615 if (cg.IsValid()) {
616 cg.ClientAdmin()->SysStatX(paths, info);
617 cg.ClientAdmin()->GoBackToRedirector();
618 if (gDebug >0)
619 Info("GetPathsInfo", "Got Status %d",
620 cg.ClientAdmin()->LastServerResp()->status);
621 if (!(cg.ClientAdmin()->LastServerResp()->status)){
622 return kTRUE;
623 }
624 cg.NotifyLastError();
625 }
626
627 // Done
628 return kFALSE;
629}
630
631////////////////////////////////////////////////////////////////////////////////
632/// Returns TRUE if the url in 'path' points to the local file system.
633/// This is used to avoid going through the NIC card for local operations.
634
636{
637 if (fIsXRootd) {
638 TXNetSystemConnectGuard cg(this, path);
639 if (cg.IsValid()) {
640 if (cg.ClientAdmin()->GetClientConn()->GetServerType() != kSTDataXrootd) {
641 // Not an end point data server: cannot assert locality
642 return kFALSE;
643 }
644 }
645 }
646 // Either an end-point data server or 'rootd': check for locality
647 return TSystem::IsPathLocal(path);
648}
649
650////////////////////////////////////////////////////////////////////////////////
651/// Get end-point url of a file. Info is returned in eurl.
652/// The function returns 0 in case of success and 1 if the file could
653/// not be stat'ed.
654
655Int_t TXNetSystem::Locate(const char *path, TString &eurl)
656{
657 if (fIsXRootd) {
658 TXNetSystemConnectGuard cg(this, path);
659 if (cg.IsValid()) {
660
661 // Extract the directory name
662 XrdClientLocate_Info li;
663 TString edir = TUrl(path).GetFile();
664
665 if (cg.ClientAdmin()->Locate((kXR_char *)edir.Data(), li)) {
666 TUrl u(path);
667 XrdClientUrlInfo ui((const char *)&li.Location[0]);
668 // We got the IP address but we need the FQDN: if we did not resolve
669 // it yet do it and cache the result
670 TNamed *hn = 0;
671 if (fgAddrFQDN.GetSize() <= 0 ||
672 !(hn = dynamic_cast<TNamed *>(fgAddrFQDN.FindObject(ui.Host.c_str())))) {
674 if (strlen(a.GetHostName()) > 0)
675 hn = new TNamed(ui.Host.c_str(), a.GetHostName());
676 else
677 hn = new TNamed(ui.Host.c_str(), ui.Host.c_str());
678 fgAddrFQDN.Add(hn);
679 if (gDebug > 0)
680 Info("Locate","caching host name: %s", hn->GetTitle());
681 }
682 if (hn)
683 u.SetHost(hn->GetTitle());
684 else
685 u.SetHost(ui.Host.c_str());
686 u.SetPort(ui.Port);
687 eurl = u.GetUrl();
688 return 0;
689 }
690 cg.NotifyLastError();
691 }
692 return 1;
693 }
694
695 // Not implemented
696 if (gDebug > 0) Info("Locate", "server not Xrootd: method not implemented!");
697 return -1;
698}
699
700////////////////////////////////////////////////////////////////////////////////
701/// Checks if an admin for 'url' exists already.
702/// Avoid duplications.
703
704XrdClientAdmin *TXNetSystem::GetClientAdmin(const char *url)
705{
706 XrdClientAdmin *ca = 0;
707
708 // ID key
709 TString key = TXNetSystem::GetKey(url);
710
711 // If we have one for 'key', just use it
712 TXrdClientAdminWrapper *caw = 0;
713 if (fgAdminHash.GetSize() > 0 &&
714 (caw = dynamic_cast<TXrdClientAdminWrapper *>(fgAdminHash.FindObject(key.Data()))))
715 return caw->fXCA;
716
717 // Create one and save the reference in the hash table
718 ca = new XrdClientAdmin(url);
720
721 // Done
722 return ca;
723}
724
725////////////////////////////////////////////////////////////////////////////////
726/// Build from uu a unique ID key used in hash tables
727
729{
730 TUrl u(url);
731 TString key(u.GetUser());
732 if (!key.IsNull())
733 key += "@";
734 key += u.GetHost();
735 if (u.GetPort() > 0) {
736 key += ":";
737 key += u.GetPort();
738 }
739
740 // Done
741 return key;
742}
743
744//
745// Wrapper class
746//
747////////////////////////////////////////////////////////////////////////////////
748/// Destructor: destroy the instance
749
751{
753}
754
755//
756// Guard methods
757//
758////////////////////////////////////////////////////////////////////////////////
759/// Construct a guard object
760
762 : fClientAdmin(0)
763{
764 if (xn)
765 // Connect
766 fClientAdmin = (url && strlen(url) > 0) ? xn->Connect(url)
767 : xn->Connect(xn->fUrl);
768}
769
770////////////////////////////////////////////////////////////////////////////////
771/// Destructor: close the connection
772
774{
775 fClientAdmin = 0;
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Print message about last occured error
780
782{
783 if (fClientAdmin)
784 if (fClientAdmin->GetClientConn())
785 Printf("Srv err: %s", fClientAdmin->GetClientConn()->LastServerError.errmsg);
786}
#define SafeDelete(p)
Definition: RConfig.hxx:543
static RooMathCoreReg dummy
unsigned char UChar_t
Definition: RtypesCore.h:36
const Bool_t kFALSE
Definition: RtypesCore.h:90
long Long_t
Definition: RtypesCore.h:52
bool Bool_t
Definition: RtypesCore.h:61
R__EXTERN Int_t gDebug
Definition: RtypesCore.h:117
long long Long64_t
Definition: RtypesCore.h:71
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
XFontStruct * id
Definition: TGX11.cxx:108
R__EXTERN TVirtualMutex * gROOTMutex
Definition: TROOT.h:59
#define gROOT
Definition: TROOT.h:406
char * Form(const char *fmt,...)
void Printf(const char *fmt,...)
Bool_t R_ISOFF(Int_t mode)
Definition: TSystem.h:121
@ kNoBlock
Definition: TSystem.h:221
EAccessMode
Definition: TSystem.h:42
R__EXTERN TSystem * gSystem
Definition: TSystem.h:556
@ kS_IWUSR
Definition: TSystem.h:102
@ kS_IFDIR
Definition: TSystem.h:94
@ kS_IRUSR
Definition: TSystem.h:101
@ kS_IXOTH
Definition: TSystem.h:111
@ kS_IXUSR
Definition: TSystem.h:103
@ kS_IFSOCK
Definition: TSystem.h:89
@ kS_IFOFF
Definition: TSystem.h:91
@ kS_IFREG
Definition: TSystem.h:92
@ kS_IXGRP
Definition: TSystem.h:107
#define R__LOCKGUARD(mutex)
TSystem * ROOT_Plugin_TXNetSystem(const char *url, Bool_t owner)
PluginManager creation function.
Definition: TXNetSystem.cxx:50
XrdClientVector< XrdOucString > VecString_t
Definition: TXNetSystem.cxx:62
#define NAME_DEBUG
#define NAME_FIRSTCONNECTMAXCNT
#define EnvPutInt(name, val)
Definition: XrdClientEnv.hh:47
#define EnvGetLong(x)
Definition: XrdClientEnv.hh:44
Collection abstract base class.
Definition: TCollection.h:63
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=0)
Set the value of a resource or create a new resource.
Definition: TEnv.cxx:736
static TString GetPathName(TObject *o)
Return the path name contained in object 'o' allowing for TUrl, TObjString or TFileInfo.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:262
This class represents an Internet Protocol (IP) address.
Definition: TInetAddress.h:36
virtual void Add(TObject *obj)
Definition: TList.h:87
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
TNamed()
Definition: TNamed.h:36
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
const char * GetDirEntry(void *dirp=0)
Get directory entry via rootd. Returns 0 in case no more entries.
Definition: TNetFile.cxx:1048
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
Definition: TNetFile.cxx:841
Int_t MakeDirectory(const char *name)
Make a directory via rootd.
Definition: TNetFile.cxx:967
void Create(const char *url, TSocket *sock=0)
Create a TNetSystem object.
Definition: TNetFile.cxx:865
void FreeDirectory(void *dirp=0)
Free directory via rootd.
Definition: TNetFile.cxx:1023
Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Definition: TNetFile.cxx:1118
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
Definition: TNetFile.cxx:1096
Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
Definition: TNetFile.cxx:1072
void * OpenDirectory(const char *name)
Open a directory and return an opaque pointer to a dir structure.
Definition: TNetFile.cxx:989
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:877
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:865
@ kROOTD
Definition: TSocket.h:52
Basic string class.
Definition: TString.h:131
void Clear()
Clear string without changing its capacity.
Definition: TString.cxx:1176
const char * Data() const
Definition: TString.h:364
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:687
Bool_t IsNull() const
Definition: TString.h:402
Abstract base class defining a generic interface to the underlying Operating System.
Definition: TSystem.h:265
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
Definition: TSystem.cxx:1300
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
Definition: TSystem.cxx:2292
This class represents a WWW compatible URL.
Definition: TUrl.h:35
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Definition: TUrl.cxx:387
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
Definition: TUrl.cxx:501
const char * GetFile() const
Definition: TUrl.h:71
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
Definition: TUrl.cxx:108
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
Definition: TUrl.cxx:520
const char * GetUser() const
Definition: TUrl.h:67
const char * GetHost() const
Definition: TUrl.h:69
void SetHost(const char *host)
Definition: TUrl.h:86
void SetPort(Int_t port)
Definition: TUrl.h:90
Int_t GetPort() const
Definition: TUrl.h:80
static void SetEnv()
Set the relevant environment variables.
Definition: TXNetFile.cxx:1201
static void FormUrl(TUrl uut, TString &uu)
Form url for rootd socket.
Definition: TXNetFile.cxx:170
static Int_t GetRootdProtocol(TSocket *s)
Find out the remote rootd protocol version.
Definition: TXNetFile.cxx:421
~TXNetSystemConnectGuard()
Destructor: close the connection.
XrdClientAdmin * fClientAdmin
Definition: TXNetSystem.h:106
TXNetSystemConnectGuard(TXNetSystem *xn, const char *url)
Construct a guard object.
void NotifyLastError()
Print message about last occured error.
XrdClientAdmin * ClientAdmin() const
Definition: TXNetSystem.h:114
virtual Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
static Bool_t fgRootdBC
Definition: TXNetSystem.h:63
void * fDirp
Definition: TXNetSystem.h:57
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
static THashList fgAddrFQDN
Definition: TXNetSystem.h:69
static XrdClientAdmin * GetClientAdmin(const char *url)
Checks if an admin for 'url' exists already.
virtual int Unlink(const char *path)
Unlink 'path' on the remote server system.
virtual Int_t MakeDirectory(const char *dir)
Create a directory. Return 0 on success, -1 otherwise.
Bool_t GetPathsInfo(const char *paths, UChar_t *info)
Retrieve status of a ' '-separated list of files in 'paths'.
Bool_t fIsRootd
Definition: TXNetSystem.h:54
TString fDir
Definition: TXNetSystem.h:56
TString fDirEntry
Definition: TXNetSystem.h:59
Bool_t fIsXRootd
Definition: TXNetSystem.h:55
void InitXrdClient()
One-time initialization of some communication variables for xrootd protocol.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
TXNetSystem(Bool_t owner=kTRUE)
Create system management class without connecting to server.
Definition: TXNetSystem.cxx:67
virtual void FreeDirectory(void *dirp)
Free(Close) the directory referenced by dirp.
VecStringVP_t fDirList
Definition: TXNetSystem.h:58
virtual void * OpenDirectory(const char *dir)
Open a directory.
virtual Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
static THashList fgAdminHash
Definition: TXNetSystem.h:70
Bool_t IsOnline(const char *path)
Check if the file defined by 'path' is ready to be used.
virtual const char * GetDirEntry(void *dirp)
Get directory entry for directory referenced by dirp.
static Bool_t fgInitDone
Definition: TXNetSystem.h:62
Bool_t Prepare(const char *path, UChar_t opt=8, UChar_t prio=0)
Issue a prepare request for file defined by 'path'.
TString fUrl
Definition: TXNetSystem.h:60
static TString GetKey(const char *url)
Build from uu a unique ID key used in hash tables.
virtual Int_t Locate(const char *path, TString &endurl)
Get end-point url of a file.
XrdClientAdmin * Connect(const char *url)
Init a connection to the server.
XrdClientAdmin * fXCA
Definition: TXNetSystem.h:46
virtual ~TXrdClientAdminWrapper()
Destructor: destroy the instance.
static constexpr double s
Int_t fMode
Definition: TSystem.h:126
Long64_t fSize
Definition: TSystem.h:129
Long_t fDev
Definition: TSystem.h:124
TString fUrl
Definition: TSystem.h:132
Int_t fGid
Definition: TSystem.h:128
Long_t fMtime
Definition: TSystem.h:130
Long_t fIno
Definition: TSystem.h:125
Bool_t fIsLink
Definition: TSystem.h:131
Int_t fUid
Definition: TSystem.h:127
auto * a
Definition: textangle.C:12