diff options
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qdnslookup.cpp | 10 | ||||
-rw-r--r-- | src/network/kernel/qdnslookup.h | 15 | ||||
-rw-r--r-- | src/network/kernel/qdnslookup_win.cpp | 2 | ||||
-rw-r--r-- | src/network/kernel/qnetworkinformation.cpp | 2 | ||||
-rw-r--r-- | src/network/kernel/qnetworkinformation.h | 4 | ||||
-rw-r--r-- | src/network/kernel/qnetworkinformation_p.h | 4 | ||||
-rw-r--r-- | src/network/kernel/qnetworkinterface_unix.cpp | 26 | ||||
-rw-r--r-- | src/network/kernel/qnetworkproxy_android.cpp | 33 | ||||
-rw-r--r-- | src/network/kernel/qtldurl.cpp | 4 |
9 files changed, 50 insertions, 50 deletions
diff --git a/src/network/kernel/qdnslookup.cpp b/src/network/kernel/qdnslookup.cpp index 1b4db7130b..e25662b33c 100644 --- a/src/network/kernel/qdnslookup.cpp +++ b/src/network/kernel/qdnslookup.cpp @@ -24,7 +24,7 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; -static Q_LOGGING_CATEGORY(lcDnsLookup, "qt.network.dnslookup", QtCriticalMsg) +Q_STATIC_LOGGING_CATEGORY(lcDnsLookup, "qt.network.dnslookup", QtCriticalMsg) namespace { struct QDnsLookupThreadPool : QThreadPool @@ -336,7 +336,7 @@ quint16 QDnsLookup::defaultPortForProtocol(Protocol protocol) noexcept */ /*! - \fn void QDnsLookup::typeChanged(Type type) + \fn void QDnsLookup::typeChanged(QDnsLookup::Type type) This signal is emitted when the lookup \l type changes. \a type is the new lookup type. @@ -1295,7 +1295,7 @@ QDnsTextRecord &QDnsTextRecord::operator=(const QDnsTextRecord &other) \sa QDnsLookup */ -QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QDnsTlsAssociationRecordPrivate) +QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QDnsTlsAssociationRecordPrivate) /*! \enum QDnsTlsAssociationRecord::CertificateUsage @@ -1347,7 +1347,7 @@ QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QDnsTlsAssociationRecordPrivate) standards. This enumeration can be used for those values even if no enumerator is provided. - \sa certificateUsage() + \sa usage() */ /*! @@ -1415,7 +1415,7 @@ QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QDnsTlsAssociationRecordPrivate) standards. This enumeration can be used for those values even if no enumerator is provided. - \sa matchingType() + \sa matchType() */ /*! diff --git a/src/network/kernel/qdnslookup.h b/src/network/kernel/qdnslookup.h index 8d21e99c84..0cf601698f 100644 --- a/src/network/kernel/qdnslookup.h +++ b/src/network/kernel/qdnslookup.h @@ -25,7 +25,7 @@ class QDnsTextRecordPrivate; class QDnsTlsAssociationRecordPrivate; class QSslConfiguration; -QT_DECLARE_QSDP_SPECIALIZATION_DTOR(QDnsTlsAssociationRecordPrivate) +QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QDnsTlsAssociationRecordPrivate) class Q_NETWORK_EXPORT QDnsDomainNameRecord { @@ -144,6 +144,7 @@ Q_DECLARE_SHARED(QDnsTextRecord) class Q_NETWORK_EXPORT QDnsTlsAssociationRecord { Q_GADGET + Q_CLASSINFO("RegisterEnumClassesUnscoped", "false") public: enum class CertificateUsage : quint8 { // https://www.iana.org/assignments/dane-parameters/dane-parameters.xhtml#certificate-usages @@ -190,10 +191,8 @@ public: QDnsTlsAssociationRecord(); QDnsTlsAssociationRecord(const QDnsTlsAssociationRecord &other); - QDnsTlsAssociationRecord(QDnsTlsAssociationRecord &&other) - : d(std::move(other.d)) - {} - QDnsTlsAssociationRecord &operator=(QDnsTlsAssociationRecord &&other) noexcept { swap(other); return *this; } + QDnsTlsAssociationRecord(QDnsTlsAssociationRecord &&other) noexcept = default; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QDnsTlsAssociationRecord) QDnsTlsAssociationRecord &operator=(const QDnsTlsAssociationRecord &other); ~QDnsTlsAssociationRecord(); @@ -207,7 +206,7 @@ public: QByteArray value() const; private: - QSharedDataPointer<QDnsTlsAssociationRecordPrivate> d; + QExplicitlySharedDataPointer<QDnsTlsAssociationRecordPrivate> d; friend class QDnsLookupRunnable; }; @@ -323,10 +322,10 @@ public Q_SLOTS: Q_SIGNALS: void finished(); void nameChanged(const QString &name); - void typeChanged(Type type); + void typeChanged(QDnsLookup::Type type); void nameserverChanged(const QHostAddress &nameserver); void nameserverPortChanged(quint16 port); - void nameserverProtocolChanged(Protocol protocol); + void nameserverProtocolChanged(QDnsLookup::Protocol protocol); private: Q_DECLARE_PRIVATE(QDnsLookup) diff --git a/src/network/kernel/qdnslookup_win.cpp b/src/network/kernel/qdnslookup_win.cpp index 92dd95ab53..1b07776db9 100644 --- a/src/network/kernel/qdnslookup_win.cpp +++ b/src/network/kernel/qdnslookup_win.cpp @@ -96,7 +96,7 @@ static DNS_STATUS sendAlternate(QDnsLookupRunnable *self, QDnsLookupReply *reply dnsBuffer->MessageHead.AuthenticatedData = true; QDnsLookupRunnable::ReplyBuffer replyBuffer; - if (!self->sendDnsOverTls(reply, { query.data(), dnsBufferSize }, replyBuffer)) + if (!self->sendDnsOverTls(reply, { query.data(), qsizetype(dnsBufferSize) }, replyBuffer)) return DNS_STATUS(-1); // error set in reply // interpret the RCODE in the reply diff --git a/src/network/kernel/qnetworkinformation.cpp b/src/network/kernel/qnetworkinformation.cpp index 10d6b89e2c..5115372b20 100644 --- a/src/network/kernel/qnetworkinformation.cpp +++ b/src/network/kernel/qnetworkinformation.cpp @@ -328,7 +328,7 @@ QNetworkInformationBackend::~QNetworkInformationBackend() = default; */ /*! - \fn void QNetworkInformationBackend::reachabilityChanged() + \fn void QNetworkInformationBackend::reachabilityChanged(NetworkInformation::Reachability reachability) You should not emit this signal manually, call setReachability() instead which will emit this signal when the value changes. diff --git a/src/network/kernel/qnetworkinformation.h b/src/network/kernel/qnetworkinformation.h index 57a49f23c8..72e2b59550 100644 --- a/src/network/kernel/qnetworkinformation.h +++ b/src/network/kernel/qnetworkinformation.h @@ -76,9 +76,9 @@ public: static QNetworkInformation *instance(); Q_SIGNALS: - void reachabilityChanged(Reachability newReachability); + void reachabilityChanged(QNetworkInformation::Reachability newReachability); void isBehindCaptivePortalChanged(bool state); - void transportMediumChanged(TransportMedium current); + void transportMediumChanged(QNetworkInformation::TransportMedium current); void isMeteredChanged(bool isMetered); private: diff --git a/src/network/kernel/qnetworkinformation_p.h b/src/network/kernel/qnetworkinformation_p.h index 504955a6e1..76b2937ced 100644 --- a/src/network/kernel/qnetworkinformation_p.h +++ b/src/network/kernel/qnetworkinformation_p.h @@ -74,9 +74,9 @@ public: } Q_SIGNALS: - void reachabilityChanged(Reachability reachability); + void reachabilityChanged(QNetworkInformation::Reachability reachability); void behindCaptivePortalChanged(bool behindPortal); - void transportMediumChanged(TransportMedium medium); + void transportMediumChanged(QNetworkInformation::TransportMedium medium); void isMeteredChanged(bool isMetered); protected: diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp index c0a7d9e00d..39ff8dbb92 100644 --- a/src/network/kernel/qnetworkinterface_unix.cpp +++ b/src/network/kernel/qnetworkinterface_unix.cpp @@ -310,12 +310,20 @@ QT_BEGIN_INCLUDE_NAMESPACE QT_END_INCLUDE_NAMESPACE # endif +static int openSocket(int &socket) +{ + if (socket == -1) + socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0); + return socket; +} + # if defined(Q_OS_LINUX) && __GLIBC__ - 0 >= 2 && __GLIBC_MINOR__ - 0 >= 1 && !defined(QT_LINUXBASE) # include <netpacket/packet.h> static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList) { Q_UNUSED(getMtu); + Q_UNUSED(openSocket); QList<QNetworkInterfacePrivate *> interfaces; QDuplicateTracker<QString> seenInterfaces; QDuplicateTracker<int> seenIndexes; @@ -387,13 +395,6 @@ QT_BEGIN_INCLUDE_NAMESPACE #endif // QT_PLATFORM_UIKIT QT_END_INCLUDE_NAMESPACE -static int openSocket(int &socket) -{ - if (socket == -1) - socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0); - return socket; -} - static QNetworkInterface::InterfaceType probeIfType(int socket, int iftype, struct ifmediareq *req) { // Determine the interface type. @@ -537,8 +538,8 @@ static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList) { - Q_UNUSED(getMtu); QList<QNetworkInterfacePrivate *> interfaces; + int socket = -1; // make sure there's one entry for each interface for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) { @@ -559,9 +560,18 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList) iface->index = ifindex; iface->name = QString::fromLatin1(ptr->ifa_name); iface->flags = convertFlags(ptr->ifa_flags); + + if ((socket = openSocket(socket)) >= 0) { + struct ifreq ifr; + qstrncpy(ifr.ifr_name, ptr->ifa_name, sizeof(ifr.ifr_name)); + iface->mtu = getMtu(socket, &ifr); + } } } + if (socket != -1) + qt_safe_close(socket); + return interfaces; } diff --git a/src/network/kernel/qnetworkproxy_android.cpp b/src/network/kernel/qnetworkproxy_android.cpp index 3d37266b70..d5b56bba86 100644 --- a/src/network/kernel/qnetworkproxy_android.cpp +++ b/src/network/kernel/qnetworkproxy_android.cpp @@ -19,26 +19,21 @@ public: }; using namespace QNativeInterface; +using namespace QtJniTypes; Q_GLOBAL_STATIC(ProxyInfoObject, proxyInfoInstance) -static const char networkClass[] = "org/qtproject/qt/android/network/QtNetwork"; - +Q_DECLARE_JNI_CLASS(QtNetwork, "org/qtproject/qt/android/network/QtNetwork") Q_DECLARE_JNI_CLASS(ProxyInfo, "android/net/ProxyInfo") -Q_DECLARE_JNI_TYPE(JStringArray, "[Ljava/lang/String;") ProxyInfoObject::ProxyInfoObject() { - QJniObject::callStaticMethod<void>(networkClass, - "registerReceiver", - QAndroidApplication::context()); + QtNetwork::callStaticMethod<void>("registerReceiver", QAndroidApplication::context()); } ProxyInfoObject::~ProxyInfoObject() { - QJniObject::callStaticMethod<void>(networkClass, - "unregisterReceiver", - QAndroidApplication::context()); + QtNetwork::callStaticMethod<void>("unregisterReceiver", QAndroidApplication::context()); } QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query) @@ -47,20 +42,14 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro if (!proxyInfoInstance) return proxyList; - QJniObject proxyInfo = QJniObject::callStaticObjectMethod<QtJniTypes::ProxyInfo>( - networkClass, "getProxyInfo", QAndroidApplication::context()); + QJniObject proxyInfo = QtNetwork::callStaticMethod<ProxyInfo>("getProxyInfo", + QAndroidApplication::context()); if (proxyInfo.isValid()) { - QJniObject exclusionList = - proxyInfo.callObjectMethod<QtJniTypes::JStringArray>("getExclusionList"); + const QJniArray exclusionList = proxyInfo.callMethod<String[]>("getExclusionList"); bool exclude = false; if (exclusionList.isValid()) { - jobjectArray listObject = exclusionList.object<jobjectArray>(); - QJniEnvironment env; - QJniObject entry; - const int size = env->GetArrayLength(listObject); - QUrl host = QUrl(query.url().host()); - for (int i = 0; i < size; ++i) { - entry = env->GetObjectArrayElement(listObject, i); + const QUrl host = QUrl(query.url().host()); + for (const auto &entry : exclusionList) { if (host.matches(QUrl(entry.toString()), QUrl::RemoveScheme)) { exclude = true; break; @@ -68,9 +57,9 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro } } if (!exclude) { - QJniObject hostName = proxyInfo.callObjectMethod<jstring>("getHost"); + const QString hostName = proxyInfo.callMethod<QString>("getHost"); const int port = proxyInfo.callMethod<jint>("getPort"); - QNetworkProxy proxy(QNetworkProxy::HttpProxy, hostName.toString(), port); + QNetworkProxy proxy(QNetworkProxy::HttpProxy, hostName, port); proxyList << proxy; } } diff --git a/src/network/kernel/qtldurl.cpp b/src/network/kernel/qtldurl.cpp index a7aceddb18..4ad11d8c36 100644 --- a/src/network/kernel/qtldurl.cpp +++ b/src/network/kernel/qtldurl.cpp @@ -28,7 +28,9 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; -Q_LOGGING_CATEGORY(lcTld, "qt.network.tld") +#if QT_CONFIG(publicsuffix_system) +Q_STATIC_LOGGING_CATEGORY(lcTld, "qt.network.tld") +#endif static constexpr int PSL_NOT_FOUND = -1; static constexpr int PSL_FLAG_EXCEPTION = 1 << 0; |