Stellarium  0.16.1
httplistener.h
Go to the documentation of this file.
1 
6 #ifndef HTTPLISTENER_H
7 #define HTTPLISTENER_H
8 
9 #include <QTcpServer>
10 #include <QBasicTimer>
11 #include "httpglobal.h"
12 #include "httpconnectionhandler.h"
13 #include "httpconnectionhandlerpool.h"
14 #include "httprequesthandler.h"
15 
21 {
23  :port(8080)
24  {}
25 
27  QString host;
29  int port;
30 };
31 
57 class DECLSPEC HttpListener : public QTcpServer {
58  Q_OBJECT
59  Q_DISABLE_COPY(HttpListener)
60 public:
61 
70  HttpListener(const HttpListenerSettings& settings, HttpRequestHandler* requestHandler, QObject* parent = Q_NULLPTR);
71 
73  virtual ~HttpListener();
74 
78  void listen();
79 
84  void close();
85 
86 protected:
87 
89  void incomingConnection(tSocketDescriptor socketDescriptor);
90 
91 private:
92 
94  HttpListenerSettings settings;
95 
97  HttpRequestHandler* requestHandler;
98 
101 
102 signals:
103 
109  void handleConnection(tSocketDescriptor socketDescriptor);
110 
111 };
112 
113 #endif // HTTPLISTENER_H
The request handler generates a response for each HTTP request.
QString host
The local IP address to bind to.
Definition: httplistener.h:27
int tSocketDescriptor
Alias type definition, for compatibility to different Qt versions.
Contains all settings for HttpListener and supporting classes.
Definition: httplistener.h:20
int port
The HTTP port to use.
Definition: httplistener.h:29
Contains all settings for the connection handler pool and the child connection handlers.
Listens for incoming TCP connections and and passes all incoming HTTP requests to your implementation...
Definition: httplistener.h:57
Pool of http connection handlers.