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

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