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.
httpsessionstore.h
Go to the documentation of this file.
1 
6 #ifndef HTTPSESSIONSTORE_H
7 #define HTTPSESSIONSTORE_H
8 
9 #include <QObject>
10 #include <QMap>
11 #include <QTimer>
12 #include <QMutex>
13 #include "httpglobal.h"
14 #include "httpsession.h"
15 #include "httpresponse.h"
16 #include "httprequest.h"
17 #include "httpsessionssettings.h"
18 
19 #include "export.h"
20 
21 namespace qtwebapp {
22 
38 class HTTPSERVER_API HttpSessionStore : public QObject {
39  Q_OBJECT
40  Q_DISABLE_COPY(HttpSessionStore)
41 public:
42 
44  HttpSessionStore(QSettings* settings, QObject* parent=NULL);
45 
47  HttpSessionStore(const HttpSessionsSettings& settings, QObject* parent=NULL);
48 
50  virtual ~HttpSessionStore();
51 
61  QByteArray getSessionId(HttpRequest& request, HttpResponse& response);
62 
73  HttpSession getSession(HttpRequest& request, HttpResponse& response, bool allowCreate=true);
74 
82  HttpSession getSession(const QByteArray id);
83 
85  void removeSession(HttpSession session);
86 
91  HttpSessionsSettings getListenerSettings() const { return sessionsSettings; }
92 
97  void setListenerSettings(const HttpSessionsSettings& settings) { sessionsSettings = settings; }
98 
99 protected:
101  QMap<QByteArray,HttpSession> sessions;
102 
103 private:
104 
106  QSettings* settings;
107 
110 
112  QTimer cleanupTimer;
113 
115  QByteArray cookieName;
116 
119 
121  QMutex mutex;
122 
125 
126 private slots:
127 
129  void sessionTimerEvent();
130 };
131 
132 } // end of namespace
133 
134 #endif // HTTPSESSIONSTORE_H
#define HTTPSERVER_API
Definition: export.h:88
QMap< QByteArray, HttpSession > sessions
HttpSessionsSettings getListenerSettings() const
HttpSessionsSettings sessionsSettings
void setListenerSettings(const HttpSessionsSettings &settings)