50 Info(
"Notify",
"Processing interrupt signal ...");
61static const char *
gScriptCmd =
"\\\"%s %d localhost:%d/%s -d=%d\\\"";
63static const char *
gSshCmd =
"ssh %s -f4 %s -R %d:localhost:%d sh -c \
64 \"'(sh=\\`basename \'\\\\\\$SHELL\'\\`; \
65 if test xbash = x\'\\\\\\$sh\' -o xsh = x\'\\\\\\$sh\' -o xzsh = x\'\\\\\\$sh\' -o xdash = x\'\\\\\\$sh\'; then \
66 \'\\\\\\$SHELL\' -l -c %s; \
67 elif test xcsh = x\'\\\\\\$sh\' -o xtcsh = x\'\\\\\\$sh\' -o xksh = x\'\\\\\\$sh\'; then \
68 \'\\\\\\$SHELL\' -c %s; \
70 echo \\\"Unknown shell \'\\\\\\$SHELL\'\\\"; \
73static const char *
gSshCmd =
"ssh %s -f4 %s -R %d:localhost:%d sh -c \
74 \"'(sh=`basename $SHELL`; \
75 if test xbash = x$sh -o xsh = x$sh -o xzsh = x$sh -o xdash = x$sh; then \
77 elif test xcsh = x$sh -o xtcsh = x$sh -o xksh = x$sh; then \
80 echo \"Unknown shell $SHELL\"; \
102 TString user = (
pw) ? (
const char*)
pw->fUser :
"";
129 if (!
ss || !
ss->IsValid()) {
130 Error(
"TApplicationRemote",
"unable to find a free port for connections");
148 Error(
"TApplicationRemote",
"illegal script name <");
152 sc.ReplaceAll(
"\"",
"");
156 const char *
verb =
"";
169 Info(
"TApplicationRemote",
"executing: %s",
cmd.Data());
171 Info(
"TApplicationRemote",
"an error occurred during SSH connection");
172 mon->DeActivateAll();
185 Error(
"TApplicationRemote",
"failed to open connection");
191 mon->DeActivateAll();
199 Error(
"TApplicationRemote",
"failed to receive startup message");
208 Error(
"TApplicationRemote",
"failed to receive remote server protocol");
214 Info(
"TApplicationRemote",
"server runs a different protocol version: %d (vs %d)",
220 Error(
"TApplicationRemote",
"failed to receive server info - protocol error");
240 gROOT->GetListOfSockets()->Add(
this);
257 gROOT->GetListOfSockets()->Remove(
this);
270 Error(
"Broadcast",
"could not send message");
287 if (str)
mess.WriteString(str);
299 mess.WriteObject(obj);
312 Error(
"Broadcast",
"could not send raw buffer");
350 if (s && s != (
TSocket *)(-1)) {
356 Info(
"Collect",
"deactivating %p", s);
418 Info(
"CollectInput",
"what %d",
what);
430 if (
TString(
robj->GetClassName()) ==
"TSystemDirectory") {
445 gROOT->RefreshBrowsers();
458 Info(
"CollectInput",
"type %d",
type);
464 mess->ReadString(str,
sizeof(str));
470 "server requested an object that we do not have");
496 Info(
"CollectInput",
"kRTT_LogDone: status %d",
st);
522 Error(
"CollectInput",
"file %s not found in path(s) %s",
544 Info(
"CollectInput",
"no associated header file"
545 " found: tried: %s %s",
554 Info(
"CollectInput",
"problems sending file %s",
impfile.Data());
560 Info(
"CollectInput",
"problems sending file %s",
headfile.Data());
574 Warning(
"CollectInput",
"unknown type received from server: %d",
type);
582 Error(
"CollectInput",
"unknown command received from server: %d",
what);
609 Warning(
"RecvLogFile",
"file descriptor for outputs undefined (%d):"
610 " will not log msgs",
fdout);
640 }
else if (
rec < 0) {
641 Error(
"RecvLogFile",
"error during receiving log file");
653 if (!
IsValid() || !obj)
return -1;
656 mess.WriteObject(obj);
686 if (
fs->fModtime != modtime) {
689 if ((*
md5) !=
fs->fMD5) {
692 fs->fModtime = modtime;
696 Error(
"CheckFile",
"could not calculate local MD5 check sum - dont send");
710 Error(
"CheckFile",
"could not calculate local MD5 check sum - dont send");
727 Warning(
"CheckFile",
"received wrong type:"
728 " %d (expected %d): protocol error?",
734 Error(
"CheckFile",
"received wrong message: %d (expected %d)",
738 Error(
"CheckFile",
"received empty message");
771 SysError(
"SendFile",
"cannot open file %s", file);
779 Error(
"SendFile",
"cannot stat file %s", file);
784 Error(
"SendFile",
"empty file %s", file);
805 Info(
"SendFile",
"sending file %s", file);
824 SysError(
"SendFile",
"error reading from file %s", file);
831 SysError(
"SendFile",
"error writing to server @ %s:%d (now offline)",
875 ::Info(
"TApplicationRemote::SetPortParam",
"port scan: %d attempts in [%d,%d]",
923 if (opt && opt[0] ==
'F') {
943 Info(
"Interrupt",
"*** Ctrl-C not yet enabled *** (type= %d)",
type);
953 Error(
"Interrupt",
"error sending oobc to server");
983 Error(
"Interrupt",
"error receiving waste from server");
987 }
else if (
n == -3) {
993 Error(
"Interrupt",
"server does not respond");
997 Error(
"Interrupt",
"error receiving OOB from server");
1024 Error(
"Interrupt",
"error receiving waste (2) from server");
1030 Info(
"Interrupt",
"server synchronized: %d bytes discarded",
nbytes);
1059 gROOT->RefreshBrowsers();
const Int_t kRRemote_Protocol
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
const char Option_t
Option string (const char)
static const char * gSshCmd
static const char * gScript
static const char * gScriptCmd
R__EXTERN TApplication * gApplication
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
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.
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
This code implements the MD5 message-digest algorithm.
static TMD5 * FileChecksum(const char *file)
Returns checksum of specified file.
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 * 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.
void Add(TObject *obj) override
This class implements server sockets.
void Add() override
Add signal handler to system signal handler list.
void Remove() override
Remove signal handler from system signal handler list.
This class implements client sockets.
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 Int_t Send(const TMessage &mess)
Send a TMessage object.
TString & Insert(Ssiz_t pos, const char *s)
const char * Data() const
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)