Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsslserver_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// Copyright (C) 2016 Kurt Pattyn <pattyn.kurt@gmail.com>.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QSSLSERVER_P_H
7#define QSSLSERVER_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtNetwork/private/qtnetworkglobal_p.h>
21
22#include <QtCore/qhash.h>
23#include <QtCore/qtimer.h>
24
25#include <QtNetwork/QSslConfiguration>
26#include <QtNetwork/private/qtcpserver_p.h>
27#include <utility>
28
30
31class Q_NETWORK_EXPORT QSslServerPrivate : public QTcpServerPrivate
32{
33 static constexpr int DefaultHandshakeTimeout = 5'000; // 5 seconds
34public:
35 Q_DECLARE_PUBLIC(QSslServer)
36
37 QSslServerPrivate();
38 void checkClientHelloAndContinue();
39 void initializeHandshakeProcess(QSslSocket *socket);
40 void removeSocketData(quintptr socket);
41 void handleHandshakeTimedOut(QSslSocket *socket);
42 int totalPendingConnections() const override;
43
44 struct SocketData {
45 QMetaObject::Connection readyReadConnection;
46 QMetaObject::Connection destroyedConnection;
47 std::shared_ptr<QTimer> timeoutTimer; // shared_ptr because QHash demands copying
48
49 SocketData(QMetaObject::Connection readyRead, QMetaObject::Connection destroyed,
50 std::shared_ptr<QTimer> &&timer)
51 : readyReadConnection(readyRead),
52 destroyedConnection(destroyed),
53 timeoutTimer(std::move(timer))
54 {
55 }
56
57 void disconnectSignals()
58 {
59 QObject::disconnect(std::exchange(readyReadConnection, {}));
60 QObject::disconnect(std::exchange(destroyedConnection, {}));
61 }
62 };
63 QHash<quintptr, SocketData> socketData;
64
65 QSslConfiguration sslConfiguration;
66 int handshakeTimeout = DefaultHandshakeTimeout;
67};
68
69
70QT_END_NAMESPACE
71
72#endif // QSSLSERVER_P_H
\inmodule QtNetwork
Definition qsslserver.h:26
QT_REQUIRE_CONFIG(ssl)