cutelyst 4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
tcpserverbalancer.h
1/*
2 * SPDX-FileCopyrightText: (C) 2017 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#ifndef TCPSERVERBALANCER_H
6#define TCPSERVERBALANCER_H
7
8#include <QTcpServer>
9#include <QtGlobal>
10
12
13namespace Cutelyst {
14
15class Server;
16class TcpServer;
17class ServerEngine;
18class Protocol;
19class TcpServerBalancer final : public QTcpServer
20{
22public:
24 ~TcpServerBalancer() override;
25
26 bool listen(const QString &address, Protocol *protocol, bool secure);
27
28 void setBalancer(bool enable);
29 QByteArray serverName() const { return m_serverName; }
30
31 void incomingConnection(qintptr handle) override;
32
33 TcpServer *createServer(ServerEngine *engine);
34
35private:
36 QHostAddress m_address;
37 quint16 m_port = 0;
38 QByteArray m_serverName;
39 std::vector<TcpServer *> m_servers;
40 Server *m_wsgi;
41 Protocol *m_protocol = nullptr;
42 QSslConfiguration *m_sslConfiguration = nullptr;
43 int m_currentServer = 0;
44 bool m_balancer = false;
45};
46
47} // namespace Cutelyst
48
49#endif // TCPSERVERBALANCER_H
Implements a web server.
Definition server.h:60
The Cutelyst namespace holds all public Cutelyst API.
Q_OBJECTQ_OBJECT
QObject * parent() const const