MythTV  master
mythhttpserver.h
Go to the documentation of this file.
1 #ifndef MYTHHTTPSERVER_H
2 #define MYTHHTTPSERVER_H
3 
4 // Qt
5 #include <QHostInfo>
6 #include <QQueue>
7 
8 // MythTV
11 
13 {
14  Q_OBJECT
15 
16  friend class MythHTTPInstance;
17 
18  signals:
19  // Inbound
20  void EnableHTTP (bool Enable);
21  void AddPaths (const QStringList& Paths);
22  void RemovePaths (const QStringList& Paths);
23  void AddHandlers (const HTTPHandlers& Handlers);
24  void RemoveHandlers (const HTTPHandlers& Handlers);
25  void AddServices (const HTTPServices& Services);
26  void RemoveServices (const HTTPServices& Services);
27  void AddErrorPageHandler (const HTTPHandler& Handler);
28  // Outbound
29  void PathsChanged (const QStringList& Paths);
30  void HandlersChanged(const HTTPHandlers& Handlers);
31  void ServicesChanged(const HTTPServices& Services);
32  void OriginsChanged (const QStringList& Origins);
33  void HostsChanged (const QStringList& Hosts);
34  void ErrorHandlerChanged (const HTTPHandler& Handler);
35  // Internal
36  void MasterResolved (QHostInfo Info);
37  void HostResolved (QHostInfo Info);
38  void ProcessTCPQueue();
39 
40  public slots:
41  void ThreadFinished ();
42 
43  protected slots:
44  void newTcpConnection(qintptr socket) override;
45  void EnableDisable (bool Enable);
46  void NewPaths (const QStringList& Paths);
47  void StalePaths (const QStringList& Paths);
48  void NewHandlers (const HTTPHandlers& Handlers);
49  void StaleHandlers (const HTTPHandlers& Handlers);
50  void NewServices (const HTTPServices& Services);
51  void StaleServices (const HTTPServices& Services);
52  void ResolveMaster (QHostInfo Info);
53  void ResolveHost (QHostInfo Info);
54  void NewErrorPageHandler (const HTTPHandler& Handler);
56 
57  protected:
59  ~MythHTTPServer() override;
60 
61  private:
62  Q_DISABLE_COPY(MythHTTPServer)
63  void Init();
64  void Started(bool Tcp, bool Ssl);
65  void Stopped();
66  void BuildHosts();
67  void BuildOrigins();
68  void DebugHosts();
69  void DebugOrigins();
70  static bool ReservedPath(const QString& Path);
71  static QStringList BuildAddressList(QHostInfo& Info);
72 
73 #ifdef USING_LIBDNS_SD
74  class BonjourRegister* m_bonjour { nullptr };
75  BonjourRegister* m_bonjourSSL { nullptr };
76 #endif
77  int m_originLookups { 0 };
78  int m_hostLookups { 0 };
80  int m_masterStatusPort { 0 };
81  int m_masterSSLPort { 0 };
83  QQueue<qintptr> m_connectionQueue;
84  int m_threadNum { 0 };
85 };
86 
87 #endif
MythHTTPServer::ProcessTCPQueue
void ProcessTCPQueue()
MythHTTPServer::~MythHTTPServer
~MythHTTPServer() override
Definition: mythhttpserver.cpp:71
MythHTTPServer::StaleServices
void StaleServices(const HTTPServices &Services)
Definition: mythhttpserver.cpp:426
MythHTTPServer::HostsChanged
void HostsChanged(const QStringList &Hosts)
MythHTTPServer::BuildHosts
void BuildHosts()
Definition: mythhttpserver.cpp:457
MythHTTPServer::newTcpConnection
void newTcpConnection(qintptr socket) override
Definition: mythhttpserver.cpp:267
MythHTTPServer::m_originLookups
int m_originLookups
Definition: mythhttpserver.h:77
MythHTTPInstance
Definition: mythhttpinstance.h:11
MythHTTPServer::EnableHTTP
void EnableHTTP(bool Enable)
BonjourRegister
Definition: bonjourregister.h:11
MythHTTPServer::ReservedPath
static bool ReservedPath(const QString &Path)
Definition: mythhttpserver.cpp:276
MythHTTPServer::RemovePaths
void RemovePaths(const QStringList &Paths)
MythHTTPServer::AddErrorPageHandler
void AddErrorPageHandler(const HTTPHandler &Handler)
MythHTTPServer::m_masterIPAddress
QString m_masterIPAddress
Definition: mythhttpserver.h:82
MythHTTPServer::AddHandlers
void AddHandlers(const HTTPHandlers &Handlers)
MythHTTPServer::NewHandlers
void NewHandlers(const HTTPHandlers &Handlers)
Add new handlers.
Definition: mythhttpserver.cpp:361
MythHTTPServer::AddPaths
void AddPaths(const QStringList &Paths)
MythHTTPServer::ServicesChanged
void ServicesChanged(const HTTPServices &Services)
MythHTTPServer::m_threadNum
int m_threadNum
Definition: mythhttpserver.h:84
MythHTTPServer::ResolveMaster
void ResolveMaster(QHostInfo Info)
Add master backend addresses to the allowed Origins list.
Definition: mythhttpserver.cpp:558
MythHTTPServer::m_masterSSLPort
int m_masterSSLPort
Definition: mythhttpserver.h:81
MythHTTPServer::NewServices
void NewServices(const HTTPServices &Services)
Definition: mythhttpserver.cpp:402
MythHTTPServer::ResolveHost
void ResolveHost(QHostInfo Info)
Add the results of a reverse lookup to our allowed list.
Definition: mythhttpserver.cpp:592
MythHTTPServer::ProcessTCPQueueHandler
void ProcessTCPQueueHandler()
Definition: mythhttpserver.cpp:249
MythHTTPServer::DebugHosts
void DebugHosts()
Definition: mythhttpserver.cpp:611
MythHTTPServer::StalePaths
void StalePaths(const QStringList &Paths)
Definition: mythhttpserver.cpp:325
MythHTTPServer::Started
void Started(bool Tcp, bool Ssl)
Definition: mythhttpserver.cpp:190
MythHTTPServer::Stopped
void Stopped()
Definition: mythhttpserver.cpp:226
MythHTTPServer::HostResolved
void HostResolved(QHostInfo Info)
mythhttptypes.h
MythHTTPServer::m_connectionQueue
QQueue< qintptr > m_connectionQueue
Definition: mythhttpserver.h:83
MythHTTPServer::MasterResolved
void MasterResolved(QHostInfo Info)
MythHTTPServer::MythHTTPServer
MythHTTPServer()
Definition: mythhttpserver.cpp:31
MythHTTPServer::BuildAddressList
static QStringList BuildAddressList(QHostInfo &Info)
Definition: mythhttpserver.cpp:534
MythHTTPServer::HandlersChanged
void HandlersChanged(const HTTPHandlers &Handlers)
MythHTTPServer::NewErrorPageHandler
void NewErrorPageHandler(const HTTPHandler &Handler)
Add new error page handler.
Definition: mythhttpserver.cpp:450
MythHTTPServer::m_config
MythHTTPConfig m_config
Definition: mythhttpserver.h:79
MythHTTPServer::RemoveHandlers
void RemoveHandlers(const HTTPHandlers &Handlers)
MythHTTPServer::StaleHandlers
void StaleHandlers(const HTTPHandlers &Handlers)
Definition: mythhttpserver.cpp:385
MythHTTPServer::ErrorHandlerChanged
void ErrorHandlerChanged(const HTTPHandler &Handler)
MythHTTPServer
Definition: mythhttpserver.h:12
MythHTTPServer::EnableDisable
void EnableDisable(bool Enable)
Definition: mythhttpserver.cpp:76
MythHTTPServer::NewPaths
void NewPaths(const QStringList &Paths)
Add new paths that will serve simple files.
Definition: mythhttpserver.cpp:308
MythHTTPServer::m_masterStatusPort
int m_masterStatusPort
Definition: mythhttpserver.h:80
mythhttpthreadpool.h
MythHTTPServer::AddServices
void AddServices(const HTTPServices &Services)
HTTPServices
std::vector< HTTPService > HTTPServices
Definition: mythhttptypes.h:55
MythHTTPServer::RemoveServices
void RemoveServices(const HTTPServices &Services)
MythHTTPServer::PathsChanged
void PathsChanged(const QStringList &Paths)
MythHTTPConfig
Definition: mythhttptypes.h:61
MythHTTPServer::DebugOrigins
void DebugOrigins()
Definition: mythhttpserver.cpp:579
HTTPHandler
std::pair< QString, HTTPFunction > HTTPHandler
Definition: mythhttptypes.h:47
MythHTTPServer::m_hostLookups
int m_hostLookups
Definition: mythhttpserver.h:78
MythHTTPThreadPool
Definition: mythhttpthreadpool.h:9
MythHTTPServer::ThreadFinished
void ThreadFinished()
Definition: mythhttpserver.cpp:241
MythHTTPServer::OriginsChanged
void OriginsChanged(const QStringList &Origins)
MythHTTPServer::BuildOrigins
void BuildOrigins()
Generate a list of allowed 'Origins' for validating CORS requests.
Definition: mythhttpserver.cpp:513
HTTPHandlers
std::vector< HTTPHandler > HTTPHandlers
Definition: mythhttptypes.h:48
MythHTTPServer::Init
void Init()
Initialise server configuration.
Definition: mythhttpserver.cpp:125