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