Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TCivetweb.h
Go to the documentation of this file.
1// Author: Sergey Linev 21/12/2013
2
3/*************************************************************************
4 * Copyright (C) 1995-2022, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_TCivetweb
12#define ROOT_TCivetweb
13
14#include "THttpEngine.h"
15#include "TString.h"
16
17#include <mutex>
18
19#include "../civetweb/civetweb.h"
20
21class TCivetweb : public THttpEngine {
22protected:
23 struct mg_context *fCtx{nullptr}; ///<! civetweb context
24 struct mg_callbacks fCallbacks; ///<! call-back table for civetweb webserver
25 Int_t fNumThreads{10}; ///<! number of configured threads
26 Int_t fNumActiveThreads{0}; ///<! number of active threads - used in request and websocket handling
27 std::mutex fMutex; ///<! mutex to read/write fNumActiveThreads
28 TString fTopName; ///<! name of top item
29 Bool_t fWebGui{kFALSE}; ///<! if server used for webgui
30 Bool_t fDebug{kFALSE}; ///<! debug mode
31 Bool_t fTerminating{kFALSE}; ///<! server doing shutdown and not react on requests
32 Bool_t fOnlySecured{kFALSE}; ///<! if server should run only https protocol
33 Int_t fMaxAge{3600}; ///<! max-age parameter
34 Bool_t fWinSymLinks{kTRUE}; ///<! resolve symbolic links on Windows
35
36 void Terminate() override { fTerminating = kTRUE; }
37
38 Bool_t IsSecured() const { return fOnlySecured; }
39
40public:
41 TCivetweb(Bool_t only_secured = kFALSE);
42 virtual ~TCivetweb();
43
44 Bool_t Create(const char *args) override;
45
46 Int_t GetNumThreads() const { return fNumThreads; }
47
49
50 Int_t ChangeNumActiveThrerads(int cnt = 0);
51
52 const char *GetTopName() const { return fTopName.Data(); }
53
54 Bool_t IsWebGui() const { return fWebGui; }
55
56 Bool_t IsDebugMode() const { return fDebug; }
57
58 Bool_t IsTerminating() const { return fTerminating; }
59
60 Bool_t IsWinSymLinks() const { return fWinSymLinks; }
61
62 Int_t ProcessLog(const char *message);
63
64 Int_t GetMaxAge() const { return fMaxAge; }
65};
66
67#endif
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
THttpEngine implementation, based on civetweb embedded server.
Definition TCivetweb.h:21
Int_t fNumThreads
! number of configured threads
Definition TCivetweb.h:25
Int_t fNumActiveThreads
! number of active threads - used in request and websocket handling
Definition TCivetweb.h:26
struct mg_context * fCtx
! civetweb context
Definition TCivetweb.h:23
std::mutex fMutex
! mutex to read/write fNumActiveThreads
Definition TCivetweb.h:27
Bool_t fWinSymLinks
! resolve symbolic links on Windows
Definition TCivetweb.h:34
Bool_t IsTerminating() const
Definition TCivetweb.h:58
Int_t GetMaxAge() const
Definition TCivetweb.h:64
const char * GetTopName() const
Definition TCivetweb.h:52
Int_t fMaxAge
! max-age parameter
Definition TCivetweb.h:33
Bool_t IsWebGui() const
Definition TCivetweb.h:54
Int_t ProcessLog(const char *message)
process civetweb log message, can be used to detect critical errors
TString fTopName
! name of top item
Definition TCivetweb.h:28
Int_t GetNumAvailableThreads()
Returns number of actively used threads.
Bool_t fOnlySecured
! if server should run only https protocol
Definition TCivetweb.h:32
Bool_t fTerminating
! server doing shutdown and not react on requests
Definition TCivetweb.h:31
Bool_t Create(const char *args) override
Creates embedded civetweb server.
Int_t ChangeNumActiveThrerads(int cnt=0)
Returns number of actively used threads.
void Terminate() override
Method called when server want to be terminated.
Definition TCivetweb.h:36
Int_t GetNumThreads() const
Definition TCivetweb.h:46
Bool_t IsSecured() const
Definition TCivetweb.h:38
Bool_t IsDebugMode() const
Definition TCivetweb.h:56
virtual ~TCivetweb()
destructor
Bool_t IsWinSymLinks() const
Definition TCivetweb.h:60
Bool_t fWebGui
! if server used for webgui
Definition TCivetweb.h:29
Bool_t fDebug
! debug mode
Definition TCivetweb.h:30
struct mg_callbacks fCallbacks
! call-back table for civetweb webserver
Definition TCivetweb.h:24
Abstract class for implementing http protocol for THttpServer.
Definition THttpEngine.h:19
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376