blob: 19131e54970f37e1f59d722d1529a8dc76ea23a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdtls_base_p.h"
QT_BEGIN_NAMESPACE
void QDtlsBasePrivate::setDtlsError(QDtlsError code, const QString &description)
{
errorCode = code;
errorDescription = description;
}
QDtlsError QDtlsBasePrivate::error() const
{
return errorCode;
}
QString QDtlsBasePrivate::errorString() const
{
return errorDescription;
}
void QDtlsBasePrivate::clearDtlsError()
{
errorCode = QDtlsError::NoError;
errorDescription.clear();
}
QSslConfiguration QDtlsBasePrivate::configuration() const
{
return dtlsConfiguration;
}
void QDtlsBasePrivate::setConfiguration(const QSslConfiguration &configuration)
{
dtlsConfiguration = configuration;
clearDtlsError();
}
bool QDtlsBasePrivate::setCookieGeneratorParameters(const GenParams ¶ms)
{
if (!params.secret.size()) {
setDtlsError(QDtlsError::InvalidInputParameters,
QDtls::tr("Invalid (empty) secret"));
return false;
}
clearDtlsError();
hashAlgorithm = params.hash;
secret = params.secret;
return true;
}
QDtlsClientVerifier::GeneratorParameters
QDtlsBasePrivate::cookieGeneratorParameters() const
{
return {hashAlgorithm, secret};
}
bool QDtlsBasePrivate::isDtlsProtocol(QSsl::SslProtocol protocol)
{
switch (protocol) {
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
case QSsl::DtlsV1_0:
case QSsl::DtlsV1_0OrLater:
QT_WARNING_POP
case QSsl::DtlsV1_2:
case QSsl::DtlsV1_2OrLater:
return true;
default:
return false;
}
}
QT_END_NAMESPACE
|