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#ifndef QNETWORKCONFIGURATION_H
41#define QNETWORKCONFIGURATION_H
42
43#include <QtNetwork/qtnetworkglobal.h>
44
45#include <QtCore/qshareddata.h>
46#include <QtCore/qstring.h>
47#include <QtCore/qlist.h>
48#include <QtCore/qmetatype.h>
49
50QT_BEGIN_NAMESPACE
51
52class QNetworkConfigurationPrivate;
53class Q_NETWORK_EXPORT QNetworkConfiguration
54{
55public:
56 QNetworkConfiguration();
57 QNetworkConfiguration(const QNetworkConfiguration& other);
58 QNetworkConfiguration &operator=(QNetworkConfiguration &&other) noexcept { swap(other); return *this; }
59 QNetworkConfiguration &operator=(const QNetworkConfiguration &other);
60 ~QNetworkConfiguration();
61
62 void swap(QNetworkConfiguration &other) noexcept { qSwap(d, other.d); }
63
64 bool operator==(const QNetworkConfiguration &other) const;
65 inline bool operator!=(const QNetworkConfiguration &other) const
66 { return !operator==(other); }
67
68 enum Type {
69 InternetAccessPoint = 0,
70 ServiceNetwork,
71 UserChoice,
72 Invalid
73 };
74
75 enum Purpose {
76 UnknownPurpose = 0,
77 PublicPurpose,
78 PrivatePurpose,
79 ServiceSpecificPurpose
80 };
81
82 enum StateFlag {
83 Undefined = 0x0000001,
84 Defined = 0x0000002,
85 Discovered = 0x0000006,
86 Active = 0x000000e
87 };
88 Q_DECLARE_FLAGS(StateFlags, StateFlag)
89
90 enum BearerType {
91 BearerUnknown,
92 BearerEthernet,
93 BearerWLAN,
94 Bearer2G,
95 BearerCDMA2000,
96 BearerWCDMA,
97 BearerHSPA,
98 BearerBluetooth,
99 BearerWiMAX,
100 BearerEVDO,
101 BearerLTE,
102 Bearer3G,
103 Bearer4G
104 };
105
106 StateFlags state() const;
107 Type type() const;
108 Purpose purpose() const;
109
110 BearerType bearerType() const;
111 BearerType bearerTypeFamily() const;
112 QString bearerTypeName() const;
113
114 QString identifier() const;
115 bool isRoamingAvailable() const;
116 QList<QNetworkConfiguration> children() const;
117
118 QString name() const;
119 bool isValid() const;
120
121 int connectTimeout() const;
122 bool setConnectTimeout(int timeout);
123
124private:
125 friend class QNetworkConfigurationPrivate;
126 friend class QNetworkConfigurationManager;
127 friend class QNetworkConfigurationManagerPrivate;
128 friend class QNetworkSessionPrivate;
129 QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> d;
130};
131
132Q_DECLARE_SHARED(QNetworkConfiguration)
133
134QT_END_NAMESPACE
135
136Q_DECLARE_METATYPE(QNetworkConfiguration)
137
138#endif // QNETWORKCONFIGURATION_H
139