Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TNetFile.cxx
Go to the documentation of this file.
1// @(#)root/net:$Id$
2// Author: Fons Rademakers 14/08/97
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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\file TNetFile.cxx
14\class TNetFile
15\ingroup IO
16
17A TNetFile is like a normal TFile except that it reads and writes
18its data via a rootd server (for more on the rootd daemon see the
19source files in `root/rootd/src/`). TNetFile file names are in
20standard URL format with protocol "root" or "roots". The following
21are valid TNetFile URL's:
22- `root://hpbrun.cern.ch/root/hsimple.root`
23- `root://pcna49a:5151/~na49/data/run821.root`
24- `root://pcna49d.cern.ch:5050//v1/data/run810.root`
25
26The only difference with the well known httpd URL's is that the root
27of the remote file tree is the user's home directory. Therefore an
28absolute pathname requires a // after the host or port specifier
29(see last example). Further the expansion of the standard shell
30characters, like ~, $, .., are handled as expected.
31TNetFile (actually TUrl) uses 1094 as default port for rootd.
32
33Connecting to a rootd requires the remote user id and password.
34TNetFile allows three ways for you to provide your login:
35 Setting it globally via the static functions:
361. TAuthenticate::SetGlobalUser() and TAuthenticate::SetGlobalPasswd()
372. Getting it from the `~/.netrc` file (same file as used by ftp)
383. Command line prompt
39The different methods will be tried in the order given above.
40On machines with AFS rootd will authenticate using AFS (if it was
41compiled with AFS support).
42
43If the protocol is specified as "rootk" kerberos5 will be used for
44authentication.
45
46The rootd daemon lives in the directory `$ROOTSYS/bin`. It can be
47started either via inetd or by hand from the command line (no need
48to be super user).
49**/
50
51#include <errno.h>
52
53#include "Bytes.h"
54#include "NetErrors.h"
55#include "TApplication.h"
56#include "TEnv.h"
57#include "TNetFile.h"
58#include "TPSocket.h"
59#include "TROOT.h"
60#include "TSysEvtHandler.h"
61#include "TSystem.h"
62#include "TTimeStamp.h"
63#include "TVirtualPerfStats.h"
64
65// fgClientProtocol is now in TAuthenticate
66
69
70////////////////////////////////////////////////////////////////////////////////
71/// Create a TNetFile object. This is actually done inside Create(), so
72/// for a description of the options and other arguments see Create().
73/// Normally a TNetFile is created via TFile::Open().
74
75TNetFile::TNetFile(const char *url, Option_t *option, const char *ftitle, Int_t compress, Int_t netopt)
76 : TFile(url, strstr(option, "_WITHOUT_GLOBALREGISTRATION") != nullptr ? "NET_WITHOUT_GLOBALREGISTRATION" : "NET",
77 ftitle, compress),
78 fEndpointUrl(url)
79{
80 fSocket = 0;
81 Create(url, option, netopt);
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Create a TNetFile object. To be used by derived classes, that need
86/// to initialize the TFile base class but not open a connection at this
87/// moment.
88
89TNetFile::TNetFile(const char *url, const char *ftitle, Int_t compress, Bool_t)
90 : TFile(url, "NET", ftitle, compress), fEndpointUrl(url)
91{
92 fSocket = 0;
93 fProtocol = 0;
94 fErrorCode = 0;
95 fNetopt = 0;
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// TNetFile dtor. Send close message and close socket.
100
102{
103 Close();
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Open a remote file. Requires fOption to be set correctly.
108
109Int_t TNetFile::SysOpen(const char * /*file*/, Int_t /*flags*/, UInt_t /*mode*/)
110{
111 if (!fSocket) {
112
114 if (!fSocket) return -1;
115
116 } else {
117
118 if (fProtocol > 15) {
119 fSocket->Send(Form("%s %s", fUrl.GetFile(), ToLower(fOption).Data()),
121 } else {
122 // Old daemon versions expect an additional slash at beginning
123 fSocket->Send(Form("/%s %s", fUrl.GetFile(), ToLower(fOption).Data()),
125 }
126
127 EMessageTypes kind;
128 int stat;
129 Recv(stat, kind);
130
131 if (kind == kROOTD_ERR) {
132 PrintError("SysOpen", stat);
133 return -1;
134 }
135 }
136
137 // This means ok for net files
138 return -2; // set as fD in ReOpen
139}
140
141////////////////////////////////////////////////////////////////////////////////
142/// Close currently open file.
143
145{
146 if (fSocket)
148
149 return 0;
150}
151
152////////////////////////////////////////////////////////////////////////////////
153/// Return file stat information. The interface and return value is
154/// identical to TSystem::GetPathInfo().
155
157{
158 if (fProtocol < 3) return 1;
159
160 if (!fSocket) return 1;
161
163
164 char msg[1024];
165 Int_t kind;
166 fSocket->Recv(msg, sizeof(msg), kind);
167
168 Int_t mode, uid, gid, islink;
169 Long_t dev, ino;
170
171 if (fProtocol > 12) {
172#ifdef R__WIN32
173 sscanf(msg, "%ld %ld %d %d %d %I64d %ld %d", &dev, &ino, &mode,
174 &uid, &gid, size, modtime, &islink);
175#else
176 sscanf(msg, "%ld %ld %d %d %d %lld %ld %d", &dev, &ino, &mode,
177 &uid, &gid, size, modtime, &islink);
178#endif
179 if (dev == -1)
180 return 1;
181 if (id)
182 *id = (dev << 24) + ino;
183 if (flags) {
184 *flags = 0;
186 *flags |= 1;
187 if (R_ISDIR(mode))
188 *flags |= 2;
189 if (!R_ISREG(mode) && !R_ISDIR(mode))
190 *flags |= 4;
191 }
192 } else {
193#ifdef R__WIN32
194 sscanf(msg, "%ld %I64d %ld %ld", id, size, flags, modtime);
195#else
196 sscanf(msg, "%ld %lld %ld %ld", id, size, flags, modtime);
197#endif
198 if (*id == -1)
199 return 1;
200 }
201
202 return 0;
203}
204
205////////////////////////////////////////////////////////////////////////////////
206/// Close remote file.
207
209{
210 if (!fSocket) return;
211
212 TFile::Close(opt);
213
214 if (fProtocol > 6)
216
218
219 fD = -1; // so TFile::IsOpen() returns false when in TFile::~TFile
220}
221
222////////////////////////////////////////////////////////////////////////////////
223/// Flush file to disk.
224
226{
228
229 if (fSocket && fWritable)
231}
232
233////////////////////////////////////////////////////////////////////////////////
234/// Initialize a TNetFile object.
235
237{
238 Seek(0);
239
240 TFile::Init(create);
241 fD = -2; // so TFile::IsOpen() returns true when in TFile::~TFile
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Retruns kTRUE if file is open, kFALSE otherwise.
246
248{
249 return fSocket == 0 ? kFALSE : kTRUE;
250}
251
252////////////////////////////////////////////////////////////////////////////////
253/// Print some info about the net file.
254
256{
257 const char *fname = fUrl.GetFile();
258 Printf("URL: %s", ((TUrl*)&fUrl)->GetUrl());
259 Printf("Remote file: %s", &fname[1]);
260 Printf("Remote user: %s", fUser.Data());
261 Printf("Title: %s", fTitle.Data());
262 Printf("Option: %s", fOption.Data());
263 Printf("Bytes written: %lld", fBytesWrite);
264 Printf("Bytes read: %lld", fBytesRead);
265}
266
267////////////////////////////////////////////////////////////////////////////////
268/// Print error string depending on error code.
269
270void TNetFile::PrintError(const char *where, Int_t err)
271{
272 fErrorCode = err;
273 Error(where, "%s", gRootdErrStr[err]);
274}
275
276////////////////////////////////////////////////////////////////////////////////
277/// Reopen a file with a different access mode, like from READ to
278/// UPDATE or from NEW, CREATE, RECREATE, UPDATE to READ. Thus the
279/// mode argument can be either "READ" or "UPDATE". The method returns
280/// 0 in case the mode was successfully modified, 1 in case the mode
281/// did not change (was already as requested or wrong input arguments)
282/// and -1 in case of failure, in which case the file cannot be used
283/// anymore.
284
286{
287 if (fProtocol < 7) {
288 Error("ReOpen", "operation not supported by remote rootd (protocol = %d)",
289 fProtocol);
290 return 1;
291 }
292
293 return TFile::ReOpen(mode);
294}
295
296////////////////////////////////////////////////////////////////////////////////
297/// Read specified byte range from remote file via rootd daemon.
298/// Returns kTRUE in case of error.
299
301{
302 if (!fSocket) return kTRUE;
303 if (len == 0)
304 return kFALSE;
305
307
308 Int_t st;
309 if ((st = ReadBufferViaCache(buf, len))) {
310 if (st == 2)
311 return kTRUE;
312 return kFALSE;
313 }
314
317
318 Double_t start = 0;
319 if (gPerfStats) start = TTimeStamp();
320
321 if (fSocket->Send(Form("%lld %d", fOffset, len), kROOTD_GET) < 0) {
322 Error("ReadBuffer", "error sending kROOTD_GET command");
323 result = kTRUE;
324 goto end;
325 }
326
327 Int_t stat, n;
328 EMessageTypes kind;
329
330 fErrorCode = -1;
331 if (Recv(stat, kind) < 0 || kind == kROOTD_ERR) {
332 PrintError("ReadBuffer", stat);
333 result = kTRUE;
334 goto end;
335 }
336
337 while ((n = fSocket->RecvRaw(buf, len)) < 0 && TSystem::GetErrno() == EINTR)
339
340 if (n != len) {
341 Error("ReadBuffer", "error receiving buffer of length %d, got %d", len, n);
342 result = kTRUE;
343 goto end;
344 }
345
346 fOffset += len;
347
348 fBytesRead += len;
349 fReadCalls++;
350#ifdef R__WIN32
353#else
354 fgBytesRead += len;
355 fgReadCalls++;
356#endif
357
358end:
359
360 if (gPerfStats)
361 gPerfStats->FileReadEvent(this, len, start);
362
365
366 return result;
367}
368
369////////////////////////////////////////////////////////////////////////////////
370/// Read specified byte range from remote file via rootd daemon.
371/// Returns kTRUE in case of error.
372
374{
375 SetOffset(pos);
376 return ReadBuffer(buf, len);
377}
378
379////////////////////////////////////////////////////////////////////////////////
380/// Read a list of buffers given in pos[] and len[] and return it in a single
381/// buffer.
382/// Returns kTRUE in case of error.
383
385{
386 if (!fSocket) return kTRUE;
387
388 // If it's an old version of the protocol try the default TFile::ReadBuffers
389 if (fProtocol < 17)
390 return TFile::ReadBuffers(buf, pos, len, nbuf);
391
392 Int_t stat;
393 Int_t blockSize = 262144; //Let's say we transfer 256KB at the time
395 EMessageTypes kind;
396 TString data_buf; // buf to put the info
397
400
401 Double_t start = 0;
402 if (gPerfStats) start = TTimeStamp();
403
404 // Make the string with a list of offsets and lengths
405 Long64_t total_len = 0;
406 Long64_t actual_pos;
407 for(Int_t i = 0; i < nbuf; i++) {
408 data_buf += pos[i] + fArchiveOffset;
409 data_buf += "-";
410 data_buf += len[i];
411 data_buf += "/";
412 total_len += len[i];
413 }
414
415 // Send the command with the length of the info and number of buffers
416 if (fSocket->Send(Form("%d %d %d", nbuf, data_buf.Length(), blockSize),
417 kROOTD_GETS) < 0) {
418 Error("ReadBuffers", "error sending kROOTD_GETS command");
419 result = kTRUE;
420 goto end;
421 }
422 // Send buffer with the list of offsets and lengths
423 if (fSocket->SendRaw(data_buf, data_buf.Length()) < 0) {
424 Error("ReadBuffers", "error sending buffer");
425 result = kTRUE;
426 goto end;
427 }
428
429 fErrorCode = -1;
430 if (Recv(stat, kind) < 0 || kind == kROOTD_ERR) {
431 PrintError("ReadBuffers", stat);
432 result = kTRUE;
433 goto end;
434 }
435
436 actual_pos = 0;
437 while (actual_pos < total_len) {
438 Long64_t left = total_len - actual_pos;
439 if (left > blockSize)
440 left = blockSize;
441
442 Int_t n;
443 while ((n = fSocket->RecvRaw(buf + actual_pos, Int_t(left))) < 0 &&
444 TSystem::GetErrno() == EINTR)
446
447 if (n != Int_t(left)) {
448 Error("GetBuffers", "error receiving buffer of length %d, got %d",
449 Int_t(left), n);
450 result = kTRUE ;
451 goto end;
452 }
453 actual_pos += left;
454 }
455
456 fBytesRead += total_len;
457 fReadCalls++;
458#ifdef R__WIN32
459 SetFileBytesRead(GetFileBytesRead() + total_len);
461#else
462 fgBytesRead += total_len;
463 fgReadCalls++;
464#endif
465
466end:
467
468 if (gPerfStats)
469 gPerfStats->FileReadEvent(this, total_len, start);
470
473
474 // If found problems try the generic implementation
475 if (result) {
476 if (gDebug > 0)
477 Info("ReadBuffers", "Couldnt use the specific implementation, calling TFile::ReadBuffers");
478 return TFile::ReadBuffers(buf, pos, len, nbuf);
479 }
480
481 return result;
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// Write specified byte range to remote file via rootd daemon.
486/// Returns kTRUE in case of error.
487
489{
490 if (!fSocket || !fWritable) return kTRUE;
491
493
494 Int_t st;
495 if ((st = WriteBufferViaCache(buf, len))) {
496 if (st == 2)
497 return kTRUE;
498 return kFALSE;
499 }
500
502
503 if (fSocket->Send(Form("%lld %d", fOffset, len), kROOTD_PUT) < 0) {
505 Error("WriteBuffer", "error sending kROOTD_PUT command");
506 result = kTRUE;
507 goto end;
508 }
509 if (fSocket->SendRaw(buf, len) < 0) {
511 Error("WriteBuffer", "error sending buffer");
512 result = kTRUE;
513 goto end;
514 }
515
516 Int_t stat;
517 EMessageTypes kind;
518
519 fErrorCode = -1;
520 if (Recv(stat, kind) < 0 || kind == kROOTD_ERR) {
522 PrintError("WriteBuffer", stat);
523 result = kTRUE;
524 goto end;
525 }
526
527 fOffset += len;
528
529 fBytesWrite += len;
530#ifdef R__WIN32
532#else
533 fgBytesWrite += len;
534#endif
535
536end:
538
539 return result;
540}
541
542////////////////////////////////////////////////////////////////////////////////
543/// Return status from rootd server and message kind. Returns -1 in
544/// case of error otherwise 8 (sizeof 2 words, status and kind).
545
547{
548 kind = kROOTD_ERR;
549 status = 0;
550
551 if (!fSocket) return -1;
552
553 Int_t what;
554 Int_t n = fSocket->Recv(status, what);
555 kind = (EMessageTypes) what;
556 return n;
557}
558
559////////////////////////////////////////////////////////////////////////////////
560/// Set position from where to start reading.
561
563{
564 SetOffset(offset, pos);
565}
566
567////////////////////////////////////////////////////////////////////////////////
568/// Connect to remote rootd server.
569
571 Int_t tcpwindowsize, Bool_t forceOpen,
572 Bool_t forceRead)
573{
574 TString fn = fUrl.GetFile();
575
576 // Create Authenticated socket
577 Int_t sSize = netopt < -1 ? -netopt : 1;
578 TString url(fUrl.GetProtocol());
579 if (url.Contains("root")) {
580 url.Insert(4,"dp");
581 } else {
582 url = "rootdp";
583 }
584 url += TString(Form("://%s@%s:%d",
586 fSocket = TSocket::CreateAuthSocket(url, sSize, tcpwindowsize, fSocket, stat);
587 if (!fSocket || (fSocket && !fSocket->IsAuthenticated())) {
588 if (sSize > 1)
589 Error("TNetFile", "can't open %d-stream connection to rootd on "
590 "host %s at port %d", sSize, fUrl.GetHost(), fUrl.GetPort());
591 else
592 Error("TNetFile", "can't open connection to rootd on "
593 "host %s at port %d", fUrl.GetHost(), fUrl.GetPort());
594 *kind = kROOTD_ERR;
595 goto zombie;
596 }
597
598 // Check if rootd supports new options
600 if (forceRead && fProtocol < 5) {
601 Warning("ConnectServer", "rootd does not support \"+read\" option");
602 forceRead = kFALSE;
603 }
604
605 // Open the file
606 if (fProtocol < 16)
607 // For backward compatibility we need to add a '/' at the beginning
608 fn.Insert(0,"/");
609 if (forceOpen)
610 fSocket->Send(Form("%s %s", fn.Data(),
611 ToLower("f"+fOption).Data()), kROOTD_OPEN);
612 else if (forceRead)
613 fSocket->Send(Form("%s %s", fn.Data(), "+read"), kROOTD_OPEN);
614 else
615 fSocket->Send(Form("%s %s", fn.Data(),
616 ToLower(fOption).Data()), kROOTD_OPEN);
617
618 EMessageTypes tmpkind;
619 int tmpstat;
620 Recv(tmpstat, tmpkind);
621 *stat = tmpstat;
622 *kind = tmpkind;
623
624 return;
625
626zombie:
627 // error in file opening occured, make this object a zombie
628 MakeZombie();
631}
632
633////////////////////////////////////////////////////////////////////////////////
634/// Create a NetFile object. A net file is the same as a TFile
635/// except that it is being accessed via a rootd server. The url
636/// argument must be of the form: root[k]://host.dom.ain/file.root.
637/// When protocol is "rootk" try using kerberos5 authentication.
638/// If the file specified in the URL does not exist, is not accessable
639/// or can not be created the kZombie bit will be set in the TNetFile
640/// object. Use IsZombie() to see if the file is accessable.
641/// If the remote daemon thinks the file is still connected, while you are
642/// sure this is not the case you can force open the file by preceding the
643/// option argument with an "-", e.g.: "-recreate". Do this only
644/// in cases when you are very sure nobody else is using the file.
645/// To bypass the writelock on a file, to allow the reading of a file
646/// that is being written by another process, explicitly specify the
647/// "+read" option ("read" being the default option).
648/// The netopt argument can be used to specify the size of the tcp window in
649/// bytes (for more info see: http://www.psc.edu/networking/perf_tune.html).
650/// The default and minimum tcp window size is 65535 bytes.
651/// If netopt < -1 then |netopt| is the number of parallel sockets that will
652/// be used to connect to rootd. This option should be used on fat pipes
653/// (i.e. high bandwidth, high latency links). The ideal number of parallel
654/// sockets depends on the bandwidth*delay product. Generally 5-7 is a good
655/// number.
656/// For a description of the option and other arguments see the TFile ctor.
657/// The preferred interface to this constructor is via TFile::Open().
658
659void TNetFile::Create(const char * /*url*/, Option_t *option, Int_t netopt)
660{
661 Int_t tcpwindowsize = 65535;
662
663 fErrorCode = -1;
664 fNetopt = netopt;
665 fOption = option;
666
667 Bool_t forceOpen = kFALSE;
668 if (option[0] == '-') {
669 fOption = &option[1];
670 forceOpen = kTRUE;
671 }
672 // accept 'f', like 'frecreate' still for backward compatibility
673 if (option[0] == 'F' || option[0] == 'f') {
674 fOption = &option[1];
675 forceOpen = kTRUE;
676 }
677
678 Bool_t forceRead = kFALSE;
679 if (!strcasecmp(option, "+read")) {
680 fOption = &option[1];
681 forceRead = kTRUE;
682 }
683
685
686 if (fOption == "NEW")
687 fOption = "CREATE";
688
689 Bool_t create = (fOption == "CREATE") ? kTRUE : kFALSE;
690 Bool_t recreate = (fOption == "RECREATE") ? kTRUE : kFALSE;
691 Bool_t update = (fOption == "UPDATE") ? kTRUE : kFALSE;
692 if (!create && !recreate && !update) {
693 fOption = "READ";
694 }
695
696 if (!fUrl.IsValid()) {
697 Error("Create", "invalid URL specified: %s", fUrl.GetUrl());
698 goto zombie;
699 }
700
701 if (netopt > tcpwindowsize)
702 tcpwindowsize = netopt;
703
704 // Open connection to remote rootd server
705 EMessageTypes kind;
706 Int_t stat;
707 ConnectServer(&stat, &kind, netopt, tcpwindowsize, forceOpen, forceRead);
708 if (gDebug > 2) Info("Create", "got from host %d %d", stat, kind);
709
710 if (kind == kROOTD_ERR) {
711 PrintError("Create", stat);
712 Error("Create", "failing on file %s", fUrl.GetUrl());
713 goto zombie;
714 }
715
716 if (recreate) {
717 create = kTRUE;
718 fOption = "CREATE";
719 }
720
721 if (update && stat > 1) {
722 create = kTRUE;
723 stat = 1;
724 }
725
726 if (stat == 1)
728 else
730
731 Init(create);
732 return;
733
734zombie:
735 // error in file opening occured, make this object a zombie
736 MakeZombie();
739}
740
741////////////////////////////////////////////////////////////////////////////////
742/// Create a NetFile object using an existing connection (socket s).
743/// Provided for use in TXNetFile.
744/// See:
745/// TNetFile::Create(const char *url, Option_t *option, Int_t netopt)
746/// for details about the arguments.
747
749{
750 // Import socket
751 fSocket = s;
752
753 // Create the connection
754 Create(s->GetUrl(), option, netopt);
755}
756
757////////////////////////////////////////////////////////////////////////////////
758/// Return kTRUE if 'url' matches the coordinates of this file.
759/// Check the full URL, including port and FQDN.
760
761Bool_t TNetFile::Matches(const char *url)
762{
763 // Run standard check on fUrl, first
764 Bool_t rc = TFile::Matches(url);
765 if (rc)
766 // Ok, standard check enough
767 return kTRUE;
768
769 // Check also endpoint URL
770 TUrl u(url);
771 if (!strcmp(u.GetFile(),fEndpointUrl.GetFile())) {
772 // Candidate info
773 TString fqdn = u.GetHostFQDN();
774
775 // Check ports
776 if (u.GetPort() == fEndpointUrl.GetPort()) {
777 TString fqdnref = fEndpointUrl.GetHostFQDN();
778 if (fqdn == fqdnref)
779 // Ok, coordinates match
780 return kTRUE;
781 }
782 }
783
784 // Default is not matching
785 return kFALSE;
786}
787
788//
789// TNetSystem: the directory handler for net files
790//
791
792////////////////////////////////////////////////////////////////////////////////
793/// Create helper class that allows directory access via rootd.
794/// Use ftpowner = TRUE (default) if this instance is responsible
795/// for cleaning of the underlying TFTP connection; this allows
796/// to have control on the order of the final cleaning.
797
799 : TSystem("-root", "Net file Helper System")
800{
801 // name must start with '-' to bypass the TSystem singleton check
802 SetName("root");
803
804 fDir = kFALSE;
805 fDirp = 0;
806 fFTP = 0;
807 fFTPOwner = ftpowner;
808 fUser = "";
809 fHost = "";
810 fPort = -1;
812}
813
814////////////////////////////////////////////////////////////////////////////////
815/// Create helper class that allows directory access via rootd.
816/// Use ftpowner = TRUE (default) if this instance is responsible
817/// for cleaning of the underlying TFTP connection; this allows
818/// to have control on the order of the final cleaning.
819
820TNetSystem::TNetSystem(const char *url, Bool_t ftpowner)
821 : TSystem("-root", "Net file Helper System")
822{
823 // name must start with '-' to bypass the TSystem singleton check
824 SetName("root");
825
826 fFTPOwner = ftpowner;
828 Create(url);
829}
830
831////////////////////////////////////////////////////////////////////////////////
832/// Parse and save coordinates of the remote entity (user, host, port, ...)
833
834void TNetSystem::InitRemoteEntity(const char *url)
835{
836 TUrl turl(url);
837
838 // Remote username: local as default
839 fUser = turl.GetUser();
840 if (!fUser.Length()) {
842 if (u)
843 fUser = u->fUser;
844 delete u;
845 }
846
847 // Check and save the host FQDN ...
848 fHost = turl.GetHostFQDN();
849
850 // Remote port: the default should be 1094 because we are here
851 // only if the protocol is "root://"
852 fPort = turl.GetPort();
853}
854
855////////////////////////////////////////////////////////////////////////////////
856/// Create a TNetSystem object.
857
858void TNetSystem::Create(const char *url, TSocket *sock)
859{
860 // If we got here protocol must be at least its short form "^root.*:" :
861 // make sure that it is in the full form to avoid problems in TFTP
862 TString surl(url);
863 if (!surl.Contains("://")) {
864 surl.Insert(surl.Index(":")+1,"//");
865 }
866 TUrl turl(surl);
867
868 fDir = kFALSE;
869 fDirp = 0;
870 fFTP = 0;
871
872 // Check locality, taking into account possible prefixes
873 fLocalPrefix = "";
875 // We may have been asked explicitly to go through the daemon
876 Bool_t forceRemote = gEnv->GetValue("Path.ForceRemote", 0);
877 TString opts = TUrl(url).GetOptions();
878 if (opts.Contains("remote=1"))
879 forceRemote = kTRUE;
880 else if (opts.Contains("remote=0"))
881 forceRemote = kFALSE;
882 if (!forceRemote) {
883 if ((fIsLocal = TSystem::IsPathLocal(url))) {
884 fLocalPrefix = gEnv->GetValue("Path.Localroot","");
885 // Nothing more to do
886 return;
887 }
888 }
889
890 // Fill in user, host, port
891 InitRemoteEntity(surl);
892
893 // Build a TFTP url
894 if (fHost.Length()) {
895 TString eurl = "";
896 // First the protocol
897 if (strlen(turl.GetProtocol())) {
898 eurl = turl.GetProtocol();
899 eurl += "://";
900 } else
901 eurl = "root://";
902 // Add user, if specified
903 if (strlen(turl.GetUser())) {
904 eurl += turl.GetUser();
905 eurl += "@";
906 }
907 // Add host
908 eurl += fHost;
909 // Add port
910 eurl += ":";
911 eurl += turl.GetPort();
912
913 fFTP = new TFTP(eurl, 1, TFTP::kDfltWindowSize, sock);
914 if (fFTP && fFTP->IsOpen()) {
915 if (fFTP->GetSocket()->GetRemoteProtocol() < 12) {
916 Error("Create",
917 "remote daemon does not support 'system' functionality");
918 fFTP->Close();
919 delete fFTP;
920 } else {
923 // If responsible for the TFTP connection, remove it from the
924 // socket global list to avoid problems with double deletion
925 // at final cleanup
926 if (fFTPOwner)
927 gROOT->GetListOfSockets()->Remove(fFTP);
928 }
929 }
930 }
931}
932
933////////////////////////////////////////////////////////////////////////////////
934/// Destructor
935
937{
938 // Close FTP connection
939 if (fFTPOwner) {
940 if (fFTP) {
941 if (fFTP->IsOpen()) {
942
943 // Close remote directory if still open
944 if (fDir) {
946 fDir = kFALSE;
947 }
948 fFTP->Close();
949 }
950 delete fFTP;
951 }
952 }
953 fDirp = 0;
954 fFTP = 0;
955}
956
957////////////////////////////////////////////////////////////////////////////////
958/// Make a directory via rootd.
959
961{
962 // If local, use the local TSystem
963 if (fIsLocal) {
964 TString edir = TUrl(dir).GetFile();
965 if (!fLocalPrefix.IsNull())
966 edir.Insert(0, fLocalPrefix);
967 return gSystem->MakeDirectory(edir);
968 }
969
970 if (fFTP && fFTP->IsOpen()) {
971 // Extract the directory name
972 TString edir = TUrl(dir).GetFile();
973 return fFTP->MakeDirectory(edir,kFALSE);
974 }
975 return -1;
976}
977
978////////////////////////////////////////////////////////////////////////////////
979/// Open a directory and return an opaque pointer to a dir structure.
980/// Returns nullptr in case of error.
981
982void *TNetSystem::OpenDirectory(const char *dir)
983{
984 // If local, use the local TSystem
985 if (fIsLocal) {
986 TString edir = TUrl(dir).GetFile();
987 if (!fLocalPrefix.IsNull())
988 edir.Insert(0, fLocalPrefix);
989 return gSystem->OpenDirectory(edir);
990 }
991
992 if (!fFTP || !fFTP->IsOpen())
993 return nullptr;
994
995 if (fDir) {
996 if (gDebug > 0)
997 Info("OpenDirectory", "a directory is already open: close it first");
999 fDir = kFALSE;
1000 }
1001
1002 // Extract the directory name
1003 TString edir = TUrl(dir).GetFile();
1004
1005 if (fFTP->OpenDirectory(edir,kFALSE)) {
1006 fDir = kTRUE;
1007 fDirp = (void *)&fDir;
1008 return fDirp;
1009 } else
1010 return nullptr;
1011}
1012
1013////////////////////////////////////////////////////////////////////////////////
1014/// Free directory via rootd.
1015
1017{
1018 // If local, use the local TSystem
1019 if (fIsLocal) {
1020 gSystem->FreeDirectory(dirp);
1021 return;
1022 }
1023
1024 if (dirp != fDirp) {
1025 Error("FreeDirectory", "invalid directory pointer (should never happen)");
1026 return;
1027 }
1028
1029 if (fFTP && fFTP->IsOpen()) {
1030 if (fDir) {
1032 fDir = kFALSE;
1033 fDirp = 0;
1034 }
1035 }
1036}
1037
1038////////////////////////////////////////////////////////////////////////////////
1039/// Get directory entry via rootd. Returns 0 in case no more entries.
1040
1041const char *TNetSystem::GetDirEntry(void *dirp)
1042{
1043 // If local, use the local TSystem
1044 if (fIsLocal) {
1045 return gSystem->GetDirEntry(dirp);
1046 }
1047
1048 if (dirp != fDirp) {
1049 Error("GetDirEntry", "invalid directory pointer (should never happen)");
1050 return 0;
1051 }
1052
1053 if (fFTP && fFTP->IsOpen() && fDir) {
1054 return fFTP->GetDirEntry(kFALSE);
1055 }
1056 return 0;
1057}
1058
1059////////////////////////////////////////////////////////////////////////////////
1060/// Get info about a file. Info is returned in the form of a FileStat_t
1061/// structure (see TSystem.h).
1062/// The function returns 0 in case of success and 1 if the file could
1063/// not be stat'ed.
1064
1066{
1067 // If local, use the local TSystem
1068 if (fIsLocal) {
1069 TString epath = TUrl(path).GetFile();
1070 if (!fLocalPrefix.IsNull())
1071 epath.Insert(0, fLocalPrefix);
1072 return gSystem->GetPathInfo(epath, buf);
1073 }
1074
1075 if (fFTP && fFTP->IsOpen()) {
1076 // Extract the directory name
1077 TString epath = TUrl(path).GetFile();
1078 fFTP->GetPathInfo(epath, buf, kFALSE);
1079 return 0;
1080 }
1081 return 1;
1082}
1083
1084////////////////////////////////////////////////////////////////////////////////
1085/// Returns FALSE if one can access a file using the specified access mode.
1086/// Mode is the same as for the Unix access(2) function.
1087/// Attention, bizarre convention of return value!!
1088
1090{
1091 // If local, use the local TSystem
1092 if (fIsLocal) {
1093 TString epath = TUrl(path).GetFile();
1094 if (!fLocalPrefix.IsNull())
1095 epath.Insert(0, fLocalPrefix);
1096 return gSystem->AccessPathName(epath, mode);
1097 }
1098
1099 if (fFTP && fFTP->IsOpen()) {
1100 // Extract the directory name
1101 TString epath = TUrl(path).GetFile();
1102 return fFTP->AccessPathName(epath, mode, kFALSE);
1103 }
1104 return kTRUE;
1105}
1106
1107////////////////////////////////////////////////////////////////////////////////
1108/// Check consistency of this helper with the one required
1109/// by 'path' or 'dirptr'.
1110
1111Bool_t TNetSystem::ConsistentWith(const char *path, void *dirptr)
1112{
1113 // Standard check: only the protocol part of 'path' is required to match
1114 Bool_t checkstd = TSystem::ConsistentWith(path, dirptr);
1115 if (!checkstd) return kFALSE;
1116
1117 // Require match of 'user' and 'host'
1118 Bool_t checknet = path ? kFALSE : kTRUE;
1119 if (path && strlen(path)) {
1120
1121 // Get user name
1122 TUrl url(path);
1123 TString user = url.GetUser();
1124 if (user.IsNull() && !fUser.IsNull()) {
1126 if (u)
1127 user = u->fUser;
1128 delete u;
1129 }
1130
1131 // Get host name
1132 TString host = url.GetHostFQDN();
1133
1134 // Get port
1135 Int_t port = url.GetPort();
1136 if (gDebug > 1)
1137 Info("ConsistentWith", "fUser:'%s' (%s), fHost:'%s' (%s), fPort:%d (%d)",
1138 fUser.Data(), user.Data(), fHost.Data(), host.Data(),
1139 fPort, port);
1140
1141 if (user == fUser && host == fHost && port == fPort)
1142 checknet = kTRUE;
1143 }
1144
1145 return (checkstd && checknet);
1146}
1147
1148////////////////////////////////////////////////////////////////////////////////
1149/// Remove a path
1150
1151Int_t TNetSystem::Unlink(const char *path)
1152{
1153 // If local, use the local TSystem
1154 if (fIsLocal) {
1155 TString epath = TUrl(path).GetFile();
1156 if (!fLocalPrefix.IsNull())
1157 epath.Insert(0, fLocalPrefix);
1158 return gSystem->Unlink(epath);
1159 }
1160
1161 // Not implemented for rootd
1162 Warning("Unlink", "functionality not implemented - ignored (path: %s)", path);
1163 return -1;
1164}
EMessageTypes
@ kROOTD_FSTAT
@ kROOTD_OPEN
@ kROOTD_BYE
@ kROOTD_GET
@ kROOTD_PUT
@ kROOTD_ERR
@ kROOTD_CLOSE
@ kROOTD_FLUSH
@ kROOTD_GETS
R__EXTERN const char * gRootdErrStr[]
Definition NetErrors.h:72
#define SafeDelete(p)
Definition RConfig.hxx:540
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Definition RtypesCore.h:45
long Long_t
Definition RtypesCore.h:54
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TApplication * gApplication
#define gDirectory
Definition TDirectory.h:386
R__EXTERN TEnv * gEnv
Definition TEnv.h:170
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:230
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:197
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:241
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Int_t gDebug
Definition TROOT.cxx:585
#define gROOT
Definition TROOT.h:405
TString ToLower(const TString &s)
Return a lower-case version of str.
Definition TString.cxx:1475
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2467
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Definition TString.cxx:2481
EAccessMode
Definition TSystem.h:43
Bool_t R_ISREG(Int_t mode)
Definition TSystem.h:118
Bool_t R_ISDIR(Int_t mode)
Definition TSystem.h:115
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
@ kS_IXOTH
Definition TSystem.h:112
@ kS_IXUSR
Definition TSystem.h:104
@ kS_IXGRP
Definition TSystem.h:108
#define gPerfStats
TSignalHandler * GetSignalHandler() const
Bool_t fWritable
True if directory is writable.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:491
Definition TFTP.h:34
Int_t MakeDirectory(const char *dir, Bool_t print=kFALSE) const
Make a remote directory.
Definition TFTP.cxx:667
@ kDfltWindowSize
Definition TFTP.h:70
void FreeDirectory(Bool_t print=kFALSE)
Free a remotely open directory via rootd.
Definition TFTP.cxx:956
Int_t GetPathInfo(const char *path, FileStat_t &buf, Bool_t print=kFALSE)
Get info about a file.
Definition TFTP.cxx:1029
Bool_t OpenDirectory(const char *name, Bool_t print=kFALSE)
Open a directory via rootd.
Definition TFTP.cxx:914
TSocket * GetSocket() const
Definition TFTP.h:108
const char * GetDirEntry(Bool_t print=kFALSE)
Get directory entry via rootd.
Definition TFTP.cxx:988
Int_t Close()
Close ftp connection.
Definition TFTP.cxx:884
Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists, Bool_t print=kFALSE)
Returns kFALSE if one can access a file using the specified access mode.
Definition TFTP.cxx:1111
Bool_t IsOpen() const
Definition TFTP.h:85
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:51
static std::atomic< Long64_t > fgBytesRead
Number of bytes read by all TFile objects.
Definition TFile.h:129
Int_t fReadCalls
Number of read calls ( not counting the cache calls )
Definition TFile.h:87
static void SetFileBytesWritten(Long64_t bytes=0)
Definition TFile.cxx:4581
Long64_t fBytesRead
Number of bytes read from this file.
Definition TFile.h:74
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
Definition TFile.cxx:2126
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
Definition TFile.cxx:4736
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
Definition TFile.cxx:4553
static void SetFileBytesRead(Long64_t bytes=0)
Definition TFile.cxx:4578
static void SetFileReadCalls(Int_t readcalls=0)
Definition TFile.cxx:4584
TUrl fUrl
!URL of file
Definition TFile.h:108
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
Definition TFile.cxx:2483
static Long64_t GetFileBytesRead()
Static function returning the total number of bytes read from all files.
Definition TFile.cxx:4544
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
Definition TFile.cxx:1853
virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read the nbuf blocks described in arrays pos and len.
Definition TFile.cxx:1785
Long64_t fArchiveOffset
!Offset at which file starts in archive
Definition TFile.h:99
virtual void Init(Bool_t create)
Initialize a TFile object.
Definition TFile.cxx:589
TString fOption
File options.
Definition TFile.h:89
ERelativeTo
Definition TFile.h:190
Int_t fD
File descriptor.
Definition TFile.h:80
Bool_t FlushWriteCache()
Flush the write cache if active.
Definition TFile.cxx:1122
Long64_t fBytesWrite
Number of bytes written to this file.
Definition TFile.h:73
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
Definition TFile.cxx:2217
Long64_t fOffset
!Seek offset cache
Definition TFile.h:94
static std::atomic< Long64_t > fgBytesWrite
Number of bytes written by all TFile objects.
Definition TFile.h:128
void Close(Option_t *option="") override
Close a file.
Definition TFile.cxx:914
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
Definition TFile.h:131
@ kWriteError
Definition TFile.h:185
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
Definition TFile.cxx:4561
TString fTitle
Definition TNamed.h:33
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
A TNetFile is like a normal TFile except that it reads and writes its data via a rootd server (for mo...
Definition TNetFile.h:34
void Init(Bool_t create) override
Initialize a TNetFile object.
Definition TNetFile.cxx:236
Bool_t ReadBuffer(char *buf, Int_t len) override
Read specified byte range from remote file via rootd daemon.
Definition TNetFile.cxx:300
Bool_t WriteBuffer(const char *buf, Int_t len) override
Write specified byte range to remote file via rootd daemon.
Definition TNetFile.cxx:488
Bool_t Matches(const char *url) override
Return kTRUE if 'url' matches the coordinates of this file.
Definition TNetFile.cxx:761
virtual void Create(const char *url, Option_t *option, Int_t netopt)
Create a NetFile object.
Definition TNetFile.cxx:659
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime) override
Return file stat information.
Definition TNetFile.cxx:156
Int_t fProtocol
Definition TNetFile.h:40
Int_t SysClose(Int_t fd) override
Close currently open file.
Definition TNetFile.cxx:144
virtual void ConnectServer(Int_t *stat, EMessageTypes *kind, Int_t netopt, Int_t tcpwindowsize, Bool_t forceOpen, Bool_t forceRead)
Connect to remote rootd server.
Definition TNetFile.cxx:570
void Print(Option_t *option) const override
Print some info about the net file.
Definition TNetFile.cxx:255
Bool_t IsOpen() const override
Retruns kTRUE if file is open, kFALSE otherwise.
Definition TNetFile.cxx:247
Int_t Recv(Int_t &status, EMessageTypes &kind)
Return status from rootd server and message kind.
Definition TNetFile.cxx:546
Int_t ReOpen(Option_t *mode) override
Reopen a file with a different access mode, like from READ to UPDATE or from NEW, CREATE,...
Definition TNetFile.cxx:285
TNetFile()
Definition TNetFile.h:64
TUrl fEndpointUrl
Definition TNetFile.h:37
Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) override
Read a list of buffers given in pos[] and len[] and return it in a single buffer.
Definition TNetFile.cxx:384
TString fUser
Definition TNetFile.h:38
void Flush() override
Flush file to disk.
Definition TNetFile.cxx:225
void PrintError(const char *where, Int_t err)
Print error string depending on error code.
Definition TNetFile.cxx:270
Int_t fNetopt
Definition TNetFile.h:42
void Seek(Long64_t offset, ERelativeTo pos=kBeg) override
Set position from where to start reading.
Definition TNetFile.cxx:562
Int_t fErrorCode
Definition TNetFile.h:41
void Close(Option_t *option="") override
Close remote file.
Definition TNetFile.cxx:208
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode) override
Open a remote file. Requires fOption to be set correctly.
Definition TNetFile.cxx:109
virtual ~TNetFile()
TNetFile dtor. Send close message and close socket.
Definition TNetFile.cxx:101
TSocket * fSocket
Definition TNetFile.h:39
TString fLocalPrefix
Definition TNetFile.h:103
void Create(const char *url, TSocket *sock=nullptr)
Create a TNetSystem object.
Definition TNetFile.cxx:858
Int_t MakeDirectory(const char *name) override
Make a directory via rootd.
Definition TNetFile.cxx:960
TString fHost
Definition TNetFile.h:91
TString fUser
Definition TNetFile.h:93
TNetSystem(const TNetSystem &)=delete
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
Definition TNetFile.cxx:834
Bool_t fDir
Definition TNetFile.h:88
int Unlink(const char *path) override
Remove a path.
virtual ~TNetSystem()
Destructor.
Definition TNetFile.cxx:936
void * fDirp
Definition TNetFile.h:89
Bool_t ConsistentWith(const char *path, void *dirptr) override
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Bool_t fFTPOwner
Definition TNetFile.h:92
TFTP * fFTP
Definition TNetFile.h:90
Int_t GetPathInfo(const char *path, FileStat_t &buf) override
Get info about a file.
const char * GetDirEntry(void *dirp=nullptr) override
Get directory entry via rootd. Returns 0 in case no more entries.
Int_t fPort
Definition TNetFile.h:94
void FreeDirectory(void *dirp=nullptr) override
Free directory via rootd.
Bool_t AccessPathName(const char *path, EAccessMode mode) override
Returns FALSE if one can access a file using the specified access mode.
Bool_t fIsLocal
Definition TNetFile.h:102
void * OpenDirectory(const char *name) override
Open a directory and return an opaque pointer to a dir structure.
Definition TNetFile.cxx:982
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:956
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:774
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:970
void MakeZombie()
Definition TObject.h:53
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:944
const char * GetHost() const
Definition TSecContext.h:75
const char * GetUser() const
Definition TSecContext.h:82
void HandleDelayedSignal()
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Definition TSocket.cxx:818
Int_t GetRemoteProtocol() const
Definition TSocket.h:126
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
Definition TSocket.cxx:898
TSecContext * GetSecContext() const
Definition TSocket.h:127
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
Definition TSocket.cxx:620
static TSocket * CreateAuthSocket(const char *user, const char *host, Int_t port, Int_t size=0, Int_t tcpwindowsize=-1, TSocket *s=nullptr, Int_t *err=nullptr)
Creates a socket or a parallel socket and authenticates to the remote server specified in 'url' on re...
Definition TSocket.cxx:1432
const char * GetUrl() const
Definition TSocket.h:130
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition TSocket.cxx:522
virtual Bool_t IsAuthenticated() const
Definition TSocket.h:131
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:421
TString & Insert(Ssiz_t pos, const char *s)
Definition TString.h:661
const char * Data() const
Definition TString.h:380
void ToUpper()
Change string to upper case.
Definition TString.cxx:1183
Bool_t IsNull() const
Definition TString.h:418
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:636
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:651
Abstract base class defining a generic interface to the underlying Operating System.
Definition TSystem.h:266
virtual void IgnoreInterrupt(Bool_t ignore=kTRUE)
If ignore is true ignore the interrupt signal, else restore previous behaviour.
Definition TSystem.cxx:605
static void ResetErrno()
Static function resetting system error number.
Definition TSystem.cxx:279
static Int_t GetErrno()
Static function returning system error number.
Definition TSystem.cxx:263
virtual void FreeDirectory(void *dirp)
Free a directory.
Definition TSystem.cxx:848
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition TSystem.cxx:839
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
Definition TSystem.cxx:1308
virtual int MakeDirectory(const char *name)
Make a directory.
Definition TSystem.cxx:830
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition TSystem.cxx:1401
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1299
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
Definition TSystem.cxx:856
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1384
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
Definition TSystem.cxx:1602
virtual Bool_t ConsistentWith(const char *path, void *dirptr=nullptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Definition TSystem.cxx:807
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition TTimeStamp.h:45
This class represents a WWW compatible URL.
Definition TUrl.h:33
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Definition TUrl.cxx:390
const char * GetFile() const
Definition TUrl.h:69
Bool_t IsValid() const
Definition TUrl.h:79
const char * GetUser() const
Definition TUrl.h:65
const char * GetHost() const
Definition TUrl.h:67
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
Definition TUrl.cxx:472
const char * GetOptions() const
Definition TUrl.h:71
const char * GetProtocol() const
Definition TUrl.h:64
Int_t GetPort() const
Definition TUrl.h:78
const Int_t n
Definition legend1.C:16
static const char * what
Definition stlLoader.cc:6
TString fUser
Definition TSystem.h:141