24void DtlsConnection::continueHandshake(
const QByteArray &datagram)
28 if (
dtls.handshakeStatus() == QDlts::HandshakeComplete) {
39DtlsClient::DtlsClient()
45void DtlsClient::handleTimeout()
53dtlsConnection.writeDatagramEncrypted(&
clientSocket,
"Hello DTLS server!");
62DtlsClient::~DtlsClient()
69auto config = QSslConfiguration::defaultDtlsConfiguration();
70config.setDtlsCookieVerificationEnabled(
false);
72dtlsConnection.setDtlsConfiguration(
config);
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
This class provides encryption for UDP sockets.
bool setPeer(const QHostAddress &address, quint16 port, const QString &verificationName={})
Sets the peer's address, port, and host name and returns true if successful.
void handshakeTimeout()
Packet loss can result in timeouts during the handshake phase.
bool handleTimeout(QUdpSocket *socket)
If a timeout occurs during the handshake, the handshakeTimeout() signal is emitted.
bool doHandshake(QUdpSocket *socket, const QByteArray &dgram={})
Starts or continues a DTLS handshake.
bool shutdown(QUdpSocket *socket)
Sends an encrypted shutdown alert message and closes the DTLS connection.
void ignoreVerificationErrors(const QList< QSslError > &errorsToIgnore)
This method tells QDtls to ignore only the errors given in errorsToIgnore.
QDtlsError dtlsError() const
Returns the last error encountered by the connection or QDtlsError::NoError.
The QHostAddress class provides an IP address.
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
static QList< QSslCertificate > fromPath(const QString &path, QSsl::EncodingFormat format=QSsl::Pem, PatternSyntax syntax=PatternSyntax::FixedString)
The QSslError class provides an SSL error.
constexpr Initialization Uninitialized
DBusConnection const char DBusError * error
GLuint GLuint64EXT address
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
QList< QSslError > expectedSslErrors
const QByteArray plainText
QByteArray encryptedMessage(dgramSize)
QByteArray clientHello(serverSocket.pendingDatagramSize(), Qt::Uninitialized)
QUdpSocket clientSocket
[0]
QList< QSslCertificate > cert
[5]
serverDtls doHandshake & serverSocket