Cutelyst  3.5.0
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 <QObject>
9 
10 #include <Cutelyst/cutelyst_global.h>
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:
27  explicit Server(QObject *parent = nullptr);
28  virtual ~Server();
29 
30  void parseCommandLine(const QStringList &args);
31 
50  int exec(Cutelyst::Application *app = nullptr);
51 
67  bool start(Cutelyst::Application *app = nullptr);
68 
73  void stop();
74 
80  Q_PROPERTY(QString application READ application WRITE setApplication NOTIFY changed)
81  void setApplication(const QString &application);
82  QString application() const;
83 
88  Q_PROPERTY(QString threads READ threads WRITE setThreads NOTIFY changed)
89  void setThreads(const QString &threads);
90  QString threads() const;
91 
97  Q_PROPERTY(QString processes READ processes WRITE setProcesses NOTIFY changed)
98  void setProcesses(const QString &process);
99  QString processes() const;
100 
105  Q_PROPERTY(QString chdir READ chdir WRITE setChdir NOTIFY changed)
106  void setChdir(const QString &chdir);
107  QString chdir() const;
108 
113  Q_PROPERTY(QStringList http_socket READ httpSocket WRITE setHttpSocket NOTIFY changed)
114  void setHttpSocket(const QStringList &httpSocket);
115  QStringList httpSocket() const;
116 
121  Q_PROPERTY(QStringList http2_socket READ http2Socket WRITE setHttp2Socket NOTIFY changed)
122  void setHttp2Socket(const QStringList &http2Socket);
123  QStringList http2Socket() const;
124 
129  Q_PROPERTY(quint32 http2_header_table_size READ http2HeaderTableSize WRITE setHttp2HeaderTableSize NOTIFY changed)
130  void setHttp2HeaderTableSize(quint32 headerTableSize);
131  quint32 http2HeaderTableSize() const;
132 
138  Q_PROPERTY(bool upgrade_h2c READ upgradeH2c WRITE setUpgradeH2c NOTIFY changed)
139  void setUpgradeH2c(bool enable);
140  bool upgradeH2c() const;
141 
147  Q_PROPERTY(bool https_h2 READ httpsH2 WRITE setHttpsH2 NOTIFY changed)
148  void setHttpsH2(bool enable);
149  bool httpsH2() const;
150 
155  Q_PROPERTY(QStringList https_socket READ httpsSocket WRITE setHttpsSocket NOTIFY changed)
156  void setHttpsSocket(const QStringList &httpsSocket);
157  QStringList httpsSocket() const;
158 
163  Q_PROPERTY(QStringList fastcgi_socket READ fastcgiSocket WRITE setFastcgiSocket NOTIFY changed)
164  void setFastcgiSocket(const QStringList &fastcgiSocket);
165  QStringList fastcgiSocket() const;
166 
171  Q_PROPERTY(QString socket_access READ socketAccess WRITE setSocketAccess NOTIFY changed)
172  void setSocketAccess(const QString &socketAccess);
173  QString socketAccess() const;
174 
179  Q_PROPERTY(int socket_timeout READ socketTimeout WRITE setSocketTimeout NOTIFY changed)
180  void setSocketTimeout(int timeout);
181  int socketTimeout() const;
182 
187  Q_PROPERTY(QString chdir2 READ chdir2 WRITE setChdir2 NOTIFY changed)
188  void setChdir2(const QString &chdir2);
189  QString chdir2() const;
190 
195  Q_PROPERTY(QStringList ini READ ini WRITE setIni NOTIFY changed)
196  void setIni(const QStringList &files);
197  QStringList ini() const;
198 
203  Q_PROPERTY(QStringList json READ json WRITE setJson NOTIFY changed)
204  void setJson(const QStringList &files);
205  QStringList json() const;
206 
211  Q_PROPERTY(QStringList static_map READ staticMap WRITE setStaticMap NOTIFY changed)
212  void setStaticMap(const QStringList &staticMap);
213  QStringList staticMap() const;
214 
219  Q_PROPERTY(QStringList static_map2 READ staticMap2 WRITE setStaticMap2 NOTIFY changed)
220  void setStaticMap2(const QStringList &staticMap);
221  QStringList staticMap2() const;
222 
228  Q_PROPERTY(bool master READ master WRITE setMaster NOTIFY changed)
229  void setMaster(bool enable);
230  bool master() const;
231 
236  Q_PROPERTY(bool auto_reload READ autoReload WRITE setAutoReload NOTIFY changed)
237  void setAutoReload(bool enable);
238  bool autoReload() const;
239 
244  Q_PROPERTY(QStringList touch_reload READ touchReload WRITE setTouchReload NOTIFY changed)
245  void setTouchReload(const QStringList &files);
246  QStringList touchReload() const;
247 
254  Q_PROPERTY(int listen READ listenQueue WRITE setListenQueue NOTIFY changed)
255  void setListenQueue(int size);
256  int listenQueue() const;
257 
262  Q_PROPERTY(int buffer_size READ bufferSize WRITE setBufferSize NOTIFY changed)
263  void setBufferSize(int size);
264  int bufferSize() const;
265 
271  Q_PROPERTY(qint64 post_buffering READ postBuffering WRITE setPostBuffering NOTIFY changed)
272  void setPostBuffering(qint64 size);
273  qint64 postBuffering() const;
274 
279  Q_PROPERTY(qint64 post_buffering_bufsize READ postBufferingBufsize WRITE setPostBufferingBufsize NOTIFY changed)
280  void setPostBufferingBufsize(qint64 size);
281  qint64 postBufferingBufsize() const;
282 
287  Q_PROPERTY(bool tcp_nodelay READ tcpNodelay WRITE setTcpNodelay NOTIFY changed)
288  void setTcpNodelay(bool enable);
289  bool tcpNodelay() const;
290 
295  Q_PROPERTY(bool so_keepalive READ soKeepalive WRITE setSoKeepalive NOTIFY changed)
296  void setSoKeepalive(bool enable);
297  bool soKeepalive() const;
298 
303  Q_PROPERTY(int socket_sndbuf READ socketSndbuf WRITE setSocketSndbuf NOTIFY changed)
304  void setSocketSndbuf(int value);
305  int socketSndbuf() const;
306 
311  Q_PROPERTY(int socket_rcvbuf READ socketRcvbuf WRITE setSocketRcvbuf NOTIFY changed)
312  void setSocketRcvbuf(int value);
313  int socketRcvbuf() const;
314 
319  Q_PROPERTY(int websocket_max_size READ websocketMaxSize WRITE setWebsocketMaxSize NOTIFY changed)
320  void setWebsocketMaxSize(int value);
321  int websocketMaxSize() const;
322 
327  Q_PROPERTY(QString pidfile READ pidfile WRITE setPidfile NOTIFY changed)
328  void setPidfile(const QString &file);
329  QString pidfile() const;
330 
335  Q_PROPERTY(QString pidfile2 READ pidfile2 WRITE setPidfile2 NOTIFY changed)
336  void setPidfile2(const QString &file);
337  QString pidfile2() const;
338 
344  Q_PROPERTY(QString uid READ uid WRITE setUid NOTIFY changed)
345  void setUid(const QString &uid);
346  QString uid() const;
347 
353  Q_PROPERTY(QString gid READ gid WRITE setGid NOTIFY changed)
354  void setGid(const QString &gid);
355  QString gid() const;
356 
362  Q_PROPERTY(bool no_initgroups READ noInitgroups WRITE setNoInitgroups NOTIFY changed)
363  void setNoInitgroups(bool enable);
364  bool noInitgroups() const;
365 
371  Q_PROPERTY(QString chown_socket READ chownSocket WRITE setChownSocket NOTIFY changed)
372  void setChownSocket(const QString &chownSocket);
373  QString chownSocket() const;
374 
380  Q_PROPERTY(QString umask READ umask WRITE setUmask NOTIFY changed)
381  void setUmask(const QString &value);
382  QString umask() const;
383 
389  Q_PROPERTY(int cpu_affinity READ cpuAffinity WRITE setCpuAffinity NOTIFY changed)
390  void setCpuAffinity(int value);
391  int cpuAffinity() const;
392 
398  Q_PROPERTY(bool reuse_port READ reusePort WRITE setReusePort NOTIFY changed)
399  void setReusePort(bool enable);
400  bool reusePort() const;
401 
406  Q_PROPERTY(bool lazy READ lazy WRITE setLazy NOTIFY changed)
407  void setLazy(bool enable);
408  bool lazy() const;
409 
416  Q_PROPERTY(bool using_frontend_proxy READ usingFrontendProxy WRITE setUsingFrontendProxy NOTIFY changed)
417  void setUsingFrontendProxy(bool enable);
418  bool usingFrontendProxy() const;
419 
420 Q_SIGNALS:
424  void ready();
425 
429  void stopped();
430 
431  void changed();
432 
436  void errorOccured(const QString& error);
437 
438 protected:
439  ServerPrivate *d_ptr;
440 };
441 
442 }
443 
444 #endif // CUTELYSTSERVER_H
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
The Cutelyst Application.
Definition: application.h:42