diff -r 7b3e49e4608a -r 72ebcbb64834 wlanutilities/eapwizard/src/eapwizard_p.cpp --- a/wlanutilities/eapwizard/src/eapwizard_p.cpp Thu Jun 24 10:49:51 2010 +0300 +++ b/wlanutilities/eapwizard/src/eapwizard_p.cpp Fri Jul 09 10:38:19 2010 +0300 @@ -63,7 +63,7 @@ /*! Constructor of EAP Wizard. - + @param [in] wizardHelper pointer to the helper instance. */ EapWizardPrivate::EapWizardPrivate( @@ -74,8 +74,10 @@ EapQtConfigInterface::EapBearerTypeWlan, EapQtConfigInterface::IapIdUndefined)) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_ENTRY ); Q_ASSERT(wizardHelper); createPages(); + OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_EXIT ); } /*! @@ -83,6 +85,8 @@ */ EapWizardPrivate::~EapWizardPrivate() { + OstTraceFunctionEntry0( DUP1_EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_ENTRY ); + OstTraceFunctionExit0( DUP1_EAPWIZARDPRIVATE_EAPWIZARDPRIVATE_EXIT ); } /*! @@ -93,6 +97,7 @@ QString &item, QString &value) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_SUMMARY_ENTRY ); bool ret = false; int outerType = configurations(EapWizardPrivate::OuterType).toInt(); @@ -121,77 +126,81 @@ break; } + OstTraceFunctionExit0( EAPWIZARDPRIVATE_SUMMARY_EXIT ); return ret; } /*! See EapWizard::storeSettings(). - + @return true - ok, false - failed */ bool EapWizardPrivate::storeSettings() { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STORESETTINGS_ENTRY ); bool ret = false; EapQtPluginHandle outerType(static_cast( configurations(OuterType).toInt())); - + int iapId = mWizardHelper->configuration(WlanWizardHelper::ConfIapId).toInt(); - + if (mEapConfIf->setConfigurationReference(iapId) && storeOuterTypeSettings(outerType) && storeInnerTypeSettings(outerType)) { ret = true; } + OstTraceFunctionExit0( EAPWIZARDPRIVATE_STORESETTINGS_EXIT ); return ret; } /*! See WlanWizardPlugin::errorString(). - + Returns EAP spesific error string. */ QString EapWizardPrivate::errorString(int errorCode) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_ERRORSTRING_ENTRY ); char* textId = NULL; int eapType = EapQtPluginHandle::PluginUndefined; - + switch (errorCode){ case KErrWlanUserRejected: textId = "txt_occ_dialog_1_auth_failed_user_cert_rej"; eapType = configurations(OuterType).toInt(); break; - + case KErrWlanUserCertificateExpired: textId = "txt_occ_dialog_1_auth_failed_user_cert_exp"; eapType = configurations(OuterType).toInt(); break; - + case KErrWlanServerCertificateExpired: textId = "txt_occ_dialog_1_authentication_failed_server_ce"; eapType = configurations(OuterType).toInt(); break; - + case KErrWlanCerficateVerifyFailed: textId = "txt_occ_dialog_1_authentication_failed_could_not"; eapType = configurations(OuterType).toInt(); break; - + case KErrWlanNoCipherSuite: textId = "txt_occ_dialog_1_authentication_failed_cipher_su"; eapType = configurations(OuterType).toInt(); break; - + case KErrWlanSimNotInstalled: textId = "txt_occ_dialog_1_authentication_failed_check_sim"; eapType = configurations(OuterType).toInt(); break; - + case KErrWlanEapFastPacStoreCorrupted: textId = "txt_occ_dialog_1_authentication_failed_reset_pac"; eapType = EapQtPluginHandle::PluginEapFast; break; - + case KErrWlanEapSimFailed: case KErrWlanEapTlsFailed: case KErrWlanEapPeapFailed: @@ -207,13 +216,13 @@ textId = "txt_occ_dialog_1_authentication_failed"; eapType = configurations(OuterType).toInt(); break; - + case KErrWlanEapMsChapv2: case KErrWlanEapGtcFailed: textId = "txt_occ_dialog_1_authentication_failed"; eapType = configurations(InnerType).toInt(); break; - + case KErrWlanNotSubscribed: case KErrWlanAccessBarred: case KErrWlanPasswordExpired: @@ -227,65 +236,69 @@ eapType = configurations(OuterType).toInt(); } break; - + default: // Return empty string break; } - + QString string; if (textId) { string = HbParameterLengthLimiter(hbTrId(textId)).arg(eapTypeToString(eapType)); } - + + OstTraceFunctionExit0( EAPWIZARDPRIVATE_ERRORSTRING_EXIT ); return string; } /*! Reader method for eap configurations. - + See ConfigurationId for further details about the data types in QVariant. - + @param [in] confId Defines what configuration is read. - + @return configuration value. */ QVariant EapWizardPrivate::configurations(ConfigurationId confId) const { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_CONFIGURATIONS_ENTRY ); Q_ASSERT(mConfigurations.contains(confId)); - + #ifdef OST_TRACE_COMPILER_IN_USE QString tmp; QDebug tmpStream(&tmp ); tmpStream << mConfigurations[confId]; TPtrC16 string(tmp.utf16(), tmp.length() ); - + OstTraceExt2( TRACE_NORMAL, EAPWIZARDPRIVATE_CONFIGURATIONS, "EapWizardPrivate::configurations;confId=%{ConfigurationId};string=%S", (TUint)confId, string ); #endif - + + OstTraceFunctionExit0( EAPWIZARDPRIVATE_CONFIGURATIONS_EXIT ); return mConfigurations[confId]; } /*! Sets EAP configuration value for given configuration identifier. See ConfigurationId for further details about the data types in QVariant. - + @param [in] confId Configuration Identifier do to be set @param [in] value Value for configuration. */ void EapWizardPrivate::setConfigurations( ConfigurationId confId, const QVariant &value) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_SETCONFIGURATIONS_ENTRY ); #ifdef OST_TRACE_COMPILER_IN_USE QString tmp; QDebug tmpStream(&tmp ); tmpStream << value; TPtrC16 string( tmp.utf16(), tmp.length() ); - + OstTraceExt2( TRACE_NORMAL, EAPWIZARDPRIVATE_SETCONFIGURATIONS, @@ -294,6 +307,7 @@ #endif mConfigurations[confId] = value; + OstTraceFunctionExit0( EAPWIZARDPRIVATE_SETCONFIGURATIONS_EXIT ); } /*! @@ -301,79 +315,85 @@ */ EapQtConfigInterface* EapWizardPrivate::eapConfigurationInterface() const { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPCONFIGURATIONINTERFACE_ENTRY ); Q_ASSERT(mEapConfIf.data()); + OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPCONFIGURATIONINTERFACE_EXIT ); return mEapConfIf.data(); } /*! Maps given EAP Qt Plugin handle into string. - + @param [in] id EapQtPluginHandle::Handle, id to be mapped to string. - + @return EAP String. */ QString EapWizardPrivate::eapTypeToString(int id) const { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_EAPTYPETOSTRING_ENTRY ); QString locId; switch (id) { case EapQtPluginHandle::PluginEapAka: locId = EapWizardUiStrings::EapAka; break; - + case EapQtPluginHandle::PluginEapFast: locId = EapWizardUiStrings::EapFast; break; - + case EapQtPluginHandle::PluginLeap: locId = EapWizardUiStrings::Leap; break; - + case EapQtPluginHandle::PluginPeap: locId = EapWizardUiStrings::Peap; break; - + case EapQtPluginHandle::PluginEapSim: locId = EapWizardUiStrings::EapSim; break; - + case EapQtPluginHandle::PluginEapTls: locId = EapWizardUiStrings::EapTls; break; - + case EapQtPluginHandle::PluginEapTtls: locId = EapWizardUiStrings::EapTtls; break; - + case EapQtPluginHandle::PluginEapMschapv2: locId = EapWizardUiStrings::EapMschapv2; break; - + case EapQtPluginHandle::PluginEapGtc: locId = EapWizardUiStrings::EapGtc; break; - + case EapQtPluginHandle::PluginPap: locId = EapWizardUiStrings::Pap; break; - + default: // Invalid enum Q_ASSERT(EapQtPluginHandle::PluginPlainMschapv2 == id); locId = EapWizardUiStrings::Mschapv2; break; } - + + OstTraceFunctionExit0( EAPWIZARDPRIVATE_EAPTYPETOSTRING_EXIT ); return locId; } /*! Accessor to WLAN Wizard Helper objects. - + @return a pointer to helper object. */ WlanWizardHelper *EapWizardPrivate::wizardHelper() const { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_WIZARDHELPER_ENTRY ); Q_ASSERT(mWizardHelper); + OstTraceFunctionExit0( EAPWIZARDPRIVATE_WIZARDHELPER_EXIT ); return mWizardHelper; } @@ -382,74 +402,78 @@ */ void EapWizardPrivate::createPages() { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_CREATEPAGES_ENTRY ); mWizardHelper->addPage( EapWizardPage::PageOuterType, new EapWizardPageOuterType(this)); - + mWizardHelper->addPage( EapWizardPage::PageCertificateCa, new EapWizardPageCertCa(this)); - + mWizardHelper->addPage( EapWizardPage::PageCertificateUser, new EapWizardPageCertUser(this)); - + mWizardHelper->addPage( EapWizardPage::PageIdentity, new EapWizardPageIdentity(this)); - + mWizardHelper->addPage( EapWizardPage::PageInnerTypeEapTtls, new EapWizardPageInnerType( this, EapQtPluginHandle::PluginEapTtls)); - + mWizardHelper->addPage( EapWizardPage::PageInnerTypePeap, new EapWizardPageInnerType( this, EapQtPluginHandle::PluginPeap)); - + mWizardHelper->addPage( EapWizardPage::PageUsernamePassword, new EapWizardPageUsernamePassword(this)); - + mWizardHelper->addPage( EapWizardPage::PageNewPacStorePassword, new EapWizardPageNewPacStore(this)); - + mWizardHelper->addPage( EapWizardPage::PagePromptPacStorePassword, new EapWizardPagePacStorePasswordConfirm(this)); + OstTraceFunctionExit0( EAPWIZARDPRIVATE_CREATEPAGES_EXIT ); } /*! Check whether selected outer type has inner method. - + @return true if inner method exists, false otherwise. */ bool EapWizardPrivate::hasInnerMethod() const { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HASINNERMETHOD_ENTRY ); int outerType = configurations(EapWizardPrivate::OuterType).toInt(); bool ret = false; - - switch (outerType){ + + switch (outerType) { case EapQtPluginHandle::PluginEapTtls: case EapQtPluginHandle::PluginPeap: case EapQtPluginHandle::PluginEapFast: ret = true; break; } - + + OstTraceFunctionExit0( EAPWIZARDPRIVATE_HASINNERMETHOD_EXIT ); return ret; } /* Handles TLS methods (PEAP, EAP-TLS and EAP-TTLS) settings. - + Stores configurations to eapConf - + @param [in,out] eapConf configuration is written to this object. @param [in] outerType Outer EAP method */ @@ -457,6 +481,7 @@ EapQtConfig &eapConf, EapQtPluginHandle &outerType) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLETLSMETHODSSETTINGS_ENTRY ); // Common stuff for all tls methods eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false); eapConf.setValue(EapQtConfig::VerifyServerRealm, false); @@ -465,9 +490,9 @@ eapConf.setValue(EapQtConfig::Username, configurations(TunnelUsername)); eapConf.setValue(EapQtConfig::RealmAutomatic, configurations(TunnelRealmAutomatic)); eapConf.setValue(EapQtConfig::Realm, configurations(TunnelRealm)); - + QVariant certVariant = configurations(CertificateCa); - + if (certVariant.canConvert ()) { QList caCerts; caCerts.append(certVariant); @@ -476,23 +501,23 @@ } else { eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); } - + // type specific configurations if (outerType == EapQtPluginHandle::PluginEapTls) { QList userCerts; userCerts.append(configurations(CertificateUser)); eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, true); eapConf.setValue(EapQtConfig::UserCertificate, userCerts); - + } else if (outerType == EapQtPluginHandle::PluginPeap) { - + switch (configurations(InnerType).toInt()) { case EapQtPluginHandle::PluginEapMschapv2: // EAP-MSCHAPv2: enable v0 only eapConf.setValue(EapQtConfig::PeapVersion0Allowed, true); eapConf.setValue(EapQtConfig::PeapVersion1Allowed, false); break; - + case EapQtPluginHandle::PluginEapGtc: // EAP-GTC: enable v1 only eapConf.setValue(EapQtConfig::PeapVersion0Allowed, false); @@ -501,20 +526,22 @@ } eapConf.setValue(EapQtConfig::PeapVersion2Allowed, false); } + OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLETLSMETHODSSETTINGS_EXIT ); } /*! Handles configurations for EAP-FAST. - + @param [in,out] eapConf EAP Configuration - + @param false in case of failure. */ bool EapWizardPrivate::handleEapFastSettings(EapQtConfig &eapConf) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLEEAPFASTSETTINGS_ENTRY ); bool ret = true; EapQtPacStoreConfig pacStoreConf; - + eapConf.setValue(EapQtConfig::ProvisioningModeAuthenticated, false); eapConf.setValue(EapQtConfig::ProvisioningModeUnauthenticated, true); eapConf.setValue(EapQtConfig::VerifyServerRealm, false); @@ -526,60 +553,66 @@ pacStoreConf.setValue( EapQtPacStoreConfig::PacStorePassword, configurations(PacStorePassword)); - + pacStoreConf.setValue( EapQtPacStoreConfig::PacStoreSavePassword, true); - + if (!mEapConfIf->savePacStoreConfiguration(pacStoreConf)) { // no cleaning required ret = false; } break; - + default: // Do nothing break; } - + + OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLEEAPFASTSETTINGS_EXIT ); return ret; } /*! Handles configurations for EAP-AKA and EAP-SIM. - + @param [in,out] eapConf EAP Configuration */ void EapWizardPrivate::handleEapAkaSimSettings(EapQtConfig &eapConf) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLEEAPAKASIMSETTINGS_ENTRY ); eapConf.setValue(EapQtConfig::UsernameAutomatic, true); eapConf.setValue(EapQtConfig::RealmAutomatic, true); + OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLEEAPAKASIMSETTINGS_EXIT ); } /*! Handles configurations for LEAP. - + @param [in,out] eapConf EAP Configuration */ void EapWizardPrivate::handleLeapSettings(EapQtConfig &eapConf) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLELEAPSETTINGS_ENTRY ); eapConf.setValue(EapQtConfig::UsernameAutomatic, false); eapConf.setValue(EapQtConfig::Username, configurations(Username)); eapConf.setValue(EapQtConfig::PasswordPrompt, false); eapConf.setValue(EapQtConfig::Password, configurations(Password)); + OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLELEAPSETTINGS_EXIT ); } /*! Store outer type settings. - + @param outerType reference to outertype - + @return false in case of failure. */ bool EapWizardPrivate::storeOuterTypeSettings(EapQtPluginHandle &outerType) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_ENTRY ); EapQtConfig eapConf; - + // 1. Store outer type settings switch (outerType.pluginId()) { case EapQtPluginHandle::PluginEapTtls: @@ -587,65 +620,70 @@ case EapQtPluginHandle::PluginEapTls: handleTlsMethodsSettings(eapConf, outerType); break; - + case EapQtPluginHandle::PluginEapFast: if (!handleEapFastSettings(eapConf)) { + OstTraceFunctionExit0( EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); return false; } break; - + case EapQtPluginHandle::PluginEapAka: case EapQtPluginHandle::PluginEapSim: handleEapAkaSimSettings(eapConf); break; - + default: Q_ASSERT(outerType == EapQtPluginHandle::PluginLeap); handleLeapSettings(eapConf); break; } - + if (hasInnerMethod()) { EapQtPluginHandle inner = static_cast( configurations(InnerType).toInt()); - + QList innerType; innerType.append(qVariantFromValue(inner)); eapConf.setValue(EapQtConfig::InnerType, innerType); } - + // store outer type configurations if (!mEapConfIf->saveConfiguration(outerType, eapConf)){ mEapConfIf->deleteConfiguration(); + OstTraceFunctionExit0( DUP1_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); return false; } - + QList selectedOuterTypes; selectedOuterTypes.append(outerType); if (!mEapConfIf->setSelectedOuterTypes(selectedOuterTypes)){ mEapConfIf->deleteConfiguration(); + OstTraceFunctionExit0( DUP2_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); return false; } - + + OstTraceFunctionExit0( DUP3_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); return true; } /*! Store inner type settings if exists. - + @param outerType reference to outertype - + @return false in case of failure. */ bool EapWizardPrivate::storeInnerTypeSettings(EapQtPluginHandle &outerType) { + OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STOREINNERTYPESETTINGS_ENTRY ); bool ret = true; - + if (hasInnerMethod()) { EapQtPluginHandle inner = static_cast( configurations(InnerType).toInt()); - + // All inner methods supported by wizard use password / username. EapQtConfig eapConfInner; eapConfInner.setValue(EapQtConfig::OuterType, qVariantFromValue(outerType)); @@ -653,11 +691,12 @@ eapConfInner.setValue(EapQtConfig::Username, configurations(Username)); eapConfInner.setValue(EapQtConfig::PasswordPrompt, false); eapConfInner.setValue(EapQtConfig::Password, configurations(Password)); - + if (!mEapConfIf->saveConfiguration(inner, eapConfInner)){ mEapConfIf->deleteConfiguration(); ret = false; } } + OstTraceFunctionExit0( EAPWIZARDPRIVATE_STOREINNERTYPESETTINGS_EXIT ); return ret; }