49   const char *
undef = 
"<undefined>";
 
   55   if (
svalue == 
"yes") 
return 1;
 
   56   if (
svalue == 
"no") 
return 0;
 
 
   80   static std::shared_ptr<RWebWindowsManager> 
sInstance = std::make_shared<RWebWindowsManager>();
 
 
  133      printf(
"Disabling loopback mode may leads to security problem.\n");
 
  134      printf(
"See https://root.cern/about/security/ for more information.\n\n");
 
  136         printf(
"Enforce session key to safely work on public network.\n");
 
  137         printf(
"One may call RWebWindowsManager::SetUseSessionKey(false); to disable it.\n");
 
 
  180   std::vector<unsigned char> buf(
keylen, 0);
 
  187      if ((
n > 0) && (
n % 4 == 0))
 
  192      key.append(t.Data());
 
 
  241      R__LOG_ERROR(
WebGUILog()) << 
"Problem with open listener socket " << 
fname << 
", check ROOT_LISTENER_SOCKET environment variable";
 
 
  353   if (
gROOT->GetWebDisplay() == 
"off")
 
  357   std::lock_guard<std::recursive_mutex> 
grd(
fMutex);
 
  361      fServer = std::make_unique<THttpServer>(
"basic_sniffer");
 
  459   while (
ntry-- >= 0) {
 
  462            R__LOG_ERROR(
WebGUILog()) << 
"Wrong HTTP range configuration, check WebGui.HttpPortMin/Max variables";
 
  472         if (!
fServer->CreateEngine(engine))
 
  486               engine.
Append(
"loopback&");
 
  487               url.Append(
"localhost");
 
  492               url.Append(
"localhost");
 
  502            engine.
Append(
"&ssl_cert=");
 
  511         if (
fServer->CreateEngine(engine)) {
 
 
  539   std::lock_guard<std::recursive_mutex> 
grd(
fMutex);
 
  546   std::shared_ptr<RWebWindow> 
win = std::make_shared<RWebWindow>();
 
  558      std::string 
fname, prefix;
 
  560         prefix = std::string(
"f") + std::to_string(
fIdCnt) + 
"_";
 
  561         fname = std::string(
"protcol") + std::to_string(
fIdCnt) + 
".json";
 
  563         fname = 
"protocol.json";
 
  572      win->fUseProcessEvents = 
true;
 
  576      win->UseServerThreads();
 
 
  607   std::string 
addr = 
"/";
 
  608   addr.append(
win.fWSHandler->GetName());
 
  616      key = 
win.GenerateKey();
 
  618      addr.append(
"?key=");
 
  621      std::unique_ptr<ROOT::RWebDisplayHandle> dummy;
 
  622      win.AddDisplayHandle(
false, key, dummy);
 
  626   if (!
token.empty()) {
 
  628      addr.append(
"token=");
 
 
  707         auto handle = std::make_unique<RWebDisplayHandle>(
"");
 
  708         win.AddDisplayHandle(
false, 
"", handle);
 
  736   std::lock_guard<std::recursive_mutex> 
grd(
fMutex);
 
  759      std::cout << 
"New web window: " << args.
GetUrl() << std::endl;
 
  763   if (
fAddr.compare(0,9,
"socket://") == 0)
 
  766#if !defined(R__MACOSX) && !defined(R__WIN32) 
  768      const char *
varname = 
"WebGui.CheckRemoteDisplay";
 
  774               "ROOT web-based widget started in the session where DISPLAY set to " << 
displ << 
"\n" <<
 
  775               "Means web browser will be displayed on remote X11 server which is usually very inefficient\n" 
  776               "One can start ROOT session in server mode like \"root -b --web=server:8877\" and forward http port to display node\n" 
  777               "Or one can use rootssh script to configure port forwarding and display web widgets automatically\n" 
  778               "Find more info on https://root.cern/for_developers/root7/#rbrowser\n" 
  779               "This message can be disabled by setting \"" << 
varname << 
": no\" in .rootrc file\n";
 
  787   if (
win.IsUseCurrentDir())
 
  788      server->AddLocation(
"currentdir/", 
".");
 
 
  817   int res = 0, cnt = 0;
 
  820   auto start = std::chrono::high_resolution_clock::now();
 
  835         std::this_thread::sleep_for(std::chrono::milliseconds(cnt > 5000 ? 10 : 1));
 
  837      std::chrono::duration<double, std::milli> 
elapsed = std::chrono::high_resolution_clock::now() - start;
 
 
#define R__LOG_ERROR(...)
 
static bool gWebWinMainThrdSet
 
static std::thread::id gWebWinMainThrd
This thread id used to identify main application thread, where ROOT event processing runs To inject c...
 
static bool gWebWinLoopbackMode
 
static bool gWebWinUseSessionKey
 
R__EXTERN TApplication * gApplication
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
 
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 win
 
R__EXTERN TRandom * gRandom
 
R__EXTERN TSystem * gSystem
 
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
 
std::string GetBrowserName() const
Returns configured browser name.
 
EBrowserKind GetBrowserKind() const
returns configured browser kind, see EBrowserKind for supported values
 
RWebDisplayArgs & SetX(int x=-1)
set preferable web window x position, negative is default
 
bool IsSupportHeadless() const
returns true if browser supports headless mode
 
RWebDisplayArgs & SetUrl(const std::string &url)
set window url
 
int GetWidth() const
returns preferable web window width
 
const std::string & GetUrl() const
returns window url
 
void AppendUrlOpt(const std::string &opt)
append extra url options, add "&" as separator if required
 
int GetY() const
set preferable web window y position
 
int GetHeight() const
returns preferable web window height
 
void SetHttpServer(THttpServer *serv)
set http server instance, used for window display
 
RWebDisplayArgs & SetWidth(int w=0)
set preferable web window width
 
bool IsInteractiveBrowser() const
returns true if interactive browser window supposed to be started
 
RWebDisplayArgs & SetY(int y=-1)
set preferable web window y position, negative is default
 
bool IsHeadless() const
returns headless mode
 
RWebDisplayArgs & SetHeight(int h=0)
set preferable web window height
 
@ kServer
indicates that ROOT runs as server and just printouts window URL, browser should be started by the us...
 
@ kOff
disable web display, do not start any browser
 
@ kEmbedded
window will be embedded into other, no extra browser need to be started
 
int GetX() const
set preferable web window x position
 
static bool NeedHttpServer(const RWebDisplayArgs &args)
Check if http server required for display.
 
static std::unique_ptr< RWebDisplayHandle > Display(const RWebDisplayArgs &args)
Create web display.
 
static int GetBoolEnv(const std::string &name, int dfl=-1)
Parse boolean gEnv variable which should be "yes" or "no".
 
Represents web window, which can be shown in web browser or any other supported environment.
 
static std::string GenerateKey(int keylen=32)
Static method to generate cryptographic key Parameter keylen defines length of cryptographic key in b...
 
bool fUseSessionKey
! is session key has to be used for data signing
 
bool CreateServer(bool with_http=false)
Creates http server, if required - with real http engine (civetweb) One could configure concrete HTTP...
 
static void SetUseConnectionKey(bool on=true)
Enable or disable usage of connection key (default on) If enabled, each connection (and reconnection)...
 
bool fExternalProcessEvents
! indicate that there are external process events engine
 
std::recursive_mutex fMutex
! main mutex, used for window creations
 
RWebWindowsManager()
window manager constructor Required here for correct usage of unique_ptr<THttpServer>
 
int WaitFor(RWebWindow &win, WebWindowWaitFunc_t check, bool timed=false, double tm=-1)
Waits until provided check function or lambdas returns non-zero value Regularly calls WebWindow::Sync...
 
WebWindowShowCallback_t fShowCallback
! function called for each RWebWindow::Show call
 
unsigned ShowWindow(RWebWindow &win, const RWebDisplayArgs &args)
Show window in specified location, see Show() method for more details.
 
std::string fAddr
! HTTP address of the server
 
void Terminate()
Terminate http server and ROOT application.
 
unsigned fIdCnt
! counter for identifiers
 
~RWebWindowsManager()
window manager destructor Required here for correct usage of unique_ptr<THttpServer>
 
THttpServer * GetServer() const
Returns THttpServer instance.
 
std::string fSessionKey
! secret session key used on client to code connections keys
 
bool fUseHttpThrd
! use special thread for THttpServer
 
static void AssignMainThrd()
Re-assigns main thread id Normally main thread id recognized at the moment when library is loaded It ...
 
static void SetUseSessionKey(bool on=true)
Enable or disable usage of session key (default on) If enabled, secrete session key used to calculate...
 
bool IsUseHttpThread() const
Returns true if http server use special thread for requests processing (default off)
 
bool fUseSenderThreads
! use extra threads for sending data from RWebWindow to clients
 
std::unique_ptr< THttpServer > fServer
! central communication with the all used displays
 
static void SetLoopbackMode(bool on=true)
Set loopback mode for THttpServer used for web widgets By default is on.
 
static bool IsMainThrd()
Returns true when called from main process Main process recognized at the moment when library is load...
 
static std::shared_ptr< RWebWindowsManager > & Instance()
Returns default window manager Used to display all standard ROOT elements like TCanvas or TFitPanel.
 
bool InformListener(const std::string &msg)
If ROOT_LISTENER_SOCKET variable is configured, message will be sent to that unix socket.
 
float fLaunchTmout
! timeout in seconds to start browser process, default 30s
 
std::string GetUrl(RWebWindow &win, bool remote=false, std::string *produced_key=nullptr)
Provide URL address to access specified window from inside or from remote.
 
void Unregister(RWebWindow &win)
Release all references to specified window Called from RWebWindow destructor.
 
static bool IsLoopbackMode()
Returns true if loopback mode used by THttpServer for web widgets.
 
std::shared_ptr< RWebWindow > CreateWindow()
Creates new window To show window, RWebWindow::Show() have to be called.
 
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
 
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
 
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
 
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
 
static const TString & GetDataDir()
Get the data directory in the installation. Static utility function.
 
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
 
Double_t Rndm() override
Machine independent random number generator.
 
virtual void Close(Option_t *opt="")
Close the socket.
 
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
 
virtual Bool_t IsValid() const
 
TString & Append(const char *cs)
 
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
 
static TString Itoa(Int_t value, Int_t base)
Converts an Int_t to a TString with respect to the base specified (2-36).
 
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
 
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
 
virtual const char * Getenv(const char *env)
Get environment variable.
 
virtual Int_t GetCryptoRandom(void *buf, Int_t len)
Return cryptographic random number Fill provided buffer with random values Returns number of bytes wr...
 
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
 
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
 
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
 
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
 
ROOT::Experimental::RLogChannel & WebGUILog()
Log channel for WebGUI diagnostics.
 
std::function< int(double)> WebWindowWaitFunc_t
function signature for waiting call-backs Such callback used when calling thread need to waits for so...