7#include <QSslCertificate>
12#include <Kanoop/mutexevent.h>
14#include <Kanoop/utility/loggingbaseclass.h>
35 TcpServer(
const QHostAddress& serverAddress,
int serverPort);
46 TcpServer(
const QHostAddress& serverAddress,
int serverPort,
const QSslKey& privateKey,
const QSslCertificate& localCertificate,
const QSslCertificate& caCert,
bool verifyPeer =
false);
57 TcpServer(
const QHostAddress& serverAddress,
int serverPort,
const QSslKey& privateKey,
const QSslCertificate& localCertificate,
const QList<QSslCertificate>& caCerts,
bool verifyPeer =
false);
79 QList<QSslCertificate>
caCerts()
const {
return _caCerts; }
107 QHostAddress _serverAddress;
112 QList<TcpServerClientObject*> _clients;
115 QSslCertificate _localCertificate;
116 QList<QSslCertificate> _caCerts;
120 QDateTime _startTime;
126 void onThreadStarted();
128 void onThreadFinished();
130 void onClientFinished();
Mixin base class providing categorized logging at four nesting levels.
Manages the lifetime of a single accepted TCP (or SSL/TLS) client socket.
Abstract TCP server supporting both plain-text and TLS/SSL connections.
bool verifyPeer() const
Return whether peer certificate verification is enabled.
QList< QSslCertificate > caCerts() const
Return the list of CA certificates (SSL mode only).
TcpServer(const QHostAddress &serverAddress, int serverPort, const QSslKey &privateKey, const QSslCertificate &localCertificate, const QList< QSslCertificate > &caCerts, bool verifyPeer=false)
Construct an SSL/TLS TCP server with a list of CA certificates.
QSslKey privateKey() const
Return the server's private key (SSL mode only).
QSslCertificate localCertificate() const
Return the server's local certificate (SSL mode only).
QDateTime startTime() const
Return the time the server was started.
TcpServer(const QHostAddress &serverAddress, int serverPort, const QSslKey &privateKey, const QSslCertificate &localCertificate, const QSslCertificate &caCert, bool verifyPeer=false)
Construct an SSL/TLS TCP server with a single CA certificate.
TcpServer(const QHostAddress &serverAddress, int serverPort)
Construct a plain-text TCP server.
bool start()
Start the server and begin accepting connections.
virtual void incomingConnection(qintptr handle) override
Handle a new incoming connection by delegating to createClient().
virtual ~TcpServer()
Destructor — stops the server and cleans up all client connections.
void stop()
Stop the server and close all active client connections.
virtual TcpServerClientObject * createClient(TcpServer *server, qintptr fd)=0
Factory method called for each incoming connection.