securitysettings/qtconfigutils/eapqtconfiginterface/inc/eapqtconfiginterface_p.h
changeset 39 fe6b6762fccd
parent 33 938269283a16
child 52 c23bdf5a328a
equal deleted inserted replaced
38:7a0216d033ac 39:fe6b6762fccd
     1 /*
     1 /*
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of the License "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8  *
     8  *
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    15  *   EAP method configuration QT interface private implementation
    15  *   EAP method configuration QT interface private implementation
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 /*
    19 /*
    20  * %version: 29 %
    20  * %version: 36 %
    21  */
    21  */
    22 
    22 
    23 #ifndef EAPQTCONFIGINTERFACEPRIVATE_H
    23 #ifndef EAPQTCONFIGINTERFACEPRIVATE_H
    24 #define EAPQTCONFIGINTERFACEPRIVATE_H
    24 #define EAPQTCONFIGINTERFACEPRIVATE_H
    25 
    25 
       
    26 // System includes
    26 #include <qglobal.h>
    27 #include <qglobal.h>
    27 #include <EapSettings.h>
    28 #include <EapSettings.h>
    28 #include <EapTypeDefinitions.h>
    29 #include <EapTypeDefinitions.h>
    29 #include <eapqtconfig.h>
    30 #include <eapqtconfig.h>
    30 #include <eapqtpluginhandle.h>
    31 #include <eapqtpluginhandle.h>
    31 #include <eapqtconfiginterface.h>
    32 #include <eapqtconfiginterface.h>
    32 
    33 #include <eapqtpacstoreconfig.h>
    33 /*!
    34 
    34  * @addtogroup group_eap_config_if_impl
    35 // User includes
    35  * @{
    36 
    36  */
    37 // Forward declarations
    37 class HbTranslator;
    38 class HbTranslator;
    38 class CEapType;
    39 class CEapType;
    39 class CEapGeneralSettings;
    40 class CEapGeneralSettings;
    40 class CpEapPluginInterface;
    41 class CpEapPluginInterface;
    41 class EapQtConfigInterface;
    42 class EapQtConfigInterface;
    42 
    43 
       
    44 // External data types
       
    45 
       
    46 // Constants
       
    47 
       
    48 // Class declaration
    43 class EapQtConfigInterfacePrivate
    49 class EapQtConfigInterfacePrivate
    44 {
    50 {
       
    51 
    45 public:
    52 public:
       
    53 
       
    54     // Data types
    46 
    55 
    47     // maximum lenghts (number of characters) for UTF-16 strings copied to EAP settings
    56     // maximum lenghts (number of characters) for UTF-16 strings copied to EAP settings
    48     static const unsigned int StringMaxLength = KGeneralStringMaxLength;
    57     static const unsigned int StringMaxLength = KGeneralStringMaxLength;
    49     static const unsigned int CertLabelMaxLength = KMaxCertLabelLength;
    58     static const unsigned int CertLabelMaxLength = KMaxCertLabelLength;
    50     static const unsigned int CertThumbprintMaxLength = KThumbprintMaxLength;
    59     static const unsigned int CertThumbprintMaxLength = KThumbprintMaxLength;
    51     static const unsigned int CertSubjectKeyIdLength = KSHA1HashLengthBytes;
    60     static const unsigned int CertSubjectKeyIdLength = KSHA1HashLengthBytes;
    52 
    61 
    53 public:
    62     // see eapqtinterface.h for documentation
    54 
    63 
    55     // the constructor can only be used for validators
       
    56     // any other call trows an exception
       
    57     EapQtConfigInterfacePrivate();
    64     EapQtConfigInterfacePrivate();
    58 
    65 
    59     // this is the constructor for using the interface for accessing settings etc.
       
    60     // if iapId is negative, it must be later set to correct value with setConfigurationReference
       
    61     // to be able to use the methods:
       
    62     // - selectedOuterTypes
       
    63     // - readConfiguration
       
    64     // - saveConfiguration
       
    65     // - deleteConfiguration
       
    66     // - uiInstance
       
    67     // other methods are usable with negative iapId
       
    68     EapQtConfigInterfacePrivate(const EapQtConfigInterface::EapBearerType bearerType,
    66     EapQtConfigInterfacePrivate(const EapQtConfigInterface::EapBearerType bearerType,
    69         const int iapId);
    67         const int iapId);
    70 
    68 
    71     ~EapQtConfigInterfacePrivate();
    69     ~EapQtConfigInterfacePrivate();
    72 
    70 
    73     QList<EapQtPluginInfo> supportedOuterTypes();
    71     QList<EapQtPluginInfo> supportedOuterTypes();
    74     QList<EapQtPluginInfo> supportedInnerTypes(const EapQtPluginHandle &outerType);
    72     QList<EapQtPluginInfo> supportedInnerTypes(const EapQtPluginHandle &outerType);
    75 
    73 
    76     bool isSupportedOuterType(const EapQtPluginHandle& handle);
    74     bool isSupportedOuterType(const EapQtPluginHandle &handle);
    77     bool isSupportedInnerType(const EapQtPluginHandle& outerHandle,
    75     bool isSupportedInnerType(const EapQtPluginHandle &outerHandle,
    78         const EapQtPluginHandle& innerHandle);
    76         const EapQtPluginHandle &innerHandle);
    79 
    77 
    80     QList<EapQtCertificateInfo> certificateAuthorityCertificates();
    78     QList<EapQtCertificateInfo> certificateAuthorityCertificates();
    81     QList<EapQtCertificateInfo> userCertificates();
    79     QList<EapQtCertificateInfo> userCertificates();
    82 
    80     bool updateCertificates();
    83     EapQtValidator *validatorEap(EapQtExpandedEapType type, EapQtConfig::SettingsId id);
    81 
    84 
       
    85     CpBaseSettingView *uiInstance(const EapQtPluginHandle& outerHandle,
       
    86         const EapQtPluginHandle& pluginHandle);
       
    87 
       
    88     // if iapId was negative in the constructor, this method must be called before
       
    89     // calling the following methods
       
    90     bool setConfigurationReference(const int iapId);
    82     bool setConfigurationReference(const int iapId);
    91 
    83 
    92     QList<EapQtPluginHandle> selectedOuterTypes();
    84     QList<EapQtPluginHandle> selectedOuterTypes();
    93     bool setSelectedOuterTypes(const QList<EapQtPluginHandle>& outerHandles);
    85     bool setSelectedOuterTypes(const QList<EapQtPluginHandle> &outerHandles);
    94 
    86 
    95     bool readConfiguration(const EapQtPluginHandle& outerHandle,
    87     bool readConfiguration(const EapQtPluginHandle &outerHandle,
    96         const EapQtPluginHandle& pluginHandle, EapQtConfig &config);
    88         const EapQtPluginHandle &pluginHandle, EapQtConfig &config);
    97     bool saveConfiguration(const EapQtPluginHandle& pluginHandle, EapQtConfig &config);
    89     bool saveConfiguration(const EapQtPluginHandle &pluginHandle, const EapQtConfig &config);
    98 
    90 
    99     bool deleteConfiguration();
    91     bool deleteConfiguration();
   100 
    92 
       
    93     EapQtValidator *validatorEap(const EapQtExpandedEapType &type, const EapQtConfig::SettingsId id);
       
    94 
       
    95     CpBaseSettingView *uiInstance(const EapQtPluginHandle &outerHandle,
       
    96         const EapQtPluginHandle &pluginHandle);
       
    97 
       
    98     bool readPacStoreConfiguration(EapQtPacStoreConfig &config);
       
    99     bool savePacStoreConfiguration(const EapQtPacStoreConfig &config);
       
   100     EapQtValidator *validatorPacStore(const EapQtPacStoreConfig::PacStoreSettings id);
       
   101 
   101 private:
   102 private:
       
   103 
       
   104     // see cpp for documentation
   102 
   105 
   103     void loadPlugins();
   106     void loadPlugins();
   104 
   107 
   105     bool fetchCertificates(QList<EapQtCertificateInfo>* const caInfos,
   108     bool fetchCertificates(QList<EapQtCertificateInfo>* const caInfos,
   106         QList<EapQtCertificateInfo>* const clientInfos);
   109         QList<EapQtCertificateInfo>* const clientInfos);
   107 
   110 
   108     void copyCertificateInfo(const RPointerArray<EapCertificateEntry>* const certEntries, QList<
   111     void copyCertificateInfo(const RPointerArray<EapCertificateEntry>* const certEntries, QList<
   109         EapQtCertificateInfo>* const certInfos);
   112         EapQtCertificateInfo>* const certInfos);
   110 
   113 
   111     void appendCertificateInfo(bool isCaCertificate, const EapQtCertificateInfo& certInfo,
   114     void appendCertificateInfo(bool isCaCertificate, const EapQtCertificateInfo &certInfo,
   112         RPointerArray<EapCertificateEntry>* const certList);
   115         RPointerArray<EapCertificateEntry>* const certList);
   113 
   116 
   114     void appendEapTypes(const RArray<TEapExpandedType>* const eapTypes,
   117     void appendEapTypes(const RArray<TEapExpandedType>* const eapTypes,
   115         QList<QByteArray>* const eapList);
   118         QList<QByteArray>* const eapList);
   116 
   119 
   117     void getEapTypeIf(const EapQtPluginHandle& pluginHandle);
   120     void getEapTypeIf(const EapQtPluginHandle &pluginHandle);
   118 
   121 
   119     void copyFromEapSettings(EAPSettings& eapSettings, EapQtConfig& config);
   122     void copyFromEapSettings(EAPSettings &eapSettings, EapQtConfig &config);
   120 
   123 
   121     void copyToEapSettings(EapQtConfig& config, EAPSettings& eapSettings);
   124     void copyToEapSettings(const EapQtConfig &config, EAPSettings &eapSettings);
   122 
   125 
   123     TBool convertToTbool(bool value);
   126     TBool convertToTbool(bool value);
   124     bool convertToBool(TBool value);
   127     bool convertToBool(TBool value);
   125 
   128 
   126     bool isUiSupported(const QByteArray &eapType, int &pluginIndex) const;
   129     bool isUiSupported(const QByteArray &eapType, int &pluginIndex) const;
   132 
   135 
   133     void shutdown();
   136     void shutdown();
   134 
   137 
   135     EapQtConfigInterface::EapBearerType getEapBearer();
   138     EapQtConfigInterface::EapBearerType getEapBearer();
   136 
   139 
   137 private:
   140     // comparison mehtod for qSort
       
   141     // must be static for using via function pointers
       
   142     static bool pluginLessThan(const EapQtPluginInfo &plugin1, const EapQtPluginInfo &plugin2);
   138 
   143 
   139     Q_DISABLE_COPY(EapQtConfigInterfacePrivate)
   144     Q_DISABLE_COPY(EapQtConfigInterfacePrivate)
   140 
   145 
       
   146 private: // data
       
   147 
       
   148     /// QT members
       
   149 
       
   150     // is current instance for validators only
   141     const bool mValidatorInstance;
   151     const bool mValidatorInstance;
   142 
   152 
   143     // list of available EAP UIs
   153     // list of available EAP UIs
   144     QList<CpEapPluginInterface*> mPlugins;
   154     QList<CpEapPluginInterface*> mPlugins;
   145 
   155 
   151     QList<EapQtPluginInfo> mSupportedOuterTypes;
   161     QList<EapQtPluginInfo> mSupportedOuterTypes;
   152 
   162 
   153     // list of supported inner EAP methods queried last time,
   163     // list of supported inner EAP methods queried last time,
   154     // combination of UI and EAP server support
   164     // combination of UI and EAP server support
   155     QList<EapQtPluginInfo> mSupportedInnerTypes;
   165     QList<EapQtPluginInfo> mSupportedInnerTypes;
       
   166 
       
   167     // currenly loaded outer EAP type
   156     EapQtPluginHandle mLastOuterHandle;
   168     EapQtPluginHandle mLastOuterHandle;
   157 
   169 
       
   170     // translator object for EAP UIs
   158     QScopedPointer<HbTranslator> mTranslator;
   171     QScopedPointer<HbTranslator> mTranslator;
   159 
   172 
   160 private:
   173     // read CA and user certificates
   161 
   174     QList<EapQtCertificateInfo> mCaCertificates;
       
   175     QList<EapQtCertificateInfo> mUserCertificates;
       
   176 
       
   177     /// Symbian members
       
   178 
       
   179     // pointers to EAP server interfaces
   162     QScopedPointer<CEapGeneralSettings> mEapGsIf;
   180     QScopedPointer<CEapGeneralSettings> mEapGsIf;
   163     QScopedPointer<CEapType> mEapTypeIf;
   181     QScopedPointer<CEapType> mEapTypeIf;
   164 
   182 
       
   183     // current IAP ID
   165     int mIapId;
   184     int mIapId;
       
   185 
       
   186     // current bearer
   166     TIndexType mEapBearer;
   187     TIndexType mEapBearer;
       
   188 
       
   189     // current EAP database reference to current IAP
   167     TInt mEapDbIndex;
   190     TInt mEapDbIndex;
       
   191 
       
   192     // if mEapDbIndex is valid (i.e. current IAP is not
       
   193     // EapQtConfigInterface::IapIdUndefined)
   168     bool mEapDbIndexValid;
   194     bool mEapDbIndexValid;
       
   195 
       
   196     // current loaded EAP server type interface
   169     TEapExpandedType mCurrentServerEapType;
   197     TEapExpandedType mCurrentServerEapType;
   170 
   198 
   171     // EAP server lists of its supported outer EAP methods
   199     // EAP server lists of its supported outer EAP methods
   172     RArray<TEapExpandedType> mOuterEapsOn;
   200     RArray<TEapExpandedType> mOuterEapsOn;
   173     RArray<TEapExpandedType> mOuterEapsOff;
   201     RArray<TEapExpandedType> mOuterEapsOff;
   174 
   202 
   175 };
   203 };
   176 
   204 
   177 /*! @} */
   205 #endif // EAPQTCONFIGINTERFACEPRIVATE_H
   178 
       
   179 #endif
       
   180