cutelyst 5.1.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 QString bindError() const { return m_bindError; }
31
32 void incomingConnection(qintptr handle) override;
33
34 TcpServer *createServer(ServerEngine *engine);
35
36private:
37 QHostAddress m_address;
38 quint16 m_port = 0;
39 QByteArray m_serverName;
40 std::vector<TcpServer *> m_servers;
41 Server *m_server;
42 Protocol *m_protocol = nullptr;
43 QSslConfiguration *m_sslConfiguration = nullptr;
44 int m_currentServer = 0;
45 bool m_balancer = false;
46 QString m_bindError;
47};
48
49} // namespace Cutelyst
50
51#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