cutelyst  3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
server.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2016-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYSTSERVER_H
6 #define CUTELYSTSERVER_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 
10 #include <QObject>
11 
12 class QCoreApplication;
13 
14 namespace Cutelyst {
15 
16 class Application;
17 class ServerPrivate;
22 class CUTELYST_SERVER_EXPORT Server : public QObject
23 {
24  Q_OBJECT
25  Q_DECLARE_PRIVATE(Server)
26 public:
35  explicit Server(QObject *parent = nullptr);
36  virtual ~Server();
37 
38  void parseCommandLine(const QStringList &args);
39 
58  int exec(Cutelyst::Application *app = nullptr);
59 
75  bool start(Cutelyst::Application *app = nullptr);
76 
81  void stop();
82 
88  Q_PROPERTY(QString application READ application WRITE setApplication NOTIFY changed)
89  void setApplication(const QString &application);
90  QString application() const;
91 
104  Q_PROPERTY(QString threads READ threads WRITE setThreads NOTIFY changed)
105  void setThreads(const QString &threads);
106  QString threads() const;
107 
113  Q_PROPERTY(QString processes READ processes WRITE setProcesses NOTIFY changed)
114  void setProcesses(const QString &process);
115  QString processes() const;
121  Q_PROPERTY(QString chdir READ chdir WRITE setChdir NOTIFY changed)
122  void setChdir(const QString &chdir);
123  QString chdir() const;
124 
129  Q_PROPERTY(QStringList http_socket READ httpSocket WRITE setHttpSocket NOTIFY changed)
130  void setHttpSocket(const QStringList &httpSocket);
131  QStringList httpSocket() const;
132 
137  Q_PROPERTY(QStringList http2_socket READ http2Socket WRITE setHttp2Socket NOTIFY changed)
138  void setHttp2Socket(const QStringList &http2Socket);
139  QStringList http2Socket() const;
140 
145  Q_PROPERTY(quint32 http2_header_table_size READ http2HeaderTableSize WRITE
146  setHttp2HeaderTableSize NOTIFY changed)
147  void setHttp2HeaderTableSize(quint32 headerTableSize);
148  quint32 http2HeaderTableSize() const;
149 
155  Q_PROPERTY(bool upgrade_h2c READ upgradeH2c WRITE setUpgradeH2c NOTIFY changed)
156  void setUpgradeH2c(bool enable);
157  bool upgradeH2c() const;
158 
164  Q_PROPERTY(bool https_h2 READ httpsH2 WRITE setHttpsH2 NOTIFY changed)
165  void setHttpsH2(bool enable);
166  bool httpsH2() const;
167 
172  Q_PROPERTY(QStringList https_socket READ httpsSocket WRITE setHttpsSocket NOTIFY changed)
173  void setHttpsSocket(const QStringList &httpsSocket);
174  QStringList httpsSocket() const;
175 
180  Q_PROPERTY(QStringList fastcgi_socket READ fastcgiSocket WRITE setFastcgiSocket NOTIFY changed)
181  void setFastcgiSocket(const QStringList &fastcgiSocket);
182  QStringList fastcgiSocket() const;
183 
188  Q_PROPERTY(QString socket_access READ socketAccess WRITE setSocketAccess NOTIFY changed)
189  void setSocketAccess(const QString &socketAccess);
190  QString socketAccess() const;
196  Q_PROPERTY(int socket_timeout READ socketTimeout WRITE setSocketTimeout NOTIFY changed)
197  void setSocketTimeout(int timeout);
198  int socketTimeout() const;
199 
204  Q_PROPERTY(QString chdir2 READ chdir2 WRITE setChdir2 NOTIFY changed)
205  void setChdir2(const QString &chdir2);
206  QString chdir2() const;
207 
212  Q_PROPERTY(QStringList ini READ ini WRITE setIni NOTIFY changed)
213  void setIni(const QStringList &files);
214  QStringList ini() const;
215 
220  Q_PROPERTY(QStringList json READ json WRITE setJson NOTIFY changed)
221  void setJson(const QStringList &files);
222  QStringList json() const;
223 
228  Q_PROPERTY(QStringList static_map READ staticMap WRITE setStaticMap NOTIFY changed)
229  void setStaticMap(const QStringList &staticMap);
230  QStringList staticMap() const;
231 
237  Q_PROPERTY(QStringList static_map2 READ staticMap2 WRITE setStaticMap2 NOTIFY changed)
238  void setStaticMap2(const QStringList &staticMap);
239  QStringList staticMap2() const;
240 
246  Q_PROPERTY(bool master READ master WRITE setMaster NOTIFY changed)
247  void setMaster(bool enable);
248  bool master() const;
249 
254  Q_PROPERTY(bool auto_reload READ autoReload WRITE setAutoReload NOTIFY changed)
255  void setAutoReload(bool enable);
256  bool autoReload() const;
257 
262  Q_PROPERTY(QStringList touch_reload READ touchReload WRITE setTouchReload NOTIFY changed)
263  void setTouchReload(const QStringList &files);
264  QStringList touchReload() const;
272  Q_PROPERTY(int listen READ listenQueue WRITE setListenQueue NOTIFY changed)
273  void setListenQueue(int size);
274  int listenQueue() const;
275 
280  Q_PROPERTY(int buffer_size READ bufferSize WRITE setBufferSize NOTIFY changed)
281  void setBufferSize(int size);
282  int bufferSize() const;
289  Q_PROPERTY(qint64 post_buffering READ postBuffering WRITE setPostBuffering NOTIFY changed)
290  void setPostBuffering(qint64 size);
291  qint64 postBuffering() const;
292 
297  Q_PROPERTY(qint64 post_buffering_bufsize READ postBufferingBufsize WRITE setPostBufferingBufsize
298  NOTIFY changed)
299  void setPostBufferingBufsize(qint64 size);
300  qint64 postBufferingBufsize() const;
301 
306  Q_PROPERTY(bool tcp_nodelay READ tcpNodelay WRITE setTcpNodelay NOTIFY changed)
307  void setTcpNodelay(bool enable);
308  bool tcpNodelay() const;
309 
314  Q_PROPERTY(bool so_keepalive READ soKeepalive WRITE setSoKeepalive NOTIFY changed)
315  void setSoKeepalive(bool enable);
316  bool soKeepalive() const;
317 
323  Q_PROPERTY(int socket_sndbuf READ socketSndbuf WRITE setSocketSndbuf NOTIFY changed)
324  void setSocketSndbuf(int value);
325  int socketSndbuf() const;
326 
332  Q_PROPERTY(int socket_rcvbuf READ socketRcvbuf WRITE setSocketRcvbuf NOTIFY changed)
333  void setSocketRcvbuf(int value);
334  int socketRcvbuf() const;
335 
340  Q_PROPERTY(
341  int websocket_max_size READ websocketMaxSize WRITE setWebsocketMaxSize NOTIFY changed)
342  void setWebsocketMaxSize(int value);
343  int websocketMaxSize() const;
344 
349  Q_PROPERTY(QString pidfile READ pidfile WRITE setPidfile NOTIFY changed)
350  void setPidfile(const QString &file);
351  QString pidfile() const;
352 
357  Q_PROPERTY(QString pidfile2 READ pidfile2 WRITE setPidfile2 NOTIFY changed)
358  void setPidfile2(const QString &file);
359  QString pidfile2() const;
360 
366  Q_PROPERTY(QString uid READ uid WRITE setUid NOTIFY changed)
367  void setUid(const QString &uid);
368  QString uid() const;
369 
375  Q_PROPERTY(QString gid READ gid WRITE setGid NOTIFY changed)
376  void setGid(const QString &gid);
377  QString gid() const;
378 
384  Q_PROPERTY(bool no_initgroups READ noInitgroups WRITE setNoInitgroups NOTIFY changed)
385  void setNoInitgroups(bool enable);
386  bool noInitgroups() const;
387 
393  Q_PROPERTY(QString chown_socket READ chownSocket WRITE setChownSocket NOTIFY changed)
394  void setChownSocket(const QString &chownSocket);
395  QString chownSocket() const;
396 
402  Q_PROPERTY(QString umask READ umask WRITE setUmask NOTIFY changed)
403  void setUmask(const QString &value);
404  QString umask() const;
405 
411  Q_PROPERTY(int cpu_affinity READ cpuAffinity WRITE setCpuAffinity NOTIFY changed)
412  void setCpuAffinity(int value);
413  int cpuAffinity() const;
414 
420  Q_PROPERTY(bool reuse_port READ reusePort WRITE setReusePort NOTIFY changed)
421  void setReusePort(bool enable);
422  bool reusePort() const;
423 
428  Q_PROPERTY(bool lazy READ lazy WRITE setLazy NOTIFY changed)
429  void setLazy(bool enable);
430  bool lazy() const;
431 
438  Q_PROPERTY(bool using_frontend_proxy READ usingFrontendProxy WRITE setUsingFrontendProxy NOTIFY
439  changed)
440  void setUsingFrontendProxy(bool enable);
441  bool usingFrontendProxy() const;
442 
443 Q_SIGNALS:
447  void ready();
448 
452  void stopped();
453 
454  void changed();
455 
459  void errorOccured(const QString &error);
460 
461 protected:
462  ServerPrivate *d_ptr;
463 };
464 
465 } // namespace Cutelyst
466 
467 #endif // CUTELYSTSERVER_H
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
The Cutelyst Application.
Definition: application.h:42