1/****************************************************************************
2**
3** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/
5**
6** This file is part of the QtNetwork module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** GNU Lesser General Public License Usage
10** This file may be used under the terms of the GNU Lesser General Public
11** License version 2.1 as published by the Free Software Foundation and
12** appearing in the file LICENSE.LGPL included in the packaging of this
13** file. Please review the following information to ensure the GNU Lesser
14** General Public License version 2.1 requirements will be met:
15** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16**
17** In addition, as a special exception, Nokia gives you certain additional
18** rights. These rights are described in the Nokia Qt LGPL Exception
19** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20**
21** GNU General Public License Usage
22** Alternatively, this file may be used under the terms of the GNU General
23** Public License version 3.0 as published by the Free Software Foundation
24** and appearing in the file LICENSE.GPL included in the packaging of this
25** file. Please review the following information to ensure the GNU General
26** Public License version 3.0 requirements will be met:
27** http://www.gnu.org/copyleft/gpl.html.
28**
29** Other Usage
30** Alternatively, this file may be used in accordance with the terms and
31** conditions contained in a signed written agreement between you and Nokia.
32**
33**
34**
35**
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QNETWORKCONFIGURATION_H
43#define QNETWORKCONFIGURATION_H
44
45#ifndef QT_MOBILITY_BEARER
46# include <QtCore/qglobal.h>
47#else
48# include "qmobilityglobal.h"
49#endif
50
51#include <QtCore/qshareddata.h>
52#include <QtCore/qstring.h>
53#include <QtCore/qlist.h>
54
55#if defined(Q_OS_WIN) && defined(interface)
56#undef interface
57#endif
58
59QT_BEGIN_HEADER
60
61#ifndef QT_MOBILITY_BEARER
62QT_BEGIN_NAMESPACE
63QT_MODULE(Network)
64#define QNetworkConfigurationExport Q_NETWORK_EXPORT
65#else
66QTM_BEGIN_NAMESPACE
67#define QNetworkConfigurationExport Q_BEARER_EXPORT
68#endif
69
70class QNetworkConfigurationPrivate;
71class QNetworkConfigurationExport QNetworkConfiguration
72{
73public:
74 QNetworkConfiguration();
75 QNetworkConfiguration(const QNetworkConfiguration& other);
76 QNetworkConfiguration &operator=(const QNetworkConfiguration &other);
77 ~QNetworkConfiguration();
78
79 bool operator==(const QNetworkConfiguration &other) const;
80 inline bool operator!=(const QNetworkConfiguration &other) const
81 { return !operator==(other); }
82
83 enum Type {
84 InternetAccessPoint = 0,
85 ServiceNetwork,
86 UserChoice,
87 Invalid
88 };
89
90 enum Purpose {
91 UnknownPurpose = 0,
92 PublicPurpose,
93 PrivatePurpose,
94 ServiceSpecificPurpose
95 };
96
97 enum StateFlag {
98 Undefined = 0x0000001,
99 Defined = 0x0000002,
100 Discovered = 0x0000006,
101 Active = 0x000000e
102 };
103 Q_DECLARE_FLAGS(StateFlags, StateFlag)
104
105#ifndef QT_MOBILITY_BEARER
106 enum BearerType {
107 BearerUnknown,
108 BearerEthernet,
109 BearerWLAN,
110 Bearer2G,
111 BearerCDMA2000,
112 BearerWCDMA,
113 BearerHSPA,
114 BearerBluetooth,
115 BearerWiMAX
116 };
117#endif
118
119 StateFlags state() const;
120 Type type() const;
121 Purpose purpose() const;
122
123#ifndef QT_MOBILITY_BEARER
124#ifdef QT_DEPRECATED
125 // Required to maintain source compatibility with Qt Mobility.
126 QT_DEPRECATED inline QString bearerName() const { return bearerTypeName(); }
127#endif
128 BearerType bearerType() const;
129 QString bearerTypeName() const;
130#else
131 QString bearerName() const;
132#endif
133
134 QString identifier() const;
135 bool isRoamingAvailable() const;
136 QList<QNetworkConfiguration> children() const;
137
138 QString name() const;
139 bool isValid() const;
140
141private:
142 friend class QNetworkConfigurationPrivate;
143 friend class QNetworkConfigurationManager;
144 friend class QNetworkConfigurationManagerPrivate;
145 friend class QNetworkSessionPrivate;
146 QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> d;
147};
148
149#ifndef QT_MOBILITY_BEARER
150QT_END_NAMESPACE
151#else
152QTM_END_NAMESPACE
153#endif
154
155QT_END_HEADER
156
157#endif // QNETWORKCONFIGURATION_H
158