cutelyst  3.7.0
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 <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:
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;
116 
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 setHttp2HeaderTableSize NOTIFY changed)
146  void setHttp2HeaderTableSize(quint32 headerTableSize);
147  quint32 http2HeaderTableSize() const;
148 
154  Q_PROPERTY(bool upgrade_h2c READ upgradeH2c WRITE setUpgradeH2c NOTIFY changed)
155  void setUpgradeH2c(bool enable);
156  bool upgradeH2c() const;
157 
163  Q_PROPERTY(bool https_h2 READ httpsH2 WRITE setHttpsH2 NOTIFY changed)
164  void setHttpsH2(bool enable);
165  bool httpsH2() const;
166 
171  Q_PROPERTY(QStringList https_socket READ httpsSocket WRITE setHttpsSocket NOTIFY changed)
172  void setHttpsSocket(const QStringList &httpsSocket);
173  QStringList httpsSocket() const;
174 
179  Q_PROPERTY(QStringList fastcgi_socket READ fastcgiSocket WRITE setFastcgiSocket NOTIFY changed)
180  void setFastcgiSocket(const QStringList &fastcgiSocket);
181  QStringList fastcgiSocket() const;
182 
187  Q_PROPERTY(QString socket_access READ socketAccess WRITE setSocketAccess NOTIFY changed)
188  void setSocketAccess(const QString &socketAccess);
189  QString socketAccess() const;
190 
195  Q_PROPERTY(int socket_timeout READ socketTimeout WRITE setSocketTimeout NOTIFY changed)
196  void setSocketTimeout(int timeout);
197  int socketTimeout() const;
198 
203  Q_PROPERTY(QString chdir2 READ chdir2 WRITE setChdir2 NOTIFY changed)
204  void setChdir2(const QString &chdir2);
205  QString chdir2() const;
206 
211  Q_PROPERTY(QStringList ini READ ini WRITE setIni NOTIFY changed)
212  void setIni(const QStringList &files);
213  QStringList ini() const;
214 
219  Q_PROPERTY(QStringList json READ json WRITE setJson NOTIFY changed)
220  void setJson(const QStringList &files);
221  QStringList json() const;
222 
227  Q_PROPERTY(QStringList static_map READ staticMap WRITE setStaticMap NOTIFY changed)
228  void setStaticMap(const QStringList &staticMap);
229  QStringList staticMap() const;
230 
235  Q_PROPERTY(QStringList static_map2 READ staticMap2 WRITE setStaticMap2 NOTIFY changed)
236  void setStaticMap2(const QStringList &staticMap);
237  QStringList staticMap2() const;
238 
244  Q_PROPERTY(bool master READ master WRITE setMaster NOTIFY changed)
245  void setMaster(bool enable);
246  bool master() const;
247 
252  Q_PROPERTY(bool auto_reload READ autoReload WRITE setAutoReload NOTIFY changed)
253  void setAutoReload(bool enable);
254  bool autoReload() const;
255 
260  Q_PROPERTY(QStringList touch_reload READ touchReload WRITE setTouchReload NOTIFY changed)
261  void setTouchReload(const QStringList &files);
262  QStringList touchReload() const;
263 
270  Q_PROPERTY(int listen READ listenQueue WRITE setListenQueue NOTIFY changed)
271  void setListenQueue(int size);
272  int listenQueue() const;
273 
278  Q_PROPERTY(int buffer_size READ bufferSize WRITE setBufferSize NOTIFY changed)
279  void setBufferSize(int size);
280  int bufferSize() const;
281 
287  Q_PROPERTY(qint64 post_buffering READ postBuffering WRITE setPostBuffering NOTIFY changed)
288  void setPostBuffering(qint64 size);
289  qint64 postBuffering() const;
290 
295  Q_PROPERTY(qint64 post_buffering_bufsize READ postBufferingBufsize WRITE setPostBufferingBufsize NOTIFY changed)
296  void setPostBufferingBufsize(qint64 size);
297  qint64 postBufferingBufsize() const;
298 
303  Q_PROPERTY(bool tcp_nodelay READ tcpNodelay WRITE setTcpNodelay NOTIFY changed)
304  void setTcpNodelay(bool enable);
305  bool tcpNodelay() const;
306 
311  Q_PROPERTY(bool so_keepalive READ soKeepalive WRITE setSoKeepalive NOTIFY changed)
312  void setSoKeepalive(bool enable);
313  bool soKeepalive() const;
314 
319  Q_PROPERTY(int socket_sndbuf READ socketSndbuf WRITE setSocketSndbuf NOTIFY changed)
320  void setSocketSndbuf(int value);
321  int socketSndbuf() const;
322 
327  Q_PROPERTY(int socket_rcvbuf READ socketRcvbuf WRITE setSocketRcvbuf NOTIFY changed)
328  void setSocketRcvbuf(int value);
329  int socketRcvbuf() const;
330 
335  Q_PROPERTY(int websocket_max_size READ websocketMaxSize WRITE setWebsocketMaxSize NOTIFY changed)
336  void setWebsocketMaxSize(int value);
337  int websocketMaxSize() const;
338 
343  Q_PROPERTY(QString pidfile READ pidfile WRITE setPidfile NOTIFY changed)
344  void setPidfile(const QString &file);
345  QString pidfile() const;
346 
351  Q_PROPERTY(QString pidfile2 READ pidfile2 WRITE setPidfile2 NOTIFY changed)
352  void setPidfile2(const QString &file);
353  QString pidfile2() const;
354 
360  Q_PROPERTY(QString uid READ uid WRITE setUid NOTIFY changed)
361  void setUid(const QString &uid);
362  QString uid() const;
363 
369  Q_PROPERTY(QString gid READ gid WRITE setGid NOTIFY changed)
370  void setGid(const QString &gid);
371  QString gid() const;
372 
378  Q_PROPERTY(bool no_initgroups READ noInitgroups WRITE setNoInitgroups NOTIFY changed)
379  void setNoInitgroups(bool enable);
380  bool noInitgroups() const;
381 
387  Q_PROPERTY(QString chown_socket READ chownSocket WRITE setChownSocket NOTIFY changed)
388  void setChownSocket(const QString &chownSocket);
389  QString chownSocket() const;
390 
396  Q_PROPERTY(QString umask READ umask WRITE setUmask NOTIFY changed)
397  void setUmask(const QString &value);
398  QString umask() const;
399 
405  Q_PROPERTY(int cpu_affinity READ cpuAffinity WRITE setCpuAffinity NOTIFY changed)
406  void setCpuAffinity(int value);
407  int cpuAffinity() const;
408 
414  Q_PROPERTY(bool reuse_port READ reusePort WRITE setReusePort NOTIFY changed)
415  void setReusePort(bool enable);
416  bool reusePort() const;
417 
422  Q_PROPERTY(bool lazy READ lazy WRITE setLazy NOTIFY changed)
423  void setLazy(bool enable);
424  bool lazy() const;
425 
432  Q_PROPERTY(bool using_frontend_proxy READ usingFrontendProxy WRITE setUsingFrontendProxy NOTIFY changed)
433  void setUsingFrontendProxy(bool enable);
434  bool usingFrontendProxy() const;
435 
436 Q_SIGNALS:
440  void ready();
441 
445  void stopped();
446 
447  void changed();
448 
452  void errorOccured(const QString& error);
453 
454 protected:
455  ServerPrivate *d_ptr;
456 };
457 
458 }
459 
460 #endif // CUTELYSTSERVER_H
The Cutelyst Application.
Definition: application.h:43
void errorOccured(const QString &error)
bool start(Cutelyst::Application *app=nullptr)
This function will start the Cutelyst::Server in user application mode.
Server(QObject *parent=nullptr)
Server.
int exec(Cutelyst::Application *app=nullptr)
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8