summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--src/network/.prev_CMakeLists.txt24
-rw-r--r--src/network/CMakeLists.txt24
-rw-r--r--src/network/access/qnetworkrequest.cpp2
-rw-r--r--src/network/bearer/bearer.pri22
-rw-r--r--src/network/bearer/qbearerengine.cpp101
-rw-r--r--src/network/bearer/qbearerengine_impl_p.h85
-rw-r--r--src/network/bearer/qbearerengine_p.h115
-rw-r--r--src/network/bearer/qbearerplugin.cpp57
-rw-r--r--src/network/bearer/qbearerplugin_p.h81
-rw-r--r--src/network/bearer/qnetworkconfigmanager.cpp389
-rw-r--r--src/network/bearer/qnetworkconfigmanager.h109
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp517
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.h141
-rw-r--r--src/network/bearer/qnetworkconfiguration.cpp596
-rw-r--r--src/network/bearer/qnetworkconfiguration.h147
-rw-r--r--src/network/bearer/qnetworkconfiguration_p.h99
-rw-r--r--src/network/bearer/qnetworksession.cpp743
-rw-r--r--src/network/bearer/qnetworksession.h159
-rw-r--r--src/network/bearer/qnetworksession_impl.cpp439
-rw-r--r--src/network/bearer/qnetworksession_impl_p.h134
-rw-r--r--src/network/bearer/qnetworksession_p.h157
-rw-r--r--src/network/bearer/qsharednetworksession.cpp102
-rw-r--r--src/network/bearer/qsharednetworksession_p.h92
-rw-r--r--src/network/configure.cmake8
-rw-r--r--src/network/configure.json11
-rw-r--r--src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp9
-rw-r--r--src/network/doc/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp58
-rw-r--r--src/network/doc/snippets/code/src_network_bearer_qnetworksession.cpp60
-rw-r--r--src/network/doc/src/bearermanagement.qdoc242
-rw-r--r--src/network/doc/src/network-programming.qdoc3
-rw-r--r--src/network/kernel/qhostinfo.cpp1
-rw-r--r--src/network/kernel/qhostinfo_p.h1
-rw-r--r--src/network/kernel/qnetworkproxy.h1
-rw-r--r--src/network/network.pro12
-rw-r--r--src/plugins/CMakeLists.txt3
-rw-r--r--src/plugins/bearer/.prev_CMakeLists.txt12
-rw-r--r--src/plugins/bearer/CMakeLists.txt14
-rw-r--r--src/plugins/bearer/android/CMakeLists.txt4
-rw-r--r--src/plugins/bearer/android/android.pro4
-rw-r--r--src/plugins/bearer/android/jar/.prev_CMakeLists.txt16
-rw-r--r--src/plugins/bearer/android/jar/CMakeLists.txt22
-rw-r--r--src/plugins/bearer/android/jar/jar.pro15
-rw-r--r--src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java92
-rw-r--r--src/plugins/bearer/android/src/CMakeLists.txt19
-rw-r--r--src/plugins/bearer/android/src/android.json3
-rw-r--r--src/plugins/bearer/android/src/main.cpp63
-rw-r--r--src/plugins/bearer/android/src/qandroidbearerengine.cpp391
-rw-r--r--src/plugins/bearer/android/src/qandroidbearerengine.h95
-rw-r--r--src/plugins/bearer/android/src/src.pro14
-rw-r--r--src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp387
-rw-r--r--src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.h168
-rw-r--r--src/plugins/bearer/android/src/wrappers/wrappers.pri6
-rw-r--r--src/plugins/bearer/bearer.pro11
-rw-r--r--src/plugins/bearer/connman/.prev_CMakeLists.txt26
-rw-r--r--src/plugins/bearer/connman/CMakeLists.txt22
-rw-r--r--src/plugins/bearer/connman/connman.json3
-rw-r--r--src/plugins/bearer/connman/connman.pro16
-rw-r--r--src/plugins/bearer/connman/main.cpp85
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp570
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h145
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp516
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h230
-rw-r--r--src/plugins/bearer/corewlan/CMakeLists.txt30
-rw-r--r--src/plugins/bearer/corewlan/corewlan.json3
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro20
-rw-r--r--src/plugins/bearer/corewlan/main.cpp82
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h147
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm862
-rw-r--r--src/plugins/bearer/generic/CMakeLists.txt28
-rw-r--r--src/plugins/bearer/generic/generic.json3
-rw-r--r--src/plugins/bearer/generic/generic.pro16
-rw-r--r--src/plugins/bearer/generic/main.cpp78
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp446
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h90
-rw-r--r--src/plugins/bearer/nativewifi/main.cpp127
-rw-r--r--src/plugins/bearer/nativewifi/nativewifi.json3
-rw-r--r--src/plugins/bearer/nativewifi/nativewifi.pro15
-rw-r--r--src/plugins/bearer/nativewifi/platformdefs.h327
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp622
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h106
-rw-r--r--src/plugins/bearer/networkmanager/.prev_CMakeLists.txt26
-rw-r--r--src/plugins/bearer/networkmanager/CMakeLists.txt22
-rw-r--r--src/plugins/bearer/networkmanager/main.cpp84
-rw-r--r--src/plugins/bearer/networkmanager/networkmanager.json3
-rw-r--r--src/plugins/bearer/networkmanager/networkmanager.pro16
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp935
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h153
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp1019
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.h500
-rw-r--r--src/plugins/bearer/nla/main.cpp78
-rw-r--r--src/plugins/bearer/nla/nla.json3
-rw-r--r--src/plugins/bearer/nla/nla.pro17
-rw-r--r--src/plugins/bearer/nla/qnlaengine.cpp639
-rw-r--r--src/plugins/bearer/nla/qnlaengine.h110
-rw-r--r--src/plugins/bearer/platformdefs_win.h142
-rw-r--r--src/plugins/plugins.pro1
-rw-r--r--src/tools/uic/qclass_lib_map.h3
-rw-r--r--tests/auto/network/CMakeLists.txt1
-rw-r--r--tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp21
-rw-r--r--tests/auto/network/access/qftp/tst_qftp.cpp57
-rw-r--r--tests/auto/network/bearer/CMakeLists.txt6
-rw-r--r--tests/auto/network/bearer/bearer.pro7
-rw-r--r--tests/auto/network/bearer/qbearertestcommon.h49
-rw-r--r--tests/auto/network/bearer/qnetworkconfiguration/CMakeLists.txt13
-rw-r--r--tests/auto/network/bearer/qnetworkconfiguration/qnetworkconfiguration.pro6
-rw-r--r--tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp203
-rw-r--r--tests/auto/network/bearer/qnetworkconfigurationmanager/CMakeLists.txt13
-rw-r--r--tests/auto/network/bearer/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro6
-rw-r--r--tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp243
-rw-r--r--tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/CMakeLists.txt13
-rw-r--r--tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/qnetworkconfigurationmanagerqappless.pro6
-rw-r--r--tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/tst_qnetworkconfigurationmanagerqappless.cpp60
-rw-r--r--tests/auto/network/bearer/qnetworksession/CMakeLists.txt7
-rw-r--r--tests/auto/network/bearer/qnetworksession/lackey/CMakeLists.txt13
-rw-r--r--tests/auto/network/bearer/qnetworksession/lackey/lackey.pro8
-rw-r--r--tests/auto/network/bearer/qnetworksession/lackey/main.cpp147
-rw-r--r--tests/auto/network/bearer/qnetworksession/qnetworksession.pro4
-rw-r--r--tests/auto/network/bearer/qnetworksession/test/.prev_CMakeLists.txt29
-rw-r--r--tests/auto/network/bearer/qnetworksession/test/CMakeLists.txt30
-rw-r--r--tests/auto/network/bearer/qnetworksession/test/test.pro18
-rw-r--r--tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp1299
-rw-r--r--tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp22
-rw-r--r--tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp33
-rw-r--r--tests/auto/network/network.pro2
-rw-r--r--tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp13
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp1
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp21
-rw-r--r--tests/manual/.prev_CMakeLists.txt68
-rw-r--r--tests/manual/CMakeLists.txt5
-rw-r--r--tests/manual/bearerex/CMakeLists.txt25
-rw-r--r--tests/manual/bearerex/bearerex.cpp569
-rw-r--r--tests/manual/bearerex/bearerex.h134
-rw-r--r--tests/manual/bearerex/bearerex.pro21
-rw-r--r--tests/manual/bearerex/bearerex.ui95
-rw-r--r--tests/manual/bearerex/bearerex_maemo.ui100
-rw-r--r--tests/manual/bearerex/datatransferer.cpp166
-rw-r--r--tests/manual/bearerex/datatransferer.h100
-rw-r--r--tests/manual/bearerex/detailedinfodialog.ui54
-rw-r--r--tests/manual/bearerex/main.cpp42
-rw-r--r--tests/manual/bearerex/sessiondialog.ui187
-rw-r--r--tests/manual/bearerex/sessiondialog_maemo.ui151
-rw-r--r--tests/manual/bearerex/xqlistwidget.cpp54
-rw-r--r--tests/manual/bearerex/xqlistwidget.h46
-rw-r--r--tests/manual/manual.pro4
-rw-r--r--tests/manual/qnetworkaccessmanager/qget/qget.cpp3
-rw-r--r--tests/manual/qnetworkconfiguration/CMakeLists.txt16
-rw-r--r--tests/manual/qnetworkconfiguration/main.cpp126
-rw-r--r--tests/manual/qnetworkconfiguration/qnetworkconfiguration.pro7
-rw-r--r--tests/manual/qnetworkconfigurationmanager/CMakeLists.txt16
-rw-r--r--tests/manual/qnetworkconfigurationmanager/main.cpp71
-rw-r--r--tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro7
-rw-r--r--tests/manual/socketengine/main.cpp3
153 files changed, 74 insertions, 18797 deletions
diff --git a/.gitignore b/.gitignore
index b1cb6fdf4e..c7ac5ad33d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -148,7 +148,6 @@ qt*-config.pri
/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver
/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal
/tests/auto/gui/kernel/qguivariant/no_application/no_application
-/tests/auto/network/bearer/qnetworksession/lackey/lackey
/tests/auto/network/socket/qlocalsocket/socketprocess/socketprocess
/tests/auto/other/qobjectrace/qobjectrace
/tests/auto/other/qprocess_and_guieventloop/write-read-write/write-read-write
diff --git a/src/network/.prev_CMakeLists.txt b/src/network/.prev_CMakeLists.txt
index a1d30b6c83..6b0af4bcc9 100644
--- a/src/network/.prev_CMakeLists.txt
+++ b/src/network/.prev_CMakeLists.txt
@@ -70,30 +70,6 @@ qt_extend_target(Network CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i3
"/BASE:0x64000000"
)
-if(ANDROID AND (QT_FEATURE_bearermanagement))
- set_property(TARGET Network APPEND PROPERTY QT_ANDROID_BUNDLED_JAR_DEPENDENCIES
- jar/QtAndroidBearer.jar
- )
- set_property(TARGET Network APPEND PROPERTY QT_ANDROID_LIB_DEPENDENCIES
- plugins/bearer/libplugins_bearer_qandroidbearer.so
- )
- set_property(TARGET Network APPEND PROPERTY QT_ANDROID_PERMISSIONS
- android.permission.ACCESS_NETWORK_STATE
- )
-endif()
-
-qt_extend_target(Network CONDITION QT_FEATURE_bearermanagement
- SOURCES
- bearer/qbearerengine.cpp bearer/qbearerengine_p.h
- bearer/qbearerengine_impl_p.h
- bearer/qbearerplugin.cpp bearer/qbearerplugin_p.h
- bearer/qnetworkconfigmanager.cpp bearer/qnetworkconfigmanager.h bearer/qnetworkconfigmanager_p.cpp bearer/qnetworkconfigmanager_p.h
- bearer/qnetworkconfiguration.cpp bearer/qnetworkconfiguration.h bearer/qnetworkconfiguration_p.h
- bearer/qnetworksession.cpp bearer/qnetworksession.h bearer/qnetworksession_p.h
- bearer/qnetworksession_impl.cpp bearer/qnetworksession_impl_p.h
- bearer/qsharednetworksession.cpp bearer/qsharednetworksession_p.h
-)
-
qt_extend_target(Network CONDITION QT_FEATURE_ftp
SOURCES
access/qftp.cpp access/qftp_p.h
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index 86eadf653c..a779eeb6a0 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -70,30 +70,6 @@ qt_extend_target(Network CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i3
"/BASE:0x64000000"
)
-if(ANDROID AND (QT_FEATURE_bearermanagement))
- set_property(TARGET Network APPEND PROPERTY QT_ANDROID_BUNDLED_JAR_DEPENDENCIES
- jar/QtAndroidBearer.jar
- )
- set_property(TARGET Network APPEND PROPERTY QT_ANDROID_LIB_DEPENDENCIES
- plugins/bearer/libplugins_bearer_qandroidbearer.so
- )
- set_property(TARGET Network APPEND PROPERTY QT_ANDROID_PERMISSIONS
- android.permission.ACCESS_NETWORK_STATE
- )
-endif()
-
-qt_extend_target(Network CONDITION QT_FEATURE_bearermanagement
- SOURCES
- bearer/qbearerengine.cpp bearer/qbearerengine_p.h
- bearer/qbearerengine_impl_p.h
- bearer/qbearerplugin.cpp bearer/qbearerplugin_p.h
- bearer/qnetworkconfigmanager.cpp bearer/qnetworkconfigmanager.h bearer/qnetworkconfigmanager_p.cpp bearer/qnetworkconfigmanager_p.h
- bearer/qnetworkconfiguration.cpp bearer/qnetworkconfiguration.h bearer/qnetworkconfiguration_p.h
- bearer/qnetworksession.cpp bearer/qnetworksession.h bearer/qnetworksession_p.h
- bearer/qnetworksession_impl.cpp bearer/qnetworksession_impl_p.h
- bearer/qsharednetworksession.cpp bearer/qsharednetworksession_p.h
-)
-
qt_extend_target(Network CONDITION QT_FEATURE_ftp
SOURCES
access/qftp.cpp access/qftp_p.h
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 33526bb7d5..f8cb3feb69 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -269,8 +269,6 @@ QT_BEGIN_NAMESPACE
Indicates that this is a background transfer, rather than a user initiated
transfer. Depending on the platform, background transfers may be subject
to different policies.
- The QNetworkSession ConnectInBackground property will be set according to
- this attribute.
\value Http2AllowedAttribute
Requests only, type: QMetaType::Bool (default: false)
diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri
deleted file mode 100644
index bcb7a5971e..0000000000
--- a/src/network/bearer/bearer.pri
+++ /dev/null
@@ -1,22 +0,0 @@
-# Qt network bearer management module
-
-HEADERS += bearer/qnetworkconfiguration.h \
- bearer/qnetworksession.h \
- bearer/qnetworkconfigmanager.h \
- bearer/qnetworkconfigmanager_p.h \
- bearer/qnetworkconfiguration_p.h \
- bearer/qnetworksession_p.h \
- bearer/qnetworksession_impl_p.h \
- bearer/qbearerengine_p.h \
- bearer/qbearerengine_impl_p.h \
- bearer/qbearerplugin_p.h \
- bearer/qsharednetworksession_p.h
-
-SOURCES += bearer/qnetworksession.cpp \
- bearer/qnetworksession_impl.cpp \
- bearer/qnetworkconfigmanager.cpp \
- bearer/qnetworkconfiguration.cpp \
- bearer/qnetworkconfigmanager_p.cpp \
- bearer/qbearerengine.cpp \
- bearer/qbearerplugin.cpp \
- bearer/qsharednetworksession.cpp
diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp
deleted file mode 100644
index 06bf449611..0000000000
--- a/src/network/bearer/qbearerengine.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbearerengine_p.h"
-#include <QtCore/private/qlocking_p.h>
-
-#include <algorithm>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-static void cleanUpConfigurations(QHash<QString, QNetworkConfigurationPrivatePointer> &configurations)
-{
- for (auto &ptr : qExchange(configurations, {})) {
- ptr->isValid = false;
- ptr->id.clear();
- }
-}
-
-static bool hasUsedConfiguration(const QHash<QString, QNetworkConfigurationPrivatePointer> &configurations)
-{
- auto isUsed = [](const QNetworkConfigurationPrivatePointer &ptr) {
- return ptr->ref.loadRelaxed() > 1;
- };
- const auto end = configurations.end();
- return std::find_if(configurations.begin(), end, isUsed) != end;
-}
-
-QBearerEngine::QBearerEngine(QObject *parent)
- : QObject(parent)
-{
-}
-
-QBearerEngine::~QBearerEngine()
-{
- cleanUpConfigurations(snapConfigurations);
- cleanUpConfigurations(accessPointConfigurations);
- cleanUpConfigurations(userChoiceConfigurations);
-}
-
-bool QBearerEngine::requiresPolling() const
-{
- return false;
-}
-
-/*
- Returns \c true if configurations are in use; otherwise returns \c false.
-
- If configurations are in use and requiresPolling() returns \c true, polling will be enabled for
- this engine.
-*/
-bool QBearerEngine::configurationsInUse() const
-{
- const auto locker = qt_scoped_lock(mutex);
- return hasUsedConfiguration(accessPointConfigurations)
- || hasUsedConfiguration(snapConfigurations)
- || hasUsedConfiguration(userChoiceConfigurations);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qbearerengine_p.cpp"
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/bearer/qbearerengine_impl_p.h b/src/network/bearer/qbearerengine_impl_p.h
deleted file mode 100644
index 4221b73276..0000000000
--- a/src/network/bearer/qbearerengine_impl_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBEARERENGINE_IMPL_H
-#define QBEARERENGINE_IMPL_H
-
-#include <QtNetwork/private/qbearerengine_p.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class Q_NETWORK_EXPORT QBearerEngineImpl : public QBearerEngine
-{
- Q_OBJECT
-
-public:
- enum ConnectionError {
- InterfaceLookupError = 0,
- ConnectError,
- OperationNotSupported,
- DisconnectionError,
- };
-
- QBearerEngineImpl(QObject *parent = nullptr) : QBearerEngine(parent) {}
- ~QBearerEngineImpl() {}
-
- virtual void connectToId(const QString &id) = 0;
- virtual void disconnectFromId(const QString &id) = 0;
-
- virtual QString getInterfaceFromId(const QString &id) = 0;
-
- virtual QNetworkSession::State sessionStateForId(const QString &id) = 0;
-
- virtual quint64 bytesWritten(const QString &) { return Q_UINT64_C(0); }
- virtual quint64 bytesReceived(const QString &) { return Q_UINT64_C(0); }
- virtual quint64 startTime(const QString &) { return Q_UINT64_C(0); }
-
-Q_SIGNALS:
- void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error);
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QBearerEngineImpl::ConnectionError)
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif // QBEARERENGINE_IMPL_H
diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h
deleted file mode 100644
index c69f478b26..0000000000
--- a/src/network/bearer/qbearerengine_p.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBEARERENGINE_P_H
-#define QBEARERENGINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-#include "qnetworkconfiguration_p.h"
-#include "qnetworksession.h"
-#include "qnetworkconfigmanager.h"
-
-#include <QtCore/qobject.h>
-#include <QtCore/qglobal.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qsharedpointer.h>
-#include <QtCore/qmutex.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfiguration;
-
-class Q_NETWORK_EXPORT QBearerEngine : public QObject
-{
- Q_OBJECT
-
- friend class QNetworkConfigurationManagerPrivate;
-
-public:
- explicit QBearerEngine(QObject *parent = nullptr);
- virtual ~QBearerEngine();
-
- virtual bool hasIdentifier(const QString &id) = 0;
-
- virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0;
-
- virtual QNetworkSessionPrivate *createSessionBackend() = 0;
-
- virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0;
-
- virtual bool requiresPolling() const;
- bool configurationsInUse() const;
-
-Q_SIGNALS:
- void configurationAdded(QNetworkConfigurationPrivatePointer config);
- void configurationRemoved(QNetworkConfigurationPrivatePointer config);
- void configurationChanged(QNetworkConfigurationPrivatePointer config);
- void updateCompleted();
-
-protected:
- //this table contains an up to date list of all configs at any time.
- //it must be updated if configurations change, are added/removed or
- //the members of ServiceNetworks change
- QHash<QString, QNetworkConfigurationPrivatePointer> accessPointConfigurations;
- QHash<QString, QNetworkConfigurationPrivatePointer> snapConfigurations;
- QHash<QString, QNetworkConfigurationPrivatePointer> userChoiceConfigurations;
-
- mutable QRecursiveMutex mutex;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif // QBEARERENGINE_P_H
diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp
deleted file mode 100644
index ec0d06e94c..0000000000
--- a/src/network/bearer/qbearerplugin.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbearerplugin_p.h"
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-QBearerEnginePlugin::QBearerEnginePlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-QBearerEnginePlugin::~QBearerEnginePlugin()
-{
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h
deleted file mode 100644
index ac787d0541..0000000000
--- a/src/network/bearer/qbearerplugin_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBEARERPLUGIN_P_H
-#define QBEARERPLUGIN_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-#include "qbearerengine_p.h"
-
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-
-#define QBearerEngineFactoryInterface_iid "org.qt-project.Qt.QBearerEngineFactoryInterface"
-
-class Q_NETWORK_EXPORT QBearerEnginePlugin : public QObject
-{
- Q_OBJECT
-public:
- explicit QBearerEnginePlugin(QObject *parent = nullptr);
- virtual ~QBearerEnginePlugin();
-
- virtual QBearerEngine *create(const QString &key) const = 0;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif // QBEARERPLUGIN_P_H
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp
deleted file mode 100644
index eb3eb59c83..0000000000
--- a/src/network/bearer/qnetworkconfigmanager.cpp
+++ /dev/null
@@ -1,389 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-
-#include "qnetworkconfigmanager.h"
-
-#include "qnetworkconfigmanager_p.h"
-#include "qbearerengine_p.h"
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qthread.h>
-#include <QtCore/private/qcoreapplication_p.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-static QBasicAtomicPointer<QNetworkConfigurationManagerPrivate> connManager_ptr;
-static QBasicAtomicInt appShutdown;
-
-static void connManager_prepare()
-{
- int shutdown = appShutdown.fetchAndStoreAcquire(0);
- Q_ASSERT(shutdown == 0 || shutdown == 1);
- Q_UNUSED(shutdown);
-}
-
-static void connManager_cleanup()
-{
- // this is not atomic or thread-safe!
- int shutdown = appShutdown.fetchAndStoreAcquire(1);
- Q_ASSERT(shutdown == 0);
- Q_UNUSED(shutdown);
- QNetworkConfigurationManagerPrivate *cmp = connManager_ptr.fetchAndStoreAcquire(nullptr);
- if (cmp)
- cmp->cleanup();
-}
-
-void QNetworkConfigurationManagerPrivate::addPreAndPostRoutine()
-{
- qAddPreRoutine(connManager_prepare);
- qAddPostRoutine(connManager_cleanup);
-}
-
-QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate()
-{
- QNetworkConfigurationManagerPrivate *ptr = connManager_ptr.loadAcquire();
- int shutdown = appShutdown.loadAcquire();
- if (!ptr && !shutdown) {
- static QBasicMutex connManager_mutex;
- QMutexLocker locker(&connManager_mutex);
- if (!(ptr = connManager_ptr.loadAcquire())) {
- ptr = new QNetworkConfigurationManagerPrivate;
-
- if (QCoreApplicationPrivate::mainThread() == QThread::currentThread()) {
- // right thread or no main thread yet
- ptr->addPreAndPostRoutine();
- ptr->initialize();
- } else {
- // wrong thread, we need to make the main thread do this
- QObject *obj = new QObject;
- QObject::connect(obj, SIGNAL(destroyed()), ptr, SLOT(addPreAndPostRoutine()), Qt::DirectConnection);
- ptr->initialize(); // this moves us to the right thread
- obj->moveToThread(QCoreApplicationPrivate::mainThread());
- obj->deleteLater();
- }
-
- connManager_ptr.storeRelease(ptr);
- }
- }
- return ptr;
-}
-
-/*!
- \class QNetworkConfigurationManager
- \obsolete
-
- \brief The QNetworkConfigurationManager class manages the network configurations provided
- by the system.
-
- \since 4.7
-
- \inmodule QtNetwork
- \ingroup network
-
- QNetworkConfigurationManager provides access to the network configurations known to the system and
- enables applications to detect the system capabilities (with regards to network sessions) at runtime.
-
- A QNetworkConfiguration abstracts a set of configuration options describing how a
- network interface has to be configured to connect to a particular target network.
- QNetworkConfigurationManager maintains and updates the global list of
- QNetworkConfigurations. Applications can access and filter this list via
- allConfigurations(). If a new configuration is added or an existing one is removed or changed
- the configurationAdded(), configurationRemoved() and configurationChanged() signals are emitted
- respectively.
-
- The defaultConfiguration() can be used when intending to immediately create a new
- network session without caring about the particular configuration. It returns
- a \l QNetworkConfiguration::Discovered configuration. If there are not any
- discovered ones an invalid configuration is returned.
-
- Some configuration updates may require some time to perform updates. A WLAN scan is
- such an example. Unless the platform performs internal updates it may be required to
- manually trigger configuration updates via QNetworkConfigurationManager::updateConfigurations().
- The completion of the update process is indicated by emitting the updateCompleted()
- signal. The update process ensures that every existing QNetworkConfiguration instance
- is updated. There is no need to ask for a renewed configuration list via allConfigurations().
-
- \sa QNetworkConfiguration
-*/
-
-/*!
- \fn void QNetworkConfigurationManager::configurationAdded(const QNetworkConfiguration &config)
-
- This signal is emitted whenever a new network configuration is added to the system. The new
- configuration is specified by \a config.
-*/
-
-/*!
- \fn void QNetworkConfigurationManager::configurationRemoved(const QNetworkConfiguration &config)
-
- This signal is emitted when a configuration is about to be removed from the system. The removed
- configuration, specified by \a config, is invalid but retains name and identifier.
-*/
-
-/*!
- \fn void QNetworkConfigurationManager::updateCompleted()
-
- This signal is emitted when the configuration update has been completed. Such an update can
- be initiated via \l updateConfigurations().
-*/
-
-/*! \fn void QNetworkConfigurationManager::configurationChanged(const QNetworkConfiguration &config)
-
- This signal is emitted when the \l {QNetworkConfiguration::state()}{state} of \a config changes.
-*/
-
-/*!
- \fn void QNetworkConfigurationManager::onlineStateChanged(bool isOnline)
-
- This signal is emitted when the device changes from online to offline mode or vice versa.
- \a isOnline represents the new state of the device.
-
- The state is considered to be online for as long as
- \l{allConfigurations()}{allConfigurations}(QNetworkConfiguration::Active) returns a list with
- at least one entry.
-*/
-
-/*!
- \enum QNetworkConfigurationManager::Capability
-
- Specifies the system capabilities of the bearer API. The possible values are:
-
- \value CanStartAndStopInterfaces Network sessions and their underlying access points can be
- started and stopped. If this flag is not set QNetworkSession
- can only monitor but not influence the state of access points.
- On some platforms this feature may require elevated user
- permissions. This option is platform specific and may not
- always be available.
- \value DirectConnectionRouting Network sessions and their sockets can be bound to a
- particular network interface. Any packet that passes through
- the socket goes to the specified network interface and thus
- disregards standard routing table entries. This may be useful
- when two interfaces can reach overlapping IP ranges or an
- application has specific needs in regards to target networks.
- This option is platform specific and may not always be
- available.
- \value SystemSessionSupport If this flag is set the underlying platform ensures that a
- network interface is not shut down until the last network
- session has been \l{QNetworkSession::close()}{closed()}. This
- works across multiple processes. If the platform session
- support is missing this API can only ensure the above behavior
- for network sessions within the same process.
- In general mobile platforms have such
- support whereas most desktop platform lack this capability.
- \value ApplicationLevelRoaming The system gives applications control over the systems roaming
- behavior. Applications can initiate roaming (in case the
- current link is not suitable) and are consulted if the system
- has identified a more suitable access point.
- \value ForcedRoaming The system disconnects an existing access point and reconnects
- via a more suitable one. The application does not have any
- control over this process and has to reconnect its active
- sockets.
- \value DataStatistics If this flag is set QNetworkSession can provide statistics
- about transmitted and received data.
- \value NetworkSessionRequired If this flag is set the platform requires that a network
- session is created before network operations can be performed.
-*/
-
-/*!
- Constructs a QNetworkConfigurationManager with the given \a parent.
-
- Note that to ensure a valid list of current configurations immediately available, updating
- is done during construction which causes some delay.
-*/
-QNetworkConfigurationManager::QNetworkConfigurationManager(QObject *parent)
- : QObject(parent)
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv) {
- connect(priv, SIGNAL(configurationAdded(QNetworkConfiguration)),
- this, SIGNAL(configurationAdded(QNetworkConfiguration)));
- connect(priv, SIGNAL(configurationRemoved(QNetworkConfiguration)),
- this, SIGNAL(configurationRemoved(QNetworkConfiguration)));
- connect(priv, SIGNAL(configurationChanged(QNetworkConfiguration)),
- this, SIGNAL(configurationChanged(QNetworkConfiguration)));
- connect(priv, SIGNAL(onlineStateChanged(bool)),
- this, SIGNAL(onlineStateChanged(bool)));
- connect(priv, SIGNAL(configurationUpdateComplete()),
- this, SIGNAL(updateCompleted()));
-
- priv->enablePolling();
- }
-}
-
-/*!
- Frees the resources associated with the QNetworkConfigurationManager object.
-*/
-QNetworkConfigurationManager::~QNetworkConfigurationManager()
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv)
- priv->disablePolling();
-}
-
-
-/*!
- Returns the default configuration to be used. This function always returns a discovered
- configuration; otherwise an invalid configuration.
-
- In some cases it may be required to call updateConfigurations() and wait for the
- updateCompleted() signal before calling this function.
-
- \sa allConfigurations()
-*/
-QNetworkConfiguration QNetworkConfigurationManager::defaultConfiguration() const
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv)
- return priv->defaultConfiguration();
-
- return QNetworkConfiguration();
-}
-
-/*!
- Returns the list of configurations which comply with the given \a filter.
-
- By default this function returns all (defined and undefined) configurations.
-
- A wireless network with a particular SSID may only be accessible in a
- certain area despite the fact that the system has a valid configuration
- for it. Therefore the filter flag may be used to limit the list to
- discovered and possibly connected configurations only.
-
- If \a filter is set to zero this function returns all possible configurations.
-
- Note that this function returns the states for all configurations as they are known at
- the time of this function call. If for instance a configuration of type WLAN is defined
- the system may have to perform a WLAN scan in order to determine whether it is
- actually available. To obtain the most accurate state updateConfigurations() should
- be used to update each configuration's state. Note that such an update may require
- some time. It's completion is signalled by updateCompleted(). In the absence of a
- configuration update this function returns the best estimate at the time of the call.
- Therefore, if WLAN configurations are of interest, it is recommended that
- updateConfigurations() is called once after QNetworkConfigurationManager
- instantiation (WLAN scans are too time consuming to perform in constructor).
- After this the data is kept automatically up-to-date as the system reports
- any changes.
-*/
-QList<QNetworkConfiguration> QNetworkConfigurationManager::allConfigurations(QNetworkConfiguration::StateFlags filter) const
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv)
- return priv->allConfigurations(filter);
-
- return QList<QNetworkConfiguration>();
-}
-
-/*!
- Returns the QNetworkConfiguration for \a identifier; otherwise returns an
- invalid QNetworkConfiguration.
-
- \sa QNetworkConfiguration::identifier()
-*/
-QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier(const QString &identifier) const
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv)
- return priv->configurationFromIdentifier(identifier);
-
- return QNetworkConfiguration();
-}
-
-/*!
- Returns \c true if the system is considered to be connected to another device via an active
- network interface; otherwise returns \c false.
-
- This is equivalent to the following code snippet:
-
- \snippet code/src_network_bearer_qnetworkconfigmanager.cpp 0
-
- \sa onlineStateChanged()
-*/
-bool QNetworkConfigurationManager::isOnline() const
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv)
- return priv->isOnline();
-
- return false;
-}
-
-/*!
- Returns the capabilities supported by the current platform.
-*/
-QNetworkConfigurationManager::Capabilities QNetworkConfigurationManager::capabilities() const
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv)
- return priv->capabilities();
-
- return {};
-}
-
-/*!
- Initiates an update of all configurations. This may be used to initiate WLAN scans or other
- time consuming updates which may be required to obtain the correct state for configurations.
-
- This call is asynchronous. On completion of this update the updateCompleted() signal is
- emitted. If new configurations are discovered or old ones were removed or changed the update
- process may trigger the emission of one or multiple configurationAdded(),
- configurationRemoved() and configurationChanged() signals.
-
- If a configuration state changes as a result of this update all existing QNetworkConfiguration
- instances are updated automatically.
-
- \sa allConfigurations()
-*/
-void QNetworkConfigurationManager::updateConfigurations()
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv)
- priv->performAsyncConfigurationUpdate();
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qnetworkconfigmanager.cpp"
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h
deleted file mode 100644
index b8f09f3d68..0000000000
--- a/src/network/bearer/qnetworkconfigmanager.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKCONFIGMANAGER_H
-#define QNETWORKCONFIGMANAGER_H
-
-#if 0
-#pragma qt_class(QNetworkConfigurationManager)
-#endif
-
-#include <QtNetwork/qtnetworkglobal.h>
-#include <QtCore/qobject.h>
-#include <QtNetwork/qnetworkconfiguration.h>
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfigurationManagerPrivate;
-class QT_DEPRECATED_BEARER_MANAGEMENT Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject
-{
- Q_OBJECT
-
-public:
- enum Capability {
- CanStartAndStopInterfaces = 0x00000001,
- DirectConnectionRouting = 0x00000002,
- SystemSessionSupport = 0x00000004,
- ApplicationLevelRoaming = 0x00000008,
- ForcedRoaming = 0x00000010,
- DataStatistics = 0x00000020,
- NetworkSessionRequired = 0x00000040
- };
-
- Q_DECLARE_FLAGS(Capabilities, Capability)
-
- explicit QNetworkConfigurationManager(QObject *parent = nullptr);
- virtual ~QNetworkConfigurationManager();
-
- QNetworkConfigurationManager::Capabilities capabilities() const;
-
- QNetworkConfiguration defaultConfiguration() const;
- QList<QNetworkConfiguration> allConfigurations(QNetworkConfiguration::StateFlags flags = QNetworkConfiguration::StateFlags()) const;
- QNetworkConfiguration configurationFromIdentifier(const QString &identifier) const;
-
- bool isOnline() const;
-
-public Q_SLOTS:
- void updateConfigurations();
-
-Q_SIGNALS:
- void configurationAdded(const QNetworkConfiguration &config);
- void configurationRemoved(const QNetworkConfiguration &config);
- void configurationChanged(const QNetworkConfiguration &config);
- void onlineStateChanged(bool isOnline);
- void updateCompleted();
-
-private:
- Q_DISABLE_COPY(QNetworkConfigurationManager)
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkConfigurationManager::Capabilities)
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-QT_WARNING_POP
-
-#endif // QNETWORKCONFIGMANAGER_H
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
deleted file mode 100644
index f0aa452dd3..0000000000
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ /dev/null
@@ -1,517 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnetworkconfigmanager_p.h"
-#include "qbearerplugin_p.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qthread.h>
-#include <QtCore/private/qcoreapplication_p.h>
-#include <QtCore/private/qlocking_p.h>
-#include <QtCore/private/qthread_p.h>
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qglobal.h>
-
-#include <utility>
-
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate()
- : QObject(), pollTimer(nullptr),
- loader(QBearerEngineFactoryInterface_iid, QLatin1String("/bearer")),
- forcedPolling(0), firstUpdate(true)
-{
- qRegisterMetaType<QNetworkConfiguration>();
- qRegisterMetaType<QNetworkConfigurationPrivatePointer>();
-}
-
-void QNetworkConfigurationManagerPrivate::initialize()
-{
- //Two stage construction, because we only want to do this heavyweight work for the winner of the Q_GLOBAL_STATIC race.
- bearerThread = new QDaemonThread();
- bearerThread->setObjectName(QStringLiteral("Qt bearer thread"));
-
- bearerThread->moveToThread(QCoreApplicationPrivate::mainThread()); // because cleanup() is called in main thread context.
- moveToThread(bearerThread);
- bearerThread->start();
- updateConfigurations();
-}
-
-QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate()
-{
- QMutexLocker locker(&mutex);
-
- qDeleteAll(sessionEngines);
- sessionEngines.clear();
- if (bearerThread)
- bearerThread->quit();
-}
-
-void QNetworkConfigurationManagerPrivate::cleanup()
-{
- QThread* thread = bearerThread;
- deleteLater();
- if (thread->wait(QDeadlineTimer(5000)))
- delete thread;
-}
-
-QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() const
-{
- QMutexLocker locker(&mutex);
-
- for (QBearerEngine *engine : sessionEngines) {
- QNetworkConfigurationPrivatePointer ptr = engine->defaultConfiguration();
- if (ptr) {
- QNetworkConfiguration config;
- config.d = ptr;
- return config;
- }
- }
-
- // Engines don't have a default configuration.
-
- // Return first active snap
- QNetworkConfigurationPrivatePointer defaultConfiguration;
-
- for (QBearerEngine *engine : sessionEngines) {
- const auto locker = qt_scoped_lock(engine->mutex);
-
- for (const auto &ptr : qAsConst(engine->snapConfigurations)) {
- const auto locker = qt_scoped_lock(ptr->mutex);
-
- if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- QNetworkConfiguration config;
- config.d = ptr;
- return config;
- } else if (!defaultConfiguration) {
- if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered)
- defaultConfiguration = ptr;
- }
- }
- }
-
- // No Active SNAPs return first Discovered SNAP.
- if (defaultConfiguration) {
- QNetworkConfiguration config;
- config.d = defaultConfiguration;
- return config;
- }
-
- /*
- No Active or Discovered SNAPs, find the perferred access point.
- The following priority order is used:
-
- 1. Active Ethernet
- 2. Active WLAN
- 3. Active Other
- 4. Discovered Ethernet
- 5. Discovered WLAN
- 6. Discovered Other
- */
-
- for (QBearerEngine *engine : sessionEngines) {
-
- QMutexLocker locker(&engine->mutex);
-
- for (const auto &ptr : qAsConst(engine->accessPointConfigurations)) {
-
- QMutexLocker configLocker(&ptr->mutex);
- QNetworkConfiguration::BearerType bearerType = ptr->bearerType;
-
- if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) {
- if (!defaultConfiguration) {
- defaultConfiguration = ptr;
- } else {
- QMutexLocker defaultConfigLocker(&defaultConfiguration->mutex);
-
- if (defaultConfiguration->state == ptr->state) {
- switch (defaultConfiguration->bearerType) {
- case QNetworkConfiguration::BearerEthernet:
- // do nothing
- break;
- case QNetworkConfiguration::BearerWLAN:
- // Ethernet beats WLAN
- defaultConfiguration = ptr;
- break;
- default:
- // Ethernet and WLAN beats other
- if (bearerType == QNetworkConfiguration::BearerEthernet ||
- bearerType == QNetworkConfiguration::BearerWLAN) {
- defaultConfiguration = ptr;
- }
- }
- } else {
- // active beats discovered
- if ((defaultConfiguration->state & QNetworkConfiguration::Active) !=
- QNetworkConfiguration::Active) {
- defaultConfiguration = ptr;
- }
- }
- }
- }
- }
- }
-
- // No Active InternetAccessPoint return first Discovered InternetAccessPoint.
- if (defaultConfiguration) {
- QNetworkConfiguration config;
- config.d = defaultConfiguration;
- return config;
- }
-
- return QNetworkConfiguration();
-}
-
-QList<QNetworkConfiguration> QNetworkConfigurationManagerPrivate::allConfigurations(QNetworkConfiguration::StateFlags filter) const
-{
- QList<QNetworkConfiguration> result;
-
- QMutexLocker locker(&mutex);
-
- for (QBearerEngine *engine : sessionEngines) {
-
- const auto locker = qt_scoped_lock(engine->mutex);
-
- //find all InternetAccessPoints
- for (const auto &ptr : qAsConst(engine->accessPointConfigurations)) {
- const auto locker = qt_scoped_lock(ptr->mutex);
-
- if ((ptr->state & filter) == filter) {
- QNetworkConfiguration pt;
- pt.d = ptr;
- result << pt;
- }
- }
-
- //find all service networks
- for (const auto &ptr : qAsConst(engine->snapConfigurations)) {
- const auto locker = qt_scoped_lock(ptr->mutex);
-
- if ((ptr->state & filter) == filter) {
- QNetworkConfiguration pt;
- pt.d = ptr;
- result << pt;
- }
- }
- }
-
- return result;
-}
-
-QNetworkConfiguration QNetworkConfigurationManagerPrivate::configurationFromIdentifier(const QString &identifier) const
-{
- QNetworkConfiguration item;
-
- const auto locker = qt_scoped_lock(mutex);
-
- for (QBearerEngine *engine : sessionEngines) {
- const auto locker = qt_scoped_lock(engine->mutex);
- if (auto ptr = engine->accessPointConfigurations.value(identifier)) {
- item.d = std::move(ptr);
- break;
- }
- if (auto ptr = engine->snapConfigurations.value(identifier)) {
- item.d = std::move(ptr);
- break;
- }
- if (auto ptr = engine->userChoiceConfigurations.value(identifier)) {
- item.d = std::move(ptr);
- break;
- }
- }
-
- return item;
-}
-
-bool QNetworkConfigurationManagerPrivate::isOnline() const
-{
- const auto locker = qt_scoped_lock(mutex);
-
- // We need allConfigurations since onlineConfigurations is filled with queued connections
- // and thus is not always (more importantly just after creation) up to date
- return !allConfigurations(QNetworkConfiguration::Active).isEmpty();
-}
-
-QNetworkConfigurationManager::Capabilities QNetworkConfigurationManagerPrivate::capabilities() const
-{
- const auto locker = qt_scoped_lock(mutex);
-
- QNetworkConfigurationManager::Capabilities capFlags;
-
- for (QBearerEngine *engine : sessionEngines)
- capFlags |= engine->capabilities();
-
- return capFlags;
-}
-
-void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- if (!firstUpdate) {
- QNetworkConfiguration item;
- item.d = ptr;
- emit configurationAdded(item);
- }
-
- auto ptrLocker = qt_unique_lock(ptr->mutex);
- if (ptr->state == QNetworkConfiguration::Active) {
- const auto id = ptr->id;
- ptrLocker.unlock();
- onlineConfigurations.insert(id);
- if (!firstUpdate && onlineConfigurations.count() == 1)
- emit onlineStateChanged(true);
- }
-}
-
-void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigurationPrivatePointer ptr)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- {
- const auto locker = qt_scoped_lock(ptr->mutex);
- ptr->isValid = false;
- }
-
- if (!firstUpdate) {
- QNetworkConfiguration item;
- item.d = ptr;
- emit configurationRemoved(item);
- }
-
- onlineConfigurations.remove(ptr->id);
- if (!firstUpdate && onlineConfigurations.isEmpty())
- emit onlineStateChanged(false);
-}
-
-void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivatePointer ptr)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- if (!firstUpdate) {
- QNetworkConfiguration item;
- item.d = ptr;
- emit configurationChanged(item);
- }
-
- bool previous = !onlineConfigurations.isEmpty();
-
- {
- const auto locker = qt_scoped_lock(ptr->mutex);
- if (ptr->state == QNetworkConfiguration::Active)
- onlineConfigurations.insert(ptr->id);
- else
- onlineConfigurations.remove(ptr->id);
- }
-
- bool online = !onlineConfigurations.isEmpty();
-
- if (!firstUpdate && online != previous)
- emit onlineStateChanged(online);
-}
-
-void QNetworkConfigurationManagerPrivate::updateConfigurations()
-{
- typedef QMultiMap<int, QString> PluginKeyMap;
- typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
-
- auto locker = qt_unique_lock(mutex);
-
- if (firstUpdate) {
- if (qobject_cast<QBearerEngine *>(sender()))
- return;
-
- updating = false;
-
- bool envOK = false;
- const int skipGeneric = qEnvironmentVariableIntValue("QT_EXCLUDE_GENERIC_BEARER", &envOK);
- QBearerEngine *generic = nullptr;
- QFactoryLoader *l = &loader;
- const PluginKeyMap keyMap = l->keyMap();
- const PluginKeyMapConstIterator cend = keyMap.constEnd();
- QStringList addedEngines;
- for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
- const QString &key = it.value();
- if (addedEngines.contains(key))
- continue;
-
- addedEngines.append(key);
- if (QBearerEngine *engine = qLoadPlugin<QBearerEngine, QBearerEnginePlugin>(l, key)) {
- if (key == QLatin1String("generic"))
- generic = engine;
- else
- sessionEngines.append(engine);
-
- engine->moveToThread(bearerThread);
-
- connect(engine, SIGNAL(updateCompleted()),
- this, SLOT(updateConfigurations()),
- Qt::QueuedConnection);
- connect(engine, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)),
- this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer)),
- Qt::QueuedConnection);
- connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)),
- this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer)),
- Qt::QueuedConnection);
- connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
- this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)),
- Qt::QueuedConnection);
- }
- }
-
- if (generic) {
- if (!envOK || skipGeneric <= 0)
- sessionEngines.append(generic);
- else
- delete generic;
- }
- }
-
- QBearerEngine *engine = qobject_cast<QBearerEngine *>(sender());
- if (engine && !updatingEngines.isEmpty())
- updatingEngines.remove(engine);
-
- if (updating && updatingEngines.isEmpty()) {
- updating = false;
- emit configurationUpdateComplete();
- }
-
- if (engine && !pollingEngines.isEmpty()) {
- pollingEngines.remove(engine);
- if (pollingEngines.isEmpty())
- startPolling();
- }
-
- if (firstUpdate) {
- firstUpdate = false;
- const QList<QBearerEngine*> enginesToInitialize = sessionEngines; //shallow copy the list in case it is modified when we unlock mutex
- locker.unlock();
- for (QBearerEngine* engine : enginesToInitialize)
- QMetaObject::invokeMethod(engine, "initialize", Qt::BlockingQueuedConnection);
- }
-}
-
-void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate()
-{
- const auto locker = qt_scoped_lock(mutex);
-
- if (sessionEngines.isEmpty()) {
- emit configurationUpdateComplete();
- return;
- }
-
- updating = true;
-
- for (QBearerEngine *engine : qAsConst(sessionEngines)) {
- updatingEngines.insert(engine);
- QMetaObject::invokeMethod(engine, "requestUpdate");
- }
-}
-
-QList<QBearerEngine *> QNetworkConfigurationManagerPrivate::engines() const
-{
- const auto locker = qt_scoped_lock(mutex);
-
- return sessionEngines;
-}
-
-void QNetworkConfigurationManagerPrivate::startPolling()
-{
- const auto locker = qt_scoped_lock(mutex);
- if (!pollTimer) {
- pollTimer = new QTimer(this);
- bool ok;
- int interval = qEnvironmentVariableIntValue("QT_BEARER_POLL_TIMEOUT", &ok);
- if (!ok)
- interval = 10000;//default 10 seconds
- pollTimer->setInterval(interval);
- pollTimer->setSingleShot(true);
- connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollEngines()));
- }
-
- if (pollTimer->isActive())
- return;
-
- for (QBearerEngine *engine : qAsConst(sessionEngines)) {
- if (engine->requiresPolling() && (forcedPolling || engine->configurationsInUse())) {
- pollTimer->start();
- break;
- }
- }
- performAsyncConfigurationUpdate();
-}
-
-void QNetworkConfigurationManagerPrivate::pollEngines()
-{
- const auto locker = qt_scoped_lock(mutex);
-
- for (QBearerEngine *engine : qAsConst(sessionEngines)) {
- if (engine->requiresPolling() && (forcedPolling || engine->configurationsInUse())) {
- pollingEngines.insert(engine);
- QMetaObject::invokeMethod(engine, "requestUpdate");
- }
- }
-}
-
-void QNetworkConfigurationManagerPrivate::enablePolling()
-{
- const auto locker = qt_scoped_lock(mutex);
-
- ++forcedPolling;
-
- if (forcedPolling == 1)
- QMetaObject::invokeMethod(this, "startPolling");
-}
-
-void QNetworkConfigurationManagerPrivate::disablePolling()
-{
- const auto locker = qt_scoped_lock(mutex);
-
- --forcedPolling;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h
deleted file mode 100644
index 4819c2027c..0000000000
--- a/src/network/bearer/qnetworkconfigmanager_p.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKCONFIGMANAGER_P_H
-#define QNETWORKCONFIGMANAGER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-#include "qnetworkconfigmanager.h"
-#include "qnetworkconfiguration_p.h"
-
-#include <QtCore/private/qfactoryloader_p.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qset.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QBearerEngine;
-class QTimer;
-
-class Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QNetworkConfigurationManagerPrivate();
- virtual ~QNetworkConfigurationManagerPrivate();
-
- QNetworkConfiguration defaultConfiguration() const;
- QList<QNetworkConfiguration> allConfigurations(QNetworkConfiguration::StateFlags filter) const;
- QNetworkConfiguration configurationFromIdentifier(const QString &identifier) const;
-
- bool isOnline() const;
-
- QNetworkConfigurationManager::Capabilities capabilities() const;
-
- void performAsyncConfigurationUpdate();
-
- QList<QBearerEngine *> engines() const;
-
- void enablePolling();
- void disablePolling();
-
- void initialize();
- void cleanup();
-public Q_SLOTS:
- void updateConfigurations();
-
- static void addPreAndPostRoutine();
-
-Q_SIGNALS:
- void configurationAdded(const QNetworkConfiguration &config);
- void configurationRemoved(const QNetworkConfiguration &config);
- void configurationChanged(const QNetworkConfiguration &config);
- void configurationUpdateComplete();
- void onlineStateChanged(bool isOnline);
-
-private Q_SLOTS:
- void configurationAdded(QNetworkConfigurationPrivatePointer ptr);
- void configurationRemoved(QNetworkConfigurationPrivatePointer ptr);
- void configurationChanged(QNetworkConfigurationPrivatePointer ptr);
-
- void pollEngines();
-
-
-private:
- Q_INVOKABLE void startPolling();
- QTimer *pollTimer;
- QThread *bearerThread;
-
-private:
- mutable QRecursiveMutex mutex;
-
- QFactoryLoader loader;
- QList<QBearerEngine *> sessionEngines;
-
- QSet<QString> onlineConfigurations;
-
- QSet<QBearerEngine *> pollingEngines;
- QSet<QBearerEngine *> updatingEngines;
- int forcedPolling;
- bool updating;
-
- bool firstUpdate;
-};
-
-Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate();
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif // QNETWORKCONFMANAGER_P_H
diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp
deleted file mode 100644
index f016dea590..0000000000
--- a/src/network/bearer/qnetworkconfiguration.cpp
+++ /dev/null
@@ -1,596 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-
-#include "qnetworkconfiguration.h"
-#include "qnetworkconfiguration_p.h"
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QNetworkConfiguration
- \obsolete
-
- \brief The QNetworkConfiguration class provides an abstraction of one or more access point configurations.
-
- \since 4.7
-
- \inmodule QtNetwork
- \ingroup network
- \ingroup shared
-
- QNetworkConfiguration encapsulates a single access point or service network.
- In most cases a single access point configuration can be mapped to one network
- interface. However a single network interface may not always map to only one
- access point configuration. Multiple configurations for the same
- network device may enable multiple access points. An example
- device that could exhibit such a configuration might be a
- Smartphone which allows the user to manage multiple WLAN
- configurations while the device itself has only one WLAN network device.
-
- The QNetworkConfiguration also supports the concept of service networks.
- This concept allows the grouping of multiple access point configurations
- into one entity. Such a group is called service network and can be
- beneficial in cases whereby a network session to a
- particular destination network is required (e.g. a company network).
- When using a service network the user doesn't usually care which one of the
- connectivity options is chosen (e.g. corporate WLAN or VPN via GPRS)
- as long as he can reach the company's target server. Depending
- on the current position and time some of the access points that make
- up the service network may not even be available. Furthermore
- automated access point roaming can be enabled which enables the device
- to change the network interface configuration dynamically while maintaining
- the applications connection to the target network. It allows adaption
- to the changing environment and may enable optimization with regards to
- cost, speed or other network parameters.
-
- Special configurations of type UserChoice provide a placeholder configuration which is
- resolved to an actual network configuration by the platform when a
- \l {QNetworkSession}{session} is \l {QNetworkSession::open()}{opened}. Not all platforms
- support the concept of a user choice configuration.
-
- \section1 Configuration States
-
- The list of available configurations can be obtained via
- QNetworkConfigurationManager::allConfigurations(). A configuration can have
- multiple states. The \l Defined configuration state indicates that the configuration
- is stored on the device. However the configuration is not yet ready to be activated
- as e.g. a WLAN may not be available at the current time.
-
- The \l Discovered state implies that the configuration is \l Defined and
- the outside conditions are such that the configuration can be used immediately
- to open a new network session. An example of such an outside condition may be
- that the Ethernet cable is actually connected to the device or that the WLAN
- with the specified SSID is in range.
-
- The \l Active state implies that the configuration is \l Discovered. A configuration
- in this state is currently being used by an application. The underlying network
- interface has a valid IP configuration and can transfer IP packets between the
- device and the target network.
-
- The \l Undefined state indicates that the system has knowledge of possible target
- networks but cannot actually use that knowledge to connect to it. An example
- for such a state could be an encrypted WLAN that has been discovered
- but the user hasn't actually saved a configuration including the required password
- which would allow the device to connect to it.
-
- Depending on the type of configuration some states are transient in nature. A GPRS/UMTS
- connection may almost always be \l Discovered if the GSM/UMTS network is available.
- However if the GSM/UMTS network loses the connection the associated configuration may change its state
- from \l Discovered to \l Defined as well. A similar use case might be triggered by
- WLAN availability. QNetworkConfigurationManager::updateConfigurations() can be used to
- manually trigger updates of states. Note that some platforms do not require such updates
- as they implicitly change the state once it has been discovered. If the state of a
- configuration changes all related QNetworkConfiguration instances change their state automatically.
-
- \sa QNetworkSession, QNetworkConfigurationManager
-*/
-
-/*!
- \enum QNetworkConfiguration::Type
-
- This enum describes the type of configuration.
-
- \value InternetAccessPoint The configuration specifies the details for a single access point.
- Note that configurations of type InternetAccessPoint may be part
- of other QNetworkConfigurations of type ServiceNetwork.
- \value ServiceNetwork The configuration is based on a group of QNetworkConfigurations of
- type InternetAccessPoint. All group members can reach the same
- target network. This type of configuration is a mandatory
- requirement for roaming enabled network sessions. On some
- platforms this form of configuration may also be called Service
- Network Access Point (SNAP).
- \value UserChoice The configuration is a placeholder which will be resolved to an
- actual configuration by the platform when a session is opened. Depending
- on the platform the selection may generate a popup dialog asking the user
- for his preferred choice.
- \value Invalid The configuration is invalid.
-*/
-
-/*!
- \enum QNetworkConfiguration::StateFlag
-
- Specifies the configuration states.
-
- \value Undefined This state is used for transient configurations such as newly discovered
- WLANs for which the user has not actually created a configuration yet.
- \value Defined Defined configurations are known to the system but are not immediately
- usable (e.g. a configured WLAN is not within range or the Ethernet cable
- is currently not plugged into the machine).
- \value Discovered A discovered configuration can be immediately used to create a new
- QNetworkSession. An example of a discovered configuration could be a WLAN
- which is within in range. If the device moves out of range the discovered
- flag is dropped. A second example is a GPRS configuration which generally
- remains discovered for as long as the device has network coverage. A
- configuration that has this state is also in state
- QNetworkConfiguration::Defined. If the configuration is a service network
- this flag is set if at least one of the underlying access points
- configurations has the Discovered state.
- \value Active The configuration is currently used by an open network session
- (see \l QNetworkSession::isOpen()). However this does not mean that the
- current process is the entity that created the open session. It merely
- indicates that if a new QNetworkSession were to be constructed based on
- this configuration \l QNetworkSession::state() would return
- \l QNetworkSession::Connected. This state implies the
- QNetworkConfiguration::Discovered state.
-*/
-
-/*!
- \enum QNetworkConfiguration::Purpose
-
- Specifies the purpose of the configuration.
-
- \value UnknownPurpose The configuration doesn't specify any purpose. This is the default value.
- \value PublicPurpose The configuration can be used for general purpose internet access.
- \value PrivatePurpose The configuration is suitable to access a private network such as an office Intranet.
- \value ServiceSpecificPurpose The configuration can be used for operator specific services (e.g.
- receiving MMS messages or content streaming).
-*/
-
-/*!
- \enum QNetworkConfiguration::BearerType
-
- Specifies the type of bearer used by a configuration.
-
- \value BearerUnknown The type of bearer is unknown or unspecified. The bearerTypeName()
- function may return additional information.
- \value BearerEthernet The configuration is for an Ethernet interfaces.
- \value BearerWLAN The configuration is for a Wireless LAN interface.
- \value Bearer2G The configuration is for a CSD, GPRS, HSCSD, EDGE or cdmaOne interface.
- \value Bearer3G The configuration is for a 3G interface.
- \value Bearer4G The configuration is for a 4G interface.
- \value BearerCDMA2000 The configuration is for CDMA interface.
- \value BearerWCDMA The configuration is for W-CDMA/UMTS interface.
- \value BearerHSPA The configuration is for High Speed Packet Access (HSPA) interface.
- \value BearerBluetooth The configuration is for a Bluetooth interface.
- \value BearerWiMAX The configuration is for a WiMAX interface.
- \value BearerEVDO The configuration is for an EVDO (3G) interface.
- \value BearerLTE The configuration is for a LTE (4G) interface.
-*/
-
-/*!
- Constructs an invalid configuration object.
-
- \sa isValid()
-*/
-QNetworkConfiguration::QNetworkConfiguration()
- : d(nullptr)
-{
-}
-
-/*!
- Creates a copy of the QNetworkConfiguration object contained in \a other.
-*/
-QNetworkConfiguration::QNetworkConfiguration(const QNetworkConfiguration &other)
- : d(other.d)
-{
-}
-
-/*!
- Frees the resources associated with the QNetworkConfiguration object.
-*/
-QNetworkConfiguration::~QNetworkConfiguration()
-{
-}
-
-/*!
- Copies the content of the QNetworkConfiguration object contained in \a other into this one.
-*/
-QNetworkConfiguration &QNetworkConfiguration::operator=(const QNetworkConfiguration &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- \fn void QNetworkConfiguration::swap(QNetworkConfiguration &other)
- \since 5.0
-
- Swaps this network configuration with \a other. This function is
- very fast and never fails.
-*/
-
-/*!
- Returns \c true, if this configuration is the same as the \a other
- configuration given; otherwise returns \c false.
-*/
-bool QNetworkConfiguration::operator==(const QNetworkConfiguration &other) const
-{
- return (d == other.d);
-}
-
-/*!
- \fn bool QNetworkConfiguration::operator!=(const QNetworkConfiguration &other) const
-
- Returns \c true if this configuration is not the same as the \a other
- configuration given; otherwise returns \c false.
-*/
-
-/*!
- Returns the user visible name of this configuration.
-
- The name may either be the name of the underlying access point or the
- name for service network that this configuration represents.
-*/
-QString QNetworkConfiguration::name() const
-{
- if (!d)
- return QString();
-
- QMutexLocker locker(&d->mutex);
- return d->name;
-}
-
-/*!
- Returns the unique and platform specific identifier for this network configuration;
- otherwise an empty string.
-*/
-QString QNetworkConfiguration::identifier() const
-{
- if (!d)
- return QString();
-
- QMutexLocker locker(&d->mutex);
- return d->id;
-}
-
-/*!
- Returns the type of the configuration.
-
- A configuration can represent a single access point configuration or
- a set of access point configurations. Such a set is called service network.
- A configuration that is based on a service network can potentially support
- roaming of network sessions.
-*/
-QNetworkConfiguration::Type QNetworkConfiguration::type() const
-{
- if (!d)
- return QNetworkConfiguration::Invalid;
-
- QMutexLocker locker(&d->mutex);
- return d->type;
-}
-
-/*!
- Returns \c true if this QNetworkConfiguration object is valid.
- A configuration may become invalid if the user deletes the configuration or
- the configuration was default-constructed.
-
- The addition and removal of configurations can be monitored via the
- QNetworkConfigurationManager.
-
- \sa QNetworkConfigurationManager
-*/
-bool QNetworkConfiguration::isValid() const
-{
- if (!d)
- return false;
-
- QMutexLocker locker(&d->mutex);
- return d->isValid;
-}
-
-/*!
- \since 5.9
-
- Returns the connect timeout of this configuration.
-
- \sa setConnectTimeout
-*/
-int QNetworkConfiguration::connectTimeout() const
-{
- if (!d)
- return QNetworkConfigurationPrivate::DefaultTimeout;
- QMutexLocker locker(&d->mutex);
- return d->timeout;
-}
-
-/*!
- \since 5.9
-
- Sets the connect timeout of this configuration to \a timeout.
- This allows control of the timeout used by \c QAbstractSocket
- to establish a connection.
-
- \note \a timeout is in millisecond.
-
- \warning This will have no effect if the bearer plugin doesn't have
- the CanStartAndStopInterfaces capability.
-
- Returns true if succeeded.
-
- \sa connectTimeout
-*/
-bool QNetworkConfiguration::setConnectTimeout(int timeout)
-{
- if (!d)
- return false;
- QMutexLocker locker(&d->mutex);
- d->timeout = timeout;
- return true;
-}
-
-/*!
- Returns the current state of the configuration.
-*/
-QNetworkConfiguration::StateFlags QNetworkConfiguration::state() const
-{
- if (!d)
- return QNetworkConfiguration::Undefined;
-
- QMutexLocker locker(&d->mutex);
- return d->state;
-}
-
-/*!
- Returns the purpose of this configuration.
-
- The purpose field may be used to programmatically determine the
- purpose of a configuration. Such information is usually part of the
- access point or service network meta data.
-*/
-QNetworkConfiguration::Purpose QNetworkConfiguration::purpose() const
-{
- if (!d)
- return QNetworkConfiguration::UnknownPurpose;
-
- QMutexLocker locker(&d->mutex);
- return d->purpose;
-}
-
-/*!
- Returns \c true if this configuration supports roaming; otherwise false.
-*/
-bool QNetworkConfiguration::isRoamingAvailable() const
-{
- if (!d)
- return false;
-
- QMutexLocker locker(&d->mutex);
- return d->roamingSupported;
-}
-
-/*!
- Returns all sub configurations of this network configuration in priority order. The first sub
- configuration in the list has the highest priority.
-
- Only network configurations of type \l ServiceNetwork can have children. Otherwise this
- function returns an empty list.
-*/
-QList<QNetworkConfiguration> QNetworkConfiguration::children() const
-{
- return {};
-}
-
-/*!
- Returns the type of bearer used by this network configuration.
-
- If the bearer type is \l {QNetworkConfiguration::BearerUnknown}{unknown} the bearerTypeName()
- function can be used to retrieve a textural type name for the bearer.
-
- An invalid network configuration always returns the BearerUnknown value.
-
- \sa bearerTypeName(), bearerTypeFamily()
-*/
-QNetworkConfiguration::BearerType QNetworkConfiguration::bearerType() const
-{
- if (!isValid())
- return BearerUnknown;
-
- QMutexLocker locker(&d->mutex);
- return d->bearerType;
-}
-
-/*!
- \since 5.2
-
- Returns the bearer type family used by this network configuration.
- The following table lists how bearerType() values map to
- bearerTypeFamily() values:
-
- \table
- \header
- \li bearer type
- \li bearer type family
- \row
- \li BearerUnknown, Bearer2G, BearerEthernet, BearerWLAN,
- BearerBluetooth
- \li (same type)
- \row
- \li BearerCDMA2000, BearerEVDO, BearerWCDMA, BearerHSPA, Bearer3G
- \li Bearer3G
- \row
- \li BearerWiMAX, BearerLTE, Bearer4G
- \li Bearer4G
- \endtable
-
- An invalid network configuration always returns the BearerUnknown value.
-
- \sa bearerType(), bearerTypeName()
-*/
-QNetworkConfiguration::BearerType QNetworkConfiguration::bearerTypeFamily() const
-{
- QNetworkConfiguration::BearerType type = bearerType();
- switch (type) {
- case QNetworkConfiguration::BearerUnknown: // fallthrough
- case QNetworkConfiguration::Bearer2G: // fallthrough
- case QNetworkConfiguration::BearerEthernet: // fallthrough
- case QNetworkConfiguration::BearerWLAN: // fallthrough
- case QNetworkConfiguration::BearerBluetooth:
- return type;
- case QNetworkConfiguration::BearerCDMA2000: // fallthrough
- case QNetworkConfiguration::BearerEVDO: // fallthrough
- case QNetworkConfiguration::BearerWCDMA: // fallthrough
- case QNetworkConfiguration::BearerHSPA: // fallthrough
- case QNetworkConfiguration::Bearer3G:
- return QNetworkConfiguration::Bearer3G;
- case QNetworkConfiguration::BearerWiMAX: // fallthrough
- case QNetworkConfiguration::BearerLTE: // fallthrough
- case QNetworkConfiguration::Bearer4G:
- return QNetworkConfiguration::Bearer4G;
- default:
- qWarning() << "unknown bearer type" << type;
- return QNetworkConfiguration::BearerUnknown;
- }
-}
-/*!
- Returns the type of bearer used by this network configuration as a string.
-
- The string is not translated and therefore cannot be shown to the user. The subsequent table
- shows the fixed mappings between BearerType and the bearer type name for known types. If the
- BearerType is unknown this function may return additional information if it is available;
- otherwise an empty string will be returned.
-
- \table
- \header
- \li BearerType
- \li Value
- \row
- \li BearerUnknown
- \li The session is based on an unknown or unspecified bearer type. The value of the
- string returned describes the bearer type.
- \row
- \li BearerEthernet
- \li Ethernet
- \row
- \li BearerWLAN
- \li WLAN
- \row
- \li Bearer2G
- \li 2G
- \row
- \li Bearer3G
- \li 3G
- \row
- \li Bearer4G
- \li 4G
- \row
- \li BearerCDMA2000
- \li CDMA2000
- \row
- \li BearerWCDMA
- \li WCDMA
- \row
- \li BearerHSPA
- \li HSPA
- \row
- \li BearerBluetooth
- \li Bluetooth
- \row
- \li BearerWiMAX
- \li WiMAX
- \row
- \li BearerEVDO
- \li EVDO
- \row
- \li BearerLTE
- \li LTE
- \endtable
-
- This function returns an empty string if this is an invalid configuration, a network
- configuration of type \l QNetworkConfiguration::ServiceNetwork or
- \l QNetworkConfiguration::UserChoice.
-
- \sa bearerType(), bearerTypeFamily()
-*/
-QString QNetworkConfiguration::bearerTypeName() const
-{
- if (!isValid())
- return QString();
-
- QMutexLocker locker(&d->mutex);
-
- if (d->type == QNetworkConfiguration::ServiceNetwork ||
- d->type == QNetworkConfiguration::UserChoice)
- return QString();
-
- switch (d->bearerType) {
- case BearerEthernet:
- return QStringLiteral("Ethernet");
- case BearerWLAN:
- return QStringLiteral("WLAN");
- case Bearer2G:
- return QStringLiteral("2G");
- case Bearer3G:
- return QStringLiteral("3G");
- case Bearer4G:
- return QStringLiteral("4G");
- case BearerCDMA2000:
- return QStringLiteral("CDMA2000");
- case BearerWCDMA:
- return QStringLiteral("WCDMA");
- case BearerHSPA:
- return QStringLiteral("HSPA");
- case BearerBluetooth:
- return QStringLiteral("Bluetooth");
- case BearerWiMAX:
- return QStringLiteral("WiMAX");
- case BearerEVDO:
- return QStringLiteral("EVDO");
- case BearerLTE:
- return QStringLiteral("LTE");
- case BearerUnknown:
- break;
- }
- return QStringLiteral("Unknown");
-}
-
-QT_END_NAMESPACE
diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h
deleted file mode 100644
index 69864a3165..0000000000
--- a/src/network/bearer/qnetworkconfiguration.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKCONFIGURATION_H
-#define QNETWORKCONFIGURATION_H
-
-#if 0
-#pragma qt_class(QNetworkConfiguration)
-#endif
-
-#include <QtNetwork/qtnetworkglobal.h>
-
-#include <QtCore/qshareddata.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qmetatype.h>
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfigurationPrivate;
-class QT_DEPRECATED_BEARER_MANAGEMENT Q_NETWORK_EXPORT QNetworkConfiguration
-{
-public:
- QNetworkConfiguration();
- QNetworkConfiguration(const QNetworkConfiguration& other);
- QNetworkConfiguration &operator=(QNetworkConfiguration &&other) noexcept { swap(other); return *this; }
- QNetworkConfiguration &operator=(const QNetworkConfiguration &other);
- ~QNetworkConfiguration();
-
- void swap(QNetworkConfiguration &other) noexcept { qSwap(d, other.d); }
-
- bool operator==(const QNetworkConfiguration &other) const;
- inline bool operator!=(const QNetworkConfiguration &other) const
- { return !operator==(other); }
-
- enum Type {
- InternetAccessPoint = 0,
- ServiceNetwork,
- UserChoice,
- Invalid
- };
-
- enum Purpose {
- UnknownPurpose = 0,
- PublicPurpose,
- PrivatePurpose,
- ServiceSpecificPurpose
- };
-
- enum StateFlag {
- Undefined = 0x0000001,
- Defined = 0x0000002,
- Discovered = 0x0000006,
- Active = 0x000000e
- };
- Q_DECLARE_FLAGS(StateFlags, StateFlag)
-
- enum BearerType {
- BearerUnknown,
- BearerEthernet,
- BearerWLAN,
- Bearer2G,
- BearerCDMA2000,
- BearerWCDMA,
- BearerHSPA,
- BearerBluetooth,
- BearerWiMAX,
- BearerEVDO,
- BearerLTE,
- Bearer3G,
- Bearer4G
- };
-
- StateFlags state() const;
- Type type() const;
- Purpose purpose() const;
-
- BearerType bearerType() const;
- BearerType bearerTypeFamily() const;
- QString bearerTypeName() const;
-
- QString identifier() const;
- bool isRoamingAvailable() const;
- QList<QNetworkConfiguration> children() const;
-
- QString name() const;
- bool isValid() const;
-
- int connectTimeout() const;
- bool setConnectTimeout(int timeout);
-
-private:
- friend class QNetworkConfigurationPrivate;
- friend class QNetworkConfigurationManager;
- friend class QNetworkConfigurationManagerPrivate;
- friend class QNetworkSessionPrivate;
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> d;
-};
-
-Q_DECLARE_SHARED(QNetworkConfiguration)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QNetworkConfiguration)
-
-QT_WARNING_POP
-
-#endif // QNETWORKCONFIGURATION_H
diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h
deleted file mode 100644
index 96854fe831..0000000000
--- a/src/network/bearer/qnetworkconfiguration_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKCONFIGURATIONPRIVATE_H
-#define QNETWORKCONFIGURATIONPRIVATE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-#include "qnetworkconfiguration.h"
-
-#include <QtCore/qshareddata.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qmap.h>
-
-QT_BEGIN_NAMESPACE
-
-typedef QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> QNetworkConfigurationPrivatePointer;
-class QNetworkConfigurationPrivate : public QSharedData
-{
-public:
- QNetworkConfigurationPrivate() :
- type(QNetworkConfiguration::Invalid),
- purpose(QNetworkConfiguration::UnknownPurpose),
- bearerType(QNetworkConfiguration::BearerUnknown),
- isValid(false), roamingSupported(false),
- timeout(DefaultTimeout)
- {}
-
- mutable QRecursiveMutex mutex;
-
- QString name;
- QString id;
-
- QNetworkConfiguration::StateFlags state;
- QNetworkConfiguration::Type type;
- QNetworkConfiguration::Purpose purpose;
- QNetworkConfiguration::BearerType bearerType;
-
- bool isValid;
- bool roamingSupported;
- int timeout;
-
- static Q_CONSTEXPR int DefaultTimeout = 30000;
-
-private:
- Q_DISABLE_COPY_MOVE(QNetworkConfigurationPrivate)
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QNetworkConfigurationPrivatePointer)
-
-#endif // QNETWORKCONFIGURATIONPRIVATE_H
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp
deleted file mode 100644
index 4e8ed1619b..0000000000
--- a/src/network/bearer/qnetworksession.cpp
+++ /dev/null
@@ -1,743 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-
-#include "qnetworksession.h"
-#include "qnetworksession_p.h"
-#include "qbearerengine_p.h"
-
-#include <QEventLoop>
-#include <QMetaMethod>
-#include <QTimer>
-#include <QThread>
-
-#include "qnetworkconfigmanager_p.h"
-
-// for QNetworkSession::interface
-#ifdef interface
-# undef interface
-#endif
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QNetworkSession
- \obsolete
-
- \brief The QNetworkSession class provides control over the system's access points
- and enables session management for cases when multiple clients access the same access point.
-
- \since 4.7
-
- \inmodule QtNetwork
- \ingroup network
-
- A QNetworkSession enables control over the system's network interfaces. The session's configuration
- parameter are determined via the QNetworkConfiguration object to which it is bound. Depending on the
- type of the session (single access point or service network) a session may be linked to one or more
- network interfaces. By means of \l{open()}{opening} and \l{close()}{closing} of network sessions
- a developer can start and stop the systems network interfaces. If the configuration represents
- multiple access points (see \l QNetworkConfiguration::ServiceNetwork) more advanced features such as roaming may be supported.
-
- QNetworkSession supports session management within the same process and depending on the platform's
- capabilities may support out-of-process sessions. If the same
- network configuration is used by multiple open sessions the underlying network interface is only terminated once
- the last session has been closed.
-
- \section1 Roaming
-
- Applications may connect to the preferredConfigurationChanged() signal in order to
- receive notifications when a more suitable access point becomes available.
- In response to this signal the application must either initiate the roaming via migrate()
- or ignore() the new access point. Once the session has roamed the
- newConfigurationActivated() signal is emitted. The application may now test the
- carrier and must either accept() or reject() it. The session will return to the previous
- access point if the roaming was rejected. The subsequent state diagram depicts the required
- state transitions.
-
- \image roaming-states.png
-
- Some platforms may distinguish forced roaming and application level roaming (ALR).
- ALR implies that the application controls (via migrate(), ignore(), accept() and reject())
- whether a network session can roam from one access point to the next. Such control is useful
- if the application maintains stateful socket connections and wants to control the transition from
- one interface to the next. Forced roaming implies that the system automatically roams to the next network without
- consulting the application. This has the advantage that the application can make use of roaming features
- without actually being aware of it. It is expected that the application detects that the underlying
- socket is broken and automatically reconnects via the new network link.
-
- If the platform supports both modes of roaming, an application indicates its preference
- by connecting to the preferredConfigurationChanged() signal. Connecting to this signal means that
- the application wants to take control over the roaming behavior and therefore implies application
- level roaming. If the client does not connect to the preferredConfigurationChanged(), forced roaming
- is used. If forced roaming is not supported the network session will not roam by default.
-
- Some applications may want to suppress any form of roaming altogether. Possible use cases may be
- high priority downloads or remote services which cannot handle a roaming enabled client. Clients
- can suppress roaming by connecting to the preferredConfigurationChanged() signal and answer each
- signal emission with ignore().
-
- \sa QNetworkConfiguration, QNetworkConfigurationManager
-*/
-
-/*!
- \enum QNetworkSession::State
-
- This enum describes the connectivity state of the session. If the session is based on a
- single access point configuration the state of the session is the same as the state of the
- associated network interface.
-
- \value Invalid The session is invalid due to an invalid configuration. This may
- happen due to a removed access point or a configuration that was
- invalid to begin with.
- \value NotAvailable The session is based on a defined but not yet discovered QNetworkConfiguration
- (see \l QNetworkConfiguration::StateFlag).
- \value Connecting The network session is being established.
- \value Connected The network session is connected. If the current process wishes to use this session
- it has to register its interest by calling open(). A network session
- is considered to be ready for socket operations if it isOpen() and connected.
- \value Closing The network session is in the process of being shut down.
- \value Disconnected The network session is not connected. The associated QNetworkConfiguration
- has the state QNetworkConfiguration::Discovered.
- \value Roaming The network session is roaming from one access point to another
- access point.
-*/
-
-/*!
- \enum QNetworkSession::SessionError
-
- This enum describes the session errors that can occur.
-
- \value UnknownSessionError An unidentified error occurred.
- \value SessionAbortedError The session was aborted by the user or system.
- \value RoamingError The session cannot roam to a new configuration.
- \value OperationNotSupportedError The operation is not supported for current configuration.
- \value InvalidConfigurationError The operation cannot currently be performed for the
- current configuration.
-*/
-
-/*!
- \enum QNetworkSession::UsagePolicy
- \since 5.0
-
- These flags allow the system to inform the application of network usage restrictions that
- may be in place.
-
- \value NoPolicy No policy in force, usage is unrestricted.
- \value NoBackgroundTrafficPolicy Background network traffic (not user initiated) should be avoided
- for example to save battery or data charges
-*/
-
-/*!
- \fn void QNetworkSession::stateChanged(QNetworkSession::State state)
-
- This signal is emitted whenever the state of the network session changes.
- The \a state parameter is the new state.
-
- \sa state()
-*/
-
-/*!
- \fn void QNetworkSession::error(QNetworkSession::SessionError error)
-
- This signal is emitted after an error occurred. The \a error parameter
- describes the error that occurred.
-
- \sa error(), errorString()
-*/
-
-/*!
- \fn void QNetworkSession::preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless)
-
- This signal is emitted when the preferred configuration/access point for the
- session changes. Only sessions which are based on service network configurations
- may emit this signal. \a config can be used to determine access point specific
- details such as proxy settings and \a isSeamless indicates whether roaming will
- break the sessions IP address.
-
- As a consequence to this signal the application must either start the roaming process
- by calling migrate() or choose to ignore() the new access point.
-
- If the roaming process is non-seamless the IP address will change which means that
- a socket becomes invalid. However seamless mobility can ensure that the local IP address
- does not change. This is achieved by using a virtual IP address which is bound to the actual
- link address. During the roaming process the virtual address is attached to the new link
- address.
-
- Some platforms may support the concept of Forced Roaming and Application Level Roaming (ALR).
- Forced roaming implies that the platform may simply roam to a new configuration without
- consulting applications. It is up to the application to detect the link layer loss and reestablish
- its sockets. In contrast ALR provides the opportunity to prevent the system from roaming.
- If this session is based on a configuration that supports roaming the application can choose
- whether it wants to be consulted (ALR use case) by connecting to this signal. For as long as this signal
- connection remains the session remains registered as a roaming stakeholder; otherwise roaming will
- be enforced by the platform.
-
- \sa migrate(), ignore(), QNetworkConfiguration::isRoamingAvailable()
-*/
-
-/*!
- \fn void QNetworkSession::newConfigurationActivated()
-
- This signal is emitted once the session has roamed to the new access point.
- The application may reopen its socket and test the suitability of the new network link.
- Subsequently it must either accept() or reject() the new access point.
-
- \sa accept(), reject()
-*/
-
-/*!
- \fn void QNetworkSession::opened()
-
- This signal is emitted when the network session has been opened.
-
- The underlying network interface will not be shut down as long as the session remains open.
- Note that this feature is dependent on \l{QNetworkConfigurationManager::SystemSessionSupport}{system wide session support}.
-*/
-
-/*!
- \fn void QNetworkSession::closed()
-
- This signal is emitted when the network session has been closed.
-*/
-
-/*!
- \fn void QNetworkSession::usagePoliciesChanged(QNetworkSession::UsagePolicies usagePolicies)
- \since 5.0
-
- This signal is emitted when the \a usagePolicies in force are changed by the system.
-*/
-
-/*!
- Constructs a session based on \a connectionConfig with the given \a parent.
-
- \sa QNetworkConfiguration
-*/
-QNetworkSession::QNetworkSession(const QNetworkConfiguration &connectionConfig, QObject *parent)
- : QObject(parent), d(nullptr)
-{
- qRegisterMetaType<QNetworkSession::State>();
- qRegisterMetaType<QNetworkSession::SessionError>();
- qRegisterMetaType<QNetworkSession::UsagePolicies>();
-
- // invalid configuration
- if (!connectionConfig.identifier().isEmpty()) {
- auto priv = qNetworkConfigurationManagerPrivate();
- const auto engines = priv ? priv->engines() : QList<QBearerEngine *>();
- for (QBearerEngine *engine : engines) {
- if (engine->hasIdentifier(connectionConfig.identifier())) {
- d = engine->createSessionBackend();
- d->q = this;
- d->publicConfig = connectionConfig;
- d->syncStateWithInterface();
- connect(d, SIGNAL(quitPendingWaitsForOpened()), this, SIGNAL(opened()));
- connect(d, SIGNAL(error(QNetworkSession::SessionError)),
- this, SIGNAL(error(QNetworkSession::SessionError)));
- connect(d, SIGNAL(stateChanged(QNetworkSession::State)),
- this, SIGNAL(stateChanged(QNetworkSession::State)));
- connect(d, SIGNAL(closed()), this, SIGNAL(closed()));
- connect(d, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)),
- this, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)));
- connect(d, SIGNAL(newConfigurationActivated()),
- this, SIGNAL(newConfigurationActivated()));
- connect(d, SIGNAL(usagePoliciesChanged(QNetworkSession::UsagePolicies)),
- this, SIGNAL(usagePoliciesChanged(QNetworkSession::UsagePolicies)));
- break;
- }
- }
- }
-}
-
-/*!
- Frees the resources associated with the QNetworkSession object.
-*/
-QNetworkSession::~QNetworkSession()
-{
- delete d;
-}
-
-/*!
- Creates an open session which increases the session counter on the underlying network interface.
- The system will not terminate a network interface until the session reference counter reaches zero.
- Therefore an open session allows an application to register its use of the interface.
-
- As a result of calling open() the interface will be started if it is not connected/up yet.
- Some platforms may not provide support for out-of-process sessions. On such platforms the session
- counter ignores any sessions held by another process. The platform capabilities can be
- detected via QNetworkConfigurationManager::capabilities().
-
- Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired
- by connecting to the stateChanged(), opened() or error() signals.
-
- It is not a requirement to open a session in order to monitor the underlying network interface.
-
- \sa close(), stop(), isOpen()
-*/
-void QNetworkSession::open()
-{
- if (d)
- d->open();
- else
- emit error(InvalidConfigurationError);
-}
-
-/*!
- Waits until the session has been opened, up to \a msecs milliseconds. If the session has been opened, this
- function returns \c true; otherwise it returns \c false. In the case where it returns \c false, you can call error()
- to determine the cause of the error.
-
- The following example waits up to one second for the session to be opened:
-
- \snippet code/src_network_bearer_qnetworksession.cpp 0
-
- If \a msecs is -1, this function will not time out.
-
- \sa open(), error()
-*/
-bool QNetworkSession::waitForOpened(int msecs)
-{
- if (!d)
- return false;
-
- if (d->isOpen)
- return true;
-
- if (!(d->state == Connecting || d->state == Connected)) {
- return false;
- }
-
- QEventLoop loop;
- QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), &loop, SLOT(quit()));
- QObject::connect(this, SIGNAL(error(QNetworkSession::SessionError)), &loop, SLOT(quit()));
-
- //final call
- if (msecs >= 0)
- QTimer::singleShot(msecs, &loop, SLOT(quit()));
-
- // enter the event loop and wait for opened/error/timeout
- loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents);
-
- return d->isOpen;
-}
-
-/*!
- Decreases the session counter on the associated network configuration. If the session counter reaches zero
- the active network interface is shut down. This also means that state() will only change from \l Connected to
- \l Disconnected if the current session was the last open session.
-
- If the platform does not support out-of-process sessions calling this function does not stop the
- interface. In this case \l{stop()} has to be used to force a shut down.
- The platform capabilities can be detected via QNetworkConfigurationManager::capabilities().
-
- Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired
- by connecting to the stateChanged(), opened() or error() signals.
-
- \sa open(), stop(), isOpen()
-*/
-void QNetworkSession::close()
-{
- if (d)
- d->close();
-}
-
-/*!
- Invalidates all open sessions against the network interface and therefore stops the
- underlying network interface. This function always changes the session's state() flag to
- \l Disconnected.
-
- \sa open(), close()
-*/
-void QNetworkSession::stop()
-{
- if (d)
- d->stop();
-}
-
-/*!
- Returns the QNetworkConfiguration that this network session object is based on.
-
- \sa QNetworkConfiguration
-*/
-QNetworkConfiguration QNetworkSession::configuration() const
-{
- return d ? d->publicConfig : QNetworkConfiguration();
-}
-
-#ifndef QT_NO_NETWORKINTERFACE
-/*!
- Returns the network interface that is used by this session.
-
- This function only returns a valid QNetworkInterface when this session is \l Connected.
-
- The returned interface may change as a result of a roaming process.
-
- \sa state()
-*/
-QNetworkInterface QNetworkSession::interface() const
-{
- return d ? d->currentInterface() : QNetworkInterface();
-}
-#endif
-
-/*!
- Returns \c true if this session is open. If the number of all open sessions is greater than
- zero the underlying network interface will remain connected/up.
-
- The session can be controlled via open() and close().
-*/
-bool QNetworkSession::isOpen() const
-{
- return d ? d->isOpen : false;
-}
-
-/*!
- Returns the state of the session.
-
- If the session is based on a single access point configuration the state of the
- session is the same as the state of the associated network interface. Therefore
- a network session object can be used to monitor network interfaces.
-
- A \l QNetworkConfiguration::ServiceNetwork based session summarizes the state of all its children
- and therefore returns the \l Connected state if at least one of the service network's
- \l {QNetworkConfiguration::children()}{children()} configurations is active.
-
- Note that it is not required to hold an open session in order to obtain the network interface state.
- A connected but closed session may be used to monitor network interfaces whereas an open and connected
- session object may prevent the network interface from being shut down.
-
- \sa error(), stateChanged()
-*/
-QNetworkSession::State QNetworkSession::state() const
-{
- return d ? d->state : QNetworkSession::Invalid;
-}
-
-/*!
- Returns the type of error that last occurred.
-
- \sa state(), errorString()
-*/
-QNetworkSession::SessionError QNetworkSession::error() const
-{
- return d ? d->error() : InvalidConfigurationError;
-}
-
-/*!
- Returns a human-readable description of the last device error that
- occurred.
-
- \sa error()
-*/
-QString QNetworkSession::errorString() const
-{
- return d ? d->errorString() : tr("Invalid configuration.");
-}
-
-/*!
- Returns the value for property \a key.
-
- A network session can have properties attached which may describe the session in more details.
- This function can be used to gain access to those properties.
-
- The following property keys are guaranteed to be specified on all platforms:
-
- \table 80%
- \header
- \li Key \li Description
- \row
- \li ActiveConfiguration
- \li If the session \l isOpen() this property returns the identifier of the
- QNetworkConfiguration that is used by this session; otherwise an empty string.
-
- The main purpose of this key is to determine which Internet access point is used
- if the session is based on a \l{QNetworkConfiguration::ServiceNetwork}{ServiceNetwork}.
- The following code snippet highlights the difference:
- \snippet code/src_network_bearer_qnetworksession.cpp 1
- \row
- \li UserChoiceConfiguration
- \li If the session \l isOpen() and is bound to a QNetworkConfiguration of type
- UserChoice, this property returns the identifier of the QNetworkConfiguration that the
- configuration resolved to when \l open() was called; otherwise an empty string.
-
- The purpose of this key is to determine the real QNetworkConfiguration that the
- session is using. This key is different from \e ActiveConfiguration in that
- this key may return an identifier for either a
- \l {QNetworkConfiguration::ServiceNetwork}{service network} or a
- \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations,
- whereas \e ActiveConfiguration always returns identifiers to
- \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations.
- \row
- \li ConnectInBackground
- \li Setting this property to \e true before calling \l open() implies that the connection attempt
- is made but if no connection can be established, the user is not connsulted and asked to select
- a suitable connection. This property is not set by default and support for it depends on the platform.
-
- \row
- \li AutoCloseSessionTimeout
- \li If the session requires polling to keep its state up to date, this property holds
- the timeout in milliseconds before the session will automatically close. If the
- value of this property is -1 the session will not automatically close. This property
- is set to -1 by default.
-
- The purpose of this property is to minimize resource use on platforms that use
- polling to update the state of the session. Applications can set the value of this
- property to the desired timeout before the session is closed. In response to the
- closed() signal the network session should be deleted to ensure that all polling is
- stopped. The session can then be recreated once it is required again. This property
- has no effect for sessions that do not require polling.
- \endtable
-*/
-QVariant QNetworkSession::sessionProperty(const QString &key) const
-{
- if (!d || !d->publicConfig.isValid())
- return QVariant();
-
- if (key == QLatin1String("ActiveConfiguration"))
- return d->isOpen ? d->activeConfig.identifier() : QString();
-
- if (key == QLatin1String("UserChoiceConfiguration")) {
- if (!d->isOpen || d->publicConfig.type() != QNetworkConfiguration::UserChoice)
- return QString();
-
- if (d->serviceConfig.isValid())
- return d->serviceConfig.identifier();
- else
- return d->activeConfig.identifier();
- }
-
- return d->sessionProperty(key);
-}
-
-/*!
- Sets the property \a value on the session. The property is identified using
- \a key. Removing an already set property can be achieved by passing an
- invalid QVariant.
-
- Note that the \e UserChoiceConfiguration and \e ActiveConfiguration
- properties are read only and cannot be changed using this method.
-*/
-void QNetworkSession::setSessionProperty(const QString &key, const QVariant &value)
-{
- if (!d)
- return;
-
- if (key == QLatin1String("ActiveConfiguration") ||
- key == QLatin1String("UserChoiceConfiguration")) {
- return;
- }
-
- d->setSessionProperty(key, value);
-}
-
-/*!
- Instructs the session to roam to the new access point. The old access point remains active
- until the application calls accept().
-
- The newConfigurationActivated() signal is emitted once roaming has been completed.
-
- \sa accept()
-*/
-void QNetworkSession::migrate()
-{
- if (d)
- d->migrate();
-}
-
-/*!
- This function indicates that the application does not wish to roam the session.
-
- \sa migrate()
-*/
-void QNetworkSession::ignore()
-{
- if (d)
- d->ignore();
-}
-
-/*!
- Instructs the session to permanently accept the new access point. Once this function
- has been called the session may not return to the old access point.
-
- The old access point may be closed in the process if there are no other network sessions for it.
- Therefore any open socket that still uses the old access point
- may become unusable and should be closed before completing the migration.
-*/
-void QNetworkSession::accept()
-{
- if (d)
- d->accept();
-}
-
-/*!
- The new access point is not suitable for the application. By calling this function the
- session returns to the previous access point/configuration. This action may invalidate
- any socket that has been created via the not desired access point.
-
- \sa accept()
-*/
-void QNetworkSession::reject()
-{
- if (d)
- d->reject();
-}
-
-
-/*!
- Returns the amount of data sent in bytes; otherwise 0.
-
- This field value includes the usage across all open network
- sessions which use the same network interface.
-
- If the session is based on a service network configuration the number of
- sent bytes across all active member configurations are returned.
-
- This function may not always be supported on all platforms and returns 0.
- The platform capability can be detected via QNetworkConfigurationManager::DataStatistics.
-
- \note On some platforms this function may run the main event loop.
-*/
-quint64 QNetworkSession::bytesWritten() const
-{
- return d ? d->bytesWritten() : Q_UINT64_C(0);
-}
-
-/*!
- Returns the amount of data received in bytes; otherwise 0.
-
- This field value includes the usage across all open network
- sessions which use the same network interface.
-
- If the session is based on a service network configuration the number of
- sent bytes across all active member configurations are returned.
-
- This function may not always be supported on all platforms and returns 0.
- The platform capability can be detected via QNetworkConfigurationManager::DataStatistics.
-
- \note On some platforms this function may run the main event loop.
-*/
-quint64 QNetworkSession::bytesReceived() const
-{
- return d ? d->bytesReceived() : Q_UINT64_C(0);
-}
-
-/*!
- Returns the number of seconds that the session has been active.
-*/
-quint64 QNetworkSession::activeTime() const
-{
- return d ? d->activeTime() : Q_UINT64_C(0);
-}
-
-/*!
- Returns the network usage policies currently in force by the system.
-*/
-QNetworkSession::UsagePolicies QNetworkSession::usagePolicies() const
-{
- return d ? d->usagePolicies() : QNetworkSession::NoPolicy;
-}
-
-/*!
- \internal
- Change usage policies for unit testing.
- In normal use, the policies are published by the bearer plugin
-*/
-void QNetworkSessionPrivate::setUsagePolicies(QNetworkSession &session, QNetworkSession::UsagePolicies policies)
-{
- if (!session.d)
- return;
- session.d->setUsagePolicies(policies);
-}
-
-/*!
- \internal
-
- This function is required to detect whether the client wants to control
- the roaming process. If he connects to preferredConfigurationChanged() signal
- he intends to influence it. Otherwise QNetworkSession always roams
- without registering this session as a stakeholder in the roaming process.
-
- For more details check the Forced vs ALR roaming section in the QNetworkSession
- class description.
-*/
-void QNetworkSession::connectNotify(const QMetaMethod &signal)
-{
- QObject::connectNotify(signal);
-
- if (!d)
- return;
-
- //check for preferredConfigurationChanged() signal connect notification
- //This is not required on all platforms
- static const QMetaMethod preferredConfigurationChangedSignal =
- QMetaMethod::fromSignal(&QNetworkSession::preferredConfigurationChanged);
- if (signal == preferredConfigurationChangedSignal)
- d->setALREnabled(true);
-}
-
-/*!
- \internal
-
- This function is called when the client disconnects from the
- preferredConfigurationChanged() signal.
-
- \sa connectNotify()
-*/
-void QNetworkSession::disconnectNotify(const QMetaMethod &signal)
-{
- QObject::disconnectNotify(signal);
-
- if (!d)
- return;
-
- //check for preferredConfigurationChanged() signal disconnect notification
- //This is not required on all platforms
- static const QMetaMethod preferredConfigurationChangedSignal =
- QMetaMethod::fromSignal(&QNetworkSession::preferredConfigurationChanged);
- if (signal == preferredConfigurationChangedSignal)
- d->setALREnabled(false);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qnetworksession.cpp"
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h
deleted file mode 100644
index 65d90b0a82..0000000000
--- a/src/network/bearer/qnetworksession.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKSESSION_H
-#define QNETWORKSESSION_H
-
-#if 0
-#pragma qt_class(QNetworkSession)
-#endif
-
-#include <QtNetwork/qtnetworkglobal.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qstring.h>
-#include <QtNetwork/qnetworkinterface.h>
-#include <QtCore/qvariant.h>
-#include <QtNetwork/qnetworkconfiguration.h>
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-#if defined(Q_OS_WIN) && defined(interface)
-#undef interface
-#endif
-
-#include <QtCore/qshareddata.h>
-QT_BEGIN_NAMESPACE
-
-class QNetworkSessionPrivate;
-class QT_DEPRECATED_BEARER_MANAGEMENT Q_NETWORK_EXPORT QNetworkSession : public QObject
-{
- Q_OBJECT
-
-public:
- enum State {
- Invalid = 0,
- NotAvailable,
- Connecting,
- Connected,
- Closing,
- Disconnected,
- Roaming
- };
-
- enum SessionError {
- UnknownSessionError = 0,
- SessionAbortedError,
- RoamingError,
- OperationNotSupportedError,
- InvalidConfigurationError
- };
-
- enum UsagePolicy {
- NoPolicy = 0,
- NoBackgroundTrafficPolicy = 1
- };
-
- Q_DECLARE_FLAGS(UsagePolicies, UsagePolicy)
-
- explicit QNetworkSession(const QNetworkConfiguration &connConfig, QObject *parent = nullptr);
- virtual ~QNetworkSession();
-
- bool isOpen() const;
- QNetworkConfiguration configuration() const;
-#ifndef QT_NO_NETWORKINTERFACE
- QNetworkInterface interface() const;
-#endif
-
- State state() const;
- SessionError error() const;
- QString errorString() const;
- QVariant sessionProperty(const QString &key) const;
- void setSessionProperty(const QString &key, const QVariant &value);
-
- quint64 bytesWritten() const;
- quint64 bytesReceived() const;
- quint64 activeTime() const;
-
- QNetworkSession::UsagePolicies usagePolicies() const;
-
- bool waitForOpened(int msecs = 30000);
-
-public Q_SLOTS:
- void open();
- void close();
- void stop();
-
- //roaming related slots
- void migrate();
- void ignore();
- void accept();
- void reject();
-
-Q_SIGNALS:
- void stateChanged(QNetworkSession::State);
- void opened();
- void closed();
- void error(QNetworkSession::SessionError);
- void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless);
- void newConfigurationActivated();
- void usagePoliciesChanged(QNetworkSession::UsagePolicies usagePolicies);
-
-protected:
- virtual void connectNotify(const QMetaMethod &signal) override;
- virtual void disconnectNotify(const QMetaMethod &signal) override;
-
-private:
- Q_DISABLE_COPY(QNetworkSession)
- friend class QNetworkSessionPrivate;
- QNetworkSessionPrivate *d;
-};
-
-QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QNetworkSession::State)
-Q_DECLARE_METATYPE(QNetworkSession::SessionError)
-Q_DECLARE_METATYPE(QNetworkSession::UsagePolicies)
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-QT_WARNING_POP
-
-#endif // QNETWORKSESSION_H
diff --git a/src/network/bearer/qnetworksession_impl.cpp b/src/network/bearer/qnetworksession_impl.cpp
deleted file mode 100644
index 45a00b45fd..0000000000
--- a/src/network/bearer/qnetworksession_impl.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// see comment in ../platformdefs_win.h.
-#define WIN32_LEAN_AND_MEAN 1
-
-#include "qnetworksession_impl_p.h"
-#include "qbearerengine_impl_p.h"
-
-#include <QtNetwork/qnetworksession.h>
-#include <QtNetwork/private/qnetworkconfigmanager_p.h>
-
-#include <QtCore/qdatetime.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qstringlist.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-static QBearerEngineImpl *getEngineFromId(const QString &id)
-{
- QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- if (priv) {
- const auto engines = priv->engines();
- for (QBearerEngine *engine : engines) {
- QBearerEngineImpl *engineImpl = qobject_cast<QBearerEngineImpl *>(engine);
- if (engineImpl && engineImpl->hasIdentifier(id))
- return engineImpl;
- }
- }
-
- return nullptr;
-}
-
-class QNetworkSessionManagerPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QNetworkSessionManagerPrivate(QObject *parent = nullptr) : QObject(parent) {}
- ~QNetworkSessionManagerPrivate() {}
-
- inline void forceSessionClose(const QNetworkConfiguration &config)
- { emit forcedSessionClose(config); }
-
-Q_SIGNALS:
- void forcedSessionClose(const QNetworkConfiguration &config);
-};
-
-Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager);
-
-void QNetworkSessionPrivateImpl::syncStateWithInterface()
-{
- connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)),
- this, SLOT(forcedSessionClose(QNetworkConfiguration)));
-
- opened = false;
- isOpen = false;
- state = QNetworkSession::Invalid;
- lastError = QNetworkSession::UnknownSessionError;
-
- qRegisterMetaType<QBearerEngineImpl::ConnectionError>();
-
- switch (publicConfig.type()) {
- case QNetworkConfiguration::InternetAccessPoint:
- activeConfig = publicConfig;
- engine = getEngineFromId(activeConfig.identifier());
- if (engine) {
- qRegisterMetaType<QNetworkConfigurationPrivatePointer>();
- connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
- this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)),
- Qt::QueuedConnection);
- connect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)),
- this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)),
- Qt::QueuedConnection);
- }
- break;
- case QNetworkConfiguration::ServiceNetwork:
- serviceConfig = publicConfig;
- // Defer setting engine and signals until open().
- Q_FALLTHROUGH();
- case QNetworkConfiguration::UserChoice:
- // Defer setting serviceConfig and activeConfig until open().
- Q_FALLTHROUGH();
- default:
- engine = nullptr;
- }
-
- networkConfigurationsChanged();
-}
-
-void QNetworkSessionPrivateImpl::open()
-{
- if (serviceConfig.isValid()) {
- lastError = QNetworkSession::OperationNotSupportedError;
- emit QNetworkSessionPrivate::error(lastError);
- } else if (!isOpen) {
- if ((activeConfig.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) {
- lastError = QNetworkSession::InvalidConfigurationError;
- state = QNetworkSession::Invalid;
- emit stateChanged(state);
- emit QNetworkSessionPrivate::error(lastError);
- return;
- }
- opened = true;
-
- if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active &&
- (activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) {
- state = QNetworkSession::Connecting;
- emit stateChanged(state);
-
- engine->connectToId(activeConfig.identifier());
- }
-
- isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
- if (isOpen)
- emit quitPendingWaitsForOpened();
- }
-}
-
-void QNetworkSessionPrivateImpl::close()
-{
- if (serviceConfig.isValid()) {
- lastError = QNetworkSession::OperationNotSupportedError;
- emit QNetworkSessionPrivate::error(lastError);
- } else if (isOpen) {
- opened = false;
- isOpen = false;
- emit closed();
- }
-}
-
-void QNetworkSessionPrivateImpl::stop()
-{
- if (serviceConfig.isValid()) {
- lastError = QNetworkSession::OperationNotSupportedError;
- emit QNetworkSessionPrivate::error(lastError);
- } else {
- if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- state = QNetworkSession::Closing;
- emit stateChanged(state);
-
- engine->disconnectFromId(activeConfig.identifier());
-
- sessionManager()->forceSessionClose(activeConfig);
- }
-
- opened = false;
- isOpen = false;
- emit closed();
- }
-}
-
-void QNetworkSessionPrivateImpl::migrate()
-{
-}
-
-void QNetworkSessionPrivateImpl::accept()
-{
-}
-
-void QNetworkSessionPrivateImpl::ignore()
-{
-}
-
-void QNetworkSessionPrivateImpl::reject()
-{
-}
-
-#ifndef QT_NO_NETWORKINTERFACE
-QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const
-{
- if (!engine || state != QNetworkSession::Connected || !publicConfig.isValid())
- return QNetworkInterface();
-
- QString iface = engine->getInterfaceFromId(activeConfig.identifier());
- if (iface.isEmpty())
- return QNetworkInterface();
- return QNetworkInterface::interfaceFromName(iface);
-}
-#endif
-
-QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString &key) const
-{
- if (key == QLatin1String("AutoCloseSessionTimeout")) {
- if (engine && engine->requiresPolling() &&
- !(engine->capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces)) {
- return sessionTimeout >= 0 ? sessionTimeout * 10000 : -1;
- }
- }
-
- return QVariant();
-}
-
-void QNetworkSessionPrivateImpl::setSessionProperty(const QString &key, const QVariant &value)
-{
- if (key == QLatin1String("AutoCloseSessionTimeout")) {
- if (engine && engine->requiresPolling() &&
- !(engine->capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces)) {
- int timeout = value.toInt();
- if (timeout >= 0) {
- connect(engine, SIGNAL(updateCompleted()),
- this, SLOT(decrementTimeout()), Qt::UniqueConnection);
- sessionTimeout = timeout / 10000; // convert to poll intervals
- } else {
- disconnect(engine, SIGNAL(updateCompleted()), this, SLOT(decrementTimeout()));
- sessionTimeout = -1;
- }
- }
- }
-}
-
-QString QNetworkSessionPrivateImpl::errorString() const
-{
- switch (lastError) {
- case QNetworkSession::UnknownSessionError:
- return tr("Unknown session error.");
- case QNetworkSession::SessionAbortedError:
- return tr("The session was aborted by the user or system.");
- case QNetworkSession::OperationNotSupportedError:
- return tr("The requested operation is not supported by the system.");
- case QNetworkSession::InvalidConfigurationError:
- return tr("The specified configuration cannot be used.");
- case QNetworkSession::RoamingError:
- return tr("Roaming was aborted or is not possible.");
- default:
- break;
- }
-
- return QString();
-}
-
-QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const
-{
- return lastError;
-}
-
-quint64 QNetworkSessionPrivateImpl::bytesWritten() const
-{
- if (engine && state == QNetworkSession::Connected)
- return engine->bytesWritten(activeConfig.identifier());
- return Q_UINT64_C(0);
-}
-
-quint64 QNetworkSessionPrivateImpl::bytesReceived() const
-{
- if (engine && state == QNetworkSession::Connected)
- return engine->bytesReceived(activeConfig.identifier());
- return Q_UINT64_C(0);
-}
-
-quint64 QNetworkSessionPrivateImpl::activeTime() const
-{
- if (state == QNetworkSession::Connected && startTime != Q_UINT64_C(0))
- return QDateTime::currentSecsSinceEpoch() - startTime;
- return Q_UINT64_C(0);
-}
-
-QNetworkSession::UsagePolicies QNetworkSessionPrivateImpl::usagePolicies() const
-{
- return currentPolicies;
-}
-
-void QNetworkSessionPrivateImpl::setUsagePolicies(QNetworkSession::UsagePolicies newPolicies)
-{
- if (newPolicies != currentPolicies) {
- currentPolicies = newPolicies;
- emit usagePoliciesChanged(currentPolicies);
- }
-}
-
-void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork()
-{
- QNetworkSession::State oldState = state;
-
- const auto configs = serviceConfig.children();
- for (const QNetworkConfiguration &config : configs) {
- if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active)
- continue;
-
- if (activeConfig != config) {
- if (engine) {
- disconnect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)),
- this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)));
- }
-
- activeConfig = config;
- engine = getEngineFromId(activeConfig.identifier());
-
- if (engine) {
- connect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)),
- this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)),
- Qt::QueuedConnection);
- }
- emit newConfigurationActivated();
- }
-
- state = QNetworkSession::Connected;
- if (state != oldState)
- emit stateChanged(state);
-
- return;
- }
-
- if (serviceConfig.children().isEmpty())
- state = QNetworkSession::NotAvailable;
- else
- state = QNetworkSession::Disconnected;
-
- if (state != oldState)
- emit stateChanged(state);
-}
-
-void QNetworkSessionPrivateImpl::updateStateFromActiveConfig()
-{
- if (!engine)
- return;
-
- QNetworkSession::State oldState = state;
- state = engine->sessionStateForId(activeConfig.identifier());
-
- bool oldActive = isOpen;
- isOpen = (state == QNetworkSession::Connected) ? opened : false;
-
- if (!oldActive && isOpen)
- emit quitPendingWaitsForOpened();
- if (oldActive && !isOpen)
- emit closed();
-
- if (oldState != state)
- emit stateChanged(state);
-}
-
-void QNetworkSessionPrivateImpl::networkConfigurationsChanged()
-{
- if (serviceConfig.isValid())
- updateStateFromServiceNetwork();
- else
- updateStateFromActiveConfig();
-
- if (engine)
- startTime = engine->startTime(activeConfig.identifier());
-}
-
-void QNetworkSessionPrivateImpl::configurationChanged(QNetworkConfigurationPrivatePointer config)
-{
- if (serviceConfig.isValid() &&
- (config->id == serviceConfig.identifier() || config->id == activeConfig.identifier())) {
- updateStateFromServiceNetwork();
- } else if (config->id == activeConfig.identifier()) {
- updateStateFromActiveConfig();
- }
-}
-
-void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration &config)
-{
- if (activeConfig == config) {
- opened = false;
- isOpen = false;
-
- emit closed();
-
- lastError = QNetworkSession::SessionAbortedError;
- emit QNetworkSessionPrivate::error(lastError);
- }
-}
-
-void QNetworkSessionPrivateImpl::connectionError(const QString &id, QBearerEngineImpl::ConnectionError error)
-{
- if (activeConfig.identifier() == id) {
- networkConfigurationsChanged();
- switch (error) {
- case QBearerEngineImpl::OperationNotSupported:
- lastError = QNetworkSession::OperationNotSupportedError;
- opened = false;
- break;
- case QBearerEngineImpl::InterfaceLookupError:
- case QBearerEngineImpl::ConnectError:
- case QBearerEngineImpl::DisconnectionError:
- default:
- lastError = QNetworkSession::UnknownSessionError;
- }
-
- emit QNetworkSessionPrivate::error(lastError);
- }
-}
-
-void QNetworkSessionPrivateImpl::decrementTimeout()
-{
- if (--sessionTimeout <= 0) {
- disconnect(engine, SIGNAL(updateCompleted()), this, SLOT(decrementTimeout()));
- sessionTimeout = -1;
- close();
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qnetworksession_impl.moc"
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/bearer/qnetworksession_impl_p.h b/src/network/bearer/qnetworksession_impl_p.h
deleted file mode 100644
index b174760152..0000000000
--- a/src/network/bearer/qnetworksession_impl_p.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKSESSION_IMPL_H
-#define QNETWORKSESSION_IMPL_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qbearerengine_impl_p.h"
-
-#include <QtNetwork/private/qnetworkconfigmanager_p.h>
-#include <QtNetwork/private/qnetworksession_p.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QBearerEngineImpl;
-
-class Q_NETWORK_EXPORT QNetworkSessionPrivateImpl : public QNetworkSessionPrivate
-{
- Q_OBJECT
-
-public:
- QNetworkSessionPrivateImpl()
- : engine(nullptr), startTime(0), lastError(QNetworkSession::UnknownSessionError), sessionTimeout(-1), currentPolicies(QNetworkSession::NoPolicy), opened(false)
- {}
- ~QNetworkSessionPrivateImpl()
- {}
-
- //called by QNetworkSession constructor and ensures
- //that the state is immediately updated (w/o actually opening
- //a session). Also this function should take care of
- //notification hooks to discover future state changes.
- void syncStateWithInterface() override;
-
-#ifndef QT_NO_NETWORKINTERFACE
- QNetworkInterface currentInterface() const override;
-#endif
- QVariant sessionProperty(const QString& key) const override;
- void setSessionProperty(const QString& key, const QVariant& value) override;
-
- void open() override;
- void close() override;
- void stop() override;
- void migrate() override;
- void accept() override;
- void ignore() override;
- void reject() override;
-
- QString errorString() const override; //must return translated string
- QNetworkSession::SessionError error() const override;
-
- quint64 bytesWritten() const override;
- quint64 bytesReceived() const override;
- quint64 activeTime() const override;
-
- QNetworkSession::UsagePolicies usagePolicies() const override;
- void setUsagePolicies(QNetworkSession::UsagePolicies) override;
-
-private Q_SLOTS:
- void networkConfigurationsChanged();
- void configurationChanged(QNetworkConfigurationPrivatePointer config);
- void forcedSessionClose(const QNetworkConfiguration &config);
- void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error);
- void decrementTimeout();
-
-private:
- void updateStateFromServiceNetwork();
- void updateStateFromActiveConfig();
-
-private:
- QBearerEngineImpl *engine;
-
- quint64 startTime;
-
- QNetworkSession::SessionError lastError;
-
- int sessionTimeout;
- QNetworkSession::UsagePolicies currentPolicies;
-
- bool opened;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif // QNETWORKSESSION_IMPL_H
diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h
deleted file mode 100644
index 7c1ff63b68..0000000000
--- a/src/network/bearer/qnetworksession_p.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKSESSIONPRIVATE_H
-#define QNETWORKSESSIONPRIVATE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-#include "qnetworksession.h"
-#include "qnetworkconfiguration_p.h"
-#include "QtCore/qsharedpointer.h"
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject
-{
- Q_OBJECT
-
- friend class QNetworkSession;
-
-public:
- QNetworkSessionPrivate() : QObject(),
- state(QNetworkSession::Invalid), isOpen(false)
- {}
- virtual ~QNetworkSessionPrivate()
- {}
-
- //called by QNetworkSession constructor and ensures
- //that the state is immediately updated (w/o actually opening
- //a session). Also this function should take care of
- //notification hooks to discover future state changes.
- virtual void syncStateWithInterface() = 0;
-
-#ifndef QT_NO_NETWORKINTERFACE
- virtual QNetworkInterface currentInterface() const = 0;
-#endif
- virtual QVariant sessionProperty(const QString &key) const = 0;
- virtual void setSessionProperty(const QString &key, const QVariant &value) = 0;
-
- virtual void open() = 0;
- virtual void close() = 0;
- virtual void stop() = 0;
-
- virtual void setALREnabled(bool /*enabled*/) {}
- virtual void migrate() = 0;
- virtual void accept() = 0;
- virtual void ignore() = 0;
- virtual void reject() = 0;
-
- virtual QString errorString() const = 0; //must return translated string
- virtual QNetworkSession::SessionError error() const = 0;
-
- virtual quint64 bytesWritten() const = 0;
- virtual quint64 bytesReceived() const = 0;
- virtual quint64 activeTime() const = 0;
-
- virtual QNetworkSession::UsagePolicies usagePolicies() const = 0;
- virtual void setUsagePolicies(QNetworkSession::UsagePolicies) = 0;
-
- static void setUsagePolicies(QNetworkSession&, QNetworkSession::UsagePolicies); //for unit testing
-protected:
- inline QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
- {
- return config.d;
- }
-
- inline void setPrivateConfiguration(QNetworkConfiguration &config,
- const QNetworkConfigurationPrivatePointer &ptr) const
- {
- config.d = ptr;
- }
-
-Q_SIGNALS:
- //releases any pending waitForOpened() calls
- void quitPendingWaitsForOpened();
-
- void error(QNetworkSession::SessionError error);
- void stateChanged(QNetworkSession::State state);
- void closed();
- void newConfigurationActivated();
- void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless);
- void usagePoliciesChanged(QNetworkSession::UsagePolicies);
-
-protected:
- QNetworkSession *q;
-
- // The config set on QNetworkSession.
- QNetworkConfiguration publicConfig;
-
- // If publicConfig is a ServiceNetwork this is a copy of publicConfig.
- // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual
- // ServiceNetwork configuration.
- QNetworkConfiguration serviceConfig;
-
- // This is the actual active configuration currently in use by the session.
- // Either a copy of publicConfig or one of serviceConfig.children().
- QNetworkConfiguration activeConfig;
-
- QNetworkSession::State state;
- bool isOpen;
-
- QRecursiveMutex mutex;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif // QNETWORKSESSIONPRIVATE_H
diff --git a/src/network/bearer/qsharednetworksession.cpp b/src/network/bearer/qsharednetworksession.cpp
deleted file mode 100644
index b3e9892f4b..0000000000
--- a/src/network/bearer/qsharednetworksession.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsharednetworksession_p.h"
-#include "qbearerengine_p.h"
-#include <QThreadStorage>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-QThreadStorage<QSharedNetworkSessionManager *> tls;
-
-inline QSharedNetworkSessionManager* sharedNetworkSessionManager()
-{
- QSharedNetworkSessionManager* rv = tls.localData();
- if (!rv) {
- rv = new QSharedNetworkSessionManager;
- tls.setLocalData(rv);
- }
- return rv;
-}
-
-struct DeleteLater {
- void operator()(QObject* obj) const
- {
- obj->deleteLater();
- }
-};
-
-template <typename Container>
-static void maybe_prune_expired(Container &c)
-{
- if (c.size() > 16) {
- for (auto it = c.cbegin(), end = c.cend(); it != end; /*erasing*/) {
- if (!it->second.lock())
- it = c.erase(it);
- else
- ++it;
- }
- }
-}
-
-QSharedPointer<QNetworkSession> QSharedNetworkSessionManager::getSession(const QNetworkConfiguration &config)
-{
- QSharedNetworkSessionManager *m = sharedNetworkSessionManager();
- maybe_prune_expired(m->sessions);
- auto &entry = m->sessions[config];
- //if already have a session, return it
- if (auto p = entry.toStrongRef())
- return p;
- //otherwise make one
- QSharedPointer<QNetworkSession> session(new QNetworkSession(config), DeleteLater{});
- entry = session;
- return session;
-}
-
-void QSharedNetworkSessionManager::setSession(const QNetworkConfiguration &config, QSharedPointer<QNetworkSession> session)
-{
- QSharedNetworkSessionManager *m = sharedNetworkSessionManager();
- m->sessions[config] = std::move(session);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/bearer/qsharednetworksession_p.h b/src/network/bearer/qsharednetworksession_p.h
deleted file mode 100644
index f22f9eeacb..0000000000
--- a/src/network/bearer/qsharednetworksession_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSHAREDNETWORKSESSIONPRIVATE_H
-#define QSHAREDNETWORKSESSIONPRIVATE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-#include "qnetworksession.h"
-#include "qnetworkconfiguration.h"
-#include <QSharedPointer>
-#include <QWeakPointer>
-#include <QMutex>
-
-#include <unordered_map>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-namespace QtPrivate {
-struct NetworkConfigurationHash {
- using result_type = size_t;
- using argument_type = QNetworkConfiguration;
- size_t operator()(const QNetworkConfiguration &config) const noexcept
- {
- return std::hash<size_t>{}(size_t(config.type()) | (size_t(config.bearerType()) << 8) | (size_t(config.purpose()) << 16));
- }
-};
-}
-
-class QSharedNetworkSessionManager
-{
-public:
- static QSharedPointer<QNetworkSession> getSession(const QNetworkConfiguration &config);
- static void setSession(const QNetworkConfiguration &config, QSharedPointer<QNetworkSession> session);
-private:
- std::unordered_map<QNetworkConfiguration, QWeakPointer<QNetworkSession>, QtPrivate::NetworkConfigurationHash> sessions;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif //QSHAREDNETWORKSESSIONPRIVATE_H
-
diff --git a/src/network/configure.cmake b/src/network/configure.cmake
index d9b47045ae..cea673e943 100644
--- a/src/network/configure.cmake
+++ b/src/network/configure.cmake
@@ -366,14 +366,6 @@ qt_feature("networkdiskcache" PUBLIC
CONDITION QT_FEATURE_temporaryfile
)
qt_feature_definition("networkdiskcache" "QT_NO_NETWORKDISKCACHE" NEGATE VALUE "1")
-qt_feature("bearermanagement" PUBLIC
- SECTION "Networking"
- LABEL "Bearer management (deprecated)"
- PURPOSE "Provides bearer management for the network stack."
- CONDITION QT_FEATURE_thread AND QT_FEATURE_library AND QT_FEATURE_networkinterface AND QT_FEATURE_properties
-)
-qt_feature_definition("bearermanagement" "QT_NO_BEARERMANAGEMENT" NEGATE VALUE "1")
-qt_feature_definition("bearermanagement" "QT_NO_BEARERMANAGEMENT" NEGATE)
qt_feature("localserver" PUBLIC
SECTION "Networking"
LABEL "QLocalServer"
diff --git a/src/network/configure.json b/src/network/configure.json
index 84ad6cc4e8..07f0e349f6 100644
--- a/src/network/configure.json
+++ b/src/network/configure.json
@@ -387,17 +387,6 @@
"condition": "features.temporaryfile",
"output": [ "publicFeature", "feature" ]
},
- "bearermanagement": {
- "label": "Bearer management (deprecated)",
- "purpose": "Provides bearer management for the network stack.",
- "section": "Networking",
- "condition": "features.thread && features.library && features.networkinterface && features.properties",
- "output": [
- "publicFeature",
- "feature",
- { "type": "define", "negative": true, "name": "QT_NO_BEARERMANAGEMENT" }
- ]
- },
"localserver": {
"label": "QLocalServer",
"purpose": "Provides a local socket based server.",
diff --git a/src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp b/src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp
index aed74e308e..d3a4cfc116 100644
--- a/src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp
+++ b/src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp
@@ -70,15 +70,6 @@ connect(reply, &QNetworkReply::sslErrors,
this, &MyClass::slotSslErrors);
//! [1]
-//! [2]
-QNetworkConfigurationManager manager;
-networkAccessManager->setConfiguration(manager.defaultConfiguration());
-//! [2]
-
-//! [3]
-networkAccessManager->setConfiguration(QNetworkConfiguration());
-//! [3]
-
//! [4]
networkAccessManager->setNetworkAccessible(QNetworkAccessManager::NotAccessible);
//! [4]
diff --git a/src/network/doc/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp b/src/network/doc/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp
deleted file mode 100644
index 42992f08d9..0000000000
--- a/src/network/doc/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QNetworkConfigurationManager mgr;
-QList<QNetworkConfiguration> activeConfigs = mgr.allConfigurations(QNetworkConfiguration::Active);
-if (activeConfigs.count() > 0)
- Q_ASSERT(mgr.isOnline());
-else
- Q_ASSERT(!mgr.isOnline());
-//! [0]
diff --git a/src/network/doc/snippets/code/src_network_bearer_qnetworksession.cpp b/src/network/doc/snippets/code/src_network_bearer_qnetworksession.cpp
deleted file mode 100644
index b88b6d1768..0000000000
--- a/src/network/doc/snippets/code/src_network_bearer_qnetworksession.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
- session->open();
- if (session->waitForOpened(1000))
- qDebug("Open!");
-//! [0]
-
-//! [1]
- QNetworkConfigurationManager mgr;
- QNetworkConfiguration ap = mgr.defaultConfiguration();
- QNetworkSession *session = new QNetworkSession(ap);
- ... //code activates session
-
- QString ident = session->sessionProperty("ActiveConfiguration").toString();
- if ( ap.type() == QNetworkConfiguration::ServiceNetwork ) {
- Q_ASSERT( ap.identifier() != ident );
- Q_ASSERT( ap.children().contains( mgr.configurationFromIdentifier(ident) ) );
- } else if ( ap.type() == QNetworkConfiguration::InternetAccessPoint ) {
- Q_ASSERT( ap.identifier() == ident );
- }
- \endcode
-//! [1]
diff --git a/src/network/doc/src/bearermanagement.qdoc b/src/network/doc/src/bearermanagement.qdoc
deleted file mode 100644
index 8aec894269..0000000000
--- a/src/network/doc/src/bearermanagement.qdoc
+++ /dev/null
@@ -1,242 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page bearer-management.html
-
-\title Bearer Management
-\brief An API to control the system's connectivity state.
-
-\warning Bearer management is deprecated and will be removed in Qt 6.0.
-
-Bearer Management controls the connectivity state of the system so that
-the user can start or stop interfaces or roam transparently between
-access points.
-
-\tableofcontents
-
-
-\section1 Overview
-
-The Bearer Management API controls the system's connectivity state. This
-incorporates simple information such as whether the device is online and
-how many interfaces there are as well as enables the application developer
-to start, stop network interfaces and influences other connection specific
-details. Depending on the platform's capabilities it may even provide
-session management so that a network interface remains up for as long as
-clients have a registered interest in them while at the same time
-optimizes the interface's uptime.
-
-This API does not provide support for management of network configurations
-themselves. It is up to the platform to provide infrastructure which
-enables to user to create, edit or delete network configurations.
-
-\section2 The API in Detail
-
-Computer systems manage their network interfaces via a set of configurations.
-Each configuration describes a set of parameters which instruct the system
-how a particular network interface is started. One of the most simplistic
-examples might be an Ethernet configuration that links a network card to a
-DHCP server. A more complex example might be a Wireless LAN configuration
-which may comprise of hardware details such as the WLAN card address,
-WLAN access point details (e.g ESSID, encryption details) and user specific
-information (for example username and password). Once the network interface
-was configured and started according to the configuration blue print,
-multiple applications are free to use this link layer connection/session
-for their own socket operations. Note that the QNetworkConfiguration object
-only provides limited information about the configuration details themselves.
-It's main purpose is to act as a configuration identifier through which link
-layer connections can be created, destroyed and monitored.
-
-QNetworkSession provides two types of use cases. It enables the monitoring of
-physical network interfaces and management of network sessions. Network sessions
-are a common feature on mobile devices where multiple applications
-can request network sessions as they see fit. The system consolidates and tracks
-active network sessions for the same network interface by maintaining the link
-layer connections until the last session has been closed. The subsequent table
-lists the major QNetworkSession functions and how they fit into the session and
-hardware management categories:
-
-\table 60%
-\header \li Interface management \li Session management
-\row \li QNetworkSession::stop() \li QNetworkSession::open()
-\row \li QNetworkSession::interface() \li QNetworkSession::close()
-\row \li QNetworkSession::state() \li QNetworkSession::isOpen()
-\row \li QNetworkSession::bytesWritten() \li QNetworkSession::migrate()
-\row \li QNetworkSession::bytesReceived() \li QNetworkSession::ignore()
-\row \li QNetworkSession::activeTime() \li QNetworkSession::accept()
-\row \li QNetworkSession::stateChanged() \li QNetworkSession::reject()
-\row \li \li QNetworkSession::opened()
-\row \li \li QNetworkSession::closed()
-\endtable
-
-The state of the session represents the state of the underlying access point
-whereas the session's openness implies the networking/connectivity state available
-to the current process.
-
-Possible use cases for interface management are network management related
-applications which intend to monitor the connectivity state but do not engage
-in network communication themselves. Any application wanting to open a socket
-to a remote address will typically use session management related functionality.
-
-\section3 Service networks
-
-Some mobile platforms use the concept of grouped access points (also
-called SNAP or Service Network Access Point). In principle multiple
-configurations are grouped together and possibly even prioritized when
-compared to each other. This is useful for use cases where all
-configurations serve a similar purpose or context. A common context could
-be that they provide access to the public Internet or possibly only to the
-office Intranet. By providing a pool of configurations the system can make
-a decision based on given priorities which usually map to factors such as
-speed, availability and cost. Furthermore the system can automatically
-roam from one access point to the next one while ensuring minimal impact on
-the user experience.
-
-The \l{QNetworkConfiguration::Type} flag specifies to what category a
-configuration belongs. The \l{QNetworkConfiguration::InternetAccessPoint}
-type is the most common example. It represents a configuration that can be
-used to create a session. The above mentioned grouping behavior is provided
-by \l {QNetworkConfiguration::ServiceNetwork} configurations. Service
-networks are place holders until such time when the user attempts to
-\l {QNetworkSession::open()}{open()} a new session. At that point in time
-the system determines which of the configurations \l{QNetworkConfiguration::children()}
-is best to use. The selection algorithm is provided by the platform and is usually managed
-by network settings applications. A service network can only have one level of indirection
-which implies children can only be of type \l {QNetworkConfiguration::InternetAccessPoint}.
-
-Most systems allow the user to define the systems default configuration.
-Usually the default behavior is either a service network, a particular
-Internet access point or the user instructs the platform to ask the user
-once an application requests the network. User interaction is generally
-implemented by some sort of system dialog which shows up at the appropriate
-point in time. The application does not have to handle the user input. This
-API provides the \l QNetworkConfigurationManager::defaultConfiguration()
-call which serves a similar purpose. The subsequent code snippet provides
-a quick way how an application can quickly create a new network session
-without (or only minimal) user interaction:
-
-\code
- // Set Internet Access Point
- QNetworkConfigurationManager manager;
- const bool canStartIAP = (manager.capabilities()
- & QNetworkConfigurationManager::CanStartAndStopInterfaces);
- // Is there default access point, use it
- QNetworkConfiguration cfg = manager.defaultConfiguration();
- if (!cfg.isValid() || (!canStartIAP && cfg.state() != QNetworkConfiguration::Active)) {
- QMessageBox::information(this, tr("Network"), tr(
- "No Access Point found."));
- return;
- }
-
- session = new QNetworkSession(cfg, this);
- session->open();
- session->waitForOpened(-1);
-\endcode
-
-To accommodate the "Ask user" use case the default configuration can be of
-type QNetworkConfiguration::UserChoice. A user choice configuration is
-resolved as part of the \l {QNetworkSession::open()} call. Note that a
-\l{QNetworkConfiguration::UserChoice}{UserChoice} configuration is only
-ever returned via \l {QNetworkConfigurationManager::defaultConfiguration()}
-and not \l QNetworkConfigurationManager::allConfigurations().
-
-On systems which do not maintain a list of
-\l {QNetworkConfigurationManager::defaultConfiguration()}{defaultConfiguration()}
-an invalid configuration is returned. A possible workaround could be to
-implement a custom dialog which is populated based on what
-\l QNetworkConfigurationManager::allConfigurations() returns.
-
-\section3 Managing network sessions
-
-A QNetworkSession object separates a \l {QNetworkSession::state()}{state()}
-and an \l{QNetworkSession::isOpen()}{isOpen()} condition.
-
-The state() attribute enables developers to detect whether the system
-currently maintains a global network session for the given
-QNetworkConfiguration. If \l {QNetworkSession::isOpen()}{isOpen()}
-returns \c true the QNetworkSession instance at hand was at least one of the
-entities requesting the global network session. This distinction is
-required to support the notion of session registrations. For as long as
-there are one or more open QNetworkSession instances the underlying
-network interface is not shut down. Therefore the session
-\l{QNetworkSession::state()}{state()} can be used to monitor the state of
-network interfaces.
-
-An open session is created by calling \l {QNetworkSession::open()} and
-closed via \l{QNetworkSession::close()}, respectively. If the session
-is \l{QNetworkSession::Disconnected}{disconnected} at the time of the
-\l{QNetworkSession::open()}{open()} call the underlying interface is started;
-otherwise only the reference counter against the global session is
-incremented. The opposite behavior can be observed when using
-\l{QNetworkSession::close()}{close()}.
-
-In some use cases it may be necessary to turn the interface off despite of
-open sessions. This can be achieved by calling
-\l{QNetworkSession::stop()}{stop()}. An example use case could be a
-network manager type of application allowing the user to control the
-overall state of the devices connectivity.
-
-Global (inter-process) session support is platform dependent and can be
-detected via \l {QNetworkConfigurationManager::SystemSessionSupport}.
-If the system does not support global session calling
-\l{QNetworkSession::close()}{close()} never stops the interface.
-
-\section3 Roaming
-
-Roaming is the process of reconnecting a device from one network to another
-while minimizing the impact on the application. The system notifies the application
-about link layer changes so that the required preparation can be taken.
-The most common reaction would be to reinitialize sockets and to renegotiate
-stateful connections with other parties. In the most extreme cases applications
-may even prevent the roaming altogether.
-
-Roaming is initiated when the system determines that a more appropriate access point
-becomes available to the user. In general such a decision is based on cost, network speed
-or network type (access to certain private networks may only be provided via certain access points).
-Almost all devices providing roaming support have some form of global configuration application
-enabling the user to define such groups of access points (service networks) and priorities.
-
-This API supports two types of roaming. Application level roaming (ALR)
-provides the most control over the process. Applications will be notified about upcoming
-link layer changes and get the opportunity to test the new access point. Eventually they can
-reject or accept the link layer change. The second form of roaming is referred to as Forced Roaming.
-The system simply changes the link layer without consulting the application. It is up to
-the application to detect that some of its internal socket may have become invalid. As a consequence
-it has to reinitialize those sockets and reestablish the previous user session without
-any interruption. Forced roaming has the advantage that applications don't have to
-manage the entire roaming process by themselves.
-
-QNetworkSession is the central class for managing roaming related issues.
-
-\section3 Platform capabilities
-
-Some API features are not available on all platforms. The
-\l QNetworkConfigurationManager::Capability should be used to detect
-platform features at runtime.
-
-*/
diff --git a/src/network/doc/src/network-programming.qdoc b/src/network/doc/src/network-programming.qdoc
index 654227f971..96bbd8d38b 100644
--- a/src/network/doc/src/network-programming.qdoc
+++ b/src/network/doc/src/network-programming.qdoc
@@ -43,9 +43,6 @@
QTcpServer and QUdpSocket that represent low level network concepts,
and high level classes such as QNetworkRequest, QNetworkReply and
QNetworkAccessManager to perform network operations using common protocols.
- It also offers classes such as QNetworkConfiguration,
- QNetworkConfigurationManager and QNetworkSession that implement bearer
- management.
\tableofcontents
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index 93be053ef3..115f3445b9 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -51,7 +51,6 @@
#include <qstringlist.h>
#include <qthread.h>
#include <qurl.h>
-#include <private/qnetworksession_p.h>
#include <algorithm>
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index d7875a0673..cc34d575b2 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -70,7 +70,6 @@
#include <QElapsedTimer>
#include <QCache>
-#include <QNetworkSession>
#include <QSharedPointer>
#include <atomic>
diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h
index c3523f8847..1f0409e8ab 100644
--- a/src/network/kernel/qnetworkproxy.h
+++ b/src/network/kernel/qnetworkproxy.h
@@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE
class QUrl;
-class QNetworkConfiguration;
class QNetworkProxyQueryPrivate;
class Q_NETWORK_EXPORT QNetworkProxyQuery
diff --git a/src/network/network.pro b/src/network/network.pro
index d13b3b9248..7bd54fd12e 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -15,24 +15,12 @@ msvc:equals(QT_ARCH, i386): QMAKE_LFLAGS += /BASE:0x64000000
QMAKE_DOCS = $$PWD/doc/qtnetwork.qdocconf
include(access/access.pri)
-qtConfig(bearermanagement): include(bearer/bearer.pri)
include(kernel/kernel.pri)
include(socket/socket.pri)
include(ssl/ssl.pri)
QMAKE_LIBS += $$QMAKE_LIBS_NETWORK
-qtConfig(bearermanagement) {
- ANDROID_BUNDLED_JAR_DEPENDENCIES = \
- jar/QtAndroidBearer.jar
- ANDROID_LIB_DEPENDENCIES = \
- plugins/bearer/libplugins_bearer_qandroidbearer.so
- MODULE_PLUGIN_TYPES = \
- bearer
- ANDROID_PERMISSIONS += \
- android.permission.ACCESS_NETWORK_STATE
-}
-
MODULE_WINRT_CAPABILITIES = \
internetClient \
internetClientServer \
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 6718d64ca0..8d6516b0b5 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -3,9 +3,6 @@
if(TARGET Qt::Sql)
add_subdirectory(sqldrivers)
endif()
-if(QT_FEATURE_bearermanagement AND TARGET Qt::Network)
- add_subdirectory(bearer)
-endif()
if(TARGET Qt::Gui)
add_subdirectory(platforms)
add_subdirectory(platforminputcontexts)
diff --git a/src/plugins/bearer/.prev_CMakeLists.txt b/src/plugins/bearer/.prev_CMakeLists.txt
deleted file mode 100644
index a7a36f60c6..0000000000
--- a/src/plugins/bearer/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# Generated from bearer.pro.
-
-if(SUBDIRS_ISEMPTY OR (TARGET Qt::DBus AND linux_x_ AND NOT ANDROID))
- add_subdirectory(generic)
-endif()
-if(TARGET Qt::DBus AND linux_x_ AND NOT ANDROID)
- add_subdirectory(connman)
- add_subdirectory(networkmanager)
-endif()
-if(ANDROID AND NOT ANDROID_EMBEDDED)
- add_subdirectory(android)
-endif()
diff --git a/src/plugins/bearer/CMakeLists.txt b/src/plugins/bearer/CMakeLists.txt
deleted file mode 100644
index 528061d264..0000000000
--- a/src/plugins/bearer/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from bearer.pro.
-
-# special case begin
-# The whole block is manual.
-if(NOT ANDROID AND LINUX AND TARGET Qt::DBus)
- add_subdirectory(generic)
- add_subdirectory(connman)
- add_subdirectory(networkmanager)
-elseif(ANDROID AND NOT ANDROID_EMBEDDED)
- add_subdirectory(android)
-else()
- add_subdirectory(generic)
-endif()
-# special case end
diff --git a/src/plugins/bearer/android/CMakeLists.txt b/src/plugins/bearer/android/CMakeLists.txt
deleted file mode 100644
index 193cbf1fe3..0000000000
--- a/src/plugins/bearer/android/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from android.pro.
-
-add_subdirectory(src)
-add_subdirectory(jar)
diff --git a/src/plugins/bearer/android/android.pro b/src/plugins/bearer/android/android.pro
deleted file mode 100644
index 6a51abf5d7..0000000000
--- a/src/plugins/bearer/android/android.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += src \
- jar
diff --git a/src/plugins/bearer/android/jar/.prev_CMakeLists.txt b/src/plugins/bearer/android/jar/.prev_CMakeLists.txt
deleted file mode 100644
index f5f25c4f8b..0000000000
--- a/src/plugins/bearer/android/jar/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from jar.pro.
-
-set(java_sources
- src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
-)
-
-add_jar(QtAndroidBearer
- INCLUDE_JARS ${QT_ANDROID_JAR}
- SOURCES ${java_sources}
-)
-
-install_jar(QtAndroidBearer
- DESTINATION jar
- COMPONENT Devel
-)
-
diff --git a/src/plugins/bearer/android/jar/CMakeLists.txt b/src/plugins/bearer/android/jar/CMakeLists.txt
deleted file mode 100644
index 16641d42b7..0000000000
--- a/src/plugins/bearer/android/jar/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-#####################################################################
-## QtAndroidBearer Binary:
-#####################################################################
-
-set(java_sources
- src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
-)
-
-add_jar(QtAndroidBearer
- INCLUDE_JARS ${QT_ANDROID_JAR}
- SOURCES ${java_sources}
- )
-
-install_jar(QtAndroidBearer
- DESTINATION jar
- COMPONENT Devel)
-
-#### Keys ignored in scope 1:.:.:jar.pro:<TRUE>:
-# JAVACLASSPATH = "$$PWD/src"
-# JAVASOURCES = "$$PWD/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java"
-# _LOADED = "qt_build_paths"
-
diff --git a/src/plugins/bearer/android/jar/jar.pro b/src/plugins/bearer/android/jar/jar.pro
deleted file mode 100644
index 8277a8abc1..0000000000
--- a/src/plugins/bearer/android/jar/jar.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-CONFIG += single_arch
-
-TARGET = QtAndroidBearer
-
-load(qt_build_paths)
-CONFIG += java
-DESTDIR = $$MODULE_BASE_OUTDIR/jar
-
-JAVACLASSPATH += $$PWD/src
-
-JAVASOURCES += $$PWD/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
-
-# install
-target.path = $$[QT_INSTALL_PREFIX]/jar
-INSTALLS += target
diff --git a/src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java b/src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
deleted file mode 100644
index 805c90548b..0000000000
--- a/src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-package org.qtproject.qt5.android.bearer;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.util.Log;
-import android.net.ConnectivityManager;
-
-public class QtNetworkReceiver
-{
- private static final String LOG_TAG = "QtNetworkReceiver";
- private static native void activeNetworkInfoChanged();
- private static BroadcastReceiverPrivate m_broadcastReceiver = null;
- private static final Object m_lock = new Object();
-
- private static class BroadcastReceiverPrivate extends BroadcastReceiver
- {
- @Override
- public void onReceive(Context context, Intent intent)
- {
- activeNetworkInfoChanged();
- }
- }
-
- private QtNetworkReceiver() {}
-
- public static void registerReceiver(final Context context)
- {
- synchronized (m_lock) {
- if (m_broadcastReceiver == null) {
- m_broadcastReceiver = new BroadcastReceiverPrivate();
- IntentFilter intentFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
- context.registerReceiver(m_broadcastReceiver, intentFilter);
- }
- }
- }
-
- public static void unregisterReceiver(final Context context)
- {
- synchronized (m_lock) {
- if (m_broadcastReceiver == null)
- return;
-
- context.unregisterReceiver(m_broadcastReceiver);
- }
- }
-
- public static ConnectivityManager getConnectivityManager(final Context context)
- {
- return (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
- }
-}
diff --git a/src/plugins/bearer/android/src/CMakeLists.txt b/src/plugins/bearer/android/src/CMakeLists.txt
deleted file mode 100644
index 5be89e316b..0000000000
--- a/src/plugins/bearer/android/src/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated from src.pro.
-
-#####################################################################
-## QAndroidBearerEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QAndroidBearerEnginePlugin
- OUTPUT_NAME qandroidbearer
- TYPE bearer
- SOURCES
- main.cpp
- qandroidbearerengine.cpp qandroidbearerengine.h
- wrappers/androidconnectivitymanager.cpp wrappers/androidconnectivitymanager.h
- INCLUDE_DIRECTORIES
- wrappers
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::NetworkPrivate
-)
diff --git a/src/plugins/bearer/android/src/android.json b/src/plugins/bearer/android/src/android.json
deleted file mode 100644
index 6843bd3301..0000000000
--- a/src/plugins/bearer/android/src/android.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "android" ]
-}
diff --git a/src/plugins/bearer/android/src/main.cpp b/src/plugins/bearer/android/src/main.cpp
deleted file mode 100644
index f3a5074e5d..0000000000
--- a/src/plugins/bearer/android/src/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidbearerengine.h"
-#include <QtNetwork/private/qbearerplugin_p.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidBearerEnginePlugin : public QBearerEnginePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "android.json")
-
-public:
- QBearerEngine *create(const QString &key) const override
- {
- return (key == QLatin1String("android")) ? new QAndroidBearerEngine() : 0;
- }
-};
-
-QT_END_NAMESPACE
-
-#include "main.moc"
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/android/src/qandroidbearerengine.cpp b/src/plugins/bearer/android/src/qandroidbearerengine.cpp
deleted file mode 100644
index ad9895e0cf..0000000000
--- a/src/plugins/bearer/android/src/qandroidbearerengine.cpp
+++ /dev/null
@@ -1,391 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidbearerengine.h"
-#include <private/qnetworksession_impl_p.h>
-#include "wrappers/androidconnectivitymanager.h"
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-static QString networkConfType(const AndroidNetworkInfo &networkInfo)
-{
- switch (networkInfo.getType()) {
- case AndroidNetworkInfo::Mobile:
- return QStringLiteral("Mobile");
- case AndroidNetworkInfo::Wifi:
- return QStringLiteral("WiFi");
- case AndroidNetworkInfo::Wimax:
- return QStringLiteral("WiMax");
- case AndroidNetworkInfo::Ethernet:
- return QStringLiteral("Ethernet");
- case AndroidNetworkInfo::Bluetooth:
- return QStringLiteral("Bluetooth");
- default:
- break;
- }
-
- return QString();
-}
-
-static inline bool isMobile(QNetworkConfiguration::BearerType type)
-{
- if (type == QNetworkConfiguration::BearerWLAN
- || type == QNetworkConfiguration::BearerWiMAX
- || type == QNetworkConfiguration::BearerBluetooth
- || type == QNetworkConfiguration::BearerEthernet
- || type == QNetworkConfiguration::BearerUnknown) {
- return false;
- }
-
- return true;
-}
-
-static QNetworkConfiguration::BearerType getBearerType(const AndroidNetworkInfo &networkInfo)
-{
- switch (networkInfo.getType()) {
- case AndroidNetworkInfo::Mobile:
- {
- switch (networkInfo.getSubtype()) {
- case AndroidNetworkInfo::Gprs:
- case AndroidNetworkInfo::Edge:
- case AndroidNetworkInfo::Iden: // 2G
- return QNetworkConfiguration::Bearer2G;
- case AndroidNetworkInfo::Umts: // BearerWCDMA (3 .5 .75 G)
- case AndroidNetworkInfo::Hsdpa: // 3G (?) UMTS
- case AndroidNetworkInfo::Hsupa: // 3G (?) UMTS
- return QNetworkConfiguration::BearerWCDMA;
- case AndroidNetworkInfo::Cdma: // CDMA ISA95[AB]
- case AndroidNetworkInfo::Cdma1xRTT: // BearerCDMA2000 (3G)
- case AndroidNetworkInfo::Ehrpd: // CDMA Bridge thing?!?
- return QNetworkConfiguration::BearerCDMA2000;
- case AndroidNetworkInfo::Evdo0: // BearerEVDO
- case AndroidNetworkInfo::EvdoA: // BearerEVDO
- case AndroidNetworkInfo::EvdoB: // BearerEVDO
- return QNetworkConfiguration::BearerEVDO;
- case AndroidNetworkInfo::Hspa:
- case AndroidNetworkInfo::Hspap: // HSPA+
- return QNetworkConfiguration::BearerHSPA;
- case AndroidNetworkInfo::Lte: // BearerLTE (4G)
- return QNetworkConfiguration::BearerLTE;
- default:
- break;
- }
- }
- case AndroidNetworkInfo::Wifi:
- return QNetworkConfiguration::BearerWLAN;
- case AndroidNetworkInfo::Wimax:
- return QNetworkConfiguration::BearerWiMAX;
- case AndroidNetworkInfo::Bluetooth:
- case AndroidNetworkInfo::MobileDun:
- return QNetworkConfiguration::BearerBluetooth;
- case AndroidNetworkInfo::Ethernet:
- return QNetworkConfiguration::BearerEthernet;
- case AndroidNetworkInfo::MobileMms:
- case AndroidNetworkInfo::MobileSupl:
- case AndroidNetworkInfo::MobileHipri:
- case AndroidNetworkInfo::Dummy:
- case AndroidNetworkInfo::UnknownType:
- break;
- }
-
- return QNetworkConfiguration::BearerUnknown;
-}
-
-QAndroidBearerEngine::QAndroidBearerEngine(QObject *parent)
- : QBearerEngineImpl(parent),
- m_connectivityManager(0)
-{
-}
-
-QAndroidBearerEngine::~QAndroidBearerEngine()
-{
-}
-
-QString QAndroidBearerEngine::getInterfaceFromId(const QString &id)
-{
- const QMutexLocker locker(&mutex);
- return m_configurationInterface.value(id);
-}
-
-bool QAndroidBearerEngine::hasIdentifier(const QString &id)
-{
- const QMutexLocker locker(&mutex);
- return m_configurationInterface.contains(id);
-}
-
-void QAndroidBearerEngine::connectToId(const QString &id)
-{
- Q_EMIT connectionError(id, OperationNotSupported);
-}
-
-void QAndroidBearerEngine::disconnectFromId(const QString &id)
-{
- Q_EMIT connectionError(id, OperationNotSupported);
-}
-
-QNetworkSession::State QAndroidBearerEngine::sessionStateForId(const QString &id)
-{
- const QMutexLocker locker(&mutex);
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- if ((!ptr || !ptr->isValid) || m_connectivityManager == 0)
- return QNetworkSession::Invalid;
-
- const QMutexLocker configLocker(&ptr->mutex);
- // Don't re-order...
- if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- return QNetworkSession::Connected;
- } else if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) {
- return QNetworkSession::Disconnected;
- } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
- return QNetworkSession::NotAvailable;
- } else if ((ptr->state & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) {
- return QNetworkSession::NotAvailable;
- }
-
- return QNetworkSession::Invalid;
-}
-
-QNetworkConfigurationManager::Capabilities QAndroidBearerEngine::capabilities() const
-{
-
- return AndroidTrafficStats::isTrafficStatsSupported()
- ? QNetworkConfigurationManager::ForcedRoaming
- | QNetworkConfigurationManager::DataStatistics
- : QNetworkConfigurationManager::ForcedRoaming;
-
-}
-
-QNetworkSessionPrivate *QAndroidBearerEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl();
-}
-
-QNetworkConfigurationPrivatePointer QAndroidBearerEngine::defaultConfiguration()
-{
- return QNetworkConfigurationPrivatePointer();
-}
-
-bool QAndroidBearerEngine::requiresPolling() const
-{
- return false;
-}
-
-quint64 QAndroidBearerEngine::bytesWritten(const QString &id)
-{
- QMutexLocker lock(&mutex);
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- if (!ptr || !ptr->isValid)
- return 0;
-
- return isMobile(ptr->bearerType)
- ? AndroidTrafficStats::getMobileTxBytes()
- : AndroidTrafficStats::getTotalTxBytes() - AndroidTrafficStats::getMobileTxBytes();
-}
-
-quint64 QAndroidBearerEngine::bytesReceived(const QString &id)
-{
- QMutexLocker lock(&mutex);
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- if (!ptr || !ptr->isValid)
- return 0;
-
- return isMobile(ptr->bearerType)
- ? AndroidTrafficStats::getMobileRxBytes()
- : AndroidTrafficStats::getTotalRxBytes() - AndroidTrafficStats::getMobileRxBytes();
-}
-
-quint64 QAndroidBearerEngine::startTime(const QString &id)
-{
- Q_UNUSED(id);
- return Q_UINT64_C(0);
-}
-
-void QAndroidBearerEngine::initialize()
-{
- if (m_connectivityManager != 0)
- return;
-
- m_connectivityManager = AndroidConnectivityManager::getInstance();
- if (m_connectivityManager == 0)
- return;
-
- updateConfigurations();
-
- connect(m_connectivityManager, &AndroidConnectivityManager::activeNetworkChanged,
- this, &QAndroidBearerEngine::updateConfigurations);
-
-}
-
-void QAndroidBearerEngine::requestUpdate()
-{
- updateConfigurations();
-}
-
-void QAndroidBearerEngine::updateConfigurations()
-{
-#ifndef QT_NO_NETWORKINTERFACE
- if (m_connectivityManager == 0)
- return;
-
- {
- QMutexLocker locker(&mutex);
- QStringList oldKeys = accessPointConfigurations.keys();
-
- QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
- if (interfaces.isEmpty())
- interfaces = QNetworkInterface::allInterfaces();
-
- // Create a configuration for each of the main types (WiFi, Mobile, Bluetooth, WiMax, Ethernet)
- const auto netInfos = m_connectivityManager->getAllNetworkInfo();
- for (const AndroidNetworkInfo &netInfo : netInfos) {
-
- if (!netInfo.isValid())
- continue;
-
- const QString name = networkConfType(netInfo);
- if (name.isEmpty())
- continue;
-
- QNetworkConfiguration::BearerType bearerType = getBearerType(netInfo);
-
- QString interfaceName;
- QNetworkConfiguration::StateFlag state = QNetworkConfiguration::Defined;
- if (netInfo.isAvailable()) {
- if (netInfo.isConnected()) {
- // Attempt to map an interface to this configuration
- while (!interfaces.isEmpty()) {
- QNetworkInterface interface = interfaces.takeFirst();
- // ignore loopback interface
- if (!interface.isValid())
- continue;
-
- if (interface.flags() & QNetworkInterface::IsLoopBack)
- continue;
- // There is no way to get the interface from the NetworkInfo, so
- // look for an active interface...
- if (interface.flags() & QNetworkInterface::IsRunning
- && !interface.addressEntries().isEmpty()) {
- state = QNetworkConfiguration::Active;
- interfaceName = interface.name();
- break;
- }
- }
- }
- }
-
- const QString key = QString(QLatin1String("android:%1:%2")).arg(name).arg(interfaceName);
- const QString id = QString::number(qHash(key));
- m_configurationInterface[id] = interfaceName;
-
- oldKeys.removeAll(id);
- if (accessPointConfigurations.contains(id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- bool changed = false;
- {
- const QMutexLocker confLocker(&ptr->mutex);
-
- if (!ptr->isValid) {
- ptr->isValid = true;
- changed = true;
- }
-
- // Don't reset the bearer type to 'Unknown'
- if (ptr->bearerType != QNetworkConfiguration::BearerUnknown
- && ptr->bearerType != bearerType) {
- ptr->bearerType = bearerType;
- changed = true;
- }
-
- if (ptr->name != name) {
- ptr->name = name;
- changed = true;
- }
-
- if (ptr->id != id) {
- ptr->id = id;
- changed = true;
- }
-
- if (ptr->state != state) {
- ptr->state = state;
- changed = true;
- }
- } // Unlock configuration
-
- if (changed) {
- locker.unlock();
- Q_EMIT configurationChanged(ptr);
- locker.relock();
- }
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
- ptr->name = name;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearerType = bearerType;
- accessPointConfigurations.insert(id, ptr);
- locker.unlock();
- Q_EMIT configurationAdded(ptr);
- locker.relock();
- }
- }
-
- while (!oldKeys.isEmpty()) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldKeys.takeFirst());
- m_configurationInterface.remove(ptr->id);
- locker.unlock();
- Q_EMIT configurationRemoved(ptr);
- locker.relock();
- }
-
- } // Unlock engine
-
-#endif // QT_NO_NETWORKINTERFACE
-
- Q_EMIT updateCompleted();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/android/src/qandroidbearerengine.h b/src/plugins/bearer/android/src/qandroidbearerengine.h
deleted file mode 100644
index 867d04d886..0000000000
--- a/src/plugins/bearer/android/src/qandroidbearerengine.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDBEARERENGINE_H
-#define QANDROIDBEARERENGINE_H
-
-#include <private/qbearerengine_impl_p.h>
-
-#include <QAbstractEventDispatcher>
-#include <QAbstractNativeEventFilter>
-#include <QtCore/private/qjni_p.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfigurationPrivate;
-class QNetworkSessionPrivate;
-class AndroidConnectivityManager;
-
-class QAndroidBearerEngine : public QBearerEngineImpl
-{
- Q_OBJECT
-
-public:
- explicit QAndroidBearerEngine(QObject *parent = 0);
- ~QAndroidBearerEngine() override;
-
- QString getInterfaceFromId(const QString &id) override;
- bool hasIdentifier(const QString &id) override;
- void connectToId(const QString &id) override;
- void disconnectFromId(const QString &id) override;
- QNetworkSession::State sessionStateForId(const QString &id) override;
- QNetworkConfigurationManager::Capabilities capabilities() const override;
- QNetworkSessionPrivate *createSessionBackend() override;
- QNetworkConfigurationPrivatePointer defaultConfiguration() override;
- bool requiresPolling() const override;
- quint64 bytesWritten(const QString &id) override;
- quint64 bytesReceived(const QString &id) override;
- quint64 startTime(const QString &id) override;
-
- Q_INVOKABLE void initialize();
- Q_INVOKABLE void requestUpdate();
-
-private Q_SLOTS:
- void updateConfigurations();
-
-private:
- QJNIObjectPrivate m_networkReceiver;
- AndroidConnectivityManager *m_connectivityManager;
- QMap<QString, QString> m_configurationInterface;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif // QANDROIDBEARERENGINE_H
diff --git a/src/plugins/bearer/android/src/src.pro b/src/plugins/bearer/android/src/src.pro
deleted file mode 100644
index fcd599dffe..0000000000
--- a/src/plugins/bearer/android/src/src.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qandroidbearer
-
-QT = core-private network-private
-
-HEADERS += qandroidbearerengine.h
-
-SOURCES += main.cpp \
- qandroidbearerengine.cpp
-
-include(wrappers/wrappers.pri)
-
-PLUGIN_TYPE = bearer
-PLUGIN_CLASS_NAME = QAndroidBearerEnginePlugin
-load(qt_plugin)
diff --git a/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp b/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp
deleted file mode 100644
index 6787690246..0000000000
--- a/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp
+++ /dev/null
@@ -1,387 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidconnectivitymanager.h"
-#include <QtCore/private/qjni_p.h>
-#include <QtCore/private/qjnihelpers_p.h>
-
-QT_BEGIN_NAMESPACE
-
-static inline bool exceptionCheckAndClear(JNIEnv *env)
-{
- if (!env->ExceptionCheck())
- return false;
-
-#ifdef QT_DEBUG
- env->ExceptionDescribe();
-#endif // QT_DEBUG
- env->ExceptionClear();
-
- return true;
-}
-
-struct AndroidConnectivityManagerInstance
-{
- AndroidConnectivityManagerInstance()
- : connManager(new AndroidConnectivityManager)
- { }
- ~AndroidConnectivityManagerInstance()
- {
- delete connManager;
- }
-
- AndroidConnectivityManager* connManager;
-};
-
-Q_GLOBAL_STATIC(AndroidConnectivityManagerInstance, androidConnManagerInstance)
-
-static const char networkReceiverClass[] = "org/qtproject/qt5/android/bearer/QtNetworkReceiver";
-static const char trafficStatsClass[] = "android/net/TrafficStats";
-
-/**
- * Returns the number of bytes transmitted over the mobile network since last device boot.
- */
-qint64 AndroidTrafficStats::getMobileTxBytes()
-{
- return QJNIObjectPrivate::callStaticMethod<jlong>(trafficStatsClass,
- "getMobileTxBytes",
- "()J");
-}
-
-/**
- * Returns the number of bytes received over the mobile network since last device boot.
- */
-qint64 AndroidTrafficStats::getMobileRxBytes()
-{
- return QJNIObjectPrivate::callStaticMethod<jlong>(trafficStatsClass,
- "getMobileRxBytes",
- "()J");
-}
-
-/**
- * Returns the total transmitted bytes since last device boot.
- */
-qint64 AndroidTrafficStats::getTotalTxBytes()
-{
- return QJNIObjectPrivate::callStaticMethod<jlong>(trafficStatsClass,
- "getTotalTxBytes",
- "()J");
-}
-
-/**
- * Returns the total received bytes since last device boot.
- */
-qint64 AndroidTrafficStats::getTotalRxBytes()
-{
- return QJNIObjectPrivate::callStaticMethod<jlong>(trafficStatsClass,
- "getTotalRxBytes",
- "()J");
-}
-
-bool AndroidTrafficStats::isTrafficStatsSupported()
-{
- // Before API level 18 DataStatistics might not be supported, so make sure that we get something
- // else then -1 from from getXXBytes().
- return (AndroidTrafficStats::getMobileRxBytes() != -1
- && AndroidTrafficStats::getTotalRxBytes() != -1);
-}
-
-static AndroidNetworkInfo::NetworkState stateForName(const QString &stateName)
-{
- if (stateName == QLatin1String("CONNECTED"))
- return AndroidNetworkInfo::Connected;
- else if (stateName == QLatin1String("CONNECTING"))
- return AndroidNetworkInfo::Connecting;
- else if (stateName == QLatin1String("DISCONNECTED"))
- return AndroidNetworkInfo::Disconnected;
- else if (stateName == QLatin1String("DISCONNECTING"))
- return AndroidNetworkInfo::Disconnecting;
- else if (stateName == QLatin1String("SUSPENDED"))
- return AndroidNetworkInfo::Suspended;
-
- return AndroidNetworkInfo::UnknownState;
-}
-
-AndroidNetworkInfo::NetworkState AndroidNetworkInfo::getDetailedState() const
-{
- QJNIObjectPrivate enumObject = m_networkInfo.callObjectMethod("getDetailedState",
- "()Landroid/net/NetworkInfo$DetailedState;");
- if (!enumObject.isValid())
- return UnknownState;
-
- QJNIObjectPrivate enumName = enumObject.callObjectMethod<jstring>("name");
- if (!enumName.isValid())
- return UnknownState;
-
- return stateForName(enumName.toString());
-}
-
-QString AndroidNetworkInfo::getExtraInfo() const
-{
- QJNIObjectPrivate extraInfo = m_networkInfo.callObjectMethod<jstring>("getExtraInfo");
- if (!extraInfo.isValid())
- return QString();
-
- return extraInfo.toString();
-}
-
-QString AndroidNetworkInfo::getReason() const
-{
- QJNIObjectPrivate reason = m_networkInfo.callObjectMethod<jstring>("getReason");
- if (!reason.isValid())
- return QString();
-
- return reason.toString();
-}
-
-AndroidNetworkInfo::NetworkState AndroidNetworkInfo::getState() const
-{
- QJNIObjectPrivate enumObject = m_networkInfo.callObjectMethod("getState",
- "()Landroid/net/NetworkInfo$State;");
- if (!enumObject.isValid())
- return UnknownState;
-
- QJNIObjectPrivate enumName = enumObject.callObjectMethod<jstring>("name");
- if (!enumName.isValid())
- return UnknownState;
-
- return stateForName(enumName.toString());
-}
-
-AndroidNetworkInfo::NetworkSubType AndroidNetworkInfo::getSubtype() const
-{
- return AndroidNetworkInfo::NetworkSubType(m_networkInfo.callMethod<jint>("getSubtype"));
-}
-
-QString AndroidNetworkInfo::getSubtypeName() const
-{
- QJNIObjectPrivate subtypeName = m_networkInfo.callObjectMethod<jstring>("getSubtypeName");
- if (!subtypeName.isValid())
- return QString();
-
- return subtypeName.toString();
-}
-
-AndroidNetworkInfo::NetworkType AndroidNetworkInfo::getType() const
-{
- return AndroidNetworkInfo::NetworkType(m_networkInfo.callMethod<jint>("getType"));
-}
-
-QString AndroidNetworkInfo::getTypeName() const
-{
- QJNIObjectPrivate typeName = m_networkInfo.callObjectMethod<jstring>("getTypeName");
- if (!typeName.isValid())
- return QString();
-
- return typeName.toString();
-}
-
-bool AndroidNetworkInfo::isAvailable() const
-{
- return m_networkInfo.callMethod<jboolean>("isAvailable");
-}
-
-bool AndroidNetworkInfo::isConnected() const
-{
- return m_networkInfo.callMethod<jboolean>("isConnected");
-}
-
-bool AndroidNetworkInfo::isConnectedOrConnecting() const
-{
- return m_networkInfo.callMethod<jboolean>("isConnectedOrConnecting");
-}
-
-bool AndroidNetworkInfo::isFailover() const
-{
- return m_networkInfo.callMethod<jboolean>("isFailover");
-}
-
-bool AndroidNetworkInfo::isRoaming() const
-{
- return m_networkInfo.callMethod<jboolean>("isRoaming");
-}
-
-bool AndroidNetworkInfo::isValid() const
-{
- return m_networkInfo.isValid();
-}
-
-AndroidConnectivityManager::AndroidConnectivityManager()
-{
- QJNIEnvironmentPrivate env;
- if (!registerNatives(env))
- return;
-
- m_connectivityManager = QJNIObjectPrivate::callStaticObjectMethod(networkReceiverClass,
- "getConnectivityManager",
- "(Landroid/content/Context;)Landroid/net/ConnectivityManager;",
- QtAndroidPrivate::context());
- if (!m_connectivityManager.isValid())
- return;
-
- QJNIObjectPrivate::callStaticMethod<void>(networkReceiverClass,
- "registerReceiver",
- "(Landroid/content/Context;)V",
- QtAndroidPrivate::context());
-}
-
-AndroidConnectivityManager *AndroidConnectivityManager::getInstance()
-{
- return androidConnManagerInstance->connManager->isValid()
- ? androidConnManagerInstance->connManager
- : 0;
-}
-
-AndroidConnectivityManager::~AndroidConnectivityManager()
-{
- QJNIObjectPrivate::callStaticMethod<void>(networkReceiverClass,
- "unregisterReceiver",
- "(Landroid/content/Context;)V",
- QtAndroidPrivate::context());
-}
-
-AndroidNetworkInfo AndroidConnectivityManager::getActiveNetworkInfo() const
-{
- QJNIObjectPrivate networkInfo = m_connectivityManager.callObjectMethod("getActiveNetworkInfo",
- "()Landroid/net/NetworkInfo;");
- return networkInfo;
-}
-
-QList<AndroidNetworkInfo> AndroidConnectivityManager::getAllNetworkInfo() const
-{
- QJNIEnvironmentPrivate env;
- QJNIObjectPrivate objArray = m_connectivityManager.callObjectMethod("getAllNetworkInfo",
- "()[Landroid/net/NetworkInfo;");
- QList<AndroidNetworkInfo> list;
- if (!objArray.isValid())
- return list;
-
- const jsize length = env->GetArrayLength(static_cast<jarray>(objArray.object()));
- if (exceptionCheckAndClear(env))
- return list;
-
- for (int i = 0; i != length; ++i) {
- jobject lref = env->GetObjectArrayElement(static_cast<jobjectArray>(objArray.object()), i);
- if (exceptionCheckAndClear(env))
- break;
-
- list << AndroidNetworkInfo(QJNIObjectPrivate::fromLocalRef(lref));
- }
-
- return list;
-}
-
-bool AndroidConnectivityManager::getBackgroundDataSetting() const
-{
- return m_connectivityManager.callMethod<jboolean>("getBackgroundDataSetting");
-}
-
-AndroidNetworkInfo AndroidConnectivityManager::getNetworkInfo(int networkType) const
-{
- QJNIObjectPrivate networkInfo = m_connectivityManager.callObjectMethod("getNetworkInfo",
- "(I)Landroid/net/NetworkInfo;",
- networkType);
- return networkInfo;
-}
-
-int AndroidConnectivityManager::getNetworkPreference() const
-{
- return m_connectivityManager.callMethod<jint>("getNetworkPreference");
-}
-
-bool AndroidConnectivityManager::isActiveNetworkMetered() const
-{
- return m_connectivityManager.callMethod<jboolean>("isActiveNetworkMetered");
-}
-
-bool AndroidConnectivityManager::isNetworkTypeValid(int networkType)
-{
- return QJNIObjectPrivate::callStaticMethod<jboolean>("android/net/ConnectivityManager",
- "isNetworkTypeValid",
- "(I)Z",
- networkType);
-}
-
-bool AndroidConnectivityManager::requestRouteToHost(int networkType, int hostAddress)
-{
- return m_connectivityManager.callMethod<jboolean>("requestRouteToHost", "(II)Z", networkType, hostAddress);
-}
-
-void AndroidConnectivityManager::setNetworkPreference(int preference)
-{
- m_connectivityManager.callMethod<void>("setNetworkPreference", "(I)V", preference);
-}
-
-int AndroidConnectivityManager::startUsingNetworkFeature(int networkType, const QString &feature)
-{
- QJNIObjectPrivate jfeature = QJNIObjectPrivate::fromString(feature);
- return m_connectivityManager.callMethod<jint>("startUsingNetworkFeature",
- "(ILjava/lang/String;)I",
- networkType,
- jfeature.object());
-}
-
-int AndroidConnectivityManager::stopUsingNetworkFeature(int networkType, const QString &feature)
-{
- QJNIObjectPrivate jfeature = QJNIObjectPrivate::fromString(feature);
- return m_connectivityManager.callMethod<jint>("stopUsingNetworkFeature",
- "(ILjava/lang/String;)I",
- networkType,
- jfeature.object());
-}
-
-static void activeNetworkInfoChanged()
-{
- Q_EMIT androidConnManagerInstance->connManager->activeNetworkChanged();
-}
-
-bool AndroidConnectivityManager::registerNatives(JNIEnv *env)
-{
- QJNIObjectPrivate networkReceiver(networkReceiverClass);
- if (!networkReceiver.isValid())
- return false;
-
- jclass clazz = env->GetObjectClass(networkReceiver.object());
- static JNINativeMethod method = {"activeNetworkInfoChanged", "()V", reinterpret_cast<void *>(activeNetworkInfoChanged)};
- const bool ret = (env->RegisterNatives(clazz, &method, 1) == JNI_OK);
- env->DeleteLocalRef(clazz);
- return ret;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.h b/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.h
deleted file mode 100644
index 7c410b0087..0000000000
--- a/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDCONNECTIVITYMANAGER_H
-#define ANDROIDCONNECTIVITYMANAGER_H
-
-#include <QObject>
-#include <QtCore/private/qjni_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class AndroidTrafficStats
-{
-public:
- static qint64 getMobileTxBytes();
- static qint64 getMobileRxBytes();
- static qint64 getTotalTxBytes();
- static qint64 getTotalRxBytes();
- static bool isTrafficStatsSupported();
-};
-
-class AndroidNetworkInfo
-{
-public:
- // Needs to be in sync with the values from the android api.
- enum NetworkState {
- UnknownState,
- Authenticating,
- Blocked,
- CaptivePortalCheck,
- Connected,
- Connecting,
- Disconnected,
- Disconnecting,
- Failed,
- Idle,
- ObtainingIpAddr,
- Scanning,
- Suspended,
- VerifyingPoorLink
- };
-
- enum NetworkType {
- Mobile,
- Wifi,
- MobileMms,
- MobileSupl,
- MobileDun,
- MobileHipri,
- Wimax,
- Bluetooth,
- Dummy,
- Ethernet,
- UnknownType
- };
-
- enum NetworkSubType {
- UnknownSubType,
- Gprs,
- Edge,
- Umts,
- Cdma,
- Evdo0,
- EvdoA,
- Cdma1xRTT,
- Hsdpa,
- Hsupa,
- Hspa,
- Iden,
- EvdoB,
- Lte,
- Ehrpd,
- Hspap
- };
-
- inline AndroidNetworkInfo(const QJNIObjectPrivate &obj) : m_networkInfo(obj)
- { }
-
- NetworkState getDetailedState() const;
- QString getExtraInfo() const;
- QString getReason() const;
- NetworkState getState() const;
- NetworkSubType getSubtype() const;
- QString getSubtypeName() const;
- NetworkType getType() const;
- QString getTypeName() const;
- bool isAvailable() const;
- bool isConnected() const;
- bool isConnectedOrConnecting() const;
- bool isFailover() const;
- bool isRoaming() const;
- bool isValid() const;
-
-private:
- QJNIObjectPrivate m_networkInfo;
-};
-
-class AndroidConnectivityManager : public QObject
-{
- Q_OBJECT
-public:
- static AndroidConnectivityManager *getInstance();
- ~AndroidConnectivityManager();
-
- AndroidNetworkInfo getActiveNetworkInfo() const;
- QList<AndroidNetworkInfo> getAllNetworkInfo() const;
- bool getBackgroundDataSetting() const;
- AndroidNetworkInfo getNetworkInfo(int networkType) const;
- int getNetworkPreference() const;
- bool isActiveNetworkMetered() const;
- static bool isNetworkTypeValid(int networkType);
- bool requestRouteToHost(int networkType, int hostAddress);
- void setNetworkPreference(int preference);
- int startUsingNetworkFeature(int networkType, const QString &feature);
- int stopUsingNetworkFeature(int networkType, const QString &feature);
- inline bool isValid() const
- {
- return m_connectivityManager.isValid();
- }
-
- Q_SIGNAL void activeNetworkChanged();
-
-private:
- friend struct AndroidConnectivityManagerInstance;
- AndroidConnectivityManager();
- bool registerNatives(JNIEnv *env);
- QJNIObjectPrivate m_connectivityManager;
-};
-
-QT_END_NAMESPACE
-
-#endif // ANDROIDCONNECTIVITYMANAGER_H
diff --git a/src/plugins/bearer/android/src/wrappers/wrappers.pri b/src/plugins/bearer/android/src/wrappers/wrappers.pri
deleted file mode 100644
index 209b76e533..0000000000
--- a/src/plugins/bearer/android/src/wrappers/wrappers.pri
+++ /dev/null
@@ -1,6 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/androidconnectivitymanager.h
-SOURCES += \
- $$PWD/androidconnectivitymanager.cpp
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
deleted file mode 100644
index afdc613167..0000000000
--- a/src/plugins/bearer/bearer.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = subdirs
-QT_FOR_CONFIG += network-private
-
-!android:linux*:qtHaveModule(dbus) {
- SUBDIRS += generic
- SUBDIRS += connman networkmanager
-}
-
-android:!android-embedded: SUBDIRS += android
-
-isEmpty(SUBDIRS):SUBDIRS = generic
diff --git a/src/plugins/bearer/connman/.prev_CMakeLists.txt b/src/plugins/bearer/connman/.prev_CMakeLists.txt
deleted file mode 100644
index 55aaa41491..0000000000
--- a/src/plugins/bearer/connman/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated from connman.pro.
-
-#####################################################################
-## QConnmanEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QConnmanEnginePlugin
- OUTPUT_NAME qconnmanbearer
- CLASS_NAME QConnmanEnginePlugin
- TYPE bearer
- SOURCES
- main.cpp
- qconnmanengine.cpp qconnmanengine.h
- qconnmanservice_linux.cpp qconnmanservice_linux_p.h
- LIBRARIES
- Qt::LinuxOfonoSupportPrivate
- Qt::NetworkPrivate
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::DBus
- Qt::LinuxOfonoSupport
- Qt::Network
-)
-
-#### Keys ignored in scope 1:.:.:connman.pro:<TRUE>:
-# OTHER_FILES = "connman.json"
diff --git a/src/plugins/bearer/connman/CMakeLists.txt b/src/plugins/bearer/connman/CMakeLists.txt
deleted file mode 100644
index 745f48b6e0..0000000000
--- a/src/plugins/bearer/connman/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated from connman.pro.
-
-#####################################################################
-## QConnmanEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QConnmanEnginePlugin
- OUTPUT_NAME qconnmanbearer
- TYPE bearer
- SOURCES
- main.cpp
- qconnmanengine.cpp qconnmanengine.h
- qconnmanservice_linux.cpp qconnmanservice_linux_p.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::DBus
- Qt::LinuxOfonoSupportPrivate
- Qt::NetworkPrivate
-)
-
-#### Keys ignored in scope 1:.:.:connman.pro:<TRUE>:
-# OTHER_FILES = "connman.json"
diff --git a/src/plugins/bearer/connman/connman.json b/src/plugins/bearer/connman/connman.json
deleted file mode 100644
index 7a80b8c9be..0000000000
--- a/src/plugins/bearer/connman/connman.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "connman" ]
-}
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
deleted file mode 100644
index 03e94cfe6a..0000000000
--- a/src/plugins/bearer/connman/connman.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qconnmanbearer
-
-QT = core network-private dbus linuxofono_support_private
-
-HEADERS += qconnmanservice_linux_p.h \
- qconnmanengine.h
-
-SOURCES += main.cpp \
- qconnmanservice_linux.cpp \
- qconnmanengine.cpp
-
-OTHER_FILES += connman.json
-
-PLUGIN_TYPE = bearer
-PLUGIN_CLASS_NAME = QConnmanEnginePlugin
-load(qt_plugin)
diff --git a/src/plugins/bearer/connman/main.cpp b/src/plugins/bearer/connman/main.cpp
deleted file mode 100644
index 03c8a7f6c5..0000000000
--- a/src/plugins/bearer/connman/main.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qconnmanengine.h"
-
-#include <QtNetwork/private/qbearerplugin_p.h>
-
-#include <QtCore/qdebug.h>
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-class QConnmanEnginePlugin : public QBearerEnginePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "connman.json")
-
-public:
- QConnmanEnginePlugin();
- ~QConnmanEnginePlugin();
-
- QBearerEngine *create(const QString &key) const;
-};
-
-QConnmanEnginePlugin::QConnmanEnginePlugin()
-{
-}
-
-QConnmanEnginePlugin::~QConnmanEnginePlugin()
-{
-}
-
-QBearerEngine *QConnmanEnginePlugin::create(const QString &key) const
-{
- if (key == QLatin1String("connman")) {
- QConnmanEngine *engine = new QConnmanEngine;
- if (engine->connmanAvailable())
- return engine;
- else
- delete engine;
- }
- return 0;
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
-
-#endif
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
deleted file mode 100644
index a673834825..0000000000
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ /dev/null
@@ -1,570 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qconnmanengine.h"
-#include "qconnmanservice_linux_p.h"
-#include <private/qnetworksession_impl_p.h>
-
-#include <QtNetwork/private/qnetworkconfiguration_p.h>
-
-#include <QtNetwork/qnetworksession.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/private/qlocking_p.h>
-
-#include <QtDBus/QtDBus>
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-QConnmanEngine::QConnmanEngine(QObject *parent)
-: QBearerEngineImpl(parent),
- connmanManager(new QConnmanManagerInterface(this)),
- ofonoManager(new QOfonoManagerInterface(this)),
- ofonoNetwork(0),
- ofonoContextManager(0)
-{
- qDBusRegisterMetaType<ConnmanMap>();
- qDBusRegisterMetaType<ConnmanMapList>();
- qRegisterMetaType<ConnmanMapList>("ConnmanMapList");
-}
-
-QConnmanEngine::~QConnmanEngine()
-{
-}
-
-bool QConnmanEngine::connmanAvailable() const
-{
- const auto locker = qt_scoped_lock(mutex);
- return connmanManager->isValid();
-}
-
-void QConnmanEngine::initialize()
-{
- const auto locker = qt_scoped_lock(mutex);
- connect(ofonoManager,SIGNAL(modemChanged()),this,SLOT(changedModem()));
-
- ofonoNetwork = new QOfonoNetworkRegistrationInterface(ofonoManager->currentModem(),this);
- ofonoContextManager = new QOfonoDataConnectionManagerInterface(ofonoManager->currentModem(),this);
- connect(ofonoContextManager,SIGNAL(roamingAllowedChanged(bool)),this,SLOT(reEvaluateCellular()));
-
- connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList,QList<QDBusObjectPath>)),
- this, SLOT(updateServices(ConnmanMapList,QList<QDBusObjectPath>)));
-
- connect(connmanManager,SIGNAL(servicesReady(QStringList)),this,SLOT(servicesReady(QStringList)));
- connect(connmanManager,SIGNAL(scanFinished(bool)),this,SLOT(finishedScan(bool)));
-
- const auto servPaths = connmanManager->getServices();
- for (const QString &servPath : servPaths)
- addServiceConfiguration(servPath);
- Q_EMIT updateCompleted();
-}
-
-void QConnmanEngine::changedModem()
-{
- const auto locker = qt_scoped_lock(mutex);
- if (ofonoNetwork)
- delete ofonoNetwork;
-
- ofonoNetwork = new QOfonoNetworkRegistrationInterface(ofonoManager->currentModem(),this);
-
- if (ofonoContextManager)
- delete ofonoContextManager;
- ofonoContextManager = new QOfonoDataConnectionManagerInterface(ofonoManager->currentModem(),this);
-}
-
-void QConnmanEngine::servicesReady(const QStringList &list)
-{
- const auto locker = qt_scoped_lock(mutex);
- for (const QString &servPath : list)
- addServiceConfiguration(servPath);
-
- Q_EMIT updateCompleted();
-}
-
-QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations()
-{
- const auto locker = qt_scoped_lock(mutex);
- QList<QNetworkConfigurationPrivate *> fetchedConfigurations;
- QNetworkConfigurationPrivate* cpPriv = 0;
- const int numFoundConfigurations = foundConfigurations.count();
- fetchedConfigurations.reserve(numFoundConfigurations);
-
- for (int i = 0; i < numFoundConfigurations; ++i) {
- QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate;
- cpPriv = foundConfigurations.at(i);
-
- config->name = cpPriv->name;
- config->isValid = cpPriv->isValid;
- config->id = cpPriv->id;
- config->state = cpPriv->state;
- config->type = cpPriv->type;
- config->roamingSupported = cpPriv->roamingSupported;
- config->purpose = cpPriv->purpose;
- config->bearerType = cpPriv->bearerType;
-
- fetchedConfigurations.append(config);
- delete config;
- }
- return fetchedConfigurations;
-}
-
-QString QConnmanEngine::getInterfaceFromId(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
- return configInterfaces.value(id);
-}
-
-bool QConnmanEngine::hasIdentifier(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
- return accessPointConfigurations.contains(id);
-}
-
-void QConnmanEngine::connectToId(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- QConnmanServiceInterface *serv = connmanServiceInterfaces.value(id);
-
- if (!serv || !serv->isValid()) {
- emit connectionError(id, QBearerEngineImpl::InterfaceLookupError);
- } else {
- if (serv->type() == QLatin1String("cellular")) {
- if (serv->roaming()) {
- if (!isRoamingAllowed(serv->path())) {
- emit connectionError(id, QBearerEngineImpl::OperationNotSupported);
- return;
- }
- }
- }
- if (serv->autoConnect())
- serv->connect();
- }
-}
-
-void QConnmanEngine::disconnectFromId(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
- QConnmanServiceInterface *serv = connmanServiceInterfaces.value(id);
-
- if (!serv || !serv->isValid()) {
- emit connectionError(id, DisconnectionError);
- } else {
- serv->disconnect();
- }
-}
-
-void QConnmanEngine::requestUpdate()
-{
- const auto locker = qt_scoped_lock(mutex);
- QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
-}
-
-void QConnmanEngine::doRequestUpdate()
-{
- bool scanned = connmanManager->requestScan("wifi");
- if (!scanned)
- Q_EMIT updateCompleted();
-}
-
-void QConnmanEngine::finishedScan(bool error)
-{
- if (error)
- Q_EMIT updateCompleted();
-}
-
-void QConnmanEngine::updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- foreach (const QDBusObjectPath &objectPath, removed) {
- removeConfiguration(objectPath.path());
- }
-
- foreach (const ConnmanMap &connmanMap, changed) {
- const QString id = connmanMap.objectPath.path();
- if (accessPointConfigurations.contains(id)) {
- configurationChange(connmanServiceInterfaces.value(id));
- } else {
- addServiceConfiguration(connmanMap.objectPath.path());
- }
- }
- Q_EMIT updateCompleted();
-}
-
-QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- if (!ptr || !ptr->isValid)
- return QNetworkSession::Invalid;
-
- QString service = id;
- QConnmanServiceInterface *serv = connmanServiceInterfaces.value(service);
- if (!serv)
- return QNetworkSession::Invalid;
-
- QString servState = serv->state();
-
- if (serv->favorite() && (servState == QLatin1String("idle") || servState == QLatin1String("failure"))) {
- return QNetworkSession::Disconnected;
- }
-
- if (servState == QLatin1String("association") || servState == QLatin1String("configuration")) {
- return QNetworkSession::Connecting;
- }
-
- if (servState == QLatin1String("online") || servState == QLatin1String("ready")) {
- return QNetworkSession::Connected;
- }
-
- if ((ptr->state & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
- return QNetworkSession::Disconnected;
- } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
- return QNetworkSession::NotAvailable;
- } else if ((ptr->state & QNetworkConfiguration::Undefined) ==
- QNetworkConfiguration::Undefined) {
- return QNetworkSession::NotAvailable;
- }
-
- return QNetworkSession::Invalid;
-}
-
-quint64 QConnmanEngine::bytesWritten(const QString &id)
-{//TODO use connman counter API
- const auto locker = qt_scoped_lock(mutex);
- quint64 result = 0;
- QString devFile = getInterfaceFromId(id);
- QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes");
- if (tx.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream in(&tx);
- in >> result;
- tx.close();
- }
-
- return result;
-}
-
-quint64 QConnmanEngine::bytesReceived(const QString &id)
-{//TODO use connman counter API
- const auto locker = qt_scoped_lock(mutex);
- quint64 result = 0;
- QString devFile = getInterfaceFromId(id);
- QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes");
- if (rx.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream in(&rx);
- in >> result;
- rx.close();
- }
- return result;
-}
-
-quint64 QConnmanEngine::startTime(const QString &/*id*/)
-{
- // TODO
- const auto locker = qt_scoped_lock(mutex);
- if (activeTime.isNull()) {
- return 0;
- }
- return activeTime.secsTo(QDateTime::currentDateTime());
-}
-
-QNetworkConfigurationManager::Capabilities QConnmanEngine::capabilities() const
-{
- return QNetworkConfigurationManager::ForcedRoaming |
- QNetworkConfigurationManager::DataStatistics |
- QNetworkConfigurationManager::CanStartAndStopInterfaces |
- QNetworkConfigurationManager::NetworkSessionRequired;
-}
-
-QNetworkSessionPrivate *QConnmanEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl;
-}
-
-QNetworkConfigurationPrivatePointer QConnmanEngine::defaultConfiguration()
-{
- const auto locker = qt_scoped_lock(mutex);
- const auto servPaths = connmanManager->getServices();
- for (const QString &servPath : servPaths) {
- if (connmanServiceInterfaces.contains(servPath)) {
- if (accessPointConfigurations.contains(servPath))
- return accessPointConfigurations.value(servPath);
- }
- }
- return QNetworkConfigurationPrivatePointer();
-}
-
-void QConnmanEngine::serviceStateChanged(const QString &state)
-{
- QConnmanServiceInterface *service = qobject_cast<QConnmanServiceInterface *>(sender());
- configurationChange(service);
-
- if (state == QLatin1String("failure")) {
- emit connectionError(service->path(), ConnectError);
- }
-}
-
-void QConnmanEngine::configurationChange(QConnmanServiceInterface *serv)
-{
- if (!serv)
- return;
- auto locker = qt_unique_lock(mutex);
- QString id = serv->path();
-
- if (accessPointConfigurations.contains(id)) {
- bool changed = false;
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- QString networkName = serv->name();
- QNetworkConfiguration::StateFlags curState = getStateForService(serv->path());
- ptr->mutex.lock();
-
- if (!ptr->isValid) {
- ptr->isValid = true;
- }
-
- if (ptr->name != networkName) {
- ptr->name = networkName;
- changed = true;
- }
-
- if (ptr->state != curState) {
- ptr->state = curState;
- changed = true;
- }
-
- ptr->mutex.unlock();
-
- if (changed) {
- locker.unlock();
- emit configurationChanged(ptr);
- locker.lock();
- }
- }
-
- locker.unlock();
- emit updateCompleted();
-}
-
-QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QString &service)
-{
- const auto locker = qt_scoped_lock(mutex);
- QConnmanServiceInterface *serv = connmanServiceInterfaces.value(service);
- if (!serv)
- return QNetworkConfiguration::Undefined;
-
- QString state = serv->state();
- QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
-
- if (serv->type() == QLatin1String("cellular")) {
-
- if (!serv->autoConnect()|| (serv->roaming()
- && !isRoamingAllowed(serv->path()))) {
- flag = (flag | QNetworkConfiguration::Defined);
- } else {
- flag = (flag | QNetworkConfiguration::Discovered);
- }
- } else {
- if (serv->favorite()) {
- if (serv->autoConnect()) {
- flag = (flag | QNetworkConfiguration::Discovered);
- }
- } else {
- flag = QNetworkConfiguration::Undefined;
- }
- }
- if (state == QLatin1String("online") || state == QLatin1String("ready")) {
- flag = (flag | QNetworkConfiguration::Active);
- }
-
- return flag;
-}
-
-QNetworkConfiguration::BearerType QConnmanEngine::typeToBearer(const QString &type)
-{
- if (type == QLatin1String("wifi"))
- return QNetworkConfiguration::BearerWLAN;
- if (type == QLatin1String("ethernet"))
- return QNetworkConfiguration::BearerEthernet;
- if (type == QLatin1String("bluetooth"))
- return QNetworkConfiguration::BearerBluetooth;
- if (type == QLatin1String("cellular")) {
- return ofonoTechToBearerType(type);
- }
- if (type == QLatin1String("wimax"))
- return QNetworkConfiguration::BearerWiMAX;
-
- return QNetworkConfiguration::BearerUnknown;
-}
-
-QNetworkConfiguration::BearerType QConnmanEngine::ofonoTechToBearerType(const QString &/*type*/)
-{
- if (ofonoNetwork) {
- QString currentTechnology = ofonoNetwork->getTechnology();
- if (currentTechnology == QLatin1String("gsm")) {
- return QNetworkConfiguration::Bearer2G;
- } else if (currentTechnology == QLatin1String("edge")) {
- return QNetworkConfiguration::BearerCDMA2000; //wrong, I know
- } else if (currentTechnology == QLatin1String("umts")) {
- return QNetworkConfiguration::BearerWCDMA;
- } else if (currentTechnology == QLatin1String("hspa")) {
- return QNetworkConfiguration::BearerHSPA;
- } else if (currentTechnology == QLatin1String("lte")) {
- return QNetworkConfiguration::BearerLTE;
- }
- }
- return QNetworkConfiguration::BearerUnknown;
-}
-
-bool QConnmanEngine::isRoamingAllowed(const QString &context)
-{
- const auto dcPaths = ofonoContextManager->contexts();
- for (const QString &dcPath : dcPaths) {
- if (dcPath.contains(context.section("_",-1))) {
- return ofonoContextManager->roamingAllowed();
- }
- }
- return false;
-}
-
-void QConnmanEngine::removeConfiguration(const QString &id)
-{
- auto locker = qt_unique_lock(mutex);
-
- if (accessPointConfigurations.contains(id)) {
-
- disconnect(connmanServiceInterfaces.value(id),SIGNAL(stateChanged(QString)),
- this,SLOT(serviceStateChanged(QString)));
- serviceNetworks.removeOne(id);
- QConnmanServiceInterface *service = connmanServiceInterfaces.take(id);
- delete service;
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id);
- foundConfigurations.removeOne(ptr.data());
- locker.unlock();
- emit configurationRemoved(ptr);
- }
-}
-
-void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
-{
- auto locker = qt_unique_lock(mutex);
- if (!connmanServiceInterfaces.contains(servicePath)) {
- QConnmanServiceInterface *serv = new QConnmanServiceInterface(servicePath, this);
- connmanServiceInterfaces.insert(serv->path(),serv);
- }
-
- if (!accessPointConfigurations.contains(servicePath)) {
-
- serviceNetworks.append(servicePath);
-
- connect(connmanServiceInterfaces.value(servicePath),SIGNAL(stateChanged(QString)),
- this,SLOT(serviceStateChanged(QString)));
-
- QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
- QConnmanServiceInterface *service = connmanServiceInterfaces.value(servicePath);
-
- QString networkName = service->name();
-
- const QString connectionType = service->type();
- if (connectionType == QLatin1String("ethernet")) {
- cpPriv->bearerType = QNetworkConfiguration::BearerEthernet;
- } else if (connectionType == QLatin1String("wifi")) {
- cpPriv->bearerType = QNetworkConfiguration::BearerWLAN;
- } else if (connectionType == QLatin1String("cellular")) {
- cpPriv->bearerType = ofonoTechToBearerType(QLatin1String("cellular"));
- cpPriv->roamingSupported = service->roaming() && isRoamingAllowed(servicePath);
- } else if (connectionType == QLatin1String("wimax")) {
- cpPriv->bearerType = QNetworkConfiguration::BearerWiMAX;
- } else {
- cpPriv->bearerType = QNetworkConfiguration::BearerUnknown;
- }
-
- cpPriv->name = networkName;
- cpPriv->isValid = true;
- cpPriv->id = servicePath;
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
-
- if (service->security() == QLatin1String("none")) {
- cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
- } else {
- cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
- }
-
- cpPriv->state = getStateForService(servicePath);
-
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
- accessPointConfigurations.insert(ptr->id, ptr);
- if (connectionType == QLatin1String("cellular")) {
- foundConfigurations.append(cpPriv);
- } else {
- foundConfigurations.prepend(cpPriv);
- }
- configInterfaces[cpPriv->id] = service->serviceInterface();
-
- locker.unlock();
- Q_EMIT configurationAdded(ptr);
- }
-}
-
-bool QConnmanEngine::requiresPolling() const
-{
- return false;
-}
-
-void QConnmanEngine::reEvaluateCellular()
-{
- const auto servicePaths = connmanManager->getServices();
- for (const QString &servicePath : servicePaths) {
- if (servicePath.contains("cellular") && accessPointConfigurations.contains(servicePath)) {
- configurationChange(connmanServiceInterfaces.value(servicePath));
- }
- }
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
deleted file mode 100644
index 969eed45b1..0000000000
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCONNMANENGINE_P_H
-#define QCONNMANENGINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qbearerengine_impl_p.h>
-
-#include "qconnmanservice_linux_p.h"
-#include <private/qofonoservice_linux_p.h>
-
-#include <QMap>
-#include <QVariant>
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-class QConnmanEngine : public QBearerEngineImpl
-{
- Q_OBJECT
-
-public:
- QConnmanEngine(QObject *parent = nullptr);
- ~QConnmanEngine();
-
- bool connmanAvailable() const;
-
- virtual QString getInterfaceFromId(const QString &id);
- bool hasIdentifier(const QString &id);
-
- virtual void connectToId(const QString &id);
- virtual void disconnectFromId(const QString &id);
-
- Q_INVOKABLE void initialize();
- Q_INVOKABLE void requestUpdate();
-
- QNetworkSession::State sessionStateForId(const QString &id);
- QNetworkSessionPrivate *createSessionBackend();
-
- virtual quint64 bytesWritten(const QString &id);
- virtual quint64 bytesReceived(const QString &id);
- virtual quint64 startTime(const QString &id);
-
- virtual QNetworkConfigurationManager::Capabilities capabilities() const;
- virtual QNetworkConfigurationPrivatePointer defaultConfiguration();
-
- QList<QNetworkConfigurationPrivate *> getConfigurations();
-
-private Q_SLOTS:
-
- void doRequestUpdate();
- void updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed);
-
- void servicesReady(const QStringList &);
- void finishedScan(bool error);
- void changedModem();
- void serviceStateChanged(const QString &state);
- void configurationChange(QConnmanServiceInterface * service);
- void reEvaluateCellular();
-private:
- QConnmanManagerInterface *connmanManager;
-
- QOfonoManagerInterface *ofonoManager;
- QOfonoNetworkRegistrationInterface *ofonoNetwork;
- QOfonoDataConnectionManagerInterface *ofonoContextManager;
-
- QList<QNetworkConfigurationPrivate *> foundConfigurations;
-
- QString networkFromId(const QString &id);
-
- QNetworkConfiguration::StateFlags getStateForService(const QString &service);
- QNetworkConfiguration::BearerType typeToBearer(const QString &type);
-
- void removeConfiguration(const QString &servicePath);
- void addServiceConfiguration(const QString &servicePath);
- QDateTime activeTime;
-
-
- QMap<QString,QConnmanTechnologyInterface *> technologies; // techpath, tech interface
- QMap<QString,QString> configInterfaces; // id, interface name
- QList<QString> serviceNetworks; //servpath
-
- QNetworkConfiguration::BearerType ofonoTechToBearerType(const QString &type);
- bool isRoamingAllowed(const QString &context);
- QMap <QString,QConnmanServiceInterface *> connmanServiceInterfaces;
-
-protected:
- bool requiresPolling() const;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
-
-#endif
-
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
deleted file mode 100644
index 35d9c40680..0000000000
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ /dev/null
@@ -1,516 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QObject>
-#include <QList>
-#include <QtDBus/QtDBus>
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusError>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
-#include <QtDBus/QDBusPendingCallWatcher>
-#include <QtDBus/QDBusObjectPath>
-#include <QtDBus/QDBusPendingCall>
-
-#include "qconnmanservice_linux_p.h"
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &map)
-{
- argument.beginStructure();
- argument << map.objectPath << map.propertyMap;
- argument.endStructure();
- return argument;
-}
-
-const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &map)
-{
- argument.beginStructure();
- argument >> map.objectPath >> map.propertyMap;
- argument.endStructure();
- return argument;
-}
-
-QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent)
- : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- CONNMAN_MANAGER_INTERFACE,
- QDBusConnection::systemBus(), parent)
-{
- qDBusRegisterMetaType<ConnmanMap>();
- qDBusRegisterMetaType<ConnmanMapList>();
-
- QDBusPendingReply<QVariantMap> props_reply = asyncCall(QLatin1String("GetProperties"));
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(props_reply, this);
-
- QObject::connect(watcher,SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(propertiesReply(QDBusPendingCallWatcher*)));
-
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SLOT(changedProperty(QString,QDBusVariant)));
-
-
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("TechnologyAdded"),
- this,SLOT(technologyAdded(QDBusObjectPath,QVariantMap)));
-
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("TechnologyRemoved"),
- this,SLOT(technologyRemoved(QDBusObjectPath)));
-
- QDBusPendingReply<ConnmanMapList> serv_reply = asyncCall(QLatin1String("GetServices"));
- QDBusPendingCallWatcher *watcher2 = new QDBusPendingCallWatcher(serv_reply, this);
-
- QObject::connect(watcher2,SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(servicesReply(QDBusPendingCallWatcher*)));
-
-}
-
-QConnmanManagerInterface::~QConnmanManagerInterface()
-{
-}
-
-void QConnmanManagerInterface::changedProperty(const QString &name, const QDBusVariant &value)
-{
- propertiesCacheMap[name] = value.variant();
-}
-
-void QConnmanManagerInterface::propertiesReply(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<QVariantMap> props_reply = *call;
-
- if (props_reply.isError()) {
- qDebug() << props_reply.error().message();
- } else {
- propertiesCacheMap = props_reply.value();
- }
- call->deleteLater();
-}
-
-void QConnmanManagerInterface::servicesReply(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<ConnmanMapList> serv_reply = *call;
-
- if (serv_reply.isError()) {
- qDebug() << serv_reply.error().message();
- } else {
- servicesList.clear(); //connman list changes order
- const ConnmanMapList connmanobjs = serv_reply.value();
- for (const ConnmanMap &connmanobj : connmanobjs)
- servicesList << connmanobj.objectPath.path();
- Q_EMIT servicesReady(servicesList);
- }
- call->deleteLater();
-}
-
-void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::propertyChanged);
- if (signal == propertyChangedSignal) {
- if (!connection().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_MANAGER_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(QString,QDBusVariant)))) {
- qWarning("PropertyChanged not connected");
- }
- }
-
- static const QMetaMethod servicesChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::servicesChanged);
- if (signal == servicesChangedSignal) {
- if (!connection().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_MANAGER_INTERFACE),
- QLatin1String("ServicesChanged"),
- this,SLOT(onServicesChanged(ConnmanMapList,QList<QDBusObjectPath>)))) {
- qWarning("servicesChanged not connected");
- }
- }
-}
-
-void QConnmanManagerInterface::onServicesChanged(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed)
-{
- servicesList.clear(); //connman list changes order
- for (const ConnmanMap &connmanobj : changed) {
- const QString svcPath(connmanobj.objectPath.path());
- servicesList << svcPath;
- }
-
- Q_EMIT servicesChanged(changed, removed);
-}
-
-QVariant QConnmanManagerInterface::getProperty(const QString &property)
-{
- QVariant var;
- var = propertiesCacheMap.value(property);
- return var;
-}
-
-QVariantMap QConnmanManagerInterface::getProperties()
-{
- if (propertiesCacheMap.isEmpty()) {
- QDBusPendingReply<QVariantMap> reply = call(QLatin1String("GetProperties"));
- reply.waitForFinished();
- if (!reply.isError()) {
- propertiesCacheMap = reply.value();
- }
- }
- return propertiesCacheMap;
-}
-
-QString QConnmanManagerInterface::getState()
-{
- return getProperty(QStringLiteral("State")).toString();
-}
-
-bool QConnmanManagerInterface::getOfflineMode()
-{
- QVariant var = getProperty(QStringLiteral("OfflineMode"));
- return qdbus_cast<bool>(var);
-}
-
-QStringList QConnmanManagerInterface::getTechnologies()
-{
- if (technologiesMap.isEmpty()) {
- QDBusPendingReply<ConnmanMapList> reply = call(QLatin1String("GetTechnologies"));
- reply.waitForFinished();
- if (!reply.isError()) {
- const ConnmanMapList maps = reply.value();
- for (const ConnmanMap &map : maps) {
- if (!technologiesMap.contains(map.objectPath.path())) {
- technologyAdded(map.objectPath, map.propertyMap);
- }
- }
- }
- }
- return technologiesMap.keys();
-}
-
-QStringList QConnmanManagerInterface::getServices()
-{
- if (servicesList.isEmpty()) {
- QDBusPendingReply<ConnmanMapList> reply = call(QLatin1String("GetServices"));
- reply.waitForFinished();
- if (!reply.isError()) {
- const ConnmanMapList maps = reply.value();
- for (const ConnmanMap &map : maps)
- servicesList << map.objectPath.path();
- }
- }
- return servicesList;
-}
-
-bool QConnmanManagerInterface::requestScan(const QString &type)
-{
- bool scanned = false;
- if (technologiesMap.isEmpty())
- getTechnologies();
- Q_FOREACH (QConnmanTechnologyInterface *tech, technologiesMap) {
- if (tech->type() == type) {
- tech->scan();
- scanned = true;
- }
- }
- return scanned;
-}
-
-void QConnmanManagerInterface::technologyAdded(const QDBusObjectPath &path, const QVariantMap &)
-{
- if (!technologiesList.contains(path.path())) {
- technologiesList << path.path();
- QConnmanTechnologyInterface *tech;
- tech = new QConnmanTechnologyInterface(path.path(),this);
- technologiesMap.insert(path.path(),tech);
- connect(tech,SIGNAL(scanFinished(bool)),this,SIGNAL(scanFinished(bool)));
- }
-}
-
-void QConnmanManagerInterface::technologyRemoved(const QDBusObjectPath &path)
-{
- if (technologiesList.contains(path.path())) {
- technologiesList.removeOne(path.path());
- QConnmanTechnologyInterface * tech = technologiesMap.take(path.path());
- delete tech;
- }
-}
-
-QConnmanServiceInterface::QConnmanServiceInterface(const QString &dbusPathName,QObject *parent)
- : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
- dbusPathName,
- CONNMAN_SERVICE_INTERFACE,
- QDBusConnection::systemBus(), parent)
-{
- QDBusPendingReply<QVariantMap> props_reply = asyncCall(QLatin1String("GetProperties"));
-
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(props_reply, this);
-
- QObject::connect(watcher,SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(propertiesReply(QDBusPendingCallWatcher*)));
-
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- path(),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SLOT(changedProperty(QString,QDBusVariant)));
-}
-
-QConnmanServiceInterface::~QConnmanServiceInterface()
-{
-}
-
-QVariantMap QConnmanServiceInterface::getProperties()
-{
- if (propertiesCacheMap.isEmpty()) {
- QDBusPendingReply<QVariantMap> reply = call(QLatin1String("GetProperties"));
- reply.waitForFinished();
- if (!reply.isError()) {
- propertiesCacheMap = reply.value();
- Q_EMIT propertiesReady();
- }
- }
- return propertiesCacheMap;
-}
-
-void QConnmanServiceInterface::propertiesReply(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<QVariantMap> props_reply = *call;
- if (props_reply.isError()) {
- qDebug() << props_reply.error().message();
- return;
- }
- propertiesCacheMap = props_reply.value();
- Q_EMIT propertiesReady();
-}
-
-void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChanged);
- if (signal == propertyChangedSignal) {
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- path(),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(QString,QDBusVariant)));
- }
-}
-
-void QConnmanServiceInterface::changedProperty(const QString &name, const QDBusVariant &value)
-{
- propertiesCacheMap[name] = value.variant();
- if (name == QLatin1String("State"))
- Q_EMIT stateChanged(value.variant().toString());
-}
-
-QVariant QConnmanServiceInterface::getProperty(const QString &property)
-{
- QVariant var;
- QVariantMap map = getProperties();
- var = map.value(property);
- return var;
-}
-
-void QConnmanServiceInterface::connect()
-{
- asyncCall(QLatin1String("Connect"));
-}
-
-void QConnmanServiceInterface::disconnect()
-{
- asyncCall(QLatin1String("Disconnect"));
-}
-
-void QConnmanServiceInterface::remove()
-{
- asyncCall(QLatin1String("Remove"));
-}
-
-// properties
-QString QConnmanServiceInterface::state()
-{
- QVariant var = getProperty(QStringLiteral("State"));
- return qdbus_cast<QString>(var);
-}
-
-QString QConnmanServiceInterface::lastError()
-{
- QVariant var = getProperty(QStringLiteral("Error"));
- return qdbus_cast<QString>(var);
-}
-
-QString QConnmanServiceInterface::name()
-{
- QVariant var = getProperty(QStringLiteral("Name"));
- return qdbus_cast<QString>(var);
-}
-
-QString QConnmanServiceInterface::type()
-{
- QVariant var = getProperty(QStringLiteral("Type"));
- return qdbus_cast<QString>(var);
-}
-
-QString QConnmanServiceInterface::security()
-{
- QVariant var = getProperty(QStringLiteral("Security"));
- return qdbus_cast<QString>(var);
-}
-
-bool QConnmanServiceInterface::favorite()
-{
- QVariant var = getProperty(QStringLiteral("Favorite"));
- return qdbus_cast<bool>(var);
-}
-
-bool QConnmanServiceInterface::autoConnect()
-{
- QVariant var = getProperty(QStringLiteral("AutoConnect"));
- return qdbus_cast<bool>(var);
-}
-
-bool QConnmanServiceInterface::roaming()
-{
- QVariant var = getProperty(QStringLiteral("Roaming"));
- return qdbus_cast<bool>(var);
-}
-
-QVariantMap QConnmanServiceInterface::ethernet()
-{
- QVariant var = getProperty(QStringLiteral("Ethernet"));
- return qdbus_cast<QVariantMap >(var);
-}
-
-QString QConnmanServiceInterface::serviceInterface()
-{
- QVariantMap map = ethernet();
- return map.value(QStringLiteral("Interface")).toString();
-}
-
-bool QConnmanServiceInterface::isOfflineMode()
-{
- QVariant var = getProperty(QStringLiteral("OfflineMode"));
- return qdbus_cast<bool>(var);
-}
-
-QStringList QConnmanServiceInterface::services()
-{
- QVariant var = getProperty(QStringLiteral("Services"));
- return qdbus_cast<QStringList>(var);
-}
-
-//////////////////////////
-QConnmanTechnologyInterface::QConnmanTechnologyInterface(const QString &dbusPathName,QObject *parent)
- : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
- dbusPathName,
- CONNMAN_TECHNOLOGY_INTERFACE,
- QDBusConnection::systemBus(), parent)
-{
-}
-
-QConnmanTechnologyInterface::~QConnmanTechnologyInterface()
-{
-}
-
-void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChanged);
- if (signal == propertyChangedSignal) {
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- path(),
- QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(QString,QDBusVariant)));
- }
-}
-
-QVariantMap QConnmanTechnologyInterface::properties()
-{
- if (propertiesMap.isEmpty()) {
- QDBusPendingReply<QVariantMap> reply = call(QLatin1String("GetProperties"));
- reply.waitForFinished();
- propertiesMap = reply.value();
- }
- return propertiesMap;
-}
-
-QVariant QConnmanTechnologyInterface::getProperty(const QString &property)
-{
- QVariant var;
- QVariantMap map = properties();
- var = map.value(property);
- return var;
-}
-
-QString QConnmanTechnologyInterface::type()
-{
- QVariant var = getProperty(QStringLiteral("Type"));
- return qdbus_cast<QString>(var);
-}
-
-void QConnmanTechnologyInterface::scan()
-{
- QDBusPendingReply<> reply = asyncCall(QLatin1String("Scan"));
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(scanReply(QDBusPendingCallWatcher*)));
-}
-
-void QConnmanTechnologyInterface::scanReply(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<> props_reply = *call;
- if (props_reply.isError()) {
- qDebug() << props_reply.error().message();
- }
- Q_EMIT scanFinished(props_reply.isError());
- call->deleteLater();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
deleted file mode 100644
index 790325f9a1..0000000000
--- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCONNMANSERVICE_H
-#define QCONNMANSERVICE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtDBus/QtDBus>
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusError>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
-#include <QtDBus/QDBusArgument>
-
-#include <QtDBus/QDBusPendingCallWatcher>
-#include <QtDBus/QDBusObjectPath>
-#include <QtDBus/QDBusContext>
-#include <QMap>
-
-#ifndef QT_NO_DBUS
-
-#ifndef __CONNMAN_DBUS_H
-
-#define CONNMAN_SERVICE "net.connman"
-#define CONNMAN_PATH "/net/connman"
-#define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager"
-#define CONNMAN_MANAGER_PATH "/"
-#define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service"
-#define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-struct ConnmanMap {
- QDBusObjectPath objectPath;
- QVariantMap propertyMap;
-};
-Q_DECLARE_TYPEINFO(ConnmanMap, Q_MOVABLE_TYPE); // QDBusObjectPath is movable, but cannot be
- // marked as such until Qt 6
-typedef QVector<ConnmanMap> ConnmanMapList;
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ConnmanMap))
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ConnmanMapList))
-
-QT_BEGIN_NAMESPACE
-
-QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj);
-const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj);
-
-class QConnmanTechnologyInterface;
-class QConnmanServiceInterface;
-
-class QConnmanManagerInterface : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- QConnmanManagerInterface( QObject *parent = nullptr);
- ~QConnmanManagerInterface();
-
- QDBusObjectPath path() const;
- QVariantMap getProperties();
-
- QString getState();
- bool getOfflineMode();
- QStringList getTechnologies();
- QStringList getServices();
- bool requestScan(const QString &type);
-
- QHash<QString, QConnmanTechnologyInterface *> technologiesMap;
-
-Q_SIGNALS:
- void propertyChanged(const QString &, const QDBusVariant &value);
- void stateChanged(const QString &);
- void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
- void servicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &);
-
- void servicesReady(const QStringList &);
- void scanFinished(bool error);
-
-protected:
- void connectNotify(const QMetaMethod &signal);
- QVariant getProperty(const QString &);
-
-private:
- QVariantMap propertiesCacheMap;
- QStringList servicesList;
- QStringList technologiesList;
-
-private slots:
- void onServicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &);
- void changedProperty(const QString &, const QDBusVariant &value);
-
- void propertiesReply(QDBusPendingCallWatcher *call);
- void servicesReply(QDBusPendingCallWatcher *call);
-
- void technologyAdded(const QDBusObjectPath &technology, const QVariantMap &properties);
- void technologyRemoved(const QDBusObjectPath &technology);
-
-};
-
-class QConnmanServiceInterface : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- explicit QConnmanServiceInterface(const QString &dbusPathName,QObject *parent = nullptr);
- ~QConnmanServiceInterface();
-
- QVariantMap getProperties();
- // clearProperty
- void connect();
- void disconnect();
- void remove();
-
-// properties
- QString state();
- QString lastError();
- QString name();
- QString type();
- QString security();
- bool favorite();
- bool autoConnect();
- bool roaming();
- QVariantMap ethernet();
- QString serviceInterface();
-
- bool isOfflineMode();
- QStringList services();
-
-Q_SIGNALS:
- void propertyChanged(const QString &, const QDBusVariant &value);
- void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
- void propertiesReady();
- void stateChanged(const QString &state);
-
-protected:
- void connectNotify(const QMetaMethod &signal);
- QVariant getProperty(const QString &);
-private:
- QVariantMap propertiesCacheMap;
-private slots:
- void propertiesReply(QDBusPendingCallWatcher *call);
- void changedProperty(const QString &, const QDBusVariant &value);
-
-};
-
-class QConnmanTechnologyInterface : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- explicit QConnmanTechnologyInterface(const QString &dbusPathName,QObject *parent = nullptr);
- ~QConnmanTechnologyInterface();
-
- QString type();
-
- void scan();
-Q_SIGNALS:
- void propertyChanged(const QString &, const QDBusVariant &value);
- void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
- void scanFinished(bool error);
-protected:
- void connectNotify(const QMetaMethod &signal);
- QVariant getProperty(const QString &);
-private:
- QVariantMap properties();
- QVariantMap propertiesMap;
-private Q_SLOTS:
- void scanReply(QDBusPendingCallWatcher *call);
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
-
-#endif //QCONNMANSERVICE_H
diff --git a/src/plugins/bearer/corewlan/CMakeLists.txt b/src/plugins/bearer/corewlan/CMakeLists.txt
deleted file mode 100644
index 31e70cc938..0000000000
--- a/src/plugins/bearer/corewlan/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Generated from corewlan.pro.
-
-#####################################################################
-## QCoreWlanEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QCoreWlanEnginePlugin
- OUTPUT_NAME qcorewlanbearer
- TYPE bearer
- SOURCES
- main.cpp
- qcorewlanengine.h qcorewlanengine.mm
- PUBLIC_LIBRARIES
- ${FWFoundation}
- ${FWSystemConfiguration}
- Qt::CorePrivate
- Qt::NetworkPrivate
-)
-
-#### Keys ignored in scope 1:.:.:corewlan.pro:<TRUE>:
-# OTHER_FILES = "corewlan.json"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QCoreWlanEnginePlugin CONDITION QT_FEATURE_corewlan
- PUBLIC_LIBRARIES
- ${FWCoreWLAN}
- ${FWSecurity}
-)
diff --git a/src/plugins/bearer/corewlan/corewlan.json b/src/plugins/bearer/corewlan/corewlan.json
deleted file mode 100644
index b43519ea90..0000000000
--- a/src/plugins/bearer/corewlan/corewlan.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "corewlan" ]
-}
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
deleted file mode 100644
index 4f08eaba71..0000000000
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGET = qcorewlanbearer
-
-QT = core-private network-private
-LIBS += -framework Foundation -framework SystemConfiguration
-
-qtConfig(corewlan) {
- LIBS += -framework CoreWLAN -framework Security
-}
-
-HEADERS += qcorewlanengine.h
-
-SOURCES += main.cpp
-
-OBJECTIVE_SOURCES += qcorewlanengine.mm
-
-OTHER_FILES += corewlan.json
-
-PLUGIN_TYPE = bearer
-PLUGIN_CLASS_NAME = QCoreWlanEnginePlugin
-load(qt_plugin)
diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp
deleted file mode 100644
index c6663d155c..0000000000
--- a/src/plugins/bearer/corewlan/main.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcorewlanengine.h"
-
-#include <QtNetwork/private/qbearerplugin_p.h>
-
-#include <QtCore/qdebug.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QCoreWlanEnginePlugin : public QBearerEnginePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "corewlan.json")
-
-public:
- QCoreWlanEnginePlugin();
- ~QCoreWlanEnginePlugin();
-
- QBearerEngine *create(const QString &key) const;
-};
-
-QCoreWlanEnginePlugin::QCoreWlanEnginePlugin()
-{
-}
-
-QCoreWlanEnginePlugin::~QCoreWlanEnginePlugin()
-{
-}
-
-QBearerEngine *QCoreWlanEnginePlugin::create(const QString &key) const
-{
- if (key == QLatin1String("corewlan"))
- return new QCoreWlanEngine;
- else
- return 0;
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
deleted file mode 100644
index 8775474c09..0000000000
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCOREWLANENGINE_H
-#define QCOREWLANENGINE_H
-
-#include <private/qbearerengine_impl_p.h>
-
-#include <QMap>
-#include <QTimer>
-#include <SystemConfiguration/SystemConfiguration.h>
-#include <QThread>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfigurationPrivate;
-class QScanThread;
-
-class QCoreWlanEngine : public QBearerEngineImpl
-{
- friend class QScanThread;
- Q_OBJECT
-
-public:
- QCoreWlanEngine(QObject *parent = 0);
- ~QCoreWlanEngine();
-
- QString getInterfaceFromId(const QString &id);
- bool hasIdentifier(const QString &id);
-
- void connectToId(const QString &id);
- void disconnectFromId(const QString &id);
-
- Q_INVOKABLE void initialize();
- Q_INVOKABLE void requestUpdate();
-
- QNetworkSession::State sessionStateForId(const QString &id);
-
- quint64 bytesWritten(const QString &id);
- quint64 bytesReceived(const QString &id);
- quint64 startTime(const QString &id);
-
- QNetworkConfigurationManager::Capabilities capabilities() const;
-
- QNetworkSessionPrivate *createSessionBackend();
-
- QNetworkConfigurationPrivatePointer defaultConfiguration();
-
- bool requiresPolling() const;
-
-private Q_SLOTS:
- void doRequestUpdate();
- void networksChanged();
- void checkDisconnect();
-
-private:
- bool isWifiReady(const QString &dev);
- QList<QNetworkConfigurationPrivate *> foundConfigurations;
-
- SCDynamicStoreRef storeSession;
- CFRunLoopSourceRef runloopSource;
- bool hasWifi;
- bool scanning;
- QScanThread *scanThread;
-
- quint64 getBytes(const QString &interfaceName,bool b);
- QString disconnectedInterfaceString;
-
-protected:
- void startNetworkChangeLoop();
-
-};
-
-class QScanThread : public QThread
-{
- Q_OBJECT
-
-public:
- QScanThread(QObject *parent = 0);
- ~QScanThread();
-
- void quit();
- QList<QNetworkConfigurationPrivate *> getConfigurations();
- QString interfaceName;
- QMap<QString, QString> configurationInterface;
- void getUserConfigurations();
- QString getNetworkNameFromSsid(const QString &ssid) const;
- QString getSsidFromNetworkName(const QString &name) const;
- bool isKnownSsid(const QString &ssid) const;
- QMap<QString, QMap<QString,QString> > userProfiles;
-
-signals:
- void networksChanged();
-
-protected:
- void run();
-
-private:
- QList<QNetworkConfigurationPrivate *> fetchedConfigurations;
- mutable QMutex mutex;
- QStringList foundNetwork(const QString &id, const QString &ssid, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose);
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
deleted file mode 100644
index 01c6df74d5..0000000000
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ /dev/null
@@ -1,862 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcorewlanengine.h"
-#include <private/qnetworksession_impl_p.h>
-
-#include <QtNetwork/private/qnetworkconfiguration_p.h>
-
-#include <QtCore/qthread.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qstringlist.h>
-
-#include <QtCore/qdebug.h>
-
-#include <QDir>
-#ifndef QT_NO_BEARERMANAGEMENT
-
-extern "C" { // Otherwise it won't find CWKeychain* symbols at link time
-#import <CoreWLAN/CoreWLAN.h>
-}
-
-#include "private/qcore_mac_p.h"
-
-#include <net/if.h>
-#include <ifaddrs.h>
-
-@interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject <CWEventDelegate>
-@property (assign) QCoreWlanEngine* engine;
-@end
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSListener);
-
-@implementation QNSListener {
- NSNotificationCenter *notificationCenter;
- CWWiFiClient *client;
- QCoreWlanEngine *engine;
- NSLock *locker;
-}
-
-- (instancetype)init
-{
- if ((self = [super init])) {
- [locker lock];
- QMacAutoReleasePool pool;
- notificationCenter = [NSNotificationCenter defaultCenter];
- client = [CWWiFiClient sharedWiFiClient];
- client.delegate = self;
- [client startMonitoringEventWithType:CWEventTypePowerDidChange error:nil];
- [locker unlock];
- }
- return self;
-}
-
-static QNSListener *listener = 0;
-
--(void)dealloc
-{
- client.delegate = nil;
- listener = nil;
- [super dealloc];
-}
-
--(void)setEngine:(QCoreWlanEngine *)coreEngine
-{
- [locker lock];
- if(!engine)
- engine = coreEngine;
- [locker unlock];
-}
-
--(QCoreWlanEngine *)engine
-{
- return engine;
-}
-
--(void)remove
-{
- [locker lock];
- [client stopMonitoringAllEventsAndReturnError:nil];
- [locker unlock];
-}
-
-- (void)powerStateDidChangeForWiFiInterfaceWithName:(NSString *)interfaceName
-{
- Q_UNUSED(interfaceName);
- engine->requestUpdate();
-}
-@end
-
-
-QT_BEGIN_NAMESPACE
-
-void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys, void *info)
-{
- for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) {
-
- QString changed = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(changedKeys, i));
- if( changed.contains("/Network/Global/IPv4")) {
- QCoreWlanEngine* wlanEngine = static_cast<QCoreWlanEngine*>(info);
- wlanEngine->requestUpdate();
- }
- }
- return;
-}
-
-
-QScanThread::QScanThread(QObject *parent)
- :QThread(parent)
-{
-}
-
-QScanThread::~QScanThread()
-{
-}
-
-void QScanThread::quit()
-{
- wait();
-}
-
-void QScanThread::run()
-{
- QMacAutoReleasePool pool;
- QStringList found;
- mutex.lock();
- CWInterface *currentInterface = [[CWWiFiClient sharedWiFiClient]
- interfaceWithName:interfaceName.toNSString()];
- mutex.unlock();
- const bool currentInterfaceServiceActive = currentInterface.serviceActive;
-
- if (currentInterface.powerOn) {
- NSError *err = nil;
-
- NSSet* apSet = [currentInterface scanForNetworksWithName:nil error:&err];
-
- if (!err) {
- for (CWNetwork *apNetwork in apSet) {
- const QString networkSsid = QString::fromNSString([apNetwork ssid]);
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- found.append(id);
-
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
- bool known = isKnownSsid(networkSsid);
- if (currentInterfaceServiceActive) {
- if (networkSsid == QString::fromNSString([currentInterface ssid])) {
- state = QNetworkConfiguration::Active;
- }
- }
- if (state == QNetworkConfiguration::Undefined) {
- if(known) {
- state = QNetworkConfiguration::Discovered;
- } else {
- state = QNetworkConfiguration::Undefined;
- }
- }
- QNetworkConfiguration::Purpose purpose = QNetworkConfiguration::UnknownPurpose;
- if ([apNetwork supportsSecurity:kCWSecurityNone]) {
- purpose = QNetworkConfiguration::PublicPurpose;
- } else {
- purpose = QNetworkConfiguration::PrivatePurpose;
- }
-
- found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose));
-
- }
- }
- }
- // add known configurations that are not around.
- for (auto i = userProfiles.cbegin(), end = userProfiles.cend(); i != end; ++i) {
-
- QString networkName = i.key();
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkName));
-
- if(!found.contains(id)) {
- QString networkSsid = getSsidFromNetworkName(networkName);
- const QString ssidId = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
- QString interfaceName;
- if (!i.value().isEmpty())
- interfaceName = i.value().last();
-
- if (currentInterfaceServiceActive) {
- if (networkSsid == QString::fromNSString([currentInterface ssid])) {
- state = QNetworkConfiguration::Active;
- }
- }
- if(state == QNetworkConfiguration::Undefined) {
- if( userProfiles.contains(networkName)
- && found.contains(ssidId)) {
- state = QNetworkConfiguration::Discovered;
- }
- }
-
- if(state == QNetworkConfiguration::Undefined) {
- state = QNetworkConfiguration::Defined;
- }
-
- found.append(foundNetwork(id, networkName, state, interfaceName, QNetworkConfiguration::UnknownPurpose));
- }
- }
- emit networksChanged();
-}
-
-QStringList QScanThread::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose)
-{
- QStringList found;
- QMutexLocker locker(&mutex);
- QNetworkConfigurationPrivate *ptr = new QNetworkConfigurationPrivate;
-
- ptr->name = name;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearerType = QNetworkConfiguration::BearerWLAN;
- ptr->purpose = purpose;
-
- fetchedConfigurations.append( ptr);
- configurationInterface.insert(ptr->id, interfaceName);
-
- locker.unlock();
- locker.relock();
- found.append(id);
- return found;
-}
-
-QList<QNetworkConfigurationPrivate *> QScanThread::getConfigurations()
-{
- QMutexLocker locker(&mutex);
- return qExchange(fetchedConfigurations, {});
-}
-
-void QScanThread::getUserConfigurations()
-{
- QMutexLocker locker(&mutex);
-
- QMacAutoReleasePool pool;
- userProfiles.clear();
-
- NSArray<NSString *> *wifiInterfaces = [CWWiFiClient interfaceNames];
- for (NSString *ifName in wifiInterfaces) {
-
- CWInterface *wifiInterface = [[CWWiFiClient sharedWiFiClient] interfaceWithName:ifName];
-
- NSString *nsInterfaceName = wifiInterface.ssid;
-// add user configured system networks
- SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
- NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]);
- CFRelease(dynRef);
- if(airportPlist != nil) {
- NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
-
- NSArray<NSString *> *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
- for (NSString *ssidkey in thisSsidarray) {
- QString thisSsid = QString::fromNSString(ssidkey);
- if(!userProfiles.contains(thisSsid)) {
- QMap <QString,QString> map;
- map.insert(thisSsid, QString::fromNSString(nsInterfaceName));
- userProfiles.insert(thisSsid, map);
- }
- }
- CFRelease(airportPlist);
- }
-
- // remembered networks
- CWConfiguration *userConfig = [wifiInterface configuration];
- NSOrderedSet *networkProfiles = [userConfig networkProfiles];
- NSEnumerator *enumerator = [networkProfiles objectEnumerator];
- CWNetworkProfile *wProfile;
- while ((wProfile = [enumerator nextObject])) {
- QString networkName = QString::fromNSString([wProfile ssid]);
-
- if (!userProfiles.contains(networkName)) {
- QMap<QString,QString> map;
- map.insert(networkName, QString::fromNSString(nsInterfaceName));
- userProfiles.insert(networkName, map);
- }
- }
-
- // 802.1X user profiles
- QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
- NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:userProfilePath.toNSString()] autorelease];
- if(eapDict != nil) {
- NSString *profileStr= @"Profiles";
- NSString *nameStr = @"UserDefinedName";
- NSString *networkSsidStr = @"Wireless Network";
- for (id profileKey in eapDict) {
- if ([profileStr isEqualToString:profileKey]) {
- NSDictionary *itemDict = [eapDict objectForKey:profileKey];
- for (id itemKey in itemDict) {
-
- NSInteger dictSize = [itemKey count];
- id objects[dictSize];
- id keys[dictSize];
-
- [itemKey getObjects:objects andKeys:keys];
- QString networkName;
- QString ssid;
- for (int i = 0; i < dictSize; i++) {
- if([nameStr isEqualToString:keys[i]]) {
- networkName = QString::fromNSString(objects[i]);
- }
- if ([networkSsidStr isEqualToString:keys[i]]) {
- ssid = QString::fromNSString(objects[i]);
- }
- if (!userProfiles.contains(networkName)
- && !ssid.isEmpty()) {
- QMap<QString,QString> map;
- map.insert(ssid, QString::fromNSString(nsInterfaceName));
- userProfiles.insert(networkName, map);
- }
- }
- }
- }
- }
- }
- }
-}
-
-QString QScanThread::getSsidFromNetworkName(const QString &name) const
-{
- QMutexLocker locker(&mutex);
-
- for (auto i = userProfiles.cbegin(), end = userProfiles.cend(); i != end; ++i) {
- for (auto ij = i.value().cbegin(), end = i.value().cend(); ij != end; ++ij) {
- const QString networkNameHash = QString::number(qHash(QLatin1String("corewlan:") +i.key()));
- if(name == i.key() || name == networkNameHash) {
- return ij.key();
- }
- }
- }
- return QString();
-}
-
-QString QScanThread::getNetworkNameFromSsid(const QString &ssid) const
-{
- QMutexLocker locker(&mutex);
-
- for (auto i = userProfiles.cbegin(), end = userProfiles.cend(); i != end; ++i) {
- if (i.value().contains(ssid))
- return i.key();
- }
- return QString();
-}
-
-bool QScanThread::isKnownSsid(const QString &ssid) const
-{
- QMutexLocker locker(&mutex);
-
- for (auto i = userProfiles.cbegin(), end = userProfiles.cend(); i != end; ++i) {
- if (i.value().contains(ssid))
- return true;
- }
- return false;
-}
-
-
-QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
-: QBearerEngineImpl(parent), scanThread(0)
-{
- scanThread = new QScanThread(this);
- connect(scanThread, SIGNAL(networksChanged()),
- this, SLOT(networksChanged()));
-}
-
-QCoreWlanEngine::~QCoreWlanEngine()
-{
- scanThread->wait();
-
- qDeleteAll(qExchange(foundConfigurations, {}));
- [listener remove];
- [listener release];
-}
-
-void QCoreWlanEngine::initialize()
-{
- QMutexLocker locker(&mutex);
- QMacAutoReleasePool pool;
-
- if ([[CWWiFiClient interfaceNames] count] > 0 && !listener) {
- listener = [QNSListener alloc] init];
- listener.engine = this;
- hasWifi = true;
- } else {
- hasWifi = false;
- }
- storeSession = NULL;
-
- startNetworkChangeLoop();
-}
-
-
-QString QCoreWlanEngine::getInterfaceFromId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- return scanThread->configurationInterface.value(id);
-}
-
-bool QCoreWlanEngine::hasIdentifier(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- return scanThread->configurationInterface.contains(id);
-}
-
-void QCoreWlanEngine::connectToId(const QString &id)
-{
- QMutexLocker locker(&mutex);
- QMacAutoReleasePool pool;
- QString interfaceString = getInterfaceFromId(id);
-
- CWInterface *wifiInterface =
- [[CWWiFiClient sharedWiFiClient] interfaceWithName:interfaceString.toNSString()];
-
- if (wifiInterface.powerOn) {
- NSError *err = nil;
- QString wantedSsid;
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- const QString idHash = QString::number(qHash(QLatin1String("corewlan:") + ptr->name));
- const QString idHash2 = QString::number(qHash(QLatin1String("corewlan:") + scanThread->getNetworkNameFromSsid(ptr->name)));
-
- QString wantedNetwork;
- for (auto i = scanThread->userProfiles.cbegin(), end = scanThread->userProfiles.cend(); i != end; ++i) {
- wantedNetwork = i.key();
- const QString networkNameHash = QString::number(qHash(QLatin1String("corewlan:") + wantedNetwork));
- if (id == networkNameHash) {
- wantedSsid = scanThread->getSsidFromNetworkName(wantedNetwork);
- break;
- }
- }
-
- NSSet *scanSet = [wifiInterface scanForNetworksWithName:wantedSsid.toNSString() error:&err];
-
- if(!err) {
- for (CWNetwork *apNetwork in scanSet) {
- NSData *ssidData = [apNetwork ssidData];
- bool result = false;
-
- SecIdentityRef identity = 0;
- // Check first whether we require IEEE 802.1X authentication for the wanted SSID
- if (CWKeychainCopyWiFiEAPIdentity(kCWKeychainDomainSystem, ssidData, &identity) == errSecSuccess) {
- NSString *username = nil;
- NSString *password = nil;
- if (CWKeychainFindWiFiEAPUsernameAndPassword(kCWKeychainDomainSystem, ssidData, &username, &password) == errSecSuccess) {
- result = [wifiInterface associateToEnterpriseNetwork:apNetwork
- identity:identity username:(NSString *)username password:(NSString *)password
- error:&err];
- [username release];
- [password release];
- }
- CFRelease(identity);
- } else {
- NSString *password = nil;
- if (CWKeychainFindWiFiPassword(kCWKeychainDomainSystem, ssidData, &password) == errSecSuccess) {
- result = [wifiInterface associateToNetwork:apNetwork password:(NSString *)password error:&err];
- [password release];
- }
- }
-
- if (!err) {
- if (!result) {
- emit connectionError(id, ConnectError);
- } else {
- return;
- }
- } else {
- qDebug() <<"associate ERROR"<< QString::fromNSString([err localizedDescription ]);
- }
- } //end scan network
- } else {
- qDebug() <<"scan ERROR"<< QString::fromNSString([err localizedDescription ]);
- }
- emit connectionError(id, InterfaceLookupError);
- }
-
- locker.unlock();
- emit connectionError(id, InterfaceLookupError);
-}
-
-void QCoreWlanEngine::disconnectFromId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QString interfaceString = getInterfaceFromId(id);
- if (interfaceString.isEmpty()) {
- locker.unlock();
- emit connectionError(id, DisconnectionError);
- return;
- }
- QMacAutoReleasePool pool;
-
- CWInterface *wifiInterface =
- [[CWWiFiClient sharedWiFiClient] interfaceWithName:interfaceString.toNSString()];
- disconnectedInterfaceString = interfaceString;
-
- [wifiInterface disassociate];
-
- QTimer::singleShot(1000, this,SLOT(checkDisconnect()));
-}
-
-void QCoreWlanEngine::checkDisconnect()
-{
- QMutexLocker locker(&mutex);
- if (!disconnectedInterfaceString.isEmpty()) {
- QMacAutoReleasePool pool;
-
- CWInterface *wifiInterface = [[CWWiFiClient sharedWiFiClient]
- interfaceWithName:disconnectedInterfaceString.toNSString()];
-
- const QString networkSsid = QString::fromNSString([wifiInterface ssid]);
- if (!networkSsid.isEmpty()) {
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- locker.unlock();
- emit connectionError(id, DisconnectionError);
- locker.relock();
- }
- disconnectedInterfaceString.clear();
- }
-}
-
-void QCoreWlanEngine::requestUpdate()
-{
- scanThread->getUserConfigurations();
- doRequestUpdate();
-}
-
-void QCoreWlanEngine::doRequestUpdate()
-{
- QMutexLocker locker(&mutex);
-
- QMacAutoReleasePool pool;
-
- NSArray<NSString *> *wifiInterfaces = [CWWiFiClient interfaceNames];
- for (NSString *ifName in wifiInterfaces) {
- scanThread->interfaceName = QString::fromNSString(ifName);
- scanThread->start();
- }
- locker.unlock();
- if ([wifiInterfaces count] == 0)
- networksChanged();
-}
-
-bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
-{
- QMutexLocker locker(&mutex);
- bool haswifi = false;
- if(hasWifi) {
- QMacAutoReleasePool pool;
- CWInterface *defaultInterface = [[CWWiFiClient sharedWiFiClient]
- interfaceWithName:wifiDeviceName.toNSString()];
- if (defaultInterface.powerOn) {
- haswifi = true;
- }
- }
- return haswifi;
-}
-
-
-QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id)
-{
- QMutexLocker locker(&mutex);
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- if (!ptr)
- return QNetworkSession::Invalid;
-
- if (!ptr->isValid) {
- return QNetworkSession::Invalid;
- } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- return QNetworkSession::Connected;
- } else if ((ptr->state & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
- return QNetworkSession::Disconnected;
- } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
- return QNetworkSession::NotAvailable;
- } else if ((ptr->state & QNetworkConfiguration::Undefined) ==
- QNetworkConfiguration::Undefined) {
- return QNetworkSession::NotAvailable;
- }
-
- return QNetworkSession::Invalid;
-}
-
-QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const
-{
- return QNetworkConfigurationManager::ForcedRoaming;
-}
-
-void QCoreWlanEngine::startNetworkChangeLoop()
-{
-
- SCDynamicStoreContext dynStoreContext = { 0, this/*(void *)storeSession*/, NULL, NULL, NULL };
- storeSession = SCDynamicStoreCreate(NULL,
- CFSTR("networkChangeCallback"),
- networkChangeCallback,
- &dynStoreContext);
- if (!storeSession ) {
- qWarning() << "could not open dynamic store: error:" << SCErrorString(SCError());
- return;
- }
-
- CFMutableArrayRef notificationKeys;
- notificationKeys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
- CFMutableArrayRef patternsArray;
- patternsArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
- CFStringRef storeKey;
- storeKey = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
- kSCDynamicStoreDomainState,
- kSCEntNetIPv4);
- CFArrayAppendValue(notificationKeys, storeKey);
- CFRelease(storeKey);
-
- storeKey = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
- kSCDynamicStoreDomainState,
- kSCCompAnyRegex,
- kSCEntNetIPv4);
- CFArrayAppendValue(patternsArray, storeKey);
- CFRelease(storeKey);
-
- if (!SCDynamicStoreSetNotificationKeys(storeSession , notificationKeys, patternsArray)) {
- qWarning() << "register notification error:"<< SCErrorString(SCError());
- CFRelease(storeSession );
- CFRelease(notificationKeys);
- CFRelease(patternsArray);
- return;
- }
- CFRelease(notificationKeys);
- CFRelease(patternsArray);
-
- runloopSource = SCDynamicStoreCreateRunLoopSource(NULL, storeSession , 0);
- if (!runloopSource) {
- qWarning() << "runloop source error:"<< SCErrorString(SCError());
- CFRelease(storeSession );
- return;
- }
-
- CFRunLoopAddSource(CFRunLoopGetCurrent(), runloopSource, kCFRunLoopDefaultMode);
- return;
-}
-
-QNetworkSessionPrivate *QCoreWlanEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl;
-}
-
-QNetworkConfigurationPrivatePointer QCoreWlanEngine::defaultConfiguration()
-{
- return QNetworkConfigurationPrivatePointer();
-}
-
-bool QCoreWlanEngine::requiresPolling() const
-{
- return true;
-}
-
-void QCoreWlanEngine::networksChanged()
-{
- QMutexLocker locker(&mutex);
-
- QStringList previous = accessPointConfigurations.keys();
-
- QList<QNetworkConfigurationPrivate *> foundConfigurations = scanThread->getConfigurations();
- while (!foundConfigurations.isEmpty()) {
- QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst();
-
- previous.removeAll(cpPriv->id);
-
- if (accessPointConfigurations.contains(cpPriv->id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id);
-
- bool changed = false;
-
- ptr->mutex.lock();
-
- if (ptr->isValid != cpPriv->isValid) {
- ptr->isValid = cpPriv->isValid;
- changed = true;
- }
-
- if (ptr->name != cpPriv->name) {
- ptr->name = cpPriv->name;
- changed = true;
- }
-
- if (ptr->bearerType != cpPriv->bearerType) {
- ptr->bearerType = cpPriv->bearerType;
- changed = true;
- }
-
- if (ptr->state != cpPriv->state) {
- ptr->state = cpPriv->state;
- changed = true;
- }
-
- ptr->mutex.unlock();
-
- if (changed) {
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
-
- delete cpPriv;
- } else {
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
-
- accessPointConfigurations.insert(ptr->id, ptr);
-
- locker.unlock();
- emit configurationAdded(ptr);
- locker.relock();
- }
- }
-
- while (!previous.isEmpty()) {
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.take(previous.takeFirst());
-
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
-
- locker.unlock();
- emit updateCompleted();
-
-}
-
-quint64 QCoreWlanEngine::bytesWritten(const QString &id)
-{
- QMutexLocker locker(&mutex);
- const QString interfaceStr = getInterfaceFromId(id);
- return getBytes(interfaceStr,false);
-}
-
-quint64 QCoreWlanEngine::bytesReceived(const QString &id)
-{
- QMutexLocker locker(&mutex);
- const QString interfaceStr = getInterfaceFromId(id);
- return getBytes(interfaceStr,true);
-}
-
-quint64 QCoreWlanEngine::startTime(const QString &identifier)
-{
- QMutexLocker locker(&mutex);
- QMacAutoReleasePool pool;
- quint64 timestamp = 0;
-
- NSString *filePath = @"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist";
- NSDictionary* plistDict = [[[NSDictionary alloc] initWithContentsOfFile:filePath] autorelease];
- if(plistDict == nil)
- return timestamp;
- NSString *input = @"KnownNetworks";
- NSString *timeStampStr = @"_timeStamp";
-
- NSString *ssidStr = @"SSID_STR";
-
- for (id key in plistDict) {
- if ([input isEqualToString:key]) {
-
- NSDictionary *knownNetworksDict = [plistDict objectForKey:key];
- if(knownNetworksDict == nil)
- return timestamp;
- for (id networkKey in knownNetworksDict) {
- bool isFound = false;
- NSDictionary *itemDict = [knownNetworksDict objectForKey:networkKey];
- if(itemDict == nil)
- return timestamp;
- NSInteger dictSize = [itemDict count];
- id objects[dictSize];
- id keys[dictSize];
-
- [itemDict getObjects:objects andKeys:keys];
- bool ok = false;
- for(int i = 0; i < dictSize; i++) {
- if([ssidStr isEqualToString:keys[i]]) {
- const QString ident = QString::number(qHash(QLatin1String("corewlan:") + QString::fromNSString(objects[i])));
- if(ident == identifier) {
- ok = true;
- }
- }
- if(ok && [timeStampStr isEqualToString:keys[i]]) {
- timestamp = (quint64)[objects[i] timeIntervalSince1970];
- isFound = true;
- break;
- }
- }
- if(isFound)
- break;
- }
- }
- }
- return timestamp;
-}
-
-quint64 QCoreWlanEngine::getBytes(const QString &interfaceName, bool b)
-{
- struct ifaddrs *ifAddressList, *ifAddress;
- struct if_data *if_data;
-
- quint64 bytes = 0;
- ifAddressList = nil;
- if(getifaddrs(&ifAddressList) == 0) {
- for(ifAddress = ifAddressList; ifAddress; ifAddress = ifAddress->ifa_next) {
- if(interfaceName == ifAddress->ifa_name) {
- if_data = (struct if_data*)ifAddress->ifa_data;
- if(b) {
- bytes = if_data->ifi_ibytes;
- break;
- } else {
- bytes = if_data->ifi_obytes;
- break;
- }
- }
- }
- freeifaddrs(ifAddressList);
- }
- return bytes;
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/bearer/generic/CMakeLists.txt b/src/plugins/bearer/generic/CMakeLists.txt
deleted file mode 100644
index 6d65346b57..0000000000
--- a/src/plugins/bearer/generic/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Generated from generic.pro.
-
-#####################################################################
-## QGenericEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QGenericEnginePlugin
- OUTPUT_NAME qgenericbearer
- TYPE bearer
- SOURCES
- ../platformdefs_win.h
- main.cpp
- qgenericengine.cpp qgenericengine.h
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::NetworkPrivate
-)
-
-#### Keys ignored in scope 1:.:.:generic.pro:<TRUE>:
-# OTHER_FILES = "generic.json"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QGenericEnginePlugin CONDITION WIN32 AND NOT WINRT
- PUBLIC_LIBRARIES
- iphlpapi
-)
diff --git a/src/plugins/bearer/generic/generic.json b/src/plugins/bearer/generic/generic.json
deleted file mode 100644
index e9357f4c72..0000000000
--- a/src/plugins/bearer/generic/generic.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "generic" ]
-}
diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro
deleted file mode 100644
index 14b858b301..0000000000
--- a/src/plugins/bearer/generic/generic.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qgenericbearer
-
-QT = core-private network-private
-
-HEADERS += qgenericengine.h \
- ../platformdefs_win.h
-SOURCES += qgenericengine.cpp \
- main.cpp
-
-OTHER_FILES += generic.json
-
-win32:!winrt:LIBS += -liphlpapi
-
-PLUGIN_TYPE = bearer
-PLUGIN_CLASS_NAME = QGenericEnginePlugin
-load(qt_plugin)
diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp
deleted file mode 100644
index 82a9ce97f4..0000000000
--- a/src/plugins/bearer/generic/main.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgenericengine.h"
-
-#include <QtNetwork/private/qbearerplugin_p.h>
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGenericEnginePlugin : public QBearerEnginePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "generic.json")
-
-public:
- QGenericEnginePlugin();
- ~QGenericEnginePlugin();
-
- QBearerEngine *create(const QString &key) const override;
-};
-
-QGenericEnginePlugin::QGenericEnginePlugin()
-{
-}
-
-QGenericEnginePlugin::~QGenericEnginePlugin()
-{
-}
-
-QBearerEngine *QGenericEnginePlugin::create(const QString &key) const
-{
- if (key == QLatin1String("generic"))
- return new QGenericEngine;
- else
- return 0;
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
deleted file mode 100644
index a5fba15789..0000000000
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ /dev/null
@@ -1,446 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// see comment in ../platformdefs_win.h.
-#define WIN32_LEAN_AND_MEAN 1
-
-#include "qgenericengine.h"
-#include <private/qnetworksession_impl_p.h>
-
-#include <QtNetwork/private/qnetworkconfiguration_p.h>
-
-#include <QtCore/qthread.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qstringlist.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/private/qcoreapplication_p.h>
-
-#if defined(Q_OS_WIN32)
-// PMIB_TCPTABLE2 is only available since Vista
-#if _WIN32_WINNT < 0x0601
-# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0601
-#endif // _WIN32_WINNT < 0x0601
-#include "../platformdefs_win.h"
-#include <iphlpapi.h>
-#endif
-
-#ifdef Q_OS_WINRT
-#include <qfunctions_winrt.h>
-
-#include <wrl.h>
-#include <windows.foundation.h>
-#include <windows.foundation.collections.h>
-#include <windows.networking.connectivity.h>
-
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-using namespace ABI::Windows::Foundation;
-using namespace ABI::Windows::Foundation::Collections;
-using namespace ABI::Windows::Networking;
-using namespace ABI::Windows::Networking::Connectivity;
-#endif // Q_OS_WINRT
-
-// needed as interface is used as parameter name in qGetInterfaceType
-#undef interface
-
-#ifdef Q_OS_LINUX
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <unistd.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_NETWORKINTERFACE
-static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface)
-{
-#if defined(Q_OS_WIN32)
- // QNetworkInterface::name returns a more friendly name on Windows. That name is not
- // accepted as an identifier for CreateFile so we have to obtain the Luid.
- std::wstring buf = interface.toStdWString();
- if (buf.size() == 0)
- return QNetworkConfiguration::BearerUnknown;
-
- NET_LUID luid;
- NETIO_STATUS status = ConvertInterfaceNameToLuidW(buf.c_str(), &luid);
- if (status != NO_ERROR)
- return QNetworkConfiguration::BearerUnknown;
-
- switch (luid.Info.IfType) {
- case IF_TYPE_ETHERNET_CSMACD:
- case IF_TYPE_ISO88025_TOKENRING:
- case IF_TYPE_PPP:
- case IF_TYPE_SOFTWARE_LOOPBACK:
- return QNetworkConfiguration::BearerEthernet;
- case IF_TYPE_IEEE80211:
- return QNetworkConfiguration::BearerWLAN;
- case IF_TYPE_ATM:
- case IF_TYPE_IEEE1394:
- case IF_TYPE_OTHER:
- case IF_TYPE_TUNNEL:
- return QNetworkConfiguration::BearerUnknown;
- default:
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Interface Type" << luid.Info.IfType;
-#endif
- return QNetworkConfiguration::BearerUnknown;
- }
- return QNetworkConfiguration::BearerUnknown;
-
-#elif defined(Q_OS_LINUX)
- int sock = socket(AF_INET, SOCK_DGRAM, 0);
-
- ifreq request;
- strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name) - 1);
- request.ifr_name[sizeof(request.ifr_name) - 1] = '\0';
- int result = ioctl(sock, SIOCGIFHWADDR, &request);
- close(sock);
-
- if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER)
- return QNetworkConfiguration::BearerEthernet;
-#elif defined(Q_OS_WINRT)
- ComPtr<INetworkInformationStatics> networkInfoStatics;
- HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &networkInfoStatics);
- Q_ASSERT_SUCCEEDED(hr);
- ComPtr<IVectorView<ConnectionProfile *>> connectionProfiles;
- hr = networkInfoStatics->GetConnectionProfiles(&connectionProfiles);
- Q_ASSERT_SUCCEEDED(hr);
- if (!connectionProfiles)
- return QNetworkConfiguration::BearerUnknown;
-
- unsigned int size;
- hr = connectionProfiles->get_Size(&size);
- Q_ASSERT_SUCCEEDED(hr);
- for (unsigned int i = 0; i < size; ++i) {
- ComPtr<IConnectionProfile> profile;
- hr = connectionProfiles->GetAt(i, &profile);
- Q_ASSERT_SUCCEEDED(hr);
-
- ComPtr<INetworkAdapter> adapter;
- hr = profile->get_NetworkAdapter(&adapter);
- // Indicates that no internet connection is available/the device is in airplane mode
- if (hr == E_INVALIDARG)
- return QNetworkConfiguration::BearerUnknown;
- Q_ASSERT_SUCCEEDED(hr);
- GUID id;
- hr = adapter->get_NetworkAdapterId(&id);
- Q_ASSERT_SUCCEEDED(hr);
- OLECHAR adapterName[39]={0};
- int length = StringFromGUID2(id, adapterName, 39);
- // "length - 1" as we have to remove the null terminator from it in order to compare
- if (!length
- || QString::fromRawData(reinterpret_cast<const QChar *>(adapterName), length - 1) != interface)
- continue;
-
- ComPtr<IConnectionProfile2> profile2;
- hr = profile.As(&profile2);
- Q_ASSERT_SUCCEEDED(hr);
- boolean isWLan;
- hr = profile2->get_IsWlanConnectionProfile(&isWLan);
- Q_ASSERT_SUCCEEDED(hr);
- if (isWLan)
- return QNetworkConfiguration::BearerWLAN;
-
- boolean isWWan;
- hr = profile2->get_IsWwanConnectionProfile(&isWWan);
- Q_ASSERT_SUCCEEDED(hr);
- if (isWWan) {
- ComPtr<IWwanConnectionProfileDetails> details;
- hr = profile2->get_WwanConnectionProfileDetails(&details);
- Q_ASSERT_SUCCEEDED(hr);
- WwanDataClass dataClass;
- hr = details->GetCurrentDataClass(&dataClass);
- Q_ASSERT_SUCCEEDED(hr);
- switch (dataClass) {
- case WwanDataClass_Edge:
- case WwanDataClass_Gprs:
- return QNetworkConfiguration::Bearer2G;
- case WwanDataClass_Umts:
- return QNetworkConfiguration::BearerWCDMA;
- case WwanDataClass_LteAdvanced:
- return QNetworkConfiguration::BearerLTE;
- case WwanDataClass_Hsdpa:
- case WwanDataClass_Hsupa:
- return QNetworkConfiguration::BearerHSPA;
- case WwanDataClass_Cdma1xRtt:
- case WwanDataClass_Cdma3xRtt:
- case WwanDataClass_CdmaUmb:
- return QNetworkConfiguration::BearerCDMA2000;
- case WwanDataClass_Cdma1xEvdv:
- case WwanDataClass_Cdma1xEvdo:
- case WwanDataClass_Cdma1xEvdoRevA:
- case WwanDataClass_Cdma1xEvdoRevB:
- return QNetworkConfiguration::BearerEVDO;
- case WwanDataClass_Custom:
- case WwanDataClass_None:
- default:
- return QNetworkConfiguration::BearerUnknown;
- }
- }
- return QNetworkConfiguration::BearerEthernet;
- }
-#else
- Q_UNUSED(interface);
-#endif
-
- return QNetworkConfiguration::BearerUnknown;
-}
-#endif
-
-QGenericEngine::QGenericEngine(QObject *parent)
-: QBearerEngineImpl(parent)
-{
- //workaround for deadlock in __cxa_guard_acquire with webkit on macos x
- //initialise the Q_GLOBAL_STATIC in same thread as the AtomicallyInitializedStatic
- (void)QNetworkInterface::interfaceFromIndex(0);
-}
-
-QGenericEngine::~QGenericEngine()
-{
-}
-
-QString QGenericEngine::getInterfaceFromId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- return configurationInterface.value(id);
-}
-
-bool QGenericEngine::hasIdentifier(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- return configurationInterface.contains(id);
-}
-
-void QGenericEngine::connectToId(const QString &id)
-{
- emit connectionError(id, OperationNotSupported);
-}
-
-void QGenericEngine::disconnectFromId(const QString &id)
-{
- emit connectionError(id, OperationNotSupported);
-}
-
-void QGenericEngine::initialize()
-{
- doRequestUpdate();
-}
-
-void QGenericEngine::requestUpdate()
-{
- doRequestUpdate();
-}
-
-void QGenericEngine::doRequestUpdate()
-{
-#ifndef QT_NO_NETWORKINTERFACE
- QMutexLocker locker(&mutex);
-
- // Immediately after connecting with a wireless access point
- // QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a
- // second time results in a non-empty list. If we loose interfaces we will end up removing
- // network configurations which will break current sessions.
- QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
- if (interfaces.isEmpty())
- interfaces = QNetworkInterface::allInterfaces();
-
- QStringList previous = accessPointConfigurations.keys();
-
- // create configuration for each interface
- while (!interfaces.isEmpty()) {
- QNetworkInterface interface = interfaces.takeFirst();
-
- if (!interface.isValid())
- continue;
-
- // ignore loopback interface
- if (interface.flags() & QNetworkInterface::IsLoopBack)
- continue;
-
-#ifndef Q_OS_WIN
- // ignore WLAN interface handled in separate engine
- if (qGetInterfaceType(interface.name()) == QNetworkConfiguration::BearerWLAN)
- continue;
-#endif
-
- uint identifier;
- if (interface.index())
- identifier = qHash(QLatin1String("generic:") + QString::number(interface.index()));
- else
- identifier = qHash(QLatin1String("generic:") + interface.hardwareAddress());
-
- const QString id = QString::number(identifier);
-
- previous.removeAll(id);
-
- QString name = interface.humanReadableName();
- if (name.isEmpty())
- name = interface.name();
-
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined;
- if ((interface.flags() & QNetworkInterface::IsRunning) && !interface.addressEntries().isEmpty())
- state |= QNetworkConfiguration::Active;
-
- if (accessPointConfigurations.contains(id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- bool changed = false;
-
- ptr->mutex.lock();
-
- if (!ptr->isValid) {
- ptr->isValid = true;
- changed = true;
- }
-
- if (ptr->name != name) {
- ptr->name = name;
- changed = true;
- }
-
- if (ptr->id != id) {
- ptr->id = id;
- changed = true;
- }
-
- if (ptr->state != state) {
- ptr->state = state;
- changed = true;
- }
-
- ptr->mutex.unlock();
-
- if (changed) {
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
-
- ptr->name = name;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearerType = qGetInterfaceType(interface.name());
-
- accessPointConfigurations.insert(id, ptr);
- configurationInterface.insert(id, interface.name());
-
- locker.unlock();
- emit configurationAdded(ptr);
- locker.relock();
- }
- }
-
- while (!previous.isEmpty()) {
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.take(previous.takeFirst());
-
- configurationInterface.remove(ptr->id);
-
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
-
- locker.unlock();
-#endif
-
- emit updateCompleted();
-}
-
-QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- if (!ptr)
- return QNetworkSession::Invalid;
-
- QMutexLocker configLocker(&ptr->mutex);
-
- if (!ptr->isValid) {
- return QNetworkSession::Invalid;
- } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- return QNetworkSession::Connected;
- } else if ((ptr->state & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
- return QNetworkSession::Disconnected;
- } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
- return QNetworkSession::NotAvailable;
- } else if ((ptr->state & QNetworkConfiguration::Undefined) ==
- QNetworkConfiguration::Undefined) {
- return QNetworkSession::NotAvailable;
- }
-
- return QNetworkSession::Invalid;
-}
-
-QNetworkConfigurationManager::Capabilities QGenericEngine::capabilities() const
-{
- return QNetworkConfigurationManager::ForcedRoaming;
-}
-
-QNetworkSessionPrivate *QGenericEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl;
-}
-
-QNetworkConfigurationPrivatePointer QGenericEngine::defaultConfiguration()
-{
- return QNetworkConfigurationPrivatePointer();
-}
-
-
-bool QGenericEngine::requiresPolling() const
-{
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
deleted file mode 100644
index 6b8fb4cd0f..0000000000
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGENERICENGINE_H
-#define QGENERICENGINE_H
-
-#include <private/qbearerengine_impl_p.h>
-
-#include <QMap>
-#include <QTimer>
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfigurationPrivate;
-class QNetworkSessionPrivate;
-
-class QGenericEngine : public QBearerEngineImpl
-{
- Q_OBJECT
-
-public:
- QGenericEngine(QObject *parent = nullptr);
- ~QGenericEngine();
-
- QString getInterfaceFromId(const QString &id) override;
- bool hasIdentifier(const QString &id) override;
-
- void connectToId(const QString &id) override;
- void disconnectFromId(const QString &id) override;
-
- Q_INVOKABLE void initialize();
- Q_INVOKABLE void requestUpdate();
-
- QNetworkSession::State sessionStateForId(const QString &id) override;
-
- QNetworkConfigurationManager::Capabilities capabilities() const override;
-
- QNetworkSessionPrivate *createSessionBackend() override;
-
- QNetworkConfigurationPrivatePointer defaultConfiguration() override;
-
- bool requiresPolling() const override;
-
-private Q_SLOTS:
- void doRequestUpdate();
-
-private:
- QMap<QString, QString> configurationInterface;
-};
-
-QT_END_NAMESPACE
-
-#endif
-
diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp
deleted file mode 100644
index 826c0104e4..0000000000
--- a/src/plugins/bearer/nativewifi/main.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnativewifiengine.h"
-#include "platformdefs.h"
-
-#include <QtCore/qmutex.h>
-#include <QtCore/qlibrary.h>
-
-#include <QtNetwork/private/qbearerplugin_p.h>
-
-#include <QtCore/qdebug.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-static bool resolveLibraryInternal()
-{
- QLibrary wlanapiLib(QLatin1String("wlanapi"));
- local_WlanOpenHandle = (WlanOpenHandleProto)
- wlanapiLib.resolve("WlanOpenHandle");
- local_WlanRegisterNotification = (WlanRegisterNotificationProto)
- wlanapiLib.resolve("WlanRegisterNotification");
- local_WlanEnumInterfaces = (WlanEnumInterfacesProto)
- wlanapiLib.resolve("WlanEnumInterfaces");
- local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto)
- wlanapiLib.resolve("WlanGetAvailableNetworkList");
- local_WlanQueryInterface = (WlanQueryInterfaceProto)
- wlanapiLib.resolve("WlanQueryInterface");
- local_WlanConnect = (WlanConnectProto)
- wlanapiLib.resolve("WlanConnect");
- local_WlanDisconnect = (WlanDisconnectProto)
- wlanapiLib.resolve("WlanDisconnect");
- local_WlanScan = (WlanScanProto)
- wlanapiLib.resolve("WlanScan");
- local_WlanFreeMemory = (WlanFreeMemoryProto)
- wlanapiLib.resolve("WlanFreeMemory");
- local_WlanCloseHandle = (WlanCloseHandleProto)
- wlanapiLib.resolve("WlanCloseHandle");
- return true;
-}
-Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal()))
-
-class QNativeWifiEnginePlugin : public QBearerEnginePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "nativewifi.json")
-
-public:
- QNativeWifiEnginePlugin();
- ~QNativeWifiEnginePlugin();
-
- QBearerEngine *create(const QString &key) const;
-};
-
-QNativeWifiEnginePlugin::QNativeWifiEnginePlugin()
-{
-}
-
-QNativeWifiEnginePlugin::~QNativeWifiEnginePlugin()
-{
-}
-
-QBearerEngine *QNativeWifiEnginePlugin::create(const QString &key) const
-{
- if (key != QLatin1String("nativewifi"))
- return 0;
-
- resolveLibrary();
-
- // native wifi dll not available
- if (!local_WlanOpenHandle)
- return 0;
-
- QNativeWifiEngine *engine = new QNativeWifiEngine;
-
- // could not initialise subsystem
- if (engine && !engine->available()) {
- delete engine;
- return 0;
- }
-
- return engine;
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/nativewifi/nativewifi.json b/src/plugins/bearer/nativewifi/nativewifi.json
deleted file mode 100644
index f3db199150..0000000000
--- a/src/plugins/bearer/nativewifi/nativewifi.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "nativewifi" ]
-}
diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro
deleted file mode 100644
index 41bde99341..0000000000
--- a/src/plugins/bearer/nativewifi/nativewifi.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-TARGET = qnativewifibearer
-
-QT = core-private network-private
-
-HEADERS += qnativewifiengine.h \
- platformdefs.h
-
-SOURCES += main.cpp \
- qnativewifiengine.cpp
-
-OTHER_FILES += nativewifi.json
-
-PLUGIN_TYPE = bearer
-PLUGIN_CLASS_NAME = QNativeWifiEnginePlugin
-load(qt_plugin)
diff --git a/src/plugins/bearer/nativewifi/platformdefs.h b/src/plugins/bearer/nativewifi/platformdefs.h
deleted file mode 100644
index b8ac40af15..0000000000
--- a/src/plugins/bearer/nativewifi/platformdefs.h
+++ /dev/null
@@ -1,327 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PLATFORMDEFS_H
-#define PLATFORMDEFS_H
-
-#include <wtypes.h>
-#undef interface
-
-//proper header is wlanapi.h, but that is not included in windows XP
-
-#define WLAN_MAX_NAME_LENGTH 256
-#define WLAN_MAX_PHY_TYPE_NUMBER 8
-#define WLAN_NOTIFICATION_SOURCE_ACM 0x00000008
-#define WLAN_NOTIFICATION_SOURCE_ALL 0x0000ffff
-#define WLAN_AVAILABLE_NETWORK_CONNECTED 1
-#define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 2
-#define DOT11_SSID_MAX_LENGTH 32
-
-QT_BEGIN_NAMESPACE
-
-struct WLAN_NOTIFICATION_DATA {
- DWORD NotificationSource;
- DWORD NotificationCode;
- GUID InterfaceGuid;
- DWORD dwDataSize;
- PVOID pData;
-};
-
-enum WLAN_INTERFACE_STATE {
- wlan_interface_state_not_ready = 0,
- wlan_interface_state_connected,
- wlan_interface_state_ad_hoc_network_formed,
- wlan_interface_state_disconnecting,
- wlan_interface_state_disconnected,
- wlan_interface_state_associating,
- wlan_interface_state_discovering,
- wlan_interface_state_authenticating
-};
-
-struct WLAN_INTERFACE_INFO {
- GUID InterfaceGuid;
- WCHAR strInterfaceDescription[WLAN_MAX_NAME_LENGTH];
- WLAN_INTERFACE_STATE isState;
-};
-
-struct WLAN_INTERFACE_INFO_LIST {
- DWORD dwNumberOfItems;
- DWORD dwIndex;
- WLAN_INTERFACE_INFO InterfaceInfo[1];
-};
-
-struct DOT11_SSID {
- ULONG uSSIDLength;
- UCHAR ucSSID[DOT11_SSID_MAX_LENGTH];
-};
-
-struct NDIS_OBJECT_HEADER {
- UCHAR Type;
- UCHAR Revision;
- USHORT Size;
-};
-
-typedef UCHAR DOT11_MAC_ADDRESS[6];
-struct DOT11_BSSID_LIST {
- NDIS_OBJECT_HEADER Header;
- ULONG uNumberOfEntries;
- ULONG uTotalNumOfEntries;
- DOT11_MAC_ADDRESS BSSIDs[1];
-};
-
-enum DOT11_BSS_TYPE {
- dot11_BSS_type_infrastructure = 1,
- dot11_BSS_type_independent = 2,
- dot11_BSS_type_any = 3
-};
-
-enum DOT11_PHY_TYPE {
- dot11_phy_type_unknown = 0,
- dot11_phy_type_any = dot11_phy_type_unknown,
- dot11_phy_type_fhss = 1,
- dot11_phy_type_dsss = 2,
- dot11_phy_type_irbaseband = 3,
- dot11_phy_type_ofdm = 4,
- dot11_phy_type_hrdsss = 5,
- dot11_phy_type_erp = 6,
- dot11_phy_type_ht = 7,
- dot11_phy_type_IHV_start = 0x80000000,
- dot11_phy_type_IHV_end = 0xffffffff
-};
-
-enum DOT11_AUTH_ALGORITHM {
- DOT11_AUTH_ALGO_80211_OPEN = 1,
- DOT11_AUTH_ALGO_80211_SHARED_KEY = 2,
- DOT11_AUTH_ALGO_WPA = 3,
- DOT11_AUTH_ALGO_WPA_PSK = 4,
- DOT11_AUTH_ALGO_WPA_NONE = 5,
- DOT11_AUTH_ALGO_RSNA = 6,
- DOT11_AUTH_ALGO_RSNA_PSK = 7,
- DOT11_AUTH_ALGO_IHV_START = 0x80000000,
- DOT11_AUTH_ALGO_IHV_END = 0xffffffff
-};
-
-enum DOT11_CIPHER_ALGORITHM {
- DOT11_CIPHER_ALGO_NONE = 0x00,
- DOT11_CIPHER_ALGO_WEP40 = 0x01,
- DOT11_CIPHER_ALGO_TKIP = 0x02,
- DOT11_CIPHER_ALGO_CCMP = 0x04,
- DOT11_CIPHER_ALGO_WEP104 = 0x05,
- DOT11_CIPHER_ALGO_WPA_USE_GROUP = 0x100,
- DOT11_CIPHER_ALGO_RSN_USE_GROUP = 0x100,
- DOT11_CIPHER_ALGO_WEP = 0x101,
- DOT11_CIPHER_ALGO_IHV_START = 0x80000000,
- DOT11_CIPHER_ALGO_IHV_END = 0xffffffff
-};
-
-struct WLAN_AVAILABLE_NETWORK {
- WCHAR strProfileName[WLAN_MAX_NAME_LENGTH];
- DOT11_SSID dot11Ssid;
- DOT11_BSS_TYPE dot11BssType;
- ULONG uNumberOfBssids;
- BOOL bNetworkConnectable;
- DWORD wlanNotConnectableReason;
- ULONG uNumberOfPhyTypes;
- DOT11_PHY_TYPE dot11PhyTypes[WLAN_MAX_PHY_TYPE_NUMBER];
- BOOL bMorePhyTypes;
- ULONG wlanSignalQuality;
- BOOL bSecurityEnabled;
- DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm;
- DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm;
- DWORD dwFlags;
- DWORD dwReserved;
-};
-
-struct WLAN_AVAILABLE_NETWORK_LIST {
- DWORD dwNumberOfItems;
- DWORD dwIndex;
- WLAN_AVAILABLE_NETWORK Network[1];
-};
-
-enum WLAN_INTF_OPCODE {
- wlan_intf_opcode_autoconf_start = 0x000000000,
- wlan_intf_opcode_autoconf_enabled,
- wlan_intf_opcode_background_scan_enabled,
- wlan_intf_opcode_media_streaming_mode,
- wlan_intf_opcode_radio_state,
- wlan_intf_opcode_bss_type,
- wlan_intf_opcode_interface_state,
- wlan_intf_opcode_current_connection,
- wlan_intf_opcode_channel_number,
- wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs,
- wlan_intf_opcode_supported_adhoc_auth_cipher_pairs,
- wlan_intf_opcode_supported_country_or_region_string_list,
- wlan_intf_opcode_current_operation_mode,
- wlan_intf_opcode_supported_safe_mode,
- wlan_intf_opcode_certified_safe_mode,
- wlan_intf_opcode_autoconf_end = 0x0fffffff,
- wlan_intf_opcode_msm_start = 0x10000100,
- wlan_intf_opcode_statistics,
- wlan_intf_opcode_rssi,
- wlan_intf_opcode_msm_end = 0x1fffffff,
- wlan_intf_opcode_security_start = 0x20010000,
- wlan_intf_opcode_security_end = 0x2fffffff,
- wlan_intf_opcode_ihv_start = 0x30000000,
- wlan_intf_opcode_ihv_end = 0x3fffffff
-};
-
-enum WLAN_OPCODE_VALUE_TYPE {
- wlan_opcode_value_type_query_only = 0,
- wlan_opcode_value_type_set_by_group_policy,
- wlan_opcode_value_type_set_by_user,
- wlan_opcode_value_type_invalid
-};
-
-enum WLAN_CONNECTION_MODE {
- wlan_connection_mode_profile = 0,
- wlan_connection_mode_temporary_profile,
- wlan_connection_mode_discovery_secure,
- wlan_connection_mode_discovery_unsecure,
- wlan_connection_mode_auto,
- wlan_connection_mode_invalid
-};
-
-struct WLAN_CONNECTION_PARAMETERS {
- WLAN_CONNECTION_MODE wlanConnectionMode;
- LPCWSTR strProfile;
- DOT11_SSID *pDot11Ssid;
- DOT11_BSSID_LIST *pDesiredBssidList;
- DOT11_BSS_TYPE dot11BssType;
- DWORD dwFlags;
-};
-
-struct WLAN_RAW_DATA {
- DWORD dwDataSize;
- BYTE DataBlob[1];
-};
-
-enum WLAN_NOTIFICATION_ACM {
- wlan_notification_acm_start = 0,
- wlan_notification_acm_autoconf_enabled,
- wlan_notification_acm_autoconf_disabled,
- wlan_notification_acm_background_scan_enabled,
- wlan_notification_acm_background_scan_disabled,
- wlan_notification_acm_bss_type_change,
- wlan_notification_acm_power_setting_change,
- wlan_notification_acm_scan_complete,
- wlan_notification_acm_scan_fail,
- wlan_notification_acm_connection_start,
- wlan_notification_acm_connection_complete,
- wlan_notification_acm_connection_attempt_fail,
- wlan_notification_acm_filter_list_change,
- wlan_notification_acm_interface_arrival,
- wlan_notification_acm_interface_removal,
- wlan_notification_acm_profile_change,
- wlan_notification_acm_profile_name_change,
- wlan_notification_acm_profiles_exhausted,
- wlan_notification_acm_network_not_available,
- wlan_notification_acm_network_available,
- wlan_notification_acm_disconnecting,
- wlan_notification_acm_disconnected,
- wlan_notification_acm_adhoc_network_state_change,
- wlan_notification_acm_end
-};
-
-struct WLAN_ASSOCIATION_ATTRIBUTES {
- DOT11_SSID dot11Ssid;
- DOT11_BSS_TYPE dot11BssType;
- DOT11_MAC_ADDRESS dot11Bssid;
- DOT11_PHY_TYPE dot11PhyType;
- ULONG uDot11PhyIndex;
- ULONG wlanSignalQuality;
- ULONG ulRxRate;
- ULONG ulTxRate;
-};
-
-struct WLAN_SECURITY_ATTRIBUTES {
- BOOL bSecurityEnabled;
- BOOL bOneXEnabled;
- DOT11_AUTH_ALGORITHM dot11AuthAlgorithm;
- DOT11_CIPHER_ALGORITHM dot11CipherAlgorithm;
-};
-
-struct WLAN_CONNECTION_ATTRIBUTES {
- WLAN_INTERFACE_STATE isState;
- WLAN_CONNECTION_MODE wlanConnectionMode;
- WCHAR strProfileName[WLAN_MAX_NAME_LENGTH];
- WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes;
- WLAN_SECURITY_ATTRIBUTES wlanSecurityAttributes;
-};
-
-typedef void (WINAPI *WLAN_NOTIFICATION_CALLBACK)(WLAN_NOTIFICATION_DATA *, PVOID);
-
-typedef DWORD (WINAPI *WlanOpenHandleProto)
- (DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, PHANDLE phClientHandle);
-typedef DWORD (WINAPI *WlanRegisterNotificationProto)
- (HANDLE hClientHandle, DWORD dwNotifSource, BOOL bIgnoreDuplicate,
- WLAN_NOTIFICATION_CALLBACK funcCallback, PVOID pCallbackContext,
- PVOID pReserved, PDWORD pdwPrevNotifSource);
-typedef DWORD (WINAPI *WlanEnumInterfacesProto)
- (HANDLE hClientHandle, PVOID pReserved, WLAN_INTERFACE_INFO_LIST **ppInterfaceList);
-typedef DWORD (WINAPI *WlanGetAvailableNetworkListProto)
- (HANDLE hClientHandle, const GUID* pInterfaceGuid, DWORD dwFlags, PVOID pReserved,
- WLAN_AVAILABLE_NETWORK_LIST **ppAvailableNetworkList);
-typedef DWORD (WINAPI *WlanQueryInterfaceProto)
- (HANDLE hClientHandle, const GUID *pInterfaceGuid, WLAN_INTF_OPCODE OpCode, PVOID pReserved,
- PDWORD pdwDataSize, PVOID *ppData, WLAN_OPCODE_VALUE_TYPE *pWlanOpcodeValueType);
-typedef DWORD (WINAPI *WlanConnectProto)
- (HANDLE hClientHandle, const GUID *pInterfaceGuid,
- const WLAN_CONNECTION_PARAMETERS *pConnectionParameters, PVOID pReserved);
-typedef DWORD (WINAPI *WlanDisconnectProto)
- (HANDLE hClientHandle, const GUID *pInterfaceGuid, PVOID pReserved);
-typedef DWORD (WINAPI *WlanScanProto)
- (HANDLE hClientHandle, const GUID *pInterfaceGuid, const DOT11_SSID *pDot11Ssid,
- const WLAN_RAW_DATA *pIeData, PVOID pReserved);
-typedef VOID (WINAPI *WlanFreeMemoryProto)(PVOID pMemory);
-typedef DWORD (WINAPI *WlanCloseHandleProto)(HANDLE hClientHandle, PVOID pReserved);
-
-extern WlanOpenHandleProto local_WlanOpenHandle;
-extern WlanRegisterNotificationProto local_WlanRegisterNotification;
-extern WlanEnumInterfacesProto local_WlanEnumInterfaces;
-extern WlanGetAvailableNetworkListProto local_WlanGetAvailableNetworkList;
-extern WlanQueryInterfaceProto local_WlanQueryInterface;
-extern WlanConnectProto local_WlanConnect;
-extern WlanDisconnectProto local_WlanDisconnect;
-extern WlanScanProto local_WlanScan;
-extern WlanFreeMemoryProto local_WlanFreeMemory;
-extern WlanCloseHandleProto local_WlanCloseHandle;
-
-QT_END_NAMESPACE
-
-#endif // PLATFORMDEFS_H
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
deleted file mode 100644
index ca8700e63b..0000000000
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ /dev/null
@@ -1,622 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnativewifiengine.h"
-#include "platformdefs.h"
-#include <private/qnetworksession_impl_p.h>
-
-#include <QtNetwork/private/qnetworkconfiguration_p.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qoperatingsystemversion.h>
-
-#include <QtCore/qdebug.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-WlanOpenHandleProto local_WlanOpenHandle = 0;
-WlanRegisterNotificationProto local_WlanRegisterNotification = 0;
-WlanEnumInterfacesProto local_WlanEnumInterfaces = 0;
-WlanGetAvailableNetworkListProto local_WlanGetAvailableNetworkList = 0;
-WlanQueryInterfaceProto local_WlanQueryInterface = 0;
-WlanConnectProto local_WlanConnect = 0;
-WlanDisconnectProto local_WlanDisconnect = 0;
-WlanScanProto local_WlanScan = 0;
-WlanFreeMemoryProto local_WlanFreeMemory = 0;
-WlanCloseHandleProto local_WlanCloseHandle = 0;
-
-void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d)
-{
- Q_UNUSED(d);
-
- if (data->NotificationSource == WLAN_NOTIFICATION_SOURCE_ACM) {
- switch (data->NotificationCode) {
- case wlan_notification_acm_connection_complete:
- case wlan_notification_acm_disconnected:
- case wlan_notification_acm_scan_complete:
- case wlan_notification_acm_scan_fail:
- QMetaObject::invokeMethod(d, "scanComplete", Qt::QueuedConnection);
- break;
- default:
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "wlan acm notification" << (int)data->NotificationCode;
-#endif
- break;
- }
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "wlan notification source" << (int)data->NotificationSource << "code" << (int)data->NotificationCode;
-#endif
- }
-}
-
-QNativeWifiEngine::QNativeWifiEngine(QObject *parent)
-: QBearerEngineImpl(parent), handle(INVALID_HANDLE_VALUE)
-{
- connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(closeHandle()));
-}
-
-QNativeWifiEngine::~QNativeWifiEngine()
-{
- closeHandle();
-}
-
-void QNativeWifiEngine::scanComplete()
-{
- QMutexLocker locker(&mutex);
-
- if (!available()) {
- locker.unlock();
- emit updateCompleted();
- return;
- }
-
- // enumerate interfaces
- WLAN_INTERFACE_INFO_LIST *interfaceList;
- DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
-#endif
-
- locker.unlock();
- emit updateCompleted();
-
- return;
- }
-
- QStringList previous = accessPointConfigurations.keys();
-
- for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) {
- const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i];
-
- WLAN_AVAILABLE_NETWORK_LIST *networkList;
- result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid,
- 3, 0, &networkList);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n",
- __FUNCTION__, result);
-#endif
- continue;
- }
-
- QStringList seenNetworks;
-
- for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) {
- WLAN_AVAILABLE_NETWORK &network = networkList->Network[j];
-
- QString networkName;
-
- if (network.strProfileName[0] != 0) {
- networkName = QString::fromWCharArray(network.strProfileName);
- } else {
- networkName = QByteArray(reinterpret_cast<char *>(network.dot11Ssid.ucSSID),
- network.dot11Ssid.uSSIDLength);
- }
-
- const QString id = QString::number(qHash(QLatin1String("WLAN:") + networkName));
-
- previous.removeAll(id);
-
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
-
- if (!(network.dwFlags & WLAN_AVAILABLE_NETWORK_HAS_PROFILE))
- state = QNetworkConfiguration::Undefined;
-
- if (network.strProfileName[0] != 0) {
- if (network.bNetworkConnectable) {
- if (network.dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED)
- state = QNetworkConfiguration::Active;
- else
- state = QNetworkConfiguration::Discovered;
- } else {
- state = QNetworkConfiguration::Defined;
- }
- }
-
- if (seenNetworks.contains(networkName))
- continue;
- else
- seenNetworks.append(networkName);
-
- if (accessPointConfigurations.contains(id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- bool changed = false;
-
- ptr->mutex.lock();
-
- if (!ptr->isValid) {
- ptr->isValid = true;
- changed = true;
- }
-
- if (ptr->name != networkName) {
- ptr->name = networkName;
- changed = true;
- }
-
- if (ptr->state != state) {
- ptr->state = state;
- changed = true;
- }
-
- ptr->mutex.unlock();
-
- if (changed) {
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
-
- ptr->name = networkName;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearerType = QNetworkConfiguration::BearerWLAN;
-
- accessPointConfigurations.insert(id, ptr);
-
- locker.unlock();
- emit configurationAdded(ptr);
- locker.relock();
- }
- }
-
- local_WlanFreeMemory(networkList);
- }
-
- local_WlanFreeMemory(interfaceList);
-
- while (!previous.isEmpty()) {
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.take(previous.takeFirst());
-
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
-
- locker.unlock();
- emit updateCompleted();
-}
-
-QString QNativeWifiEngine::getInterfaceFromId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- if (!available())
- return QString();
-
- // enumerate interfaces
- WLAN_INTERFACE_INFO_LIST *interfaceList;
- DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
-#endif
- return QString();
- }
-
- for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) {
- const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i];
-
- DWORD dataSize;
- WLAN_CONNECTION_ATTRIBUTES *connectionAttributes;
- result = local_WlanQueryInterface(handle, &interface.InterfaceGuid,
- wlan_intf_opcode_current_connection, 0, &dataSize,
- reinterpret_cast<PVOID *>(&connectionAttributes), 0);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- if (result != ERROR_INVALID_STATE)
- qDebug("%s: WlanQueryInterface failed with error %ld\n", __FUNCTION__, result);
-#endif
-
- continue;
- }
-
- if (qHash(QLatin1String("WLAN:") +
- QString::fromWCharArray(connectionAttributes->strProfileName)) == id.toUInt()) {
- QString guid("{%1-%2-%3-%4%5-%6%7%8%9%10%11}");
-
- guid = guid.arg(interface.InterfaceGuid.Data1, 8, 16, QChar('0'));
- guid = guid.arg(interface.InterfaceGuid.Data2, 4, 16, QChar('0'));
- guid = guid.arg(interface.InterfaceGuid.Data3, 4, 16, QChar('0'));
- for (int i = 0; i < 8; ++i)
- guid = guid.arg(interface.InterfaceGuid.Data4[i], 2, 16, QChar('0'));
-
- local_WlanFreeMemory(connectionAttributes);
- local_WlanFreeMemory(interfaceList);
-
- return guid.toUpper();
- }
-
- local_WlanFreeMemory(connectionAttributes);
- }
-
- local_WlanFreeMemory(interfaceList);
-
- return QString();
-}
-
-bool QNativeWifiEngine::hasIdentifier(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- if (!available())
- return false;
-
- // enumerate interfaces
- WLAN_INTERFACE_INFO_LIST *interfaceList;
- DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
-#endif
- return false;
- }
-
- for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) {
- const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i];
-
- WLAN_AVAILABLE_NETWORK_LIST *networkList;
- result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid,
- 3, 0, &networkList);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n",
- __FUNCTION__, result);
-#endif
- continue;
- }
-
- for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) {
- WLAN_AVAILABLE_NETWORK &network = networkList->Network[j];
-
- QString networkName;
-
- if (network.strProfileName[0] != 0) {
- networkName = QString::fromWCharArray(network.strProfileName);
- } else {
- networkName = QByteArray(reinterpret_cast<char *>(network.dot11Ssid.ucSSID),
- network.dot11Ssid.uSSIDLength);
- }
-
- if (qHash(QLatin1String("WLAN:") + networkName) == id.toUInt()) {
- local_WlanFreeMemory(networkList);
- local_WlanFreeMemory(interfaceList);
- return true;
- }
- }
-
- local_WlanFreeMemory(networkList);
- }
-
- local_WlanFreeMemory(interfaceList);
-
- return false;
-}
-
-void QNativeWifiEngine::connectToId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- if (!available()) {
- locker.unlock();
- emit connectionError(id, InterfaceLookupError);
- return;
- }
-
- WLAN_INTERFACE_INFO_LIST *interfaceList;
- DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
-#endif
- locker.unlock();
- emit connectionError(id, InterfaceLookupError);
- return;
- }
-
- QString profile;
-
- for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) {
- const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i];
-
- WLAN_AVAILABLE_NETWORK_LIST *networkList;
- result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid,
- 3, 0, &networkList);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n",
- __FUNCTION__, result);
-#endif
- continue;
- }
-
- for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) {
- WLAN_AVAILABLE_NETWORK &network = networkList->Network[j];
-
- profile = QString::fromWCharArray(network.strProfileName);
-
- if (qHash(QLatin1String("WLAN:") + profile) == id.toUInt())
- break;
- else
- profile.clear();
- }
-
- local_WlanFreeMemory(networkList);
-
- if (!profile.isEmpty()) {
- WLAN_CONNECTION_PARAMETERS parameters;
- parameters.wlanConnectionMode = wlan_connection_mode_profile;
- parameters.strProfile = reinterpret_cast<LPCWSTR>(profile.utf16());
- parameters.pDot11Ssid = 0;
- parameters.pDesiredBssidList = 0;
- parameters.dot11BssType = dot11_BSS_type_any;
- parameters.dwFlags = 0;
-
- DWORD result = local_WlanConnect(handle, &interface.InterfaceGuid, &parameters, 0);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result);
-#endif
- locker.unlock();
- emit connectionError(id, ConnectError);
- locker.relock();
- break;
- }
-
- break;
- }
- }
-
- local_WlanFreeMemory(interfaceList);
-
- if (profile.isEmpty()) {
- locker.unlock();
- emit connectionError(id, InterfaceLookupError);
- }
-}
-
-void QNativeWifiEngine::disconnectFromId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- if (!available()) {
- locker.unlock();
- emit connectionError(id, InterfaceLookupError);
- return;
- }
-
- QString interface = getInterfaceFromId(id);
-
- if (interface.isEmpty()) {
- locker.unlock();
- emit connectionError(id, InterfaceLookupError);
- return;
- }
-
- const QVector<QStringRef> split = interface.midRef(1, interface.length() - 2).split(QLatin1Char('-'));
-
- GUID guid;
- guid.Data1 = split.at(0).toUInt(0, 16);
- guid.Data2 = split.at(1).toUShort(0, 16);
- guid.Data3 = split.at(2).toUShort(0, 16);
- guid.Data4[0] = split.at(3).left(2).toUShort(0, 16);
- guid.Data4[1] = split.at(3).right(2).toUShort(0, 16);
- for (int i = 0; i < 6; ++i)
- guid.Data4[i + 2] = split.at(4).mid(i*2, 2).toUShort(0, 16);
-
- DWORD result = local_WlanDisconnect(handle, &guid, 0);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result);
-#endif
- locker.unlock();
- emit connectionError(id, DisconnectionError);
- return;
- }
-}
-
-void QNativeWifiEngine::initialize()
-{
- scanComplete();
-}
-
-void QNativeWifiEngine::requestUpdate()
-{
- QMutexLocker locker(&mutex);
-
- if (!available()) {
- locker.unlock();
- emit updateCompleted();
- return;
- }
-
- // enumerate interfaces
- WLAN_INTERFACE_INFO_LIST *interfaceList;
- DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
-#endif
-
- locker.unlock();
- emit updateCompleted();
-
- return;
- }
-
- bool requested = false;
- for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) {
- result = local_WlanScan(handle, &interfaceList->InterfaceInfo[i].InterfaceGuid, 0, 0, 0);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: WlanScan failed with error %ld\n", __FUNCTION__, result);
-#endif
- } else {
- requested = true;
- }
- }
-
- local_WlanFreeMemory(interfaceList);
-
- if (!requested) {
- locker.unlock();
- emit updateCompleted();
- }
-}
-
-QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- if (!ptr)
- return QNetworkSession::Invalid;
-
- if (!ptr->isValid) {
- return QNetworkSession::Invalid;
- } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- return QNetworkSession::Connected;
- } else if ((ptr->state & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
- return QNetworkSession::Disconnected;
- } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
- return QNetworkSession::NotAvailable;
- } else if ((ptr->state & QNetworkConfiguration::Undefined) ==
- QNetworkConfiguration::Undefined) {
- return QNetworkSession::NotAvailable;
- }
-
- return QNetworkSession::Invalid;
-}
-
-QNetworkConfigurationManager::Capabilities QNativeWifiEngine::capabilities() const
-{
- return QNetworkConfigurationManager::ForcedRoaming |
- QNetworkConfigurationManager::CanStartAndStopInterfaces;
-}
-
-QNetworkSessionPrivate *QNativeWifiEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl;
-}
-
-QNetworkConfigurationPrivatePointer QNativeWifiEngine::defaultConfiguration()
-{
- return QNetworkConfigurationPrivatePointer();
-}
-
-bool QNativeWifiEngine::available()
-{
- if (handle != INVALID_HANDLE_VALUE)
- return true;
-
- DWORD clientVersion;
-
- DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- if (result != ERROR_SERVICE_NOT_ACTIVE)
- qDebug("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result);
-#endif
-
- return false;
- }
-
- result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true,
- WLAN_NOTIFICATION_CALLBACK(qNotificationCallback),
- this, 0, 0);
-#ifdef BEARER_MANAGEMENT_DEBUG
- if (result != ERROR_SUCCESS)
- qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
-#endif
-
- return handle != INVALID_HANDLE_VALUE;
-}
-
-void QNativeWifiEngine::closeHandle()
-{
- if (handle != INVALID_HANDLE_VALUE) {
- local_WlanCloseHandle(handle, 0);
- handle = INVALID_HANDLE_VALUE;
- }
-}
-
-bool QNativeWifiEngine::requiresPolling() const
-{
- // On Windows XP SP2 and SP3 only connection and disconnection notifications are available.
- // We need to poll for changes in available wireless networks.
- return QOperatingSystemVersion::current()
- <= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 5, 2);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
deleted file mode 100644
index 24e97bf6df..0000000000
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNATIVEWIFIENGINE_P_H
-#define QNATIVEWIFIENGINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qbearerengine_impl_p.h>
-
-#include <QtCore/qtimer.h>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfigurationPrivate;
-struct WLAN_NOTIFICATION_DATA;
-
-class QNativeWifiEngine : public QBearerEngineImpl
-{
- Q_OBJECT
-
-public:
- QNativeWifiEngine(QObject *parent = 0);
- ~QNativeWifiEngine();
-
- QString getInterfaceFromId(const QString &id);
- bool hasIdentifier(const QString &id);
-
- void connectToId(const QString &id);
- void disconnectFromId(const QString &id);
-
- Q_INVOKABLE void initialize();
- Q_INVOKABLE void requestUpdate();
-
- QNetworkSession::State sessionStateForId(const QString &id);
-
- QNetworkConfigurationManager::Capabilities capabilities() const;
-
- QNetworkSessionPrivate *createSessionBackend();
-
- QNetworkConfigurationPrivatePointer defaultConfiguration();
-
- bool available();
-
- bool requiresPolling() const;
-
-private Q_SLOTS:
- void scanComplete();
- void closeHandle();
-
-private:
- Qt::HANDLE handle;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_BEARERMANAGEMENT
-
-#endif
diff --git a/src/plugins/bearer/networkmanager/.prev_CMakeLists.txt b/src/plugins/bearer/networkmanager/.prev_CMakeLists.txt
deleted file mode 100644
index df5927024d..0000000000
--- a/src/plugins/bearer/networkmanager/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated from networkmanager.pro.
-
-#####################################################################
-## QNetworkManagerEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QNetworkManagerEnginePlugin
- OUTPUT_NAME qnmbearer
- CLASS_NAME QNetworkManagerEnginePlugin
- TYPE bearer
- SOURCES
- main.cpp
- qnetworkmanagerengine.cpp qnetworkmanagerengine.h
- qnetworkmanagerservice.cpp qnetworkmanagerservice.h
- LIBRARIES
- Qt::LinuxOfonoSupportPrivate
- Qt::NetworkPrivate
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::DBus
- Qt::LinuxOfonoSupport
- Qt::Network
-)
-
-#### Keys ignored in scope 1:.:.:networkmanager.pro:<TRUE>:
-# OTHER_FILES = "networkmanager.json"
diff --git a/src/plugins/bearer/networkmanager/CMakeLists.txt b/src/plugins/bearer/networkmanager/CMakeLists.txt
deleted file mode 100644
index 8f26a4c86d..0000000000
--- a/src/plugins/bearer/networkmanager/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated from networkmanager.pro.
-
-#####################################################################
-## QNetworkManagerEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QNetworkManagerEnginePlugin
- OUTPUT_NAME qnmbearer
- TYPE bearer
- SOURCES
- main.cpp
- qnetworkmanagerengine.cpp qnetworkmanagerengine.h
- qnetworkmanagerservice.cpp qnetworkmanagerservice.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::DBus
- Qt::LinuxOfonoSupportPrivate
- Qt::NetworkPrivate
-)
-
-#### Keys ignored in scope 1:.:.:networkmanager.pro:<TRUE>:
-# OTHER_FILES = "networkmanager.json"
diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp
deleted file mode 100644
index 1773abe55b..0000000000
--- a/src/plugins/bearer/networkmanager/main.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnetworkmanagerengine.h"
-
-#include <QtNetwork/private/qbearerplugin_p.h>
-
-#include <QtCore/qdebug.h>
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkManagerEnginePlugin : public QBearerEnginePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "networkmanager.json")
-
-public:
- QNetworkManagerEnginePlugin();
- ~QNetworkManagerEnginePlugin();
-
- QBearerEngine *create(const QString &key) const;
-};
-
-QNetworkManagerEnginePlugin::QNetworkManagerEnginePlugin()
-{
-}
-
-QNetworkManagerEnginePlugin::~QNetworkManagerEnginePlugin()
-{
-}
-
-QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const
-{
- if (key == QLatin1String("networkmanager")) {
- QNetworkManagerEngine *engine = new QNetworkManagerEngine;
- return engine;
- }
-
- return 0;
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
-
-#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/networkmanager/networkmanager.json b/src/plugins/bearer/networkmanager/networkmanager.json
deleted file mode 100644
index 3d408d5c20..0000000000
--- a/src/plugins/bearer/networkmanager/networkmanager.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "networkmanager" ]
-}
diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro
deleted file mode 100644
index 3ca217f974..0000000000
--- a/src/plugins/bearer/networkmanager/networkmanager.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qnmbearer
-
-QT = core network-private dbus linuxofono_support_private
-
-HEADERS += qnetworkmanagerservice.h \
- qnetworkmanagerengine.h
-
-SOURCES += main.cpp \
- qnetworkmanagerservice.cpp \
- qnetworkmanagerengine.cpp
-
-OTHER_FILES += networkmanager.json
-
-PLUGIN_TYPE = bearer
-PLUGIN_CLASS_NAME = QNetworkManagerEnginePlugin
-load(qt_plugin)
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
deleted file mode 100644
index cba2221587..0000000000
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ /dev/null
@@ -1,935 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnetworkmanagerengine.h"
-#include "qnetworkmanagerservice.h"
-#include <private/qnetworksession_impl_p.h>
-
-#include <QtNetwork/private/qnetworkconfiguration_p.h>
-
-#include <QtNetwork/qnetworksession.h>
-
-#include <QtCore/qdebug.h>
-
-#include <QtDBus>
-#include <QDBusConnection>
-#include <QDBusError>
-#include <QDBusInterface>
-#include <QDBusMessage>
-#include <QDBusReply>
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
-: QBearerEngineImpl(parent),
- managerInterface(NULL),
- systemSettings(NULL),
- ofonoManager(NULL),
- nmAvailable(false)
-{
- qDBusRegisterMetaType<QNmSettingsMap>();
-
- nmWatcher = new QDBusServiceWatcher(NM_DBUS_SERVICE,QDBusConnection::systemBus(),
- QDBusServiceWatcher::WatchForRegistration |
- QDBusServiceWatcher::WatchForUnregistration, this);
- connect(nmWatcher, SIGNAL(serviceRegistered(QString)),
- this, SLOT(nmRegistered(QString)));
- connect(nmWatcher, SIGNAL(serviceUnregistered(QString)),
- this, SLOT(nmUnRegistered(QString)));
-
- ofonoWatcher = new QDBusServiceWatcher("org.ofono",QDBusConnection::systemBus(),
- QDBusServiceWatcher::WatchForRegistration |
- QDBusServiceWatcher::WatchForUnregistration, this);
- connect(ofonoWatcher, SIGNAL(serviceRegistered(QString)),
- this, SLOT(ofonoRegistered(QString)));
- connect(ofonoWatcher, SIGNAL(serviceUnregistered(QString)),
- this, SLOT(ofonoUnRegistered(QString)));
-
- QDBusConnectionInterface *interface = QDBusConnection::systemBus().interface();
-
- if (!interface) return;
-
- if (interface->isServiceRegistered("org.ofono"))
- QMetaObject::invokeMethod(this, "ofonoRegistered", Qt::QueuedConnection);
-
- if (interface->isServiceRegistered(NM_DBUS_SERVICE))
- QMetaObject::invokeMethod(this, "nmRegistered", Qt::QueuedConnection);
-}
-
-QNetworkManagerEngine::~QNetworkManagerEngine()
-{
- qDeleteAll(connections);
- connections.clear();
- qDeleteAll(accessPoints);
- accessPoints.clear();
- qDeleteAll(wirelessDevices);
- wirelessDevices.clear();
- qDeleteAll(activeConnectionsList);
- activeConnectionsList.clear();
- qDeleteAll(interfaceDevices);
- interfaceDevices.clear();
-
- connectionInterfaces.clear();
-
- qDeleteAll(ofonoContextManagers);
- ofonoContextManagers.clear();
-
- qDeleteAll(wiredDevices);
- wiredDevices.clear();
-}
-
-void QNetworkManagerEngine::initialize()
-{
- if (nmAvailable)
- setupConfigurations();
-}
-
-void QNetworkManagerEngine::setupConfigurations()
-{
- QMutexLocker locker(&mutex);
- // Get active connections.
- const auto acPaths = managerInterface->activeConnections();
- for (const QDBusObjectPath &acPath : acPaths) {
-
- if (activeConnectionsList.contains(acPath.path()))
- continue;
-
- QNetworkManagerConnectionActive *activeConnection =
- new QNetworkManagerConnectionActive(acPath.path(),this);
- activeConnectionsList.insert(acPath.path(), activeConnection);
- connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
- this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
-
- QStringList devices = activeConnection->devices();
- if (!devices.isEmpty()) {
- QNetworkManagerInterfaceDevice device(devices.at(0),this);
- connectionInterfaces.insert(activeConnection->connection().path(),device.networkInterface());
- }
- }
-
- // Get connections.
- const auto settingsPaths = systemSettings->listConnections();
- for (const QDBusObjectPath &settingsPath : settingsPaths) {
- locker.unlock();
- if (!hasIdentifier(settingsPath.path()))
- newConnection(settingsPath, systemSettings); //add system connection configs
- locker.relock();
- }
-
- Q_EMIT updateCompleted();
-}
-
-bool QNetworkManagerEngine::networkManagerAvailable() const
-{
- return nmAvailable;
-}
-
-QString QNetworkManagerEngine::getInterfaceFromId(const QString &settingsPath)
-{
- return connectionInterfaces.value(settingsPath);
-}
-
-bool QNetworkManagerEngine::hasIdentifier(const QString &id)
-{
- QMutexLocker locker(&mutex);
- return accessPointConfigurations.contains(id);
-}
-
-void QNetworkManagerEngine::connectToId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkManagerSettingsConnection *connection = connectionFromId(id);
-
- if (!connection)
- return;
-
- NMDeviceType connectionType = connection->getType();
-
- QString dbusDevicePath;
- const QString settingsPath = connection->path();
- QString specificPath = configuredAccessPoints.key(settingsPath);
-
- if (isConnectionActive(settingsPath))
- return;
-
- for (auto i = interfaceDevices.cbegin(), end = interfaceDevices.cend(); i != end; ++i) {
- const auto type = i.value()->deviceType();
- if (type == DEVICE_TYPE_ETHERNET || type == DEVICE_TYPE_WIFI || type == DEVICE_TYPE_MODEM) {
- if (type == connectionType) {
- dbusDevicePath = i.key();
- break;
- }
- }
- }
-
- if (specificPath.isEmpty())
- specificPath = "/";
-
- managerInterface->activateConnection(QDBusObjectPath(settingsPath),
- QDBusObjectPath(dbusDevicePath), QDBusObjectPath(specificPath));
-}
-
-void QNetworkManagerEngine::disconnectFromId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkManagerSettingsConnection *connection = connectionFromId(id);
-
- if (!connection)
- return;
-
- QNmSettingsMap map = connection->getSettings();
- bool connectionAutoconnect = map.value("connection").value("autoconnect",true).toBool(); //if not present is true !!
- if (connectionAutoconnect) { //autoconnect connections will simply be reconnected by nm
- emit connectionError(id, QBearerEngineImpl::OperationNotSupported);
- return;
- }
-
- for (auto i = activeConnectionsList.cbegin(), end = activeConnectionsList.cend(); i != end; ++i) {
- if (id == i.value()->connection().path() && accessPointConfigurations.contains(id)) {
- managerInterface->deactivateConnection(QDBusObjectPath(i.key()));
- break;
- }
- }
-}
-
-void QNetworkManagerEngine::requestUpdate()
-{
- if (managerInterface && managerInterface->wirelessEnabled()) {
- for (auto *wirelessDevice : qAsConst(wirelessDevices))
- wirelessDevice->requestScan();
- }
- QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
-}
-
-void QNetworkManagerEngine::interfacePropertiesChanged(const QMap<QString, QVariant> &properties)
-{
- QMutexLocker locker(&mutex);
-
- for (auto i = properties.cbegin(), end = properties.cend(); i != end; ++i) {
- if (i.key() == QLatin1String("ActiveConnections")) {
- // Active connections changed, update configurations.
-
- const auto activeConnections = qdbus_cast<QList<QDBusObjectPath> >(qvariant_cast<QDBusArgument>(i.value()));
-
- QStringList identifiers = accessPointConfigurations.keys();
- QStringList priorActiveConnections = activeConnectionsList.keys();
-
- for (const QDBusObjectPath &acPath : activeConnections) {
- priorActiveConnections.removeOne(acPath.path());
- QNetworkManagerConnectionActive *activeConnection =
- activeConnectionsList.value(acPath.path());
-
- if (!activeConnection) {
- activeConnection = new QNetworkManagerConnectionActive(acPath.path(),this);
- activeConnectionsList.insert(acPath.path(), activeConnection);
-
- connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
- this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
- }
-
- const QString id = activeConnection->connection().path();
-
- identifiers.removeOne(id);
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- if (ptr) {
- ptr->mutex.lock();
- if (activeConnection->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
- (ptr->state & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) {
-
- ptr->state |= QNetworkConfiguration::Active;
-
- if (activeConnectionsList.value(id) && activeConnectionsList.value(id)->defaultRoute()
- && managerInterface->state() < QNetworkManagerInterface::NM_STATE_CONNECTED_GLOBAL) {
- ptr->purpose = QNetworkConfiguration::PrivatePurpose;
- }
- ptr->mutex.unlock();
-
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- } else {
- ptr->mutex.unlock();
- }
- }
- }
-
- while (!priorActiveConnections.isEmpty())
- delete activeConnectionsList.take(priorActiveConnections.takeFirst());
-
- while (!identifiers.isEmpty()) {
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.value(identifiers.takeFirst());
-
- ptr->mutex.lock();
- if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
- ptr->state = (flag | QNetworkConfiguration::Discovered);
- ptr->mutex.unlock();
-
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- } else {
- ptr->mutex.unlock();
- }
- }
- }
- }
-}
-
-void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QMap<QString, QVariant> &properties)
-{
- QMutexLocker locker(&mutex);
-
- Q_UNUSED(properties)
-
- QNetworkManagerConnectionActive *activeConnection = qobject_cast<QNetworkManagerConnectionActive *>(sender());
-
- if (!activeConnection)
- return;
-
- const QString id = activeConnection->connection().path();
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- if (ptr) {
- if (properties.contains(QStringLiteral("State"))) {
- ptr->mutex.lock();
- if (properties.value("State").toUInt() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
- QStringList devices = activeConnection->devices();
- if (!devices.isEmpty()) {
- QNetworkManagerInterfaceDevice device(devices.at(0),this);
- connectionInterfaces.insert(id,device.networkInterface());
- }
-
- ptr->state |= QNetworkConfiguration::Active;
- ptr->mutex.unlock();
-
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- } else {
- connectionInterfaces.remove(id);
- ptr->mutex.unlock();
- }
- }
- }
-}
-
-void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &connectionsList)
-{
- QMutexLocker locker(&mutex);
- for (int i = 0; i < connections.count(); ++i) {
- if (connectionsList.contains(connections.at(i)->path()))
- continue;
-
- const QString settingsPath = connections.at(i)->path();
-
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.value(settingsPath);
- ptr->mutex.lock();
- QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
- ptr->state = (flag | QNetworkConfiguration::Discovered);
- ptr->mutex.unlock();
-
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- Q_EMIT updateCompleted();
- }
-}
-
-void QNetworkManagerEngine::wiredCarrierChanged(bool carrier)
-{
- QNetworkManagerInterfaceDeviceWired *deviceWired = qobject_cast<QNetworkManagerInterfaceDeviceWired *>(sender());
- if (!deviceWired)
- return;
- QMutexLocker locker(&mutex);
- const auto settingsPaths = systemSettings->listConnections();
- for (const QDBusObjectPath &settingsPath : settingsPaths) {
- for (int i = 0; i < connections.count(); ++i) {
- QNetworkManagerSettingsConnection *connection = connections.at(i);
- if (connection->getType() == DEVICE_TYPE_ETHERNET
- && settingsPath.path() == connection->path()) {
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.value(settingsPath.path());
-
- if (ptr) {
- ptr->mutex.lock();
- if (carrier)
- ptr->state |= QNetworkConfiguration::Discovered;
- else
- ptr->state = QNetworkConfiguration::Defined;
- ptr->mutex.unlock();
- locker.unlock();
- emit configurationChanged(ptr);
- return;
- }
- }
- }
- }
-}
-
-void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
- QNetworkManagerSettings *settings)
-{
- QMutexLocker locker(&mutex);
- if (!settings)
- settings = qobject_cast<QNetworkManagerSettings *>(sender());
-
- if (!settings) {
- return;
- }
-
- QNetworkManagerSettingsConnection *connection =
- new QNetworkManagerSettingsConnection(settings->service(),
- path.path(),this);
- const QString settingsPath = connection->path();
- if (accessPointConfigurations.contains(settingsPath)) {
- return;
- }
-
- connections.append(connection);
-
- connect(connection,SIGNAL(removed(QString)),this,SLOT(removeConnection(QString)));
- connect(connection,SIGNAL(updated()),this,SLOT(updateConnection()));
- connection->setConnections();
-
- NMDeviceType deviceType = connection->getType();
-
- if (deviceType == DEVICE_TYPE_WIFI) {
- QString apPath;
- for (int i = 0; i < accessPoints.count(); ++i) {
- if (connection->getSsid() == accessPoints.at(i)->ssid()) {
- // remove the corresponding accesspoint from configurations
- apPath = accessPoints.at(i)->path();
- QNetworkConfigurationPrivatePointer ptr
- = accessPointConfigurations.take(apPath);
- if (ptr) {
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
- }
- }
- if (!configuredAccessPoints.contains(settingsPath))
- configuredAccessPoints.insert(apPath,settingsPath);
- }
-
- QNetworkConfigurationPrivate *cpPriv =
- parseConnection(settingsPath, connection->getSettings());
-
- // Check if connection is active.
- if (isConnectionActive(settingsPath))
- cpPriv->state |= QNetworkConfiguration::Active;
-
- if (deviceType == DEVICE_TYPE_ETHERNET) {
- for (auto interfaceDevice : qAsConst(interfaceDevices)) {
- if (interfaceDevice->deviceType() == deviceType) {
- auto *wiredDevice = wiredDevices.value(interfaceDevice->path());
- if (wiredDevice && wiredDevice->carrier()) {
- cpPriv->state |= QNetworkConfiguration::Discovered;
- }
- }
- }
- }
-
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
- accessPointConfigurations.insert(ptr->id, ptr);
- locker.unlock();
- emit configurationAdded(ptr);
-}
-
-bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) const
-{
- for (QNetworkManagerConnectionActive *activeConnection : activeConnectionsList) {
- if (activeConnection->connection().path() == settingsPath) {
- const auto state = activeConnection->state();
- if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING
- || state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
- return true;
- } else {
- break;
- }
- }
- }
-
- QNetworkManagerSettingsConnection *settingsConnection = connectionFromId(settingsPath);
- if (settingsConnection && settingsConnection->getType() == DEVICE_TYPE_MODEM) {
- return isActiveContext(settingsConnection->path());
- }
-
- return false;
-}
-
-void QNetworkManagerEngine::removeConnection(const QString &path)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkManagerSettingsConnection *connection =
- qobject_cast<QNetworkManagerSettingsConnection *>(sender());
-
- if (!connection)
- return;
-
- connection->deleteLater();
- connections.removeAll(connection);
-
- const QString id = path;
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id);
-
- if (ptr) {
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
-
- // add base AP back into configurations
-
- // removed along with all AP props code...
-}
-
-void QNetworkManagerEngine::updateConnection()
-{
- QMutexLocker locker(&mutex);
-
- QNetworkManagerSettingsConnection *connection =
- qobject_cast<QNetworkManagerSettingsConnection *>(sender());
- if (!connection)
- return;
- const QString settingsPath = connection->path();
-
- QNetworkConfigurationPrivate *cpPriv = parseConnection(settingsPath, connection->getSettings());
-
- // Check if connection is active.
- const auto acPaths = managerInterface->activeConnections();
- for (const QDBusObjectPath &acPath : acPaths) {
- QNetworkManagerConnectionActive activeConnection(acPath.path());
-
- if (activeConnection.connection().path() == settingsPath &&
- activeConnection.state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
- cpPriv->state |= QNetworkConfiguration::Active;
- break;
- }
- }
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id);
-
- ptr->mutex.lock();
-
- ptr->isValid = cpPriv->isValid;
- ptr->name = cpPriv->name;
- ptr->id = cpPriv->id;
- ptr->state = cpPriv->state;
-
- ptr->mutex.unlock();
-
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- delete cpPriv;
-}
-
-void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher)
-{
- QMutexLocker locker(&mutex);
- QDBusPendingReply<QDBusObjectPath> reply(*watcher);
- watcher->deleteLater();
-
- if (!reply.isError()) {
- QDBusObjectPath result = reply.value();
-
- QNetworkManagerConnectionActive activeConnection(result.path());
-
- const QString id = activeConnection.connection().path();
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- if (ptr) {
- ptr->mutex.lock();
- if (activeConnection.state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
- ptr->state != QNetworkConfiguration::Active) {
- ptr->state |= QNetworkConfiguration::Active;
- ptr->mutex.unlock();
-
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- } else {
- ptr->mutex.unlock();
- }
- }
- }
-}
-
-QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &settingsPath,
- const QNmSettingsMap &map)
-{
- QMutexLocker locker(&mutex);
- QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate;
- cpPriv->name = map.value("connection").value("id").toString();
- cpPriv->isValid = true;
- cpPriv->id = settingsPath;
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
-
- cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
-
- cpPriv->state = QNetworkConfiguration::Defined;
- const QString connectionType = map.value("connection").value("type").toString();
-
- if (connectionType == QLatin1String("802-3-ethernet")) {
- cpPriv->bearerType = QNetworkConfiguration::BearerEthernet;
-
- const auto devicePaths = managerInterface->getDevices();
- for (const QDBusObjectPath &devicePath : devicePaths) {
- QNetworkManagerInterfaceDevice device(devicePath.path(),this);
- if (device.deviceType() == DEVICE_TYPE_ETHERNET) {
- QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.path());
- if (wiredDevice && wiredDevice->carrier()) {
- cpPriv->state |= QNetworkConfiguration::Discovered;
- break;
- }
- }
- }
- } else if (connectionType == QLatin1String("802-11-wireless")) {
- cpPriv->bearerType = QNetworkConfiguration::BearerWLAN;
-
- const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString();
- for (int i = 0; i < accessPoints.count(); ++i) {
- if (connectionSsid == accessPoints.at(i)->ssid()
- && map.value("802-11-wireless").value("seen-bssids").toStringList().contains(accessPoints.at(i)->hwAddress())) {
- cpPriv->state |= QNetworkConfiguration::Discovered;
- if (!configuredAccessPoints.contains(accessPoints.at(i)->path())) {
- configuredAccessPoints.insert(accessPoints.at(i)->path(),settingsPath);
-
- const QString accessPointId = accessPoints.at(i)->path();
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.take(accessPointId);
-
- if (ptr) {
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
- }
- break;
- }
- }
- } else if (connectionType == QLatin1String("gsm")) {
-
- const QString connectionPath = map.value("connection").value("id").toString();
- cpPriv->name = contextName(connectionPath);
- cpPriv->bearerType = currentBearerType(connectionPath);
-
- if (ofonoManager && ofonoManager->isValid()) {
- const QString contextPart = connectionPath.section('/', -1);
- for (auto i = ofonoContextManagers.cbegin(), end = ofonoContextManagers.cend(); i != end; ++i) {
- const QString path = i.key() + QLatin1Char('/') +contextPart;
- if (isActiveContext(path)) {
- cpPriv->state |= QNetworkConfiguration::Active;
- break;
- }
- }
- }
- }
-
- return cpPriv;
-}
-
-bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) const
-{
- if (ofonoManager && ofonoManager->isValid()) {
- const QString contextPart = contextPath.section('/', -1);
- for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) {
- const PathPropertiesList list = iface->contextsWithProperties();
- for (int i = 0; i < list.size(); ++i) {
- if (list.at(i).path.path().contains(contextPart)) {
- return list.at(i).properties.value(QStringLiteral("Active")).toBool();
-
- }
- }
- }
- }
- return false;
-}
-
-QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const
-{
- for (int i = 0; i < connections.count(); ++i) {
- QNetworkManagerSettingsConnection *connection = connections.at(i);
- if (id == connection->path())
- return connection;
- }
-
- return 0;
-}
-
-QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &id)
-{
- QMutexLocker locker(&mutex);
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- if (!ptr)
- return QNetworkSession::Invalid;
-
- if (!ptr->isValid)
- return QNetworkSession::Invalid;
-
- for (QNetworkManagerConnectionActive *activeConnection : qAsConst(activeConnectionsList)) {
- const QString identifier = activeConnection->connection().path();
-
- if (id == identifier) {
- switch (activeConnection->state()) {
- case 0:
- return QNetworkSession::Disconnected;
- case 1:
- return QNetworkSession::Connecting;
- case 2:
- return QNetworkSession::Connected;
- }
- }
- }
-
- if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered)
- return QNetworkSession::Disconnected;
- else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined)
- return QNetworkSession::NotAvailable;
- else if ((ptr->state & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined)
- return QNetworkSession::NotAvailable;
-
- return QNetworkSession::Invalid;
-}
-
-quint64 QNetworkManagerEngine::bytesWritten(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- const QString networkInterface = connectionInterfaces.value(id);
- if (!networkInterface.isEmpty()) {
- const QString devFile = QLatin1String("/sys/class/net/") +
- networkInterface +
- QLatin1String("/statistics/tx_bytes");
-
- quint64 result = Q_UINT64_C(0);
-
- QFile tx(devFile);
- if (tx.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream in(&tx);
- in >> result;
- tx.close();
- }
-
- return result;
- }
- }
-
- return Q_UINT64_C(0);
-}
-
-quint64 QNetworkManagerEngine::bytesReceived(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- const QString networkInterface = connectionInterfaces.value(id);
- if (!networkInterface.isEmpty()) {
- const QString devFile = QLatin1String("/sys/class/net/") +
- networkInterface +
- QLatin1String("/statistics/rx_bytes");
-
- quint64 result = Q_UINT64_C(0);
-
- QFile tx(devFile);
- if (tx.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream in(&tx);
- in >> result;
- tx.close();
- }
-
- return result;
- }
- }
-
- return Q_UINT64_C(0);
-}
-
-quint64 QNetworkManagerEngine::startTime(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkManagerSettingsConnection *connection = connectionFromId(id);
- if (connection)
- return connection->getTimestamp();
- else
- return Q_UINT64_C(0);
-}
-
-QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() const
-{
- return QNetworkConfigurationManager::ForcedRoaming |
- QNetworkConfigurationManager::DataStatistics |
- QNetworkConfigurationManager::CanStartAndStopInterfaces;
-}
-
-QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl;
-}
-
-QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration()
-{
- for (QNetworkManagerConnectionActive *activeConnection : qAsConst(activeConnectionsList)) {
- if ((activeConnection->defaultRoute() || activeConnection->default6Route())) {
- return accessPointConfigurations.value(activeConnection->connection().path());
- }
- }
-
- return QNetworkConfigurationPrivatePointer();
-}
-
-QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) const
-{
- QString contextPart = id.section('/', -1);
- for (auto i = ofonoContextManagers.begin(), end = ofonoContextManagers.end(); i != end; ++i) {
- QString contextPath = i.key() + QLatin1Char('/') +contextPart;
-
- if (i.value()->contexts().contains(contextPath)) {
-
- QString bearer = i.value()->bearer();
-
- if (bearer == QLatin1String("gsm")) {
- return QNetworkConfiguration::Bearer2G;
- } else if (bearer == QLatin1String("edge")) {
- return QNetworkConfiguration::Bearer2G;
- } else if (bearer == QLatin1String("umts")) {
- return QNetworkConfiguration::BearerWCDMA;
- } else if (bearer == QLatin1String("hspa")
- || bearer == QLatin1String("hsdpa")
- || bearer == QLatin1String("hsupa")) {
- return QNetworkConfiguration::BearerHSPA;
- } else if (bearer == QLatin1String("lte")) {
- return QNetworkConfiguration::BearerLTE;
- }
- }
- }
-
- return QNetworkConfiguration::BearerUnknown;
-}
-
-QString QNetworkManagerEngine::contextName(const QString &path) const
-{
- QString contextPart = path.section('/', -1);
- for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) {
- const PathPropertiesList list = iface->contextsWithProperties();
- for (int i = 0; i < list.size(); ++i) {
- if (list.at(i).path.path().contains(contextPart)) {
- return list.at(i).properties.value(QStringLiteral("Name")).toString();
- }
- }
- }
- return path;
-}
-
-void QNetworkManagerEngine::nmRegistered(const QString &)
-{
- if (ofonoManager) {
- delete ofonoManager;
- ofonoManager = NULL;
- }
- managerInterface = new QNetworkManagerInterface(this);
- systemSettings = new QNetworkManagerSettings(NM_DBUS_SERVICE, this);
-
- connect(managerInterface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
- this, SLOT(activationFinished(QDBusPendingCallWatcher*)));
- connect(managerInterface, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
- this, SLOT(interfacePropertiesChanged(QMap<QString,QVariant>)));
- managerInterface->setConnections();
-
- connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)),
- this, SLOT(newConnection(QDBusObjectPath)));
- systemSettings->setConnections();
- nmAvailable = true;
-
- setupConfigurations();
-}
-
-void QNetworkManagerEngine::nmUnRegistered(const QString &)
-{
- if (systemSettings) {
- delete systemSettings;
- systemSettings = NULL;
- }
- if (managerInterface) {
- delete managerInterface;
- managerInterface = NULL;
- }
-}
-
-void QNetworkManagerEngine::ofonoRegistered(const QString &)
-{
- if (ofonoManager) {
- delete ofonoManager;
- ofonoManager = NULL;
- }
- ofonoManager = new QOfonoManagerInterface(this);
- if (ofonoManager && ofonoManager->isValid()) {
- const auto modems = ofonoManager->getModems();
- for (const QString &modem : modems) {
- QOfonoDataConnectionManagerInterface *ofonoContextManager
- = new QOfonoDataConnectionManagerInterface(modem,this);
- ofonoContextManagers.insert(modem, ofonoContextManager);
- }
- }
-}
-
-void QNetworkManagerEngine::ofonoUnRegistered(const QString &)
-{
- ofonoContextManagers.clear();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
deleted file mode 100644
index c624d6087d..0000000000
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKMANAGERENGINE_P_H
-#define QNETWORKMANAGERENGINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qbearerengine_impl_p.h>
-
-#include "qnetworkmanagerservice.h"
-
-#include <private/qofonoservice_linux_p.h>
-
-#include <QMap>
-#include <QVariant>
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkManagerEngine : public QBearerEngineImpl
-{
- Q_OBJECT
-
-public:
- QNetworkManagerEngine(QObject *parent = nullptr);
- ~QNetworkManagerEngine();
-
- bool networkManagerAvailable() const;
-
- QString getInterfaceFromId(const QString &id) override;
- bool hasIdentifier(const QString &id) override;
-
- void connectToId(const QString &id) override;
- void disconnectFromId(const QString &id) override;
-
- Q_INVOKABLE void initialize();
- Q_INVOKABLE void requestUpdate();
-
- QNetworkSession::State sessionStateForId(const QString &id) override;
-
- quint64 bytesWritten(const QString &id) override;
- quint64 bytesReceived(const QString &id) override;
- quint64 startTime(const QString &id) override;
-
- QNetworkConfigurationManager::Capabilities capabilities() const override;
-
- QNetworkSessionPrivate *createSessionBackend() override;
-
- QNetworkConfigurationPrivatePointer defaultConfiguration() override;
-
-private Q_SLOTS:
- void interfacePropertiesChanged(const QMap<QString, QVariant> &properties);
- void activeConnectionPropertiesChanged(const QMap<QString, QVariant> &properties);
-
- void newConnection(const QDBusObjectPath &path, QNetworkManagerSettings *settings = nullptr);
- void removeConnection(const QString &path);
- void updateConnection();
- void activationFinished(QDBusPendingCallWatcher *watcher);
- void deviceConnectionsChanged(const QStringList &activeConnectionsList);
-
- void wiredCarrierChanged(bool);
-
- void nmRegistered(const QString &serviceName = QString());
- void nmUnRegistered(const QString &serviceName = QString());
-
- void ofonoRegistered(const QString &serviceName = QString());
- void ofonoUnRegistered(const QString &serviceName = QString());
-
-private:
- QNetworkConfigurationPrivate *parseConnection(const QString &settingsPath,
- const QNmSettingsMap &map);
- QNetworkManagerSettingsConnection *connectionFromId(const QString &id) const;
-
- QNetworkManagerInterface *managerInterface;
- QNetworkManagerSettings *systemSettings;
- QHash<QString, QNetworkManagerInterfaceDeviceWired *> wiredDevices;
- QHash<QString, QNetworkManagerInterfaceDeviceWireless *> wirelessDevices;
-
- QHash<QString, QNetworkManagerConnectionActive *> activeConnectionsList;
- QList<QNetworkManagerSettingsConnection *> connections;
- QList<QNetworkManagerInterfaceAccessPoint *> accessPoints;
- QHash<QString, QNetworkManagerInterfaceDevice *> interfaceDevices;
-
- QMap<QString,QString> configuredAccessPoints; //ap, settings path
- QHash<QString,QString> connectionInterfaces; // ac, interface
-
- QOfonoManagerInterface *ofonoManager;
- QHash <QString, QOfonoDataConnectionManagerInterface *> ofonoContextManagers;
- QNetworkConfiguration::BearerType currentBearerType(const QString &id) const;
- QString contextName(const QString &path) const;
-
- bool isConnectionActive(const QString &settingsPath) const;
- QDBusServiceWatcher *ofonoWatcher;
- QDBusServiceWatcher *nmWatcher;
-
- bool isActiveContext(const QString &contextPath) const;
- bool nmAvailable;
- void setupConfigurations();
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
-
-#endif
-
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
deleted file mode 100644
index 2d6cba1791..0000000000
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ /dev/null
@@ -1,1019 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QObject>
-#include <QList>
-#include <QtDBus/QtDBus>
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusError>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
-#include <QtDBus/QDBusPendingCallWatcher>
-#include <QtDBus/QDBusObjectPath>
-#include <QtDBus/QDBusPendingCall>
-
-#include "qnetworkmanagerservice.h"
-
-#ifndef QT_NO_DBUS
-
-#define DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
-
-QT_BEGIN_NAMESPACE
-
-
-QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
- : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- NM_DBUS_INTERFACE,
- QDBusConnection::systemBus(),parent)
-{
- if (!isValid()) {
- return;
- }
-
- PropertiesDBusInterface managerPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- DBUS_PROPERTIES_INTERFACE,
- QDBusConnection::systemBus());
- QDBusPendingReply<QVariantMap> propsReply
- = managerPropertiesInterface.call(QDBus::Block, QLatin1String("GetAll"), QLatin1String(NM_DBUS_INTERFACE));
-
- if (!propsReply.isError()) {
- propertyMap = propsReply.value();
- } else {
- qWarning() << "propsReply" << propsReply.error().message();
- }
-
- QDBusPendingReply<QList <QDBusObjectPath> > nmReply
- = call(QLatin1String("GetDevices"));
- nmReply.waitForFinished();
- if (!nmReply.isError()) {
- devicesPathList = nmReply.value();
- } else {
- qWarning() << "nmReply" << nmReply.error().message();
- }
-
- QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- QLatin1String(NM_DBUS_INTERFACE),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QNetworkManagerInterface::~QNetworkManagerInterface()
-{
- QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- QLatin1String(NM_DBUS_INTERFACE),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
- QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- QLatin1String(NM_DBUS_INTERFACE),
- QLatin1String("DeviceAdded"),
- this,SIGNAL(deviceAdded(QDBusObjectPath)));
- QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- QLatin1String(NM_DBUS_INTERFACE),
- QLatin1String("DeviceRemoved"),
- this,SIGNAL(deviceRemoved(QDBusObjectPath)));
-}
-
-bool QNetworkManagerInterface::setConnections()
-{
- if (!isValid())
- return false;
-
- QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- QLatin1String(NM_DBUS_INTERFACE),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-
- bool allOk = false;
- if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- QLatin1String(NM_DBUS_INTERFACE),
- QLatin1String("DeviceAdded"),
- this,SIGNAL(deviceAdded(QDBusObjectPath)))) {
- allOk = true;
- }
- if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- QLatin1String(NM_DBUS_INTERFACE),
- QLatin1String("DeviceRemoved"),
- this,SIGNAL(deviceRemoved(QDBusObjectPath)))) {
- allOk = true;
- }
-
- return allOk;
-}
-
-QList <QDBusObjectPath> QNetworkManagerInterface::getDevices()
-{
- if (devicesPathList.isEmpty()) {
- //qWarning("using blocking call!");
- QDBusReply<QList<QDBusObjectPath> > reply = call(QLatin1String("GetDevices"));
- devicesPathList = reply.value();
- }
- return devicesPathList;
-}
-
-void QNetworkManagerInterface::activateConnection(QDBusObjectPath connectionPath,
- QDBusObjectPath devicePath,
- QDBusObjectPath specificObject)
-{
- QDBusPendingCall pendingCall = asyncCall(QLatin1String("ActivateConnection"),
- QVariant::fromValue(connectionPath),
- QVariant::fromValue(devicePath),
- QVariant::fromValue(specificObject));
-
- QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(pendingCall);
- connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SIGNAL(activationFinished(QDBusPendingCallWatcher*)));
-}
-
-void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath)
-{
- asyncCall(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
-}
-
-bool QNetworkManagerInterface::wirelessEnabled() const
-{
- if (propertyMap.contains("WirelessEnabled"))
- return propertyMap.value("WirelessEnabled").toBool();
- return false;
-}
-
-bool QNetworkManagerInterface::wirelessHardwareEnabled() const
-{
- if (propertyMap.contains("WirelessHardwareEnabled"))
- return propertyMap.value("WirelessHardwareEnabled").toBool();
- return false;
-}
-
-QList <QDBusObjectPath> QNetworkManagerInterface::activeConnections() const
-{
- if (propertyMap.contains("ActiveConnections")) {
-
- const QDBusArgument &dbusArgs = qvariant_cast<QDBusArgument>(propertyMap.value("ActiveConnections"));
- QDBusObjectPath path;
- QList <QDBusObjectPath> list;
-
- dbusArgs.beginArray();
- while (!dbusArgs.atEnd()) {
- dbusArgs >> path;
- list.append(path);
- }
- dbusArgs.endArray();
-
- return list;
- }
-
- QList <QDBusObjectPath> list;
- list << QDBusObjectPath();
- return list;
-}
-
-QNetworkManagerInterface::NMState QNetworkManagerInterface::state()
-{
- if (propertyMap.contains("State"))
- return static_cast<QNetworkManagerInterface::NMState>(propertyMap.value("State").toUInt());
- return QNetworkManagerInterface::NM_STATE_UNKNOWN;
-}
-
-QString QNetworkManagerInterface::version() const
-{
- if (propertyMap.contains("Version"))
- return propertyMap.value("Version").toString();
- return QString();
-}
-
-void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
-{
- for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
- propertyMap.insert(i.key(),i.value());
-
- if (i.key() == QLatin1String("State")) {
- quint32 state = i.value().toUInt();
- if (state == NM_DEVICE_STATE_ACTIVATED
- || state == NM_DEVICE_STATE_DISCONNECTED
- || state == NM_DEVICE_STATE_UNAVAILABLE
- || state == NM_DEVICE_STATE_FAILED) {
- Q_EMIT propertiesChanged(map);
- Q_EMIT stateChanged(state);
- }
- } else if (i.key() == QLatin1String("ActiveConnections")) {
- Q_EMIT propertiesChanged(map);
- }
- }
-}
-
-QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent)
- : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
- dbusPathName,
- NM_DBUS_INTERFACE_ACCESS_POINT,
- QDBusConnection::systemBus(),parent)
-{
-}
-
-QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint()
-{
-}
-
-quint32 QNetworkManagerInterfaceAccessPoint::flags() const
-{
- if (propertyMap.contains("Flags"))
- return propertyMap.value("Flags").toUInt();
- return 0;
-}
-
-quint32 QNetworkManagerInterfaceAccessPoint::wpaFlags() const
-{
- if (propertyMap.contains("WpaFlags"))
- return propertyMap.value("WpaFlags").toUInt();
- return 0;
-}
-
-quint32 QNetworkManagerInterfaceAccessPoint::rsnFlags() const
-{
- if (propertyMap.contains("RsnFlags"))
- return propertyMap.value("RsnFlags").toUInt();
- return 0;
-}
-
-QString QNetworkManagerInterfaceAccessPoint::ssid() const
-{
- if (propertyMap.contains("Ssid"))
- return propertyMap.value("Ssid").toString();
- return QString();
-}
-
-quint32 QNetworkManagerInterfaceAccessPoint::frequency() const
-{
- if (propertyMap.contains("Frequency"))
- return propertyMap.value("Frequency").toUInt();
- return 0;
-}
-
-QString QNetworkManagerInterfaceAccessPoint::hwAddress() const
-{
- if (propertyMap.contains("HwAddress"))
- return propertyMap.value("HwAddress").toString();
- return QString();
-}
-
-quint32 QNetworkManagerInterfaceAccessPoint::mode() const
-{
- if (propertyMap.contains("Mode"))
- return propertyMap.value("Mode").toUInt();
- return 0;
-}
-
-quint32 QNetworkManagerInterfaceAccessPoint::maxBitrate() const
-{
- if (propertyMap.contains("MaxBitrate"))
- return propertyMap.value("MaxBitrate").toUInt();
- return 0;
-}
-
-quint32 QNetworkManagerInterfaceAccessPoint::strength() const
-{
- if (propertyMap.contains("Strength"))
- return propertyMap.value("Strength").toUInt();
- return 0;
-}
-
-void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap<QString,QVariant> map)
-{
- for (auto i = map.cbegin(), end = map.cend(); i != end; ++i)
- propertyMap.insert(i.key(),i.value());
-}
-
-QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent)
- : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
- deviceObjectPath,
- NM_DBUS_INTERFACE_DEVICE,
- QDBusConnection::systemBus(),parent)
-{
-
- if (!isValid()) {
- return;
- }
- PropertiesDBusInterface devicePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- deviceObjectPath,
- DBUS_PROPERTIES_INTERFACE,
- QDBusConnection::systemBus(),parent);
-
- QDBusPendingReply<QVariantMap> propsReply
- = devicePropertiesInterface.call(QDBus::Block, QLatin1String("GetAll"), QLatin1String(NM_DBUS_INTERFACE_DEVICE));
-
- if (!propsReply.isError()) {
- propertyMap = propsReply.value();
- }
-
- QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- deviceObjectPath,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice()
-{
- QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
- path(),
- QLatin1String(NM_DBUS_INTERFACE_DEVICE),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QString QNetworkManagerInterfaceDevice::udi() const
-{
- if (propertyMap.contains("Udi"))
- return propertyMap.value("Udi").toString();
- return QString();
-}
-
-QString QNetworkManagerInterfaceDevice::networkInterface() const
-{
- if (propertyMap.contains("Interface"))
- return propertyMap.value("Interface").toString();
- return QString();
-}
-
-quint32 QNetworkManagerInterfaceDevice::ip4Address() const
-{
- if (propertyMap.contains("Ip4Address"))
- return propertyMap.value("Ip4Address").toUInt();
- return 0;
-}
-
-quint32 QNetworkManagerInterfaceDevice::state() const
-{
- if (propertyMap.contains("State"))
- return propertyMap.value("State").toUInt();
- return 0;
-}
-
-quint32 QNetworkManagerInterfaceDevice::deviceType() const
-{
- if (propertyMap.contains("DeviceType"))
- return propertyMap.value("DeviceType").toUInt();
- return 0;
-}
-
-QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const
-{
- if (propertyMap.contains("Ip4Config"))
- return qvariant_cast<QDBusObjectPath>(propertyMap.value("Ip4Config"));
- return QDBusObjectPath();
-}
-
-void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
-{
- for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
- if (i.key() == QLatin1String("AvailableConnections")) { //Device
- const QDBusArgument &dbusArgs = qvariant_cast<QDBusArgument>(i.value());
- QDBusObjectPath path;
- QStringList paths;
- dbusArgs.beginArray();
- while (!dbusArgs.atEnd()) {
- dbusArgs >> path;
- paths << path.path();
- }
- dbusArgs.endArray();
- Q_EMIT connectionsChanged(paths);
- }
- propertyMap.insert(i.key(),i.value());
- }
- Q_EMIT propertiesChanged(map);
-}
-
-QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent)
- : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
- ifaceDevicePath,
- NM_DBUS_INTERFACE_DEVICE_WIRED,
- QDBusConnection::systemBus(), parent)
-{
- if (!isValid()) {
- return;
- }
- PropertiesDBusInterface deviceWiredPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- ifaceDevicePath,
- DBUS_PROPERTIES_INTERFACE,
- QDBusConnection::systemBus(),parent);
-
- QDBusPendingReply<QVariantMap> propsReply
- = deviceWiredPropertiesInterface.call(QDBus::Block, QLatin1String("GetAll"), QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED));
-
- if (!propsReply.isError()) {
- propertyMap = propsReply.value();
- }
-
- QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- ifaceDevicePath,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired()
-{
- QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
- path(),
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QString QNetworkManagerInterfaceDeviceWired::hwAddress() const
-{
- if (propertyMap.contains("HwAddress"))
- return propertyMap.value("HwAddress").toString();
- return QString();
-}
-
-quint32 QNetworkManagerInterfaceDeviceWired::speed() const
-{
- if (propertyMap.contains("Speed"))
- return propertyMap.value("Speed").toUInt();
- return 0;
-}
-
-bool QNetworkManagerInterfaceDeviceWired::carrier() const
-{
- if (propertyMap.contains("Carrier"))
- return propertyMap.value("Carrier").toBool();
- return false;
-}
-
-QStringList QNetworkManagerInterfaceDeviceWired::availableConnections()
-{
- QStringList list;
- if (propertyMap.contains("AvailableConnections")) {
- const QDBusArgument &dbusArgs = qvariant_cast<QDBusArgument>(propertyMap.value("Carrier"));
- QDBusObjectPath path;
- dbusArgs.beginArray();
- while (!dbusArgs.atEnd()) {
- dbusArgs >> path;
- list << path.path();
- }
- dbusArgs.endArray();
- }
-
- return list;
-}
-
-void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap<QString,QVariant> map)
-{
- for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
- propertyMap.insert(i.key(),i.value());
- if (i.key() == QLatin1String("Carrier"))
- Q_EMIT carrierChanged(i.value().toBool());
- }
- Q_EMIT propertiesChanged(map);
-}
-
-QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent)
- : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
- ifaceDevicePath,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
- QDBusConnection::systemBus(), parent)
-{
- if (!isValid()) {
- return;
- }
-
- interfacePath = ifaceDevicePath;
- QDBusPendingReply<QList <QDBusObjectPath> > nmReply
- = call(QLatin1String("GetAccessPoints"));
-
- if (!nmReply.isError()) {
- accessPointsList = nmReply.value();
- }
-
- PropertiesDBusInterface deviceWirelessPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- interfacePath,
- DBUS_PROPERTIES_INTERFACE,
- QDBusConnection::systemBus(),parent);
-
- QDBusPendingReply<QVariantMap> propsReply
- = deviceWirelessPropertiesInterface.call(QDBus::Block, QLatin1String("GetAll"), QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS));
-
- if (!propsReply.isError()) {
- propertyMap = propsReply.value();
- }
-
- QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- interfacePath,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless()
-{
- QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
- path(),
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-bool QNetworkManagerInterfaceDeviceWireless::setConnections()
-{
- return true;
-}
-
-QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
-{
- if (accessPointsList.isEmpty()) {
- //qWarning("Using blocking call!");
- QDBusReply<QList<QDBusObjectPath> > reply
- = call(QLatin1String("GetAccessPoints"));
- accessPointsList = reply.value();
- }
- return accessPointsList;
-}
-
-QString QNetworkManagerInterfaceDeviceWireless::hwAddress() const
-{
- if (propertyMap.contains("HwAddress"))
- return propertyMap.value("HwAddress").toString();
- return QString();
-}
-
-quint32 QNetworkManagerInterfaceDeviceWireless::mode() const
-{
- if (propertyMap.contains("Mode"))
- return propertyMap.value("Mode").toUInt();
- return 0;
-}
-
-quint32 QNetworkManagerInterfaceDeviceWireless::bitrate() const
-{
- if (propertyMap.contains("Bitrate"))
- return propertyMap.value("Bitrate").toUInt();
- return 0;
-}
-
-QDBusObjectPath QNetworkManagerInterfaceDeviceWireless::activeAccessPoint() const
-{
- if (propertyMap.contains("ActiveAccessPoint"))
- return qvariant_cast<QDBusObjectPath>(propertyMap.value("ActiveAccessPoint"));
- return QDBusObjectPath();
-}
-
-quint32 QNetworkManagerInterfaceDeviceWireless::wirelessCapabilities() const
-{
- if (propertyMap.contains("WirelelessCapabilities"))
- return propertyMap.value("WirelelessCapabilities").toUInt();
- return 0;
-}
-
-void QNetworkManagerInterfaceDeviceWireless::requestScan()
-{
- asyncCall(QLatin1String("RequestScan"));
-}
-
-void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVariant> map)
-{
- for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
- propertyMap.insert(i.key(),i.value());
- if (i.key() == QLatin1String("ActiveAccessPoint")) //DeviceWireless
- Q_EMIT propertiesChanged(map);
- }
-}
-
-QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const QString &ifaceDevicePath, QObject *parent)
- : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
- ifaceDevicePath,
- NM_DBUS_INTERFACE_DEVICE_MODEM,
- QDBusConnection::systemBus(), parent)
-{
- if (!isValid()) {
- return;
- }
- PropertiesDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- ifaceDevicePath,
- QLatin1String("org.freedesktop.DBus.Properties"),
- QDBusConnection::systemBus(),parent);
-
- QDBusPendingReply<QVariantMap> propsReply
- = deviceModemPropertiesInterface.call(QDBus::Block, QLatin1String("GetAll"), QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM));
-
- if (!propsReply.isError()) {
- propertyMap = propsReply.value();
- }
-
- QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- ifaceDevicePath,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QNetworkManagerInterfaceDeviceModem::~QNetworkManagerInterfaceDeviceModem()
-{
- QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
- path(),
- QLatin1String(NM_DBUS_PATH_SETTINGS),
- QLatin1String(NM_DBUS_IFACE_SETTINGS),
- QLatin1String("NewConnection"),
- this, SIGNAL(newConnection(QDBusObjectPath)));
-}
-
-QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceDeviceModem::modemCapabilities() const
-{
- if (propertyMap.contains("ModemCapabilities"))
- return static_cast<QNetworkManagerInterfaceDeviceModem::ModemCapabilities>(propertyMap.value("ModemCapabilities").toUInt());
- return QNetworkManagerInterfaceDeviceModem::None;
-}
-
-QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceDeviceModem::currentCapabilities() const
-{
- if (propertyMap.contains("CurrentCapabilities"))
- return static_cast<QNetworkManagerInterfaceDeviceModem::ModemCapabilities>(propertyMap.value("CurrentCapabilities").toUInt());
- return QNetworkManagerInterfaceDeviceModem::None;
-}
-
-void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap<QString,QVariant> map)
-{
- for (auto i = map.cbegin(), end = map.cend(); i != end; ++i)
- propertyMap.insert(i.key(),i.value());
- Q_EMIT propertiesChanged(map);
-}
-
-
-QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent)
- : QDBusAbstractInterface(settingsService,
- NM_DBUS_PATH_SETTINGS,
- NM_DBUS_IFACE_SETTINGS,
- QDBusConnection::systemBus(), parent)
-{
- if (!isValid()) {
- return;
- }
- interfacePath = settingsService;
- QDBusPendingReply<QList <QDBusObjectPath> > nmReply
- = call(QLatin1String("ListConnections"));
-
- if (!nmReply.isError()) {
- connectionsList = nmReply.value();
- }
-}
-
-QNetworkManagerSettings::~QNetworkManagerSettings()
-{
-}
-
-bool QNetworkManagerSettings::setConnections()
-{
- bool allOk = true;
- if (!QDBusConnection::systemBus().connect(interfacePath,
- QLatin1String(NM_DBUS_PATH_SETTINGS),
- QLatin1String(NM_DBUS_IFACE_SETTINGS),
- QLatin1String("NewConnection"),
- this, SIGNAL(newConnection(QDBusObjectPath)))) {
- allOk = false;
- qWarning("NewConnection could not be connected");
- }
-
- return allOk;
-}
-
-QList <QDBusObjectPath> QNetworkManagerSettings::listConnections()
-{
- if (connectionsList.isEmpty()) {
- //qWarning("Using blocking call!");
- QDBusReply<QList<QDBusObjectPath> > reply
- = call(QLatin1String("ListConnections"));
- connectionsList = reply.value();
- }
- return connectionsList;
-}
-
-
-QString QNetworkManagerSettings::getConnectionByUuid(const QString &uuid)
-{
- QDBusReply<QDBusObjectPath > reply = call(QDBus::Block, QLatin1String("GetConnectionByUuid"), uuid);
- return reply.value().path();
-}
-
-QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent)
- : QDBusAbstractInterface(settingsService,
- connectionObjectPath,
- NM_DBUS_IFACE_SETTINGS_CONNECTION,
- QDBusConnection::systemBus(), parent)
-{
- qDBusRegisterMetaType<QNmSettingsMap>();
- if (!isValid()) {
- return;
- }
- interfacepath = connectionObjectPath;
- QDBusPendingReply<QNmSettingsMap> nmReply
- = call(QLatin1String("GetSettings"));
- if (!nmReply.isError()) {
- settingsMap = nmReply.value();
- }
-}
-
-QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection()
-{
- QDBusConnection::systemBus().disconnect(service(),
- path(),
- QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
- QLatin1String("Updated"),
- this, SIGNAL(updated()));
- QDBusConnection::systemBus().disconnect(service(),
- path(),
- QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
- QLatin1String("Removed"),
- this, SIGNAL(slotSettingsRemoved()));
-}
-
-bool QNetworkManagerSettingsConnection::setConnections()
-{
- if (!isValid())
- return false;
-
- QDBusConnection dbusConnection = QDBusConnection::systemBus();
- bool allOk = true;
- if (!dbusConnection.connect(service(),
- interfacepath,
- QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
- QLatin1String("Updated"),
- this, SIGNAL(updated()))) {
- allOk = false;
- }
-
- if (!dbusConnection.connect(service(),
- interfacepath,
- QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
- QLatin1String("Removed"),
- this, SIGNAL(slotSettingsRemoved()))) {
- allOk = false;
- }
- return allOk;
-}
-
-void QNetworkManagerSettingsConnection::slotSettingsRemoved()
-{
- Q_EMIT removed(interfacepath);
-}
-
-QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
-{
- if (settingsMap.isEmpty()) {
- //qWarning("Using blocking call!");
- QDBusReply<QNmSettingsMap> reply = call(QLatin1String("GetSettings"));
- settingsMap = reply.value();
- }
- return settingsMap;
-}
-
-NMDeviceType QNetworkManagerSettingsConnection::getType()
-{
- const QString devType =
- settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString();
-
- if (devType == QLatin1String("802-3-ethernet"))
- return DEVICE_TYPE_ETHERNET;
- else if (devType == QLatin1String("802-11-wireless"))
- return DEVICE_TYPE_WIFI;
- else if (devType == QLatin1String("gsm"))
- return DEVICE_TYPE_MODEM;
- else
- return DEVICE_TYPE_UNKNOWN;
-}
-
-bool QNetworkManagerSettingsConnection::isAutoConnect()
-{
- const QVariant autoConnect =
- settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect"));
-
- // NetworkManager default is to auto connect
- if (!autoConnect.isValid())
- return true;
-
- return autoConnect.toBool();
-}
-
-quint64 QNetworkManagerSettingsConnection::getTimestamp()
-{
- return settingsMap.value(QLatin1String("connection"))
- .value(QLatin1String("timestamp")).toUInt();
-}
-
-QString QNetworkManagerSettingsConnection::getId()
-{
- return settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString();
-}
-
-QString QNetworkManagerSettingsConnection::getUuid()
-{
- const QString id = settingsMap.value(QLatin1String("connection"))
- .value(QLatin1String("uuid")).toString();
-
- // is no uuid, return the connection path
- return id.isEmpty() ? path() : id;
-}
-
-QString QNetworkManagerSettingsConnection::getSsid()
-{
- return settingsMap.value(QLatin1String("802-11-wireless"))
- .value(QLatin1String("ssid")).toString();
-}
-
-QString QNetworkManagerSettingsConnection::getMacAddress()
-{
- NMDeviceType type = getType();
-
- if (type == DEVICE_TYPE_ETHERNET) {
- return settingsMap.value(QLatin1String("802-3-ethernet"))
- .value(QLatin1String("mac-address")).toString();
- } else if (type == DEVICE_TYPE_WIFI) {
- return settingsMap.value(QLatin1String("802-11-wireless"))
- .value(QLatin1String("mac-address")).toString();
- } else {
- return QString();
- }
-}
-
-QStringList QNetworkManagerSettingsConnection::getSeenBssids()
-{
- if (getType() == DEVICE_TYPE_WIFI) {
- return settingsMap.value(QLatin1String("802-11-wireless"))
- .value(QLatin1String("seen-bssids")).toStringList();
- } else {
- return QStringList();
- }
-}
-
-QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &activeConnectionObjectPath, QObject *parent)
- : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
- activeConnectionObjectPath,
- NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
- QDBusConnection::systemBus(), parent)
-{
- if (!isValid()) {
- return;
- }
- PropertiesDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- activeConnectionObjectPath,
- QLatin1String("org.freedesktop.DBus.Properties"),
- QDBusConnection::systemBus());
-
-
- QDBusPendingReply<QVariantMap> propsReply
- = connectionActivePropertiesInterface.call(QDBus::Block, QLatin1String("GetAll"), QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION));
-
- if (!propsReply.isError()) {
- propertyMap = propsReply.value();
- } else {
- qWarning() << propsReply.error().message();
- }
-
- QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- activeConnectionObjectPath,
- QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive()
-{
- QDBusConnection::systemBus().disconnect(QLatin1String(NM_DBUS_SERVICE),
- path(),
- QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
- QLatin1String("PropertiesChanged"),
- this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-}
-
-QDBusObjectPath QNetworkManagerConnectionActive::connection() const
-{
- if (propertyMap.contains("Connection"))
- return qvariant_cast<QDBusObjectPath>(propertyMap.value("Connection"));
- return QDBusObjectPath();
-}
-
-QDBusObjectPath QNetworkManagerConnectionActive::specificObject() const
-{
- if (propertyMap.contains("SpecificObject"))
- return qvariant_cast<QDBusObjectPath>(propertyMap.value("SpecificObject"));
- return QDBusObjectPath();
-}
-
-QStringList QNetworkManagerConnectionActive::devices() const
-{
- QStringList list;
- if (propertyMap.contains("Devices")) {
- const QDBusArgument &dbusArgs = qvariant_cast<QDBusArgument>(propertyMap.value("Devices"));
- QDBusObjectPath path;
-
- dbusArgs.beginArray();
- while (!dbusArgs.atEnd()) {
- dbusArgs >> path;
- list.append(path.path());
- }
- dbusArgs.endArray();
- }
- return list;
-}
-
-quint32 QNetworkManagerConnectionActive::state() const
-{
- if (propertyMap.contains("State"))
- return propertyMap.value("State").toUInt();
- return 0;
-}
-
-bool QNetworkManagerConnectionActive::defaultRoute() const
-{
- if (propertyMap.contains("Default"))
- return propertyMap.value("Default").toBool();
- return false;
-}
-
-bool QNetworkManagerConnectionActive::default6Route() const
-{
- if (propertyMap.contains("Default6"))
- return propertyMap.value("Default6").toBool();
- return false;
-}
-
-void QNetworkManagerConnectionActive::propertiesSwap(QMap<QString,QVariant> map)
-{
- for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
- propertyMap.insert(i.key(),i.value());
- if (i.key() == QLatin1String("State")) {
- quint32 state = i.value().toUInt();
- if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
- || state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
- Q_EMIT propertiesChanged(map);
- }
- }
- }
-}
-
-QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent)
- : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
- deviceObjectPath,
- NM_DBUS_INTERFACE_IP4_CONFIG,
- QDBusConnection::systemBus(), parent)
-{
- if (!isValid()) {
- return;
- }
-}
-
-QNetworkManagerIp4Config::~QNetworkManagerIp4Config()
-{
-}
-
-QStringList QNetworkManagerIp4Config::domains() const
-{
- return property("Domains").toStringList();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
deleted file mode 100644
index bff7a71097..0000000000
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
+++ /dev/null
@@ -1,500 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKMANAGERSERVICE_H
-#define QNETWORKMANAGERSERVICE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtDBus/QtDBus>
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusError>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
-
-#include <QtDBus/QDBusPendingCallWatcher>
-#include <QtDBus/QDBusObjectPath>
-#include <QtDBus/QDBusContext>
-#include <QtDBus/QDBusAbstractInterface>
-#include <QMap>
-
-#ifndef QT_NO_DBUS
-
-#ifndef NETWORK_MANAGER_H
-typedef enum NMDeviceType
-{
- DEVICE_TYPE_UNKNOWN = 0,
- DEVICE_TYPE_ETHERNET,
- DEVICE_TYPE_WIFI,
- DEVICE_TYPE_MODEM = 8
-} NMDeviceType;
-
-typedef enum
-{
- NM_DEVICE_STATE_UNKNOWN = 0,
- NM_DEVICE_STATE_UNMANAGED = 10,
- NM_DEVICE_STATE_UNAVAILABLE = 20,
- NM_DEVICE_STATE_DISCONNECTED = 30,
- NM_DEVICE_STATE_PREPARE = 40,
- NM_DEVICE_STATE_CONFIG = 50,
- NM_DEVICE_STATE_NEED_AUTH = 60,
- NM_DEVICE_STATE_IP_CONFIG = 70,
- NM_DEVICE_STATE_ACTIVATED = 100,
- NM_DEVICE_STATE_DEACTIVATING = 110,
- NM_DEVICE_STATE_FAILED = 120
-} NMDeviceState;
-
-typedef enum
-{
- NM_ACTIVE_CONNECTION_STATE_UNKNOWN = 0,
- NM_ACTIVE_CONNECTION_STATE_ACTIVATING,
- NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
- NM_ACTIVE_CONNECTION_STATE_DEACTIVATED = 4
-} NMActiveConnectionState;
-
-#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager"
-
-#define NM_DBUS_PATH "/org/freedesktop/NetworkManager"
-#define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager"
-#define NM_DBUS_INTERFACE_DEVICE NM_DBUS_INTERFACE ".Device"
-#define NM_DBUS_INTERFACE_DEVICE_WIRED NM_DBUS_INTERFACE_DEVICE ".Wired"
-#define NM_DBUS_INTERFACE_DEVICE_WIRELESS NM_DBUS_INTERFACE_DEVICE ".Wireless"
-#define NM_DBUS_INTERFACE_DEVICE_MODEM NM_DBUS_INTERFACE_DEVICE ".Modem"
-#define NM_DBUS_PATH_ACCESS_POINT NM_DBUS_PATH "/AccessPoint"
-#define NM_DBUS_INTERFACE_ACCESS_POINT NM_DBUS_INTERFACE ".AccessPoint"
-
-#define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManager/Settings"
-
-#define NM_DBUS_IFACE_SETTINGS_CONNECTION "org.freedesktop.NetworkManager.Settings.Connection"
-#define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManager.Settings"
-#define NM_DBUS_INTERFACE_ACTIVE_CONNECTION NM_DBUS_INTERFACE ".Connection.Active"
-#define NM_DBUS_INTERFACE_IP4_CONFIG NM_DBUS_INTERFACE ".IP4Config"
-
-#define NM_DBUS_SERVICE_USER_SETTINGS "org.freedesktop.NetworkManagerUserSettings"
-#define NM_DBUS_SERVICE_SYSTEM_SETTINGS "org.freedesktop.NetworkManagerSystemSettings"
-
-#define NM_802_11_AP_FLAGS_NONE 0x00000000
-#define NM_802_11_AP_FLAGS_PRIVACY 0x00000001
-#endif
-
-QT_BEGIN_NAMESPACE
-
-typedef QMap< QString, QMap<QString,QVariant> > QNmSettingsMap;
-typedef QList<quint32> ServerThing;
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QNmSettingsMap))
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ServerThing))
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkManagerInterface : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
- typedef enum
- {
- NM_STATE_UNKNOWN = 0,
- NM_STATE_ASLEEP = 10,
- NM_STATE_DISCONNECTED = 20,
- NM_STATE_DISCONNECTING = 30,
- NM_STATE_CONNECTING = 40,
- NM_STATE_CONNECTED_LOCAL = 50,
- NM_STATE_CONNECTED_SITE = 60,
- NM_STATE_CONNECTED_GLOBAL = 70
- } NMState;
-
- QNetworkManagerInterface(QObject *parent = nullptr);
- ~QNetworkManagerInterface();
-
- QList <QDBusObjectPath> getDevices();
- void activateConnection(QDBusObjectPath connection,QDBusObjectPath device, QDBusObjectPath specificObject);
- void deactivateConnection(QDBusObjectPath connectionPath);
-
- QDBusObjectPath path() const;
-
- bool wirelessEnabled() const;
- bool wirelessHardwareEnabled() const;
- QList <QDBusObjectPath> activeConnections() const;
- NMState state();
- QString version() const;
- bool setConnections();
-
-Q_SIGNALS:
- void deviceAdded(QDBusObjectPath);
- void deviceRemoved(QDBusObjectPath);
- void propertiesChanged(QMap<QString,QVariant>);
- void stateChanged(quint32);
- void activationFinished(QDBusPendingCallWatcher*);
- void propertiesReady();
- void devicesListReady();
-
-private Q_SLOTS:
- void propertiesSwap(QMap<QString,QVariant>);
-
-private:
- QVariantMap propertyMap;
- QList<QDBusObjectPath> devicesPathList;
-
-};
-
-class QNetworkManagerInterfaceAccessPoint : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- enum DeviceState {
- Unknown = 0,
- Unmanaged,
- Unavailable,
- Disconnected,
- Prepare,
- Config,
- NeedAuthentication,
- IpConfig,
- Activated,
- Failed
- };
-
- enum ApFlag {
- ApNone = 0x0,
- Privacy = 0x1
- };
-
- Q_DECLARE_FLAGS(ApFlags, ApFlag)
-
- enum ApSecurityFlag {
- ApSecurityNone = 0x0,
- PairWep40 = 0x1,
- PairWep104 = 0x2,
- PairTkip = 0x4,
- PairCcmp = 0x8,
- GroupWep40 = 0x10,
- GroupWep104 = 0x20,
- GroupTkip = 0x40,
- GroupCcmp = 0x80,
- KeyPsk = 0x100,
- Key8021x = 0x200
- };
-
- Q_DECLARE_FLAGS(ApSecurityFlags, ApSecurityFlag)
-
- explicit QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = nullptr);
- ~QNetworkManagerInterfaceAccessPoint();
-
- quint32 flags() const;
- quint32 wpaFlags() const;
- quint32 rsnFlags() const;
- QString ssid() const;
- quint32 frequency() const;
- QString hwAddress() const;
- quint32 mode() const;
- quint32 maxBitrate() const;
- quint32 strength() const;
- // bool setConnections();
-
-Q_SIGNALS:
- void propertiesChanged(QMap<QString,QVariant>);
- void propertiesReady();
-
-private Q_SLOTS:
- void propertiesSwap(QMap<QString,QVariant>);
-
-private:
- QVariantMap propertyMap;
-};
-
-class QNetworkManagerInterfaceDevice : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- explicit QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = nullptr);
- ~QNetworkManagerInterfaceDevice();
-
- QString udi() const;
- QString networkInterface() const;
- quint32 ip4Address() const;
- quint32 state() const;
- quint32 deviceType() const;
-
- QDBusObjectPath ip4config() const;
-
-Q_SIGNALS:
- void stateChanged(const QString &, quint32);
- void propertiesChanged(QMap<QString,QVariant>);
- void connectionsChanged(QStringList);
- void propertiesReady();
-private Q_SLOTS:
- void propertiesSwap(QMap<QString,QVariant>);
-private:
- QVariantMap propertyMap;
-};
-
-class QNetworkManagerInterfaceDeviceWired : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- explicit QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath,
- QObject *parent = nullptr);
- ~QNetworkManagerInterfaceDeviceWired();
-
- QString hwAddress() const;
- quint32 speed() const;
- bool carrier() const;
- QStringList availableConnections();
-
-Q_SIGNALS:
- void propertiesChanged(QMap<QString,QVariant>);
- void propertiesReady();
- void carrierChanged(bool);
-
-private Q_SLOTS:
- void propertiesSwap(QMap<QString,QVariant>);
-
-private:
- QVariantMap propertyMap;
-};
-
-class QNetworkManagerInterfaceDeviceWireless : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- enum DeviceCapability {
- None = 0x0,
- Wep40 = 0x1,
- Wep104 = 0x2,
- Tkip = 0x4,
- Ccmp = 0x8,
- Wpa = 0x10,
- Rsn = 0x20
- };
-
- explicit QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath,
- QObject *parent = nullptr);
- ~QNetworkManagerInterfaceDeviceWireless();
-
- QList <QDBusObjectPath> getAccessPoints();
-
- QString hwAddress() const;
- quint32 mode() const;
- quint32 bitrate() const;
- QDBusObjectPath activeAccessPoint() const;
- quint32 wirelessCapabilities() const;
- bool setConnections();
-
- void requestScan();
-Q_SIGNALS:
- void propertiesChanged(QMap<QString,QVariant>);
- void propertiesReady();
-
-private Q_SLOTS:
- void propertiesSwap(QMap<QString,QVariant>);
-
-private:
- QVariantMap propertyMap;
- QList <QDBusObjectPath> accessPointsList;
- QString interfacePath;
-};
-
-class QNetworkManagerInterfaceDeviceModem : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- enum ModemCapability {
- None = 0x0,
- Pots = 0x1,
- Cmda_Edvo = 0x2,
- Gsm_Umts = 0x4,
- Lte = 0x08
- };
- Q_DECLARE_FLAGS(ModemCapabilities, ModemCapability)
-
- explicit QNetworkManagerInterfaceDeviceModem(const QString &ifaceDevicePath,
- QObject *parent = nullptr);
- ~QNetworkManagerInterfaceDeviceModem();
-
- ModemCapabilities modemCapabilities() const;
- ModemCapabilities currentCapabilities() const;
-
-Q_SIGNALS:
- void propertiesChanged(QMap<QString,QVariant>);
- void propertiesReady();
-
-private Q_SLOTS:
- void propertiesSwap(QMap<QString,QVariant>);
-
-private:
- QVariantMap propertyMap;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkManagerInterfaceDeviceModem::ModemCapabilities)
-
-class QNetworkManagerSettings : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- explicit QNetworkManagerSettings(const QString &settingsService, QObject *parent = nullptr);
- ~QNetworkManagerSettings();
-
- QList <QDBusObjectPath> listConnections();
- QString getConnectionByUuid(const QString &uuid);
- bool setConnections();
-
-Q_SIGNALS:
- void newConnection(QDBusObjectPath);
- void connectionsListReady();
-private:
- QList <QDBusObjectPath> connectionsList;
- QString interfacePath;
-};
-
-class QNetworkManagerSettingsConnection : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent = nullptr);
- ~QNetworkManagerSettingsConnection();
-
- QNmSettingsMap getSettings();
- bool setConnections();
- NMDeviceType getType();
- bool isAutoConnect();
- quint64 getTimestamp();
- QString getId();
- QString getUuid();
- QString getSsid();
- QString getMacAddress();
- QStringList getSeenBssids();
-
-Q_SIGNALS:
- void updated();
- void removed(const QString &path);
- void settingsReady();
-
-private Q_SLOTS:
- void slotSettingsRemoved();
-private:
- QNmSettingsMap settingsMap;
- QString interfacepath;
-};
-
-class QNetworkManagerConnectionActive : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- enum ActiveConnectionState {
- Unknown = 0,
- Activating = 1,
- Activated = 2
- };
-
- explicit QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = nullptr);
- ~ QNetworkManagerConnectionActive();
-
- QDBusObjectPath connection() const;
- QDBusObjectPath specificObject() const;
- QStringList devices() const;
- quint32 state() const;
- bool defaultRoute() const;
- bool default6Route() const;
-
-
-Q_SIGNALS:
- void propertiesChanged(QMap<QString,QVariant>);
- void propertiesReady();
-
-private Q_SLOTS:
- void propertiesSwap(QMap<QString,QVariant>);
-
-private:
- QVariantMap propertyMap;
-};
-
-class QNetworkManagerIp4Config : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
- explicit QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = nullptr);
- ~QNetworkManagerIp4Config();
-
- QStringList domains() const;
-};
-
-class PropertiesDBusInterface : public QDBusAbstractInterface
-{
-public:
- PropertiesDBusInterface(const QString &service, const QString &path,
- const QString &interface, const QDBusConnection &connection,
- QObject *parent = nullptr)
- : QDBusAbstractInterface(service, path, interface.toLatin1().data(), connection, parent)
- {}
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
-#endif //QNETWORKMANAGERSERVICE_H
diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp
deleted file mode 100644
index 8e45c071e8..0000000000
--- a/src/plugins/bearer/nla/main.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnlaengine.h"
-
-#include <QtNetwork/private/qbearerplugin_p.h>
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-class QNlaEnginePlugin : public QBearerEnginePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "nla.json")
-
-public:
- QNlaEnginePlugin();
- ~QNlaEnginePlugin();
-
- QBearerEngine *create(const QString &key) const;
-};
-
-QNlaEnginePlugin::QNlaEnginePlugin()
-{
-}
-
-QNlaEnginePlugin::~QNlaEnginePlugin()
-{
-}
-
-QBearerEngine *QNlaEnginePlugin::create(const QString &key) const
-{
- if (key == QLatin1String("nla"))
- return new QNlaEngine;
- else
- return 0;
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/bearer/nla/nla.json b/src/plugins/bearer/nla/nla.json
deleted file mode 100644
index 2554d2c5c4..0000000000
--- a/src/plugins/bearer/nla/nla.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "nla" ]
-}
diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro
deleted file mode 100644
index 2582dc7cd4..0000000000
--- a/src/plugins/bearer/nla/nla.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TARGET = qnlabearer
-
-QT = core core-private network network-private
-
-QMAKE_USE_PRIVATE += ws2_32
-
-HEADERS += qnlaengine.h \
- ../platformdefs_win.h
-
-SOURCES += main.cpp \
- qnlaengine.cpp
-
-OTHER_FILES += nla.json
-
-PLUGIN_TYPE = bearer
-PLUGIN_CLASS_NAME = QNlaEnginePlugin
-load(qt_plugin)
diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp
deleted file mode 100644
index ab3c0d0e3a..0000000000
--- a/src/plugins/bearer/nla/qnlaengine.cpp
+++ /dev/null
@@ -1,639 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnlaengine.h"
-#include <private/qnetworksession_impl_p.h>
-
-#include <QtNetwork/private/qnetworkconfiguration_p.h>
-
-#include <QtCore/qthread.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qstringlist.h>
-
-#include <QtCore/qdebug.h>
-
-#include "../platformdefs_win.h"
-
-QT_BEGIN_NAMESPACE
-
-QWindowsSockInit2::QWindowsSockInit2()
-: version(0)
-{
- //### should we try for 2.2 on all platforms ??
- WSAData wsadata;
-
- // IPv6 requires Winsock v2.0 or better.
- if (WSAStartup(MAKEWORD(2,0), &wsadata) != 0) {
- qWarning("QBearerManagementAPI: WinSock v2.0 initialization failed.");
- } else {
- version = 0x20;
- }
-}
-
-QWindowsSockInit2::~QWindowsSockInit2()
-{
- WSACleanup();
-}
-
-#ifdef BEARER_MANAGEMENT_DEBUG
-static void printBlob(NLA_BLOB *blob)
-{
- qDebug() << "==== BEGIN NLA_BLOB ====" << Qt::endl
-
- << "type:" << blob->header.type << Qt::endl
- << "size:" << blob->header.dwSize << Qt::endl
- << "next offset:" << blob->header.nextOffset;
-
- switch (blob->header.type) {
- case NLA_RAW_DATA:
- qDebug() << "Raw Data" << Qt::endl
- << '\t' << blob->data.rawData;
- break;
- case NLA_INTERFACE:
- qDebug() << "Interface" << Qt::endl
- << "\ttype:" << blob->data.interfaceData.dwType << Qt::endl
- << "\tspeed:" << blob->data.interfaceData.dwSpeed << Qt::endl
- << "\tadapter:" << blob->data.interfaceData.adapterName;
- break;
- case NLA_802_1X_LOCATION:
- qDebug() << "802.1x Location" << Qt::endl
- << '\t' << blob->data.locationData.information;
- break;
- case NLA_CONNECTIVITY:
- qDebug() << "Connectivity" << Qt::endl
- << "\ttype:" << blob->data.connectivity.type << Qt::endl
- << "\tinternet:" << blob->data.connectivity.internet;
- break;
- case NLA_ICS:
- qDebug() << "ICS" << Qt::endl
- << "\tspeed:" << blob->data.ICS.remote.speed << Qt::endl
- << "\ttype:" << blob->data.ICS.remote.type << Qt::endl
- << "\tstate:" << blob->data.ICS.remote.state << Qt::endl
- << "\tmachine name:" << blob->data.ICS.remote.machineName << Qt::endl
- << "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName;
- break;
- default:
- qDebug("UNKNOWN BLOB TYPE");
- }
-
- qDebug("===== END NLA_BLOB =====");
-}
-#endif
-
-static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface)
-{
- unsigned long oid;
- DWORD bytesWritten;
-
- NDIS_MEDIUM medium;
- NDIS_PHYSICAL_MEDIUM physicalMedium;
-
- HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0,
- FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
- if (handle == INVALID_HANDLE_VALUE)
- return QNetworkConfiguration::BearerUnknown;
-
- oid = OID_GEN_MEDIA_SUPPORTED;
- bytesWritten = 0;
- bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
- &medium, sizeof(medium), &bytesWritten, 0);
- if (!result) {
- CloseHandle(handle);
- return QNetworkConfiguration::BearerUnknown;
- }
-
- oid = OID_GEN_PHYSICAL_MEDIUM;
- bytesWritten = 0;
- result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
- &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0);
- if (!result) {
- CloseHandle(handle);
-
- if (medium == NdisMedium802_3)
- return QNetworkConfiguration::BearerEthernet;
- else
- return QNetworkConfiguration::BearerUnknown;
- }
-
- CloseHandle(handle);
-
- if (medium == NdisMedium802_3) {
- switch (physicalMedium) {
- case NdisPhysicalMediumWirelessLan:
- return QNetworkConfiguration::BearerWLAN;
- case NdisPhysicalMediumBluetooth:
- return QNetworkConfiguration::BearerBluetooth;
- case NdisPhysicalMediumWiMax:
- return QNetworkConfiguration::BearerWiMAX;
- default:
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Physical Medium" << physicalMedium;
-#endif
- return QNetworkConfiguration::BearerEthernet;
- }
- }
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << medium << physicalMedium;
-#endif
-
- return QNetworkConfiguration::BearerUnknown;
-}
-
-class QNlaThread : public QThread
-{
- Q_OBJECT
-
-public:
- QNlaThread(QNlaEngine *parent = 0);
- ~QNlaThread();
-
- QList<QNetworkConfigurationPrivate *> getConfigurations();
-
- void forceUpdate();
-
-protected:
- virtual void run();
-
-private:
- void updateConfigurations(QList<QNetworkConfigurationPrivate *> &configs);
- DWORD parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv) const;
- QNetworkConfigurationPrivate *parseQuerySet(const WSAQUERYSET *querySet) const;
- void fetchConfigurations();
-
-signals:
- void networksChanged();
-
-private:
- QMutex mutex;
- HANDLE handle;
- bool done;
- QList<QNetworkConfigurationPrivate *> fetchedConfigurations;
-};
-
-QNlaThread::QNlaThread(QNlaEngine *parent)
-: QThread(parent), handle(0), done(false)
-{
-}
-
-QNlaThread::~QNlaThread()
-{
- mutex.lock();
-
- done = true;
-
- if (handle) {
- /* cancel completion event */
- if (WSALookupServiceEnd(handle) == SOCKET_ERROR) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("WSALookupServiceEnd error %d", WSAGetLastError());
-#endif
- }
- }
- mutex.unlock();
-
- wait();
-}
-
-QList<QNetworkConfigurationPrivate *> QNlaThread::getConfigurations()
-{
- QMutexLocker locker(&mutex);
-
- QList<QNetworkConfigurationPrivate *> foundConfigurations = fetchedConfigurations;
- fetchedConfigurations.clear();
-
- return foundConfigurations;
-}
-
-void QNlaThread::forceUpdate()
-{
- mutex.lock();
-
- if (handle) {
- /* cancel completion event */
- if (WSALookupServiceEnd(handle) == SOCKET_ERROR) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("WSALookupServiceEnd error %d", WSAGetLastError());
-#endif
- }
- handle = 0;
- }
- mutex.unlock();
-}
-
-void QNlaThread::run()
-{
- WSAEVENT changeEvent = WSACreateEvent();
- if (changeEvent == WSA_INVALID_EVENT)
- return;
-
- while (true) {
- fetchConfigurations();
-
- WSAQUERYSET qsRestrictions;
-
- memset(&qsRestrictions, 0, sizeof(qsRestrictions));
- qsRestrictions.dwSize = sizeof(qsRestrictions);
- qsRestrictions.dwNameSpace = NS_NLA;
-
- mutex.lock();
- if (done) {
- mutex.unlock();
- break;
- }
- int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL, &handle);
- mutex.unlock();
-
- if (result == SOCKET_ERROR)
- break;
-
- WSACOMPLETION completion;
- WSAOVERLAPPED overlapped;
-
- memset(&overlapped, 0, sizeof(overlapped));
- overlapped.hEvent = changeEvent;
-
- memset(&completion, 0, sizeof(completion));
- completion.Type = NSP_NOTIFY_EVENT;
- completion.Parameters.Event.lpOverlapped = &overlapped;
-
- DWORD bytesReturned = 0;
- result = WSANSPIoctl(handle, SIO_NSP_NOTIFY_CHANGE, 0, 0, 0, 0,
- &bytesReturned, &completion);
- if (result == SOCKET_ERROR) {
- if (WSAGetLastError() != WSA_IO_PENDING)
- break;
- }
-
- // Not interested in unrelated IO completion events
- // although we also don't want to block them
- while (WaitForSingleObjectEx(changeEvent, WSA_INFINITE, true) != WAIT_IO_COMPLETION &&
- handle)
- {
- }
-
- mutex.lock();
- if (handle) {
- result = WSALookupServiceEnd(handle);
- if (result == SOCKET_ERROR) {
- mutex.unlock();
- break;
- }
- handle = 0;
- }
- mutex.unlock();
- }
-
- WSACloseEvent(changeEvent);
-}
-
-void QNlaThread::updateConfigurations(QList<QNetworkConfigurationPrivate *> &configs)
-{
- mutex.lock();
-
- while (!fetchedConfigurations.isEmpty())
- delete fetchedConfigurations.takeFirst();
-
- fetchedConfigurations = configs;
-
- mutex.unlock();
-
- emit networksChanged();
-}
-
-DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv) const
-{
-#ifdef BEARER_MANAGEMENT_DEBUG
- printBlob(blob);
-#endif
-
- switch (blob->header.type) {
- case NLA_RAW_DATA:
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: unhandled header type NLA_RAW_DATA", __FUNCTION__);
-#endif
- break;
- case NLA_INTERFACE:
- cpPriv->state = QNetworkConfiguration::Active;
- if (QNlaEngine *engine = qobject_cast<QNlaEngine *>(parent())) {
- engine->configurationInterface[cpPriv->id.toUInt()] =
- QString::fromLatin1(blob->data.interfaceData.adapterName);
- }
- break;
- case NLA_802_1X_LOCATION:
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: unhandled header type NLA_802_1X_LOCATION", __FUNCTION__);
-#endif
- break;
- case NLA_CONNECTIVITY:
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: unhandled header type NLA_CONNECTIVITY", __FUNCTION__);
-#endif
- break;
- case NLA_ICS:
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: unhandled header type NLA_ICS", __FUNCTION__);
-#endif
- break;
- default:
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("%s: unhandled header type %d", __FUNCTION__, blob->header.type);
-#endif
- ;
- }
-
- return blob->header.nextOffset;
-}
-
-QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *querySet) const
-{
- QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate;
-
- cpPriv->name = QString::fromWCharArray(querySet->lpszServiceInstanceName);
- cpPriv->isValid = true;
- cpPriv->id = QString::number(qHash(QLatin1String("NLA:") + cpPriv->name));
- cpPriv->state = QNetworkConfiguration::Defined;
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "size:" << querySet->dwSize;
- qDebug() << "service instance name:" << QString::fromUtf16(querySet->lpszServiceInstanceName);
- qDebug() << "service class id:" << querySet->lpServiceClassId;
- qDebug() << "version:" << querySet->lpVersion;
- qDebug() << "comment:" << QString::fromUtf16(querySet->lpszComment);
- qDebug() << "namespace:" << querySet->dwNameSpace;
- qDebug() << "namespace provider id:" << querySet->lpNSProviderId;
- qDebug() << "context:" << QString::fromUtf16(querySet->lpszContext);
- qDebug() << "number of protocols:" << querySet->dwNumberOfProtocols;
- qDebug() << "protocols:" << querySet->lpafpProtocols;
- qDebug() << "query string:" << QString::fromUtf16(querySet->lpszQueryString);
- qDebug() << "number of cs addresses:" << querySet->dwNumberOfCsAddrs;
- qDebug() << "cs addresses:" << querySet->lpcsaBuffer;
- qDebug() << "output flags:" << querySet->dwOutputFlags;
-#endif
-
- if (querySet->lpBlob) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "blob size:" << querySet->lpBlob->cbSize;
- qDebug() << "blob data:" << querySet->lpBlob->pBlobData;
-#endif
-
- DWORD offset = 0;
- do {
- NLA_BLOB *blob = reinterpret_cast<NLA_BLOB *>(querySet->lpBlob->pBlobData + offset);
- DWORD nextOffset = parseBlob(blob, cpPriv);
- if (nextOffset == offset)
- break;
- else
- offset = nextOffset;
- } while (offset != 0 && offset < querySet->lpBlob->cbSize);
- }
-
- if (QNlaEngine *engine = qobject_cast<QNlaEngine *>(parent())) {
- const QString interface = engine->getInterfaceFromId(cpPriv->id);
- cpPriv->bearerType = qGetInterfaceType(interface);
- }
-
- return cpPriv;
-}
-
-void QNlaThread::fetchConfigurations()
-{
- QList<QNetworkConfigurationPrivate *> foundConfigurations;
-
- WSAQUERYSET qsRestrictions;
- HANDLE hLookup = 0;
-
- memset(&qsRestrictions, 0, sizeof(qsRestrictions));
- qsRestrictions.dwSize = sizeof(qsRestrictions);
- qsRestrictions.dwNameSpace = NS_NLA;
-
- int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL | LUP_DEEP, &hLookup);
- if (result == SOCKET_ERROR) {
- mutex.lock();
- fetchedConfigurations.clear();
- mutex.unlock();
- }
-
- char buffer[0x10000];
- while (result == 0) {
- DWORD bufferLength = sizeof(buffer);
- result = WSALookupServiceNext(hLookup, LUP_RETURN_ALL,
- &bufferLength, reinterpret_cast<WSAQUERYSET *>(buffer));
-
- if (result == SOCKET_ERROR)
- break;
-
- QNetworkConfigurationPrivate *cpPriv =
- parseQuerySet(reinterpret_cast<WSAQUERYSET *>(buffer));
-
- foundConfigurations.append(cpPriv);
- }
-
- if (hLookup) {
- result = WSALookupServiceEnd(hLookup);
- if (result == SOCKET_ERROR) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("WSALookupServiceEnd error %d", WSAGetLastError());
-#endif
- }
- }
-
- updateConfigurations(foundConfigurations);
-}
-
-QNlaEngine::QNlaEngine(QObject *parent)
-: QBearerEngineImpl(parent), nlaThread(0)
-{
- nlaThread = new QNlaThread(this);
- connect(nlaThread, SIGNAL(networksChanged()),
- this, SLOT(networksChanged()));
- nlaThread->start();
-
- qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
-}
-
-QNlaEngine::~QNlaEngine()
-{
- delete nlaThread;
-}
-
-void QNlaEngine::networksChanged()
-{
- QMutexLocker locker(&mutex);
-
- QStringList previous = accessPointConfigurations.keys();
-
- QList<QNetworkConfigurationPrivate *> foundConfigurations = nlaThread->getConfigurations();
- while (!foundConfigurations.isEmpty()) {
- QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst();
-
- previous.removeAll(cpPriv->id);
-
- if (accessPointConfigurations.contains(cpPriv->id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id);
-
- bool changed = false;
-
- ptr->mutex.lock();
-
- if (ptr->isValid != cpPriv->isValid) {
- ptr->isValid = cpPriv->isValid;
- changed = true;
- }
-
- if (ptr->name != cpPriv->name) {
- ptr->name = cpPriv->name;
- changed = true;
- }
-
- if (ptr->state != cpPriv->state) {
- ptr->state = cpPriv->state;
- changed = true;
- }
-
- ptr->mutex.unlock();
-
- if (changed) {
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
-
- delete cpPriv;
- } else {
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
-
- accessPointConfigurations.insert(ptr->id, ptr);
-
- locker.unlock();
- emit configurationAdded(ptr);
- locker.relock();
- }
- }
-
- while (!previous.isEmpty()) {
- QNetworkConfigurationPrivatePointer ptr =
- accessPointConfigurations.take(previous.takeFirst());
-
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
-
- locker.unlock();
- emit updateCompleted();
-}
-
-QString QNlaEngine::getInterfaceFromId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- return configurationInterface.value(id.toUInt());
-}
-
-bool QNlaEngine::hasIdentifier(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- return configurationInterface.contains(id.toUInt());
-}
-
-void QNlaEngine::connectToId(const QString &id)
-{
- emit connectionError(id, OperationNotSupported);
-}
-
-void QNlaEngine::disconnectFromId(const QString &id)
-{
- emit connectionError(id, OperationNotSupported);
-}
-
-void QNlaEngine::requestUpdate()
-{
- QMutexLocker locker(&mutex);
-
- nlaThread->forceUpdate();
-}
-
-QNetworkSession::State QNlaEngine::sessionStateForId(const QString &id)
-{
- QMutexLocker locker(&mutex);
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- if (!ptr)
- return QNetworkSession::Invalid;
-
- if (!ptr->isValid) {
- return QNetworkSession::Invalid;
- } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- return QNetworkSession::Connected;
- } else if ((ptr->state & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
- return QNetworkSession::Disconnected;
- } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
- return QNetworkSession::NotAvailable;
- } else if ((ptr->state & QNetworkConfiguration::Undefined) ==
- QNetworkConfiguration::Undefined) {
- return QNetworkSession::NotAvailable;
- }
-
- return QNetworkSession::Invalid;
-}
-
-QNetworkConfigurationManager::Capabilities QNlaEngine::capabilities() const
-{
- return QNetworkConfigurationManager::ForcedRoaming;
-}
-
-QNetworkSessionPrivate *QNlaEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl;
-}
-
-QNetworkConfigurationPrivatePointer QNlaEngine::defaultConfiguration()
-{
- return QNetworkConfigurationPrivatePointer();
-}
-
-#include "qnlaengine.moc"
-QT_END_NAMESPACE
-
diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h
deleted file mode 100644
index 90efa50201..0000000000
--- a/src/plugins/bearer/nla/qnlaengine.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNLAENGINE_P_H
-#define QNLAENGINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qbearerengine_impl_p.h>
-
-#include <QtNetwork/private/qnativesocketengine_p.h>
-
-#include <QMap>
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkConfigurationPrivate;
-class QNlaThread;
-
-class QWindowsSockInit2
-{
-public:
- QWindowsSockInit2();
- ~QWindowsSockInit2();
- int version;
-};
-
-class QNlaEngine : public QBearerEngineImpl
-{
- Q_OBJECT
-
- friend class QNlaThread;
-
-public:
- QNlaEngine(QObject *parent = 0);
- ~QNlaEngine();
-
- QString getInterfaceFromId(const QString &id);
- bool hasIdentifier(const QString &id);
-
- void connectToId(const QString &id);
- void disconnectFromId(const QString &id);
-
- Q_INVOKABLE void requestUpdate();
-
- QNetworkSession::State sessionStateForId(const QString &id);
-
- QNetworkConfigurationManager::Capabilities capabilities() const;
-
- QNetworkSessionPrivate *createSessionBackend();
-
- QNetworkConfigurationPrivatePointer defaultConfiguration();
-
-private Q_SLOTS:
- void networksChanged();
-
-private:
- QWindowsSockInit2 winSock;
- QNlaThread *nlaThread;
- QMap<uint, QString> configurationInterface;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h
deleted file mode 100644
index 0477dc45c3..0000000000
--- a/src/plugins/bearer/platformdefs_win.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMDEFS_WIN_H
-#define QPLATFORMDEFS_WIN_H
-
-// Since we need to include winsock2.h, we need to define WIN32_LEAN_AND_MEAN
-// somewhere above so windows.h won't include winsock.h.
-#include <winsock2.h>
-#include <mswsock.h>
-#undef interface
-#include <wincrypt.h>
-#include <winioctl.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef NS_NLA
-
-#define NS_NLA 15
-
-#ifndef NLA_NAMESPACE_GUID
-enum NLA_BLOB_DATA_TYPE {
- NLA_RAW_DATA = 0,
- NLA_INTERFACE = 1,
- NLA_802_1X_LOCATION = 2,
- NLA_CONNECTIVITY = 3,
- NLA_ICS = 4
-};
-
-enum NLA_CONNECTIVITY_TYPE {
- NLA_NETWORK_AD_HOC = 0,
- NLA_NETWORK_MANAGED = 1,
- NLA_NETWORK_UNMANAGED = 2,
- NLA_NETWORK_UNKNOWN = 3
-};
-
-enum NLA_INTERNET {
- NLA_INTERNET_UNKNOWN = 0,
- NLA_INTERNET_NO = 1,
- NLA_INTERNET_YES = 2
-};
-
-struct NLA_BLOB {
- struct {
- NLA_BLOB_DATA_TYPE type;
- DWORD dwSize;
- DWORD nextOffset;
- } header;
-
- union {
- // NLA_RAW_DATA
- CHAR rawData[1];
-
- // NLA_INTERFACE
- struct {
- DWORD dwType;
- DWORD dwSpeed;
- CHAR adapterName[1];
- } interfaceData;
-
- // NLA_802_1X_LOCATION
- struct {
- CHAR information[1];
- } locationData;
-
- // NLA_CONNECTIVITY
- struct {
- NLA_CONNECTIVITY_TYPE type;
- NLA_INTERNET internet;
- } connectivity;
-
- // NLA_ICS
- struct {
- struct {
- DWORD speed;
- DWORD type;
- DWORD state;
- WCHAR machineName[256];
- WCHAR sharedAdapterName[256];
- } remote;
- } ICS;
- } data;
-};
-#endif // NLA_NAMESPACE_GUID
-
-#endif
-
-enum NDIS_MEDIUM {
- NdisMedium802_3 = 0,
-};
-
-enum NDIS_PHYSICAL_MEDIUM {
- NdisPhysicalMediumWirelessLan = 1,
- NdisPhysicalMediumBluetooth = 10,
- NdisPhysicalMediumWiMax = 12,
-};
-
-#define OID_GEN_MEDIA_SUPPORTED 0x00010103
-#define OID_GEN_PHYSICAL_MEDIUM 0x00010202
-
-#define IOCTL_NDIS_QUERY_GLOBAL_STATS \
- CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
-
-QT_END_NAMESPACE
-
-#endif // QPLATFORMDEFS_WIN_H
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index cd4d301194..df738c419f 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -2,7 +2,6 @@ TEMPLATE = subdirs
QT_FOR_CONFIG += network
qtHaveModule(sql): SUBDIRS += sqldrivers
-qtHaveModule(network):qtConfig(bearermanagement): SUBDIRS += bearer
qtHaveModule(gui) {
SUBDIRS *= platforms platforminputcontexts platformthemes
qtConfig(imageformatplugin): SUBDIRS *= imageformats
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 456101c2e7..03b3ffa5dd 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -363,9 +363,6 @@ QT_CLASS_LIB(QNetworkCookieJar, QtNetwork, qnetworkcookiejar.h)
QT_CLASS_LIB(QNetworkDiskCache, QtNetwork, qnetworkdiskcache.h)
QT_CLASS_LIB(QNetworkReply, QtNetwork, qnetworkreply.h)
QT_CLASS_LIB(QNetworkRequest, QtNetwork, qnetworkrequest.h)
-QT_CLASS_LIB(QNetworkConfigurationManager, QtNetwork, qnetworkconfigmanager.h)
-QT_CLASS_LIB(QNetworkConfiguration, QtNetwork, qnetworkconfiguration.h)
-QT_CLASS_LIB(QNetworkSession, QtNetwork, qnetworksession.h)
QT_CLASS_LIB(QAuthenticator, QtNetwork, qauthenticator.h)
QT_CLASS_LIB(QIPv6Address, QtNetwork, qhostaddress.h)
QT_CLASS_LIB(Q_IPV6ADDR, QtNetwork, qhostaddress.h)
diff --git a/tests/auto/network/CMakeLists.txt b/tests/auto/network/CMakeLists.txt
index b7ba3de688..0e2415daac 100644
--- a/tests/auto/network/CMakeLists.txt
+++ b/tests/auto/network/CMakeLists.txt
@@ -15,7 +15,6 @@ endif()
# special case end
add_subdirectory(access)
-add_subdirectory(bearer)
add_subdirectory(kernel)
add_subdirectory(ssl)
add_subdirectory(socket)
diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
index 182e3e9547..b6be01d900 100644
--- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -31,12 +31,6 @@
#include <QtNetwork/QtNetwork>
#include "../../../network-settings.h"
-#ifndef QT_NO_BEARERMANAGEMENT
-#include <QtNetwork/qnetworkconfigmanager.h>
-#include <QtNetwork/qnetworkconfiguration.h>
-#include <QtNetwork/qnetworksession.h>
-#endif
-
#include <algorithm>
#define TESTFILE QLatin1String("http://") + QtNetworkSettings::httpServerName() + QLatin1String("/qtest/cgi-bin/")
@@ -77,11 +71,6 @@ private:
void runTest();
void checkSynchronous();
-#ifndef QT_NO_BEARERMANAGEMENT
- QNetworkConfigurationManager *netConfMan;
- QNetworkConfiguration networkConfiguration;
- QScopedPointer<QNetworkSession> networkSession;
-#endif
};
class NetworkDiskCache : public QNetworkDiskCache
@@ -133,16 +122,6 @@ void tst_QAbstractNetworkCache::initTestCase()
if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif
-
-#ifndef QT_NO_BEARERMANAGEMENT
- netConfMan = new QNetworkConfigurationManager(this);
- networkConfiguration = netConfMan->defaultConfiguration();
- networkSession.reset(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
- }
-#endif
}
diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp
index 60acb70af4..886a589324 100644
--- a/tests/auto/network/access/qftp/tst_qftp.cpp
+++ b/tests/auto/network/access/qftp/tst_qftp.cpp
@@ -37,10 +37,6 @@
#include <time.h>
#include <stdlib.h>
#include <QNetworkProxy>
-#include <QNetworkConfiguration>
-#include <qnetworkconfigmanager.h>
-#include <QNetworkSession>
-#include <QtNetwork/private/qnetworksession_p.h>
#include <QTcpServer>
#include <QHostInfo>
#include <QElapsedTimer>
@@ -66,7 +62,6 @@ public:
private slots:
void initTestCase_data();
void initTestCase();
- void cleanupTestCase();
void init();
void cleanup();
void connectToHost_data();
@@ -138,10 +133,6 @@ private:
void renameCleanup( const QString &host, const QString &user, const QString &password, const QString &fileToDelete );
QFtp *ftp;
-#ifndef QT_NO_BEARERMANAGEMENT
- QSharedPointer<QNetworkSession> networkSessionExplicit;
- QSharedPointer<QNetworkSession> networkSessionImplicit;
-#endif
QList<int> ids; // helper to make sure that all expected signals are emitted
int current_id;
@@ -190,21 +181,13 @@ void tst_QFtp::initTestCase_data()
{
QTest::addColumn<bool>("setProxy");
QTest::addColumn<int>("proxyType");
- QTest::addColumn<bool>("setSession");
- QTest::newRow("WithoutProxy") << false << 0 << false;
+ QTest::newRow("WithoutProxy") << false << 0;
#if QT_CONFIG(socks5)
- QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy) << false;
+ QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
#endif
//### doesn't work well yet.
//QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
-
-#ifndef QT_NO_BEARERMANAGEMENT
- QTest::newRow("WithoutProxyWithSession") << false << 0 << true;
-#if QT_CONFIG(socks5)
- QTest::newRow("WithSocks5ProxyAndSession") << true << int(QNetworkProxy::Socks5Proxy) << true;
-#endif
-#endif
}
void tst_QFtp::initTestCase()
@@ -218,29 +201,14 @@ void tst_QFtp::initTestCase()
if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
#endif
-#ifndef QT_NO_BEARERMANAGEMENT
- QNetworkConfigurationManager manager;
- networkSessionImplicit = QSharedPointer<QNetworkSession>::create(manager.defaultConfiguration());
- networkSessionImplicit->open();
- QVERIFY(networkSessionImplicit->waitForOpened(60000)); //there may be user prompt on 1st connect
-#endif
rfc3252File = QFINDTESTDATA("rfc3252.txt");
QVERIFY(!rfc3252File.isEmpty());
}
-void tst_QFtp::cleanupTestCase()
-{
-#ifndef QT_NO_BEARERMANAGEMENT
- networkSessionExplicit.clear();
- networkSessionImplicit.clear();
-#endif
-}
-
void tst_QFtp::init()
{
QFETCH_GLOBAL(bool, setProxy);
QFETCH_GLOBAL(int, proxyType);
- QFETCH_GLOBAL(bool, setSession);
if (setProxy) {
#ifndef QT_NO_NETWORKPROXY
if (proxyType == QNetworkProxy::Socks5Proxy) {
@@ -253,19 +221,6 @@ void tst_QFtp::init()
QSKIP("No proxy support");
#endif // QT_NO_NETWORKPROXY
}
-#ifndef QT_NO_BEARERMANAGEMENT
- if (setSession) {
- networkSessionExplicit = networkSessionImplicit;
- if (!networkSessionExplicit->isOpen()) {
- networkSessionExplicit->open();
- QVERIFY(networkSessionExplicit->waitForOpened(30000));
- }
- } else {
- networkSessionExplicit.clear();
- }
-#else
- Q_UNUSED(setSession);
-#endif
delete ftp;
ftp = 0;
@@ -314,9 +269,6 @@ void tst_QFtp::cleanup()
delete ftp;
ftp = 0;
-#ifndef QT_NO_BEARERMANAGEMENT
- networkSessionExplicit.clear();
-#endif
}
void tst_QFtp::connectToHost_data()
@@ -1947,11 +1899,6 @@ void tst_QFtp::dataTransferProgress( qint64 done, qint64 total )
QFtp *tst_QFtp::newFtp()
{
QFtp *nFtp = new QFtp( this );
-#ifndef QT_NO_BEARERMANAGEMENT
- if (networkSessionExplicit) {
- nFtp->setProperty("_q_networksession", QVariant::fromValue(networkSessionExplicit));
- }
-#endif
connect( nFtp, SIGNAL(commandStarted(int)),
SLOT(commandStarted(int)) );
connect( nFtp, SIGNAL(commandFinished(int,bool)),
diff --git a/tests/auto/network/bearer/CMakeLists.txt b/tests/auto/network/bearer/CMakeLists.txt
deleted file mode 100644
index 4b593aab0a..0000000000
--- a/tests/auto/network/bearer/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# Generated from bearer.pro.
-
-add_subdirectory(qnetworkconfiguration)
-add_subdirectory(qnetworkconfigurationmanager)
-add_subdirectory(qnetworkconfigurationmanagerqappless)
-add_subdirectory(qnetworksession)
diff --git a/tests/auto/network/bearer/bearer.pro b/tests/auto/network/bearer/bearer.pro
deleted file mode 100644
index 6ce922eaf8..0000000000
--- a/tests/auto/network/bearer/bearer.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE=subdirs
-SUBDIRS=\
- qnetworkconfiguration \
- qnetworkconfigurationmanager \
- qnetworkconfigurationmanagerqappless \
- qnetworksession \
-
diff --git a/tests/auto/network/bearer/qbearertestcommon.h b/tests/auto/network/bearer/qbearertestcommon.h
deleted file mode 100644
index 923f093402..0000000000
--- a/tests/auto/network/bearer/qbearertestcommon.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBEARERTESTCOMMON_H
-#define QBEARERTESTCOMMON_H
-
-#include <QtTest/qtestcase.h>
-
-enum { TestTimeOut = 90000 };
-
-// Wait for __expr to happen, while still allowing events to be processed.
-#define QTRY_NOOP(__expr) \
- do { \
- const int __step = 50; \
- const int __timeout = 15000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- } while(0)
-
-#endif
diff --git a/tests/auto/network/bearer/qnetworkconfiguration/CMakeLists.txt b/tests/auto/network/bearer/qnetworkconfiguration/CMakeLists.txt
deleted file mode 100644
index 1db8bb1e6b..0000000000
--- a/tests/auto/network/bearer/qnetworkconfiguration/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated from qnetworkconfiguration.pro.
-
-#####################################################################
-## tst_qnetworkconfiguration Test:
-#####################################################################
-
-add_qt_test(tst_qnetworkconfiguration
- SOURCES
- ../qbearertestcommon.h
- tst_qnetworkconfiguration.cpp
- PUBLIC_LIBRARIES
- Qt::Network
-)
diff --git a/tests/auto/network/bearer/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/network/bearer/qnetworkconfiguration/qnetworkconfiguration.pro
deleted file mode 100644
index cde82a4fb2..0000000000
--- a/tests/auto/network/bearer/qnetworkconfiguration/qnetworkconfiguration.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qnetworkconfiguration
-SOURCES += tst_qnetworkconfiguration.cpp
-HEADERS += ../qbearertestcommon.h
-
-QT = core network testlib
diff --git a/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
deleted file mode 100644
index 9c49e0c173..0000000000
--- a/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include "../qbearertestcommon.h"
-
-#ifndef QT_NO_BEARERMANAGEMENT
-#include <QtNetwork/qnetworkconfiguration.h>
-#include <QtNetwork/qnetworkconfigmanager.h>
-#endif
-
-/*
- Although this unit test doesn't use QNetworkAccessManager
- this include is used to ensure that bearer continues to compile against
- Qt 4.7+ which has a QNetworkConfiguration enabled QNetworkAccessManager
-*/
-#include <QNetworkAccessManager>
-
-QT_USE_NAMESPACE
-
-class tst_QNetworkConfiguration : public QObject
-{
- Q_OBJECT
-
-private slots:
-#ifndef QT_NO_BEARERMANAGEMENT
- void invalidPoint();
- void comparison();
- void children();
- void isRoamingAvailable();
- void connectTimeout();
-#endif
-};
-
-#ifndef QT_NO_BEARERMANAGEMENT
-void tst_QNetworkConfiguration::invalidPoint()
-{
- QNetworkConfiguration pt;
-
- QVERIFY(pt.name().isEmpty());
- QVERIFY(!pt.isValid());
- QCOMPARE(pt.type(), QNetworkConfiguration::Invalid);
- QVERIFY(!(pt.state() & QNetworkConfiguration::Defined));
- QVERIFY(!(pt.state() & QNetworkConfiguration::Discovered));
- QVERIFY(!(pt.state() & QNetworkConfiguration::Active));
- QVERIFY(!pt.isRoamingAvailable());
-
- QNetworkConfiguration pt2(pt);
- QVERIFY(pt2.name().isEmpty());
- QVERIFY(!pt2.isValid());
- QCOMPARE(pt2.type(), QNetworkConfiguration::Invalid);
- QVERIFY(!(pt2.state() & QNetworkConfiguration::Defined));
- QVERIFY(!(pt2.state() & QNetworkConfiguration::Discovered));
- QVERIFY(!(pt2.state() & QNetworkConfiguration::Active));
- QVERIFY(!pt2.isRoamingAvailable());
-
-}
-
-void tst_QNetworkConfiguration::comparison()
-{
- //test copy constructor and assignment operator
- //compare invalid connection points
- QNetworkConfiguration pt1;
- QVERIFY(!pt1.isValid());
- QCOMPARE(pt1.type(), QNetworkConfiguration::Invalid);
-
- QNetworkConfiguration pt2(pt1);
- QVERIFY(pt1==pt2);
- QVERIFY(!(pt1!=pt2));
- QCOMPARE(pt1.name(), pt2.name());
- QCOMPARE(pt1.isValid(), pt2.isValid());
- QCOMPARE(pt1.type(), pt2.type());
- QCOMPARE(pt1.state(), pt2.state());
- QCOMPARE(pt1.purpose(), pt2.purpose());
-
-
- QNetworkConfiguration pt3;
- pt3 = pt1;
- QVERIFY(pt1==pt3);
- QVERIFY(!(pt1!=pt3));
- QCOMPARE(pt1.name(), pt3.name());
- QCOMPARE(pt1.isValid(), pt3.isValid());
- QCOMPARE(pt1.type(), pt3.type());
- QCOMPARE(pt1.state(), pt3.state());
- QCOMPARE(pt1.purpose(), pt3.purpose());
-
- //test case must run on machine that has valid connection points
- QNetworkConfigurationManager manager;
- QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();
-
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
-
- QList<QNetworkConfiguration> configs = manager.allConfigurations(QNetworkConfiguration::Discovered);
- QVERIFY(configs.count());
- QNetworkConfiguration defaultConfig = manager.defaultConfiguration();
- QVERIFY(defaultConfig.isValid());
- QVERIFY(defaultConfig.type() != QNetworkConfiguration::Invalid);
- QVERIFY(!defaultConfig.name().isEmpty());
-
- pt3 = defaultConfig;
- QVERIFY(defaultConfig==pt3);
- QVERIFY(!(defaultConfig!=pt3));
- QCOMPARE(defaultConfig.name(), pt3.name());
- QCOMPARE(defaultConfig.isValid(), pt3.isValid());
- QCOMPARE(defaultConfig.type(), pt3.type());
- QCOMPARE(defaultConfig.state(), pt3.state());
- QCOMPARE(defaultConfig.purpose(), pt3.purpose());
-}
-
-void tst_QNetworkConfiguration::children()
-{
- QNetworkConfigurationManager manager;
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
-
- foreach(QNetworkConfiguration c, configs)
- {
- if ( c.type() == QNetworkConfiguration::ServiceNetwork ) {
- qDebug() << "found service network" << c.name() << c.children().count();
- QVERIFY(c.isValid());
- QList<QNetworkConfiguration> members = c.children();
- foreach(QNetworkConfiguration child, members) {
- QVERIFY(child.isValid());
- QVERIFY(configs.contains(child));
- qDebug() << "\t" << child.name();
- }
- }
- }
-}
-
-void tst_QNetworkConfiguration::isRoamingAvailable()
-{
- QNetworkConfigurationManager manager;
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
-
- //force update to get maximum list
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
-
- foreach(QNetworkConfiguration c, configs)
- {
- QVERIFY(QNetworkConfiguration::UserChoice != c.type());
- QVERIFY(QNetworkConfiguration::Invalid != c.type());
- if ( c.type() == QNetworkConfiguration::ServiceNetwork ) {
- //cannot test flag as some SNAPs may not support roaming anyway
- //QVERIFY(c.roamingavailable())
- if ( c.children().count() <= 1 )
- QVERIFY(!c.isRoamingAvailable());
- foreach(QNetworkConfiguration child, c.children()) {
- QCOMPARE(QNetworkConfiguration::InternetAccessPoint, child.type());
- QCOMPARE(child.children().count(), 0);
- }
- } else {
- QVERIFY(!c.isRoamingAvailable());
- }
- }
-}
-
-void tst_QNetworkConfiguration::connectTimeout()
-{
- QNetworkConfigurationManager manager;
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
-
- foreach (QNetworkConfiguration networkConfiguration, configs) {
- QCOMPARE(networkConfiguration.connectTimeout(), 30000);
-
- bool result = networkConfiguration.setConnectTimeout(100);
- QVERIFY(result);
-
- QCOMPARE(networkConfiguration.connectTimeout(), 100);
- }
-}
-#endif
-
-QTEST_MAIN(tst_QNetworkConfiguration)
-#include "tst_qnetworkconfiguration.moc"
diff --git a/tests/auto/network/bearer/qnetworkconfigurationmanager/CMakeLists.txt b/tests/auto/network/bearer/qnetworkconfigurationmanager/CMakeLists.txt
deleted file mode 100644
index 355bd4898a..0000000000
--- a/tests/auto/network/bearer/qnetworkconfigurationmanager/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated from qnetworkconfigurationmanager.pro.
-
-#####################################################################
-## tst_qnetworkconfigurationmanager Test:
-#####################################################################
-
-add_qt_test(tst_qnetworkconfigurationmanager
- SOURCES
- ../qbearertestcommon.h
- tst_qnetworkconfigurationmanager.cpp
- PUBLIC_LIBRARIES
- Qt::Network
-)
diff --git a/tests/auto/network/bearer/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro b/tests/auto/network/bearer/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro
deleted file mode 100644
index 52cee1f64d..0000000000
--- a/tests/auto/network/bearer/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qnetworkconfigurationmanager
-SOURCES += tst_qnetworkconfigurationmanager.cpp
-HEADERS += ../qbearertestcommon.h
-
-QT = core network testlib
diff --git a/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
deleted file mode 100644
index b251a65420..0000000000
--- a/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include "../qbearertestcommon.h"
-
-#ifndef QT_NO_BEARERMANAGEMENT
-#include <QtNetwork/qnetworkconfiguration.h>
-#include <QtNetwork/qnetworkconfigmanager.h>
-#endif
-
-QT_USE_NAMESPACE
-class tst_QNetworkConfigurationManager : public QObject
-{
- Q_OBJECT
-
-private slots:
-#ifndef QT_NO_BEARERMANAGEMENT
- void usedInThread(); // this test must be first, or it will falsely pass
- void allConfigurations();
- void defaultConfiguration();
- void configurationFromIdentifier();
-#endif
-};
-
-#ifndef QT_NO_BEARERMANAGEMENT
-void printConfigurationDetails(const QNetworkConfiguration& p)
-{
- qDebug() << p.name() <<": isvalid->" <<p.isValid() << " type->"<< p.type() <<
- " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() <<
- " purpose->" << p.purpose() << " state->" << p.state();
-}
-
-void tst_QNetworkConfigurationManager::allConfigurations()
-{
- QNetworkConfigurationManager manager;
- QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();
-
- foreach(QNetworkConfiguration c, preScanConfigs)
- {
- QVERIFY2(c.type()!=QNetworkConfiguration::UserChoice, "allConfiguration must not return UserChoice configs");
- }
-
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
-
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
-
- int all = configs.count();
- qDebug() << "All configurations:" << all;
- QVERIFY(all);
- foreach(QNetworkConfiguration p, configs) {
- QVERIFY(p.isValid());
- printConfigurationDetails(p);
- QVERIFY(p.type() != QNetworkConfiguration::Invalid);
- QVERIFY(p.type() != QNetworkConfiguration::UserChoice);
- }
-
- configs = manager.allConfigurations(QNetworkConfiguration::Undefined);
- int undefined = configs.count();
- QVERIFY(undefined <= all);
- qDebug() << "Undefined configurations:" << undefined;
- foreach( const QNetworkConfiguration p, configs) {
- printConfigurationDetails(p);
- QVERIFY(p.state() & QNetworkConfiguration::Undefined);
- QVERIFY(!(p.state() & QNetworkConfiguration::Defined));
- }
-
- //get defined configs only (same as all)
- configs = manager.allConfigurations(QNetworkConfiguration::Defined);
- int defined = configs.count();
- qDebug() << "Defined configurations:" << defined;
- QVERIFY(defined <= all);
- foreach( const QNetworkConfiguration p, configs) {
- printConfigurationDetails(p);
- QVERIFY(p.state() & QNetworkConfiguration::Defined);
- QVERIFY(!(p.state() & QNetworkConfiguration::Undefined));
- }
-
- //get discovered configurations only
- configs = manager.allConfigurations(QNetworkConfiguration::Discovered);
- int discovered = configs.count();
- //QVERIFY(discovered);
- qDebug() << "Discovered configurations:" << discovered;
- foreach(const QNetworkConfiguration p, configs) {
- printConfigurationDetails(p);
- QVERIFY(p.isValid());
- QVERIFY(!(p.state() & QNetworkConfiguration::Undefined));
- QVERIFY(p.state() & QNetworkConfiguration::Defined);
- QVERIFY(p.state() & QNetworkConfiguration::Discovered);
- }
-
- //getactive configurations only
- configs = manager.allConfigurations(QNetworkConfiguration::Active);
- int active = configs.count();
- if (active)
- QVERIFY(manager.isOnline());
- else
- QVERIFY(!manager.isOnline());
-
- //QVERIFY(active);
- qDebug() << "Active configurations:" << active;
- foreach(const QNetworkConfiguration p, configs) {
- printConfigurationDetails(p);
- QVERIFY(p.isValid());
- QVERIFY(!(p.state() & QNetworkConfiguration::Undefined));
- QVERIFY(p.state() & QNetworkConfiguration::Active);
- QVERIFY(p.state() & QNetworkConfiguration::Discovered);
- QVERIFY(p.state() & QNetworkConfiguration::Defined);
- }
-
- QVERIFY(all >= discovered);
- QVERIFY(discovered >= active);
-}
-
-
-void tst_QNetworkConfigurationManager::defaultConfiguration()
-{
- QNetworkConfigurationManager manager;
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
-
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
- QNetworkConfiguration defaultConfig = manager.defaultConfiguration();
-
- bool confirm = configs.contains(defaultConfig);
-
- if (defaultConfig.type() != QNetworkConfiguration::UserChoice) {
- QVERIFY(confirm || !defaultConfig.isValid());
- QVERIFY(!(confirm && !defaultConfig.isValid()));
- } else {
- QVERIFY(!confirm); // user choice config is not part of allConfigurations()
- QVERIFY(defaultConfig.isValid());
- QCOMPARE(defaultConfig.name(), QString("UserChoice"));
- QCOMPARE(defaultConfig.children().count(), 0);
- QVERIFY(!defaultConfig.isRoamingAvailable());
- QCOMPARE(defaultConfig.state(), QNetworkConfiguration::Discovered);
- QNetworkConfiguration copy = manager.configurationFromIdentifier(defaultConfig.identifier());
- QCOMPARE(copy, defaultConfig);
- }
-}
-
-void tst_QNetworkConfigurationManager::configurationFromIdentifier()
-{
- QNetworkConfigurationManager manager;
- QSet<QString> allIdentifier;
-
- //force an update to get maximum number of configs
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
-
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
-
- foreach(QNetworkConfiguration c, configs) {
- QVERIFY(!allIdentifier.contains(c.identifier()));
- allIdentifier.insert(c.identifier());
-
- QNetworkConfiguration direct = manager.configurationFromIdentifier(c.identifier());
- QVERIFY(direct.isValid());
- QCOMPARE(direct, c);
- }
-
- //assume that there is no item with identifier 'FooBar'
- QVERIFY(!allIdentifier.contains("FooBar"));
- QNetworkConfiguration invalid = manager.configurationFromIdentifier("FooBar");
- QVERIFY(!invalid.isValid());
-}
-
-class QNCMTestThread : public QThread
-{
-protected:
- virtual void run()
- {
- QNetworkConfigurationManager manager;
- preScanConfigs = manager.allConfigurations();
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
- configs = manager.allConfigurations();
- }
-public:
- QList<QNetworkConfiguration> configs;
- QList<QNetworkConfiguration> preScanConfigs;
-};
-
-// regression test for QTBUG-18795
-void tst_QNetworkConfigurationManager::usedInThread()
-{
-#if defined Q_OS_MAC && !defined (QT_NO_COREWLAN)
- QSKIP("QTBUG-19070 Mac CoreWlan plugin is broken");
-#else
- QNCMTestThread thread;
- connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- thread.start();
- QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY_WITH_TIMEOUT could take ~90 seconds to time out in the thread
- QVERIFY(!QTestEventLoop::instance().timeout());
- qDebug() << "prescan:" << thread.preScanConfigs.count();
- qDebug() << "postscan:" << thread.configs.count();
-
- QNetworkConfigurationManager manager;
- QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut); //wait for scan to complete
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
- QCOMPARE(thread.configs, configs);
- //Don't compare pre scan configs, because these may be cached and therefore give different results
- //which makes the test unstable. The post scan results should have all configurations every time
- //QCOMPARE(thread.preScanConfigs, preScanConfigs);
-#endif
-}
-#endif
-
-QTEST_MAIN(tst_QNetworkConfigurationManager)
-#include "tst_qnetworkconfigurationmanager.moc"
diff --git a/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/CMakeLists.txt b/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/CMakeLists.txt
deleted file mode 100644
index dcf18785bf..0000000000
--- a/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated from qnetworkconfigurationmanagerqappless.pro.
-
-#####################################################################
-## tst_qnetworkconfigurationmanagerqappless Test:
-#####################################################################
-
-add_qt_test(tst_qnetworkconfigurationmanagerqappless
- SOURCES
- ../qbearertestcommon.h
- tst_qnetworkconfigurationmanagerqappless.cpp
- PUBLIC_LIBRARIES
- Qt::Network
-)
diff --git a/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/qnetworkconfigurationmanagerqappless.pro b/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/qnetworkconfigurationmanagerqappless.pro
deleted file mode 100644
index ad080910d7..0000000000
--- a/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/qnetworkconfigurationmanagerqappless.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qnetworkconfigurationmanagerqappless
-SOURCES += tst_qnetworkconfigurationmanagerqappless.cpp
-HEADERS += ../qbearertestcommon.h
-
-QT = core network testlib
diff --git a/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/tst_qnetworkconfigurationmanagerqappless.cpp b/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/tst_qnetworkconfigurationmanagerqappless.cpp
deleted file mode 100644
index fdeaa9d3b2..0000000000
--- a/tests/auto/network/bearer/qnetworkconfigurationmanagerqappless/tst_qnetworkconfigurationmanagerqappless.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtNetwork/qnetworkaccessmanager.h>
-
-QT_USE_NAMESPACE
-
-class tst_QNetworkConfigurationManager : public QObject
-{
- Q_OBJECT
-
-private slots:
- void staticsInitialization();
-};
-
-void tst_QNetworkConfigurationManager::staticsInitialization()
-{
- // This code should not crash. The test was introduced as
- // a fix for QTBUG-36897
- for (int i = 0; i < 2; i++)
- {
- int argc = 1;
- const char *testName = "tst_qnetworkconfigurationmanagerqappless";
- char **argv = const_cast<char **>(&testName);
- QCoreApplication app(argc, argv);
- QNetworkAccessManager qnam;
- Q_UNUSED(app);
- Q_UNUSED(qnam);
- }
- QVERIFY(true);
-}
-
-QTEST_APPLESS_MAIN(tst_QNetworkConfigurationManager)
-#include "tst_qnetworkconfigurationmanagerqappless.moc"
diff --git a/tests/auto/network/bearer/qnetworksession/CMakeLists.txt b/tests/auto/network/bearer/qnetworksession/CMakeLists.txt
deleted file mode 100644
index 99c3483e6c..0000000000
--- a/tests/auto/network/bearer/qnetworksession/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Generated from qnetworksession.pro.
-
-add_subdirectory(test)
-
-if(NOT WINRT)
- add_subdirectory(lackey)
-endif()
diff --git a/tests/auto/network/bearer/qnetworksession/lackey/CMakeLists.txt b/tests/auto/network/bearer/qnetworksession/lackey/CMakeLists.txt
deleted file mode 100644
index c2d0d59d57..0000000000
--- a/tests/auto/network/bearer/qnetworksession/lackey/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated from lackey.pro.
-
-#####################################################################
-## lackey Binary:
-#####################################################################
-
-add_qt_executable(lackey
- OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
- SOURCES
- main.cpp
- PUBLIC_LIBRARIES
- Qt::Network
-)
diff --git a/tests/auto/network/bearer/qnetworksession/lackey/lackey.pro b/tests/auto/network/bearer/qnetworksession/lackey/lackey.pro
deleted file mode 100644
index dd83d905e6..0000000000
--- a/tests/auto/network/bearer/qnetworksession/lackey/lackey.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-SOURCES += main.cpp
-TARGET = lackey
-
-QT = core network
-
-DESTDIR = ./
-
-CONFIG += cmdline
diff --git a/tests/auto/network/bearer/qnetworksession/lackey/main.cpp b/tests/auto/network/bearer/qnetworksession/lackey/main.cpp
deleted file mode 100644
index 5fad06c2cf..0000000000
--- a/tests/auto/network/bearer/qnetworksession/lackey/main.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QCoreApplication>
-#include <QStringList>
-#include <QLocalSocket>
-
-#ifndef QT_NO_BEARERMANAGEMENT
-#include <QtNetwork/qnetworkconfiguration.h>
-#include <QtNetwork/qnetworkconfigmanager.h>
-#include <QtNetwork/qnetworksession.h>
-#endif
-
-#include <QEventLoop>
-#include <QTimer>
-#include <QDebug>
-
-QT_USE_NAMESPACE
-
-
-#define NO_DISCOVERED_CONFIGURATIONS_ERROR 1
-#define SESSION_OPEN_ERROR 2
-
-
-int main(int argc, char** argv)
-{
- QCoreApplication app(argc, argv);
-
-#ifndef QT_NO_BEARERMANAGEMENT
- // Update configurations so that everything is up to date for this process too.
- // Event loop is used to wait for awhile.
- QNetworkConfigurationManager manager;
- manager.updateConfigurations();
- QEventLoop iIgnoreEventLoop;
- QTimer::singleShot(3000, &iIgnoreEventLoop, SLOT(quit()));
- iIgnoreEventLoop.exec();
-
- QList<QNetworkConfiguration> discovered =
- manager.allConfigurations(QNetworkConfiguration::Discovered);
-
- foreach(QNetworkConfiguration config, discovered) {
- qDebug() << "Lackey: Name of the config enumerated: " << config.name();
- qDebug() << "Lackey: State of the config enumerated: " << config.state();
- }
-
- if (discovered.isEmpty()) {
- qDebug("Lackey: no discovered configurations, returning empty error.");
- return NO_DISCOVERED_CONFIGURATIONS_ERROR;
- }
-
- // Cannot read/write to processes on WinCE.
- // Easiest alternative is to use sockets for IPC.
- QLocalSocket oopSocket;
-
- oopSocket.connectToServer("tst_qnetworksession");
- oopSocket.waitForConnected(-1);
-
- qDebug() << "Lackey started";
-
- QNetworkSession *session = 0;
- do {
- if (session) {
- delete session;
- session = 0;
- }
-
- qDebug() << "Discovered configurations:" << discovered.count();
-
- if (discovered.isEmpty()) {
- qDebug() << "No more discovered configurations";
- break;
- }
-
- qDebug() << "Taking first configuration";
-
- QNetworkConfiguration config = discovered.takeFirst();
-
- if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- qDebug() << config.name() << "is active, therefore skipping it (looking for configs in 'discovered' state).";
- continue;
- }
-
- qDebug() << "Creating session for" << config.name() << config.identifier();
-
- session = new QNetworkSession(config);
-
- QString output = QString("Starting session for %1\n").arg(config.identifier());
- oopSocket.write(output.toLatin1());
- oopSocket.waitForBytesWritten();
- session->open();
- session->waitForOpened();
- } while (!(session && session->isOpen()));
-
- qDebug() << "lackey: loop done";
-
- if (!session) {
- qDebug() << "Could not start session";
-
- oopSocket.disconnectFromServer();
- oopSocket.waitForDisconnected(-1);
-
- return SESSION_OPEN_ERROR;
- }
-
- QByteArray output = "Started session for "
- + session->configuration().identifier().toLatin1() + '\n';
- oopSocket.write(output);
- oopSocket.waitForBytesWritten();
-
- oopSocket.waitForReadyRead();
- oopSocket.readLine();
-
- session->stop();
-
- delete session;
-
- oopSocket.disconnectFromServer();
- oopSocket.waitForDisconnected(-1);
-#endif
-
- return 0;
-}
diff --git a/tests/auto/network/bearer/qnetworksession/qnetworksession.pro b/tests/auto/network/bearer/qnetworksession/qnetworksession.pro
deleted file mode 100644
index cd480fb73b..0000000000
--- a/tests/auto/network/bearer/qnetworksession/qnetworksession.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-!winrt:SUBDIRS = lackey
-test.depends = $$SUBDIRS
-SUBDIRS += test
diff --git a/tests/auto/network/bearer/qnetworksession/test/.prev_CMakeLists.txt b/tests/auto/network/bearer/qnetworksession/test/.prev_CMakeLists.txt
deleted file mode 100644
index e164bccbdf..0000000000
--- a/tests/auto/network/bearer/qnetworksession/test/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generated from test.pro.
-
-#####################################################################
-## tst_qnetworksession Test:
-#####################################################################
-
-add_qt_test(tst_qnetworksession
- SOURCES
- ../../qbearertestcommon.h
- tst_qnetworksession.cpp
- PUBLIC_LIBRARIES
- Qt::Network
- Qt::NetworkPrivate
-)
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 3:.:.:test.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
-# DESTDIR = "../debug"
-
-#### Keys ignored in scope 4:.:.:test.pro:else:
-# DESTDIR = "../release"
-
-#### Keys ignored in scope 5:.:.:test.pro:else:
-# DESTDIR = ".."
-
-#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID AND NOT WINRT:
-# TEST_HELPER_INSTALLS = "../lackey/lackey"
diff --git a/tests/auto/network/bearer/qnetworksession/test/CMakeLists.txt b/tests/auto/network/bearer/qnetworksession/test/CMakeLists.txt
deleted file mode 100644
index c86966600d..0000000000
--- a/tests/auto/network/bearer/qnetworksession/test/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Generated from test.pro.
-
-#####################################################################
-## tst_qnetworksession Test:
-#####################################################################
-
-add_qt_test(tst_qnetworksession
- OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" # special case
- SOURCES
- ../../qbearertestcommon.h
- tst_qnetworksession.cpp
- PUBLIC_LIBRARIES
- Qt::Network
- Qt::NetworkPrivate
-)
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 3:.:.:test.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
-# DESTDIR = "../debug"
-
-#### Keys ignored in scope 4:.:.:test.pro:else:
-# DESTDIR = "../release"
-
-#### Keys ignored in scope 5:.:.:test.pro:else:
-# DESTDIR = ".."
-
-#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID AND NOT WINRT:
-# TEST_HELPER_INSTALLS = "../lackey/lackey"
diff --git a/tests/auto/network/bearer/qnetworksession/test/test.pro b/tests/auto/network/bearer/qnetworksession/test/test.pro
deleted file mode 100644
index bfc1ec7727..0000000000
--- a/tests/auto/network/bearer/qnetworksession/test/test.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-CONFIG += testcase
-SOURCES += tst_qnetworksession.cpp
-HEADERS += ../../qbearertestcommon.h
-
-QT = core network testlib network-private
-
-TARGET = tst_qnetworksession
-CONFIG(debug_and_release) {
- CONFIG(debug, debug|release) {
- DESTDIR = ../debug
- } else {
- DESTDIR = ../release
- }
-} else {
- DESTDIR = ..
-}
-
-!android:!winrt: TEST_HELPER_INSTALLS = ../lackey/lackey
diff --git a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
deleted file mode 100644
index a13adc8ebf..0000000000
--- a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
+++ /dev/null
@@ -1,1299 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QLocalServer>
-#include <QLocalSocket>
-#include <QTimer>
-#include "../../qbearertestcommon.h"
-
-#ifndef QT_NO_BEARERMANAGEMENT
-#include <QtNetwork/qnetworkconfigmanager.h>
-#include <QtNetwork/qnetworksession.h>
-#include <private/qnetworksession_p.h>
-#endif
-
-QT_USE_NAMESPACE
-
-// Can be used to configure tests that require manual attention (such as roaming)
-//#define QNETWORKSESSION_MANUAL_TESTS 1
-
-#ifndef QT_NO_BEARERMANAGEMENT
-Q_DECLARE_METATYPE(QNetworkConfiguration::Type)
-#endif
-
-class tst_QNetworkSession : public QObject
-{
- Q_OBJECT
-
-#ifndef QT_NO_BEARERMANAGEMENT
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void robustnessBombing();
-
- void sessionClosing_data();
- void sessionClosing();
-
- void outOfProcessSession();
- void invalidSession();
-
- void repeatedOpenClose_data();
- void repeatedOpenClose();
-
- void sessionProperties_data();
- void sessionProperties();
-
- void userChoiceSession_data();
- void userChoiceSession();
-
- void sessionOpenCloseStop_data();
- void sessionOpenCloseStop();
-
- void sessionAutoClose_data();
- void sessionAutoClose();
-
- void usagePolicies();
-
-private:
- QNetworkConfigurationManager manager;
- int inProcessSessionManagementCount;
- QString lackeyDir;
-#endif
-};
-
-#ifndef QT_NO_BEARERMANAGEMENT
-// Helper functions
-bool openSession(QNetworkSession *session);
-bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration = true);
-void updateConfigurations();
-void printConfigurations();
-QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfiguration::Type configType);
-
-void tst_QNetworkSession::initTestCase()
-{
- qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration");
- qRegisterMetaType<QNetworkConfiguration::Type>("QNetworkConfiguration::Type");
-
- inProcessSessionManagementCount = -1;
-
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations();
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, TestTimeOut);
-
- lackeyDir = QFINDTESTDATA("lackey");
- QVERIFY2(!lackeyDir.isEmpty(), qPrintable(
- QString::fromLatin1("Couldn't find lackey dir starting from %1.").arg(QDir::currentPath())));
-}
-
-void tst_QNetworkSession::cleanupTestCase()
-{
- if (!(manager.capabilities() & QNetworkConfigurationManager::SystemSessionSupport) &&
- (manager.capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces) &&
- inProcessSessionManagementCount == 0) {
- qWarning("No usable configurations found to complete all possible tests in "
- "inProcessSessionManagement()");
- }
-}
-
-// Robustness test for calling interfaces in nonsense order / with nonsense parameters
-void tst_QNetworkSession::robustnessBombing()
-{
- QNetworkConfigurationManager mgr;
- QNetworkSession testSession(mgr.defaultConfiguration());
- // Should not reset even session is not ope