securitysettings/qtconfigutils/eapqtconfiginterface/inc/eapqtconfiginterface_p.h
changeset 26 9abfd4f00d37
child 27 9660a5eb236f
equal deleted inserted replaced
25:e03a3db4489e 26:9abfd4f00d37
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *   EAP method configuration QT interface private implementation
       
    16  *
       
    17  */
       
    18 
       
    19 /*
       
    20  * %version: 28 %
       
    21  */
       
    22 
       
    23 #ifndef EAPQTCONFIGINTERFACEPRIVATE_H
       
    24 #define EAPQTCONFIGINTERFACEPRIVATE_H
       
    25 
       
    26 #include <qglobal.h>
       
    27 #include <EapSettings.h>
       
    28 #include <EapTypeDefinitions.h>
       
    29 #include <eapqtconfig.h>
       
    30 #include <eapqtpluginhandle.h>
       
    31 #include <eapqtconfiginterface.h>
       
    32 
       
    33 /*!
       
    34  * @addtogroup group_eap_config_if_impl
       
    35  * @{
       
    36  */
       
    37 class HbTranslator;
       
    38 class CEapType;
       
    39 class CEapGeneralSettings;
       
    40 class CpEapPluginInterface;
       
    41 class EapQtConfigInterface;
       
    42 
       
    43 class EapQtConfigInterfacePrivate
       
    44 {
       
    45 public:
       
    46 
       
    47     // TODO: check all certificate fields. Are they treated correctly, unicode vs. ascii vs. binary?
       
    48 
       
    49     // maximum lenghts (number of characters) for UTF-16 strings copied to EAP settings
       
    50     static const unsigned int StringMaxLength = KGeneralStringMaxLength;
       
    51     static const unsigned int CertLabelMaxLength = KMaxCertLabelLength;
       
    52     static const unsigned int CertThumbprintMaxLength = KThumbprintMaxLength;
       
    53     static const unsigned int CertSubjectKeyIdLength = KSHA1HashLengthBytes;
       
    54 
       
    55 public:
       
    56 
       
    57     // the constructor can only be used for validators
       
    58     // any other call trows an exception
       
    59     EapQtConfigInterfacePrivate();
       
    60 
       
    61     // this is the constructor for using the interface for accessing settings etc.
       
    62     // if iapId is negative, it must be later set to correct value with setConfigurationReference
       
    63     // to be able to use the methods:
       
    64     // - selectedOuterTypes
       
    65     // - readConfiguration
       
    66     // - saveConfiguration
       
    67     // - deleteConfiguration
       
    68     // other methods are usable with negative iapId
       
    69     EapQtConfigInterfacePrivate(const EapQtConfigInterface::EapBearerType bearerType,
       
    70         const int iapId);
       
    71 
       
    72     ~EapQtConfigInterfacePrivate();
       
    73 
       
    74     QList<EapQtPluginInfo> supportedOuterTypes();
       
    75     QList<EapQtPluginInfo> supportedInnerTypes(const EapQtPluginHandle &outerType);
       
    76 
       
    77     bool isSupportedOuterType(const EapQtPluginHandle& handle);
       
    78     bool isSupportedInnerType(const EapQtPluginHandle& outerHandle,
       
    79         const EapQtPluginHandle& innerHandle);
       
    80 
       
    81     QList<EapQtCertificateInfo> certificateAuthorityCertificates();
       
    82     QList<EapQtCertificateInfo> userCertificates();
       
    83 
       
    84     EapQtValidator *validatorEap(EapQtExpandedEapType type, EapQtConfig::SettingsId id);
       
    85 
       
    86     CpBaseSettingView *uiInstance(const EapQtPluginHandle& outerHandle,
       
    87         const EapQtPluginHandle& pluginHandle);
       
    88 
       
    89     // if iapId was negative in the constructor, this method must be called before
       
    90     // calling the following methods
       
    91     bool setConfigurationReference(const int iapId);
       
    92 
       
    93     QList<EapQtPluginHandle> selectedOuterTypes();
       
    94     bool setSelectedOuterTypes(const QList<EapQtPluginHandle>& outerHandles);
       
    95 
       
    96     bool readConfiguration(const EapQtPluginHandle& outerHandle,
       
    97         const EapQtPluginHandle& pluginHandle, EapQtConfig &config);
       
    98     bool saveConfiguration(const EapQtPluginHandle& pluginHandle, EapQtConfig &config);
       
    99 
       
   100     bool deleteConfiguration();
       
   101 
       
   102 private:
       
   103 
       
   104     void loadPlugins();
       
   105 
       
   106     bool fetchCertificates(QList<EapQtCertificateInfo>* const caInfos,
       
   107         QList<EapQtCertificateInfo>* const clientInfos);
       
   108 
       
   109     void copyCertificateInfo(const RPointerArray<EapCertificateEntry>* const certEntries, QList<
       
   110         EapQtCertificateInfo>* const certInfos);
       
   111 
       
   112     void appendCertificateInfo(bool isCaCertificate, const EapQtCertificateInfo& certInfo,
       
   113         RPointerArray<EapCertificateEntry>* const certList);
       
   114 
       
   115     void appendEapTypes(const RArray<TEapExpandedType>* const eapTypes,
       
   116         QList<QByteArray>* const eapList);
       
   117 
       
   118     void getEapTypeIf(const EapQtPluginHandle& pluginHandle);
       
   119 
       
   120     void copyFromEapSettings(EAPSettings& eapSettings, EapQtConfig& config);
       
   121 
       
   122     void copyToEapSettings(EapQtConfig& config, EAPSettings& eapSettings);
       
   123 
       
   124     TBool convertToTbool(bool value);
       
   125     bool convertToBool(TBool value);
       
   126 
       
   127     bool isUiSupported(const QByteArray &eapType, int &pluginIndex) const;
       
   128 
       
   129     void checkInstanceThrowing() const;
       
   130 
       
   131     bool setEapDbIndex(const int iapId);
       
   132     bool setEapWlanDbIndex(const int iapId);
       
   133 
       
   134     void shutdown();
       
   135 
       
   136     EapQtConfigInterface::EapBearerType getEapBearer();
       
   137 
       
   138 private:
       
   139 
       
   140     Q_DISABLE_COPY(EapQtConfigInterfacePrivate)
       
   141 
       
   142     const bool mValidatorInstance;
       
   143 
       
   144     // list of available EAP UIs
       
   145     QList<CpEapPluginInterface*> mPlugins;
       
   146 
       
   147     // list of EAPs supported by UI
       
   148     QList<EapQtPluginInfo> mPluginInfos;
       
   149 
       
   150     // list of supported outer EAP methods,
       
   151     // combination of UI and EAP server support
       
   152     QList<EapQtPluginInfo> mSupportedOuterTypes;
       
   153 
       
   154     // list of supported inner EAP methods queried last time,
       
   155     // combination of UI and EAP server support
       
   156     QList<EapQtPluginInfo> mSupportedInnerTypes;
       
   157     EapQtPluginHandle mLastOuterHandle;
       
   158 
       
   159     QScopedPointer<HbTranslator> mTranslator;
       
   160 
       
   161 private:
       
   162 
       
   163     QScopedPointer<CEapGeneralSettings> mEapGsIf;
       
   164     QScopedPointer<CEapType> mEapTypeIf;
       
   165 
       
   166     int mIapId;
       
   167     TIndexType mEapBearer;
       
   168     TInt mEapDbIndex;
       
   169     bool mEapDbIndexValid;
       
   170     TEapExpandedType mCurrentServerEapType;
       
   171 
       
   172     // EAP server lists of its supported outer EAP methods
       
   173     RArray<TEapExpandedType> mOuterEapsOn;
       
   174     RArray<TEapExpandedType> mOuterEapsOff;
       
   175 
       
   176 };
       
   177 
       
   178 /*! @} */
       
   179 
       
   180 #endif
       
   181