Cutelyst  1.7.0
wsgi.h
1 /*
2  * Copyright (C) 2016-2017 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 Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 #ifndef WSGI_H
20 #define WSGI_H
21 
22 #include <QObject>
23 
24 #include <Cutelyst/cutelyst_global.h>
25 
26 class QCoreApplication;
27 
28 namespace Cutelyst {
29 class Application;
30 }
31 
32 namespace CWSGI {
33 
34 class WSGIPrivate;
39 class CUTELYST_WSGI_EXPORT WSGI : public QObject
40 {
41  Q_OBJECT
42  Q_DECLARE_PRIVATE(WSGI)
43 public:
44  explicit WSGI(QObject *parent = nullptr);
45  virtual ~WSGI();
46 
47  void parseCommandLine(const QStringList &args);
48 
65  int exec(Cutelyst::Application *app = nullptr);
66 
72  Q_PROPERTY(QString application READ application WRITE setApplication)
73  void setApplication(const QString &application);
74  QString application() const;
75 
80  Q_PROPERTY(QString threads READ threads WRITE setThreads)
81  void setThreads(const QString &threads);
82  QString threads() const;
83 
84 #ifdef Q_OS_UNIX
85 
89  Q_PROPERTY(QString processes READ processes WRITE setProcesses)
90  void setProcesses(const QString &process);
91  QString processes() const;
92 #endif
93 
98  Q_PROPERTY(QString chdir READ chdir WRITE setChdir)
99  void setChdir(const QString &chdir);
100  QString chdir() const;
101 
106  Q_PROPERTY(QStringList http_socket READ httpSocket WRITE setHttpSocket)
107  void setHttpSocket(const QStringList &httpSocket);
108  QStringList httpSocket() const;
109 
114  Q_PROPERTY(QStringList https_socket READ httpsSocket WRITE setHttpsSocket)
115  void setHttpsSocket(const QStringList &httpsSocket);
116  QStringList httpsSocket() const;
117 
122  Q_PROPERTY(QStringList fastcgi_socket READ fastcgiSocket WRITE setFastcgiSocket)
123  void setFastcgiSocket(const QStringList &fastcgiSocket);
124  QStringList fastcgiSocket() const;
125 
130  Q_PROPERTY(QString socket_access READ socketAccess WRITE setSocketAccess)
131  void setSocketAccess(const QString &socketAccess);
132  QString socketAccess() const;
133 
138  Q_PROPERTY(int socket_timeout READ socketTimeout WRITE setSocketTimeout)
139  void setSocketTimeout(int timeout);
140  int socketTimeout() const;
141 
146  Q_PROPERTY(QString chdir2 READ chdir2 WRITE setChdir2)
147  void setChdir2(const QString &chdir2);
148  QString chdir2() const;
149 
154  Q_PROPERTY(QStringList ini READ ini WRITE setIni)
155  void setIni(const QStringList &ini);
156  QStringList ini() const;
157 
162  Q_PROPERTY(QStringList json READ json WRITE setJson)
163  void setJson(const QStringList &files);
164  QStringList json() const;
165 
170  Q_PROPERTY(QStringList static_map READ staticMap WRITE setStaticMap)
171  void setStaticMap(const QStringList &staticMap);
172  QStringList staticMap() const;
173 
178  Q_PROPERTY(QStringList static_map2 READ staticMap2 WRITE setStaticMap2)
179  void setStaticMap2(const QStringList &staticMap);
180  QStringList staticMap2() const;
181 
187  Q_PROPERTY(bool master READ master WRITE setMaster)
188  void setMaster(bool enable);
189  bool master() const;
190 
195  Q_PROPERTY(bool auto_reload READ autoReload WRITE setAutoReload)
196  void setAutoReload(bool enable);
197  bool autoReload() const;
198 
203  Q_PROPERTY(QStringList touch_reload READ touchReload WRITE setTouchReload)
204  void setTouchReload(const QStringList &files);
205  QStringList touchReload() const;
206 
211  Q_PROPERTY(qint64 buffer_size READ bufferSize WRITE setBufferSize)
212  void setBufferSize(qint64 size);
213  int bufferSize() const;
214 
220  Q_PROPERTY(qint64 post_buffering READ postBuffering WRITE setPostBuffering)
221  void setPostBuffering(qint64 size);
222  qint64 postBuffering() const;
223 
228  Q_PROPERTY(qint64 post_buffering_bufsize READ postBufferingBufsize WRITE setPostBufferingBufsize)
229  void setPostBufferingBufsize(qint64 size);
230  qint64 postBufferingBufsize() const;
231 
236  Q_PROPERTY(bool tcp_nodelay READ tcpNodelay WRITE setTcpNodelay)
237  void setTcpNodelay(bool enable);
238  bool tcpNodelay() const;
239 
244  Q_PROPERTY(bool so_keepalive READ soKeepalive WRITE setSoKeepalive)
245  void setSoKeepalive(bool enable);
246  bool soKeepalive() const;
247 
252  Q_PROPERTY(int socket_sndbuf READ socketSndbuf WRITE setSocketSndbuf)
253  void setSocketSndbuf(int value);
254  int socketSndbuf() const;
255 
260  Q_PROPERTY(int socket_rcvbuf READ socketRcvbuf WRITE setSocketRcvbuf)
261  void setSocketRcvbuf(int value);
262  int socketRcvbuf() const;
263 
268  Q_PROPERTY(int websocket_max_size READ websocketMaxSize WRITE setWebsocketMaxSize)
269  void setWebsocketMaxSize(int value);
270  int websocketMaxSize() const;
271 
276  Q_PROPERTY(QString pidfile READ pidfile WRITE setPidfile)
277  void setPidfile(const QString &file);
278  QString pidfile() const;
279 
284  Q_PROPERTY(QString pidfile2 READ pidfile2 WRITE setPidfile2)
285  void setPidfile2(const QString &file);
286  QString pidfile2() const;
287 
288 #ifdef Q_OS_UNIX
289 
293  Q_PROPERTY(QString uid READ uid WRITE setUid)
294  void setUid(const QString &uid);
295  QString uid() const;
296 
301  Q_PROPERTY(QString gid READ gid WRITE setGid)
302  void setGid(const QString &gid);
303  QString gid() const;
304 
309  Q_PROPERTY(bool no_initgroups READ noInitgroups WRITE setNoInitgroups)
310  void setNoInitgroups(bool enable);
311  bool noInitgroups() const;
312 
317  Q_PROPERTY(QString chown_socket READ chownSocket WRITE setChownSocket)
318  void setChownSocket(const QString &chownSocket);
319  QString chownSocket() const;
320 
325  Q_PROPERTY(QString umask READ umask WRITE setUmask)
326  void setUmask(const QString &value);
327  QString umask() const;
328 
333  Q_PROPERTY(int cpu_affinity READ cpuAffinity WRITE setCpuAffinity)
334  void setCpuAffinity(int value);
335  int cpuAffinity() const;
336 #endif
337 
338 #ifdef Q_OS_LINUX
339 
343  Q_PROPERTY(bool reuse_port READ reusePort WRITE setReusePort)
344  void setReusePort(bool enable);
345  bool reusePort() const;
346 #endif
347 
352  Q_PROPERTY(bool lazy READ lazy WRITE setLazy)
353  void setLazy(bool enable);
354  bool lazy() const;
355 
356 Q_SIGNALS:
360  void ready();
361 
362 protected:
363  WSGIPrivate *d_ptr;
364 };
365 
366 }
367 
368 #endif // WSGI_H
Definition: wsgi.h:32
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
Implements a WSGI server.
Definition: wsgi.h:39
The Cutelyst Application.
Definition: application.h:56