qnetworkconfiguration.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtNetwork module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QNETWORKCONFIGURATION_H
00043 #define QNETWORKCONFIGURATION_H
00044 
00045 #ifndef QT_MOBILITY_BEARER
00046 # include <QtCore/qglobal.h>
00047 #else
00048 # include "qmobilityglobal.h"
00049 #endif
00050 
00051 #include <QtCore/qshareddata.h>
00052 #include <QtCore/qstring.h>
00053 #include <QtCore/qlist.h>
00054 
00055 #if defined(Q_OS_WIN) && defined(interface)
00056 #undef interface
00057 #endif
00058 
00059 QT_BEGIN_HEADER
00060 
00061 #ifndef QT_MOBILITY_BEARER
00062 QT_BEGIN_NAMESPACE
00063 QT_MODULE(Network)
00064 #define QNetworkConfigurationExport Q_NETWORK_EXPORT
00065 #else
00066 QTM_BEGIN_NAMESPACE
00067 #define QNetworkConfigurationExport Q_BEARER_EXPORT
00068 #endif
00069 
00070 class QNetworkConfigurationPrivate;
00071 class QNetworkConfigurationExport QNetworkConfiguration
00072 {
00073 public:
00074     QNetworkConfiguration();
00075     QNetworkConfiguration(const QNetworkConfiguration& other);
00076     QNetworkConfiguration &operator=(const QNetworkConfiguration& other);
00077     ~QNetworkConfiguration();
00078 
00079     bool operator==(const QNetworkConfiguration& cp) const;
00080     inline bool operator!=(const QNetworkConfiguration& cp) const
00081     { return !operator==(cp); }
00082 
00083     enum Type {
00084         InternetAccessPoint = 0,
00085         ServiceNetwork,
00086         UserChoice,
00087         Invalid
00088     };
00089 
00090     enum Purpose {
00091         UnknownPurpose = 0,
00092         PublicPurpose,
00093         PrivatePurpose,
00094         ServiceSpecificPurpose
00095     };
00096 
00097     enum StateFlag {
00098         Undefined        = 0x0000001,
00099         Defined          = 0x0000002,
00100         Discovered       = 0x0000006,
00101         Active           = 0x000000e
00102     };
00103 
00104     Q_DECLARE_FLAGS(StateFlags, StateFlag)
00105 
00106 #ifndef QT_MOBILITY_BEARER
00107     enum BearerType {
00108         BearerUnknown,
00109         BearerEthernet,
00110         BearerWLAN,
00111         Bearer2G,
00112         BearerCDMA2000,
00113         BearerWCDMA,
00114         BearerHSPA,
00115         BearerBluetooth,
00116         BearerWiMAX
00117     };
00118 #endif
00119 
00120     StateFlags state() const;
00121     Type type() const;
00122     Purpose purpose() const;
00123 
00124 #ifndef QT_MOBILITY_BEARER
00125 #ifdef QT_DEPRECATED
00126     // Required to maintain source compatibility with Qt Mobility.
00127     QT_DEPRECATED inline QString bearerName() const { return bearerTypeName(); }
00128 #endif
00129     BearerType bearerType() const;
00130     QString bearerTypeName() const;
00131 #else
00132     QString bearerName() const;
00133 #endif
00134 
00135     QString identifier() const;
00136     bool isRoamingAvailable() const;
00137     QList<QNetworkConfiguration> children() const;
00138 
00139     QString name() const;
00140     bool isValid() const;
00141 
00142 private:
00143     friend class QNetworkConfigurationPrivate;
00144     friend class QNetworkConfigurationManager;
00145     friend class QNetworkConfigurationManagerPrivate;
00146     friend class QNetworkSessionPrivate;
00147     QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> d;
00148 };
00149 
00150 #ifndef QT_MOBILITY_BEARER
00151 QT_END_NAMESPACE
00152 #else
00153 QTM_END_NAMESPACE
00154 #endif
00155 
00156 QT_END_HEADER
00157 
00158 #endif //QNETWORKCONFIGURATION_H