From 28a87f1f213a84781ef6a4ddfdd3ef1362d03743 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 11 Feb 2019 16:07:04 +0100 Subject: OCSP response - fix API as proposed in the API review. Change-Id: I607a38d24d533da59fc0d33dac886fa7693ed6c8 Fixes: QTBUG-73739 Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- src/network/ssl/qocspresponse.h | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/network/ssl/qocspresponse.h') diff --git a/src/network/ssl/qocspresponse.h b/src/network/ssl/qocspresponse.h index 5cff625b84..552a088ba5 100644 --- a/src/network/ssl/qocspresponse.h +++ b/src/network/ssl/qocspresponse.h @@ -42,8 +42,9 @@ #include +#include +#include #include -#include #ifndef Q_CLANG_QDOC QT_REQUIRE_CONFIG(ssl); @@ -51,14 +52,14 @@ QT_REQUIRE_CONFIG(ssl); QT_BEGIN_NAMESPACE -enum class OcspCertificateStatus +enum class QOcspCertificateStatus { Good, Revoked, Unknown }; -enum class OcspRevocationReason +enum class QOcspRevocationReason { None = -1, Unspecified, @@ -71,8 +72,11 @@ enum class OcspRevocationReason RemoveFromCRL }; +class QOcspResponse; +Q_NETWORK_EXPORT uint qHash(const QOcspResponse &response, uint seed = 0); + class QOcspResponsePrivate; -class QOcspResponse +class Q_NETWORK_EXPORT QOcspResponse { public: @@ -84,18 +88,29 @@ public: QOcspResponse &operator = (const QOcspResponse &other); QOcspResponse &operator = (QOcspResponse &&other) Q_DECL_NOTHROW; - OcspCertificateStatus certificateStatus() const; - OcspRevocationReason revocationReason() const; + QOcspCertificateStatus certificateStatus() const; + QOcspRevocationReason revocationReason() const; class QSslCertificate responder() const; QSslCertificate subject() const; + void swap(QOcspResponse &other) Q_DECL_NOTHROW { d.swap(other.d); } + private: friend class QSslSocketBackendPrivate; - QScopedPointer d; + friend Q_NETWORK_EXPORT bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs); + friend Q_NETWORK_EXPORT uint qHash(const QOcspResponse &response, uint seed); + + QSharedDataPointer d; }; +inline bool operator!=(const QOcspResponse &lhs, const QOcspResponse &rhs) { return !(lhs == rhs); } + +Q_DECLARE_SHARED(QOcspResponse) + QT_END_NAMESPACE +Q_DECLARE_METATYPE(QOcspResponse) + #endif // QOCSPRESPONSE_H -- cgit v1.2.3