SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
httpconnectionhandler.h
Go to the documentation of this file.
1 
6 #ifndef HTTPCONNECTIONHANDLER_H
7 #define HTTPCONNECTIONHANDLER_H
8 
9 #ifndef QT_NO_OPENSSL
10  #include <QSslConfiguration>
11 #endif
12 #include <QTcpSocket>
13 #include <QSettings>
14 #include <QTimer>
15 #include <QThread>
16 #include "httpglobal.h"
17 #include "httprequest.h"
18 #include "httprequesthandler.h"
19 #include "httplistenersettings.h"
20 
21 #include "export.h"
22 
23 namespace qtwebapp {
24 
26 #if QT_VERSION >= 0x050000
27  typedef qintptr tSocketDescriptor;
28 #else
29  typedef int tSocketDescriptor;
30 #endif
31 
33 #ifdef QT_NO_OPENSSL
34  #define QSslConfiguration QObject
35 #endif
36 
52 class HTTPSERVER_API HttpConnectionHandler : public QThread {
53  Q_OBJECT
54  Q_DISABLE_COPY(HttpConnectionHandler)
55 
56 public:
57 
64  HttpConnectionHandler(QSettings* settings, HttpRequestHandler* requestHandler, QSslConfiguration* sslConfiguration=NULL);
65 
72  HttpConnectionHandler(const HttpListenerSettings* settings, HttpRequestHandler* requestHandler, QSslConfiguration* sslConfiguration=NULL);
73 
75  virtual ~HttpConnectionHandler();
76 
78  bool isBusy();
79 
81  void setBusy();
82 
87  const HttpListenerSettings *getListenerSettings() const { return listenerSettings; }
88 
89 
90 private:
91 
93  QSettings* settings;
94 
97 
99  QTcpSocket* socket;
100 
102  QTimer readTimer;
103 
106 
109 
111  bool busy;
112 
114  QSslConfiguration* sslConfiguration;
115 
117  void run();
118 
120  void createSocket();
121 
124 
125 public slots:
126 
131  void handleConnection(tSocketDescriptor socketDescriptor);
132 
133 private slots:
134 
136  void readTimeout();
137 
139  void read();
140 
142  void disconnected();
143 
144 };
145 
146 } // end of namespace
147 
148 #endif // HTTPCONNECTIONHANDLER_H
const HttpListenerSettings * getListenerSettings() const
#define HTTPSERVER_API
Definition: export.h:88
const HttpListenerSettings * listenerSettings