Cutelyst  2.13.0
wsgi.h
1 /*
2  * Copyright (C) 2016-2018 Daniel Nicoletti <dantti12@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 #ifndef WSGI_H
19 #define WSGI_H
20 
21 #include <QObject>
22 
23 #include <Cutelyst/cutelyst_global.h>
24 
25 class QCoreApplication;
26 
27 namespace Cutelyst {
28 class Application;
29 }
30 
31 namespace CWSGI {
32 
33 class WSGIPrivate;
38 class CUTELYST_WSGI_EXPORT WSGI : public QObject
39 {
40  Q_OBJECT
41  Q_DECLARE_PRIVATE(WSGI)
42 public:
43  explicit WSGI(QObject *parent = nullptr);
44  virtual ~WSGI();
45 
46  void parseCommandLine(const QStringList &args);
47 
64  int exec(Cutelyst::Application *app = nullptr);
65 
78  bool start(Cutelyst::Application *app = nullptr);
79 
84  void stop();
85 
91  Q_PROPERTY(QString application READ application WRITE setApplication NOTIFY changed)
92  void setApplication(const QString &application);
93  QString application() const;
94 
99  Q_PROPERTY(QString threads READ threads WRITE setThreads NOTIFY changed)
100  void setThreads(const QString &threads);
101  QString threads() const;
102 
108  Q_PROPERTY(QString processes READ processes WRITE setProcesses NOTIFY changed)
109  void setProcesses(const QString &process);
110  QString processes() const;
111 
116  Q_PROPERTY(QString chdir READ chdir WRITE setChdir NOTIFY changed)
117  void setChdir(const QString &chdir);
118  QString chdir() const;
119 
124  Q_PROPERTY(QStringList http_socket READ httpSocket WRITE setHttpSocket NOTIFY changed)
125  void setHttpSocket(const QStringList &httpSocket);
126  QStringList httpSocket() const;
127 
132  Q_PROPERTY(QStringList http2_socket READ http2Socket WRITE setHttp2Socket NOTIFY changed)
133  void setHttp2Socket(const QStringList &http2Socket);
134  QStringList http2Socket() const;
135 
140  Q_PROPERTY(quint32 http2_header_table_size READ http2HeaderTableSize WRITE setHttp2HeaderTableSize NOTIFY changed)
141  void setHttp2HeaderTableSize(quint32 headerTableSize);
142  quint32 http2HeaderTableSize() const;
143 
149  Q_PROPERTY(bool upgrade_h2c READ upgradeH2c WRITE setUpgradeH2c NOTIFY changed)
150  void setUpgradeH2c(bool enable);
151  bool upgradeH2c() const;
152 
158  Q_PROPERTY(bool https_h2 READ httpsH2 WRITE setHttpsH2 NOTIFY changed)
159  void setHttpsH2(bool enable);
160  bool httpsH2() const;
161 
166  Q_PROPERTY(QStringList https_socket READ httpsSocket WRITE setHttpsSocket NOTIFY changed)
167  void setHttpsSocket(const QStringList &httpsSocket);
168  QStringList httpsSocket() const;
169 
174  Q_PROPERTY(QStringList fastcgi_socket READ fastcgiSocket WRITE setFastcgiSocket NOTIFY changed)
175  void setFastcgiSocket(const QStringList &fastcgiSocket);
176  QStringList fastcgiSocket() const;
177 
182  Q_PROPERTY(QString socket_access READ socketAccess WRITE setSocketAccess NOTIFY changed)
183  void setSocketAccess(const QString &socketAccess);
184  QString socketAccess() const;
185 
190  Q_PROPERTY(int socket_timeout READ socketTimeout WRITE setSocketTimeout NOTIFY changed)
191  void setSocketTimeout(int timeout);
192  int socketTimeout() const;
193 
198  Q_PROPERTY(QString chdir2 READ chdir2 WRITE setChdir2 NOTIFY changed)
199  void setChdir2(const QString &chdir2);
200  QString chdir2() const;
201 
206  Q_PROPERTY(QStringList ini READ ini WRITE setIni NOTIFY changed)
207  void setIni(const QStringList &files);
208  QStringList ini() const;
209 
214  Q_PROPERTY(QStringList json READ json WRITE setJson NOTIFY changed)
215  void setJson(const QStringList &files);
216  QStringList json() const;
217 
222  Q_PROPERTY(QStringList static_map READ staticMap WRITE setStaticMap NOTIFY changed)
223  void setStaticMap(const QStringList &staticMap);
224  QStringList staticMap() const;
225 
230  Q_PROPERTY(QStringList static_map2 READ staticMap2 WRITE setStaticMap2 NOTIFY changed)
231  void setStaticMap2(const QStringList &staticMap);
232  QStringList staticMap2() const;
233 
239  Q_PROPERTY(bool master READ master WRITE setMaster NOTIFY changed)
240  void setMaster(bool enable);
241  bool master() const;
242 
247  Q_PROPERTY(bool auto_reload READ autoReload WRITE setAutoReload NOTIFY changed)
248  void setAutoReload(bool enable);
249  bool autoReload() const;
250 
255  Q_PROPERTY(QStringList touch_reload READ touchReload WRITE setTouchReload NOTIFY changed)
256  void setTouchReload(const QStringList &files);
257  QStringList touchReload() const;
258 
265  Q_PROPERTY(int listen READ listenQueue WRITE setListenQueue NOTIFY changed)
266  void setListenQueue(int size);
267  int listenQueue() const;
268 
273  Q_PROPERTY(int buffer_size READ bufferSize WRITE setBufferSize NOTIFY changed)
274  void setBufferSize(int size);
275  int bufferSize() const;
276 
282  Q_PROPERTY(qint64 post_buffering READ postBuffering WRITE setPostBuffering NOTIFY changed)
283  void setPostBuffering(qint64 size);
284  qint64 postBuffering() const;
285 
290  Q_PROPERTY(qint64 post_buffering_bufsize READ postBufferingBufsize WRITE setPostBufferingBufsize NOTIFY changed)
291  void setPostBufferingBufsize(qint64 size);
292  qint64 postBufferingBufsize() const;
293 
298  Q_PROPERTY(bool tcp_nodelay READ tcpNodelay WRITE setTcpNodelay NOTIFY changed)
299  void setTcpNodelay(bool enable);
300  bool tcpNodelay() const;
301 
306  Q_PROPERTY(bool so_keepalive READ soKeepalive WRITE setSoKeepalive NOTIFY changed)
307  void setSoKeepalive(bool enable);
308  bool soKeepalive() const;
309 
314  Q_PROPERTY(int socket_sndbuf READ socketSndbuf WRITE setSocketSndbuf NOTIFY changed)
315  void setSocketSndbuf(int value);
316  int socketSndbuf() const;
317 
322  Q_PROPERTY(int socket_rcvbuf READ socketRcvbuf WRITE setSocketRcvbuf NOTIFY changed)
323  void setSocketRcvbuf(int value);
324  int socketRcvbuf() const;
325 
330  Q_PROPERTY(int websocket_max_size READ websocketMaxSize WRITE setWebsocketMaxSize NOTIFY changed)
331  void setWebsocketMaxSize(int value);
332  int websocketMaxSize() const;
333 
338  Q_PROPERTY(QString pidfile READ pidfile WRITE setPidfile NOTIFY changed)
339  void setPidfile(const QString &file);
340  QString pidfile() const;
341 
346  Q_PROPERTY(QString pidfile2 READ pidfile2 WRITE setPidfile2 NOTIFY changed)
347  void setPidfile2(const QString &file);
348  QString pidfile2() const;
349 
355  Q_PROPERTY(QString uid READ uid WRITE setUid NOTIFY changed)
356  void setUid(const QString &uid);
357  QString uid() const;
358 
364  Q_PROPERTY(QString gid READ gid WRITE setGid NOTIFY changed)
365  void setGid(const QString &gid);
366  QString gid() const;
367 
373  Q_PROPERTY(bool no_initgroups READ noInitgroups WRITE setNoInitgroups NOTIFY changed)
374  void setNoInitgroups(bool enable);
375  bool noInitgroups() const;
376 
382  Q_PROPERTY(QString chown_socket READ chownSocket WRITE setChownSocket NOTIFY changed)
383  void setChownSocket(const QString &chownSocket);
384  QString chownSocket() const;
385 
391  Q_PROPERTY(QString umask READ umask WRITE setUmask NOTIFY changed)
392  void setUmask(const QString &value);
393  QString umask() const;
394 
400  Q_PROPERTY(int cpu_affinity READ cpuAffinity WRITE setCpuAffinity NOTIFY changed)
401  void setCpuAffinity(int value);
402  int cpuAffinity() const;
403 
409  Q_PROPERTY(bool reuse_port READ reusePort WRITE setReusePort NOTIFY changed)
410  void setReusePort(bool enable);
411  bool reusePort() const;
412 
417  Q_PROPERTY(bool lazy READ lazy WRITE setLazy NOTIFY changed)
418  void setLazy(bool enable);
419  bool lazy() const;
420 
427  Q_PROPERTY(bool using_frontend_proxy READ usingFrontendProxy WRITE setUsingFrontendProxy NOTIFY changed)
428  void setUsingFrontendProxy(bool enable);
429  bool usingFrontendProxy() const;
430 
431 Q_SIGNALS:
435  void ready();
436 
440  void stopped();
441 
442  void changed();
443 
444 protected:
445  WSGIPrivate *d_ptr;
446 };
447 
448 }
449 
450 #endif // WSGI_H
Cutelyst::Application
The Cutelyst Application.
Definition: application.h:55
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
CWSGI::WSGI
Implements a WSGI server.
Definition: wsgi.h:38