Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5#ifndef QSSLSERVER_P_H
6#define QSSLSERVER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtNetwork/private/qtnetworkglobal_p.h>
20
21#include <QtCore/qhash.h>
22#include <QtCore/qtimer.h>
23
24#include <QtNetwork/QSslConfiguration>
25#include <QtNetwork/private/qtcpserver_p.h>
26#include <utility>
27
29
30class Q_NETWORK_EXPORT QSslServerPrivate : public QTcpServerPrivate
31{
32 static constexpr int DefaultHandshakeTimeout = 5'000; // 5 seconds
33public:
34 Q_DECLARE_PUBLIC(QSslServer)
35
37 void checkClientHelloAndContinue();
38 void initializeHandshakeProcess(QSslSocket *socket);
39 void removeSocketData(quintptr socket);
40 void handleHandshakeTimedOut(QSslSocket *socket);
41 int totalPendingConnections() const override;
42
43 struct SocketData {
46 std::shared_ptr<QTimer> timeoutTimer; // shared_ptr because QHash demands copying
47
49 std::shared_ptr<QTimer> &&timer)
50 : readyReadConnection(readyRead),
51 destroyedConnection(destroyed),
52 timeoutTimer(std::move(timer))
53 {
54 }
55
57 {
58 QObject::disconnect(std::exchange(readyReadConnection, {}));
59 QObject::disconnect(std::exchange(destroyedConnection, {}));
60 }
61 };
62 QHash<quintptr, SocketData> socketData;
63
65 int handshakeTimeout = DefaultHandshakeTimeout;
66};
67
68
70
71#endif // QSSLSERVER_P_H
\inmodule QtCore Represents a handle to a signal-slot (or signal-functor) connection.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3236
The QSslConfiguration class holds the configuration and state of an SSL connection.
QSslConfiguration sslConfiguration
QHash< quintptr, SocketData > socketData
\inmodule QtNetwork
Definition qsslserver.h:25
The QSslSocket class provides an SSL encrypted socket for both clients and servers.
Definition qsslsocket.h:29
Combined button and popup list for selecting options.
size_t quintptr
Definition qtypes.h:167
QTcpSocket * socket
[1]
QTimer * timer
[3]
SocketData(QMetaObject::Connection readyRead, QMetaObject::Connection destroyed, std::shared_ptr< QTimer > &&timer)
std::shared_ptr< QTimer > timeoutTimer
QMetaObject::Connection destroyedConnection
QMetaObject::Connection readyReadConnection