Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TApplicationRemote.h
Go to the documentation of this file.
1// @(#)root/net:$Id$
2// Author: G. Ganis 10/5/2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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#ifndef ROOT_TApplicationRemote
13#define ROOT_TApplicationRemote
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TApplicationRemote //
18// //
19// TApplicationRemote maps a remote session. It starts a remote session //
20// and takes care of redirecting the commands to be processed to the //
21// remote session, to collect the graphic output objects and to display //
22// them locally. //
23// //
24//////////////////////////////////////////////////////////////////////////
25
26#include "RRemoteProtocol.h"
27#include "TApplication.h"
28#include "TMD5.h"
29#include "TUrl.h"
30#include "TNamed.h"
31#include "TMessage.h"
32#include "TSysEvtHandler.h"
33#include "RtypesCore.h" // for Longptr_t
34
35
36class THashList;
37class TMonitor;
38class TSocket;
39class TBrowser;
40class TRemoteObject;
41class TSeqCollection;
42
44
45public:
47 kAscii = 0x0,
48 kBinary = 0x1,
49 kForce = 0x2
50 };
51 // TApplication specific bits
53 kCollecting = BIT(17) // TRUE while collecting from server
54 };
55
56private:
57 class TARFileStat : public TNamed {
58 public:
59 TARFileStat(const char *fn, TMD5 *md5, Long_t mt) :
60 TNamed(fn,fn), fMD5(*md5), fModtime(mt) { }
61 TMD5 fMD5; //file's md5
62 Long_t fModtime; //file's modification time
63 };
64
65 TString fName; //Unique name identifying this instance
66 Int_t fProtocol; //server protocol version number
67 TUrl fUrl; //server's url
68 TSocket *fSocket; //socket connection to server
69 TMonitor *fMonitor; //monitor for the input socket
70 Bool_t fInterrupt; //flag interrupt state
71 TSignalHandler *fIntHandler; //interrupt signal handler (ctrl-c)
72
73 TString fLogFilePath; //Full remote path to log file
74 THashList *fFileList; // List of files already uploaded
75
76 TObject *fReceivedObject; // last received object
77 TSeqCollection *fRootFiles; // list of (remote) root files
78 TRemoteObject *fWorkingDir; // working (remote) directory
79
80 static Int_t fgPortAttempts; // number of attempts to find a port
81 static Int_t fgPortLower; // lower bound for ports
82 static Int_t fgPortUpper; // upper bound for ports
83
84 Int_t Broadcast(const TMessage &mess);
85 Int_t Broadcast(const char *mess, Int_t kind = kMESS_STRING, Int_t type = kRRT_Undef);
86 Int_t Broadcast(Int_t kind, Int_t type = kRRT_Undef) { return Broadcast(nullptr, kind, type); }
88 Int_t BroadcastRaw(const void *buffer, Int_t length);
89 Bool_t CheckFile(const char *file, Long_t modtime);
90 Int_t Collect(Long_t timeout = -1);
92
94
95public:
96 TApplicationRemote(const char *url, Int_t debug = 0, const char *script = nullptr);
97 virtual ~TApplicationRemote();
98
99 void Browse(TBrowser *b) override;
100 Bool_t IsFolder() const override { return kTRUE; }
101 const char *ApplicationName() const override { return fName; }
102 Longptr_t ProcessLine(const char *line, Bool_t /*sync*/ = kFALSE, Int_t *error = nullptr) override;
103
104 Int_t SendFile(const char *file, Int_t opt = kAscii,
105 const char *rfile = nullptr);
106 Int_t SendObject(const TObject *obj);
107
109 Bool_t IsValid() const { return (fSocket) ? kTRUE : kFALSE; }
110
111 void Print(Option_t *option="") const override;
112
113 void Terminate(Int_t status = 0) override;
114
115 static void SetPortParam(Int_t lower = -1, Int_t upper = -1, Int_t attempts = -1);
116
117 ClassDefOverride(TApplicationRemote,0) //Remote Application Interface
118};
119
120//
121// TApplicationRemote Interrupt signal handler
122//
124private:
126public:
129 Bool_t Notify() override;
130};
131
132#endif
@ kMESS_STRING
@ kMESS_OBJECT
@ kRRT_Undef
@ kRRI_Hard
#define b(i)
Definition RSha256.hxx:100
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
long Long_t
Definition RtypesCore.h:54
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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 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 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
@ kSigInterrupt
TApplicationRemote * fApplicationRemote
Bool_t Notify() override
TApplicationRemote interrupt handler.
TARInterruptHandler(TApplicationRemote *r)
TARFileStat(const char *fn, TMD5 *md5, Long_t mt)
Int_t CollectInput()
Collect and analyze available input from the socket.
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.
const char * ApplicationName() const override
Int_t BroadcastObject(const TObject *obj, Int_t kind=kMESS_OBJECT)
Broadcast an object to the remote session.
Int_t Broadcast(Int_t kind, Int_t type=kRRT_Undef)
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
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...
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition THashList.h:34
This code implements the MD5 message-digest algorithm.
Definition TMD5.h:44
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
The TRemoteObject class provides protocol for browsing ROOT objects from a remote ROOT session.
Sequenceable collection abstract base class.
Basic string class.
Definition TString.h:139
This class represents a WWW compatible URL.
Definition TUrl.h:33
TLine * line
Definition file.py:1