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