50   Info(
"Notify",
"Processing interrupt signal ...");
 
   62static const char *
gScriptCmd = 
"\\\"%s %d localhost:%d/%s -d=%d\\\"";
 
   64static const char *
gSshCmd = 
"ssh %s -f4 %s -R %d:localhost:%d sh -c \ 
   65   \"'(sh=\\`basename \'\\\\\\$SHELL\'\\`; \ 
   66   if test xbash = x\'\\\\\\$sh\' -o xsh = x\'\\\\\\$sh\' -o xzsh = x\'\\\\\\$sh\' -o xdash = x\'\\\\\\$sh\'; then \ 
   67      \'\\\\\\$SHELL\' -l -c %s; \ 
   68   elif test xcsh = x\'\\\\\\$sh\' -o xtcsh = x\'\\\\\\$sh\' -o xksh = x\'\\\\\\$sh\'; then \ 
   69      \'\\\\\\$SHELL\' -c %s; \ 
   71      echo \\\"Unknown shell \'\\\\\\$SHELL\'\\\"; \ 
   74static const char *
gSshCmd = 
"ssh %s -f4 %s -R %d:localhost:%d sh -c \ 
   75   \"'(sh=`basename $SHELL`; \ 
   76   if test xbash = x$sh -o xsh = x$sh -o xzsh = x$sh -o xdash = x$sh; then \ 
   78   elif test xcsh = x$sh -o xtcsh = x$sh -o xksh = x$sh; then \ 
   81      echo \"Unknown shell $SHELL\"; \ 
  121   std::default_random_engine randomEngine(now);
 
  125      port = randomPort(randomEngine);
 
  131      Error(
"TApplicationRemote",
"unable to find a free port for connections");
 
  143   if (script && *script) {
 
  145      if (script[1] == 
'<') {
 
  149            Error(
"TApplicationRemote", 
"illegal script name <");
 
  157   const char *verb = 
"";
 
  170      Info(
"TApplicationRemote", 
"executing: %s", cmd.
Data());
 
  172      Info(
"TApplicationRemote", 
"an error occured during SSH connection");
 
  186      Error(
"TApplicationRemote", 
"failed to open connection");
 
  200      Error(
"TApplicationRemote", 
"failed to receive startup message");
 
  209      Error(
"TApplicationRemote", 
"failed to receive remote server protocol");
 
  215      Info(
"TApplicationRemote",
"server runs a different protocol version: %d (vs %d)",
 
  221      Error(
"TApplicationRemote", 
"failed to receive server info - protocol error");
 
  241   gROOT->GetListOfSockets()->Add(
this);
 
  258   gROOT->GetListOfSockets()->Remove(
this);
 
  271      Error(
"Broadcast", 
"could not send message");
 
  313      Error(
"Broadcast", 
"could not send raw buffer");
 
  345   Int_t rc = 0, cnt = 0;
 
  351      if (s && s != (
TSocket *)(-1)) {
 
  357               Info(
"Collect",
"deactivating %p", s);
 
  371         if (s == (
TSocket *)(-1) && nto > 0)
 
  419      Info(
"CollectInput",
"what %d", 
what);
 
  446                  gROOT->RefreshBrowsers();
 
  459               Info(
"CollectInput",
"type %d", 
type);
 
  471                             "server requested an object that we do not have");
 
  497                        Info(
"CollectInput",
"kRTT_LogDone: status %d", st);
 
  505                     (*mess) >> msg >> lfeed;
 
  507                        fprintf(stderr,
"%s\n", msg.
Data());
 
  509                        fprintf(stderr,
"%s\r", msg.
Data());
 
  523                        Error(
"CollectInput", 
"file %s not found in path(s) %s",
 
  545                                 Info(
"CollectInput", 
"no associated header file" 
  546                                                 " found: tried: %s %s",
 
  547                                                 h.Data(), headfile.
Data());
 
  555                           Info(
"CollectInput", 
"problems sending file %s", impfile.
Data());
 
  561                              Info(
"CollectInput", 
"problems sending file %s", headfile.
Data());
 
  575                  Warning(
"CollectInput",
"unknown type received from server: %d", 
type);
 
  583         Error(
"CollectInput", 
"unknown command received from server: %d", 
what);
 
  604   const Int_t kMAXBUF = 16384;  
 
  608   Int_t fdout = fileno(stdout);
 
  610      Warning(
"RecvLogFile", 
"file descriptor for outputs undefined (%d):" 
  611                             " will not log msgs", fdout);
 
  614   lseek(fdout, (off_t) 0, SEEK_END);
 
  619   while (filesize < 
size) {
 
  624      filesize = (rec > 0) ? (filesize + rec) : filesize;
 
  632            w = write(fdout, 
p, 
r);
 
  635               SysError(
"RecvLogFile", 
"error writing to unit: %d", fdout);
 
  641      } 
else if (rec < 0) {
 
  642         Error(
"RecvLogFile", 
"error during receiving log file");
 
  654   if (!
IsValid() || !obj) 
return -1;
 
  687      if (
fs->fModtime != modtime) {
 
  690            if ((*md5) != 
fs->fMD5) {
 
  693               fs->fModtime  = modtime;
 
  697            Error(
"CheckFile", 
"could not calculate local MD5 check sum - dont send");
 
  711         Error(
"CheckFile", 
"could not calculate local MD5 check sum - dont send");
 
  725            (*reply) >> 
type >> uptodate;
 
  728               Warning(
"CheckFile", 
"received wrong type:" 
  729                                    " %d (expected %d): protocol error?",
 
  735            Error(
"CheckFile", 
"received wrong message: %d (expected %d)",
 
  739         Error(
"CheckFile", 
"received empty message");
 
  780      Error(
"SendFile", 
"cannot stat file %s", 
file);
 
  785      Error(
"SendFile", 
"empty file %s", 
file);
 
  794   const Int_t kMAXBUF = 32768;  
 
  806      Info(
"SendFile", 
"sending file %s", 
file);
 
  817      lseek(fd, 0, SEEK_SET);
 
  825            SysError(
"SendFile", 
"error reading from file %s", 
file);
 
  832            SysError(
"SendFile", 
"error writing to server @ %s:%d (now offline)",
 
  876   ::Info(
"TApplicationRemote::SetPortParam",
"port scan: %d attempts in [%d,%d]",
 
  890   if (!strncasecmp(
line, 
".q", 2)) {
 
  896   if (!strncmp(
line, 
"?", 1)) {
 
  924   if (opt && opt[0] == 
'F') {
 
  944   Info(
"Interrupt", 
"*** Ctrl-C not yet enabled *** (type= %d)", 
type);
 
  948   char oobc = (char) 
type;
 
  949   const int kBufSize = 1024;
 
  950   char waste[kBufSize];
 
  954      Error(
"Interrupt", 
"error sending oobc to server");
 
  960      int   n, nch, nbytes = 0, nloop = 0;
 
  981            if (nch > kBufSize) nch = kBufSize;
 
  984               Error(
"Interrupt", 
"error receiving waste from server");
 
  988         } 
else if (
n == -3) {   
 
  994               Error(
"Interrupt", 
"server does not respond");
 
  998            Error(
"Interrupt", 
"error receiving OOB from server");
 
 1022         if (nch > kBufSize) nch = kBufSize;
 
 1025            Error(
"Interrupt", 
"error receiving waste (2) from server");
 
 1031         Info(
"Interrupt", 
"server synchronized: %d bytes discarded", nbytes);
 
 1060   gROOT->RefreshBrowsers();
 
const Int_t kRRemote_Protocol
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
static const char * gSshCmd
 
static const char * gScript
 
static const char * gScriptCmd
 
R__EXTERN TApplication * gApplication
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
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 r
 
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 length
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
 
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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
 
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 type
 
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
 
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
 
R__EXTERN TSystem * gSystem
 
TApplicationRemote * fApplicationRemote
 
Bool_t Notify() override
TApplicationRemote interrupt handler.
 
Int_t CollectInput()
Collect and analyze available input from the socket.
 
TObject * fReceivedObject
 
TApplicationRemote(const char *url, Int_t debug=0, const char *script=nullptr)
Main constructor: start a remote session at 'url' accepting callbacks on local port 'port'; if port i...
 
virtual ~TApplicationRemote()
Destructor.
 
void Terminate(Int_t status=0) override
Terminate this session.
 
Int_t BroadcastRaw(const void *buffer, Int_t length)
Broadcast a raw buffer of specified length to the remote session.
 
Bool_t CheckFile(const char *file, Long_t modtime)
Check if a file needs to be send to the server.
 
static void SetPortParam(Int_t lower=-1, Int_t upper=-1, Int_t attempts=-1)
Set port parameters for tunnelling. A value of -1 means unchanged.
 
TRemoteObject * fWorkingDir
 
void Print(Option_t *option="") const override
Print some info about this instance.
 
void Browse(TBrowser *b) override
Browse remote application (working directory and ROOT files).
 
void Interrupt(Int_t type=kRRI_Hard)
Send interrupt OOB byte to server.
 
Int_t SendFile(const char *file, Int_t opt=kAscii, const char *rfile=nullptr)
Send a file to the server.
 
void RecvLogFile(Int_t size)
Receive the log file from the server.
 
TSeqCollection * fRootFiles
 
Longptr_t ProcessLine(const char *line, Bool_t=kFALSE, Int_t *error=nullptr) override
Parse a single command line and forward the request to the remote server where it will be processed.
 
Int_t BroadcastObject(const TObject *obj, Int_t kind=kMESS_OBJECT)
Broadcast an object to the remote session.
 
Int_t SendObject(const TObject *obj)
Send object to server.
 
Int_t Collect(Long_t timeout=-1)
Collect responses from the remote server.
 
static Int_t fgPortAttempts
 
TSignalHandler * fIntHandler
 
Int_t Broadcast(const TMessage &mess)
Broadcast a message to the remote session.
 
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
 
virtual Longptr_t ProcessLine(const char *line, Bool_t sync=kFALSE, Int_t *error=nullptr)
Process a single command line, either a C++ statement or an interpreter command starting with a "....
 
virtual void Help(const char *line)
The function lists useful commands (".help") or opens the online reference guide, generated with Doxy...
 
void InitializeGraphics(Bool_t only_web=kFALSE)
Initialize the graphics environment.
 
static void NeedGraphicsLibs()
Static method.
 
Using a TBrowser one can browse all ROOT objects.
 
TObject * ReadObject(const TClass *cl) override
Read object from I/O buffer.
 
void WriteString(const char *s) override
Write string to I/O buffer.
 
char * ReadString(char *s, Int_t max) override
Read string from I/O buffer.
 
void WriteObject(const TObject *obj, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
 
void SetName(const char *name)
 
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
 
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
 
TObject * FindObject(const char *name) const override
Find object using its name.
 
void Add(TObject *obj) override
 
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
 
This code implements the MD5 message-digest algorithm.
 
static TMD5 * FileChecksum(const char *file)
Returns checksum of specified file.
 
TClass * GetClass() const
 
virtual void ActivateAll()
Activate all de-activated sockets.
 
TSocket * Select()
Return pointer to socket for which an event is waiting.
 
virtual void Add(TSocket *sock, Int_t interest=kRead)
Add socket to the monitor's active list.
 
Int_t GetActive(Long_t timeout=-1) const
Return number of sockets in the active list.
 
virtual void DeActivateAll()
De-activate all activated sockets.
 
virtual void DeActivate(TSocket *sock)
De-activate a socket.
 
const char * GetName() const override
Returns name of object.
 
const char * GetTitle() const override
Returns title of object.
 
Mother of all ROOT objects.
 
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
 
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
 
virtual const char * ClassName() const
Returns name of class to which the object belongs.
 
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
 
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
 
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
 
@ kInvalidObject
if object ctor succeeded but object should not be used
 
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
 
static const char * GetMacroPath()
Get macro search path. Static utility function.
 
The TRemoteObject class provides protocol for browsing ROOT objects from a remote ROOT session.
 
const char * GetClassName() const
 
void Add(TObject *obj) override
 
virtual TSocket * Accept(UChar_t Opt=0)
Accept a connection on a server socket.
 
void Add() override
Add signal handler to system signal handler list.
 
void Remove() override
Remove signal handler from system signal handler list.
 
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
 
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
 
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
 
Option_t * GetOption() const override
 
virtual Int_t SendObject(const TObject *obj, Int_t kind=kMESS_OBJECT)
Send an object.
 
virtual Bool_t IsValid() const
 
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
 
TString & Insert(Ssiz_t pos, const char *s)
 
const char * Data() const
 
TString & ReplaceAll(const TString &s1, const TString &s2)
 
Ssiz_t Last(char c) const
Find last occurrence of a character c.
 
TString & Remove(Ssiz_t pos)
 
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
 
static void ResetErrno()
Static function resetting system error number.
 
static Int_t GetErrno()
Static function returning system error number.
 
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
 
virtual Int_t Exec(const char *shellcmd)
Execute a command.
 
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.
 
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
 
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
 
virtual Int_t GetEffectiveUid()
Returns the effective user id.
 
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
 
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
 
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
 
const char * GetFile() const
 
const char * GetUser() const
 
const char * GetHost() const
 
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
 
const char * GetOptions() const
 
void SetHost(const char *host)