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