OpenCoverage

qnetworkconfigmanager.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/bearer/qnetworkconfigmanager.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtNetwork module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qnetworkconfigmanager.h"-
41-
42#include "qnetworkconfigmanager_p.h"-
43#include "qbearerengine_p.h"-
44-
45#include <QtCore/qstringlist.h>-
46#include <QtCore/qcoreapplication.h>-
47#include <QtCore/qmutex.h>-
48#include <QtCore/qthread.h>-
49#include <QtCore/private/qcoreapplication_p.h>-
50-
51#ifndef QT_NO_BEARERMANAGEMENT-
52-
53QT_BEGIN_NAMESPACE-
54-
55static QBasicAtomicPointer<QNetworkConfigurationManagerPrivate> connManager_ptr;-
56static QBasicAtomicInt appShutdown;-
57-
58static void connManager_prepare()-
59{-
60 int shutdown = appShutdown.fetchAndStoreAcquire(0);-
61 Q_ASSERT(shutdown == 0 || shutdown == 1);-
62 Q_UNUSED(shutdown);-
63}
executed 19 times by 16 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
19
64-
65static void connManager_cleanup()-
66{-
67 // this is not atomic or thread-safe!-
68 int shutdown = appShutdown.fetchAndStoreAcquire(1);-
69 Q_ASSERT(shutdown == 0);-
70 Q_UNUSED(shutdown);-
71 QNetworkConfigurationManagerPrivate *cmp = connManager_ptr.fetchAndStoreAcquire(0);-
72 if (cmp)
cmpDescription
TRUEevaluated 20 times by 19 tests
Evaluated by:
  • tst_QNetworkConfigurationManager
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qftp - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfiguration - unknown status
  • tst_qnetworkconfigurationmanager - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkinterface - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qnetworksession - unknown status
  • tst_qtcpserver - unknown status
  • tst_qudpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
FALSEnever evaluated
0-20
73 cmp->cleanup();
executed 20 times by 19 tests: cmp->cleanup();
Executed by:
  • tst_QNetworkConfigurationManager
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qftp - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfiguration - unknown status
  • tst_qnetworkconfigurationmanager - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkinterface - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qnetworksession - unknown status
  • tst_qtcpserver - unknown status
  • tst_qudpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
20
74}
executed 20 times by 19 tests: end of block
Executed by:
  • tst_QNetworkConfigurationManager
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qftp - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qnetworkaccessmanager - unknown status
  • tst_qnetworkaccessmanager_and_qprogressdialog - unknown status
  • tst_qnetworkconfiguration - unknown status
  • tst_qnetworkconfigurationmanager - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkinterface - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qnetworksession - unknown status
  • tst_qtcpserver - unknown status
  • tst_qudpsocket - unknown status
  • tst_qxmlinputsource - unknown status
  • tst_qxmlstream - unknown status
  • tst_spdy - unknown status
20
75-
76void QNetworkConfigurationManagerPrivate::addPreAndPostRoutine()-
77{-
78 qAddPreRoutine(connManager_prepare);-
79 qAddPostRoutine(connManager_cleanup);-
80}
executed 18 times by 16 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
18
81-
82QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate()-
83{-
84 QNetworkConfigurationManagerPrivate *ptr = connManager_ptr.loadAcquire();-
85 int shutdown = appShutdown.loadAcquire();-
86 if (!ptr && !shutdown) {
!ptrDescription
TRUEevaluated 18 times by 16 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
FALSEevaluated 1562 times by 26 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhostinfo - unknown status
  • tst_qnetworkinterface - unknown status
  • tst_qnetworksession - unknown status
  • tst_qudpsocket - unknown status
  • ...
!shutdownDescription
TRUEevaluated 18 times by 16 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
FALSEnever evaluated
0-1562
87 static QBasicMutex connManager_mutex;-
88 QMutexLocker locker(&connManager_mutex);-
89 if (!(ptr = connManager_ptr.loadAcquire())) {
!(ptr = connMa...loadAcquire())Description
TRUEevaluated 18 times by 16 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
FALSEnever evaluated
0-18
90 ptr = new QNetworkConfigurationManagerPrivate;-
91-
92 if (QCoreApplicationPrivate::mainThread() == QThread::currentThread()) {
QCoreApplicati...urrentThread()Description
TRUEevaluated 17 times by 16 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkConfigurationManager
1-17
93 // right thread or no main thread yet-
94 ptr->addPreAndPostRoutine();-
95 ptr->initialize();-
96 } else {
executed 17 times by 16 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
17
97 // wrong thread, we need to make the main thread do this-
98 QObject *obj = new QObject;-
99 QObject::connect(obj, SIGNAL(destroyed()), ptr, SLOT(addPreAndPostRoutine()), Qt::DirectConnection);-
100 ptr->initialize(); // this moves us to the right thread-
101 obj->moveToThread(QCoreApplicationPrivate::mainThread());-
102 obj->deleteLater();-
103 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkConfigurationManager
1
104-
105 connManager_ptr.storeRelease(ptr);-
106 }
executed 18 times by 16 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
18
107 }
executed 18 times by 16 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
18
108 return ptr;
executed 1580 times by 26 tests: return ptr;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhostinfo - unknown status
  • tst_qnetworkinterface - unknown status
  • tst_qnetworksession - unknown status
  • tst_qudpsocket - unknown status
  • ...
1580
109}-
110-
111/*!-
112 \class QNetworkConfigurationManager-
113-
114 \brief The QNetworkConfigurationManager class manages the network configurations provided-
115 by the system.-
116-
117 \since 4.7-
118-
119 \inmodule QtNetwork-
120 \ingroup network-
121-
122 QNetworkConfigurationManager provides access to the network configurations known to the system and-
123 enables applications to detect the system capabilities (with regards to network sessions) at runtime.-
124-
125 A QNetworkConfiguration abstracts a set of configuration options describing how a-
126 network interface has to be configured to connect to a particular target network.-
127 QNetworkConfigurationManager maintains and updates the global list of-
128 QNetworkConfigurations. Applications can access and filter this list via-
129 allConfigurations(). If a new configuration is added or an existing one is removed or changed-
130 the configurationAdded(), configurationRemoved() and configurationChanged() signals are emitted-
131 respectively.-
132-
133 The defaultConfiguration() can be used when intending to immediately create a new-
134 network session without caring about the particular configuration. It returns-
135 a \l QNetworkConfiguration::Discovered configuration. If there are not any-
136 discovered ones an invalid configuration is returned.-
137-
138 Some configuration updates may require some time to perform updates. A WLAN scan is-
139 such an example. Unless the platform performs internal updates it may be required to-
140 manually trigger configuration updates via QNetworkConfigurationManager::updateConfigurations().-
141 The completion of the update process is indicated by emitting the updateCompleted()-
142 signal. The update process ensures that every existing QNetworkConfiguration instance-
143 is updated. There is no need to ask for a renewed configuration list via allConfigurations().-
144-
145 \sa QNetworkConfiguration-
146*/-
147-
148/*!-
149 \fn void QNetworkConfigurationManager::configurationAdded(const QNetworkConfiguration &config)-
150-
151 This signal is emitted whenever a new network configuration is added to the system. The new-
152 configuration is specified by \a config.-
153*/-
154-
155/*!-
156 \fn void QNetworkConfigurationManager::configurationRemoved(const QNetworkConfiguration &config)-
157-
158 This signal is emitted when a configuration is about to be removed from the system. The removed-
159 configuration, specified by \a config, is invalid but retains name and identifier.-
160*/-
161-
162/*!-
163 \fn void QNetworkConfigurationManager::updateCompleted()-
164-
165 This signal is emitted when the configuration update has been completed. Such an update can-
166 be initiated via \l updateConfigurations().-
167*/-
168-
169/*! \fn void QNetworkConfigurationManager::configurationChanged(const QNetworkConfiguration &config)-
170-
171 This signal is emitted when the \l {QNetworkConfiguration::state()}{state} of \a config changes.-
172*/-
173-
174/*!-
175 \fn void QNetworkConfigurationManager::onlineStateChanged(bool isOnline)-
176-
177 This signal is emitted when the device changes from online to offline mode or vice versa.-
178 \a isOnline represents the new state of the device.-
179-
180 The state is considered to be online for as long as-
181 \l{allConfigurations()}{allConfigurations}(QNetworkConfiguration::Active) returns a list with-
182 at least one entry.-
183*/-
184-
185/*!-
186 \enum QNetworkConfigurationManager::Capability-
187-
188 Specifies the system capabilities of the bearer API. The possible values are:-
189-
190 \value CanStartAndStopInterfaces Network sessions and their underlying access points can be-
191 started and stopped. If this flag is not set QNetworkSession-
192 can only monitor but not influence the state of access points.-
193 On some platforms this feature may require elevated user-
194 permissions. This option is platform specific and may not-
195 always be available.-
196 \value DirectConnectionRouting Network sessions and their sockets can be bound to a-
197 particular network interface. Any packet that passes through-
198 the socket goes to the specified network interface and thus-
199 disregards standard routing table entries. This may be useful-
200 when two interfaces can reach overlapping IP ranges or an-
201 application has specific needs in regards to target networks.-
202 This option is platform specific and may not always be-
203 available.-
204 \value SystemSessionSupport If this flag is set the underlying platform ensures that a-
205 network interface is not shut down until the last network-
206 session has been \l{QNetworkSession::close()}{closed()}. This-
207 works across multiple processes. If the platform session-
208 support is missing this API can only ensure the above behavior-
209 for network sessions within the same process.-
210 In general mobile platforms have such-
211 support whereas most desktop platform lack this capability.-
212 \value ApplicationLevelRoaming The system gives applications control over the systems roaming-
213 behavior. Applications can initiate roaming (in case the-
214 current link is not suitable) and are consulted if the system-
215 has identified a more suitable access point.-
216 \value ForcedRoaming The system disconnects an existing access point and reconnects-
217 via a more suitable one. The application does not have any-
218 control over this process and has to reconnect its active-
219 sockets.-
220 \value DataStatistics If this flag is set QNetworkSession can provide statistics-
221 about transmitted and received data.-
222 \value NetworkSessionRequired If this flag is set the platform requires that a network-
223 session is created before network operations can be performed.-
224*/-
225-
226/*!-
227 Constructs a QNetworkConfigurationManager with the given \a parent.-
228-
229 Note that to ensure a valid list of current configurations immediately available, updating-
230 is done during construction which causes some delay.-
231*/-
232QNetworkConfigurationManager::QNetworkConfigurationManager(QObject *parent)-
233 : QObject(parent)-
234{-
235 QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();-
236-
237 connect(priv, SIGNAL(configurationAdded(QNetworkConfiguration)),-
238 this, SIGNAL(configurationAdded(QNetworkConfiguration)));-
239 connect(priv, SIGNAL(configurationRemoved(QNetworkConfiguration)),-
240 this, SIGNAL(configurationRemoved(QNetworkConfiguration)));-
241 connect(priv, SIGNAL(configurationChanged(QNetworkConfiguration)),-
242 this, SIGNAL(configurationChanged(QNetworkConfiguration)));-
243 connect(priv, SIGNAL(onlineStateChanged(bool)),-
244 this, SIGNAL(onlineStateChanged(bool)));-
245 connect(priv, SIGNAL(configurationUpdateComplete()),-
246 this, SIGNAL(updateCompleted()));-
247-
248 priv->enablePolling();-
249}
executed 432 times by 19 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
432
250-
251/*!-
252 Frees the resources associated with the QNetworkConfigurationManager object.-
253*/-
254QNetworkConfigurationManager::~QNetworkConfigurationManager()-
255{-
256 QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();-
257 if (priv)
privDescription
TRUEevaluated 433 times by 22 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhostinfo - unknown status
  • tst_qnetworkinterface - unknown status
  • tst_qnetworksession - unknown status
  • tst_qudpsocket - unknown status
  • tst_spdy - unknown status
FALSEnever evaluated
0-433
258 priv->disablePolling();
executed 433 times by 22 tests: priv->disablePolling();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhostinfo - unknown status
  • tst_qnetworkinterface - unknown status
  • tst_qnetworksession - unknown status
  • tst_qudpsocket - unknown status
  • tst_spdy - unknown status
433
259}
executed 433 times by 22 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qhostinfo - unknown status
  • tst_qnetworkinterface - unknown status
  • tst_qnetworksession - unknown status
  • tst_qudpsocket - unknown status
  • tst_spdy - unknown status
433
260-
261-
262/*!-
263 Returns the default configuration to be used. This function always returns a discovered-
264 configuration; otherwise an invalid configuration.-
265-
266 In some cases it may be required to call updateConfigurations() and wait for the-
267 updateCompleted() signal before calling this function.-
268-
269 \sa allConfigurations()-
270*/-
271QNetworkConfiguration QNetworkConfigurationManager::defaultConfiguration() const-
272{-
273 QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();-
274 if (priv)
privDescription
TRUEevaluated 301 times by 18 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
FALSEnever evaluated
0-301
275 return priv->defaultConfiguration();
executed 301 times by 18 tests: return priv->defaultConfiguration();
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
301
276-
277 return QNetworkConfiguration();
never executed: return QNetworkConfiguration();
0
278}-
279-
280/*!-
281 Returns the list of configurations which comply with the given \a filter.-
282-
283 By default this function returns all (defined and undefined) configurations.-
284-
285 A wireless network with a particular SSID may only be accessible in a-
286 certain area despite the fact that the system has a valid configuration-
287 for it. Therefore the filter flag may be used to limit the list to-
288 discovered and possibly connected configurations only.-
289-
290 If \a filter is set to zero this function returns all possible configurations.-
291-
292 Note that this function returns the states for all configurations as they are known at-
293 the time of this function call. If for instance a configuration of type WLAN is defined-
294 the system may have to perform a WLAN scan in order to determine whether it is-
295 actually available. To obtain the most accurate state updateConfigurations() should-
296 be used to update each configuration's state. Note that such an update may require-
297 some time. It's completion is signalled by updateCompleted(). In the absence of a-
298 configuration update this function returns the best estimate at the time of the call.-
299 Therefore, if WLAN configurations are of interest, it is recommended that-
300 updateConfigurations() is called once after QNetworkConfigurationManager-
301 instantiation (WLAN scans are too time consuming to perform in constructor).-
302 After this the data is kept automatically up-to-date as the system reports-
303 any changes.-
304*/-
305QList<QNetworkConfiguration> QNetworkConfigurationManager::allConfigurations(QNetworkConfiguration::StateFlags filter) const-
306{-
307 QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();-
308 if (priv)
privDescription
TRUEevaluated 27 times by 4 tests
Evaluated by:
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkProxyFactory
  • tst_QNetworkSession
FALSEnever evaluated
0-27
309 return priv->allConfigurations(filter);
executed 27 times by 4 tests: return priv->allConfigurations(filter);
Executed by:
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkProxyFactory
  • tst_QNetworkSession
27
310-
311 return QList<QNetworkConfiguration>();
never executed: return QList<QNetworkConfiguration>();
0
312}-
313-
314/*!-
315 Returns the QNetworkConfiguration for \a identifier; otherwise returns an-
316 invalid QNetworkConfiguration.-
317-
318 \sa QNetworkConfiguration::identifier()-
319*/-
320QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier(const QString &identifier) const-
321{-
322 QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();-
323 if (priv)
privDescription
TRUEevaluated 120 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkConfigurationManager
  • tst_QNetworkReply
FALSEnever evaluated
0-120
324 return priv->configurationFromIdentifier(identifier);
executed 120 times by 3 tests: return priv->configurationFromIdentifier(identifier);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkConfigurationManager
  • tst_QNetworkReply
120
325-
326 return QNetworkConfiguration();
never executed: return QNetworkConfiguration();
0
327}-
328-
329/*!-
330 Returns \c true if the system is considered to be connected to another device via an active-
331 network interface; otherwise returns \c false.-
332-
333 This is equivalent to the following code snippet:-
334-
335 \snippet code/src_network_bearer_qnetworkconfigmanager.cpp 0-
336-
337 \sa onlineStateChanged()-
338*/-
339bool QNetworkConfigurationManager::isOnline() const-
340{-
341 QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();-
342 if (priv)
privDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkConfigurationManager
FALSEnever evaluated
0-1
343 return priv->isOnline();
executed 1 time by 1 test: return priv->isOnline();
Executed by:
  • tst_QNetworkConfigurationManager
1
344-
345 return false;
never executed: return false;
0
346}-
347-
348/*!-
349 Returns the capabilities supported by the current platform.-
350*/-
351QNetworkConfigurationManager::Capabilities QNetworkConfigurationManager::capabilities() const-
352{-
353 QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();-
354 if (priv)
privDescription
TRUEevaluated 94 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QXmlInputSource
  • tst_QXmlStream
FALSEnever evaluated
0-94
355 return priv->capabilities();
executed 94 times by 12 tests: return priv->capabilities();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QXmlInputSource
  • tst_QXmlStream
94
356-
357 return QNetworkConfigurationManager::Capabilities(0);
never executed: return QNetworkConfigurationManager::Capabilities(0);
0
358}-
359-
360/*!-
361 Initiates an update of all configurations. This may be used to initiate WLAN scans or other-
362 time consuming updates which may be required to obtain the correct state for configurations.-
363-
364 This call is asynchronous. On completion of this update the updateCompleted() signal is-
365 emitted. If new configurations are discovered or old ones were removed or changed the update-
366 process may trigger the emission of one or multiple configurationAdded(),-
367 configurationRemoved() and configurationChanged() signals.-
368-
369 If a configuration state changes as a result of this update all existing QNetworkConfiguration-
370 instances are updated automatically.-
371-
372 \sa allConfigurations()-
373*/-
374void QNetworkConfigurationManager::updateConfigurations()-
375{-
376 QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();-
377 if (priv)
privDescription
TRUEevaluated 16 times by 3 tests
Evaluated by:
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkSession
FALSEnever evaluated
0-16
378 priv->performAsyncConfigurationUpdate();
executed 16 times by 3 tests: priv->performAsyncConfigurationUpdate();
Executed by:
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkSession
16
379}
executed 16 times by 3 tests: end of block
Executed by:
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkSession
16
380-
381#include "moc_qnetworkconfigmanager.cpp"-
382-
383QT_END_NAMESPACE-
384-
385#endif // QT_NO_BEARERMANAGEMENT-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9