cutelyst  4.5.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
tcpserver.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2016-2017 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef TCPSERVER_H
6 #define TCPSERVER_H
7 
8 #include <QTcpServer>
9 
10 namespace Cutelyst {
11 
12 class Server;
13 class Protocol;
14 class TcpSocket;
15 class ServerEngine;
16 class TcpServer : public QTcpServer
17 {
18  Q_OBJECT
19 public:
20  explicit TcpServer(const QByteArray &serverAddress,
21  Protocol *protocol,
22  Server *wsgi,
23  QObject *parent = nullptr);
24 
26  virtual void incomingConnection(qintptr handle) override;
27 
28  virtual void shutdown();
29  virtual void timeoutConnections();
30 
31  Protocol *protocol() const;
32  void setProtocol(Protocol *protocol);
33 
34 Q_SIGNALS:
35  void createConnection(qintptr handle);
36 
37 protected:
38  friend class TcpServerBalancer;
39 
40  QByteArray m_serverAddress;
41  ServerEngine *m_engine;
42  Server *m_wsgi;
43 
44  std::vector<std::pair<QAbstractSocket::SocketOption, QVariant>> m_socketOptions;
45  Protocol *m_protocol;
46  int m_processing = 0;
47 };
48 
49 } // namespace Cutelyst
50 
51 #endif // TCPSERVER_H
Implements a web server.
Definition: server.h:60
The Cutelyst namespace holds all public Cutelyst API.
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
QHostAddress serverAddress() const const