# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1286973736 -10800 # Node ID 5960d2d03390885c4263762be19bdccddef45e16 # Parent 29c8f9bc68e1e2a2a517068378a1aaf463b9b14a Revision: 201038 Kit: 201041 diff -r 29c8f9bc68e1 -r 5960d2d03390 group/bld.inf --- a/group/bld.inf Wed Sep 15 13:20:54 2010 +0300 +++ b/group/bld.inf Wed Oct 13 15:42:16 2010 +0300 @@ -46,9 +46,8 @@ ../vpnengine/vpnmanager/rom/vpnmanager.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vpnmanager.iby) ../vpnengine/vpnins/rom/vpnins.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vpnins.iby) ../vpnengine/vpnipsecpolparser/rom/vpnipsecpolparser.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vpnipsecpolparser.iby) -../vpnengine/agileprovisionws/rom/agileprovisionws.iby CORE_MW_LAYER_IBY_EXPORT_PATH(agileprovisionws.iby) ../vpnengine/vpntcwrapper/rom/vpntcwrapper.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vpntcwrapper.iby) -../vpnengine/vpnextapi/rom/vpnextapi.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vpnextapi.iby) + ../vpnui/vpnecomnotifier/rom/vpnecomnotifier.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vpnecomnotifier.iby) ../vpnui/vpndialogmanager/rom/vpndialogmanager.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vpndialogmanager.iby) ../vpnui/vpnmanagementui/rom/vpnmanagementui.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vpnmanagementui.iby) @@ -79,8 +78,7 @@ #include "../vpnc_plat/vpnapi/group/bld.inf" #include "../vpnapiimpl/group/bld.inf" -#include "../vpnengine/vpnextapi/group/bld.inf" -#include "../vpnengine/agileprovisionws/group/bld.inf" + #include "../vpnengine/eventmediatorapi/group/bld.inf" #include "../vpnengine/eventviewer/group/bld.inf" #include "../vpnengine/vpnins/group/bld.inf" diff -r 29c8f9bc68e1 -r 5960d2d03390 group/update_version_h.pl --- a/group/update_version_h.pl Wed Sep 15 13:20:54 2010 +0300 +++ b/group/update_version_h.pl Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of "Eclipse Public License v1.0" @@ -72,9 +72,14 @@ } +my $oldpwd = getcwd(); +chdir ".."; + ### VERSION.H ########### # version.h update_version_h( - '../vpnengine/vpncommon/inc/version.h', + 'vpnengine/vpncommon/inc/version.h', $PLATFORM_LONG); + +chdir $oldpwd; diff -r 29c8f9bc68e1 -r 5960d2d03390 group/vpnclient_version_update.flm --- a/group/vpnclient_version_update.flm Wed Sep 15 13:20:54 2010 +0300 +++ b/group/vpnclient_version_update.flm Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of "Eclipse Public License v1.0" @@ -22,8 +22,9 @@ # The file destinations relative to EPOCROOT # ============================================================================ + define updateversion -$(GUARD_VPNVU):=1 +$(GUARD):=1 BITMAP:: $(EXTENSION_ROOT)/$(VU_TOOL) $(call startrule,vpnclient_version_update,FORCESUCCESS) \ @@ -31,6 +32,7 @@ $(call endrule,vpnclient_version_update) endef -ifeq ($($(GUARD_VPNVU)),) +ifeq ($($(GUARD)),) $(eval -$(updateversion)) endif + diff -r 29c8f9bc68e1 -r 5960d2d03390 help/group/bld.inf --- a/help/group/bld.inf Wed Sep 15 13:20:54 2010 +0300 +++ b/help/group/bld.inf Wed Oct 13 15:42:16 2010 +0300 @@ -24,4 +24,6 @@ ../inc/vpn.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/vpn.hlp.hrh) +#ifndef FF_GENERIC_ACCESS_NETWORK // UMA not supported ../rom/vpnclienthelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(vpnclienthelps_variant.iby) +#endif \ No newline at end of file diff -r 29c8f9bc68e1 -r 5960d2d03390 rom/ipsecvpn.iby --- a/rom/ipsecvpn.iby Wed Sep 15 13:20:54 2010 +0300 +++ b/rom/ipsecvpn.iby Wed Oct 13 15:42:16 2010 +0300 @@ -22,9 +22,13 @@ #ifdef FF_VPN_CLIENT +#ifndef FF_GENERIC_ACCESS_NETWORK // UMA not supported + data=ZSYSTEM\install\ipsecvpn.sis system\install\ipsecvpn.sis data=ZSYSTEM\install\ipsecvpn_vpnpolins.sis system\install\ipsecvpn_vpnpolins.sis #endif +#endif // FF_VPN_CLIENT + #endif // __IPSECVPN_IBY__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnc_plat/vpnapi/group/bld.inf --- a/vpnc_plat/vpnapi/group/bld.inf Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnc_plat/vpnapi/group/bld.inf Wed Oct 13 15:42:16 2010 +0300 @@ -24,6 +24,3 @@ ../inc/vpnapidefs.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnapidefs.h) ../inc/vpnapi.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnapi.h) ../inc/vpnsipobserverpskeys.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnsipobserverpskeys.h) - ../inc/softtokenpluginif.h MW_LAYER_PLATFORM_EXPORT_PATH(softtokenpluginif.h) - ../inc/softtokenpluginif.inl MW_LAYER_PLATFORM_EXPORT_PATH(softtokenpluginif.inl) - \ No newline at end of file diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnc_plat/vpnapi/inc/softtokenpluginif.h --- a/vpnc_plat/vpnapi/inc/softtokenpluginif.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Soft Token plugin interface. -* -*/ - -#ifndef __SOFTTOKENPLUGIN_H -#define __SOFTTOKENPLUGIN_H - -#include -#include - -const TUid KCSoftTokenImplUid = {0x20031614}; -/** - * Soft Token plugin interface. - * - * Soft Token plugin interface provides functionality for generating OTPs - * (One Time Passwords). - * - */ - -class CSoftTokenPluginIf : public CBase - { - public: - /** - * Instantiates an object of this type . - */ - static CSoftTokenPluginIf* NewL(); - /** - * Destructor. - */ - virtual ~CSoftTokenPluginIf(); - /** - * Checks if default token is found. - * @return True if there is a token available. - */ - virtual TBool DefaultFoundL() = 0; - /** - * Gets code from default token. - * @param aPin PIN of token. - * @param aOTP One Time Password. - * @param aNextCode True if next code is requested. - * @return KErrNone if the OTP received or a system-wide error code. - */ - virtual TInt CodeL(const TDesC8& aPin, HBufC8*& aOTP, TBool aNextCode = EFalse) = 0; - - private: - TUid iDtor_ID_Key; - }; - -#include "softtokenpluginif.inl" - -#endif // __SOFTTOKENPLUGIN_H diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnc_plat/vpnapi/inc/softtokenpluginif.inl --- a/vpnc_plat/vpnapi/inc/softtokenpluginif.inl Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Soft Token plugin interface inline. -* -*/ - -#ifndef __SOFTTOKENPLUGIN_INL__ -#define __SOFTTOKENPLUGIN_INL__ - -_LIT8(KDefaultImplementation,"*"); -_LIT8(KDefaultPluginImpl,"softtokenplugin"); // default_data = "softtokenplugin"; - -inline CSoftTokenPluginIf::~CSoftTokenPluginIf() - { - // Destroy any instance variables and then - // inform the framework that this specific - // instance of the interface has been destroyed. - REComSession::DestroyedImplementation(iDtor_ID_Key); - } - -inline CSoftTokenPluginIf* CSoftTokenPluginIf::NewL() - { - return REINTERPRET_CAST(CSoftTokenPluginIf*, - REComSession::CreateImplementationL(KCSoftTokenImplUid, - _FOFF(CSoftTokenPluginIf,iDtor_ID_Key))); - } -#endif // __SOFTTOKENPLUGIN_INL__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnclient_sis/group/nokia_vpn_client_localised_armv5_udeb.pkg --- a/vpnclient_sis/group/nokia_vpn_client_localised_armv5_udeb.pkg Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnclient_sis/group/nokia_vpn_client_localised_armv5_udeb.pkg Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ ; -; Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ; All rights reserved. ; This component and the accompanying materials are made available ; under the terms of "Eclipse Public License v1.0" @@ -17,7 +17,7 @@ ; LANGUAGES ; - None (English only by default) -&EN,FR,GE,SP,IT,SW,DA,NO,FI,AM,PO,TU,IC,RU,HU,DU,CS,SK,PL,SL,TC,HK,ZH,JA,TH,AR,TL,BG,HR,ET,FA,CF,EL,HE,IN,LV,LT,MS,BP,RO,SR,LS,UK,UR,VI,44,102,103,65 +&EN,FR,GE,SP,IT,SW,DA,NO,FI,AM,PO,TU,IC,RU,HU,DU,CS,SK,PL,SL,TC,HK,ZH,JA,TH,AR,TL,BG,HR,ET,FA,CF,EL,HE,IN,LV,LT,MS,BP,RO,SR,LS,UK,UR,VI,44,102,103 ; INSTALLATION HEADER ; UID of acuagentcrypto @@ -68,7 +68,6 @@ "Nokia VPN client", "Nokia VPN", "Nokia VPN", - "Nokia VPN", "Nokia VPN"}, (0x101F5147),32,08,0124, TYPE=SA, RU @@ -121,7 +120,6 @@ "Series60ProductID", "Series60ProductID", "Series60ProductID", -"Series60ProductID", "Series60ProductID"} ; Product / platform version compatibility - S60 5.2 @@ -173,7 +171,6 @@ "Series60ProductID", "Series60ProductID", "Series60ProductID", -"Series60ProductID", "Series60ProductID"} ; List of localised vendor names - one per language. @@ -224,7 +221,6 @@ "Nokia", "Nokia", "Nokia", -"Nokia", "Nokia"} ; The non-localised, globally unique vendor name (mandatory) @@ -271,11 +267,6 @@ "\epoc32\release\armv5\udeb\dmadpki.dll"-"!:\sys\bin\dmadpki.dll" "\epoc32\data\z\resource\plugins\dmadpki.rsc"-"!:\resource\plugins\dmadpki.rsc" -; Agile Provision -"\epoc32\release\armv5\udeb\agileprovisionws.dll"-"!:\sys\bin\agileprovisionws.dll" - -; VPN EXT API -"\epoc32\release\armv5\udeb\vpnextapi.dll"-"!:\sys\bin\vpnextapi.dll" ; VPN API ( include by platform ) ;"\epoc32\release\armv5\udeb\vpnapi.dll"-"!:\sys\bin\vpnapi.dll" @@ -335,13 +326,64 @@ "\epoc32\data\z\resource\vpnmanagementuirsc.r44" "\epoc32\data\z\resource\vpnmanagementuirsc.r102" "\epoc32\data\z\resource\vpnmanagementuirsc.r103" -"\epoc32\data\z\resource\vpnmanagementuirsc.r65" }-"!:\resource\vpnmanagementuirsc.rsc" ; icon and GS plugin registration file "\epoc32\data\z\resource\apps\vpnmanagementui.mif"-"!:\resource\apps\vpnmanagementui.mif" "\epoc32\data\Z\resource\plugins\vpnmanagementui.rsc"-"!:\resource\plugins\vpnmanagementui.rsc" +; VPN help resources +; Localized help files are missing, thus use only EE +; Help resources should be already in ROM but content can be updated from SIS package +;"\epoc32\data\Z\resource\xhtml\01\0x10200EC4\index.xml"-"!:\resource\xhtml\01\0x10200EC4\index.xml" +;{ +;"\epoc32\data\z\resource\help\vpn.h01" +;"\epoc32\data\z\resource\help\vpn.h02" +;"\epoc32\data\z\resource\help\vpn.h03" +;"\epoc32\data\z\resource\help\vpn.h04" +;"\epoc32\data\z\resource\help\vpn.h05" +;"\epoc32\data\z\resource\help\vpn.h06" +;"\epoc32\data\z\resource\help\vpn.h07" +;"\epoc32\data\z\resource\help\vpn.h08" +;"\epoc32\data\z\resource\help\vpn.h09" +;"\epoc32\data\z\resource\help\vpn.h10" +;"\epoc32\data\z\resource\help\vpn.h13" +;"\epoc32\data\z\resource\help\vpn.h14" +;"\epoc32\data\z\resource\help\vpn.h15" +;"\epoc32\data\z\resource\help\vpn.h16" +;"\epoc32\data\z\resource\help\vpn.h17" +;"\epoc32\data\z\resource\help\vpn.h18" +;"\epoc32\data\z\resource\help\vpn.h25" +;"\epoc32\data\z\resource\help\vpn.h26" +;"\epoc32\data\z\resource\help\vpn.h27" +;"\epoc32\data\z\resource\help\vpn.h28" +;"\epoc32\data\z\resource\help\vpn.h29" +;"\epoc32\data\z\resource\help\vpn.h30" +;"\epoc32\data\z\resource\help\vpn.h31" +;"\epoc32\data\z\resource\help\vpn.h32" +;"\epoc32\data\z\resource\help\vpn.h33" +;"\epoc32\data\z\resource\help\vpn.h37" +;"\epoc32\data\z\resource\help\vpn.h39" +;"\epoc32\data\z\resource\help\vpn.h42" +;"\epoc32\data\z\resource\help\vpn.h45" +;"\epoc32\data\z\resource\help\vpn.h49" +;"\epoc32\data\z\resource\help\vpn.h01" +;"\epoc32\data\z\resource\help\vpn.h51" +;"\epoc32\data\z\resource\help\vpn.h54" +;"\epoc32\data\z\resource\help\vpn.h57" +;"\epoc32\data\z\resource\help\vpn.h01" +;"\epoc32\data\z\resource\help\vpn.h59" +;"\epoc32\data\z\resource\help\vpn.h67" +;"\epoc32\data\z\resource\help\vpn.h68" +;"\epoc32\data\z\resource\help\vpn.h70" +;"\epoc32\data\z\resource\help\vpn.h76" +;"\epoc32\data\z\resource\help\vpn.h78" +;"\epoc32\data\z\resource\help\vpn.h79" +;"\epoc32\data\z\resource\help\vpn.h83" +;"\epoc32\data\z\resource\help\vpn.h93" +;"\epoc32\data\z\resource\help\vpn.h01" +;"\epoc32\data\z\resource\help\vpn.h01" +;}-"!:\resource\help\vpn.hlp" ; PKI Services Server "\epoc32\release\armv5\udeb\pkiservice.exe"-"!:\sys\bin\pkiservice.exe" @@ -426,13 +468,13 @@ "\epoc32\data\z\resource\vpnecomnotifier.r44" "\epoc32\data\z\resource\vpnecomnotifier.r102" "\epoc32\data\z\resource\vpnecomnotifier.r103" -"\epoc32\data\z\resource\vpnecomnotifier.r65" }-"!:\resource\vpnecomnotifier.rsc" ; XML Parser "\epoc32\release\armv5\udeb\utlxml.dll"-"!:\sys\bin\utlxml.dll" -; Install only languages that device supports +; During installation check languages that HW supports +; and install resources only for them. ; EN - 01 - English IF EXISTS ("z:\resource\avkon.r01") "\epoc32\data\z\resource\vpnecomnotifier.r01"-"!:\resource\vpnecomnotifier.r01" @@ -673,41 +715,49 @@ IF EXISTS ("z:\resource\avkon.r102") "\epoc32\data\z\resource\vpnecomnotifier.r102"-"!:\resource\vpnecomnotifier.r102" "\epoc32\data\z\resource\vpnmanagementuirsc.r102"-"!:\resource\vpnmanagementui.r102" +; Helps do not support language id 102 yet +;IF NOT EXISTS ("z:\resource\xhtml\102\0x10200EC4\index.xml") +;"\epoc32\data\Z\resource\xhtml\102\0x10200EC4\index.xml"-"!:\resource\xhtml\102\0x10200EC4\index.xml" +;"\epoc32\data\Z\resource\xhtml\102\0x10200EC4\keywords.xml"-"!:\resource\xhtml\102\0x10200EC4\keywords.xml" +;"\epoc32\data\Z\resource\xhtml\102\0x10200EC4\meta.xml"-"!:\resource\xhtml\102\0x10200EC4\meta.xml" +;"\epoc32\data\Z\resource\xhtml\102\0x10200EC4\contents.zip"-"!:\resource\xhtml\102\0x10200EC4\contents.zip" +;ENDIF ENDIF ; - 103 - Galicia IF EXISTS ("z:\resource\avkon.r103") "\epoc32\data\z\resource\vpnecomnotifier.r103"-"!:\resource\vpnecomnotifier.r103" "\epoc32\data\z\resource\vpnmanagementuirsc.r103"-"!:\resource\vpnmanagementui.r103" +; Helps do not support language 103 yet +;IF NOT EXISTS ("z:\resource\xhtml\103\0x10200EC4\index.xml") +;"\epoc32\data\Z\resource\xhtml\103\0x10200EC4\index.xml"-"!:\resource\xhtml\103\0x10200EC4\index.xml" +;"\epoc32\data\Z\resource\xhtml\103\0x10200EC4\keywords.xml"-"!:\resource\xhtml\103\0x10200EC4\keywords.xml" +;"\epoc32\data\Z\resource\xhtml\103\0x10200EC4\meta.xml"-"!:\resource\xhtml\103\0x10200EC4\meta.xml" +;"\epoc32\data\Z\resource\xhtml\103\0x10200EC4\contents.zip"-"!:\resource\xhtml\103\0x10200EC4\contents.zip" +;ENDIF ENDIF -; - 65 - Korean -IF EXISTS ("z:\resource\avkon.r65") -"\epoc32\data\z\resource\vpnecomnotifier.r65"-"!:\resource\vpnecomnotifier.r65" -"\epoc32\data\z\resource\vpnmanagementuirsc.r65"-"!:\resource\vpnmanagementui.r65" -ENDIF - "\epoc32\release\armv5\udeb\vpnpolicyrecognizer.dll"-"!:\sys\bin\vpnpolicyrecognizer.dll" "\epoc32\data\z\resource\plugins\vpnpolicyrecognizer.rsc"-"!:\resource\plugins\vpnpolicyrecognizer.rsc" "\epoc32\release\armv5\udeb\vpnpolins.exe"-"!:\sys\bin\vpnpolins.exe" "\epoc32\data\z\private\10003a3f\apps\vpnpolins_reg.rsc"-"!:\Private\10003a3f\import\apps\vpnpolins_reg.rsc" - ; Embedded VPN Policy Installer sis file @"mVPN_vpnpolins_armv5.sis",(0xA0000131) +; ; VPN Cleaner +; "\epoc32\release\armv5\udeb\vpncleaner.exe"-"!:\sys\bin\vpncleaner.exe",FR,RR,RW - +; ; The following modules must not be deleted before VPN Cleaner has been run: - ; VPN Manager "\epoc32\release\armv5\udeb\vpnmanager.exe"-"!:\sys\bin\vpnmanager.exe" - ; Event Mediator "\epoc32\release\armv5\udeb\eventmed.exe"-"!:\sys\bin\eventmed.exe" - +; "\epoc32\winscw\c\private\101FD288\backup_registration.xml"-"!:\Private\101FD288\backup_registration.xml" ; Event Mediator API "\epoc32\release\armv5\udeb\eventmedapi.dll"-"!:\sys\bin\eventmedapi.dll" ; VPN Installer +; "101f877b.txt"-"c:\Private\10202be9\persists\101f877b.txt" "\epoc32\release\armv5\udeb\vpnins.exe"-"!:\sys\bin\vpnins.exe",FR,RI,RW diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnclient_sis/group/nokia_vpn_client_localised_armv5_urel.pkg --- a/vpnclient_sis/group/nokia_vpn_client_localised_armv5_urel.pkg Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnclient_sis/group/nokia_vpn_client_localised_armv5_urel.pkg Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ ; -; Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ; All rights reserved. ; This component and the accompanying materials are made available ; under the terms of "Eclipse Public License v1.0" @@ -17,7 +17,7 @@ ; LANGUAGES ; - None (English only by default) -&EN,FR,GE,SP,IT,SW,DA,NO,FI,AM,PO,TU,IC,RU,HU,DU,CS,SK,PL,SL,TC,HK,ZH,JA,TH,AR,TL,BG,HR,ET,FA,CF,EL,HE,IN,LV,LT,MS,BP,RO,SR,LS,UK,UR,VI,44,102,103,65 +&EN,FR,GE,SP,IT,SW,DA,NO,FI,AM,PO,TU,IC,RU,HU,DU,CS,SK,PL,SL,TC,HK,ZH,JA,TH,AR,TL,BG,HR,ET,FA,CF,EL,HE,IN,LV,LT,MS,BP,RO,SR,LS,UK,UR,VI,44,102,103 ; INSTALLATION HEADER ; UID of acuagentcrypto @@ -68,7 +68,6 @@ "Nokia VPN client", "Nokia VPN", "Nokia VPN", - "Nokia VPN", "Nokia VPN"}, (0x101F5147),32,08,0124, TYPE=SA, RU @@ -121,7 +120,6 @@ "Series60ProductID", "Series60ProductID", "Series60ProductID", -"Series60ProductID", "Series60ProductID"} ; Product / platform version compatibility - S60 5.2 @@ -173,7 +171,6 @@ "Series60ProductID", "Series60ProductID", "Series60ProductID", -"Series60ProductID", "Series60ProductID"} ; List of localised vendor names - one per language. @@ -224,7 +221,6 @@ "Nokia", "Nokia", "Nokia", -"Nokia", "Nokia"} ; The non-localised, globally unique vendor name (mandatory) @@ -271,11 +267,6 @@ "\epoc32\release\armv5\urel\dmadpki.dll"-"!:\sys\bin\dmadpki.dll" "\epoc32\data\z\resource\plugins\dmadpki.rsc"-"!:\resource\plugins\dmadpki.rsc" -; Agile Provision -"\epoc32\release\armv5\urel\agileprovisionws.dll"-"!:\sys\bin\agileprovisionws.dll" - -; VPN EXT API -"\epoc32\release\armv5\urel\vpnextapi.dll"-"!:\sys\bin\vpnextapi.dll" ; VPN API (comes with platform) ;"\epoc32\release\armv5\urel\vpnapi.dll"-"!:\sys\bin\vpnapi.dll" @@ -335,35 +326,84 @@ "\epoc32\data\z\resource\vpnmanagementuirsc.r44" "\epoc32\data\z\resource\vpnmanagementuirsc.r102" "\epoc32\data\z\resource\vpnmanagementuirsc.r103" -"\epoc32\data\z\resource\vpnmanagementuirsc.r65" }-"!:\resource\vpnmanagementuirsc.rsc" ; icon and GS plugin registration file "\epoc32\data\z\resource\apps\vpnmanagementui.mif"-"!:\resource\apps\vpnmanagementui.mif" "\epoc32\data\Z\resource\plugins\vpnmanagementui.rsc"-"!:\resource\plugins\vpnmanagementui.rsc" +; VPN help resources (not localized yet) +; Help resources should be already in ROM but content can be updated from SIS package +;"\epoc32\data\Z\resource\xhtml\01\0x10200EC4\contents.zip"-"!:\resource\xhtml\01\0x10200EC4\contents.zip" +;"\epoc32\data\Z\resource\xhtml\01\0x10200EC4\index.xml"-"!:\resource\xhtml\01\0x10200EC4\index.xml" +;"\epoc32\data\Z\resource\xhtml\01\0x10200EC4\keywords.xml"-"!:\resource\xhtml\01\0x10200EC4\keywords.xml" +;"\epoc32\data\Z\resource\xhtml\01\0x10200EC4\meta.xml"-"!:\resource\xhtml\01\0x10200EC4\meta.xml" +;{ +;"\epoc32\data\z\resource\help\vpn.h01" +;"\epoc32\data\z\resource\help\vpn.h02" +;"\epoc32\data\z\resource\help\vpn.h03" +;"\epoc32\data\z\resource\help\vpn.h04" +;"\epoc32\data\z\resource\help\vpn.h05" +;"\epoc32\data\z\resource\help\vpn.h06" +;"\epoc32\data\z\resource\help\vpn.h07" +;"\epoc32\data\z\resource\help\vpn.h08" +;"\epoc32\data\z\resource\help\vpn.h09" +;"\epoc32\data\z\resource\help\vpn.h10" +;"\epoc32\data\z\resource\help\vpn.h13" +;"\epoc32\data\z\resource\help\vpn.h14" +;"\epoc32\data\z\resource\help\vpn.h15" +;"\epoc32\data\z\resource\help\vpn.h16" +;"\epoc32\data\z\resource\help\vpn.h17" +;"\epoc32\data\z\resource\help\vpn.h18" +;"\epoc32\data\z\resource\help\vpn.h25" +;"\epoc32\data\z\resource\help\vpn.h26" +;"\epoc32\data\z\resource\help\vpn.h27" +;"\epoc32\data\z\resource\help\vpn.h28" +;"\epoc32\data\z\resource\help\vpn.h29" +;"\epoc32\data\z\resource\help\vpn.h30" +;"\epoc32\data\z\resource\help\vpn.h31" +;"\epoc32\data\z\resource\help\vpn.h32" +;"\epoc32\data\z\resource\help\vpn.h33" +;"\epoc32\data\z\resource\help\vpn.h37" +;"\epoc32\data\z\resource\help\vpn.h39" +;"\epoc32\data\z\resource\help\vpn.h42" +;"\epoc32\data\z\resource\help\vpn.h45" +;"\epoc32\data\z\resource\help\vpn.h49" +;"\epoc32\data\z\resource\help\vpn.h01" +;"\epoc32\data\z\resource\help\vpn.h51" +;"\epoc32\data\z\resource\help\vpn.h54" +;"\epoc32\data\z\resource\help\vpn.h57" +;"\epoc32\data\z\resource\help\vpn.h01" +;"\epoc32\data\z\resource\help\vpn.h59" +;"\epoc32\data\z\resource\help\vpn.h67" +;"\epoc32\data\z\resource\help\vpn.h68" +;"\epoc32\data\z\resource\help\vpn.h70" +;"\epoc32\data\z\resource\help\vpn.h76" +;"\epoc32\data\z\resource\help\vpn.h78" +;"\epoc32\data\z\resource\help\vpn.h79" +;"\epoc32\data\z\resource\help\vpn.h83" +;"\epoc32\data\z\resource\help\vpn.h93" +;"\epoc32\data\z\resource\help\vpn.h01" +;"\epoc32\data\z\resource\help\vpn.h01" +;}-"!:\resource\help\vpn.hlp" ; PKI Services Server "\epoc32\release\armv5\urel\pkiservice.exe"-"!:\sys\bin\pkiservice.exe" - ; PKI Services API "\epoc32\release\armv5\urel\pkiserviceapi.dll"-"!:\sys\bin\pkiserviceapi.dll" + ; PKCS#10 Module "\epoc32\release\armv5\urel\utlpkcs10.dll"-"!:\sys\bin\utlpkcs10.dll" - ; PKCS#12 Module "\epoc32\release\armv5\urel\utlpkcs12.dll"-"!:\sys\bin\utlpkcs12.dll" - ; Base64 Module "\epoc32\release\armv5\urel\utlbase64.dll"-"!:\sys\bin\utlbase64.dll" - ; Socket Interaction Thread "\epoc32\release\armv5\urel\eventmedsit.dll"-"!:\sys\bin\eventmedsit.dll" - ; Event Viewer "\epoc32\release\armv5\urel\eventviewer.dll"-"!:\sys\bin\eventviewer.dll" - +; "\epoc32\data\z\resource\vpnlogmessages.rsc"-"!:\resource\vpnlogmessages.rsc" ; Terminal control stubs (for downwards compatibility) @@ -426,13 +466,12 @@ "\epoc32\data\z\resource\vpnecomnotifier.r44" "\epoc32\data\z\resource\vpnecomnotifier.r102" "\epoc32\data\z\resource\vpnecomnotifier.r103" -"\epoc32\data\z\resource\vpnecomnotifier.r65" }-"!:\resource\vpnecomnotifier.rsc" ; XML Parser "\epoc32\release\armv5\urel\utlxml.dll"-"!:\sys\bin\utlxml.dll" -; Install only languages that device supports +; Install only languages that HW supports ; EN - 01 - English IF EXISTS ("z:\resource\avkon.r01") "\epoc32\data\z\resource\vpnecomnotifier.r01"-"!:\resource\vpnecomnotifier.r01" @@ -673,41 +712,51 @@ IF EXISTS ("z:\resource\avkon.r102") "\epoc32\data\z\resource\vpnecomnotifier.r102"-"!:\resource\vpnecomnotifier.r102" "\epoc32\data\z\resource\vpnmanagementuirsc.r102"-"!:\resource\vpnmanagementui.r102" +; Helps do not support language id 102 yet +;IF NOT EXISTS ("z:\resource\xhtml\102\0x10200EC4\index.xml") +;"\epoc32\data\Z\resource\xhtml\102\0x10200EC4\index.xml"-"!:\resource\xhtml\102\0x10200EC4\index.xml" +;"\epoc32\data\Z\resource\xhtml\102\0x10200EC4\keywords.xml"-"!:\resource\xhtml\102\0x10200EC4\keywords.xml" +;"\epoc32\data\Z\resource\xhtml\102\0x10200EC4\meta.xml"-"!:\resource\xhtml\102\0x10200EC4\meta.xml" +;"\epoc32\data\Z\resource\xhtml\102\0x10200EC4\contents.zip"-"!:\resource\xhtml\102\0x10200EC4\contents.zip" +;ENDIF ENDIF ; - 103 - Galicia IF EXISTS ("z:\resource\avkon.r103") "\epoc32\data\z\resource\vpnecomnotifier.r103"-"!:\resource\vpnecomnotifier.r103" "\epoc32\data\z\resource\vpnmanagementuirsc.r103"-"!:\resource\vpnmanagementui.r103" +; Helps do not support language 103 yet +;IF NOT EXISTS ("z:\resource\xhtml\103\0x10200EC4\index.xml") +;"\epoc32\data\Z\resource\xhtml\103\0x10200EC4\index.xml"-"!:\resource\xhtml\103\0x10200EC4\index.xml" +;"\epoc32\data\Z\resource\xhtml\103\0x10200EC4\keywords.xml"-"!:\resource\xhtml\103\0x10200EC4\keywords.xml" +;"\epoc32\data\Z\resource\xhtml\103\0x10200EC4\meta.xml"-"!:\resource\xhtml\103\0x10200EC4\meta.xml" +;"\epoc32\data\Z\resource\xhtml\103\0x10200EC4\contents.zip"-"!:\resource\xhtml\103\0x10200EC4\contents.zip" +;ENDIF ENDIF -; - 65 - Korean -IF EXISTS ("z:\resource\avkon.r65") -"\epoc32\data\z\resource\vpnecomnotifier.r65"-"!:\resource\vpnecomnotifier.r65" -"\epoc32\data\z\resource\vpnmanagementuirsc.r65"-"!:\resource\vpnmanagementui.r65" -ENDIF - "\epoc32\release\armv5\urel\vpnpolicyrecognizer.dll"-"!:\sys\bin\vpnpolicyrecognizer.dll" "\epoc32\data\z\resource\plugins\vpnpolicyrecognizer.rsc"-"!:\resource\plugins\vpnpolicyrecognizer.rsc" + "\epoc32\release\armv5\urel\vpnpolins.exe"-"!:\sys\bin\vpnpolins.exe" "\epoc32\data\z\private\10003a3f\apps\vpnpolins_reg.rsc"-"!:\Private\10003a3f\import\apps\vpnpolins_reg.rsc" - ; Embedded VPN Policy Installer sis file @"mVPN_vpnpolins_armv5.sis",(0xA0000131) +; ; VPN Cleaner +; "\epoc32\release\armv5\urel\vpncleaner.exe"-"!:\sys\bin\vpncleaner.exe",FR,RR,RW - +; ; The following modules must not be deleted before VPN Cleaner has been run: - ; VPN Manager "\epoc32\release\armv5\urel\vpnmanager.exe"-"!:\sys\bin\vpnmanager.exe" ; Event Mediator "\epoc32\release\armv5\urel\eventmed.exe"-"!:\sys\bin\eventmed.exe" - +; "\epoc32\winscw\c\private\101FD288\backup_registration.xml"-"!:\Private\101FD288\backup_registration.xml" ; Event Mediator API "\epoc32\release\armv5\urel\eventmedapi.dll"-"!:\sys\bin\eventmedapi.dll" ; VPN Installer +; "101f877b.txt"-"c:\Private\10202be9\persists\101f877b.txt" "\epoc32\release\armv5\urel\vpnins.exe"-"!:\sys\bin\vpnins.exe",FR,RI,RW diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg --- a/vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg Wed Oct 13 15:42:16 2010 +0300 @@ -16,7 +16,7 @@ ; LANGUAGES ; - None (English only by default) -&EN,FR,GE,SP,IT,SW,DA,NO,FI,AM,PO,TU,IC,RU,HU,DU,CS,SK,PL,SL,TC,HK,ZH,JA,TH,AR,TL,BG,HR,ET,FA,CF,EL,HE,IN,LV,LT,MS,BP,RO,SR,LS,UK,UR,VI,44,102,103,65 +&EN,FR,GE,SP,IT,SW,DA,NO,FI,AM,PO,TU,IC,RU,HU,DU,CS,SK,PL,SL,TC,HK,ZH,JA,TH,AR,TL,BG,HR,ET,FA,CF,EL,HE,IN,LV,LT,MS,BP,RO,SR,LS,UK,UR,VI,44,102,103 ; INSTALLATION HEADER ; UID of acuagentcrypto @@ -67,7 +67,6 @@ "Nokia VPN client", "Nokia VPN", "Nokia VPN", - "Nokia VPN", "Nokia VPN"}, (0x101F5147),32,08,0124, TYPE=SA, RU @@ -120,7 +119,6 @@ "Series60ProductID", "Series60ProductID", "Series60ProductID", -"Series60ProductID", "Series60ProductID"} ; Product / platform version compatibility - S60 5.2 @@ -172,7 +170,6 @@ "Series60ProductID", "Series60ProductID", "Series60ProductID", -"Series60ProductID", "Series60ProductID"} ; List of localised vendor names - one per language. @@ -223,7 +220,6 @@ "Nokia", "Nokia", "Nokia", -"Nokia", "Nokia"} ; The non-localised, globally unique vendor name (mandatory) diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/.cproject --- a/vpnengine/agileprovisionws/.cproject Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/.project --- a/vpnengine/agileprovisionws/.project Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - - - agileprovisionws - - - - - - com.nokia.carbide.cdt.builder.carbideCPPBuilder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - com.nokia.carbide.cdt.builder.carbideCPPBuilderNature - com.nokia.carbide.cdt.builder.carbideSBSv2BuilderNature - - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/BWINS/agileprovisionwsu.def --- a/vpnengine/agileprovisionws/BWINS/agileprovisionwsu.def Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -EXPORTS - ?GenerateCertReqL@CAgileProvisionWs@@QAEXXZ @ 1 NONAME ; void CAgileProvisionWs::GenerateCertReqL(void) - ?SetServiceAddr@CAgileProvisionWs@@QAEXPBVHBufC8@@@Z @ 2 NONAME ; void CAgileProvisionWs::SetServiceAddr(class HBufC8 const *) - ??1CAgileCryptoPrivKey@@UAE@XZ @ 3 NONAME ; CAgileCryptoPrivKey::~CAgileCryptoPrivKey(void) - ??1CAgileCryptoCert@@UAE@XZ @ 4 NONAME ; CAgileCryptoCert::~CAgileCryptoCert(void) - ?NewL@CAgileProvisionWs@@SAPAV1@XZ @ 5 NONAME ; class CAgileProvisionWs * CAgileProvisionWs::NewL(void) - ?NewL@CAgileCryptoCert@@SAPAV1@ABVTDesC8@@H@Z @ 6 NONAME ; class CAgileCryptoCert * CAgileCryptoCert::NewL(class TDesC8 const &, int) - ?CancelGetPolicy@CAgileProvisionWs@@QAEXXZ @ 7 NONAME ; void CAgileProvisionWs::CancelGetPolicy(void) - ?GenerateKeypairCancel@CAgileCryptoGenerateKeypair@@QAEXXZ @ 8 NONAME ; void CAgileCryptoGenerateKeypair::GenerateKeypairCancel(void) - ?SaveClientCertL@CAgileCryptoCert@@QAEXABV?$TBuf8@$0BE@@@I@Z @ 9 NONAME ; void CAgileCryptoCert::SaveClientCertL(class TBuf8<20> const &, unsigned int) - ?ReadCertReqL@CAgileCryptoPrivKey@@QAEPAVHBufC8@@ABVTDesC16@@H@Z @ 10 NONAME ; class HBufC8 * CAgileCryptoPrivKey::ReadCertReqL(class TDesC16 const &, int) - ?NewL@CAgileCryptoPrivKey@@SAPAV1@XZ @ 11 NONAME ; class CAgileCryptoPrivKey * CAgileCryptoPrivKey::NewL(void) - ?GenerateCertReqL@CAgileCryptoPrivKey@@QAEXABVTDesC8@@000ABV?$TBuf8@$0BE@@@AAVTDes16@@AAH@Z @ 12 NONAME ; void CAgileCryptoPrivKey::GenerateCertReqL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TBuf8<20> const &, class TDes16 &, int &) - ?SaveCACertL@CAgileCryptoCert@@QAEXXZ @ 13 NONAME ; void CAgileCryptoCert::SaveCACertL(void) - ?HandleGetConfSoapInL@CAgileProvisionWs@@QAEXABVTDesC8@@@Z @ 14 NONAME ; void CAgileProvisionWs::HandleGetConfSoapInL(class TDesC8 const &) - ?NewLC@CAgileProvisionWs@@SAPAV1@XZ @ 15 NONAME ; class CAgileProvisionWs * CAgileProvisionWs::NewLC(void) - ?GetPolicy@CAgileProvisionWs@@QAEXABVTDesC8@@IAAVTRequestStatus@@@Z @ 16 NONAME ; void CAgileProvisionWs::GetPolicy(class TDesC8 const &, unsigned int, class TRequestStatus &) - ?HandleGetCertificateSoapInL@CAgileProvisionWs@@QAEXABVTDesC8@@@Z @ 17 NONAME ; void CAgileProvisionWs::HandleGetCertificateSoapInL(class TDesC8 const &) - ?GenerateKeypairL@CAgileCryptoGenerateKeypair@@QAEHABHAAV?$TBuf8@$0BE@@@AAVTRequestStatus@@@Z @ 18 NONAME ; int CAgileCryptoGenerateKeypair::GenerateKeypairL(int const &, class TBuf8<20> &, class TRequestStatus &) - ?NewL@CAgileCryptoGenerateKeypair@@SAPAV1@PAVCAgileCryptoPrivKey@@@Z @ 19 NONAME ; class CAgileCryptoGenerateKeypair * CAgileCryptoGenerateKeypair::NewL(class CAgileCryptoPrivKey *) - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/EABI/agileprovisionwsu.def --- a/vpnengine/agileprovisionws/EABI/agileprovisionwsu.def Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -EXPORTS - _ZN16CAgileCryptoCert11SaveCACertLEv @ 1 NONAME - _ZN16CAgileCryptoCert15SaveClientCertLERK5TBuf8ILi20EEj @ 2 NONAME - _ZN16CAgileCryptoCert4NewLERK6TDesC8i @ 3 NONAME - _ZN16CAgileCryptoCertD0Ev @ 4 NONAME - _ZN16CAgileCryptoCertD1Ev @ 5 NONAME - _ZN16CAgileCryptoCertD2Ev @ 6 NONAME - _ZN17CAgileProvisionWs14SetServiceAddrEPK6HBufC8 @ 7 NONAME - _ZN17CAgileProvisionWs15CancelGetPolicyEv @ 8 NONAME - _ZN17CAgileProvisionWs16GenerateCertReqLEv @ 9 NONAME - _ZN17CAgileProvisionWs20HandleGetConfSoapInLERK6TDesC8 @ 10 NONAME - _ZN17CAgileProvisionWs27HandleGetCertificateSoapInLERK6TDesC8 @ 11 NONAME - _ZN17CAgileProvisionWs4NewLEv @ 12 NONAME - _ZN17CAgileProvisionWs5NewLCEv @ 13 NONAME - _ZN17CAgileProvisionWs9GetPolicyERK6TDesC8jR14TRequestStatus @ 14 NONAME - _ZN19CAgileCryptoPrivKey12ReadCertReqLERK7TDesC16i @ 15 NONAME - _ZN19CAgileCryptoPrivKey16GenerateCertReqLERK6TDesC8S2_S2_S2_RK5TBuf8ILi20EER6TDes16Ri @ 16 NONAME - _ZN19CAgileCryptoPrivKey4NewLEv @ 17 NONAME - _ZN19CAgileCryptoPrivKeyD0Ev @ 18 NONAME - _ZN19CAgileCryptoPrivKeyD1Ev @ 19 NONAME - _ZN19CAgileCryptoPrivKeyD2Ev @ 20 NONAME - _ZN27CAgileCryptoGenerateKeypair16GenerateKeypairLERKiR5TBuf8ILi20EER14TRequestStatus @ 21 NONAME - _ZN27CAgileCryptoGenerateKeypair21GenerateKeypairCancelEv @ 22 NONAME - _ZN27CAgileCryptoGenerateKeypair4NewLEP19CAgileCryptoPrivKey @ 23 NONAME - _ZTI16CAgileCryptoCert @ 24 NONAME - _ZTI19CAgileCryptoPrivKey @ 25 NONAME - _ZTV16CAgileCryptoCert @ 26 NONAME - _ZTV19CAgileCryptoPrivKey @ 27 NONAME - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/group/ABLD.BAT --- a/vpnengine/agileprovisionws/group/ABLD.BAT Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -@ECHO OFF - -REM Bldmake-generated batch file - ABLD.BAT -REM ** DO NOT EDIT ** - -perl -S ABLD.PL "\vpnclient\vpnengine\agileprovisionws\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel==1 goto CheckPerl -goto End - -:CheckPerl -perl -v >NUL -if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? -goto End - -:End diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/group/agileprovisionws.mmp --- a/vpnengine/agileprovisionws/group/agileprovisionws.mmp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition file for project agileprovisionws -* -*/ - -TARGET agileprovisionws.dll -TARGETTYPE dll -UID 0x1000008d 0x20016A90 -CAPABILITY NetworkControl NetworkServices ReadDeviceData ReadUserData DiskAdmin ProtServ WriteDeviceData - -USERINCLUDE ../inc -USERINCLUDE ../../utlbase64/inc -USERINCLUDE ../../utlcrypto/inc -USERINCLUDE ../../vpnmanager/inc -USERINCLUDE ../../pkiserviceapi/inc -USERINCLUDE ../../vpncommon/inc -USERINCLUDE ../../../vpnui/vpnpolins/inc - -MW_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src - -SOURCE agileprovisionservice.cpp -SOURCE agileprovisionws.cpp -SOURCE agilecrypto.cpp - -LIBRARY efsrv.lib -LIBRARY euser.lib -LIBRARY SenUtils.lib -LIBRARY SenServDesc.lib -LIBRARY inetprotutil.lib -LIBRARY SenServConn.lib -LIBRARY SenXml.lib -LIBRARY SenServMgr.lib -LIBRARY utlbase64.lib -LIBRARY utlcrypto.lib -LIBRARY pkiserviceapi.lib -LIBRARY x509.lib -LIBRARY cmmanager.lib - - - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/group/bld.inf --- a/vpnengine/agileprovisionws/group/bld.inf Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This file provides the information required for building the module. -* -*/ - -PRJ_PLATFORMS -DEFAULT - - -PRJ_MMPFILES -agileprovisionws.mmp diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/inc/agilecrypto.h --- a/vpnengine/agileprovisionws/inc/agilecrypto.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN Agile provision Crypto library -* -*/ - -#ifndef __AGILE_CRYPTO_H -#define __AGILE_CRYPTO_H - -#include "pkiserviceapi.h" - - -const TInt KAgileCryptoMaxSignatureLth = 512; //publicKey->Size() / 8; - -typedef TPKIKeyIdentifier TPrivKeyRef; -typedef HBufC8* TRetBufCertReq; -typedef HBufC8* TRetBufCertRef; -typedef TInt TErrCode; - -// --- agile crypto error codes -const TInt KAgileErrCryptoCertFileNotFound = -102101; -const TInt KAgileErrCryptoReadCertRequestFailed = -102103; - - -class CAgileCryptoCert : public CBase -/** -* Certificate operations -* @internalComponent -*/ -{ -public: - - - IMPORT_C static CAgileCryptoCert* NewL(const TDesC8& aCert, TBool aBase64Encoded); - IMPORT_C ~CAgileCryptoCert(); //agile_crypto_cert_free - - IMPORT_C void SaveCACertL(void); - IMPORT_C void SaveClientCertL(const TPrivKeyRef& aKeyId, TUint aKeySize); - -private: - CAgileCryptoCert(); - - void ConstructL(const TDesC8& aCert, TBool aBase64Encoded); - - -private: - HBufC8 *iCertDER; - -}; - -class CAgileCryptoGenerateKeypair; -class CAgileCryptoPrivKey : public CBase -/** -* Private key operations -* @internalComponent -*/ -{ -public: - //friend class CAgileCryptoGenerateKeypair; - - IMPORT_C static CAgileCryptoPrivKey* NewL(void); - IMPORT_C ~CAgileCryptoPrivKey(); - - - IMPORT_C void GenerateCertReqL(const TDesC8& aDistinguishedName, - const TDesC8& aSubjectAltNameRfc822, - const TDesC8& aChallengePassword, - const TDesC8& aDnsName, - const TPrivKeyRef& aKeyId, - TDes& aCertReqRef, - TInt& aCertReqSize); //agile_crypto_generate_cert_req_pem - IMPORT_C TRetBufCertReq ReadCertReqL(const TDesC& aCertReqRef, TInt aCertReqSize); - - RPKIServiceAPI GetPkiService(); - -private: - CAgileCryptoPrivKey(); - void ConstructL(void); - - -private: - RPKIServiceAPI iPkiServiceApi; -}; - - -class CAgileCryptoGenerateKeypair : public CBase -/** -* Generate key pair -* @internalComponent -*/ -{ -public: - IMPORT_C static CAgileCryptoGenerateKeypair* NewL(CAgileCryptoPrivKey* aAgileCryptoPrivKey); - IMPORT_C TErrCode GenerateKeypairL(const TInt& aPublicKeyLen, - TPrivKeyRef& aKeyId, - TRequestStatus& aStatus); - IMPORT_C void GenerateKeypairCancel(void); - - -private: - CAgileCryptoGenerateKeypair(CAgileCryptoPrivKey* aAgileCryptoPrivKey); - void ConstructL(void); - -private: - CAgileCryptoPrivKey* iAgileCryptoPrivKey; - -}; - -#endif diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/inc/agileprovisiondefs.h --- a/vpnengine/agileprovisionws/inc/agileprovisiondefs.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2000 - 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Provides file handling functions. -* -*/ -#ifndef __VPNAGILEPROVISIONDEFS_H__ -#define __VPNAGILEPROVISIONDEFS_H__ - -#include - - -_LIT(KAgileProvisionPolicyFileName, "agileVPN.pol"); -_LIT(KAgileProvisionPinFileName, "agileVPN.pin"); -_LIT(KAgileProvisionCertificateFileName, "agileVPN-User.cer"); -_LIT(KAgileProvisionServiceNameSpace, "agileVPNProvisionService"); -_LIT8(KCRLF, "\r\n"); -_LIT8(KHTTPprefix, "https://"); -_LIT8(KServiceSuffix, "/AWS/AgileVPNProvisionService.asmx"); -_LIT8(KPolicyRequestPrefix, ""); - -_LIT8(KSoapActionCert, "http://vpn.agileprovision/GetCertificate"); - -_LIT8(KRequest1, ""); -_LIT8(KRequest2, ""); - - -#endif // __VPNAGILEPROVISIONDEFS_H__ - - - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/inc/agileprovisionservice.h --- a/vpnengine/agileprovisionws/inc/agileprovisionservice.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN Agile provision service -* -*/ - -#ifndef AGILEPROVISIONWS_H -#define AGILEPROVISIONWS_H - -#include -#include -#include -#include -#include - - -NONSHARABLE_CLASS(MAgileProvisionServiceConsumer) : public MSenServiceConsumer -{ - -public: - - // ----- To be implemented by consumer (from MSenServiceConsumer): ----- - virtual void HandleErrorL(const TInt aErrorCode, const TDesC8& aMessage) = 0; - virtual void SetStatus(const TInt aStatus) = 0; - - /* Implementation of this callback is optional. - * If you are not interested in SOAP Fault details, - * the default implementation will fall back to HandleErrorL - * with the error code KErrSenSoapFault. - */ - virtual void HandleSoapFaultL(const CSenSoapFault& /*aFault*/) - { HandleErrorL(KErrSenSoapFault, _L8("Soap fault received") ); } - - -}; - - -NONSHARABLE_CLASS(CAgileProvisionServiceService) : public CBase -{ - CSenServiceConnection *iConnection; - TBool iOwnsConnection; - - CAgileProvisionServiceService(CSenServiceConnection* aConnection, TBool aOwnsConnection); - -public: - - ~CAgileProvisionServiceService(); - - - static CAgileProvisionServiceService* NewL(MSenServiceConsumer& aObserver, MSenServiceDescription& aDescription); - - - - -public: // remote methods - - - - /************************************************************************** - * Asynchronous operations that handle result in callback methods. * - * Methods can leave. * - **************************************************************************/ - - void GetConfAsyncL(); - void GetCertificateAsyncL(HBufC8* aCertReq); - - void CancelTransaction(); - void ResetTransactionId(); - - HBufC8* iCertreq; - TUint iIapId; -private: // data - /** - * Transaction id. - * Own. - */ - TInt iTransactionId; - - -}; - -#endif diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/inc/agileprovisionws.h --- a/vpnengine/agileprovisionws/inc/agileprovisionws.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN Agile provision Web Service Client -* -*/ - - -#ifndef C_AGILEPROVISIONWS_H -#define C_AGILEPROVISIONWS_H - - -#include -#include -#include "agileprovisionservice.h" -#include "agilecrypto.h" -#include "base64.h" - -const TInt KPublicKeyLen = 1024; - -NONSHARABLE_CLASS(CAgileProvisionWs) : public CBase, public MAgileProvisionServiceConsumer -{ -public: - IMPORT_C static CAgileProvisionWs* NewL(); - IMPORT_C static CAgileProvisionWs* NewLC(); - ~CAgileProvisionWs(); - -public: - /** - * Gets policy. - * @param aEndpointUri Service endpoint - * @param aStatus Completion status (returned) - */ - IMPORT_C void GetPolicy( const TDesC8& aEndPointUri, TUint aIapId, - TRequestStatus& aStatus ); - - /** - * Cancels Get policy request. - */ - IMPORT_C void CancelGetPolicy(); - - - //gets ownership of aServiceAddr - IMPORT_C void SetServiceAddr(const HBufC8* aServiceAddr); - -// from base class MAgileProvisionServiceConsumer -public: - void HandleMessageL(const TDesC8& aMessage); - void HandleErrorL(const TInt aErrorCode, const TDesC8& aError); - void SetStatus(const TInt aStatus); - - - /* - * Callback methods, for each asynchronous remote operation - */ - - IMPORT_C void HandleGetConfSoapInL(const TDesC8& aMessage); - - IMPORT_C void HandleGetCertificateSoapInL(const TDesC8& aMessage); - - IMPORT_C void GenerateCertReqL( ); - - -private: - enum - { - KStateInitial, - KStateGettingConf, - KStateGettingCertificate - }; - - CAgileProvisionWs(); - - void ConstructL(); - - void DoGetPolicyL( const TDesC8& aEndPointUri, const TUint aIapId ); - void ParseFileFromSoapEnvelopeL( RPointerArray& aArray, - TInt aContentType, TInt aLevel, - TDesC& aFileName ); - - - void DoComplete( const TInt aStatus ); - -private: // data - - /** - * State. - * Own. - */ - TInt iState; - - - CAgileProvisionServiceService* iPService; - - /** - * Client's request's status. - * Not own. - */ - TRequestStatus* iClientStatus; - - TPrivKeyRef iKeyRef; - - const HBufC8* iServiceAddr; - - const TDesC8* iEndPointUri; - - }; - -#endif // C_AGILEPROVISIONWS_H diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/rom/agileprovisionws.iby --- a/vpnengine/agileprovisionws/rom/agileprovisionws.iby Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for project agileprovisionws -* -*/ - - - -#ifndef __AGILEPROVISIONWS_IBY__ -#define __AGILEPROVISIONWS_IBY__ - -#ifdef FF_VPN_CLIENT - -file=ABI_DIR\BUILD_DIR\agileprovisionws.dll SHARED_LIB_DIR\agileprovisionws.dll - -#endif // FF_VPN_CLIENT - -#endif // __AGILEPROVISIONWS_IBY__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/src/agilecrypto.cpp --- a/vpnengine/agileprovisionws/src/agilecrypto.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,317 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN Agile provision Crypto library -* -*/ - -#include - -#include -#include -#include - -#include "agilecrypto.h" -#include "utlcrypto.h" -#include "base64.h" -#include "pkcs10.h" -#include "vpnclientuids.h" - - - - -EXPORT_C CAgileCryptoCert::~CAgileCryptoCert() -/** -* Destructor. -*/ - { - - delete iCertDER; - - } - -CAgileCryptoCert::CAgileCryptoCert() - { - } - - - -EXPORT_C CAgileCryptoCert* CAgileCryptoCert::NewL(const TDesC8& aCert, TBool aBase64Encoded) -/** -* Makes crypto certififate object. -* @param aCert Certificate data. -* @param aCert aBase64Encoded If ETrue, certificate data is base64 encoded. -* @return CAgileCryptoCert* Pointer to crypto certififate object. -*/ - { - CAgileCryptoCert* self = new (ELeave) CAgileCryptoCert(); - CleanupStack::PushL(self); - self->ConstructL(aCert, aBase64Encoded); - CleanupStack::Pop(); // self - return self; - } - - -void CAgileCryptoCert::ConstructL(const TDesC8& aCert, TBool aBase64Encoded) - { - - HBufC8* certDerCodedHBuf; - TPtrC8 certDerCoded; - - if (aBase64Encoded) - { - TBase64Codec base64Codec; - if ((certDerCodedHBuf = base64Codec.Base64DecodeLC(aCert)) == NULL) - { - User::Leave(KErrNoMemory); - } - } - else - { - certDerCodedHBuf = aCert.AllocLC(); - } - certDerCoded.Set(certDerCodedHBuf->Des()); - - iCertDER = certDerCodedHBuf; - - CleanupStack::Pop(1); //certDerCodedHBuf - } - -EXPORT_C void CAgileCryptoCert::SaveCACertL(void) -/** -* Saves server certififate to certificate store. -* @return TRetBufCertRef The identifier of the certificate. -*/ - { - RPKIServiceAPI pkiServiceApi; - CleanupClosePushL(pkiServiceApi); - User::LeaveIfError(pkiServiceApi.Connect()); - - TPtr8 certDERDesc(iCertDER->Des()); - TRequestStatus requestStatus; - TAny* resArray; - TUint keySize = 0; - pkiServiceApi.StoreCertificateL(EPKICACertificate, - keySize, - EPKIRSA, - certDERDesc, - &resArray, - requestStatus); - User::WaitForRequest(requestStatus); - pkiServiceApi.Finalize(resArray); - TInt status = requestStatus.Int(); - if (status != KErrNone) - { - User::Leave(status); - } - - - // Set VPN trusted - CX509Certificate* tempCert = CX509Certificate::NewLC(certDERDesc); - RArray appArray; - CleanupClosePushL(appArray); - appArray.AppendL(TUid::Uid(KUidVpnManager)); - - const TPtrC8* serialNumber = tempCert->DataElementEncoding( - CX509Certificate::ESerialNumber); - const TPtrC8* issuername = tempCert->DataElementEncoding( - CX509Certificate::EIssuerName); - - pkiServiceApi.SetApplicabilityL( - *issuername, - *serialNumber, - appArray); - - CleanupStack::PopAndDestroy(3); // appArray, tempCert, pkiServiceApi - - } - -EXPORT_C void CAgileCryptoCert::SaveClientCertL(const TPrivKeyRef& aKeyId, TUint aKeySize) -/** -* Saves client certififate to certificate store. -* @param aKeyId Private key identifier. -* @param aKeySize Private key size. -* @return TRetBufCertRef The identifier of the certificate -*/ - { - RPKIServiceAPI pkiServiceApi; - CleanupClosePushL(pkiServiceApi); - User::LeaveIfError(pkiServiceApi.Connect()); - - TPtr8 certDERDesc(iCertDER->Des()); - TRequestStatus requestStatus; - TAny* resArray; - pkiServiceApi.AttachCertificateL(aKeyId, - aKeySize, - EPKIRSA, - certDERDesc, - &resArray, - requestStatus); - User::WaitForRequest(requestStatus); - pkiServiceApi.Finalize(resArray); - TInt status = requestStatus.Int(); - if (status != KErrNone) - User::LeaveIfError(status); - - CleanupStack::PopAndDestroy(); //pkiServiceApi - - - } - -EXPORT_C CAgileCryptoPrivKey* CAgileCryptoPrivKey::NewL(void) -/** -* Makes crypto private key object. -* @return CAgileCryptoPrivKey* Pointer to crypto private key object. -*/ - { - CAgileCryptoPrivKey* self = new (ELeave) CAgileCryptoPrivKey(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -void CAgileCryptoPrivKey::ConstructL(void) - { - User::LeaveIfError(iPkiServiceApi.Connect()); - } - - -CAgileCryptoPrivKey::CAgileCryptoPrivKey() - { - ; - } - -EXPORT_C CAgileCryptoPrivKey::~CAgileCryptoPrivKey() -/** -* Destructor. -*/ - { - iPkiServiceApi.Close(); - } - - -EXPORT_C void CAgileCryptoPrivKey::GenerateCertReqL(const TDesC8& aDistinguishedName, - const TDesC8& aSubjectAltNameRfc822, - const TDesC8& aChallengePassword, - const TDesC8& aDnsName, - const TPrivKeyRef& aKeyId, - TDes& aCertReqRef, - TInt& aCertReqSize) -/** -* Creates certificate request. -* @param aDistinguishedName Subject name of the certificate owner. -* @param aSubjectAltNameRfc822 SubjectAlt name of the certificate owner. -* @param aChallengePassword ChallengePw of the certificate owner. -* @param aDnsName DNS name of the certificate owner. -* @param aKeyId KeyId of the key for which the certificate will be generated. -* @param aCertReqRef The identifier of created certificate request (output parameter). -* @param aCertReqSize The size of created certificate request (output parameter). -* @return TErrCode KErrNone, if OK. -*/ - { - - iPkiServiceApi.CreateAndSaveCertificateRequestL(aKeyId, - aDistinguishedName, - aSubjectAltNameRfc822, - aChallengePassword, - aDnsName, - aCertReqRef, - aCertReqSize); - - } - -EXPORT_C TRetBufCertReq CAgileCryptoPrivKey::ReadCertReqL(const TDesC& aCertReqRef, TInt aCertReqSize) -/** -* Reads certififate certificate. -* @param aCertReqRef Certificate request identifier. -* @param aCertReqSize The size of the certificate request. -* @return TRetBufCertReq Certificate request. -*/ - { - HBufC8* certRequest = HBufC8::NewLC(aCertReqSize); - TPtr8 certRequestDesc(certRequest->Des()); - - - TInt status = iPkiServiceApi.ReadCertificateRequest(aCertReqRef, - certRequestDesc); - if (status != KErrNone) - { - User::Leave(KAgileErrCryptoReadCertRequestFailed); - } - CleanupStack::Pop(); //certRequest - - return certRequest; - } - -RPKIServiceAPI CAgileCryptoPrivKey::GetPkiService() - { - return iPkiServiceApi; - } - - -EXPORT_C CAgileCryptoGenerateKeypair* CAgileCryptoGenerateKeypair::NewL(CAgileCryptoPrivKey* aAgileCryptoPrivKey) -/** -* Makes crypto generate key pair object. -* @param aAgileCryptoPrivKey Crypto private key object (contains session to PKI service). -* @return CAgileCryptoGenerateKeypair crypto generate key pair object. -*/ - { - CAgileCryptoGenerateKeypair* self = new (ELeave) CAgileCryptoGenerateKeypair(aAgileCryptoPrivKey); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -void CAgileCryptoGenerateKeypair::ConstructL(void) - { - ; - } - - -CAgileCryptoGenerateKeypair::CAgileCryptoGenerateKeypair(CAgileCryptoPrivKey* aAgileCryptoPrivKey) - : iAgileCryptoPrivKey(aAgileCryptoPrivKey) - { - ; - } - -EXPORT_C TErrCode CAgileCryptoGenerateKeypair::GenerateKeypairL(const TInt& aPublicKeyLen, - TPrivKeyRef& aKeyId, - TRequestStatus& aStatus) -/** -* Generates key pair. -* @param aPublicKeyLen The length of public key. -* @param aKeyId Key pair (private key) identifier (output parameter). -* @param aStatus Asynchronous request status. -* @return TErrCode KErrNone, if OK. -*/ - { - // aStatus = KRequestPending; - - iAgileCryptoPrivKey->GetPkiService().GenerateKeypair(aKeyId, - (TUint)aPublicKeyLen, - EPKIRSA, - //&iResArray, - aStatus); - return 0; - } - -EXPORT_C void CAgileCryptoGenerateKeypair::GenerateKeypairCancel(void) -/** -* Cancels operation. -*/ - { - iAgileCryptoPrivKey->GetPkiService().CancelPendingOperation(); - } - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/src/agileprovisionservice.cpp --- a/vpnengine/agileprovisionws/src/agileprovisionservice.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN Agile provision service -* -*/ - -#include -#include -#include -#include -#include -#include -#include "agileprovisionservice.h" -#include "agileprovisiondefs.h" - - -CAgileProvisionServiceService* CAgileProvisionServiceService::NewL(MSenServiceConsumer& aObserver, MSenServiceDescription& aServiceDescription) -{ - CSenServiceConnection* pConn = CSenServiceConnection::NewLC(aObserver, aServiceDescription); - - CAgileProvisionServiceService* pNew = new (ELeave) CAgileProvisionServiceService(pConn, ETrue); // owns connection - - CleanupStack::Pop(pConn); - return pNew; -} - - -CAgileProvisionServiceService::CAgileProvisionServiceService(CSenServiceConnection* aConnection, TBool aOwnsConnection) : - iConnection(aConnection), iOwnsConnection(aOwnsConnection) -{ -} - -CAgileProvisionServiceService::~CAgileProvisionServiceService() -{ - delete iCertreq; - iCertreq=NULL; - if (iOwnsConnection) - { - delete iConnection; - } - -} - - -void CAgileProvisionServiceService::GetConfAsyncL() -{ - TPtrC8 reqStr; - - CSenSoapMessage *soapRequest = CSenSoapMessage::NewL(); - CleanupStack::PushL(soapRequest); - - TPtrC8 soapActionPtr(KSoapAction); - soapRequest->SetSoapActionL( soapActionPtr ); - - - TPtrC8 reqBodyStr(KRequest); - soapRequest->SetBodyL(reqBodyStr); - - CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); - - using namespace CMManager; - - RCmManagerExt cmManagerExt; - cmManagerExt.OpenL(); - CleanupClosePushL( cmManagerExt ); - - RArray destinationArray; - cmManagerExt.AllDestinationsL( destinationArray ); - CleanupClosePushL(destinationArray); - TBool destinationExist=EFalse; - for (TInt i = 0; i < destinationArray.Count(); ++i) - { - RCmDestinationExt destination = cmManagerExt.DestinationL( destinationArray[i] ); - CleanupClosePushL(destination); - - if ( destination.Id() == iIapId ) - { - destinationExist=ETrue; - CleanupStack::PopAndDestroy(); //destination - break; - } - CleanupStack::PopAndDestroy(); //destination - } - destinationArray.Reset(); - destinationArray.Close(); - CleanupStack::PopAndDestroy(2); //destinationArray, cmManagerExt - - if ( destinationExist == 1 ) //ETrue - { - pHttpProperties->SetSnapIdL(iIapId); - } - else - { - pHttpProperties->SetIapIdL(iIapId); - } - - HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); - CleanupStack::PushL(pSerializedProperties); - iConnection->SetTransportPropertiesL(*pSerializedProperties); - - TInt ret = iConnection->SendL(*soapRequest); - User::LeaveIfError( ret ); - - iTransactionId = ret ; - CleanupStack::PopAndDestroy(pSerializedProperties); - CleanupStack::PopAndDestroy(pHttpProperties); - CleanupStack::PopAndDestroy(soapRequest); -} - - -void CAgileProvisionServiceService::GetCertificateAsyncL( HBufC8* aCertReq ) -{ - TPtrC8 reqStr; - - CSenSoapMessage *soapRequest = CSenSoapMessage::NewL(); - CleanupStack::PushL(soapRequest); - soapRequest->SetSoapActionL( KSoapActionCert ); - - TBase64Codec base64Codec; - HBufC8* certreqBase64 = base64Codec.Base64EncodeLC(*aCertReq); - HBufC8* certReqBodyHeap=HBufC8::NewLC(KRequest1().Length() + KRequest2().Length() + certreqBase64->Length()); - TPtr8 certReqBodyAppend(certReqBodyHeap->Des()); - certReqBodyAppend=KRequest1; - certReqBodyAppend.Append(certreqBase64->Des()); - certReqBodyAppend.Append(KRequest2); - - TPtrC8 reqBodyStr(certReqBodyAppend); - soapRequest->SetBodyL(reqBodyStr); - - TInt ret = iConnection->SendL(*soapRequest); - User::LeaveIfError( ret ); - iTransactionId = ret; - CleanupStack::PopAndDestroy(); //certReqBodyHeap - CleanupStack::PopAndDestroy(); //certreqBase64 - CleanupStack::PopAndDestroy(); // soapRequest -} - - -void CAgileProvisionServiceService::CancelTransaction() -{ - if ( iTransactionId > 0 ) - { - iConnection->CancelTransaction( iTransactionId ); - iTransactionId = 0; - } -} - -void CAgileProvisionServiceService::ResetTransactionId() -{ - iTransactionId = 0; -} diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/agileprovisionws/src/agileprovisionws.cpp --- a/vpnengine/agileprovisionws/src/agileprovisionws.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,378 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN Agile provision Web Service Client -* -*/ - -#include -#include -#include -#include -#include "agileprovisionws.h" -#include "agileprovisiondefs.h" -#include "policyinstaller_constants.h" -#include "base64.h" - - -EXPORT_C CAgileProvisionWs* CAgileProvisionWs::NewL() - { - CAgileProvisionWs* self = NewLC(); - CleanupStack::Pop(); // self - return self; - } - - -EXPORT_C CAgileProvisionWs* CAgileProvisionWs::NewLC() - { - CAgileProvisionWs* self = new (ELeave) CAgileProvisionWs(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -CAgileProvisionWs::CAgileProvisionWs() - { - } - - -void CAgileProvisionWs::ConstructL() - { - } - - -CAgileProvisionWs::~CAgileProvisionWs() - { - delete iPService; - delete iServiceAddr; - } - -EXPORT_C void CAgileProvisionWs::GetPolicy(const TDesC8& aEndPointUri, const TUint aIapId, - TRequestStatus& aStatus) - { - __ASSERT_DEBUG( iClientStatus == NULL, - User::Invariant() ); - - // Store client's request status. - - iClientStatus = &aStatus; - *iClientStatus = KRequestPending; - - TRAPD( err, DoGetPolicyL( aEndPointUri, aIapId) ); - if ( err != KErrNone ) - { - DoComplete( err ); - } - } - -EXPORT_C void CAgileProvisionWs::CancelGetPolicy() - { - if ( iPService != NULL ) - { - iPService->CancelTransaction(); - delete iPService; - iPService = NULL; - } - DoComplete( KErrCancel ); - } - -EXPORT_C void CAgileProvisionWs::SetServiceAddr(const HBufC8* aServiceAddr) - { - iServiceAddr=aServiceAddr; - } - -void CAgileProvisionWs::DoGetPolicyL(const TDesC8& aEndPointUri, const TUint aIapId) - { - - CSenXmlServiceDescription* pServiceDesc = CSenXmlServiceDescription::NewLC( aEndPointUri, - KNullDesC8() ); - iEndPointUri=&aEndPointUri; - pServiceDesc->SetFrameworkIdL( KDefaultBasicWebServicesFrameworkID ); - delete iPService; - iPService = NULL; - - iPService = CAgileProvisionServiceService::NewL( *this, *pServiceDesc ); - - CleanupStack::PopAndDestroy( pServiceDesc ); - - iPService->iIapId= aIapId; - - iState = KStateGettingConf; - - } - -void CAgileProvisionWs::HandleMessageL(const TDesC8& aMessage) -{ - - iPService->ResetTransactionId(); - - if ( iState == KStateGettingConf ) - { - HandleGetConfSoapInL( aMessage ); - GenerateCertReqL(); - iPService->GetCertificateAsyncL(iPService->iCertreq); - iState = KStateGettingCertificate; - } - else if ( iState == KStateGettingCertificate ) - { - HandleGetCertificateSoapInL( aMessage ); - DoComplete( KErrNone ); - iState = KStateInitial; - } - else - { - User::Leave( KErrArgument ); - } -} - -void CAgileProvisionWs::HandleErrorL(const TInt aErrorCode, const TDesC8& /*aError*/) - { - DoComplete( aErrorCode ); - } - - -void CAgileProvisionWs::SetStatus(const TInt aStatus) - { - TInt err = KErrNone; - if ( aStatus == KSenConnectionStatusReady ) - { - TRAP( err, iPService->GetConfAsyncL() ); - } - else if ( aStatus == KSenConnectionStatusCreateFailed ) - { - err = aStatus; - } - else - { - // Do nothing. - } - - if ( err != KErrNone ) - { - DoComplete( err ); - } - } - -EXPORT_C void CAgileProvisionWs::HandleGetConfSoapInL(const TDesC8& aMessage) - { - CSenXmlReader *pXmlReader = CSenXmlReader::NewL(); - CleanupStack::PushL(pXmlReader); - - //CSenDomFragment - CSenDomFragment* pBase = CSenDomFragment::NewL(); - CleanupStack::PushL(pBase); - - //must set the content handler - pXmlReader->SetContentHandler(*pBase); - // and the reader - pBase->SetReader(*pXmlReader); - - pXmlReader->ParseL(aMessage); - - RPointerArray& array = pBase->AsElement().ElementsL(); - - //start the listing of the elements, first level is 1 - TInt contentType(1); - - TInt vpnFilePathLth = KAgileProvisionPolicyFileName().Length() + KTempDirectory().Length(); - HBufC* vpnFilePathBuf = HBufC::NewLC(vpnFilePathLth); - TPtr vpnFilePath(vpnFilePathBuf->Des()); - vpnFilePath.Copy(KTempDirectory); - vpnFilePath.Append(KAgileProvisionPolicyFileName); - - ParseFileFromSoapEnvelopeL(array, contentType, 1, vpnFilePath); - - CleanupStack::PopAndDestroy(vpnFilePathBuf); // file - CleanupStack::PopAndDestroy(pBase); // delete pXmlReader, procMsg, responseStr - CleanupStack::PopAndDestroy(pXmlReader); // delete pXmlReader, procMsg, responseStr - } - - -EXPORT_C void CAgileProvisionWs::HandleGetCertificateSoapInL(const TDesC8& aMessage) - { - CSenXmlReader *pXmlReader = CSenXmlReader::NewL(); - CleanupStack::PushL(pXmlReader); - - //CSenDomFragment - CSenDomFragment* pBase = CSenDomFragment::NewL(); - CleanupStack::PushL(pBase); - - //must set the content handler - pXmlReader->SetContentHandler(*pBase); - // and the reader - pBase->SetReader(*pXmlReader); - - pXmlReader->ParseL(aMessage); - - RPointerArray& array = pBase->AsElement().ElementsL(); - - //start the listing of the elements, first level is 1 - - TInt vpnFilePathLth = KAgileProvisionCertificateFileName().Length() + KTempDirectory().Length(); - HBufC* vpnFilePathBuf = HBufC::NewLC(vpnFilePathLth); - TPtr vpnFilePath(vpnFilePathBuf->Des()); - vpnFilePath.Copy(KTempDirectory); - vpnFilePath.Append(KAgileProvisionCertificateFileName); - TInt contentType(2); - ParseFileFromSoapEnvelopeL(array, contentType, 1, vpnFilePath); - - CleanupStack::PopAndDestroy(vpnFilePathBuf); // file - CleanupStack::PopAndDestroy(pBase); // delete pXmlReader, procMsg, responseStr - CleanupStack::PopAndDestroy(pXmlReader); // delete pXmlReader, procMsg, responseStr - - } - -// The listing of the elements is done in ListNodesL function: -void CAgileProvisionWs::ParseFileFromSoapEnvelopeL(RPointerArray& aArray, - TInt aContentType,TInt aLevel, TDesC& aFileName ) - { - - TInt size = aArray.Count(); - for(TInt i=0; iHasContent() ) - { - //get the content of the element - TPtrC8 content = pElement->Content(); - TBase64Codec* base64Inst = new (ELeave) TBase64Codec(); - CleanupStack::PushL(base64Inst); - HBufC8* dataBuf = base64Inst->Base64DecodeLC(content); - HBufC8* fileBuf = base64Inst->Base64DecodeLC(*dataBuf); - - //CA from getConf envelope - if ( aContentType == 1 && i==1 ) - { - CAgileCryptoCert* agileClientCert = CAgileCryptoCert::NewL(fileBuf->Des(), EFalse); - CleanupStack::PushL(agileClientCert); - agileClientCert->SaveCACertL(); - CleanupStack::PopAndDestroy(agileClientCert); - } - else if ( aContentType == 2) - { - CAgileCryptoCert* agileClientCert = CAgileCryptoCert::NewL(fileBuf->Des(), ETrue); - CleanupStack::PushL(agileClientCert); - agileClientCert->SaveClientCertL(iKeyRef,KPublicKeyLen); - CleanupStack::PopAndDestroy(agileClientCert); - } - else - { - RFile file; - RFs iFs; - TInt err= iFs.Connect(); - CleanupClosePushL(file); - User::LeaveIfError(file.Replace(iFs, aFileName, EFileWrite)); - User::LeaveIfError(file.Write(*fileBuf)); - - //write pin file - TInt vpnPinFilePathLth = KAgileProvisionPinFileName().Length() + KTempDirectory().Length(); - HBufC* vpnPinFilePathBuf = HBufC::NewLC(vpnPinFilePathLth); - TPtr vpnPinFilePath(vpnPinFilePathBuf->Des()); - vpnPinFilePath.Copy(KTempDirectory); - vpnPinFilePath.Append(KAgileProvisionPinFileName); - User::LeaveIfError(file.Replace(iFs, vpnPinFilePath, EFileWrite)); - CleanupStack::PopAndDestroy(vpnPinFilePathBuf); // file - file.Flush(); - file.Close(); - CleanupStack::PopAndDestroy(&file); - iFs.Close(); - } - - - CleanupStack::PopAndDestroy(fileBuf); - CleanupStack::PopAndDestroy(dataBuf); - CleanupStack::PopAndDestroy(base64Inst); - - - } - - //get the first child - CSenElement* child = pElement->Child(0); - - //check if element has childs - if( child ) - { - //get the child elements - RPointerArray& tree = pElement->ElementsL(); - - //list child elements by a recursive call - ParseFileFromSoapEnvelopeL(tree, aContentType, ++aLevel, aFileName); - } - aLevel--; - } //for loop ends - } - -EXPORT_C void CAgileProvisionWs::GenerateCertReqL() - { - TRequestStatus status; - CAgileCryptoPrivKey* agileCryptoPrivKey = CAgileCryptoPrivKey::NewL(); - CleanupStack::PushL(agileCryptoPrivKey); - CAgileCryptoGenerateKeypair* agileCryptoGenerateKeypair = CAgileCryptoGenerateKeypair::NewL(agileCryptoPrivKey); - CleanupStack::PushL(agileCryptoGenerateKeypair); - - // generate key - agileCryptoGenerateKeypair->GenerateKeypairL(KPublicKeyLen, iKeyRef, status); - User::WaitForRequest(status); - - // generate subjectname - _LIT8(KCnHeader, "CN="); - _LIT8(KCnUsername, "vpnuser"); - TInt distinguishedNameLth = KCnHeader().Length() + KCnUsername().Length(); - HBufC8* distinguishedNameHBuf = HBufC8::NewLC(distinguishedNameLth); - TPtr8 distinguishedName(distinguishedNameHBuf->Des()); - distinguishedName.Copy(KCnHeader); - distinguishedName.Append(KCnUsername); - - // generate certreq - const TInt KDmAdMaxCertReqRefLth = KMaxFileName; - HBufC* certReqRef = HBufC::NewLC(KDmAdMaxCertReqRefLth); - TPtr certReqRefPtr(certReqRef->Des()); - TInt certReqSize; - - agileCryptoPrivKey->GenerateCertReqL(*distinguishedNameHBuf, //subjectname - KNullDesC8, // subjectaltname - KNullDesC8, //aChallengePassword, - KNullDesC8, //DnsName, - iKeyRef, - certReqRefPtr, - certReqSize); - - - // read certreq - TRetBufCertReq certReq; - certReq = agileCryptoPrivKey->ReadCertReqL(certReqRefPtr, certReqSize); - if ( iPService ) - { - iPService->iCertreq = certReq; - } - else - { - delete certReq; - certReq=NULL; - } - - CleanupStack::PopAndDestroy(certReqRef); - CleanupStack::PopAndDestroy(distinguishedNameHBuf); - CleanupStack::PopAndDestroy(agileCryptoGenerateKeypair); - CleanupStack::PopAndDestroy(agileCryptoPrivKey); - } - -void CAgileProvisionWs::DoComplete( const TInt aStatus ) - { - if ( iClientStatus != NULL ) - { - User::RequestComplete( iClientStatus, - aStatus ); - } - } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/dmadipsecvpn/src/DmAdRtNodeData.cpp --- a/vpnengine/dmadipsecvpn/src/DmAdRtNodeData.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/dmadipsecvpn/src/DmAdRtNodeData.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -599,23 +599,6 @@ if (aName.Length() > 0) { iName = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aName); - - if (iContent == NULL) - { - //If the content has not been set we also generate an empty - //dummy policy at this point. The dummy policy is needed in - //a case of a large policy. Large policies are delivered using - //two separate messages from the OMA DM server. First message - //contains only the policy info details and the second one contains - //the actual data. We have to have the dummy content to handle - //the completion of the first message correctly. - _LIT8(KEmptyPolicyContent, "SECURITY_FILE_VERSION: 1\n"\ - "[INFO]\n"\ - "%S\n"); - iContent = HBufC8::NewL(iName->Length() + KEmptyPolicyContent().Length()); - TPtr8 contentPtr = iContent->Des(); - contentPtr.Format(KEmptyPolicyContent, iName); - } } } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/dmadpki/src/DmAdRtNodeData.cpp --- a/vpnengine/dmadpki/src/DmAdRtNodeData.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/dmadpki/src/DmAdRtNodeData.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2000-2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -644,7 +644,7 @@ TUid uid = { TDmAdUtil::DesToInt(attribute) }; DEBUG_LOG1(_L("Uid: 0x%x"), uid.iUid); - aApplicabilityList.AppendL(uid); + aApplicabilityList.Append(uid); parser->NextL(); while (parser->State() == CXmlPullParser::EStateText) diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/dmadpki/src/DmAdStore.cpp --- a/vpnengine/dmadpki/src/DmAdStore.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/dmadpki/src/DmAdStore.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -40,7 +40,6 @@ TRACE("CDmAdStore::ConstructL"); TInt status = iPkiServiceApi.Connect(); - iPkiServiceApi.SetInformational(ETrue); DEBUG_LOG1(_L("Connect status: %d"), status); User::LeaveIfError(status); iCert = CDmAdCert::NewL(iPkiServiceApi); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediator/group/eventmediator.mmp --- a/vpnengine/eventmediator/group/eventmediator.mmp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/eventmediator/group/eventmediator.mmp Wed Oct 13 15:42:16 2010 +0300 @@ -29,7 +29,6 @@ SOURCEPATH ../src SOURCE eventmediator.cpp -SOURCE eventmediatorsession.cpp SOURCE eventlogger.cpp SOURCE eventmediatorstarter.cpp diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediator/inc/eventlogger.h --- a/vpnengine/eventmediator/inc/eventlogger.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/eventmediator/inc/eventlogger.h Wed Oct 13 15:42:16 2010 +0300 @@ -98,6 +98,12 @@ static CEventLogger* NewL(CEventMediatorServer* aServer); /** + * Constructor + * @param aFileMaxLength: maximum length of log file in kbytes + */ + CEventLogger(TInt aFileMaxLength, CEventMediatorServer* aServer); + + /** * Destructor */ ~CEventLogger(); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediator/inc/eventmediator.h --- a/vpnengine/eventmediator/inc/eventmediator.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/eventmediator/inc/eventmediator.h Wed Oct 13 15:42:16 2010 +0300 @@ -51,6 +51,8 @@ */ class CEventMediatorServer : public CPolicyServer, public MSitDeathListener { + friend class CEventMediatorSession; // Friend class + public: //Methods // Constructors and destructor @@ -75,10 +77,6 @@ */ CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; - /** - * Notifies the server that a session has been deleted. - */ - void SessionDeleted(TBool aIsSitSession); // Other methods /** @@ -100,7 +98,7 @@ * Finds out whether the specified client thread is a SIT * thread or not */ - TBool IsClientTheSitL(const RMessage2& aMessage) const; + TBool IsClientTheSitL(const RMessage2& aMessage); /** * Starts the SIT thread if it is not running @@ -210,14 +208,6 @@ TPtrC EventLogFileName(void); - /** - * Copies data describing an event to the client. - * @param aMessge: a message from client side sent by RConnection::FetchData - * @return error code, KErrNone if successfull - */ - TInt CopyEventDataL(const RMessage2& aMessage); - - public: // From MSitDeathListener void SitDied(); @@ -241,11 +231,23 @@ /** * Perform the second phase construction of a CVpnManagerServer * object. + * @param aServer Pointer to the server itself. */ - void ConstructL(); + void ConstructL(CEventMediatorServer* aServer); // Other methods + /** + * Stops the server if the session count is zero. + */ + void StopEventMediator(void); + + /** + * Copies data describing an event to the client. + * @param aMessge: a message from client side sent by RConnection::FetchData + * @return error code, KErrNone if successfull + */ + TInt CopyEventDataL(const RMessage2& aMessage); /** * Reduces listener count of a stored event by one and destroys it if count becomes zero. @@ -253,11 +255,16 @@ */ void MarkStoredEventListened(TInt aIndex); + /** + * Sets the iShuttingDown flag. + */ + void SetShuttingDown(TBool aShuttingDown); + private: //Data // List of Events that have been reported but not handled by all listeners. CArrayFixFlat iStoredEvents; // Number of currently existing sessions. - mutable TInt iSessionCount; + TInt iSessionCount; // Log writer CEventLogger* iLogger; // The next event specification ID @@ -283,6 +290,231 @@ }; +// CLASS DECLARATION + +/** +* Defines the session to the VPN manager server. +*/ +class CEventMediatorSession : public CSession2 + { + public: //Message types + enum + { + KEventMediatorListen, + KEventMediatorListenWithSpec, + KEventMediatorCancel, + KEventMediatorCancelWithSpec, + KEventMediatorCancelAll, + KEventMediatorReportEvent, + KEventMediatorReportEventWithSpec, + KEventMediatorFetchData, + KEventMediatorReportLogEvent, + KEventMediatorNewEventSpecId, + KEventMediatorDeletePrivateFiles, + KEventMediatorGetEventLogSize, + KEventMediatorGetEventLogHeader, + KEventMediatorGetEventLogData, + KEventMediatorClearEventLog + }; + + public: // Methods + + // Constructors and destructor + + /** + * Static constructor + */ + static CEventMediatorSession* NewL(CEventMediatorServer* aServer, const RMessage2& aMessage); + + /** + * Default destructor + */ + ~CEventMediatorSession(void); + + /** + * Wrapper function which Dispatches and executes the client's service calls + * (See Message type definition). + */ + void ServiceL(const RMessage2& aMessage); + + /** + * Checks if client is listening events of the given type and completes message + * sent by clients ListenToEvent function. The length of the event data and + * the pointer to that data are written to the message. + * @param aType: type of the event. + * @param aSpec: additional info on event. + * @param aData: event data. + * @return number of listeners for the event was listened. + */ + TInt CheckEventL(const TEventType aType, const TDesC8* aSpec, const TDesC8* aData, TInt aStatus); + + /** + * Tries to find a task request that is not being fulfilled + * already + */ + CListenerContainer* FindWaitingTaskRequest(); + + /** + * Retrieves the event listener object, if any, that is using + * the SIT that is fulfilling the specified event. + */ + CListenerContainer* FindListener(TEventType aEventType, TInt aEventSpecId); + + /** + * Retrieves the event listener object, if any, that is using + * the SIT that is fulfilling the specified event. + */ + CListenerContainer* FindListener(TEventType aEventType, const TDesC8* aEventSpec); + + /** + * Completes the specified listener if it is owned by the + * session. Returns ETrue is the listener was found and + * completed, EFalse otherwise. + */ + void CompleteListener(TEventType aEventType, const TDesC8* aEventSpec, TInt aStatus); + + void CompleteTaskRequests(TInt aStatus); + + TBool IsASitSession(); + + private: //Methods + // Constructors and destructor + + /** + * Constructor + */ + CEventMediatorSession(CEventMediatorServer* aServer); + + /** + * Starts listening events of requesteed type by coping the message to iListenedEvents. + * @param aMessage: aMessage sent by clients ListenToEvent function. + * @return: error code, KErrNone if successfull. + */ + TInt ListenToEventWithSpecL(const RMessage2& aMessage); + + /** + * Starts listening events of requesteed type by coping the message to iListenedEvents. + * @param aMessage: aMessage sent by clients ListenToEvent function. + * @return: error code, KErrNone if successfull. + */ + TInt ListenToEventL(const RMessage2& aMessage); + + /** + * Reports the event contained in the message to the event mediator server. + * @param aMessage: aMessage sent by clients ReportEvent function. + * @return: error code, KErrNone if successfull. + */ + void ReportEventL(const RMessage2& aMessage); + + /** + * Reports a log event contained in the message to the event mediator server. + * @param aMessage: aMessage sent by clients ReportLogEvent function. + * @return: error code, KErrNone if successfull. + */ + void ReportLogEventL(const RMessage2& aMessage); + + /** + * Reports the event contained in the message to the event mediator server. + * @param aMessage: aMessage sent by clients ReportEvent function. + * @return: error code, KErrNone if successfull. + */ + void ReportEventWithSpecL(const RMessage2& aMessage); + + /** + * Cancels listning of one event type. + * @param aMessage: aMessage sent by clients CancelListenToEvent function. + */ + void CancelListening(const RMessage2& aMessage); + + /** + * Cancels listning of one event type. + * @param aMessage: aMessage sent by clients CancelListenToEvent function. + */ + void CancelListeningWithSpecL(const RMessage2& aMessage); + + /** + * Cancels all listening. + * @param aMessage: aMessage sent by clients CancelAllListening function. + */ + void CancelAll(); + + /** + * Copies event data from the server to the client. + * @param aMessage: aMessage sent by clients FetchData function. + * @return: error code, KErrNone if successfull. + */ + TInt FetchDataL(const RMessage2& aMessage); + + /** + * Looks up a message from iListenedEvents. + * @param aType: type of the event the message is listening to. + * @param aIndex: the position of the message in iListenedEvents. + * @return ETrue if message exists, EFalse if not. + */ + TBool FindListenerMsg(const TEventType aType,TInt& index); + + /** + * Looks up a message from iListenedEvents. + * @param aType: type of the event the message is listening to. + * @param aIndex: the position of the message in iListenedEvents. + * @return ETrue if message exists, EFalse if not. + */ + TBool FindListenerMsg(const TEventType aType,const TDesC8* aSpec,TInt& index); + + /** + * Searches for a task request type event listening request + */ + TBool FindTaskRequestListenerMsg(TInt& index); + + /** + * Reads data that was reported with the event from client. Allocates a buffer + * for data and gives ownership of that buffer to caller. + * @param aMessage: aMessage sent by clients ReportEvent function. + * @return pointer to the newly created buffer containig data. + */ + HBufC8* ReadEventDataFromClientL(const RMessage2& aMessage); + + /** + * Reads specification describing the event from client. Allocates a buffer + * for secification and gives ownership of that buffer to caller. + * @param aMessage: aMessage sent with event specification. + * @return pointer to the newly created buffer containig data. + */ + HBufC8* ReadSpecificationFromClientL(const RMessage2& aMessage); + + /** + * Completes the specified listener and deletes it from the + * listener list + */ + void CompleteListener(TInt aIndex, TInt aStatus); + + /** + * Returns to the client a new event specification ID + */ + void NewEventSpecIdL(const RMessage2& aMessage); + + TInt DeletePrivateFiles(); + void DeletePrivateFilesL(); + + TInt GetEventLogSize(const RMessage2& aMessage); + TInt GetEventLogHeader(const RMessage2& aMessage); + TInt GetEventLogData(const RMessage2& aMessage); + TInt ClearEventLog(); + + private: //Data + // List of messages listening to events + CArrayFixFlat iListenedEvents; + // Event mediator server + CEventMediatorServer* iServer; + + RFs iFs; + RFile iEventLogFile; + TBool iEventLogFileOpen; + // Is this session from a SIT or not + + public: + TBool iIsSitSession; + }; // CLASS DECLARATION @@ -317,7 +549,7 @@ public: //Methods // Constructors and destructor CListenerContainer(const RMessage2& aMessage, TDesC8* aSpec, - CEventMediatorServer& aServer); + CEventMediatorServer* aServer); ~CListenerContainer(); inline TEventType Type() {return (TEventType) iMessage.Int0();} @@ -338,7 +570,7 @@ RMessage2 iMessage; TEventType iEventType; // Pointer to the event mediator server - CEventMediatorServer& iServer; + CEventMediatorServer* iServer; // A flag that tells whether the request // is being fulfilled by the SIT or not TBool iBeingFulfilledBySit; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediator/inc/eventmediatorsession.h --- a/vpnengine/eventmediator/inc/eventmediatorsession.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -/* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This module defines event mediator server side session. -* -*/ -#ifndef EVENTMEDIATORSESSION_H_ -#define EVENTMEDIATORSESSION_H_ - -#include -#include -#include "eventmediatorapi.h" - -/** -* Defines the session to the VPN manager server. -*/ -class CEventMediatorServer; -class CListenerContainer; - -class CEventMediatorSession : public CSession2 - { - public: // Methods - - // Constructors and destructor - - /** - * Static constructor - */ - static CEventMediatorSession* NewL(CEventMediatorServer& aServer, - TBool aIsSitSession); - - /** - * Default destructor - */ - ~CEventMediatorSession(void); - - /** - * Wrapper function which Dispatches and executes the client's service calls - * (See Message type definition). - */ - void ServiceL(const RMessage2& aMessage); - - /** - * Checks if client is listening events of the given type and completes message - * sent by clients ListenToEvent function. The length of the event data and - * the pointer to that data are written to the message. - * @param aType: type of the event. - * @param aSpec: additional info on event. - * @param aData: event data. - * @return number of listeners for the event was listened. - */ - TInt CheckEventL(const TEventType aType, const TDesC8* aSpec, const TDesC8* aData, TInt aStatus); - - /** - * Tries to find a task request that is not being fulfilled - * already - */ - CListenerContainer* FindWaitingTaskRequest(); - - /** - * Retrieves the event listener object, if any, that is using - * the SIT that is fulfilling the specified event. - */ - CListenerContainer* FindListener(TEventType aEventType, TInt aEventSpecId); - - /** - * Retrieves the event listener object, if any, that is using - * the SIT that is fulfilling the specified event. - */ - CListenerContainer* FindListener(TEventType aEventType, const TDesC8* aEventSpec); - - /** - * Completes the specified listener if it is owned by the - * session. Returns ETrue is the listener was found and - * completed, EFalse otherwise. - */ - void CompleteListener(TEventType aEventType, const TDesC8* aEventSpec, TInt aStatus); - - void CompleteTaskRequests(TInt aStatus); - - TBool IsASitSession(); - - private: //Methods - // Constructors and destructor - - /** - * Constructor - */ - CEventMediatorSession(CEventMediatorServer& aServer, TBool aIsSitSession); - void ConstructL(); - - /** - * Starts listening events of requesteed type by coping the message to iListenedEvents. - * @param aMessage: aMessage sent by clients ListenToEvent function. - * @return: error code, KErrNone if successfull. - */ - TInt ListenToEventWithSpecL(const RMessage2& aMessage); - - /** - * Starts listening events of requesteed type by coping the message to iListenedEvents. - * @param aMessage: aMessage sent by clients ListenToEvent function. - * @return: error code, KErrNone if successfull. - */ - TInt ListenToEventL(const RMessage2& aMessage); - - /** - * Reports the event contained in the message to the event mediator server. - * @param aMessage: aMessage sent by clients ReportEvent function. - * @return: error code, KErrNone if successfull. - */ - void ReportEventL(const RMessage2& aMessage); - - /** - * Reports a log event contained in the message to the event mediator server. - * @param aMessage: aMessage sent by clients ReportLogEvent function. - * @return: error code, KErrNone if successfull. - */ - void ReportLogEventL(const RMessage2& aMessage); - - /** - * Reports the event contained in the message to the event mediator server. - * @param aMessage: aMessage sent by clients ReportEvent function. - * @return: error code, KErrNone if successfull. - */ - void ReportEventWithSpecL(const RMessage2& aMessage); - - /** - * Cancels listning of one event type. - * @param aMessage: aMessage sent by clients CancelListenToEvent function. - */ - void CancelListening(const RMessage2& aMessage); - - /** - * Cancels listning of one event type. - * @param aMessage: aMessage sent by clients CancelListenToEvent function. - */ - void CancelListeningWithSpecL(const RMessage2& aMessage); - - /** - * Cancels all listening. - * @param aMessage: aMessage sent by clients CancelAllListening function. - */ - void CancelAll(); - - /** - * Copies event data from the server to the client. - * @param aMessage: aMessage sent by clients FetchData function. - * @return: error code, KErrNone if successfull. - */ - TInt FetchDataL(const RMessage2& aMessage); - - /** - * Looks up a message from iListenedEvents. - * @param aType: type of the event the message is listening to. - * @param aIndex: the position of the message in iListenedEvents. - * @return ETrue if message exists, EFalse if not. - */ - TBool FindListenerMsg(const TEventType aType,TInt& index); - - /** - * Looks up a message from iListenedEvents. - * @param aType: type of the event the message is listening to. - * @param aIndex: the position of the message in iListenedEvents. - * @return ETrue if message exists, EFalse if not. - */ - TBool FindListenerMsg(const TEventType aType,const TDesC8* aSpec,TInt& index); - - /** - * Searches for a task request type event listening request - */ - TBool FindTaskRequestListenerMsg(TInt& index); - - /** - * Reads data that was reported with the event from client. Allocates a buffer - * for data and gives ownership of that buffer to caller. - * @param aMessage: aMessage sent by clients ReportEvent function. - * @return pointer to the newly created buffer containig data. - */ - HBufC8* ReadEventDataFromClientL(const RMessage2& aMessage); - - /** - * Reads specification describing the event from client. Allocates a buffer - * for secification and gives ownership of that buffer to caller. - * @param aMessage: aMessage sent with event specification. - * @return pointer to the newly created buffer containig data. - */ - HBufC8* ReadSpecificationFromClientL(const RMessage2& aMessage); - - /** - * Completes the specified listener and deletes it from the - * listener list - */ - void CompleteListener(TInt aIndex, TInt aStatus); - - /** - * Returns to the client a new event specification ID - */ - void NewEventSpecIdL(const RMessage2& aMessage); - - TInt DeletePrivateFiles(); - void DeletePrivateFilesL(); - - TInt GetEventLogSize(const RMessage2& aMessage); - TInt GetEventLogHeader(const RMessage2& aMessage); - TInt GetEventLogData(const RMessage2& aMessage); - TInt ClearEventLog(); - - private: //Data - // List of messages listening to events - CArrayFixFlat iListenedEvents; - // Event mediator server - CEventMediatorServer& iServer; - - RFs iFs; - RFile iEventLogFile; - TBool iEventLogFileOpen; - // Is this session from a SIT or not - - public: - TBool iIsSitSession; - }; - -#endif /* EVENTMEDIATORSESSION_H_ */ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediator/src/eventlogger.cpp --- a/vpnengine/eventmediator/src/eventlogger.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/eventmediator/src/eventlogger.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -37,6 +37,14 @@ return server; } +CEventLogger::CEventLogger(TInt aFileMaxLength, CEventMediatorServer* aServer) +{ + iServer = aServer; + if ( aFileMaxLength == 0 || aFileMaxLength > LOGFILE_MAX_LTH ) + iFileMaxLength = KBYTES_TO_BYTES * LOGFILE_MAX_LTH; + else iFileMaxLength = KBYTES_TO_BYTES * aFileMaxLength; +} + CEventLogger::~CEventLogger() { } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediator/src/eventmediator.cpp --- a/vpnengine/eventmediator/src/eventmediator.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/eventmediator/src/eventmediator.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -23,28 +23,26 @@ * This module contains eventmediator and the services of it. * */ +#include #include "eventmediator.h" -#include "eventmediatorsession.h" -#include "eventmediatorclientservercommon.h" #include "eventlogger.h" +#include "eventmediatordefs.h" #include "sit.h" #include "log_em.h" - #define FIRST_ARGUMENT 0 #define SECOND_ARGUMENT 1 #define THIRD_ARGUMENT 2 #define FOURTH_ARGUMENT 3 - // ============================= CEventMediatorServer ============================= const TUint CEventMediatorServer::iRangeCount = 2; const TInt CEventMediatorServer::iRanges[iRangeCount] = { - KEventMediatorListen, - KEventMediatorClearEventLog+1 + CEventMediatorSession::KEventMediatorListen, + CEventMediatorSession::KEventMediatorClearEventLog+1 }; const TUint8 CEventMediatorServer::iElementIndex[iRangeCount] = @@ -76,27 +74,23 @@ CEventMediatorServer* CEventMediatorServer::NewL() { LOG(Log::Printf(_L("CEventMediatorServer::NewL - begin\n"))); - - CEventMediatorServer* self = CEventMediatorServer::NewLC(); - CleanupStack::Pop(self); // server + CEventMediatorServer* server = CEventMediatorServer::NewLC(); + CleanupStack::Pop(); // server LOG(Log::Printf(_L("CEventMediatorServer::NewL - end\n"))); - - return self; + return server; } CEventMediatorServer* CEventMediatorServer::NewLC() { LOG(Log::Printf(_L("CEventMediatorServer::NewLC - begin\n"))); - - CEventMediatorServer* self = new (ELeave) CEventMediatorServer(); - CleanupStack::PushL(self); - self->ConstructL(); - + CEventMediatorServer* server = new (ELeave) CEventMediatorServer(); + CleanupStack::PushL(server); + server->ConstructL(server); LOG(Log::Printf(_L("CEventMediatorServer::NewLC - end\n"))); - return self; + return server; } -void CEventMediatorServer::ConstructL() +void CEventMediatorServer::ConstructL(CEventMediatorServer* aServer) { RFs fs; User::LeaveIfError(fs.Connect()); @@ -111,7 +105,7 @@ CleanupStack::PopAndDestroy(); // fs - iLogger = CEventLogger::NewL(this); + aServer->iLogger = CEventLogger::NewL(this); iSit = new (ELeave) CSit(this); StartL(KEventMediatorServer); } @@ -134,6 +128,19 @@ delete iSit; } +// ---------------------------------------------------------------------------- +// CEventMediatorServer::StopEventMediator +// Stops Event Mediator service if there are no sessions left. +// ---------------------------------------------------------------------------- +// +void CEventMediatorServer::StopEventMediator(void) + { + if (iSessionCount == 0) + { + LOG(Log::Printf(_L("CEventMediatorServer::StopEventMediator - session count 0, stopping scheduler and thus the server\n"))); + CActiveScheduler::Stop(); + } + } TInt CEventMediatorServer::RunError(TInt aError) { @@ -165,51 +172,10 @@ User::Leave(KErrServerTerminated); } - - CSession2* session = CEventMediatorSession::NewL(const_cast(*this), - IsClientTheSitL(aMessage)); - iSessionCount++; + CSession2* session = CEventMediatorSession::NewL(CONST_CAST(CEventMediatorServer*, this), aMessage); return session; } -void CEventMediatorServer::SessionDeleted(TBool aIsSitSession) - { - TInt normalSessionCount = NormalSessionCount(); - - // If this too is a normal session and is dying, - // decrement the normal session count by one - if (!aIsSitSession) - { - normalSessionCount--; - } - - if (normalSessionCount == 0) - { - // If "normal" (non-sit) sessions are no longer present, - // we complete the task arrival observation request, thus - // causing the SIT to terminate and close its connection - // to this server. This should be the last connection whose - // closing will cause this server to terminate. - // NOTE. KErrCancel cannot be used here as the Event Mediator - // does not report it to the caller - LOG(Log::Printf(_L("CEventMediatorServer::SessionDeleted - normal session count = 0\n"))); - CompleteListener(ETaskArrivedEvent, NULL, KErrAbort); - - // Set the server state to "shutting down". This will - // cause the server to discard any new connect requests - // with KErrServerTerminated. - iShuttingDown = ETrue; - } - - __ASSERT_DEBUG(iSessionCount > 0, User::Invariant()); - iSessionCount--; - if (iSessionCount == 0) - { - LOG(Log::Printf(_L("CEventMediatorServer::SessionDeleted - session count 0, stopping scheduler and thus the server\n"))); - CActiveScheduler::Stop(); - } - } - void CEventMediatorServer::ReportEventL(const TEventType aType, TDesC8* aSpec, TDesC8* aData, TInt aStatus) { @@ -238,11 +204,8 @@ iStoredEvents.AppendL(container); CleanupStack::Pop(); } - // Write event to log - __ASSERT_DEBUG(iLogger != NULL, User::Invariant()); - - if (aType == ELogEvent) + if (aType == ELogEvent && iLogger) { LOG(Log::Printf(_L("CEventMediatorServer::ReportEventL - calling iLogger->LogEvent\n"))); iLogger->LogEvent(*aData); @@ -294,7 +257,7 @@ } } -TBool CEventMediatorServer::IsClientTheSitL(const RMessage2& aMessage) const +TBool CEventMediatorServer::IsClientTheSitL(const RMessage2& aMessage) { LOG(Log::Printf(_L("CEventMediatorServer::IsClientTheSitL\n"))); TBool isClientTheSit = EFalse; @@ -596,11 +559,689 @@ session = (CEventMediatorSession*) iSessionIter++; } } + +void CEventMediatorServer::SetShuttingDown(TBool aShuttingDown) + { + iShuttingDown = aShuttingDown; + } + +// ============================= CEventMediatorSession ============================= + +CEventMediatorSession* CEventMediatorSession::NewL(CEventMediatorServer* aServer, const RMessage2& aMessage) + { + LOG(Log::Printf(_L("CEventMediatorSession::NewL - begin\n"))); + CEventMediatorSession* self; + self = new (ELeave) CEventMediatorSession(aServer); + CleanupStack::PushL(self); + + // Marks the session as a "SIT session" + // if the client is the SIT thread + self->iIsSitSession = aServer->IsClientTheSitL(aMessage); + + aServer->iSessionCount++; + + if ( !self->IsASitSession() ) + { + User::LeaveIfError(self->iFs.Connect()); // For EventLog + self->iEventLogFileOpen = EFalse; + } + + CleanupStack::Pop(); // self + + LOG(Log::Printf(_L("CEventMediatorSession::NewL - end\n"))); + return self; + } + +CEventMediatorSession::CEventMediatorSession(CEventMediatorServer* aServer) + : iListenedEvents(2), iServer(aServer) + { + } + +CEventMediatorSession::~CEventMediatorSession(void) + { + LOG(Log::Printf(_L("CEventMediatorSession::~CEventMediatorSession\n"))); + CancelAll(); + if (iServer) + { + TInt normalSessionCount = iServer->NormalSessionCount(); + + // If this too is a normal session and is dying, + // decrement the normal session count by one + if (!IsASitSession()) + { + normalSessionCount--; + + if (iEventLogFileOpen) + { + iEventLogFile.Close(); + iEventLogFileOpen = EFalse; + } + iFs.Close(); // For EventLog + + } + + if (normalSessionCount == 0) + { + // If "normal" (non-sit) sessions are no longer present, + // we complete the task arrival observation request, thus + // causing the SIT to terminate and close its connection + // to this server. This should be the last connection whose + // closing will cause this server to terminate. + // NOTE. KErrCancel cannot be used here as the Event Mediator + // does not report it to the caller + LOG(Log::Printf(_L("CEventMediatorSession::~CEventMediatorSession - normal session count = 0\n"))); + iServer->CompleteListener(ETaskArrivedEvent, NULL, KErrAbort); + + // Set the server state to "shutting down". This will + // cause the server to discard any new connect requests + // with KErrServerTerminated. + iServer->SetShuttingDown(ETrue); + } + + if (iServer->iSessionCount) + { + iServer->iSessionCount--; + } + + iServer->StopEventMediator(); + } + } + +void CEventMediatorSession::ServiceL(const RMessage2& aMessage) + { + TInt status = 0; + + switch (aMessage.Function()) + { + case KEventMediatorListen: + ListenToEventL(aMessage); + break; + + case KEventMediatorListenWithSpec: + ListenToEventWithSpecL(aMessage); + break; + + case KEventMediatorCancel: + CancelListening(aMessage); + aMessage.Complete(KErrNone); + break; + + case KEventMediatorCancelWithSpec: + CancelListeningWithSpecL(aMessage); + aMessage.Complete(KErrNone); + break; + + case KEventMediatorCancelAll: + CancelAll(); + aMessage.Complete(KErrNone); + break; + + case KEventMediatorReportEvent: + ReportEventL(aMessage); + aMessage.Complete(KErrNone); + break; + + case KEventMediatorReportEventWithSpec: + ReportEventWithSpecL(aMessage); + aMessage.Complete(KErrNone); + break; + + case KEventMediatorFetchData: + status = FetchDataL(aMessage); + aMessage.Complete(status); + break; + + case KEventMediatorReportLogEvent: + ReportLogEventL(aMessage); + aMessage.Complete(KErrNone); + break; + + case KEventMediatorNewEventSpecId: + NewEventSpecIdL(aMessage); + aMessage.Complete(KErrNone); + break; + case KEventMediatorDeletePrivateFiles: + status = DeletePrivateFiles(); + aMessage.Complete(status); + break; + + case KEventMediatorGetEventLogSize: + status = GetEventLogSize(aMessage); + aMessage.Complete(status); + break; + + case KEventMediatorGetEventLogHeader: + status = GetEventLogHeader(aMessage); + aMessage.Complete(status); + break; + case KEventMediatorGetEventLogData: + status = GetEventLogData(aMessage); + aMessage.Complete(status); + break; + case KEventMediatorClearEventLog: + status = ClearEventLog(); + aMessage.Complete(status); + break; + default: + aMessage.Complete(KErrGeneral); + break; + } + } + +TInt CEventMediatorSession::ListenToEventL(const RMessage2& aMessage) + { + CListenerContainer* listener = new (ELeave) CListenerContainer(aMessage, NULL, iServer); + CleanupStack::PushL(listener); + + iListenedEvents.AppendL(listener); + CleanupStack::Pop(); // listener + + listener->AnalyzeRequestL(); + + return KErrNone; + } + +TInt CEventMediatorSession::ListenToEventWithSpecL(const RMessage2& aMessage) + { + HBufC8* specBuf = NULL; + + // Read specification + specBuf = ReadSpecificationFromClientL(aMessage); + CleanupStack::PushL(specBuf); + + // Ownership of specBuf is given to listener + CListenerContainer* listener = new (ELeave) CListenerContainer(aMessage, specBuf, iServer); + CleanupStack::Pop(); // specBuf + CleanupStack::PushL(listener); + + iListenedEvents.AppendL(listener); + CleanupStack::Pop(); // listener + + listener->AnalyzeRequestL(); + + return KErrNone; + } + +void CEventMediatorSession::CancelListening(const RMessage2& aMessage) + { + TInt index; + + while (FindListenerMsg((TEventType)aMessage.Int0(), index)) + { + CompleteListener(index, KErrCancel); + } + } + +void CEventMediatorSession::CancelListeningWithSpecL(const RMessage2& aMessage) + { + HBufC8* specBuf = NULL; + TInt index; + + // Read specification + specBuf = ReadSpecificationFromClientL(aMessage); + CleanupStack::PushL(specBuf); + + // Cancel listeners + while (FindListenerMsg((TEventType)aMessage.Int0(), specBuf, index)) + { + CompleteListener(index, KErrCancel); + } + CleanupStack::PopAndDestroy(); // specBuf + } + +void CEventMediatorSession::CancelAll() + { + TInt nEvents = iListenedEvents.Count(); + for (TInt i = 0; i < nEvents; i++) + { + iListenedEvents.At(i)->Complete(KErrCancel); + delete iListenedEvents.At(i); + iListenedEvents.At(i) = NULL; + } + iListenedEvents.Reset(); + } + +void CEventMediatorSession::ReportEventL(const RMessage2& aMessage) + { + TEventType eventType = (TEventType)aMessage.Int0(); + LOG(Log::Printf(_L("CEventMediatorSession::ReportEventL - event type = %d\n"), eventType)); + // Read data + HBufC8* dataBuf = ReadEventDataFromClientL(aMessage); + CleanupStack::PushL(dataBuf); + // Report event to server + iServer->ReportEventL(eventType, NULL, dataBuf); + CleanupStack::Pop(); + } + +void CEventMediatorSession::ReportEventWithSpecL(const RMessage2& aMessage) + { + TEventType eventType=(TEventType) aMessage.Int0(); + LOG(Log::Printf(_L("CEventMediatorSession::ReportEventWithSpecL - event type = %d\n"), eventType)); + // Read data + HBufC8* dataBuf = ReadEventDataFromClientL(aMessage); + CleanupStack::PushL(dataBuf); + // Read specification + HBufC8* specBuf = ReadSpecificationFromClientL(aMessage); + CleanupStack::PushL(specBuf); + // Report event to server + iServer->ReportEventL(eventType, specBuf, dataBuf); + CleanupStack::PopAndDestroy(); // specBuf + CleanupStack::Pop(); // dataBuf + } + +void CEventMediatorSession::ReportLogEventL(const RMessage2& aMessage) + { + LOG(Log::Printf(_L("CEventMediatorSession::ReportLogEventL\n"))); + // Read event + TLogEvent event; + TPckg eventPckg(event); + aMessage.ReadL(FIRST_ARGUMENT, eventPckg); + + // Create one buffer to contain put everything in a normal buffer and + TInt lengthsDesLth = event.iDesCount * sizeof(TInt); + TInt position = eventPckg.Length(); + TInt dataLength = position + lengthsDesLth + aMessage.Int2(); + HBufC8* dataBuf = HBufC8::NewLC(dataLength); + TPtr8 dataPtr = dataBuf->Des(); + + // Copy event to buffer + dataPtr.Append(eventPckg); + // Read lengths to buffer + TPtr8 tmpPtr(&dataPtr[position], 0, dataLength - position); + aMessage.ReadL(SECOND_ARGUMENT, tmpPtr); + // Read descriptors to the buffer + position= dataPtr.Length(); + tmpPtr.Set(&dataPtr[position], 0, dataLength - position); + aMessage.ReadL(THIRD_ARGUMENT, tmpPtr); + + // Report event to server + iServer->ReportEventL(ELogEvent, NULL, dataBuf); + CleanupStack::Pop(); + } + +TInt CEventMediatorSession::FetchDataL(const RMessage2& aMessage) + { + LOG(Log::Printf(_L("CEventMediatorSession::FetchDataL\n"))); + return iServer->CopyEventDataL(aMessage); + } + +TInt CEventMediatorSession::CheckEventL(const TEventType aType, const TDesC8* aSpec, + const TDesC8* aData, TInt aStatus) + { + TInt index; + TInt listenerCount = 0; + TInt dataLth = 0; + // Some events don't not have data + if (aData) + { + dataLth = aData->Length(); + } + TPckg lengthpckg(dataLth); + TPckgC ptrpckg(aData); + + while (FindListenerMsg(aType, aSpec, index)) + { + RMessage2& listener = iListenedEvents.At(index)->Message(); + + if (aStatus == KErrNone) + { + // Write info about data + listener.WriteL(SECOND_ARGUMENT, lengthpckg); + listener.WriteL(THIRD_ARGUMENT, ptrpckg); + + // Complete listener + listener.Complete(KErrNone); + } + else + { + listener.Complete(aStatus); + } + + delete iListenedEvents.At(index); + iListenedEvents.Delete(index); + listenerCount++; + } + + return listenerCount; + } + +TBool CEventMediatorSession::FindListenerMsg(const TEventType aType, TInt& index) + { + for (TInt i = 0; i < iListenedEvents.Count(); i++) + { + if (iListenedEvents.At(i)->Type() == aType) + { + index=i; + return ETrue; + } + } + return EFalse; + } + +TBool CEventMediatorSession::FindListenerMsg(const TEventType aType, const TDesC8* aSpec, TInt& index) + { + for (TInt i = 0; i < iListenedEvents.Count(); i++) + { + if (iListenedEvents.At(i)->HandlesEvent(aType, aSpec)) + { + index = i; + return ETrue; + } + } + return EFalse; + } + +TBool CEventMediatorSession::FindTaskRequestListenerMsg(TInt& index) + { + for (TInt i = 0; i < iListenedEvents.Count(); i++) + { + if (CSit::EventRequiresSit(iListenedEvents.At(i)->Type())) + { + index = i; + return ETrue; + } + } + return EFalse; + } + +HBufC8* CEventMediatorSession::ReadSpecificationFromClientL(const RMessage2& aMessage) + { + HBufC8* specBuf; + // Read specification descriptor length from client, create specification buffer + const TAny* desPtr = aMessage.Ptr3(); + if (desPtr == NULL) + { + return NULL; + } + TInt specLength = aMessage.GetDesLength(FOURTH_ARGUMENT); + // Create spcification buffer + specBuf = HBufC8::NewLC(specLength); + TPtr8 ptr = specBuf->Des(); + // Read specification + aMessage.ReadL(FOURTH_ARGUMENT, ptr); + CleanupStack::Pop(); // specBuf + return specBuf; + } + +HBufC8* CEventMediatorSession::ReadEventDataFromClientL(const RMessage2& aMessage) + { + HBufC8* dataBuf = NULL; + TInt desLength = aMessage.Int1(); + + if (desLength != 0) // Some events have no data + { + dataBuf = HBufC8::NewLC(desLength); + TPtr8 ptr = dataBuf->Des(); + aMessage.ReadL(THIRD_ARGUMENT, ptr); + CleanupStack::Pop(); // dataBuf + } + return dataBuf; + } + +CListenerContainer* CEventMediatorSession::FindWaitingTaskRequest() + { + CListenerContainer* listener = NULL; + + for (TInt i = 0; i < iListenedEvents.Count(); i++) + { + if (iListenedEvents.At(i)->WaitingForFulfilling()) + { + listener = iListenedEvents.At(i); + break; + } + } + + return listener; + } + +CListenerContainer* CEventMediatorSession::FindListener(TEventType aEventType, + TInt aEventSpecId) + { + CListenerContainer* listener = NULL; + + for (TInt i = 0; i < iListenedEvents.Count(); i++) + { + if (iListenedEvents.At(i)->Type() == aEventType) + { + TEventSpec* eventSpec = (TEventSpec*)(iListenedEvents.At(i)->Specification()->Ptr()); + + if (eventSpec->iId == aEventSpecId) + { + listener = iListenedEvents.At(i); + break; + } + } + } + + return listener; + } + +CListenerContainer* CEventMediatorSession::FindListener(TEventType aEventType, + const TDesC8* aEventSpec) + { + CListenerContainer* listener = NULL; + + for (TInt i = 0; i < iListenedEvents.Count(); i++) + { + if (iListenedEvents.At(i)->HandlesEvent(aEventType, aEventSpec)) + { + listener = iListenedEvents.At(i); + break; + } + } + + return listener; + } + +void CEventMediatorSession::CompleteListener(TEventType aEventType, + const TDesC8* aEventSpec, + TInt aStatus) + { + TInt index; + while (FindListenerMsg(aEventType, aEventSpec, index)) + { + CompleteListener(index, aStatus); + } + } + +void CEventMediatorSession::CompleteListener(TInt aIndex, TInt aStatus) + { + iListenedEvents.At(aIndex)->Complete(aStatus); + delete iListenedEvents.At(aIndex); + iListenedEvents.Delete(aIndex); + } + +void CEventMediatorSession::CompleteTaskRequests(TInt aStatus) + { + LOG(Log::Printf(_L("CEventMediatorSession::CompleteTaskRequests\n"))); + TInt index; + while (FindTaskRequestListenerMsg(index)) + { + CompleteListener(index, aStatus); + } + } + +TBool CEventMediatorSession::IsASitSession() + { + return iIsSitSession; + } + +void CEventMediatorSession::NewEventSpecIdL(const RMessage2& aMessage) + { + TInt newEventSpecId = iServer->NewEventSpecId(); + TPckg newEventSpecIdDes(newEventSpecId); + aMessage.WriteL(FIRST_ARGUMENT, newEventSpecIdDes); + } + +TInt CEventMediatorSession::DeletePrivateFiles() + { + TRAPD(err, DeletePrivateFilesL()); + if ( err ) + { + LOG(Log::Printf(_L("DeletePrivateFilesL() leave error %d\n"), err)); + return err; + } + + return KErrNone; + } + +void CEventMediatorSession::DeletePrivateFilesL() + { + LOG(Log::Printf(_L("DeletePrivateFilesL() called\n"))); + + CFileMan* fileMan = CFileMan::NewL(iFs); + CleanupStack::PushL(fileMan); + + TPath privateDir; + User::LeaveIfError(iFs.PrivatePath(privateDir)); + + TInt err = fileMan->RmDir(privateDir); + if (err != KErrNone && err != KErrPathNotFound && err != KErrNotFound) + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(); //fileMan + } + +TInt CEventMediatorSession::GetEventLogSize( + const RMessage2& aMessage) + { + if ( iEventLogFileOpen ) + { + iEventLogFile.Close(); + iEventLogFileOpen = EFalse; + } + + TInt err = iEventLogFile.Open(iFs, iServer->EventLogFileName(), EFileRead | EFileShareAny); + if ( err ) + return err; + + TInt size(0); + err = iEventLogFile.Size(size); + if ( err ) + { + iEventLogFile.Close(); + return err; + } + + TPckg sizePckg(size); + err = aMessage.Write(FIRST_ARGUMENT, sizePckg); + if ( err ) + { + iEventLogFile.Close(); + return err; + } + + iEventLogFileOpen = ETrue; + + return KErrNone; + } + +TInt CEventMediatorSession::GetEventLogHeader( + const RMessage2& aMessage) + { + TInt err(0); + + if ( !iEventLogFileOpen ) + { + err = iEventLogFile.Open(iFs, iServer->EventLogFileName(), EFileRead | EFileShareAny); + if ( err ) + return err; + iEventLogFileOpen = ETrue; + } + + TInt position = 0; + err = iEventLogFile.Seek(ESeekStart, position); + if (err != KErrNone) + return err; + + TBuf8 fileHeaderBuf; + err = iEventLogFile.Read(fileHeaderBuf, EVENTLOG_FILE_HEADER_LTH); + if (err != KErrNone) + return err; + + TRAP(err, aMessage.WriteL(FIRST_ARGUMENT, fileHeaderBuf)); + if ( err ) + return err; + + return KErrNone; + } + +TInt CEventMediatorSession::GetEventLogData( + const RMessage2& aMessage) + { + TInt err(0); + + if ( !iEventLogFileOpen ) + { + err = iEventLogFile.Open(iFs, iServer->EventLogFileName(), EFileRead | EFileShareAny); + if ( err ) + return err; + iEventLogFileOpen = ETrue; + } + + TInt size(0); + err = iEventLogFile.Size(size); + if ( err ) + return err; + + if ( size < EVENTLOG_FILE_HEADER_LTH ) + return KErrNotFound; + + HBufC8* eventLogFileBuf = NULL; + TRAP(err, eventLogFileBuf = HBufC8::NewL(size)); + if ( err ) + { + return err; + } + + TPtr8 eventLogDataPtr(eventLogFileBuf->Des()); + TInt position(0); + err = iEventLogFile.Seek(ESeekStart, position); + if ( err ) + { + delete eventLogFileBuf; + return err; + } + err = iEventLogFile.Read(eventLogDataPtr); // iLogFileSize); + if ( err ) + { + delete eventLogFileBuf; + return err; + } + + TRAP( err, aMessage.WriteL(FIRST_ARGUMENT, eventLogDataPtr)); + if ( err ) + { + delete eventLogFileBuf; + return err; + } + + delete eventLogFileBuf; + eventLogFileBuf = NULL; + + return KErrNone; + } + +TInt CEventMediatorSession::ClearEventLog() + { + if ( iEventLogFileOpen ) + { + iEventLogFile.Close(); + iEventLogFileOpen = EFalse; + } + + TInt err = iFs.Delete(iServer->EventLogFileName()); + + return err; + } + + // ============================= CEventMediatorServer ============================= CListenerContainer::CListenerContainer(const RMessage2& aMessage, TDesC8* aSpec, - CEventMediatorServer& aServer) + CEventMediatorServer* aServer) : iSpec(aSpec), iMessage(aMessage), iServer(aServer) { iEventType = Type(); @@ -612,23 +1253,23 @@ if (CSit::EventRequiresSit(iEventType)) { LOG(Log::Printf(_L("CListenerContainer::AnalyzeRequestL - event type = %d, requires SIT\n"), iEventType)); - iServer.MakeSureSitIsRunningL(); - iServer.TaskRequestArrivedL(this); + iServer->MakeSureSitIsRunningL(); + iServer->TaskRequestArrivedL(this); } // If this event listening request is the one // made by the SIT task arrival observer... if (iEventType == ETaskArrivedEvent) { - iServer.SetTaskArrivalListenerL(this); - iServer.TaskArrivalObservationRequestArrivedL(); + iServer->SetTaskArrivalListenerL(this); + iServer->TaskArrivalObservationRequestArrivedL(); } // If this event listening request is one // made by a SIT TH to fetch a task... if (iEventType == EFetchTaskInfoEvent) { - iServer.TaskRequestEventSpecFetchingRequestArrivedL(this); + iServer->TaskRequestEventSpecFetchingRequestArrivedL(this); } // If the event listening request is one @@ -636,7 +1277,7 @@ // of the task request it is handling if (CSit::IsTaskCancellationObservationRequest(iEventType)) { - iServer.TaskCancellationObservationRequestArrivedL(this); + iServer->TaskCancellationObservationRequestArrivedL(this); } } @@ -644,9 +1285,9 @@ { delete iSpec; - if (iServer.TaskArrivalListener() == this) + if (iServer->TaskArrivalListener() == this) { - iServer.ClearTaskArrivalListener(); + iServer->ClearTaskArrivalListener(); } } @@ -683,7 +1324,7 @@ { // Complete the task request cancellation // observation, if found - iServer.CompleteListener(cancelEventType, iSpec, KErrNone); + iServer->CompleteListener(cancelEventType, iSpec, KErrNone); } } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediator/src/eventmediatorsession.cpp --- a/vpnengine/eventmediator/src/eventmediatorsession.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,666 +0,0 @@ -/* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This module defines event mediator server side session. -* -*/ - -#include "eventmediatorsession.h" -#include "eventmediator.h" -#include "eventmediatorclientservercommon.h" -#include "eventlogger.h" -#include "sit.h" -#include "log_em.h" - -#define FIRST_ARGUMENT 0 -#define SECOND_ARGUMENT 1 -#define THIRD_ARGUMENT 2 -#define FOURTH_ARGUMENT 3 - - -// ============================= CEventMediatorSession ============================= - -CEventMediatorSession* CEventMediatorSession::NewL(CEventMediatorServer& aServer, - TBool aIsSitSession) - { - LOG(Log::Printf(_L("CEventMediatorSession::NewL - begin\n"))); - - CEventMediatorSession* self = new (ELeave) CEventMediatorSession(aServer, aIsSitSession); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - - LOG(Log::Printf(_L("CEventMediatorSession::NewL - end\n"))); - return self; - } - -CEventMediatorSession::CEventMediatorSession(CEventMediatorServer& aServer, TBool aIsSitSession) - : iListenedEvents(2), iServer(aServer), iIsSitSession(aIsSitSession) - { - } - -void CEventMediatorSession::ConstructL() - { - if ( !IsASitSession() ) - { - User::LeaveIfError(iFs.Connect()); // For EventLog - iEventLogFileOpen = EFalse; - } - } - - -CEventMediatorSession::~CEventMediatorSession(void) - { - LOG(Log::Printf(_L("CEventMediatorSession::~CEventMediatorSession\n"))); - CancelAll(); - - // If this too is a normal session and is dying, - // decrement the normal session count by one - if (!IsASitSession()) - { - iEventLogFile.Close(); - iEventLogFileOpen = EFalse; - iFs.Close(); - } - iServer.SessionDeleted(IsASitSession()); - } - -void CEventMediatorSession::ServiceL(const RMessage2& aMessage) - { - TInt status = 0; - - switch (aMessage.Function()) - { - case KEventMediatorListen: - ListenToEventL(aMessage); - break; - - case KEventMediatorListenWithSpec: - ListenToEventWithSpecL(aMessage); - break; - - case KEventMediatorCancel: - CancelListening(aMessage); - aMessage.Complete(KErrNone); - break; - - case KEventMediatorCancelWithSpec: - CancelListeningWithSpecL(aMessage); - aMessage.Complete(KErrNone); - break; - - case KEventMediatorCancelAll: - CancelAll(); - aMessage.Complete(KErrNone); - break; - - case KEventMediatorReportEvent: - ReportEventL(aMessage); - aMessage.Complete(KErrNone); - break; - - case KEventMediatorReportEventWithSpec: - ReportEventWithSpecL(aMessage); - aMessage.Complete(KErrNone); - break; - - case KEventMediatorFetchData: - status = FetchDataL(aMessage); - aMessage.Complete(status); - break; - - case KEventMediatorReportLogEvent: - ReportLogEventL(aMessage); - aMessage.Complete(KErrNone); - break; - - case KEventMediatorNewEventSpecId: - NewEventSpecIdL(aMessage); - aMessage.Complete(KErrNone); - break; - case KEventMediatorDeletePrivateFiles: - status = DeletePrivateFiles(); - aMessage.Complete(status); - break; - - case KEventMediatorGetEventLogSize: - status = GetEventLogSize(aMessage); - aMessage.Complete(status); - break; - - case KEventMediatorGetEventLogHeader: - status = GetEventLogHeader(aMessage); - aMessage.Complete(status); - break; - case KEventMediatorGetEventLogData: - status = GetEventLogData(aMessage); - aMessage.Complete(status); - break; - case KEventMediatorClearEventLog: - status = ClearEventLog(); - aMessage.Complete(status); - break; - default: - aMessage.Complete(KErrGeneral); - break; - } - } - -TInt CEventMediatorSession::ListenToEventL(const RMessage2& aMessage) - { - CListenerContainer* listener = new (ELeave) CListenerContainer(aMessage, NULL, iServer); - CleanupStack::PushL(listener); - - iListenedEvents.AppendL(listener); - CleanupStack::Pop(); // listener - - listener->AnalyzeRequestL(); - - return KErrNone; - } - -TInt CEventMediatorSession::ListenToEventWithSpecL(const RMessage2& aMessage) - { - HBufC8* specBuf = NULL; - - // Read specification - specBuf = ReadSpecificationFromClientL(aMessage); - CleanupStack::PushL(specBuf); - - // Ownership of specBuf is given to listener - CListenerContainer* listener = new (ELeave) CListenerContainer(aMessage, specBuf, iServer); - CleanupStack::Pop(); // specBuf - CleanupStack::PushL(listener); - - iListenedEvents.AppendL(listener); - CleanupStack::Pop(); // listener - - listener->AnalyzeRequestL(); - - return KErrNone; - } - -void CEventMediatorSession::CancelListening(const RMessage2& aMessage) - { - TInt index; - - while (FindListenerMsg((TEventType)aMessage.Int0(), index)) - { - CompleteListener(index, KErrCancel); - } - } - -void CEventMediatorSession::CancelListeningWithSpecL(const RMessage2& aMessage) - { - HBufC8* specBuf = NULL; - TInt index; - - // Read specification - specBuf = ReadSpecificationFromClientL(aMessage); - CleanupStack::PushL(specBuf); - - // Cancel listeners - while (FindListenerMsg((TEventType)aMessage.Int0(), specBuf, index)) - { - CompleteListener(index, KErrCancel); - } - CleanupStack::PopAndDestroy(); // specBuf - } - -void CEventMediatorSession::CancelAll() - { - TInt nEvents = iListenedEvents.Count(); - for (TInt i = 0; i < nEvents; i++) - { - iListenedEvents.At(i)->Complete(KErrCancel); - delete iListenedEvents.At(i); - iListenedEvents.At(i) = NULL; - } - iListenedEvents.Reset(); - } - -void CEventMediatorSession::ReportEventL(const RMessage2& aMessage) - { - TEventType eventType = (TEventType)aMessage.Int0(); - LOG(Log::Printf(_L("CEventMediatorSession::ReportEventL - event type = %d\n"), eventType)); - // Read data - HBufC8* dataBuf = ReadEventDataFromClientL(aMessage); - CleanupStack::PushL(dataBuf); - // Report event to server - iServer.ReportEventL(eventType, NULL, dataBuf); - CleanupStack::Pop(); - } - -void CEventMediatorSession::ReportEventWithSpecL(const RMessage2& aMessage) - { - TEventType eventType=(TEventType) aMessage.Int0(); - LOG(Log::Printf(_L("CEventMediatorSession::ReportEventWithSpecL - event type = %d\n"), eventType)); - // Read data - HBufC8* dataBuf = ReadEventDataFromClientL(aMessage); - CleanupStack::PushL(dataBuf); - // Read specification - HBufC8* specBuf = ReadSpecificationFromClientL(aMessage); - CleanupStack::PushL(specBuf); - // Report event to server - iServer.ReportEventL(eventType, specBuf, dataBuf); - CleanupStack::PopAndDestroy(); // specBuf - CleanupStack::Pop(); // dataBuf - } - -void CEventMediatorSession::ReportLogEventL(const RMessage2& aMessage) - { - LOG(Log::Printf(_L("CEventMediatorSession::ReportLogEventL\n"))); - // Read event - TLogEvent event; - TPckg eventPckg(event); - aMessage.ReadL(FIRST_ARGUMENT, eventPckg); - - // Create one buffer to contain put everything in a normal buffer and - TInt lengthsDesLth = event.iDesCount * sizeof(TInt); - TInt position = eventPckg.Length(); - TInt dataLength = position + lengthsDesLth + aMessage.Int2(); - HBufC8* dataBuf = HBufC8::NewLC(dataLength); - TPtr8 dataPtr = dataBuf->Des(); - - // Copy event to buffer - dataPtr.Append(eventPckg); - // Read lengths to buffer - TPtr8 tmpPtr(&dataPtr[position], 0, dataLength - position); - aMessage.ReadL(SECOND_ARGUMENT, tmpPtr); - // Read descriptors to the buffer - position= dataPtr.Length(); - tmpPtr.Set(&dataPtr[position], 0, dataLength - position); - aMessage.ReadL(THIRD_ARGUMENT, tmpPtr); - - // Report event to server - iServer.ReportEventL(ELogEvent, NULL, dataBuf); - CleanupStack::Pop(); - } - -TInt CEventMediatorSession::FetchDataL(const RMessage2& aMessage) - { - LOG(Log::Printf(_L("CEventMediatorSession::FetchDataL\n"))); - return iServer.CopyEventDataL(aMessage); - } - -TInt CEventMediatorSession::CheckEventL(const TEventType aType, const TDesC8* aSpec, - const TDesC8* aData, TInt aStatus) - { - TInt index; - TInt listenerCount = 0; - TInt dataLth = 0; - // Some events don't not have data - if (aData) - { - dataLth = aData->Length(); - } - TPckg lengthpckg(dataLth); - TPckgC ptrpckg(aData); - - while (FindListenerMsg(aType, aSpec, index)) - { - RMessage2& listener = iListenedEvents.At(index)->Message(); - - if (aStatus == KErrNone) - { - // Write info about data - listener.WriteL(SECOND_ARGUMENT, lengthpckg); - listener.WriteL(THIRD_ARGUMENT, ptrpckg); - - // Complete listener - listener.Complete(KErrNone); - } - else - { - listener.Complete(aStatus); - } - - delete iListenedEvents.At(index); - iListenedEvents.Delete(index); - listenerCount++; - } - - return listenerCount; - } - -TBool CEventMediatorSession::FindListenerMsg(const TEventType aType, TInt& index) - { - for (TInt i = 0; i < iListenedEvents.Count(); i++) - { - if (iListenedEvents.At(i)->Type() == aType) - { - index=i; - return ETrue; - } - } - return EFalse; - } - -TBool CEventMediatorSession::FindListenerMsg(const TEventType aType, const TDesC8* aSpec, TInt& index) - { - for (TInt i = 0; i < iListenedEvents.Count(); i++) - { - if (iListenedEvents.At(i)->HandlesEvent(aType, aSpec)) - { - index = i; - return ETrue; - } - } - return EFalse; - } - -TBool CEventMediatorSession::FindTaskRequestListenerMsg(TInt& index) - { - for (TInt i = 0; i < iListenedEvents.Count(); i++) - { - if (CSit::EventRequiresSit(iListenedEvents.At(i)->Type())) - { - index = i; - return ETrue; - } - } - return EFalse; - } - -HBufC8* CEventMediatorSession::ReadSpecificationFromClientL(const RMessage2& aMessage) - { - HBufC8* specBuf; - // Read specification descriptor length from client, create specification buffer - const TAny* desPtr = aMessage.Ptr3(); - if (desPtr == NULL) - { - return NULL; - } - TInt specLength = aMessage.GetDesLength(FOURTH_ARGUMENT); - // Create spcification buffer - specBuf = HBufC8::NewLC(specLength); - TPtr8 ptr = specBuf->Des(); - // Read specification - aMessage.ReadL(FOURTH_ARGUMENT, ptr); - CleanupStack::Pop(); // specBuf - return specBuf; - } - -HBufC8* CEventMediatorSession::ReadEventDataFromClientL(const RMessage2& aMessage) - { - HBufC8* dataBuf = NULL; - TInt desLength = aMessage.Int1(); - - if (desLength != 0) // Some events have no data - { - dataBuf = HBufC8::NewLC(desLength); - TPtr8 ptr = dataBuf->Des(); - aMessage.ReadL(THIRD_ARGUMENT, ptr); - CleanupStack::Pop(); // dataBuf - } - return dataBuf; - } - -CListenerContainer* CEventMediatorSession::FindWaitingTaskRequest() - { - CListenerContainer* listener = NULL; - - for (TInt i = 0; i < iListenedEvents.Count(); i++) - { - if (iListenedEvents.At(i)->WaitingForFulfilling()) - { - listener = iListenedEvents.At(i); - break; - } - } - - return listener; - } - -CListenerContainer* CEventMediatorSession::FindListener(TEventType aEventType, - TInt aEventSpecId) - { - CListenerContainer* listener = NULL; - - for (TInt i = 0; i < iListenedEvents.Count(); i++) - { - if (iListenedEvents.At(i)->Type() == aEventType) - { - TEventSpec* eventSpec = (TEventSpec*)(iListenedEvents.At(i)->Specification()->Ptr()); - - if (eventSpec->iId == aEventSpecId) - { - listener = iListenedEvents.At(i); - break; - } - } - } - - return listener; - } - -CListenerContainer* CEventMediatorSession::FindListener(TEventType aEventType, - const TDesC8* aEventSpec) - { - CListenerContainer* listener = NULL; - - for (TInt i = 0; i < iListenedEvents.Count(); i++) - { - if (iListenedEvents.At(i)->HandlesEvent(aEventType, aEventSpec)) - { - listener = iListenedEvents.At(i); - break; - } - } - - return listener; - } - -void CEventMediatorSession::CompleteListener(TEventType aEventType, - const TDesC8* aEventSpec, - TInt aStatus) - { - TInt index; - while (FindListenerMsg(aEventType, aEventSpec, index)) - { - CompleteListener(index, aStatus); - } - } - -void CEventMediatorSession::CompleteListener(TInt aIndex, TInt aStatus) - { - iListenedEvents.At(aIndex)->Complete(aStatus); - delete iListenedEvents.At(aIndex); - iListenedEvents.Delete(aIndex); - } - -void CEventMediatorSession::CompleteTaskRequests(TInt aStatus) - { - LOG(Log::Printf(_L("CEventMediatorSession::CompleteTaskRequests\n"))); - TInt index; - while (FindTaskRequestListenerMsg(index)) - { - CompleteListener(index, aStatus); - } - } - -TBool CEventMediatorSession::IsASitSession() - { - return iIsSitSession; - } - -void CEventMediatorSession::NewEventSpecIdL(const RMessage2& aMessage) - { - TInt newEventSpecId = iServer.NewEventSpecId(); - TPckg newEventSpecIdDes(newEventSpecId); - aMessage.WriteL(FIRST_ARGUMENT, newEventSpecIdDes); - } - -TInt CEventMediatorSession::DeletePrivateFiles() - { - TRAPD(err, DeletePrivateFilesL()); - if ( err ) - { - LOG(Log::Printf(_L("DeletePrivateFilesL() leave error %d\n"), err)); - return err; - } - - return KErrNone; - } - -void CEventMediatorSession::DeletePrivateFilesL() - { - LOG(Log::Printf(_L("DeletePrivateFilesL() called\n"))); - - CFileMan* fileMan = CFileMan::NewL(iFs); - CleanupStack::PushL(fileMan); - - TPath privateDir; - User::LeaveIfError(iFs.PrivatePath(privateDir)); - - TInt err = fileMan->RmDir(privateDir); - if (err != KErrNone && err != KErrPathNotFound && err != KErrNotFound) - { - User::Leave(err); - } - CleanupStack::PopAndDestroy(); //fileMan - } - -TInt CEventMediatorSession::GetEventLogSize( - const RMessage2& aMessage) - { - if ( iEventLogFileOpen ) - { - iEventLogFile.Close(); - iEventLogFileOpen = EFalse; - } - - TInt err = iEventLogFile.Open(iFs, iServer.EventLogFileName(), EFileRead | EFileShareAny); - if ( err ) - return err; - - TInt size(0); - err = iEventLogFile.Size(size); - if ( err ) - { - iEventLogFile.Close(); - return err; - } - - TPckg sizePckg(size); - err = aMessage.Write(FIRST_ARGUMENT, sizePckg); - if ( err ) - { - iEventLogFile.Close(); - return err; - } - - iEventLogFileOpen = ETrue; - - return KErrNone; - } - -TInt CEventMediatorSession::GetEventLogHeader( - const RMessage2& aMessage) - { - TInt err(0); - - if ( !iEventLogFileOpen ) - { - err = iEventLogFile.Open(iFs, iServer.EventLogFileName(), EFileRead | EFileShareAny); - if ( err ) - return err; - iEventLogFileOpen = ETrue; - } - - TInt position = 0; - err = iEventLogFile.Seek(ESeekStart, position); - if (err != KErrNone) - return err; - - TBuf8 fileHeaderBuf; - err = iEventLogFile.Read(fileHeaderBuf, EVENTLOG_FILE_HEADER_LTH); - if (err != KErrNone) - return err; - - TRAP(err, aMessage.WriteL(FIRST_ARGUMENT, fileHeaderBuf)); - if ( err ) - return err; - - return KErrNone; - } - -TInt CEventMediatorSession::GetEventLogData( - const RMessage2& aMessage) - { - TInt err(0); - - if ( !iEventLogFileOpen ) - { - err = iEventLogFile.Open(iFs, iServer.EventLogFileName(), EFileRead | EFileShareAny); - if ( err ) - return err; - iEventLogFileOpen = ETrue; - } - - TInt size(0); - err = iEventLogFile.Size(size); - if ( err ) - return err; - - if ( size < EVENTLOG_FILE_HEADER_LTH ) - return KErrNotFound; - - HBufC8* eventLogFileBuf = NULL; - TRAP(err, eventLogFileBuf = HBufC8::NewL(size)); - if ( err ) - { - return err; - } - - TPtr8 eventLogDataPtr(eventLogFileBuf->Des()); - TInt position(0); - err = iEventLogFile.Seek(ESeekStart, position); - if ( err ) - { - delete eventLogFileBuf; - return err; - } - err = iEventLogFile.Read(eventLogDataPtr); // iLogFileSize); - if ( err ) - { - delete eventLogFileBuf; - return err; - } - - TRAP( err, aMessage.WriteL(FIRST_ARGUMENT, eventLogDataPtr)); - if ( err ) - { - delete eventLogFileBuf; - return err; - } - - delete eventLogFileBuf; - eventLogFileBuf = NULL; - - return KErrNone; - } - -TInt CEventMediatorSession::ClearEventLog() - { - if ( iEventLogFileOpen ) - { - iEventLogFile.Close(); - iEventLogFileOpen = EFalse; - } - - TInt err = iFs.Delete(iServer.EventLogFileName()); - - return err; - } - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediatorapi/inc/eventmediatorclientservercommon.h --- a/vpnengine/eventmediatorapi/inc/eventmediatorclientservercommon.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Commond definitions with the even -* -*/ - -#ifndef EVENTMEDIATORCLIENTSERVERCOMMON_H_ -#define EVENTMEDIATORCLIENTSERVERCOMMON_H_ - -enum - { - KEventMediatorListen, - KEventMediatorListenWithSpec, - KEventMediatorCancel, - KEventMediatorCancelWithSpec, - KEventMediatorCancelAll, - KEventMediatorReportEvent, - KEventMediatorReportEventWithSpec, - KEventMediatorFetchData, - KEventMediatorReportLogEvent, - KEventMediatorNewEventSpecId, - KEventMediatorDeletePrivateFiles, - KEventMediatorGetEventLogSize, - KEventMediatorGetEventLogHeader, - KEventMediatorGetEventLogData, - KEventMediatorClearEventLog - }; - - -#endif /* EVENTMEDIATORCLIENTSERVERCOMMON_H_ */ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/eventmediatorapi/src/EventMediatorAPI.cpp --- a/vpnengine/eventmediatorapi/src/EventMediatorAPI.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/eventmediatorapi/src/EventMediatorAPI.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -17,7 +17,7 @@ #include -#include "eventmediatorclientservercommon.h" +#include "eventmediator.h" #include "eventmediatorapi.h" #include "eventlogger.h" #include "clistatic.h" @@ -45,44 +45,32 @@ *----------------------------------------------------------*/ EXPORT_C TInt REventMediator::Connect(void) { - static const TUint KMaxRetryCount = 2; TInt ret = KErrNone; TRAP(ret, CreateListenedEventsListL()); - if (ret == KErrNone) + if (ret != KErrNone) + { + return ret; + } + + TInt retry=2; + for (;;) { - for (TUint i = 0; i < KMaxRetryCount; i++) - { - ret = CreateSession(KEventMediatorServer, - TVersion(KEventMediatorMajorVersionNumber, - KEventMediatorMinorVersionNumber, - KEventMediatorBuildVersionNumber), - 2 * KDefaultMessageSlots); - - if ( ret == KErrNotFound ) - { - //do nothing - } - else if ( ret == KErrServerTerminated ) - { - //Wait for one second so that the Eventmed - //and sit has sufficient time to go down. - User::After(500000); - } - else - { - break; - } + TInt r=CreateSession(KEventMediatorServer, + TVersion(KEventMediatorMajorVersionNumber, + KEventMediatorMinorVersionNumber, + KEventMediatorBuildVersionNumber), + 2 * KDefaultMessageSlots); + + if (r!=KErrNotFound && r!=KErrServerTerminated) + return r; + if (--retry==0) + return r; + r = Launcher::LaunchServer(KEventMediatorServer, KEventMediatorFile, + KEventMediatorUid3); - ret = Launcher::LaunchServer(KEventMediatorServer, KEventMediatorFile, - KEventMediatorUid3); - - if ( ret != KErrNone && ret !=KErrAlreadyExists) - { - break; - } - } + if (r!=KErrNone && r!=KErrAlreadyExists) + return r; } - return ret; } void REventMediator::CreateListenedEventsListL() @@ -120,7 +108,7 @@ { LOG(Log::Printf(_L("REventMediator::ListenToEvent(TEventType aType, MEventObserver& aObserver) - calling SendReceive\n"))); - SendReceive(KEventMediatorListen, + SendReceive(CEventMediatorSession::KEventMediatorListen, TIpcArgs(aType, &(listener->iDataLengthPckg), &(listener->iSrvDataPtrPckg)), @@ -153,7 +141,7 @@ { LOG(Log::Printf(_L("REventMediator::ListenToEvent(TEventType aType, TDesC8& aEventSpec, MEventObserver& aObserver) - calling SendReceive\n"))); - SendReceive(KEventMediatorListenWithSpec, + SendReceive(CEventMediatorSession::KEventMediatorListenWithSpec, TIpcArgs(aType, &(listener->iDataLengthPckg), &(listener->iSrvDataPtrPckg), @@ -210,17 +198,17 @@ EXPORT_C TInt REventMediator::ReportEvent(TEventType aType) { - return SendReceive(KEventMediatorReportEvent, TIpcArgs(aType, 0, NULL)); + return SendReceive(CEventMediatorSession::KEventMediatorReportEvent, TIpcArgs(aType, 0, NULL)); } EXPORT_C TInt REventMediator::ReportEvent(TEventType aType, TDesC8& aData) { - return SendReceive(KEventMediatorReportEvent, TIpcArgs(aType, aData.Length(), &aData)); + return SendReceive(CEventMediatorSession::KEventMediatorReportEvent, TIpcArgs(aType, aData.Length(), &aData)); } EXPORT_C TInt REventMediator::ReportEvent(TEventType aType, TDesC8& aEventSpec, TDesC8& aData) { - return SendReceive(KEventMediatorReportEventWithSpec, TIpcArgs(aType, aData.Length(), &aData, &aEventSpec)); + return SendReceive(CEventMediatorSession::KEventMediatorReportEventWithSpec, TIpcArgs(aType, aData.Length(), &aData, &aEventSpec)); } EXPORT_C TInt REventMediator::ReportLogEvent(TUid& aSrc, TLogCategory aCategory, TUint aMsgId, TInt aDesCount,...) @@ -276,7 +264,7 @@ TInt specId = 0; TPckg specIdDes(specId); - SendReceive(KEventMediatorNewEventSpecId, TIpcArgs(&specIdDes)); + SendReceive(CEventMediatorSession::KEventMediatorNewEventSpecId, TIpcArgs(&specIdDes)); return specId; } @@ -285,14 +273,14 @@ { LOG(Log::Printf(_L("REventMediator::CancelListenToEvent(TEventType aType)\n"))); - SendReceive(KEventMediatorCancel, TIpcArgs(aType)); + SendReceive(CEventMediatorSession::KEventMediatorCancel, TIpcArgs(aType)); } TInt REventMediator::CancelListenToEvent(TEventType aType, TDesC8& aEventSpec) { LOG(Log::Printf(_L("REventMediator::CancelListenToEvent(TEventType aType, TDesC8& aEventSpec)\n"))); - return SendReceive(KEventMediatorCancelWithSpec, TIpcArgs(aType, NULL, NULL, &aEventSpec)); + return SendReceive(CEventMediatorSession::KEventMediatorCancelWithSpec, TIpcArgs(aType, NULL, NULL, &aEventSpec)); } TInt REventMediator::FetchData(TAny* aSrvPtr, TDes8& aDataPtr) @@ -300,7 +288,7 @@ LOG(Log::Printf(_L("REventMediator::FetchData()\n"))); TRequestStatus status; - SendReceive(KEventMediatorFetchData, + SendReceive(CEventMediatorSession::KEventMediatorFetchData, TIpcArgs(aSrvPtr, &aDataPtr), status); User::WaitForRequest(status); @@ -387,7 +375,7 @@ EXPORT_C TInt REventMediator::DeletePrivateFiles() { - return SendReceive (KEventMediatorDeletePrivateFiles, TIpcArgs()); + return SendReceive (CEventMediatorSession::KEventMediatorDeletePrivateFiles, TIpcArgs()); } @@ -395,25 +383,25 @@ { TPckg eventLogSizePckg(aEventLogSize); - return SendReceive (KEventMediatorGetEventLogSize, + return SendReceive (CEventMediatorSession::KEventMediatorGetEventLogSize, TIpcArgs(&eventLogSizePckg)); } EXPORT_C TInt REventMediator::GetEventLogHeader(TDes8& aEventLogHeader) { - return SendReceive (KEventMediatorGetEventLogHeader, + return SendReceive (CEventMediatorSession::KEventMediatorGetEventLogHeader, TIpcArgs(&aEventLogHeader)); } EXPORT_C TInt REventMediator::GetEventLogData(TDes8& aEventLogData) { - return SendReceive (KEventMediatorGetEventLogData, + return SendReceive (CEventMediatorSession::KEventMediatorGetEventLogData, TIpcArgs(&aEventLogData)); } EXPORT_C TInt REventMediator::ClearEventLog() { - return SendReceive (KEventMediatorClearEventLog, TIpcArgs()); + return SendReceive (CEventMediatorSession::KEventMediatorClearEventLog, TIpcArgs()); } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikepolparser/inc/ikepolparser.h --- a/vpnengine/ikepolparser/inc/ikepolparser.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikepolparser/inc/ikepolparser.h Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -11,10 +11,12 @@ * * Contributors: * -* Description: IKE policy parser main module +* Description: IKE policy parser main module * */ + + #ifndef __IKEPOLPARSER_H #define __IKEPOLPARSER_H @@ -291,8 +293,7 @@ TOwnCertInfo iOwnCert; TCertInfo iPrivKey; TCertInfo iPeerCert; - TBool iUseCache; // Use credential cache - TBool iSoftToken; // Use soft token + }; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikepolparser/src/ikepolparser.cpp --- a/vpnengine/ikepolparser/src/ikepolparser.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikepolparser/src/ikepolparser.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -170,8 +170,6 @@ CleanupStack::Pop(ca_copy); } } - iSoftToken = aData->iSoftToken; - iUseCache = aData->iUseCache; } void CIkeData::Empty() @@ -728,20 +726,6 @@ //PeerCerts List else if (token.CompareF(_L("PEER_CERTS:"))==0) //CompareF ignores case err = ParsePeerCerts(aConf); - else if (token.CompareF(_L("USE_CACHE:"))==0) //CompareF ignores case - { - aConf->iUseCache = EFalse; - token.Set(NextToken()); - if (token.CompareF(_L("True"))==0) - aConf->iUseCache = ETrue; - } - else if (token.CompareF(_L("TOKEN_TYPE:"))==0) //CompareF ignores case - { - aConf->iSoftToken = EFalse; - token.Set(NextToken()); - if (token.CompareF(_L("SOFT"))==0) - aConf->iSoftToken = ETrue; - } } if ( err == KErrNone ) errCA=CheckPolicy(aConf); @@ -1122,25 +1106,6 @@ err = BufferAppend(aPolBfr, line); if (err != KErrNone) return err; - - line.Copy(_L8("USE_CACHE: ")); - if (aConf->iUseCache) - line.Append(_L("TRUE\n")); - else - line.Append(_L("FALSE\n")); - err = BufferAppend(aPolBfr, line); - if (err != KErrNone) - return err; - - line.Copy(_L8("TOKEN_TYPE: ")); - if (aConf->iSoftToken) - line.Append(_L("SOFT\n")); - else - line.Append(_L("HARD\n")); - err = BufferAppend(aPolBfr, line); - if (err != KErrNone) - return err; - if ( aConf->iCRACKLAMUserName ) { line.Copy(_L8("CRACK_LAM_USERNAME: ")); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikeutils/bwins/ikeutilsu.def --- a/vpnengine/ikeutils/bwins/ikeutilsu.def Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikeutils/bwins/ikeutilsu.def Wed Oct 13 15:42:16 2010 +0300 @@ -28,5 +28,4 @@ ?NewL@CIpsecSaSpiRetriever@@SAPAV1@AAVMIpsecSaSpiRetrieverCallback@@AAVCPFKeySocketIf@@@Z @ 27 NONAME ; class CIpsecSaSpiRetriever * CIpsecSaSpiRetriever::NewL(class MIpsecSaSpiRetrieverCallback &, class CPFKeySocketIf &) ?GetIpseSaSpecListLC@CIpsecPolicyUtil@@QAEPAVCIpsecSaSpecList@@VTInetAddr@@000HK@Z @ 28 NONAME ; class CIpsecSaSpecList * CIpsecPolicyUtil::GetIpseSaSpecListLC(class TInetAddr, class TInetAddr, class TInetAddr, class TInetAddr, int, unsigned long) ?DestAddr@TIkeSendQueueItem@@QAEABVTInetAddr@@XZ @ 29 NONAME ; class TInetAddr const & TIkeSendQueueItem::DestAddr(void) - ?GetPolicyIdL@CmUtils@@SAXKAAV?$TBuf@$0DC@@@@Z @ 30 NONAME ; void CmUtils::GetPolicyIdL(unsigned long, class TBuf<50> &) diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikeutils/eabi/ikeutilsu.def --- a/vpnengine/ikeutils/eabi/ikeutilsu.def Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikeutils/eabi/ikeutilsu.def Wed Oct 13 15:42:16 2010 +0300 @@ -46,5 +46,4 @@ _ZTV19TPfkeySupportedAuth @ 45 NONAME _ZTV20CIpsecSaSpiRetriever @ 46 NONAME _ZTV22TPfkeySupportedEncrypt @ 47 NONAME - _ZN7CmUtils12GetPolicyIdLEmR4TBufILi50EE @ 48 NONAME diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikeutils/group/ikeutils.mmp --- a/vpnengine/ikeutils/group/ikeutils.mmp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikeutils/group/ikeutils.mmp Wed Oct 13 15:42:16 2010 +0300 @@ -35,7 +35,6 @@ SOURCE pfkeymsg.cpp SOURCE pfkeysocketif.cpp SOURCE vpnaddrinfo.cpp -SOURCE cmutils.cpp USERINCLUDE . USERINCLUDE ../inc @@ -50,6 +49,5 @@ LIBRARY ipsecpolapi.lib LIBRARY lib_pfkey.lib LIBRARY random.lib -LIBRARY cmmanager.lib CAPABILITY ALL -Tcb diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikeutils/inc/cmutils.h --- a/vpnengine/ikeutils/inc/cmutils.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CmManager related utility functionality -* -*/ - -#ifndef CMUTILS_H -#define CMUTILS_H - -#include -#include - - -/** - * CmManager related utilities. - */ -class CmUtils{ - public: - /** - * Gets VPN policy id based on VPN access point id. - * - * @param aVpnApId VPN access point id. - * @param aPolId On return, VPN policy id. - */ - IMPORT_C static void GetPolicyIdL( - const TUint32 aVpnApId, TVpnPolicyId& aPolId ); - -}; - - -#endif // CMUTILS_H diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikeutils/src/cmutils.cpp --- a/vpnengine/ikeutils/src/cmutils.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CmManager related utility functionality -* -*/ - -#include -#include -#include - -#include "cmutils.h" - - -EXPORT_C void CmUtils::GetPolicyIdL( const TUint32 aVpnApId, TVpnPolicyId& aPolId ) -{ - using namespace CMManager; - - RCmManager cmManager; - - cmManager.OpenL(); - CleanupClosePushL( cmManager ); - - RCmConnectionMethod cm = cmManager.ConnectionMethodL( aVpnApId ); - CleanupClosePushL( cm ); - - HBufC* policy = cm.GetStringAttributeL( EVpnServicePolicy ); - - if( policy && policy->Length() <= aPolId.MaxLength() ) - { - aPolId.Copy( *policy ); - } - - delete policy; - - CleanupStack::PopAndDestroy( 2 ); // cm and cmManager -} - - -/***/ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/group/ikev1lib.mmp --- a/vpnengine/ikev1lib/group/ikev1lib.mmp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/group/ikev1lib.mmp Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -11,10 +11,12 @@ * * Contributors: * -* Description: Project definition file for project ikev1lib +* Description: Project definition file for project ikev1lib * */ + + #include TARGET ikev1lib.dll @@ -44,7 +46,6 @@ SOURCE ikev1trans.cpp SOURCE ikev1isakmpstream.cpp SOURCE ikev1nokianattkeepalive.cpp -SOURCE credentialcache.cpp USERINCLUDE ../inc USERINCLUDE ../../ikesocket/inc @@ -72,4 +73,5 @@ LIBRARY ikesocket.lib LIBRARY random.lib LIBRARY ikeutils.lib -LIBRARY ecom.lib + + diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/inc/credentialcache.h --- a/vpnengine/ikev1lib/inc/credentialcache.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Cache for authentication credentials -* -*/ - -#ifndef CREDENTIALCACHE_H -#define CREDENTIALCACHE_H - -#include -#include - - -class MIkeDebug; - - -const TInt KCredentialMaxLen = 64; - - -/** - * Cache buffer stored to file. - */ -struct TCacheBuffer{ - TVpnPolicyId iId; - TBuf8 iUser; - TBuf8 iSecret; -}; - - -/** - * Cache for authentication credentials. - * The public interface of the class has been - * designed for CTransNegotiation use. - * - * Error handling: - * The methods return error code or leave only if - * it is useful for the method caller to handle the error. - * The user of CCredentialCache must work even if the - * cache fails. (The credentials are asked from user in that case.) - * - * Example usage sequence: - * NewL - * SetUserName - * SetSecret - * Store - * GetCredentials - */ -NONSHARABLE_CLASS( CCredentialCache ) : public CBase{ - public: - /** - * Two-phased constructor. - * @param aDebug Debug log interface. - */ - static CCredentialCache* NewL( MIkeDebug& aDebug ); - - ~CCredentialCache(); - - /** - * Sets user-name. Does not store to file. - * @param aUser User name. - */ - void SetUserName( const TDesC8& aUser ); - - /** - * Sets secret, e.g. password. Does not store to file. - * @param aSecret Secret, e.g. password. - */ - void SetSecret( const TDesC8& aSecret ); - - /** - * Gets credentials from cache file. - * Caller is responsible for deallocating aUser and aSecret. - * - * @param aVpnApId VPN access point id - * @param aUser On return, user name. - * @param aSecret On return, secret. - * - * @return KErrNone if credentials are fetched from cache. - * @return System-wide error code if cached credentials are not available. - */ - TInt GetCredentials( - const TUint32 aVpnApId, HBufC8*& aUser, HBufC8*& aSecret - ); - - /** - * Stores user-name and secret to private file. - * @param aVpnApId VPN access point id. - */ - void Store( const TUint32 aVpnApId ); - - /** - * Clears cache. - */ - void Clear(); - - private: - CCredentialCache( MIkeDebug& aDebug ); - - void ConstructL(); - - /** - * Gets credentials from cache file. - */ - TInt GetCredentialsL( - const TUint32 aVpnApId, HBufC8*& aUser, HBufC8*& aSecret - ); - - /** - * Stores user-name and secret to private file. - */ - void StoreL( const TUint32 aVpnApId ); - - TInt CheckCredential( const TDesC8& cr ); - - /** - * Stores cache to private file. - */ - void StoreToFileL(); - - /** - * Reads cache data to iBuf. - */ - TInt ReadFile(); - - /** - * Stores file name with path to iFileName. - * Creates private path if needed. - */ - TInt CreateFileNameAndPath(); - - RFs iFs; - - TCacheBuffer iBuf; - - TFileName iFileName; - - MIkeDebug& iDebug; -}; - - -#endif // CREDENTIALCACHE_H diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/inc/ikev1crack.h --- a/vpnengine/ikev1lib/inc/ikev1crack.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/inc/ikev1crack.h Wed Oct 13 15:42:16 2010 +0300 @@ -50,7 +50,6 @@ *---------------------------------------------------------------------------*/ #define DIALOG_INFO_ID 0xfedcba98 #define XAUTH_DIALOG_ID 0x76543210 -#define ERROR_DIALOG_ID 0x87654321 class CIkev1Negotiation; class TNotificationISAKMP; @@ -59,46 +58,28 @@ class CIkev1PluginSession; class MIkeDebug; - -NONSHARABLE_CLASS(CAuthDialogInfo) : public CBase +class CAuthDialogInfo : public CBase { public: CAuthDialogInfo(CIkev1PluginSession* aPluginSession, TUint32 aObjId, TUint32 aSAId, TUint32 aMsgId) { iPluginSession = aPluginSession; iSAId = aSAId; iObjId = aObjId; iMsgId = aMsgId; } - ~CAuthDialogInfo(); + ~CAuthDialogInfo() {iObjId = 0;} inline CIkev1PluginSession* PluginSession() { return iPluginSession;} inline TUint32 SAId() { return iSAId;} inline TUint32 GetObjId() { return iObjId;} inline TUint32 GetMsgId() { return iMsgId;} - void SetUserName( HBufC8* aUserName ); - void SetSecret( HBufC8* aSecret ); - private: - TUint32 iObjId; // Object identifier + TUint32 iObjId; // Object identifier CIkev1PluginSession* iPluginSession; // Plugin session pointer - TUint32 iSAId; // SA id of CIkev1Negotiation - TUint32 iMsgId; // Transaction exchange message ID - + TUint32 iSAId; // SA id of CIkev1Negotiation + TUint32 iMsgId; // Transaction exchange message ID + public: - /** - * Username from UI dialog or cache. - * Own. - */ - HBufC8* iUsername; - - /** - * Secret from UI dialog or cache. - * Own. - */ - HBufC8* iSecret; - - /** - * Negotiation pointer - * Not own. - */ - CIkev1Negotiation* iNegotiation; - +// Credentials data get from user with asynchronous dialog + HBufC8 *iUsername; + HBufC8 *iSecret; + HBufC8 *iDomain; }; @@ -111,8 +92,9 @@ TInt ExecuteCRACKMsgL(const ThdrISAKMP &aHdr); TInt ProcessUserResponseL(CAuthDialogInfo *aUserInfo); TInt CrackAuthenticationFailedL(const TNotificationISAKMP *aNotifPayload); - - TInt DialogCompleteL(TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret); + + TInt DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain); + private: TInt GetDataL(HBufC8* aChallenge); @@ -135,7 +117,7 @@ HBufC8 *iUserName; // Saved for User name caching HBufC8 *iDomain; // Fixed domain value for this CRACK negotiation - + MIkeDebug& iDebug; }; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/inc/ikev1dialog.h --- a/vpnengine/ikev1lib/inc/ikev1dialog.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/inc/ikev1dialog.h Wed Oct 13 15:42:16 2010 +0300 @@ -28,7 +28,6 @@ class RFs; class MIkeDebug; - /** * IKE dialog complete * @internalComponent @@ -39,12 +38,13 @@ /** * IKE dialog completed * @internalComponent + * */ - virtual TInt DialogCompleteL( - TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret) = 0; + virtual TInt DialogCompleteL(CIkev1Dialog* aDialog, TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain)=0; }; + NONSHARABLE_CLASS(CDialogTimeout) : public CTimer { public: @@ -76,7 +76,6 @@ void GetAsyncUNPWDialogL(TAny *aUserInfo, MIkeDialogComplete* aCallback); void GetAsyncUNAMEDialog(TAny *aUserInfo, MIkeDialogComplete* aCallback); - void GetAsyncSecureidPinDialogL(TAny *aUserInfo, MIkeDialogComplete* aCallback); void GetAsyncSecureidDialogL(TAny *aUserInfo, MIkeDialogComplete* aCallback); void GetAsyncSecureNextPinDialogL(TAny *aUserInfo, MIkeDialogComplete* aCallback); void GetAsyncRespDialog(TPtr8 aChallenge, TAny *aUserInfo, MIkeDialogComplete* aCallback); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/inc/ikev1negotiation.h --- a/vpnengine/ikev1lib/inc/ikev1negotiation.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/inc/ikev1negotiation.h Wed Oct 13 15:42:16 2010 +0300 @@ -155,7 +155,6 @@ inline TUint32 SAId() {return iSAId;} TIkev1IsakmpStream* SaveIkeMsgBfr(TIkev1IsakmpStream* aMsg); void AuthDialogCompletedL(CAuthDialogInfo *aUserInfo); - void ErrDialogCompletedL(); TInt32 RandomMessageId(); void SendDeleteL(TUint8 aProtocol, TUint32 aIpsecSPI = 0); //Send a Delete payload for the negotiation void SendKeepAliveMsgL(TIkev1SAData* aSa); @@ -178,9 +177,10 @@ TInt aStatus, TUint32 aSpi); - TInt ProcessUserResponseL(CAuthDialogInfo *aUserInfo); - TInt DialogCompleteL(TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret); + TInt ProcessUserResponseL(CAuthDialogInfo *aUserInfo); + TInt DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain); + private: CIkev1Negotiation( CIkev1PluginSession* aPluginSession, diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/inc/ikev1plugin.h --- a/vpnengine/ikev1lib/inc/ikev1plugin.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/inc/ikev1plugin.h Wed Oct 13 15:42:16 2010 +0300 @@ -19,7 +19,6 @@ #define C_IKEV1PLUGIN_H #include -#include #include "ikepluginif.h" #include "pfkeysocketif.h" @@ -91,11 +90,7 @@ * Returns event logger interface. */ MKmdEventLoggerIf& EventLogger(); - - /** - * Returns SoftToken interface. - */ - CSoftTokenPluginIf* SoftToken(); + // Methods to build and send PFKEY API primitives to IPsec @@ -175,13 +170,6 @@ * Not own. */ MIkeDebug& iDebug; - - /** - * SoftToken plugin. - * Own. - */ - CSoftTokenPluginIf* iSoftToken; - }; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/inc/ikev1pluginsession.h --- a/vpnengine/ikev1lib/inc/ikev1pluginsession.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/inc/ikev1pluginsession.h Wed Oct 13 15:42:16 2010 +0300 @@ -20,7 +20,6 @@ #define C_IKEV1PLUGINSESSION_H #include -#include #include "vpnmandefs.h" #include "ikemsgheader.h" @@ -274,13 +273,6 @@ * @return Error value */ TInt AuthDialogCompletedL( CAuthDialogInfo* aUserInfo ); - - /** - * Handles completion of error dialog processing. - * @param aUserInfo User info - * @return Error value - */ - TInt ErrDialogCompletedL( CAuthDialogInfo* aUserInfo ); /** * Handles change of internal address. @@ -349,13 +341,7 @@ * @return Eveng logger interface */ MKmdEventLoggerIf& EventLogger(); - - /** - * Returns SoftToken interface. - * @return SoftToken interface - */ - CSoftTokenPluginIf* SoftToken(); - + /** * Returns internal address (NULL if does not exist). * @return Internal address. Ownership transferred. diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/inc/ikev1trans.h --- a/vpnengine/ikev1lib/inc/ikev1trans.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/inc/ikev1trans.h Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -63,8 +63,6 @@ class TIkev1IsakmpStream; class MIkeDebug; class TInetAddr; -class CCredentialCache; - /**-------------------------------------------------------------------------- * @@ -102,7 +100,8 @@ static TUint16 GetAuthMethod(TUint16 aAuthMethod, TBool aXauthUsed, TInt aRole); static void BuildXauthVendorId(TIkev1IsakmpStream &aMsg); - TInt DialogCompleteL(TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret); + TInt DialogCompleteL(CIkev1Dialog* aDialog, TAny* aUserInfo, HBufC8* aUsername, + HBufC8* aSecret, HBufC8* aDomain); TInt BuildConfigRequestL(); private: @@ -129,8 +128,7 @@ CIkev1PluginSession* aPluginSession, CIkev1Negotiation* aNegotiation, MIkeDebug& aDebug ); - void ConstructL(); - void GetCredentialsL(); + void ConstructL(); private: CIkev1PluginSession* iPluginSession; @@ -147,13 +145,9 @@ TUint32 iRequestFlags; TBool iXauthCompleted; TBool iCfgModeCompleted; - TBool iUseOlderPIXXauth; // use draft-ietf-ipsec-isakmp-xauth-04.txt - TInt iCredentialType; - - TLastIKEMsg iLastTransMsgInfo; - - CCredentialCache* iCache; - + TBool iUseOlderPIXXauth; // use draft-ietf-ipsec-isakmp-xauth-04.txt + + TLastIKEMsg iLastTransMsgInfo; MIkeDebug& iDebug; }; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/src/credentialcache.cpp --- a/vpnengine/ikev1lib/src/credentialcache.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +0,0 @@ - /* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Cache for authentication credentials -* -*/ - -#include - -#include "credentialcache.h" -#include "ikedebug.h" -#include "cmutils.h" - - -_LIT( KFileName, "cache" ); - - -CCredentialCache* CCredentialCache::NewL( MIkeDebug& aDebug ) -{ - CCredentialCache* cache = new (ELeave) CCredentialCache( aDebug ); - - CleanupStack::PushL( cache ); - - cache->ConstructL(); - - CleanupStack::Pop(); - - return cache; -} - - -CCredentialCache::CCredentialCache( MIkeDebug& aDebug ) - : iDebug( aDebug ) -{ -} - - -void CCredentialCache::ConstructL() -{ - User::LeaveIfError( iFs.Connect() ); - - DEBUG_LOG( _L( "CCredentialCache::ConstructL" ) ); -} - - -CCredentialCache::~CCredentialCache() -{ - iFs.Close(); -} - - -void CCredentialCache::SetUserName( const TDesC8& aUser ) -{ - if( KErrNone != CheckCredential( aUser ) ) - { - return; - } - - iBuf.iUser.Copy( aUser ); -} - - -void CCredentialCache::SetSecret( const TDesC8& aSecret ) -{ - if( KErrNone != CheckCredential( aSecret ) ) - { - return; - } - - iBuf.iSecret.Copy( aSecret ); -} - - -TInt CCredentialCache::GetCredentials( - const TUint32 aVpnApId, HBufC8*& aUser, HBufC8*& aSecret ) -{ - TInt ret = KErrNone; - - TRAPD( err, ret = GetCredentialsL( aVpnApId, aUser, aSecret ) ); - - if( KErrNone != err ) - { - DEBUG_LOG1( _L("CCredentialCache::GetCredentials, err=%d"), err ); - return err; - } - - return ret; -} - - -TInt CCredentialCache::GetCredentialsL( - const TUint32 aVpnApId, HBufC8*& aUser, HBufC8*& aSecret ) -{ - TInt ret = ReadFile(); - - if( KErrNone != ret ) - { - return ret; - } - - TVpnPolicyId id; - - CmUtils::GetPolicyIdL( aVpnApId, id ); - - if( id != iBuf.iId ) - { - DEBUG_LOG1( - _L("CCredentialCache::GetCredentialsL, pol=%S"), &iBuf.iId - ); - - return KErrNotFound; - } - - aUser = iBuf.iUser.AllocL(); - aSecret = iBuf.iSecret.AllocL(); - - return KErrNone; -} - - -void CCredentialCache::Store( const TUint32 aVpnApId ) -{ - TRAPD( err, StoreL( aVpnApId ) ); - - if( KErrNone != err ) - { - DEBUG_LOG1( _L("CCredentialCache::Store, err=%d"), err ); - } -} - - -void CCredentialCache::StoreL( const TUint32 aVpnApId ) -{ - CmUtils::GetPolicyIdL( aVpnApId, iBuf.iId ); - - StoreToFileL(); -} - - -void CCredentialCache::Clear() -{ - TInt ret = CreateFileNameAndPath(); - - if( KErrNone != ret ) - { - return; - } - - ret = iFs.Delete( iFileName ); - - if( KErrNone != ret ) - { - DEBUG_LOG1( _L("CCredentialCache::Clear, ret=%d"), ret ); - } -} - - -TInt CCredentialCache::CheckCredential( const TDesC8& cr ) -{ - TInt len = cr.Length(); - - if( 0 == len || KCredentialMaxLen < len ) - { - DEBUG_LOG1( _L("CCredentialCache::CheckCredential, len=%d"), len ); - return KErrArgument; - } - - return KErrNone; -} - - -void CCredentialCache::StoreToFileL() -{ - RFile cache; - - User::LeaveIfError( CreateFileNameAndPath() ); - - User::LeaveIfError( cache.Replace( - iFs, iFileName, EFileShareExclusive | EFileWrite - ) ); - - CleanupClosePushL( cache ); - - TPckg< TCacheBuffer > data( iBuf ); - - User::LeaveIfError( cache.Write( data ) ); - - CleanupStack::PopAndDestroy( &cache ); -} - - -TInt CCredentialCache::ReadFile() -{ - RFile cache; - - TInt ret = cache.Open( iFs, KFileName, EFileRead ); - - if( KErrNone != ret ) - { - return ret; - } - - TInt size = 0; - - ret = cache.Size( size ); - - TPckg< TCacheBuffer > data( iBuf ); - - if( size != data.Size() ) - { - DEBUG_LOG1( _L("CCredentialCache::ReadFile, size=%d"), size ); - cache.Close(); - Clear(); - return KErrCorrupt; - } - - ret = cache.Read( data ); - - cache.Close(); - - return ret; -} - - -TInt CCredentialCache::CreateFileNameAndPath() -{ - TInt ret = iFs.CreatePrivatePath( RFs::GetSystemDrive() ); - - if( KErrNone != ret && - KErrAlreadyExists != ret ) - { - DEBUG_LOG1( _L("CCredentialCache, CreatePrivatePath ret=%d"), ret ); - return ret; - } - - ret = iFs.PrivatePath( iFileName ); - - if( KErrNone != ret ) - { - DEBUG_LOG1( _L("CCredentialCache, PrivatePath ret=%d"), ret ); - return ret; - } - - iFileName.Append( KFileName ); - - return KErrNone; -} - - -/***/ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/src/ikev1crack.cpp --- a/vpnengine/ikev1lib/src/ikev1crack.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/src/ikev1crack.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -26,27 +26,6 @@ #include "ikepolparser.h" -CAuthDialogInfo::~CAuthDialogInfo() -{ - delete iUsername; - delete iSecret; -} - - -void CAuthDialogInfo::SetUserName( HBufC8* aUserName ) -{ - delete iUsername; - iUsername = aUserName; -} - - -void CAuthDialogInfo::SetSecret( HBufC8* aSecret ) -{ - delete iSecret; - iSecret = aSecret; -} - - // // Class that implements IKE CRACK authentication method // @@ -192,7 +171,7 @@ *-------------------------------------------------------------------------*/ if ( iState & WAITING_USER_RSP ) { - iState &= ~(WAITING_USER_RSP); + iState &= ~(WAITING_USER_RSP + SECURID_NEXT_PIN_MODE); delete iDialog; /* delete dialog object */ iDialog = NULL; @@ -211,31 +190,6 @@ switch ( iLAMType ) { case CRACK_PASSWORD: - - if (iNegotiation->iHostData->iSoftToken && (iPluginSession->SoftToken() != NULL)) - { - HBufC8* password = NULL; - TInt err; - if (iState & SECURID_NEXT_PIN_MODE) - { - iState &= ~(SECURID_NEXT_PIN_MODE); - err = iPluginSession->SoftToken()->CodeL(*aDialogInfo->iSecret, password, ETrue); - } - else - err = iPluginSession->SoftToken()->CodeL(*aDialogInfo->iSecret, password); - if (KErrNone != err) - { - DEBUG_LOG(_L("Failed to get OTP from SoftToken!")); - delete aDialogInfo; /* release dialog info object */ - iDialogInfo = NULL; /* reset dialog info pointer */ - return CRACK_FAILED; - } - else - { - aDialogInfo->SetSecret(password); - } - } - /*-------------------------------------------------- * Possible attributes: User name, Secret, Domain *-------------------------------------------------*/ @@ -301,16 +255,10 @@ switch ( iLAMType ) { case CRACK_PASSWORD: - /*-------------------------------------------------- - * Request User name and pin from user - *-------------------------------------------------*/ - if (iNegotiation->iHostData->iSoftToken && (iPluginSession->SoftToken() != NULL)) - iDialog->GetAsyncSecureidPinDialogL(iDialogInfo, static_cast(this)); /*-------------------------------------------------- * Request User name and password (domain) from user *-------------------------------------------------*/ - else - iDialog->GetAsyncUNPWDialogL(iDialogInfo, static_cast(this)); + iDialog->GetAsyncUNPWDialogL(iDialogInfo, (MIkeDialogComplete*)this); break; default: @@ -570,8 +518,8 @@ // // The implementation for class MIkeDialogComplete virtual function // -TInt CIKECRACKNegotiation::DialogCompleteL( - TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret) +TInt CIKECRACKNegotiation::DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo, + HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain) { /*--------------------------------------------------------------------------- * @@ -584,21 +532,23 @@ * *-------------------------------------------------------------------------*/ TUint32 obj_id = 1; - CAuthDialogInfo* info = static_cast(aUserInfo); + CAuthDialogInfo* info = (CAuthDialogInfo*)aUserInfo; DEBUG_LOG1(_L("CIKECRACKNegotiation::DialogCompleteL(), aUserInfo = %x"), aUserInfo); if ( info ) { obj_id = info->GetObjId(); - info->iNegotiation = iNegotiation; DEBUG_LOG1(_L("Preparing to call AuthDialogCompletedL(), ObjId = %x"), obj_id); if ( obj_id == DIALOG_INFO_ID ) { - info->SetUserName( aUsername ); - info->SetSecret( aSecret ); + info->iUsername = aUsername; + info->iSecret = aSecret; + info->iDomain = aDomain; obj_id = info->PluginSession()->AuthDialogCompletedL(info); - } + } } return obj_id; } + + diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/src/ikev1dialog.cpp --- a/vpnengine/ikev1lib/src/ikev1dialog.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/src/ikev1dialog.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -189,9 +189,12 @@ if ( iCallback ) { TInt err; - TRAP(err, delete_obj = iCallback->DialogCompleteL( - iUserInfo, un_bfr, pw_bfr)); - + TRAP(err, delete_obj = iCallback->DialogCompleteL(this, iUserInfo, + un_bfr, //User name + pw_bfr, //Password + NULL)); //domain + delete un_bfr; + delete pw_bfr; if ( err != KErrNone ) delete_obj = 1; } @@ -270,18 +273,18 @@ /*-------------------------------------------------------------------- * - * Get user name and Secure ID code data for Legacy authentication + * Get user name and Secure ID pin data for Legacy authentication * *---------------------------------------------------------------------*/ void CIkev1Dialog::GetAsyncSecureidDialogL(TAny *aUserInfo, MIkeDialogComplete* aCallback) { DEBUG_LOG2(_L("CIkev1Dialog::GetAsyncSecureidDialogL(), aUserInfo = %x, aCallback = %x"), aUserInfo, aCallback); - iDialogType = TKMDDialog::ESecurIdCode; + iDialogType = TKMDDialog::ESecurIdPin; iUserInfo = aUserInfo; iCallback = aCallback; // For asynchronous dialog RunL - TIPSecDialogInfo dialog_input(TKMDDialog::ESecurIdCode, 0); + TIPSecDialogInfo dialog_input(TKMDDialog::ESecurIdPin, 0); iInputData = CreateDialogInput(dialog_input, ETrue);// TRUE = Use user name cache if ( iInputData ) LaunchDialogL(); //launch the dialog @@ -289,26 +292,6 @@ /*-------------------------------------------------------------------- * - * Get user name and Secure ID pin data for Legacy authentication - * - *---------------------------------------------------------------------*/ -void CIkev1Dialog::GetAsyncSecureidPinDialogL(TAny *aUserInfo, MIkeDialogComplete* aCallback) -{ - DEBUG_LOG2(_L("CIkev1Dialog::GetAsyncSecureidPinDialogL(), aUserInfo = %x, aCallback = %x"), aUserInfo, aCallback); - - iDialogType = TKMDDialog::ESecurIdPin; - iUserInfo = aUserInfo; - iCallback = aCallback; // For asynchronous dialog RunL - - TIPSecDialogInfo dialog_input(TKMDDialog::ESecurIdPin, 0); - iInputData = CreateDialogInput(dialog_input, ETrue);// TRUE = Use user name cache - if ( iInputData ) - LaunchDialogL(); //launch the dialog -} - - -/*-------------------------------------------------------------------- - * * Get user name and Secure ID next pin data for Legacy authentication * *---------------------------------------------------------------------*/ @@ -624,9 +607,11 @@ { TInt err; DEBUG_LOG2(_L("Calling DialogCompleteL(), UserInfo = %x, Callback = %x"), (TUint32)iDialog->UserInfo(), (TUint32)Callback); - TRAP(err, delete_dialog = Callback->DialogCompleteL( - iDialog->UserInfo(), NULL, NULL)); - + TRAP(err, delete_dialog = Callback->DialogCompleteL(iDialog, + iDialog->UserInfo(), + NULL, //User name + NULL, //Password + NULL)); //domain DEBUG_LOG2(_L("DialogCompleteL() completed, err = %d, delete_dialog = %d"), err, delete_dialog); if ( err != KErrNone ) delete_dialog = 1; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/src/ikev1negotiation.cpp --- a/vpnengine/ikev1lib/src/ikev1negotiation.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/src/ikev1negotiation.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -15,12 +15,10 @@ * */ -#include #include #include #include #include -#include #include "ikev1negotiation.h" #include "ikedebug.h" @@ -189,8 +187,8 @@ delete iPkiService; // Trusted CA certificate list - delete[] iSAPayload; - delete[] iPeerIdentPayload; + delete iSAPayload; + delete iPeerIdentPayload; delete iOwnIdentPayload; //Keys @@ -1103,15 +1101,6 @@ } } -// -// CIkev1Negotiation::ErrDialogCompletedL -// Error dialog is completed. End negotiation. -// -void CIkev1Negotiation::ErrDialogCompletedL( ) -{ - SendDeleteL(PROTO_ISAKMP); - SetErrorStatus(KKmdIkeAuthFailedErr); -} // // CIkev1Negotiation::StartCRACKAuthL @@ -1284,37 +1273,18 @@ //Sends the initial IKE packets to start the negotiation. PHASE I void CIkev1Negotiation::InitNegotiationL() //Equiv. to stage 1 { + if (iProposal_I.iAttrList->iAuthMethod == IKE_A_CRACK && !iHostData->iCRACKLAMUserName && !iHostData->iCRACKLAMPassword && !iCRACKLAMUserName && !iCRACKLAMPassword) { - if ( (iHostData->iSoftToken) && (iPluginSession->SoftToken() != NULL) ) - { - if (iPluginSession->SoftToken()->DefaultFoundL()) - { - iDialog = CIkev1Dialog::NewL( iPluginSession, iPluginSession->DialogAnchor(), iDebug ); - iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, DIALOG_INFO_ID, SAId(), 0); - iDialog->GetAsyncSecureidPinDialogL(iDialogInfo, static_cast(this)); - return; - } - else - { - DEBUG_LOG(_L("Failed to find token!")); - iDialog = CIkev1Dialog::NewL( iPluginSession, iPluginSession->DialogAnchor(), iDebug ); - iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, ERROR_DIALOG_ID, SAId(), 0); - iDialog->ShowErrorDialogL(TVpnNoteDialog::EKmdTokenNotFound, iDialogInfo, static_cast(this)); - return; - } - } - else - { + iDialog = CIkev1Dialog::NewL( iPluginSession, iPluginSession->DialogAnchor(), iDebug ); iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, DIALOG_INFO_ID, SAId(), 0); - iDialog->GetAsyncUNPWDialogL(iDialogInfo, static_cast(this)); + iDialog->GetAsyncUNPWDialogL(iDialogInfo, (MIkeDialogComplete*)this); return; - } } TIkev1IsakmpStream* msg = SaveIkeMsgBfr( new (ELeave) TIkev1IsakmpStream(iDebug) ); @@ -8427,32 +8397,6 @@ { delete iDialog; /* delete dialog object */ iDialog = NULL; - - if (iHostData->iSoftToken && (iPluginSession->SoftToken() != NULL)) - { - HBufC8* password = NULL; - TInt status; - status = iPluginSession->SoftToken()->CodeL(*aDialogInfo->iSecret, password); - - if (KErrNone != status) - { - if (KErrNoSecureTime == status) - { - DEBUG_LOG(_L("Token expired!")); - iDialog = CIkev1Dialog::NewL( iPluginSession, iPluginSession->DialogAnchor(), iDebug ); - iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, ERROR_DIALOG_ID, SAId(), 0); - iDialog->ShowErrorDialogL(TVpnNoteDialog::EKmdTokenExpired, iDialogInfo, static_cast(this)); - return status; - } - DEBUG_LOG(_L("Failed to get OTP from SoftToken!")); - SetFinished(); - return KErrNotFound; - } - else - { - aDialogInfo->SetSecret(password); - } - } iCRACKLAMUserName = aDialogInfo->iUsername->AllocL(); iCRACKLAMPassword = aDialogInfo->iSecret->AllocL(); @@ -8465,12 +8409,11 @@ return KErrNone; } - // // The implementation for class MIkeDialogComplete virtual function // -TInt CIkev1Negotiation::DialogCompleteL( - TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret) +TInt CIkev1Negotiation::DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo, + HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain) { /*--------------------------------------------------------------------------- * @@ -8487,17 +8430,13 @@ if ( info ) { obj_id = info->GetObjId(); - info->iNegotiation = this; DEBUG_LOG1(_L("Preparing to call AuthDialogCompletedL(), ObjId = %x"), obj_id); if ( obj_id == DIALOG_INFO_ID ) { - info->SetUserName(aUsername); - info->SetSecret(aSecret); - obj_id = info->PluginSession()->AuthDialogCompletedL(info); - } - if ( obj_id == ERROR_DIALOG_ID ) - { - obj_id = info->PluginSession()->ErrDialogCompletedL(info); + info->iUsername = aUsername; + info->iSecret = aSecret; + info->iDomain = aDomain; + obj_id = info->PluginSession()->AuthDialogCompletedL(info); } } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/src/ikev1plugin.cpp --- a/vpnengine/ikev1lib/src/ikev1plugin.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/src/ikev1plugin.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -65,7 +65,6 @@ iPluginSessions.Close(); delete iPFKeySocket; delete iIpsecPolicyUtil; - delete iSoftToken; } // --------------------------------------------------------------------------- @@ -89,14 +88,6 @@ iDebug ); iIpsecPolicyUtil = CIpsecPolicyUtil::NewL(); - - TInt err(KErrNone); - TRAP(err, iSoftToken = CSoftTokenPluginIf::NewL()); -#ifdef _DEBUG - if (err != KErrNone) - DEBUG_LOG(_L("SoftTokenPlugin not found")); -#endif // _DEBUG - } // --------------------------------------------------------------------------- @@ -247,14 +238,3 @@ return iEventLogger; } -// --------------------------------------------------------------------------- -// Returns SoftToken interface. -// --------------------------------------------------------------------------- -// -//MSoftTokenPluginIf* CIkev1Plugin::SoftToken() -CSoftTokenPluginIf* CIkev1Plugin::SoftToken() - { - return iSoftToken; - } - - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/src/ikev1pluginsession.cpp --- a/vpnengine/ikev1lib/src/ikev1pluginsession.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/src/ikev1pluginsession.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -902,7 +902,7 @@ // TInt CIkev1PluginSession::AuthDialogCompletedL( CAuthDialogInfo* aUserInfo ) { - CIkev1Negotiation* negotiation = aUserInfo->iNegotiation; + CIkev1Negotiation* negotiation = FindNegotiation( aUserInfo->SAId() ); if ( negotiation ) { DEBUG_LOG1( _L("Dialog completed for SAID: %d"), @@ -920,31 +920,6 @@ return KErrNotFound; } -// --------------------------------------------------------------------------- -// Handles completion of error dialog processing. -// --------------------------------------------------------------------------- -// -TInt CIkev1PluginSession::ErrDialogCompletedL( CAuthDialogInfo* aUserInfo ) - { - - CIkev1Negotiation* negotiation = aUserInfo->iNegotiation; - if ( negotiation ) - { - DEBUG_LOG1( _L("Dialog completed for SAID: %d"), - aUserInfo->SAId() ); - - negotiation->ErrDialogCompletedL(); - if ( negotiation->Finished() ) - { - DeleteNegotiation( negotiation ); - } - return KErrNone; - } - DEBUG_LOG1( _L("Dialog completed, no negotiation found for SAID: %d"), - aUserInfo->SAId() ); - - return KErrNotFound; - } // --------------------------------------------------------------------------- // Handles change of internal address. @@ -1078,16 +1053,6 @@ MKmdEventLoggerIf& CIkev1PluginSession::EventLogger() { return iPlugin.EventLogger(); - } - -// --------------------------------------------------------------------------- -// Returns SoftToken interface. -// --------------------------------------------------------------------------- -// -//MSoftTokenPluginIf* CIkev1PluginSession::SoftToken() -CSoftTokenPluginIf* CIkev1PluginSession::SoftToken() - { - return iPlugin.SoftToken(); } // --------------------------------------------------------------------------- @@ -1571,7 +1536,7 @@ aDestAddr, aLocalPort, aDscp ); - iSendQueue.AppendL( item ); + iSendQueue.Append( item ); } } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/ikev1lib/src/ikev1trans.cpp --- a/vpnengine/ikev1lib/src/ikev1trans.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/ikev1lib/src/ikev1trans.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -36,17 +36,11 @@ #include "ikev1crack.h" #include "ikev1isakmpstream.h" #include "ikev1crypto.h" -#include "credentialcache.h" - const TUint8 XAUTH_VID_DATA[8] = {0x09, 0x00, 0x26, 0x89, 0xdf, 0xd6, 0xb7, 0x12}; const TUint8 CISCO_UNITY_VID_DATA[16] = {0x12, 0xf5, 0xf2, 0x8c, 0x45, 0x71, 0x68, 0xa9, 0x70, 0x2d, 0x9f, 0xe2, 0x74, 0xcc, 0x01, 0x00}; -const TInt KCredentialTypeUnknown = 0; -const TInt KCredentialTypeNew = 1; -const TInt KCredentialTypeCached = 2; - CTransNegotiation::CTransNegotiation( TInt aGranularity, TBool aUseXauth, @@ -99,9 +93,8 @@ delete iInternalAddr; delete iDialog; delete iDialogInfo; - delete iUserName; - delete iCache; - + delete iUserName; + for ( TInt i = 0; i < Count(); i++ ) { delete At(i); @@ -121,7 +114,8 @@ { User::Leave(KErrArgument); } - + + DEBUG_LOG(_L("Transaction exchange object constructed")); if ( !iUseXauth ) { iXauthCompleted = ETrue; @@ -132,14 +126,7 @@ if ( !iUseCfgMode ) iCfgModeCompleted = ETrue; DEBUG_LOG(_L("Starting to Wait XAUTH request")); - } - - if( EFalse != iPluginSession->IkeData().iUseCache ) - { - iCache = CCredentialCache::NewL( iDebug ); - } - - DEBUG_LOG(_L("Transaction exchange object constructed")); + } } /**------------------------------------------------------------------- @@ -296,12 +283,7 @@ iUserName = HBufC8::New(aDialogInfo->iUsername->Length() + 16); // 16 bytes space for padding if ( iUserName ) { iUserName->Des().Copy(aDialogInfo->iUsername->Des()); - } - - if( iCache && KCredentialTypeNew == iCredentialType ) - { - iCache->SetUserName( *aDialogInfo->iUsername ); - } + } } if ( aDialogInfo->iSecret ) { @@ -326,12 +308,9 @@ break; default: - if( iCache && KCredentialTypeNew == iCredentialType ) - { - iCache->SetSecret( *aDialogInfo->iSecret ); - } break; - } + + } AddAttributeData(attr_ptr, AttrType, aDialogInfo->iSecret->Length(), (TUint8*)aDialogInfo->iSecret->Ptr()); } @@ -821,7 +800,9 @@ // // User name/Password authentication required // - GetCredentialsL(); + iDialog = CIkev1Dialog::NewL(iPluginSession, iPluginSession->DialogAnchor(), iDebug); + iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, XAUTH_DIALOG_ID, iNegotiation->SAId(), iCurrExchange->iMessageId); + iDialog->GetAsyncUNPWDialogL(iDialogInfo, (MIkeDialogComplete*)this); break; case ( (1 << (ATTR_USER_NAME - ATTR_XAUTH_TYPE)) | (1 << (ATTR_PASSCODE - ATTR_XAUTH_TYPE))): @@ -830,7 +811,7 @@ // iDialog = CIkev1Dialog::NewL(iPluginSession, iPluginSession->DialogAnchor(), iDebug); iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, XAUTH_DIALOG_ID, iNegotiation->SAId(), iCurrExchange->iMessageId); - iDialog->GetAsyncSecureidDialogL(iDialogInfo, static_cast(this)); + iDialog->GetAsyncSecureidDialogL(iDialogInfo, (MIkeDialogComplete*)this); break; case ( (1 << (ATTR_USER_NAME - ATTR_XAUTH_TYPE)) | (1 << (ATTR_NEXT_PIN - ATTR_XAUTH_TYPE))): @@ -839,7 +820,7 @@ // iDialog = CIkev1Dialog::NewL(iPluginSession, iPluginSession->DialogAnchor(), iDebug); iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, XAUTH_DIALOG_ID, iNegotiation->SAId(), iCurrExchange->iMessageId); - iDialog->GetAsyncSecureNextPinDialogL(iDialogInfo, static_cast(this)); + iDialog->GetAsyncSecureNextPinDialogL(iDialogInfo, (MIkeDialogComplete*)this); break; case ( (1 << (ATTR_CHALLENGE - ATTR_XAUTH_TYPE)) ): @@ -850,7 +831,7 @@ { iDialog = CIkev1Dialog::NewL(iPluginSession, iPluginSession->DialogAnchor(), iDebug); iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, XAUTH_DIALOG_ID, iNegotiation->SAId(), iCurrExchange->iMessageId); - iDialog->GetAsyncRespDialog(challenge, iDialogInfo, static_cast(this)); + iDialog->GetAsyncRespDialog(challenge, iDialogInfo, (MIkeDialogComplete*)this); } break; @@ -860,6 +841,7 @@ } return status; + } /**------------------------------------------------------------------- @@ -874,13 +856,12 @@ TBuf8<16> attributes; TInt status = TRANSACTION_CONTINUE; TInt16 attr_status; - + while ( aLth > 0 ) { aLth = aLth - aAttr->Size(); if ( aLth < 0 ) { DEBUG_LOG(_L("XAUTH SET ERROR (Length mismatch in the attibutes)")); - iCredentialType = KCredentialTypeUnknown; return TRANSACTION_FAILED; } @@ -920,19 +901,14 @@ if ( status == TRANSACTION_SUCCESS ) { DEBUG_LOG(_L("XAUTH authentication succeeded!")); iXauthCompleted = ETrue; - - if( iCache && KCredentialTypeNew == iCredentialType ) - { - iCache->Store( iPluginSession->VpnIapId() ); - } - if ( iUserName ) { + // // Cache user name into user name file + // CIkev1Dialog* Dialog = CIkev1Dialog::NewL(iPluginSession, iPluginSession->DialogAnchor(), iDebug); CleanupStack::PushL(Dialog); TInt err(KErrNone); TRAP(err, Dialog->StoreUserNameL(iUserName->Des())); - #ifdef _DEBUG if (err == KErrNone) DEBUG_LOG(_L("User Name caching succeeded")); @@ -942,16 +918,13 @@ } } else { - if( iCache ) - { - iCache->Clear(); - } DEBUG_LOG(_L("XAUTH authentication failed!")); + // Dialog object shall be delete in Dialog->RunL when dialog completed + CIkev1Dialog* Dialog = CIkev1Dialog::NewL(iPluginSession, iPluginSession->DialogAnchor(), iDebug); + Dialog->ShowErrorDialogL(TVpnNoteDialog::EKmdAuthenticationFailed, NULL, NULL); } } - - iCredentialType = KCredentialTypeUnknown; - + return status; } @@ -1007,6 +980,7 @@ *--------------------------------------------------------------------*/ TInt CTransNegotiation::BuildConfigRequestL() { + TBuf8<16> attributes; TUint32 message_id = iNegotiation->RandomMessageId(); @@ -1024,6 +998,8 @@ DEBUG_LOG(_L("CONFIG-MODE started, request xmitted!")); return TRANSACTION_CONTINUE; + + } /**------------------------------------------------------------------- @@ -1138,8 +1114,8 @@ // // The implementation for class MIkeDialogComplete virtual function // -TInt CTransNegotiation::DialogCompleteL( - TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret) +TInt CTransNegotiation::DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo, + HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain) { /*--------------------------------------------------------------------------- * @@ -1153,66 +1129,20 @@ *-------------------------------------------------------------------------*/ TUint32 obj_id = 1; CAuthDialogInfo* info = (CAuthDialogInfo*)aUserInfo; - DEBUG_LOG1(_L("CTransNegotiation::DialogCompleteL(), aUserInfo=%x"), aUserInfo); + DEBUG_LOG1(_L("CIKECRACKNegotiation::DialogCompleteL(), aUserInfo = %x"), aUserInfo); if ( info ) { obj_id = info->GetObjId(); - info->iNegotiation = iNegotiation; DEBUG_LOG1(_L("Preparing to call AuthDialogCompletedL(), ObjId = %x"), obj_id); if ( obj_id == XAUTH_DIALOG_ID ) { - info->SetUserName( aUsername ); - info->SetSecret( aSecret ); + info->iUsername = aUsername; + info->iSecret = aSecret; + info->iDomain = aDomain; obj_id = info->PluginSession()->AuthDialogCompletedL(info); - } + } } return obj_id; } - - -void CTransNegotiation::GetCredentialsL() -{ - DEBUG_LOG( _L( "CTransNegotiation::GetCredentialsL" ) ); - - TInt ret = KErrNotFound; - - delete iDialogInfo; iDialogInfo = NULL; - - iDialogInfo = new (ELeave) CAuthDialogInfo( - iPluginSession, - XAUTH_DIALOG_ID, - iNegotiation->SAId(), - iCurrExchange->iMessageId ); - - if( iCache && KCredentialTypeUnknown == iCredentialType ) - { - ret = iCache->GetCredentials( - iPluginSession->VpnIapId(), - iDialogInfo->iUsername, - iDialogInfo->iSecret - ); - } - - if( KErrNone == ret ) - { - iCredentialType = KCredentialTypeCached; - iDialogInfo->iNegotiation = iNegotiation; - TUint32 id = iPluginSession->AuthDialogCompletedL( iDialogInfo ); - } - else - { - iCredentialType = KCredentialTypeNew; - - delete iDialog; iDialog = NULL; - - iDialog = CIkev1Dialog::NewL( - iPluginSession, iPluginSession->DialogAnchor(), iDebug ); - - iDialog->GetAsyncUNPWDialogL( iDialogInfo, static_cast(this) ); - } -} - - -/***/ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/pkiservice/inc/mapdescriptor.h --- a/vpnengine/pkiservice/inc/mapdescriptor.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/pkiservice/inc/mapdescriptor.h Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -59,7 +59,7 @@ TBool IsEqual(CMapDescriptor &aDesc); void SetMapDeletable(TBool aDeletable); void SetMapTrusted(const TBool &aTrusted); - void SetMapApplicationsL(const RArray &aApplications); + void SetMapApplications(const RArray &aApplications); TPtrC Label() const; const TPKIKeyIdentifier& CertificateKeyId() const; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/pkiservice/inc/pkisupport.h --- a/vpnengine/pkiservice/inc/pkisupport.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/pkiservice/inc/pkisupport.h Wed Oct 13 15:42:16 2010 +0300 @@ -157,8 +157,8 @@ void DoRunOperationL(); void DoRunLoggedInOperationL(); - // Function to remove all "Java Trust Root" certificates from the - // local listing ("Java Trust Root" certs shouldn't be supported by VPN) + // Function to remove all MIDP2 certificates from the + // local listing (MIDP2 certs shouldn't be supported by VPN) void CleanupCertListL(); // CActive methods diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/pkiservice/inc/pkiwrapper.h --- a/vpnengine/pkiservice/inc/pkiwrapper.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/pkiservice/inc/pkiwrapper.h Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -47,7 +47,7 @@ void InitializeL(const RMessage2& aMessage); void SetTrusted(TBool aValue); - void SetApplicationsL(const RArray& aApplUids); + void SetApplications(const RArray& aApplUids); void SetCertStoreType(TPkiServiceStoreType aStoreType); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/pkiservice/src/mapdescriptor.cpp --- a/vpnengine/pkiservice/src/mapdescriptor.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/pkiservice/src/mapdescriptor.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -410,12 +410,12 @@ iIsDeletable = aDeletable; } -void CMapDescriptor::SetMapApplicationsL(const RArray &aApplications) +void CMapDescriptor::SetMapApplications(const RArray &aApplications) { iApplUids.Close(); for(TInt i=0; iIsMatchingL(aDescriptor, aInfoOnly, aStoreType)) { // If we found a match, process it further - _LIT(KJavaTrustRootLabel, "Java Trust Root"); - // Discard all "Java Trust Root" certificates to avoid label-mapping problem - if (mapping->Label().Compare(KJavaTrustRootLabel) != 0) + _LIT(KMidp2Label, "MIDP2"); + TBuf<12> buf; + buf.Append(KMidp2Label); + // Discard all MIDP2 certificates to avoid label-mapping problem + if (buf.Compare(mapping->Label()) != 0) { if(mapping->EndTime() > furthestEndTime) { @@ -446,7 +448,7 @@ } else { - LOG(Log::Printf(_L("Found a cert, but it was a \"Java Trust Root\" one - continuing search"))); + LOG(Log::Printf(_L("Found a cert, but it was a MIDP2 one - continuing search"))); } } } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/pkiservice/src/pkisupport.cpp --- a/vpnengine/pkiservice/src/pkisupport.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/pkiservice/src/pkisupport.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -263,7 +263,7 @@ CleanupStack::PushL(newMapping); newMapping->SetMapDeletable(currentCertInfo->IsDeletable()); - newMapping->SetMapApplicationsL(iApplUids); + newMapping->SetMapApplications(iApplUids); iApplUids.Reset(); User::LeaveIfError(iMapper.AddMapping(newMapping)); @@ -433,7 +433,7 @@ if((iSupportStatus == KErrNotSupported) && iToggleSwitch && (iInitState == EInitCompleteImportCerts)) { - // Some implementations of "Java Trust Root" certstore return KErrNotSupported + // Some implementations of MIDP2 certstore return KErrNotSupported // when calling iCertStore->Applications() LOG_1("CPKISupport::RunL ignore error :%d", iSupportStatus); iSupportStatus = KErrNone; @@ -767,25 +767,25 @@ /** Removes all unnecessary certificates from the certificate list before generating the local mapping data. - More specifically, all "Java Trust Root" and non X509 certificates are removed. - ("Java Trust Root" certificates can never have a "VPN" trust setting.) + More specifically, all MIDP2 and non X509 certificates are removed. + (MIDP2 certificates can never have a "VPN" trust setting.) iListCleaned instance variable is used to limit the frequency of this cleanup - it's only necessary once, during PKI startup. */ void CPKISupport::CleanupCertListL() { - LOG_("Removing invalid certs (\"Java Trust Root\" certs)"); + LOG_("Removing invalid certs (MIDP2 certs)"); TInt certcount = iCerts.Count(); - _LIT(KJavaTrustRootLabel, "Java Trust Root"); + _LIT(KMidp2Label, "MIDP2"); LOG_1("Total cert count, before cleanup: %d", iCerts.Count()); RMPointerArray removedInfos; CleanupClosePushL(removedInfos); for (TInt i = certcount - 1; i >= 0; i--) { CCTCertInfo* info = iCerts[i]; - if (info->Label().Compare(KJavaTrustRootLabel) == 0 || + if (info->Label().Compare(KMidp2Label) == 0 || info->CertificateFormat() != EX509Certificate) { // CCTCertInfo has private destructor @@ -833,7 +833,7 @@ break; case EInitRetrieveCertList: LOG_("CPKISupport::DoRunOperationL() EInitRetrieveCertList"); - // Cert list might be new. Remove all "Java Trust Root" certificates first, + // Cert list might be new. Remove all MIDP2 certificates first, // if it hasn't been already done CleanupCertListL(); iInitState = EInitCompleteImportCerts; @@ -1019,7 +1019,7 @@ case ESSComplete: if(iCurrentFunction == PkiService::EApplications) { - iWrapper.SetApplicationsL(iApplUids); + iWrapper.SetApplications(iApplUids); } iSubState = ESSCompleteRequest; @@ -1162,7 +1162,7 @@ iApplUids.Close(); for(TInt i = 0;i& aApplUids) +void CPKIWrapper::SetApplications(const RArray& aApplUids) { iUidArray.Close(); for(TInt i=0;iRead(i * sizeof(TUid), (TAny*)&tempUid, sizeof(TUid)); - iUidArray.AppendL(tempUid); + iUidArray.Append(tempUid); } } CleanupStack::PopAndDestroy(1); // list @@ -592,7 +592,7 @@ case PkiService::ESetApplicability: if (iCurrentStatus == KErrNone) { - iMapper.GetMapDescriptorAtIndex(iIndex).SetMapApplicationsL(iUidArray); + iMapper.GetMapDescriptorAtIndex(iIndex).SetMapApplications(iUidArray); } break; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/EABI/eventmedsitU.DEF --- a/vpnengine/sit/EABI/eventmedsitU.DEF Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/sit/EABI/eventmedsitU.DEF Wed Oct 13 15:42:16 2010 +0300 @@ -12,6 +12,4 @@ _ZN4CSitD2Ev @ 11 NONAME _ZTI4CSit @ 12 NONAME ; ## _ZTV4CSit @ 13 NONAME ; ## - _ZTI9CExtender @ 14 NONAME - _ZTV9CExtender @ 15 NONAME diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/bwins/EVENTMEDSITU.DEF --- a/vpnengine/sit/bwins/EVENTMEDSITU.DEF Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/sit/bwins/EVENTMEDSITU.DEF Wed Oct 13 15:42:16 2010 +0300 @@ -1,10 +1,10 @@ EXPORTS - ??0CSit@@QAE@PAVMSitDeathListener@@@Z @ 1 NONAME ; CSit::CSit(class MSitDeathListener *) - ??1CSit@@UAE@XZ @ 2 NONAME ; CSit::~CSit(void) - ?EventRequiresSit@CSit@@SAHW4TEventType@@@Z @ 3 NONAME ; int CSit::EventRequiresSit(enum TEventType) - ?FindCancelEventType@CSit@@SA?AW4TEventType@@W42@@Z @ 4 NONAME ; enum TEventType CSit::FindCancelEventType(enum TEventType) - ?FindTaskRequestEventType@CSit@@SA?AW4TEventType@@W42@@Z @ 5 NONAME ; enum TEventType CSit::FindTaskRequestEventType(enum TEventType) - ?IsTaskCancellationObservationRequest@CSit@@SAHW4TEventType@@@Z @ 6 NONAME ; int CSit::IsTaskCancellationObservationRequest(enum TEventType) - ?StartL@CSit@@QAEXXZ @ 7 NONAME ; void CSit::StartL(void) - ?ThreadId@CSit@@QAE?AVTThreadId@@XZ @ 8 NONAME ; class TThreadId CSit::ThreadId(void) + ??0CSit@@QAE@PAVMSitDeathListener@@@Z @ 1 NONAME ; public: __thiscall CSit::CSit(class MSitDeathListener *) + ??1CSit@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CSit::~CSit(void) + ?EventRequiresSit@CSit@@SAHW4TEventType@@@Z @ 3 NONAME ; public: static int __cdecl CSit::EventRequiresSit(enum TEventType) + ?FindCancelEventType@CSit@@SA?AW4TEventType@@W42@@Z @ 4 NONAME ; public: static enum TEventType __cdecl CSit::FindCancelEventType(enum TEventType) + ?FindTaskRequestEventType@CSit@@SA?AW4TEventType@@W42@@Z @ 5 NONAME ; public: static enum TEventType __cdecl CSit::FindTaskRequestEventType(enum TEventType) + ?IsTaskCancellationObservationRequest@CSit@@SAHW4TEventType@@@Z @ 6 NONAME ; public: static int __cdecl CSit::IsTaskCancellationObservationRequest(enum TEventType) + ?StartL@CSit@@QAEXXZ @ 7 NONAME ; public: void __thiscall CSit::StartL(void) + ?ThreadId@CSit@@QAE?AVTThreadId@@XZ @ 8 NONAME ; public: class TThreadId __thiscall CSit::ThreadId(void) diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/group/sit.mmp --- a/vpnengine/sit/group/sit.mmp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/sit/group/sit.mmp Wed Oct 13 15:42:16 2010 +0300 @@ -35,8 +35,6 @@ SOURCE realiapconnobserver.cpp SOURCE vpnconncloser.cpp SOURCE eventlogger.cpp -SOURCE extender.cpp -SOURCE extenderhelper.cpp USERINCLUDE ../inc USERINCLUDE ../../../vpnapiimpl/inc @@ -47,7 +45,6 @@ USERINCLUDE ../../vpnmanager/inc USERINCLUDE ../../vpncommon/inc USERINCLUDE ../../eventviewer/inc -USERINCLUDE ../../vpnextapi/inc USERINCLUDE ../../pkiserviceapi/inc USERINCLUDE ../../../vpnui/vpnecomnotifier/inc @@ -66,6 +63,5 @@ LIBRARY eventviewer.lib LIBRARY featmgr.lib LIBRARY cmmanager.lib -LIBRARY vpnextapi.lib DEBUGLIBRARY flogger.lib diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/inc/eventlogger.h --- a/vpnengine/sit/inc/eventlogger.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/sit/inc/eventlogger.h Wed Oct 13 15:42:16 2010 +0300 @@ -38,7 +38,6 @@ const TInt R_VPN_MSG_VPN_IAP_ACT_END = KMaxTInt - 1; const TInt R_VPN_MSG_VPN_IAP_ACT_CANCEL = KMaxTInt - 2; -class CExtender; NONSHARABLE_CLASS(CEventLogger) : CBase { @@ -59,7 +58,6 @@ REventMediator& iEventMediator; TUint32 iVpnIapId; TUint32 iRealIapId; - CExtender* iExtender; }; #define DEFINE_EVENT_LOGGER CEventLogger* iEventLogger; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/inc/extender.h --- a/vpnengine/sit/inc/extender.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Extended functinality for policy provision process. -* -*/ - -#ifndef EXTENDER_H_ -#define EXTENDER_H_ - -#include -#include "vpnextapi.h" -#include "vpnnotifierdefs.h" - - -const TInt KStateCheckPolicyUpdateAvailability = 1; -const TInt KStateAfterCheckPolicyUpdateAvailability = 2; -const TInt KStateAskUpdateConfirmation = 3; -const TInt KStateAfterAskUpdateConfirmation = 4; -const TInt KStateUpdatePolicy = 5; -const TInt KStateAfterUpdatePolicy = 6; -const TInt KStateShowUpdateCompleteNote = 8; -const TInt KStateAfterShowUpdateCompleteNote = 9; -const TInt KStateShowApActFailureNote = 10; -const TInt KStateAfterShowApActFailureNote = 11; -const TInt KStateBeforeEnrollCertificates = 12; - - -static const TUid KDmMsrNotificationUid = {0x1020699E}; - -class CVpnConnStarter; -class CExtenderHelper; - -class CExtender : public CActive - { -public: - static CExtender* NewL(); - ~CExtender(); - -public: - void OnVpnApActStart(CVpnConnStarter* aVpnConnStarter); - void OnVpnApActCancel(); - - void OnVpnApActEnd(const TVpnPolicyId* aPolicyId, TInt aStatus, TUint32 aRealIapId); - -private: - CExtender(); - void ConstructL(); - -private: - void GotoState(TInt aState); - void SetCurrState(TInt aState); - void SetNextState(TInt aState); - TInt CurrState(); - TInt NextState(); - - void ChangeStateL(); - void CancelOngoingOperation(); - - void StateShowApActFailureNote(); - void StateAfterShowApActFailureNote(); - void StateCheckPolicyUpdateAvailabilityL(); - void StateAfterCheckPolicyUpdateAvailability(); - void StateAskUpdateConfirmation(); - void StateAfterAskUpdateConfirmationL(); - void StateUpdatePolicyL(); - - void StateAfterUpdatePolicyL(); - - void StateShowUpdateCompleteNote(); - void StateAfterShowUpdateCompleteNote(); - - - void ProcessComplete(TInt aStatus); - void EndTask(); - - TCmSettingSelection GetPolicyServerSelectionL(); - void ReportFailure(TUint32 aVpnIapId); - -private: // From CActive - void DoCancel(); - void RunL(); - TInt RunError(TInt aError); - -private: - CVpnConnStarter* iVpnConnStarter; - TVpnPolicyId iPolicyId; - TUint32 iRealIapId; - - TBool iPolicyUpdateAvailable; - TInt iStateAfterUpdateConfirmation; - - RVpnExtApi iVpnExtServ; - RNotifier iNotifier; - - TInt iCurrState; - TInt iNextState; - - TInt iVpnActStatus; - TInt iFinalStatus; - - CExtenderHelper* iExtenderHelper; - - TBool iShowCompletionNote; - - TPckgBuf iDialogInfoDes; - TPckgBuf iDialogResponseDes; - }; - - -#endif // __EXTENDER__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/inc/extenderhelper.h --- a/vpnengine/sit/inc/extenderhelper.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Helper class for extended functionality for policy provision process. -* -*/ - -#ifndef EXTENDERHELPER_H_ -#define EXTENDERHELPER_H_ - - -#include - -#include "vpnnotifierdefs.h" - -class CExtender; - -NONSHARABLE_CLASS(CExtenderHelper) : public CActive - { -public: - static CExtenderHelper* NewL(); - ~CExtenderHelper(); - -private: - CExtenderHelper(); - void ConstructL(); - -private: // From CActive - void DoCancel(); - void RunL(); - - -public: - void StartNotifierL(CExtender* aExtender); - -private: - RNotifier iNotifier; - - CExtender* iExtender; - - TPckgBuf iDialogInfoDes; - TPckgBuf iDialogResponseDes; - - }; -#endif // __EXTENDERHELPER__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/inc/taskarrivalobserver.h --- a/vpnengine/sit/inc/taskarrivalobserver.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/sit/inc/taskarrivalobserver.h Wed Oct 13 15:42:16 2010 +0300 @@ -32,13 +32,14 @@ /** * Combined task handler arrival observer and task handler manager. */ -NONSHARABLE_CLASS(CTaskArrivalObserver) : public CBase, - public MEventObserver, - public MTaskHandlerManager +NONSHARABLE_CLASS(CTaskArrivalObserver) : public CAsyncOneShot, public MEventObserver, public MTaskHandlerManager { public: static CTaskArrivalObserver* NewL(); ~CTaskArrivalObserver(); + +private: // From CAsyncOneShot + void RunL(); public: void Start(); @@ -58,12 +59,17 @@ void ConstructL(); private: // Implementation - void LaunchTaskHandlerL(const TTaskArrivedEventData& aEventSpec); + void LaunchTaskHandlerL(const TTaskArrivedEventData& aEventSpec); + CTaskHandler* CreateTaskHandlerL(const TTaskArrivedEventData& aEventSpec); + TInt FindTaskHandler(CTaskHandler* aTaskHandler); + TInt FindAsyncCleaner(CAsyncCleaner* aAsyncCleaner); + void AsyncDeleteTaskHandler(CTaskHandler* aTaskHandler); private: REventMediator iEventMediator; CArrayPtrFlat* iTaskHandlerList; CArrayPtrFlat* iAsyncCleanerList; + CTaskHandler* iTaskHandlerToDelete; }; NONSHARABLE_CLASS(CAsyncCleaner) : public CAsyncOneShot @@ -71,8 +77,8 @@ public: CAsyncCleaner(CTaskArrivalObserver* aTaskArrivalObserver, CTaskHandler* aTaskHandlerToDelete); - void Start(); - TBool IsMatchingCleaner(const CTaskHandler& aTaskHandler) const; + void Start(); + private: // From CAsyncOneShot void RunL(); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/src/eventlogger.cpp --- a/vpnengine/sit/src/eventlogger.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/sit/src/eventlogger.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -22,7 +22,6 @@ #include "log.h" #include "eventmediatorapi.h" #include "vpnconnstarter.h" -#include "extender.h" /** @@ -48,8 +47,6 @@ { // Set default access point names just // in case the real name fetching fails - iExtender=CExtender::NewL(); - iVpnApName.Copy(KUnknownVpnAp); iRealApName.Copy(KUnknownIap); @@ -59,7 +56,6 @@ CEventLogger::~CEventLogger() { LOG(Log::Printf(_L("CEventLogger::~CEventLogger\n"))); - delete iExtender; } void CEventLogger::LogEvent(TUint aMsgId, TAny* aAnyPtr, TInt aStatusCode, TInt aReasonCode) @@ -145,15 +141,13 @@ break; case R_VPN_MSG_VPN_IAP_ACT_START: - iExtender->OnVpnApActStart(static_cast(aAnyPtr)); + // NSSM removal break; case R_VPN_MSG_VPN_IAP_ACT_CANCEL: - iExtender->OnVpnApActCancel(); break; case R_VPN_MSG_VPN_IAP_ACT_END: - iExtender->OnVpnApActEnd(static_cast(aAnyPtr), aStatusCode, iRealIapId); break; default: diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/src/extender.cpp --- a/vpnengine/sit/src/extender.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,413 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Extended functinality for policy provision process. -* -*/ -#include -#include -#include -#include -#include - -#include "sit.h" -#include "extender.h" -#include "log.h" -#include "vpnconnstarter.h" -#include "extenderhelper.h" - - -CExtender* CExtender::NewL() - { - LOG(Log::Printf(_L("CExtender::NewL - begin\n"))); - CExtender* self = new (ELeave) CExtender(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - LOG(Log::Printf(_L("CExtender::NewL - end\n"))); - return self; - } - -CExtender::~CExtender() - { - LOG(Log::Printf(_L("CExtender::~CExtender\n"))); - Cancel(); - - iVpnExtServ.Close(); - iNotifier.Close(); - delete iExtenderHelper; - } - -CExtender::CExtender() : CActive(EPriorityNormal) - { - - } - -void CExtender::ConstructL() - { - CActiveScheduler::Add(this); - User::LeaveIfError(iVpnExtServ.Connect()); - User::LeaveIfError(iNotifier.Connect()); - } - -void CExtender::DoCancel() - { - CancelOngoingOperation(); - } - -void CExtender::RunL() - { - ChangeStateL(); - } - -void CExtender::GotoState(TInt aState) - { - SetNextState(aState); - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - } - -void CExtender::SetCurrState(TInt aState) - { - iCurrState = aState; - } - -void CExtender::SetNextState(TInt aState) - { - iNextState = aState; - } - -TInt CExtender::CurrState() - { - return iCurrState; - } - -TInt CExtender::NextState() - { - return iNextState; - } - -TInt CExtender::RunError(TInt aError) - { - LOG(Log::Printf(_L("CExtender::RunError - error = %d\n"), aError)); - ProcessComplete(aError); - return KErrNone; - } - -void CExtender::ChangeStateL() - { - switch (NextState()) - { - case KStateCheckPolicyUpdateAvailability: - StateCheckPolicyUpdateAvailabilityL(); - break; - - case KStateAfterAskUpdateConfirmation: - StateAfterAskUpdateConfirmationL(); - break; - - case KStateUpdatePolicy: - StateUpdatePolicyL(); - break; - - case KStateAfterUpdatePolicy: - StateAfterUpdatePolicyL(); - break; - - case KStateShowUpdateCompleteNote: - StateShowUpdateCompleteNote(); - break; - - case KStateAfterShowUpdateCompleteNote: - StateAfterShowUpdateCompleteNote(); - break; - - case KStateShowApActFailureNote: - StateShowApActFailureNote(); - break; - - case KStateAfterShowApActFailureNote: - StateAfterShowApActFailureNote(); - break; - - default: - User::Panic(KSitName, EPanicInvalidTaskHandlerState); - } - } - -void CExtender::CancelOngoingOperation() - { - switch (CurrState()) - { - case KStateShowApActFailureNote: - case KStateAskUpdateConfirmation: - case KStateShowUpdateCompleteNote: - LOG(Log::Printf(_L("CExtender::CancelOngoingOperation - cancelling notifier\n"))); - iNotifier.CancelNotifier(KUidVpnDialogNotifier); - break; - - case KStateCheckPolicyUpdateAvailability: - case KStateUpdatePolicy: - case KStateAfterUpdatePolicy: - LOG(Log::Printf(_L("CExtender::CancelOngoingOperation - cancelling Policy Provision operation\n"))); - iVpnExtServ.CancelPolicyProvision(); - iExtenderHelper->Cancel(); - break; - - case KStateAfterShowApActFailureNote: - case KStateAfterAskUpdateConfirmation: - case KStateAfterCheckPolicyUpdateAvailability: - case KStateAfterShowUpdateCompleteNote: - LOG(Log::Printf(_L("CExtender::CancelOngoingOperation - cancelling nothing\n"))); - // Nothing to cancel - break; - - default: - User::Panic(KSitName, EPanicInvalidTaskHandlerState); - } - } - -void CExtender::OnVpnApActStart(CVpnConnStarter* aVpnConnStarter) - { - LOG(Log::Printf(_L("CExtender::OnVpnApActStart\n"))); - iVpnConnStarter = aVpnConnStarter; - - // Prevent the deletion of the iVpnConnStarter task - // handler (that owns us) as long as we are running - iVpnConnStarter->SetDelayedTaskEnd(ETrue); - } - -void CExtender::OnVpnApActCancel() - { - LOG(Log::Printf(_L("CExtender::OnVpnApActCancel\n"))); - - // Allow the deletion of the iVpnConnStarter task handler - // (the activation has been cancelled in which case - // automatic policy updating process will not be - // performed and thus the task handler can be deleted - // right away after cancel) - iVpnConnStarter->SetDelayedTaskEnd(EFalse); - } - -void CExtender::OnVpnApActEnd(const TVpnPolicyId* aPolicyId, TInt aStatus, TUint32 aRealIapId) - { - LOG(Log::Printf(_L("CExtender::OnVpnApActEnd\n"))); - iPolicyId.Copy(*aPolicyId); - iRealIapId = aRealIapId; - - iVpnActStatus = aStatus; - - if (iVpnActStatus != KErrNone && iVpnActStatus != KErrCancel) - { - // Report the failure to the system - // (management session runner if such is present) - // First show a VPN connection activation failure note - GotoState(KStateShowApActFailureNote); - } - else if (iVpnActStatus == KErrCancel) - { - // The user has cancelled the VPN connection activation, - // in that case the automatic policy update operation is - // not performed - EndTask(); - } - else - { - // Begin the combined policy update and - // certificate enrollment process right away - //GotoState(KStateCheckPolicyUpdateAvailability); - EndTask(); - } - } - -void CExtender::StateShowApActFailureNote() - { - LOG(Log::Printf(_L("CExtender::StateShowApActFailureNote\n"))); - SetCurrState(KStateShowApActFailureNote); - iStatus = KRequestPending; - SetActive(); - - TRequestStatus* ownStatus = &iStatus; - User::RequestComplete(ownStatus, KErrNone); - - SetNextState(KStateAfterShowApActFailureNote); - } - -void CExtender::StateAfterShowApActFailureNote() - { - LOG(Log::Printf(_L("CExtender::StateAfterShowApActFailureNote\n"))); - SetCurrState(KStateAfterShowApActFailureNote); - - iNotifier.CancelNotifier(KUidVpnDialogNotifier); - - // Begin the combined policy update - // and certificate enrollment process - GotoState(KStateCheckPolicyUpdateAvailability); - } - - -void CExtender::StateCheckPolicyUpdateAvailabilityL() - { - LOG(Log::Printf(_L("CExtender::StateCheckPolicyUpdateAvailabilityL\n"))); - SetCurrState(KStateCheckPolicyUpdateAvailability); - - LOG(Log::Printf(_L(" Doing the policy update.\n"))); - - - TAgileProvisionPolicy vpnPolicyName; - User::LeaveIfError(iVpnExtServ.GetPolicyName(vpnPolicyName)); - - if ( iPolicyId.Compare(vpnPolicyName.iPolicyName) == 0 ) - { - SetCurrState(KStateAskUpdateConfirmation); - - TVpnDialogInfo dialogInfo(TVpnDialog::EPolicyUpdateConfirmation, 0); - iDialogInfoDes() = dialogInfo; - - iNotifier.StartNotifierAndGetResponse(iStatus, KUidVpnDialogNotifier, - iDialogInfoDes, iDialogResponseDes); - - SetActive(); - SetNextState(KStateAfterAskUpdateConfirmation); - } - else - { - EndTask(); - } - } - - -void CExtender::StateAfterAskUpdateConfirmationL() - { - LOG(Log::Printf(_L("CExtender::StateAfterAskUpdateConfirmationL\n"))); - SetCurrState(KStateAfterAskUpdateConfirmation); - - iNotifier.CancelNotifier(KUidVpnDialogNotifier); - - // If the user pressed Cancel or an - // error occurred, we stop here - User::LeaveIfError(iStatus.Int()); - - iShowCompletionNote = ETrue; - GotoState(KStateUpdatePolicy); - } - -void CExtender::StateUpdatePolicyL() - { - LOG(Log::Printf(_L("CExtender::StateUpdatePolicy\n"))); - SetCurrState(KStateUpdatePolicy); - - if ( iExtenderHelper == NULL) - iExtenderHelper=CExtenderHelper::NewL(); - - iExtenderHelper->StartNotifierL(this); - - - iVpnExtServ.SynchronizePolicyServer(iStatus); - - SetActive(); - SetNextState(KStateAfterUpdatePolicy); - } - -void CExtender::StateAfterUpdatePolicyL() - { - LOG(Log::Printf(_L("CExtender::StateAfterUpdatePolicyL\n"))); - - - if (iStatus != KErrNone) - { - User::Leave(iStatus.Int()); - } - - ProcessComplete(KErrNone); - } - -void CExtender::ProcessComplete(TInt aStatus) - { - LOG(Log::Printf(_L("CExtender::ProcessComplete - status = %d\n"), aStatus)); - iFinalStatus = aStatus; - GotoState(KStateShowUpdateCompleteNote); - } - -void CExtender::StateShowUpdateCompleteNote() - { - LOG(Log::Printf(_L("CExtender::StateShowUpdateCompleteNote\n"))); - SetCurrState(KStateShowUpdateCompleteNote); - - if (!iShowCompletionNote || iFinalStatus == KErrCancel) - { - EndTask(); - } - else if ( iFinalStatus == KErrNone ) - { - - TVpnDialogInfo dialogInfo(TNoteDialog::EInfo, TVpnNoteDialog::EPolicyUpdateSucceeded); - iDialogInfoDes() = dialogInfo; - - iNotifier.StartNotifierAndGetResponse(iStatus, KUidVpnDialogNotifier, - iDialogInfoDes, iDialogResponseDes); - - SetActive(); - SetNextState(KStateAfterShowUpdateCompleteNote); - - } - else - { - TVpnDialogInfo dialogInfo(TNoteDialog::EInfo, TVpnNoteDialog::EPolicyUpdateFailed); - iDialogInfoDes() = dialogInfo; - - iNotifier.StartNotifierAndGetResponse(iStatus, KUidVpnDialogNotifier, - iDialogInfoDes, iDialogResponseDes); - - SetActive(); - SetNextState(KStateAfterShowUpdateCompleteNote); - } - - - } - -void CExtender::StateAfterShowUpdateCompleteNote() - { - LOG(Log::Printf(_L("CExtender::StateAfterShowUpdateCompleteNote\n"))); - SetCurrState(KStateAfterShowUpdateCompleteNote); - - iNotifier.CancelNotifier(KUidVpnDialogNotifier); - - EndTask(); - } - -TCmSettingSelection CExtender::GetPolicyServerSelectionL() - { - - // Get policy server details - // from the Policy Provision server configuration - TAgileProvisionApiServerSettings vpnPolicyServerDetails; - User::LeaveIfError(iVpnExtServ.ServerDetails(vpnPolicyServerDetails)); - - - // Return the server selection - return vpnPolicyServerDetails.iSelection; - } - -void CExtender::EndTask() - { - LOG(Log::Printf(_L("CExtender::EndTask\n"))); - // Allow the deletion of the CVpnConStarter task handler - iVpnConnStarter->SetDelayedTaskEnd(EFalse); - - // We're done and the enclosing connection starter - // object is now free to go (causing the deletion - // of this extender object as well) - iVpnConnStarter->TaskDone(); - } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/src/extenderhelper.cpp --- a/vpnengine/sit/src/extenderhelper.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Helper class for extended functionality for policy provision process. -* -*/ - - -#include "extenderhelper.h" -#include "extender.h" - - -CExtenderHelper* CExtenderHelper::NewL() - { - CExtenderHelper* self = new (ELeave) CExtenderHelper(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -CExtenderHelper::~CExtenderHelper() - { - iExtender=NULL; - Cancel(); - iNotifier.Close(); - } - -CExtenderHelper::CExtenderHelper() : CActive(EPriorityNormal) - { - - } - -void CExtenderHelper::ConstructL() - { - CActiveScheduler::Add(this); - User::LeaveIfError(iNotifier.Connect()); - - } - -//From CActive -void CExtenderHelper::DoCancel() - { - iNotifier.CancelNotifier(KUidVpnDialogNotifier); - } - -void CExtenderHelper::RunL() - { - ASSERT(iStatus.Int() == KErrCancel); - iExtender->Cancel(); - - } - - -void CExtenderHelper::StartNotifierL(CExtender* aExtender) - { - iExtender=aExtender; - - TVpnDialogInfo dialogInfo(TVpnDialog::EPolicyInstallInProgress, 0); - iDialogInfoDes() = dialogInfo; - - iNotifier.StartNotifierAndGetResponse(iStatus, KUidVpnDialogNotifier, - iDialogInfoDes, iDialogResponseDes); - SetActive(); - } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/src/sit.cpp --- a/vpnengine/sit/src/sit.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/sit/src/sit.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -157,8 +157,7 @@ CActiveScheduler::Start(); // Cleanup the task handler and scheduler - CleanupStack::PopAndDestroy(taskArrivalObserver); - CleanupStack::PopAndDestroy(scheduler); + CleanupStack::PopAndDestroy(2); // taskArrivalObserver, scheduler LOG(Log::Printf(_L("CSit::StartWorkingL - end\n"))); } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/sit/src/taskarrivalobserver.cpp --- a/vpnengine/sit/src/taskarrivalobserver.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/sit/src/taskarrivalobserver.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -33,6 +33,7 @@ } CTaskArrivalObserver::CTaskArrivalObserver() + : CAsyncOneShot(EPriorityNormal) { } @@ -48,9 +49,8 @@ LOG(Log::Printf(_L("CTaskArrivalObserver::~CTaskArrivalObserver\n"))); Cancel(); iEventMediator.Close(); - if (iTaskHandlerList) - { + { iTaskHandlerList->ResetAndDestroy(); delete iTaskHandlerList; } @@ -116,25 +116,62 @@ { LOG(Log::Printf(_L("CTaskArrivalObserver::LaunchTaskHandlerL\n"))); // A new task has arrived so create a task handler for it + CTaskHandler* taskHandler = CreateTaskHandlerL(aEventSpec); - CTaskHandler* taskHandler = TaskHandlerCreator::CreateTaskHandlerL(this, aEventSpec); + // Add the handler to the list of active handlers + iTaskHandlerList->AppendL(taskHandler); + + // And start performing the task + taskHandler->Start(); + } + +CTaskHandler* CTaskArrivalObserver::CreateTaskHandlerL(const TTaskArrivedEventData& aEventSpec) + { + LOG(Log::Printf(_L("CTaskArrivalObserver::CreateTaskHandlerL\n"))); + CTaskHandler* taskHandler = NULL; + + taskHandler = TaskHandlerCreator::CreateTaskHandlerL(this, aEventSpec); + if (!taskHandler) { User::Panic(KSitName, EPanicUnknownEventType); } - - // Add the handler to the list of active handlers - iTaskHandlerList->AppendL(taskHandler); + + return taskHandler; + } - //Create the asyncleaner for cleaning the task handler, when the - //task is done. - CAsyncCleaner* asyncCleaner = new (ELeave) CAsyncCleaner(this, taskHandler); - iAsyncCleanerList->AppendL(asyncCleaner); - - // And start performing the task - taskHandler->Start(); +TInt CTaskArrivalObserver::FindTaskHandler(CTaskHandler* aTaskHandler) + { + TInt foundIndex = KUnfoundIndex; + + for (TInt i = 0; i < iTaskHandlerList->Count(); i++) + { + if (iTaskHandlerList->At(i) == aTaskHandler) + { + foundIndex = i; + break; + }; + } + + return foundIndex; } +TInt CTaskArrivalObserver::FindAsyncCleaner(CAsyncCleaner* aAsyncCleaner) + { + TInt foundIndex = KUnfoundIndex; + + for (TInt i = 0; i < iAsyncCleanerList->Count(); i++) + { + if (iAsyncCleanerList->At(i) == aAsyncCleaner) + { + foundIndex = i; + break; + }; + } + + return foundIndex; + } + void CTaskArrivalObserver::TaskHandlerComplete(CTaskHandler* aTaskHandler) { LOG(Log::Printf(_L("CTaskArrivalObserver::TaskHandlerComplete\n"))); @@ -144,73 +181,98 @@ // Otherwise we'll get panic E32USER-CBase 42 (SetActive called // while active object is already active). - //Find the async cleaner for the task handler: - TInt i = 0; - for (i = 0; i < iAsyncCleanerList->Count(); ++i) + // NOTE. Each asyncCleaner instance will cause itself to be deleted + CAsyncCleaner* asyncCleaner = new CAsyncCleaner(this, aTaskHandler); + if (asyncCleaner) + { + // Add the handler to a list of cleaners. This list + // is needed to handle some rare cases where the SIT + // thread dies before one or more async cleaners get + // the chance to delete themselves. Such cleaner + // instances get destroyed by the CTaskArrivalObserver + // destructor. + TRAP_IGNORE(iAsyncCleanerList->AppendL(asyncCleaner)); + // Initiate the task handler delete operation + asyncCleaner->Start(); + } + else { - if (iAsyncCleanerList->At(i)->IsMatchingCleaner(*aTaskHandler)) - { - iAsyncCleanerList->At(i)->Start(); - } + // Backup - just in case asyncCleaner could not be created + AsyncDeleteTaskHandler(aTaskHandler); } - __ASSERT_DEBUG(i <= iAsyncCleanerList->Count(), User::Invariant()); - + } + +void CTaskArrivalObserver::AsyncDeleteTaskHandler(CTaskHandler* aTaskHandler) + { + LOG(Log::Printf(_L("CTaskArrivalObserver::AsyncDeleteTaskHandler\n"))); + iTaskHandlerToDelete = aTaskHandler; + Call(); + } + +void CTaskArrivalObserver::RunL() // Called as a result of AsyncDeleteTaskHandler + { + LOG(Log::Printf(_L("CTaskArrivalObserver::RunL\n"))); + + DeleteTaskHandler(iTaskHandlerToDelete); + + iTaskHandlerToDelete = NULL; } void CTaskArrivalObserver::DeleteTaskHandler(CTaskHandler* aTaskHandler) { LOG(Log::Printf(_L("CTaskArrivalObserver::DeleteTaskHandler\n"))); - __ASSERT_DEBUG(aTaskHandler != NULL, User::Invariant()); - // The specified task handler has done its // job succesfully so it can be deleted - TInt taskHandlerIndex = KErrNotFound; - - for (TInt i = 0; i < iTaskHandlerList->Count(); i++) + TInt taskHandlerIndex = FindTaskHandler(aTaskHandler); + + if (taskHandlerIndex != KUnfoundIndex) { - if (iTaskHandlerList->At(i) == aTaskHandler) - { - taskHandlerIndex = i; - break; - }; + LOG(Log::Printf(_L("CTaskArrivalObserver::DeleteTaskHandler - deleting task handler\n"))); + // Delete the task handler + delete iTaskHandlerList->At(taskHandlerIndex); + // Delete the list item + iTaskHandlerList->Delete(taskHandlerIndex); + // Deleting elements from the array does not cause + // the array buffer to be automatically compressed. + // Compress it to return excess space to the heap + // as task handlers come and go. + iTaskHandlerList->Compress(); } - - __ASSERT_DEBUG(taskHandlerIndex >= 0, User::Invariant()); - - LOG(Log::Printf(_L("CTaskArrivalObserver::DeleteTaskHandler - deleting task handler\n"))); - // Delete the task handler - delete aTaskHandler; - iTaskHandlerList->Delete(taskHandlerIndex); - iTaskHandlerList->Compress(); + else + { + // + delete aTaskHandler; + } } void CTaskArrivalObserver::DeleteAsyncCleaner(CAsyncCleaner* aAsyncCleaner) { LOG(Log::Printf(_L("CTaskArrivalObserver::DeleteAsyncCleaner\n"))); - __ASSERT_DEBUG(aAsyncCleaner != NULL, User::Invariant()); - // The specified asynchronous cleaner // has done its job and be deleted + TInt asyncCleanerIndex = FindAsyncCleaner(aAsyncCleaner); - TInt asyncCleanerIndex = KErrNotFound; - for (TInt i = 0; i < iAsyncCleanerList->Count(); i++) + if (asyncCleanerIndex != KUnfoundIndex) { - if (iAsyncCleanerList->At(i) == aAsyncCleaner) - { - asyncCleanerIndex = i; - break; - }; + LOG(Log::Printf(_L("CTaskArrivalObserver::DeleteAsyncCleaner - deleting async cleaner\n"))); + // Delete the cleaner object + delete iAsyncCleanerList->At(asyncCleanerIndex); + // Delete the list item + iAsyncCleanerList->Delete(asyncCleanerIndex); + // Deleting elements from the array does not cause + // the array buffer to be automatically compressed. + // Compress it to return excess space to the heap + // as cleaner objects come and go. + iAsyncCleanerList->Compress(); } - - __ASSERT_DEBUG(asyncCleanerIndex >= 0, User::Invariant()); - - // Delete the cleaner object - delete aAsyncCleaner; - iAsyncCleanerList->Delete(asyncCleanerIndex); - iAsyncCleanerList->Compress(); - + else + { + // Always delete the cleaner instance even + // though it have not been added to the list + delete aAsyncCleaner; + } } void CTaskArrivalObserver::TaskHandlerFatalError(CTaskHandler* /*aTaskHandler*/, TInt /*aError*/) @@ -248,8 +310,3 @@ // Delete this cleaner object instance as well iTaskArrivalObserver->DeleteAsyncCleaner(this); } - -TBool CAsyncCleaner::IsMatchingCleaner(const CTaskHandler& aTaskHandler) const - { - return iTaskHandlerToDelete == &aTaskHandler; - } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpncommon/inc/vpnnotifierdefs.h --- a/vpnengine/vpncommon/inc/vpnnotifierdefs.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpncommon/inc/vpnnotifierdefs.h Wed Oct 13 15:42:16 2010 +0300 @@ -131,8 +131,7 @@ { EUserPwd = 2000, // MUST be greater than the last value in enum TNoteDialog::TDialogId ESecurIdPin, - ESecurIdNextPin, - ESecurIdCode + ESecurIdNextPin }; }; @@ -186,9 +185,7 @@ EVpnCannotForceDeviceLock, EVpnPolicyInstalled, // Kmd related notes - EKmdAuthenticationFailed = 2000, - EKmdTokenNotFound, - EKmdTokenExpired + EKmdAuthenticationFailed = 2000 }; }; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/.cproject --- a/vpnengine/vpnextapi/.cproject Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/.project --- a/vpnengine/vpnextapi/.project Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ - - - vpnextapi - - - - - - com.nokia.carbide.cdt.builder.carbideCPPBuilder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - com.nokia.carbide.cdt.builder.carbideCPPBuilderNature - - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/bwins/vpnextapiu.def --- a/vpnengine/vpnextapi/bwins/vpnextapiu.def Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -EXPORTS - ?GetPolicyName@RVpnExtApi@@QAEHAAVTAgileProvisionPolicy@@@Z @ 1 NONAME ; int RVpnExtApi::GetPolicyName(class TAgileProvisionPolicy &) - ?DeleteServer@RVpnExtApi@@QAEHXZ @ 2 NONAME ; int RVpnExtApi::DeleteServer(void) - ?ServerListL@RVpnExtApi@@QAEHAAVTAgileProvisionApiServerListElem@@@Z @ 3 NONAME ; int RVpnExtApi::ServerListL(class TAgileProvisionApiServerListElem &) - ?ServerDetails@RVpnExtApi@@QAEHAAVTAgileProvisionApiServerSettings@@@Z @ 4 NONAME ; int RVpnExtApi::ServerDetails(class TAgileProvisionApiServerSettings &) - ?SynchronizePolicyServer@RVpnExtApi@@QAEXAAVTRequestStatus@@@Z @ 5 NONAME ; void RVpnExtApi::SynchronizePolicyServer(class TRequestStatus &) - ??0RVpnExtApi@@QAE@XZ @ 6 NONAME ; RVpnExtApi::RVpnExtApi(void) - ?CreateServer@RVpnExtApi@@QAEHABVTAgileProvisionApiServerSettings@@@Z @ 7 NONAME ; int RVpnExtApi::CreateServer(class TAgileProvisionApiServerSettings const &) - ?CancelPolicyProvision@RVpnExtApi@@QAEHXZ @ 8 NONAME ; int RVpnExtApi::CancelPolicyProvision(void) - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/eabi/vpnextapiu.def --- a/vpnengine/vpnextapi/eabi/vpnextapiu.def Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - _ZN10RVpnExtApi11ServerListLER32TAgileProvisionApiServerListElem @ 1 NONAME - _ZN10RVpnExtApi12CreateServerERK32TAgileProvisionApiServerSettings @ 2 NONAME - _ZN10RVpnExtApi12DeleteServerEv @ 3 NONAME - _ZN10RVpnExtApi13GetPolicyNameER21TAgileProvisionPolicy @ 4 NONAME - _ZN10RVpnExtApi13ServerDetailsER32TAgileProvisionApiServerSettings @ 5 NONAME - _ZN10RVpnExtApi21CancelPolicyProvisionEv @ 6 NONAME - _ZN10RVpnExtApi23SynchronizePolicyServerER14TRequestStatus @ 7 NONAME - _ZN10RVpnExtApiC1Ev @ 8 NONAME - _ZN10RVpnExtApiC2Ev @ 9 NONAME - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/group/ABLD.BAT --- a/vpnengine/vpnextapi/group/ABLD.BAT Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -@ECHO OFF - -REM Bldmake-generated batch file - ABLD.BAT -REM ** DO NOT EDIT ** - -perl -S ABLD.PL "\vpnclient\vpnengine\vpnextapi\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel==1 goto CheckPerl -goto End - -:CheckPerl -perl -v >NUL -if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? -goto End - -:End diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/group/bld.inf --- a/vpnengine/vpnextapi/group/bld.inf Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for VPN Ext API -* -*/ - -#include - -PRJ_EXPORTS - -PRJ_MMPFILES -vpnextapi.mmp diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/group/vpnextapi.mmp --- a/vpnengine/vpnextapi/group/vpnextapi.mmp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition file for VPN Ext API -* -*/ - -#include - -TARGET vpnextapi.dll -TARGETTYPE dll -UID 0x1000008d 0x20016A86 - -CAPABILITY ALL -Tcb -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE vpnextapi.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../vpnengine/vpnmanager/inc - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY vpnapi.lib - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/inc/vpnextapi.h --- a/vpnengine/vpnextapi/inc/vpnextapi.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN Ext API -* -*/ - -#ifndef R_VPNEXTAPI_H -#define R_VPNEXTAPI_H - -// INCLUDES -#include -#include -#include -#include "vpnextapiservantdefs.h" - - - -class TAgileProvisionApiServerSettings - - { - public: - TCmSettingSelection iSelection; - TBuf8 iServerUrl; - TBuf iServerNameLocal; - }; - - class TAgileProvisionApiServerListElem - - { - public: - TBuf8 iServerUrl; - TBuf iServerNameLocal; - }; - - class TAgileProvisionPolicy - - { - public: - TBuf iPolicyName; - }; - -/** - * VPN Ext API. - * - * VPN Ext API allows clients to manage VPN policies. VPN Ext API provides - * extended functionality to VPN API. - */ -class RVpnExtApi : public RVpnServ - { -public: - - - - - /** - * Constructor - */ - IMPORT_C RVpnExtApi(); - - - - IMPORT_C TInt CreateServer( const TAgileProvisionApiServerSettings& aServerDetails ); - IMPORT_C TInt ServerDetails( TAgileProvisionApiServerSettings& aServerDetails ); - IMPORT_C TInt ServerListL( TAgileProvisionApiServerListElem& aVpnPolicyServerList ); - IMPORT_C TInt DeleteServer( ); - IMPORT_C void SynchronizePolicyServer( TRequestStatus& aStatus ); - IMPORT_C TInt CancelPolicyProvision(); - IMPORT_C TInt GetPolicyName(TAgileProvisionPolicy& aVpnPolicyName); -private: - - }; - -#endif // R_VPNEXTAPI_H diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/inc/vpnextapiservantdefs.h --- a/vpnengine/vpnextapi/inc/vpnextapiservantdefs.h Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN External API servant definitions -* -*/ - -#ifndef VPNEXTAPISERVANTDEFS_H -#define VPNEXTAPISERVANTDEFS_H - -const TInt KMaxProvisionServerUrlLength = 100; -const TInt KMaxProvisionServerNameLength = 100; -const TInt KMaxPolicyServerFileNameLength = 100; - -// VPN policy server settings file definition constants -const TInt KPolicyServerAddressLine = 1; //Address of the policy server -const TInt KPolicyServerNameLine = 2; //Name of the server. Not has to be equal to real host name of server -const TInt KPolicyServerIapIdLine = 3; // Used IAP for policy provision operation -const TInt KPolicyServerIapModeLine = 4; //Iap mode for used IAP (SNAP, AP) -const TInt KPolicyFileLine = 5; //real file name of the imported policy in private dir -const TInt KAgileProvisionVpnIapId = 6; //ID of created IAP for provisioned policy. - - -_LIT(KProvisionServerSettings, "vpnpolicyserver"); -_LIT(KNullDesc, ""); -_LIT8(KNullDesc8, ""); - - -class TAgileProvisionServerLocals -{ -public: - TCmSettingSelection iSelection; - TBuf8 iServerAddress; - TBuf iServerNameLocal; -}; - - -#endif // VPNEXTAPISERVANTDEFS_H diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/rom/vpnextapi.iby --- a/vpnengine/vpnextapi/rom/vpnextapi.iby Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for project -* VPN Ext API -* -*/ - -#ifndef __VPNEXTAPI_IBY__ -#define __VPNEXTAPI_IBY__ - -#ifdef FF_VPN_CLIENT - -file=ABI_DIR\BUILD_DIR\vpnextapi.dll SHARED_LIB_DIR\vpnextapi.dll - -#endif // FF_VPN_CLIENT - -#endif // __VPNEXTAPI_IBY__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnextapi/src/vpnextapi.cpp --- a/vpnengine/vpnextapi/src/vpnextapi.cpp Wed Sep 15 13:20:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: VPN Ext API -* -*/ - - -#include "vpnextapi.h" -#include "vpnextapiservantdefs.h" -#include "vpnmanagerserverdefs.h" - -EXPORT_C RVpnExtApi::RVpnExtApi() : RVpnServ() - { - } - - -EXPORT_C TInt RVpnExtApi::CreateServer( const TAgileProvisionApiServerSettings& aServerDetails ) - { - TPckg serverCreatePckg(aServerDetails); - return SendReceive(EExtCreateProvisionServer, TIpcArgs(&serverCreatePckg)); - } - - -EXPORT_C TInt RVpnExtApi::ServerDetails( TAgileProvisionApiServerSettings& aServerDetails ) - { - TPckg serverPckg( aServerDetails ); - - return SendReceive(EExtVPNPolicyServerDetails, TIpcArgs(&serverPckg)); - } - -EXPORT_C TInt RVpnExtApi::DeleteServer( ) - { - return SendReceive(EExtDeletePolicyServer); - } - -EXPORT_C TInt RVpnExtApi::ServerListL( TAgileProvisionApiServerListElem& aVpnPolicyServerList ) - { - TPckg serverPckg( aVpnPolicyServerList ); - return SendReceive(EExtVPNPolicyServerList, TIpcArgs(&serverPckg)); - } - -EXPORT_C void RVpnExtApi::SynchronizePolicyServer( TRequestStatus& aStatus ) - { - SendReceive(EExtSynchronizePolicyServer, aStatus); - } - -EXPORT_C TInt RVpnExtApi::CancelPolicyProvision( ) - { - return SendReceive(EExtCancelSynchronize); - } - -EXPORT_C TInt RVpnExtApi::GetPolicyName(TAgileProvisionPolicy& aVpnPolicyName) - { - TPckg serverPckg( aVpnPolicyName ); - return SendReceive(EExtGetPolicyName, TIpcArgs(&serverPckg)); - } - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/group/vpnmanager.mmp --- a/vpnengine/vpnmanager/group/vpnmanager.mmp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/group/vpnmanager.mmp Wed Oct 13 15:42:16 2010 +0300 @@ -52,11 +52,8 @@ USERINCLUDE ../../utlbase64/inc USERINCLUDE ../../utlpkcs10/inc USERINCLUDE ../../../vpnui/vpnecomnotifier/inc -USERINCLUDE ../../../vpnui/vpnpolins/inc USERINCLUDE ../../eventmediatorapi/inc USERINCLUDE ../../eventviewer/inc -USERINCLUDE ../../agileprovisionws/inc -USERINCLUDE ../../vpnextapi/inc MW_LAYER_SYSTEMINCLUDE @@ -78,9 +75,8 @@ LIBRARY charconv.lib LIBRARY cmmanager.lib LIBRARY cryptography.lib -LIBRARY agileprovisionws.lib LIBRARY centralrepository.lib DEBUGLIBRARY flogger.lib -EPOCSTACKSIZE 0x5000 +EPOCSTACKSIZE 0x4000 diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/group/vpnmanager_test.mmp --- a/vpnengine/vpnmanager/group/vpnmanager_test.mmp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/group/vpnmanager_test.mmp Wed Oct 13 15:42:16 2010 +0300 @@ -52,11 +52,8 @@ USERINCLUDE ../../utlbase64/inc USERINCLUDE ../../utlpkcs10/inc USERINCLUDE ../../../vpnui/vpnecomnotifier/inc -USERINCLUDE ../../../vpnui/vpnpolins/inc USERINCLUDE ../../eventmediatorapi/inc USERINCLUDE ../../eventviewer/inc -USERINCLUDE ../../agileprovisionws/inc -USERINCLUDE ../../vpnextapi/inc MW_LAYER_SYSTEMINCLUDE @@ -79,9 +76,8 @@ LIBRARY charconv.lib LIBRARY cmmanager.lib LIBRARY cryptography.lib -LIBRARY agileprovisionws.lib LIBRARY centralrepository.lib DEBUGLIBRARY flogger.lib -EPOCSTACKSIZE 0x5000 +EPOCSTACKSIZE 0x4000 diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/inc/cmmanagerutils.h --- a/vpnengine/vpnmanager/inc/cmmanagerutils.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/inc/cmmanagerutils.h Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -37,12 +37,9 @@ { public: - static TUint32 CreateVPNConnectionMethodToIntranetL(const TVpnPolicyInfo& aVpnPolicyInfo, + static void CreateVPNConnectionMethodToIntranetL(const TVpnPolicyInfo& aVpnPolicyInfo, CEventLogger& aEventLogger); - static TBool ProvisionIAPNameExistL(TUint32 aAgileProvisionAPId); - - private: static void SetVpnConnectionMethodAttributesL(RCmConnectionMethodExt& aConnectionMethod, diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/inc/policyimporter.h --- a/vpnengine/vpnmanager/inc/policyimporter.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/inc/policyimporter.h Wed Oct 13 15:42:16 2010 +0300 @@ -34,11 +34,9 @@ class CPolicyPatchInfoList; class CIkeDataArray; class CIkeData; -class CAgileProvisionWs; const TInt KMaxExtPolicyIdLength = 256; const TInt KDoNotGetKeySize = -1; -const TInt KMaxIapLength = 10; typedef TBuf TExtVpnPolicyId; @@ -61,9 +59,7 @@ void ImportPolicyL(const TDesC& aDir); void ImportSinglePolicyL(const TDesC& aDir, TVpnPolicyId& aNewPolicyId); - void SynchronizeVpnPolicyServerL(); - - + private: CPolicyImporter(const RMessage2& aMessage, CVpnApiServant& aVpnApiServant, CPolicyStore& iPolicyStore, RFs& aFs); @@ -100,8 +96,6 @@ void StateImportPinAndPolL(); void StateCreateVpnDestinationL(); void StateEndPolicyImportL(); - void StateGetPolicyProvisionServiceL(); - void StateAfterGetPolicyProvisionServiceL(); void BuildPolicyIdListL(); TPkiServiceStoreType GetStoreTypeL(CIkeData* aData); @@ -157,25 +151,9 @@ /** * Returns Issuer name of certificate */ - HBufC8* CertIssuerL(const TFileName& aCertFile); - TFileName GetCAFromFileListL(const TDesC8& aCertSubjectName, CArrayFixFlat* aCertFileArray); - - /** - * Checks whether mVPN policy provision is requested - */ - TBool GetPolicyService(); - - void GetPolicyWsL(); - - HBufC8* GetPolicyNameL(HBufC* aPolicyFileName); - - void PatchPolicyProvisionL(); + HBufC8* CPolicyImporter::CertIssuerL(const TFileName& aCertFile); + TFileName CPolicyImporter::GetCAFromFileListL(const TDesC8& aCertSubjectName, CArrayFixFlat* aCertFileArray); - -public: - //Policy provision service - CAgileProvisionWs* iAgileProvisionWs; - private: RMessage2 iMessage; TRequestStatus* iExtStatus; @@ -220,16 +198,9 @@ TAny* iPkiOpContext; TBool iImportSinglePolicy; - TBool iAgileProvision; TVpnPolicyId* iNewPolicyId; - TVpnPolicyId iNewPolicyIdBuf; + TVpnPolicyId iPolicyId; - - TBuf iPolicyIdBuf; - - HBufC8* iAgileProvisionWSAddr; - - TUint32 iAgileProvisionAPId; }; #endif // __POLICYIMPORTER_H__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/inc/vpnapiservant.h --- a/vpnengine/vpnmanager/inc/vpnapiservant.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/inc/vpnapiservant.h Wed Oct 13 15:42:16 2010 +0300 @@ -22,11 +22,7 @@ #include #include "vpnapi.h" -#include "vpnextapi.h" -#include "vpnextapiservantdefs.h" #include "eventlogger.h" -#include "fileutil.h" - class RFs; class CPolicyStore; @@ -72,20 +68,12 @@ void AddPolicyL(const RMessage2& aMessage); void UpdatePolicyDetailsL(const RMessage2& aMessage); void UpdatePolicyDataL(const RMessage2& aMessage); - void CreateProvisionServerL( const RMessage2& aMessage ); - void ListProvisionServerL( const RMessage2& aMessage ); - void GetProvisionServerDetailsL( const RMessage2& aMessage ); - void DeleteVPNPolicyServerL( const RMessage2& aMessage ); - void SynchronizeVPNPolicyServerL( const RMessage2& aMessage ); - void CancelSynchronize( const RMessage2& aMessage ); - void GetVPNPolicyNameL( const RMessage2& aMessage ); private: CPolicyStore* iPolicyStore; CPwdChanger* iPwdChanger; CPolicyImporter* iPolicyImporter; RFs& iFs; - TFileUtil iFileUtil; }; #endif // __VPNAPISERVANT_H__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/inc/vpnmanagerserverdefs.h --- a/vpnengine/vpnmanager/inc/vpnmanagerserverdefs.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/inc/vpnmanagerserverdefs.h Wed Oct 13 15:42:16 2010 +0300 @@ -53,16 +53,7 @@ // OMA DM based policy management) EVpnAddPolicy, EVpnUpdatePolicyDetails, - EVpnUpdatePolicyData, - - //Policy provision - EExtCreateProvisionServer, - EExtDeletePolicyServer, - EExtVPNPolicyServerList, - EExtVPNPolicyServerDetails, - EExtSynchronizePolicyServer, - EExtCancelSynchronize, - EExtGetPolicyName + EVpnUpdatePolicyData }; // Panic codes diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/src/cmmanagerutils.cpp --- a/vpnengine/vpnmanager/src/cmmanagerutils.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/src/cmmanagerutils.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -29,13 +29,11 @@ static const TUint KMaxDestinationNameLength = 32; -TUint32 CmManagerUtils::CreateVPNConnectionMethodToIntranetL(const TVpnPolicyInfo& aVpnPolicyInfo, +void CmManagerUtils::CreateVPNConnectionMethodToIntranetL(const TVpnPolicyInfo& aVpnPolicyInfo, CEventLogger& aEventLogger) { LOG_("CmManagerUtils::CreateVPNConnectionMethodToIntranetL \n"); - TUint32 connectionMethodId(0); - using namespace CMManager; RCmManagerExt cmManagerExt; @@ -77,7 +75,7 @@ internetDestinationId); CleanupClosePushL( vpnConnectionMethod ); - connectionMethodId = vpnConnectionMethod.GetIntAttributeL( ECmId ); + TUint32 connectionMethodId = vpnConnectionMethod.GetIntAttributeL( ECmId ); aEventLogger.LogEvent(R_VPN_MSG_CREATED_VPN_ACCESS_POINT_WITH_SNAP, &(aVpnPolicyInfo.iId), NULL, connectionMethodId, internetDestinationId); @@ -93,8 +91,6 @@ CleanupStack::PopAndDestroy(); //cmManagerExt LOG_("CmManagerUtils::CreateVPNConnectionMethodToIntranetL - end \n"); - return connectionMethodId; - } void CmManagerUtils::SetVpnConnectionMethodAttributesL(RCmConnectionMethodExt& aConnectionMethod, @@ -106,7 +102,7 @@ LOG_("CmManagerUtils::SetVpnConnectionMethodAttributesL \n"); - aConnectionMethod.SetIntAttributeL( ECmNamingMethod, ENamingUnique ); + aConnectionMethod.SetIntAttributeL( ECmNamingMethod, ENamingNothing ); aConnectionMethod.SetStringAttributeL( ECmName, aConnectionMethodName ); aConnectionMethod.SetStringAttributeL( EVpnServicePolicy, aPolicyId ); aConnectionMethod.SetIntAttributeL( ECmNextLayerSNAPId, aInternetDestinationId ); @@ -263,42 +259,3 @@ LOG_("CmManagerUtils::CreateNewConnectionMethodToIntranetL - end \n"); return vpnConnectionMethod; } - -TBool CmManagerUtils::ProvisionIAPNameExistL(TUint32 aAgileProvisionAPId) - { - TBool apExist=EFalse; - using namespace CMManager; - RCmManagerExt cmManagerExt; - cmManagerExt.OpenL(); - CleanupClosePushL( cmManagerExt ); - - RArray aps; - - TBool supportedBearersOnly = ETrue; - TBool legacyCmsOnly = EFalse; - - cmManagerExt.ConnectionMethodL( aps, supportedBearersOnly, legacyCmsOnly ); - CleanupClosePushL( aps ); - - for( TInt i = 0; i < aps.Count(); ++i ) - { - RCmConnectionMethodExt ap = cmManagerExt.ConnectionMethodL( aps[i] ); - CleanupClosePushL( ap ); - - if( KPluginVPNBearerTypeUid == ap.GetIntAttributeL( ECmBearerType ) ) - if ( ap.GetIntAttributeL(ECmId) == aAgileProvisionAPId ) - { - apExist=ETrue; - } - CleanupStack::PopAndDestroy(); // ap - } - - CleanupStack::PopAndDestroy(); // aps - - - CleanupStack::PopAndDestroy(); //cmManagerExt - - return apExist; - } - - diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/src/fileutil.cpp --- a/vpnengine/vpnmanager/src/fileutil.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/src/fileutil.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -19,7 +19,6 @@ #include #include "fileutil.h" -#include "log_r6.h" TFileUtil::TFileUtil(RFs& aFs) : iFs(aFs) { diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/src/policyimporter.cpp --- a/vpnengine/vpnmanager/src/policyimporter.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/src/policyimporter.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -15,11 +15,7 @@ * */ -#include -#include -#include -#include -#include + #include "policyimporter.h" #include "vpnapiservant.h" @@ -32,17 +28,12 @@ #include "pkiutil.h" #include "cmmanagerutils.h" #include "log_r6.h" -#include "agileprovisionws.h" -#include "agileprovisiondefs.h" -#include "policyinstaller_constants.h" -#include "vpnextapiservantdefs.h" - +#include +#include const TInt KDefaultKeySize(1024); -_LIT8 (KPinFileNameTitle, "[POLICYNAME]"); - enum TImportState { EStateBeginPolicyImport = 1, @@ -56,9 +47,7 @@ EStateAfterAttachCertificate, EStateImportPinAndPol, EStateCreateVpnDestination, - EStateEndPolicyImport, - EStateGetPolicyProvisionService, - EStateAfterGetPolicyProvisionService + EStateEndPolicyImport }; CPolicyImporter* CPolicyImporter::NewL(const RMessage2& aMessage, CVpnApiServant& aVpnApiServant, @@ -127,10 +116,6 @@ delete iCertFileData; delete iKeyFileData; - - delete iAgileProvisionWSAddr; - delete iAgileProvisionWs; - LOG_("<- CPolicyImporter::~CPolicyImporter()"); } @@ -243,14 +228,7 @@ case EStateEndPolicyImport: StateEndPolicyImportL(); break; - - case EStateGetPolicyProvisionService: - StateGetPolicyProvisionServiceL(); - break; - case EStateAfterGetPolicyProvisionService: - StateAfterGetPolicyProvisionServiceL(); - break; default: User::Panic(KVpnManagerServer, EInvalidImportState); break; @@ -619,41 +597,9 @@ { LOG_("-> CPolicyImporter::StateImportPinAndPolL()"); SetCurrState(EStateImportPinAndPol); - HBufC* pinFile; - HBufC* polFile; - if ( !iAgileProvision ) - { - pinFile = iFileUtil.MakeFileNameLC(iImportDir, iCurrPolicyId, KPinFileExt); - polFile = iFileUtil.MakeFileNameLC(iImportDir, iCurrPolicyId, KPolFileExt); - } - else - { - pinFile = iFileUtil.MakeFileNameLC(KTempDirectory(), KAgileProvisionPinFileName(), KNullDesc()); - polFile = iFileUtil.MakeFileNameLC(KTempDirectory(), KAgileProvisionPolicyFileName(), KNullDesc()); - - HBufC8* infoData=NULL; - - if ( iFileUtil.FileExists(*polFile) ) - { - infoData=GetPolicyNameL(polFile); - CleanupStack::PushL(infoData); - } - else - User::Leave(KErrNotFound); - - - HBufC8* pinFileData = HBufC8::NewLC(KNullDesc().Length() + KPinFileNameTitle().Length() + KCRLF().Length() + infoData->Length()); - TPtr8 pinFilePtr (pinFileData->Des()) ; - pinFilePtr.Append(KPinFileNameTitle); - pinFilePtr.Append(KCRLF); - pinFilePtr.Append(*infoData); - - iFileUtil.SaveFileDataL(*pinFile, *pinFileData); - - CleanupStack::PopAndDestroy(pinFileData); - CleanupStack::PopAndDestroy(infoData); - } - + + HBufC* pinFile = iFileUtil.MakeFileNameLC(iImportDir, iCurrPolicyId, KPinFileExt); + HBufC* polFile = iFileUtil.MakeFileNameLC(iImportDir, iCurrPolicyId, KPolFileExt); if (!iFileUtil.FileExists(*pinFile)) { @@ -670,14 +616,9 @@ PatchPolicyCaCertInfoL(*polFile); iPolicyStore.ImportPolicyL(*pinFile, *polFile, iNewPolicyId); - - // if policy imported from Agile VPN provisioning web service - if ( iAgileProvision ) - { - PatchPolicyProvisionL(); - } + //iImportSinglePolicy is used when policy is installed via - //OMA DM. If the policy is installed from .vpn file + //OMA DM or ACU. If the policy is installed from .vpn file //the iImportSinglePolicy is not used. //The VPN destination is only created in .vpn case. if (iImportSinglePolicy) @@ -698,107 +639,16 @@ LOG_("-> CPolicyImporter::StateCreateVpnDestinationL()"); SetCurrState(EStateCreateVpnDestination); - //Gets the IAP name from policy name + //Gets the IAP name from policy name TVpnPolicyInfo* policyInfo = new (ELeave) TVpnPolicyInfo; CleanupDeletePushL(policyInfo); User::LeaveIfError(iPolicyStore.GetPolicyInfo(*iNewPolicyId, *policyInfo)); - TBool iapExist(EFalse); - if ( !iAgileProvision ) - TUint32 provisionIapId = CmManagerUtils::CreateVPNConnectionMethodToIntranetL(*policyInfo, - *(iVpnApiServant.iEventLogger)); - else - { - - if ( iAgileProvisionAPId > 0 ) - { - iapExist=CmManagerUtils::ProvisionIAPNameExistL(iAgileProvisionAPId); - } - - if ( !iapExist || iAgileProvisionAPId == 0) - { - TUint32 provisionIapId = CmManagerUtils::CreateVPNConnectionMethodToIntranetL(*policyInfo, - *(iVpnApiServant.iEventLogger)); - - TFileName serverSettingsFile; - User::LeaveIfError(iFs.PrivatePath(serverSettingsFile)); - - serverSettingsFile.Append(KProvisionServerSettings); - - if ( iFileUtil.FileExists(serverSettingsFile) ) - { - _LIT(KCRLF, "\n"); - RFile serverFile; - User::LeaveIfError(serverFile.Open(iFs,serverSettingsFile, EFileRead)); - - TFileText tx; - tx.Set(serverFile); - - TInt fileSize; - User::LeaveIfError(serverFile.Size(fileSize)); - HBufC* serverUrlBuf = HBufC::NewLC(fileSize); - - TPtr serverUrlPtr=serverUrlBuf->Des(); - - User::LeaveIfError(tx.Read(serverUrlPtr)); - - - HBufC* serverNameBuf = HBufC::NewLC(fileSize); - TPtr serverNamePtr=serverNameBuf->Des(); - - User::LeaveIfError(tx.Read(serverNamePtr)); - - - TBuf iapIdData; - User::LeaveIfError(tx.Read(iapIdData)); - - TBuf iapModeData; - User::LeaveIfError(tx.Read(iapModeData)); - - HBufC* policyFileNameBuf = HBufC::NewLC(fileSize); - - TPtr policyFileNamePtr = policyFileNameBuf->Des(); - User::LeaveIfError(tx.Read(policyFileNamePtr)); - - serverFile.Close(); - - TBuf agileIapIdStr; - agileIapIdStr.Num(provisionIapId); - - HBufC* serverFileBuf = HBufC::NewL(fileSize + KCRLF().Length() + agileIapIdStr.Length()); - CleanupStack::PushL(serverFileBuf); - TPtr tPtr(serverFileBuf->Des()); - tPtr.Copy(serverUrlPtr); - tPtr.Append(KCRLF); - tPtr.Append(serverNamePtr); - tPtr.Append(KCRLF); - tPtr.Append(iapIdData); - tPtr.Append(KCRLF); - tPtr.Append(iapModeData); - tPtr.Append(KCRLF); - tPtr.Append(policyFileNamePtr); - tPtr.Append(KCRLF); - tPtr.AppendNum(provisionIapId); - - RFile file; - CleanupClosePushL(file); - User::LeaveIfError(file.Replace(iFs, serverSettingsFile, EFileWrite)); - TPtrC8 ptr8 ( (TUint8*) tPtr.Ptr(), tPtr.Size() ); - file.Write ( ptr8 ); - file.Close(); - - CleanupStack::PopAndDestroy(1); //file - CleanupStack::PopAndDestroy(serverFileBuf); - CleanupStack::PopAndDestroy(policyFileNameBuf); - CleanupStack::PopAndDestroy(serverNameBuf); - CleanupStack::PopAndDestroy(serverUrlBuf); - - } - } - } + CmManagerUtils::CreateVPNConnectionMethodToIntranetL(*policyInfo, + *(iVpnApiServant.iEventLogger)); - CleanupStack::PopAndDestroy(policyInfo); + CleanupStack::PopAndDestroy(); //policyInfo GotoState(EStateEndPolicyImport); LOG_("<- CPolicyImporter::StateCreateVpnDestinationL()"); @@ -818,58 +668,13 @@ iFileUtil.DeleteFilesL(*fileFilter); CleanupStack::PopAndDestroy(); // fileFilter - if ( !iAgileProvision ) - { - LOG_EVENT_2B(R_VPN_MSG_INSTALLED_POLICY_FILE, iNewPolicyId, NULL, 0, iImportSinglePolicy); - } - else - { - _LIT8(KPolicySever, "Policy server"); - LOG_EVENT_2B(R_VPN_MSG_INSTALLED_POLICY_SERVER, iNewPolicyId, &KPolicySever(), KErrNone, EFalse); - } + + LOG_EVENT_2B(R_VPN_MSG_INSTALLED_POLICY_FILE, iNewPolicyId, NULL, 0, iImportSinglePolicy); + GotoState(EStateBeginPolicyImport); LOG_("<- CPolicyImporter::StateEndPolicyImportL()"); } -void CPolicyImporter::SynchronizeVpnPolicyServerL() - { - - GotoState(EStateGetPolicyProvisionService); - } - -void CPolicyImporter::StateGetPolicyProvisionServiceL() - { - GetPolicyWsL(); - SetNextState(EStateAfterGetPolicyProvisionService); - - } - -void CPolicyImporter::StateAfterGetPolicyProvisionServiceL() - { - - if (iStatus != KErrNone) - { - User::Leave(iStatus.Int()); - } - delete iCurrCaCertList; - iCurrCaCertList = NULL; - iCurrCaCertList = new (ELeave) CArrayFixFlat(2); - - delete iCurrUserCertList; - iCurrUserCertList = NULL; - iCurrUserCertList = new (ELeave) CArrayFixFlat(2); - - iNewPolicyId = &iPolicyId; - - BuildPolicyIdListL(); - iCurrPolicyId.Copy(iPolicyIdList->At(iCurrPolicyIdIndex)); - iImportSinglePolicy = EFalse; - iAgileProvision = ETrue; - GotoState(EStateImportPinAndPol); - - } - - void CPolicyImporter::BuildPolicyIdListL() { delete iPolicyIdList; @@ -1348,240 +1153,6 @@ } return aCertFileArray->At(currCaIndex); - } - - void CPolicyImporter::GetPolicyWsL() - { - - delete iAgileProvisionWs; - iImportDir=KTempDirectory(); - iFileUtil.CreateDirIfNeededL(iImportDir); - iAgileProvisionWs = CAgileProvisionWs::NewL(); - - TFileName serverSettingsFile; - User::LeaveIfError(iFs.PrivatePath(serverSettingsFile)); - - serverSettingsFile.Append(KProvisionServerSettings); - - HBufC8* serviceEndPoint; - - if ( iFileUtil.FileExists(serverSettingsFile) ) - { - - - RFile serverFile; - User::LeaveIfError(serverFile.Open(iFs,serverSettingsFile, EFileRead)); - - TFileText tx; - tx.Set(serverFile); - - TInt fileSize; - User::LeaveIfError(serverFile.Size(fileSize)); - - HBufC* serverUrlBuf = HBufC::NewLC(fileSize); - - TPtr serverUrlPtr=serverUrlBuf->Des(); - - User::LeaveIfError(tx.Read(serverUrlPtr)); - - HBufC8* serverUrl=iFileUtil.To8BitL(serverUrlPtr); - - CleanupStack::PopAndDestroy(serverUrlBuf); - - CleanupStack::PushL(serverUrl); - - - serviceEndPoint=HBufC8::NewL( KHTTPprefix().Length() + KServiceSuffix().Length() + serverUrlPtr.Length()); - CleanupStack::PushL(serviceEndPoint); - TPtr8 endPointPtr(serviceEndPoint->Des()); - endPointPtr=KHTTPprefix; - - // serverUrl ownership transfer - iAgileProvisionWs->SetServiceAddr(serverUrl); - endPointPtr.Append(*serverUrl); - endPointPtr.Append(KServiceSuffix); - - - HBufC* serverNameBuf = HBufC::NewLC(fileSize); - TPtr serverNamePtr=serverNameBuf->Des(); - - User::LeaveIfError(tx.Read(serverNamePtr)); - - CleanupStack::PopAndDestroy(serverNameBuf); - - TBuf iapIdData; - User::LeaveIfError(tx.Read(iapIdData)); - - TLex iapIdConverter(iapIdData); - TUint iapIdInt; - iapIdConverter.Val(iapIdInt); - - iAgileProvisionWs->GetPolicy( *serviceEndPoint, iapIdInt, iStatus ); - CleanupStack::PopAndDestroy(serviceEndPoint); - CleanupStack::Pop(serverUrl); - serverFile.Close(); - } - - - SetActive(); - - } - - HBufC8* CPolicyImporter::GetPolicyNameL(HBufC* aPolicyFileName) - { - HBufC8* infoData=NULL; - HBufC8* infoSection=NULL; - HBufC8* fileData=NULL; - if ( iFileUtil.FileExists(*aPolicyFileName) ) - { - fileData=iFileUtil.LoadFileDataL(*aPolicyFileName); - CleanupStack::PushL(fileData); - _LIT8(KInfo, "[INFO]"); - TInt i=(fileData->Find(KInfo)) + KInfo().Length() + KCRLF().Length(); - - infoSection=fileData->Right((fileData->Length())-i).AllocL(); - CleanupStack::PushL(infoSection); - TInt j=infoSection->Find(KCRLF); - - infoData=infoSection->Mid(0,j).AllocL(); - - CleanupStack::Pop(infoSection); - CleanupStack::Pop(fileData); - - delete infoSection; - delete fileData; - infoSection=NULL; - fileData=NULL; - - } - else - User::Leave(KErrNotFound); - - return infoData; - } - - - void CPolicyImporter::PatchPolicyProvisionL() - { - TPath privateDir; - User::LeaveIfError(iFs.PrivatePath(privateDir)); - - HBufC* policyServerSettingsFileName = HBufC::NewL(KProvisionServerSettings().Length() + privateDir.Length()); - CleanupStack::PushL(policyServerSettingsFileName); - TPtr fileNamePtr=policyServerSettingsFileName->Des(); - fileNamePtr.Append(privateDir); - fileNamePtr.Append(KProvisionServerSettings); - _LIT(KCRLF, "\n"); - if ( iFileUtil.FileExists(fileNamePtr) ) - { - - RFile serverFile; - User::LeaveIfError(serverFile.Open(iFs,fileNamePtr, EFileRead)); - - TFileText tx; - tx.Set(serverFile); - - TInt fileSize; - User::LeaveIfError(serverFile.Size(fileSize)); - - HBufC* serverUrlBuf = HBufC::NewLC(fileSize); - - TPtr serverUrlPtr=serverUrlBuf->Des(); - - User::LeaveIfError(tx.Read(serverUrlPtr)); - - HBufC* serverNameBuf = HBufC::NewLC(fileSize); - TPtr serverNamePtr=serverNameBuf->Des(); - - User::LeaveIfError(tx.Read(serverNamePtr)); - - - TBuf iapIdData; - User::LeaveIfError(tx.Read(iapIdData)); - - TBuf iapModeData; - User::LeaveIfError(tx.Read(iapModeData)); - - TBuf iapIdBuf; - - HBufC* policyFilePath; - HBufC* policyFileNameBuf = HBufC::NewLC(fileSize); - TPtr policyFileNamePtr = policyFileNameBuf->Des(); - - if ( tx.Read(policyFileNamePtr) == KErrNone ) - { - - tx.Read(iapIdBuf); - TLex iapIdConverter(iapIdBuf); - iapIdConverter.Val(iAgileProvisionAPId,EDecimal); - - policyFilePath = iFileUtil.MakeFileNameLC(privateDir, *policyFileNameBuf, KPolFileExt); - } - else - { - policyFilePath =iFileUtil.MakeFileNameLC(privateDir, *iNewPolicyId, KPolFileExt); - } - - serverFile.Close(); - - TBuf iapAgileIdStr; - //server configuration file includes installed policy file name and policy exists. - if ( (iAgileProvisionAPId > 0) && iFileUtil.FileExists(*policyFilePath) ) - { - iPolicyIdBuf.Append(*policyFileNameBuf); - iNewPolicyIdBuf=iPolicyIdBuf; - iPolicyStore.ReplacePolicyL(iPolicyIdBuf,*iNewPolicyId); - iNewPolicyId= &iNewPolicyIdBuf; - } - //either first configuration or policy removed - else - { - - HBufC* serverFileBuf = HBufC::NewL(fileSize + KCRLF().Length() + iNewPolicyId->Length() + KMaxIapLength); - CleanupStack::PushL(serverFileBuf); - TPtr tPtr(serverFileBuf->Des()); - tPtr.Copy(serverUrlPtr); - tPtr.Append(KCRLF); - tPtr.Append(serverNamePtr); - tPtr.Append(KCRLF); - tPtr.Append(iapIdData); - tPtr.Append(KCRLF); - tPtr.Append(iapModeData); - - //policy removed - if ( !iFileUtil.FileExists(*policyFilePath) ) - { - tPtr.Append(KCRLF); - tPtr.Append(*iNewPolicyId); - tPtr.Append(KCRLF); - iapAgileIdStr.Num(iAgileProvisionAPId); - tPtr.Append(iapAgileIdStr); - } - //first configuration - else - { - tPtr.Append(KCRLF); - tPtr.Append(*iNewPolicyId); - - } - RFile file; - CleanupClosePushL(file); - User::LeaveIfError(file.Replace(iFs, fileNamePtr, EFileWrite)); - - TPtrC8 ptr8 ( (TUint8*) tPtr.Ptr(), tPtr.Size() ); - file.Write ( ptr8 ); - file.Close(); - CleanupStack::PopAndDestroy(1); //file - CleanupStack::PopAndDestroy(serverFileBuf); - } - - CleanupStack::PopAndDestroy(policyFilePath); - CleanupStack::PopAndDestroy(policyFileNameBuf); - CleanupStack::PopAndDestroy(serverNameBuf); - CleanupStack::PopAndDestroy(serverUrlBuf); - CleanupStack::PopAndDestroy(policyServerSettingsFileName); - } - } /***/ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/src/vpnapiservant.cpp --- a/vpnengine/vpnmanager/src/vpnapiservant.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/src/vpnapiservant.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -16,10 +16,7 @@ */ -#include -#include -#include "fileutil.h" #include "vpnapiservant.h" #include "policystore.h" #include "policyimporter.h" @@ -28,9 +25,6 @@ #include "vpnmanagerserverdefs.h" #include "vpnmaninternal.h" #include "log_r6.h" -#include "agileprovisionws.h" -#include "agileprovisiondefs.h" -#include "cmmanagerutils.h" CVpnApiServant* CVpnApiServant::NewL(RFs& aFs) @@ -42,7 +36,7 @@ return self; } -CVpnApiServant::CVpnApiServant(RFs& aFs) : iFs(aFs), iFileUtil(aFs) +CVpnApiServant::CVpnApiServant(RFs& aFs) : iFs(aFs) { } @@ -119,36 +113,6 @@ UpdatePolicyDataL(aMessage); break; - - //Policy Provision Methods - case EExtCreateProvisionServer: - CreateProvisionServerL(aMessage); - break; - - case EExtVPNPolicyServerList: - ListProvisionServerL(aMessage); - break; - - case EExtVPNPolicyServerDetails: - GetProvisionServerDetailsL(aMessage); - break; - - case EExtSynchronizePolicyServer: - SynchronizeVPNPolicyServerL(aMessage); - break; - - case EExtDeletePolicyServer: - DeleteVPNPolicyServerL(aMessage); - break; - - case EExtCancelSynchronize: - CancelSynchronize(aMessage); - break; - - case EExtGetPolicyName: - GetVPNPolicyNameL(aMessage); - break; - default: requestHandled = EFalse; break; @@ -280,7 +244,7 @@ aMessage.Complete(ret); - LOG(Log::Printf(_L("CVpnApiServant::GetPolicyDetailsL: aMessage completed withd %d"), ret)); + LOG(Log::Printf(_L("CVpnApiServant::GetPolicyDetailsL: aMesage completed withd %d"), ret)); } void CVpnApiServant::DeletePolicyL(const RMessage2& aMessage) @@ -554,357 +518,3 @@ aMessage.Complete(KErrNone); } - -void CVpnApiServant::CreateProvisionServerL( const RMessage2& aMessage ) - { - TAgileProvisionApiServerSettings* serverCreate = new (ELeave) TAgileProvisionApiServerSettings(); - CleanupStack::PushL(serverCreate); - TPckg pckgServerCreate(*serverCreate); - aMessage.ReadL(0, pckgServerCreate); - TAgileProvisionServerLocals* serverAccountLocalData = new (ELeave) TAgileProvisionServerLocals(); - CleanupStack::PushL(serverAccountLocalData); - serverAccountLocalData->iSelection = serverCreate->iSelection; - serverAccountLocalData->iServerAddress.Copy(serverCreate->iServerUrl); - serverAccountLocalData->iServerNameLocal.Copy(serverCreate->iServerNameLocal); - - TFileName serverFilePath; - User::LeaveIfError(iFs.PrivatePath(serverFilePath)); - serverFilePath.Append(KProvisionServerSettings); - - /* Check if file allready exists and copy policy and vpn iap id to a new file */ - TFileName policyFileName; - TUint32 agileProvisionAPId=0; - - HBufC* serverUrlBuf=NULL; - - HBufC* serverNameBuf=NULL; - - TBuf iapIdBuf; - - TBool serverFileExist=EFalse; - - if ( iFileUtil.FileExists(serverFilePath) ) - { - RFile serverFile; - User::LeaveIfError(serverFile.Open(iFs,serverFilePath, EFileRead)); - - - TFileText tx; - tx.Set(serverFile); - - TInt fileSize; - User::LeaveIfError(serverFile.Size(fileSize)); - - serverUrlBuf = HBufC::NewLC(fileSize); - - TPtr serverUrlPtr=serverUrlBuf->Des(); - - User::LeaveIfError(tx.Read(serverUrlPtr)); - - serverNameBuf = HBufC::NewLC(fileSize); - TPtr serverNamePtr=serverNameBuf->Des(); - - User::LeaveIfError(tx.Read(serverNamePtr)); - - TBuf iapIdData; - User::LeaveIfError(tx.Read(iapIdData)); - - TBuf iapModeData; - User::LeaveIfError(tx.Read(iapModeData)); - - HBufC* policyFileNameBuf = HBufC::NewLC(fileSize); - TPtr policyFileNamePtr = policyFileNameBuf->Des(); - - if ( tx.Read(policyFileNamePtr) == KErrNone ) - { - tx.Read(iapIdBuf); - - TLex iapIdConverter(iapIdBuf); - iapIdConverter.Val(agileProvisionAPId,EDecimal); - policyFileName = *policyFileNameBuf; - } - CleanupStack::PopAndDestroy(policyFileNameBuf); - serverFile.Close(); - serverFileExist = ETrue; - } - /* end of saving old values */ - - //IAP data Max value 255 - TBuf iapIdStr; - TBuf iapModeStr; - TBuf iapAgileIdStr; - - iapIdStr.Num(serverAccountLocalData->iSelection.iId); - iapModeStr.Num(serverAccountLocalData->iSelection.iResult); - HBufC* serverSettingsDataBuf; - _LIT(KCRLF, "\n"); - if ( agileProvisionAPId >0 ) - { - - serverSettingsDataBuf = HBufC::NewL(serverAccountLocalData->iServerNameLocal.Length() + serverAccountLocalData->iServerAddress.Length() + - iapIdStr.Length() + iapModeStr.Length() + policyFileName.Length() + iapIdBuf.Length() + 5*(KCRLF().Length()) ); - } - else - { - serverSettingsDataBuf = HBufC::NewL(serverAccountLocalData->iServerNameLocal.Length() + serverAccountLocalData->iServerAddress.Length() + - iapIdStr.Length() + iapModeStr.Length() + 3*(KCRLF().Length()) ); - } - CleanupStack::PushL(serverSettingsDataBuf); - TPtr tPtr(serverSettingsDataBuf->Des()); - tPtr.Copy(serverAccountLocalData->iServerAddress); - - tPtr.Append(KCRLF); - tPtr.Append(serverAccountLocalData->iServerNameLocal); - tPtr.Append(KCRLF); - tPtr.Append(iapIdStr); - tPtr.Append(KCRLF); - tPtr.Append(iapModeStr); - if ( agileProvisionAPId >0 ) - { - tPtr.Append(KCRLF); - tPtr.Append(policyFileName); - tPtr.Append(KCRLF); - tPtr.Append(iapIdBuf); - } - - RFile file; - CleanupClosePushL(file); - - User::LeaveIfError(file.Replace(iFs, serverFilePath, EFileWrite)); - - TPtrC8 ptr8 ( (TUint8*) tPtr.Ptr(), tPtr.Size() ); - file.Write ( ptr8 ); - file.Close(); - CleanupStack::PopAndDestroy(1); //file - CleanupStack::PopAndDestroy(serverSettingsDataBuf); - - if ( serverFileExist != EFalse ) - { - CleanupStack::PopAndDestroy(serverNameBuf); - CleanupStack::PopAndDestroy(serverUrlBuf); - } - - CleanupStack::PopAndDestroy(serverAccountLocalData); - CleanupStack::PopAndDestroy(serverCreate); - - aMessage.Complete(KErrNone); - } - -void CVpnApiServant::ListProvisionServerL( const RMessage2& aMessage ) - { - - TAgileProvisionApiServerListElem* serverList = new (ELeave) TAgileProvisionApiServerListElem(); - CleanupStack::PushL(serverList); - TPckg serverPckg(*serverList); - - TFileName serverFilePath; - User::LeaveIfError(iFs.PrivatePath(serverFilePath)); - serverFilePath.Append(KProvisionServerSettings); - - if ( iFileUtil.FileExists(serverFilePath) ) - { - - RFile serverFile; - User::LeaveIfError(serverFile.Open(iFs,serverFilePath, EFileRead)); - - - TFileText tx; - tx.Set(serverFile); - - TInt fileSize; - User::LeaveIfError(serverFile.Size(fileSize)); - - HBufC* serverUrlBuf = HBufC::NewLC(fileSize); - - TPtr serverUrlPtr=serverUrlBuf->Des(); - - User::LeaveIfError(tx.Read(serverUrlPtr)); - - HBufC8* serverUrl=iFileUtil.To8BitL(serverUrlPtr); - serverList->iServerUrl=*serverUrl; - - delete serverUrl; - serverUrl=NULL; - - CleanupStack::PopAndDestroy(serverUrlBuf); - - HBufC* serverNameBuf = HBufC::NewLC(fileSize); - TPtr serverNamePtr=serverNameBuf->Des(); - - User::LeaveIfError(tx.Read(serverNamePtr)); - - serverList->iServerNameLocal=serverNamePtr; - - CleanupStack::PopAndDestroy(serverNameBuf); - - serverFile.Close(); - } - - aMessage.WriteL(0, serverPckg); - - CleanupStack::PopAndDestroy(serverList); - aMessage.Complete(KErrNone); - } - -void CVpnApiServant::GetProvisionServerDetailsL( const RMessage2& aMessage ) - { - - TAgileProvisionApiServerSettings* serverList = new (ELeave) TAgileProvisionApiServerSettings(); - CleanupStack::PushL(serverList); - TPckg serverPckg(*serverList); - - TFileName serverFilePath; - User::LeaveIfError(iFs.PrivatePath(serverFilePath)); - serverFilePath.Append(KProvisionServerSettings); - - if ( iFileUtil.FileExists(serverFilePath) ) - { - RFile serverFile; - User::LeaveIfError(serverFile.Open(iFs,serverFilePath, EFileRead)); - - TFileText tx; - tx.Set(serverFile); - - TInt fileSize; - User::LeaveIfError(serverFile.Size(fileSize)); - - HBufC* serverUrlBuf = HBufC::NewLC(fileSize); - - TPtr serverUrlPtr=serverUrlBuf->Des(); - - User::LeaveIfError(tx.Read(serverUrlPtr)); - - HBufC8* serverUrl=iFileUtil.To8BitL(serverUrlPtr); - serverList->iServerUrl=*serverUrl; - - delete serverUrl; - serverUrl=NULL; - - CleanupStack::PopAndDestroy(serverUrlBuf); - - HBufC* serverNameBuf = HBufC::NewLC(fileSize); - TPtr serverNamePtr=serverNameBuf->Des(); - - User::LeaveIfError(tx.Read(serverNamePtr)); - - serverList->iServerNameLocal=serverNamePtr; - - CleanupStack::PopAndDestroy(serverNameBuf); - - TBuf iapIdData; - User::LeaveIfError(tx.Read(iapIdData)); - - TLex iapIdConverter(iapIdData); - TUint idInt; - iapIdConverter.Val(idInt); - serverList->iSelection.iId = idInt; - - TBuf iapModeData; - User::LeaveIfError(tx.Read(iapModeData)); - - TLex iapModeConverter = iapModeData; - iapModeConverter.Val(idInt); - - CMManager::TCmSettingSelectionMode selectionMode = (CMManager::TCmSettingSelectionMode) idInt; - serverList->iSelection.iResult = selectionMode; - - serverFile.Close(); - } - aMessage.WriteL(0, serverPckg); - - CleanupStack::PopAndDestroy(serverList); - - aMessage.Complete(KErrNone); - } - -void CVpnApiServant::SynchronizeVPNPolicyServerL( const RMessage2& aMessage ) - { - iPolicyImporter = CPolicyImporter::NewL(aMessage, *this, *iPolicyStore, iFs); - - //Asynchronous call - iPolicyImporter->SynchronizeVpnPolicyServerL(); - } - -void CVpnApiServant::DeleteVPNPolicyServerL( const RMessage2& aMessage ) - { - TFileName serverFilePath; - User::LeaveIfError(iFs.PrivatePath(serverFilePath)); - serverFilePath.Append(KProvisionServerSettings); - iFileUtil.DeleteFileL(serverFilePath); - aMessage.Complete(KErrNone); - } - -void CVpnApiServant::CancelSynchronize( const RMessage2& aMessage ) - { - if (iPolicyImporter) - { - if ( iPolicyImporter->iAgileProvisionWs != NULL ) - { - CAgileProvisionWs* ws = iPolicyImporter->iAgileProvisionWs; - ws->CancelGetPolicy(); - } - iPolicyImporter->Cancel(); - delete iPolicyImporter; - iPolicyImporter = NULL; - } - aMessage.Complete(KErrCancel); - } - -void CVpnApiServant::GetVPNPolicyNameL( const RMessage2& aMessage ) - { - TAgileProvisionPolicy* policy = new (ELeave) TAgileProvisionPolicy(); - CleanupStack::PushL(policy); - TPckg serverPckg(*policy); - - TFileName serverFilePath; - User::LeaveIfError(iFs.PrivatePath(serverFilePath)); - serverFilePath.Append(KProvisionServerSettings); - - if ( iFileUtil.FileExists(serverFilePath) ) - { - RFile serverFile; - User::LeaveIfError(serverFile.Open(iFs,serverFilePath, EFileRead)); - - TFileText tx; - tx.Set(serverFile); - - TInt fileSize; - User::LeaveIfError(serverFile.Size(fileSize)); - - HBufC* serverUrlBuf = HBufC::NewLC(fileSize); - - TPtr serverUrlPtr=serverUrlBuf->Des(); - - User::LeaveIfError(tx.Read(serverUrlPtr)); - - HBufC* serverNameBuf = HBufC::NewLC(fileSize); - TPtr serverNamePtr=serverNameBuf->Des(); - - User::LeaveIfError(tx.Read(serverNamePtr)); - - TBuf iapIdData; - User::LeaveIfError(tx.Read(iapIdData)); - - TBuf iapModeData; - User::LeaveIfError(tx.Read(iapModeData)); - - TBuf iapIdBuf; - - HBufC* policyFileNameBuf = HBufC::NewLC(fileSize); - TPtr policyFileNamePtr = policyFileNameBuf->Des(); - - User::LeaveIfError(tx.Read(policyFileNamePtr)); - policy->iPolicyName = policyFileNamePtr; - CleanupStack::PopAndDestroy(policyFileNameBuf); - serverFile.Close(); - - CleanupStack::PopAndDestroy(serverNameBuf); - CleanupStack::PopAndDestroy(serverUrlBuf); - } - - aMessage.WriteL(0, serverPckg); - - CleanupStack::PopAndDestroy(policy); - - aMessage.Complete(KErrNone); - } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnengine/vpnmanager/src/vpnmanagerserver.cpp --- a/vpnengine/vpnmanager/src/vpnmanagerserver.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnengine/vpnmanager/src/vpnmanagerserver.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -30,7 +30,7 @@ { 0, EVpnImportPolicy, - EExtGetPolicyName+1 + EVpnUpdatePolicyData+1 }; const TUint8 CVpnManagerServer::iVpnManElementIndex[iVpnManRangeCount] = diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpndialogmanager/group/vpndialogmanager.mmp --- a/vpnui/vpndialogmanager/group/vpndialogmanager.mmp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpndialogmanager/group/vpndialogmanager.mmp Wed Oct 13 15:42:16 2010 +0300 @@ -49,7 +49,6 @@ LIBRARY eikcore.lib // For Infowin LIBRARY eiksrvui.lib // Eikon server ui (for suppressing app -key) LIBRARY efsrv.lib -LIBRARY eikctl.lib LIBRARY commonengine.lib LIBRARY cdlengine.lib diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpndialogmanager/inc/vpndialogshower.h --- a/vpnui/vpndialogmanager/inc/vpndialogshower.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpndialogmanager/inc/vpndialogshower.h Wed Oct 13 15:42:16 2010 +0300 @@ -30,7 +30,7 @@ const TInt KMaxAcuInputLength = 50; -const TInt KMinSecurIDPINLength = 4; +const TInt KMaxAuthenticationInputLength = 32; class CVpnDialog; class CEikColumnListBox; @@ -57,7 +57,6 @@ CVpnInfoDialog* ShowNoteDialogL(MVpnNotifierCallback* aNotifier, TInt aTextId); CVpnMultiLineDialog* GetUserPwdDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput); CVpnMultiLineDialog* GetSecurIdDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput); - CVpnMultiLineDialog* GetSecurIdPinDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput); CVpnMultiLineDialog* GetSecurIdNextDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput); private: @@ -188,7 +187,6 @@ // NewL static CKmdDlg* NewL(MVpnNotifierCallback* aNotifier, TDes& aText1, TDes& aText2, TTone aTone = ENoTone); static CKmdDlg* NewL(MVpnNotifierCallback* aNotifier, TDes& aText1, TDes& aText2, const TDesC8& aInput, TTone aTone = ENoTone); - void SetResourceId(TInt aResourceId); protected: //Construction and destruction CKmdDlg(MVpnNotifierCallback* aNotifier, const TTone& aTone); @@ -197,13 +195,11 @@ void PreLayoutDynInitL(); void SetInitialCurrentLine(); - void UpdateLeftSoftKeyL(); // From CVpnMultiLineDialog void GetOutputL(TVpnDialogOutput& aOutput, TInt aButtonId); private: // Data TPtrC8 iInput; - TInt iResourceId; }; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpndialogmanager/src/vpndialogmanager.cpp --- a/vpnui/vpndialogmanager/src/vpndialogmanager.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpndialogmanager/src/vpndialogmanager.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -68,10 +68,8 @@ // KMD Dialogs case TKmdDialog::EUserPwd: return shower->GetUserPwdDlgL(aNotifier, aInput); - case TKmdDialog::ESecurIdCode: + case TKmdDialog::ESecurIdPin: return shower->GetSecurIdDlgL(aNotifier, aInput); - case TKmdDialog::ESecurIdPin: - return shower->GetSecurIdPinDlgL(aNotifier, aInput); case TKmdDialog::ESecurIdNextPin: return shower->GetSecurIdNextDlgL(aNotifier, aInput); @@ -127,10 +125,6 @@ // Kmd note dialogs case TVpnNoteDialog::EKmdAuthenticationFailed: return R_KMD_CRACK_AUTH_FAILED; - case TVpnNoteDialog::EKmdTokenNotFound: - return R_KMD_TOKEN_NOT_FOUND; - case TVpnNoteDialog::EKmdTokenExpired: - return R_KMD_TOKEN_EXPIRED; default: LOG_(" Calling CVpnDialogManagerBase::GetNoteTextId()"); return CVpnDialogManager::GetNoteTextId(aNoteDialogId); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpndialogmanager/src/vpndialogshower.cpp --- a/vpnui/vpndialogmanager/src/vpndialogshower.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpndialogmanager/src/vpndialogshower.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -103,16 +103,6 @@ return dialog; } -CVpnMultiLineDialog* CVpnDialogShower::GetSecurIdPinDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput) - { - iValue1 = KNullDesC; - iValue2 = KNullDesC; - CKmdDlg* dialog = CKmdDlg::NewL(aNotifier, iValue1, iValue2, aInput, CAknQueryDialog::ENoTone); - dialog->SetResourceId(R_KMD_CRACK_SID_PIN_QUERY); - dialog->ExecuteLD(R_KMD_CRACK_SID_PIN_QUERY); - return dialog; - } - CVpnMultiLineDialog* CVpnDialogShower::GetSecurIdNextDlgL(MVpnNotifierCallback* aNotifier, const TDesC8& aInput) { iValue1 = KNullDesC; @@ -499,14 +489,12 @@ CKmdDlg::CKmdDlg(MVpnNotifierCallback* aNotifier, const TTone& aTone) : CVpnMultiLineDialog(aNotifier, aTone) { - iResourceId = 0; } CKmdDlg::CKmdDlg(MVpnNotifierCallback* aNotifier, const TDesC8& aInput, const TTone& aTone) : CVpnMultiLineDialog(aNotifier, aTone) { iInput.Set(aInput); - iResourceId = 0; } CKmdDlg* CKmdDlg::NewL(MVpnNotifierCallback* aNotifier, TDes& aData1, TDes& aData2, TTone aTone) @@ -533,18 +521,11 @@ return self; } -void CKmdDlg::SetResourceId(TInt aResourceId) - { - iResourceId = aResourceId; - } void CKmdDlg::PreLayoutDynInitL() { - if (iResourceId == R_KMD_CRACK_SID_PIN_QUERY) - { - CAknQueryControl* secondControl = static_cast(Control(EEikCidPasswordConfirm)); - CEikSecretEditor* secretEditor = static_cast(secondControl->ControlByLayoutOrNull( EMultiDataSecondSecEd )); - secretEditor->SetDefaultInputMode(EAknEditorNumericInputMode); - } + SetMaxLengthOfFirstEditor(KMaxAuthenticationInputLength); + SetMaxLengthOfSecondEditor(KMaxAuthenticationInputLength); + CAknMultiLineDataQueryDialog::PreLayoutDynInitL(); CAknQueryControl* usernameControl = static_cast(Control(EEikCidPassword)); @@ -562,27 +543,6 @@ } } -void CKmdDlg::UpdateLeftSoftKeyL() - { - - CAknQueryControl* secondControl = static_cast(Control(EEikCidPasswordConfirm)); - if (iResourceId == R_KMD_CRACK_SID_PIN_QUERY) - { - if ( (0 == secondControl->GetTextLength()) || - (KMinSecurIDPINLength <= secondControl->GetTextLength()) ) - MakeLeftSoftkeyVisible(ETrue); - else - MakeLeftSoftkeyVisible(EFalse); - } - else - { - if (0 != secondControl->GetTextLength()) - MakeLeftSoftkeyVisible(ETrue); - else - MakeLeftSoftkeyVisible(EFalse); - } - } - void CKmdDlg::SetInitialCurrentLine() { CAknMultiLineDataQueryDialog::SetInitialCurrentLine(); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnecomnotifier/data/vpnecomnotifier.rss --- a/vpnui/vpnecomnotifier/data/vpnecomnotifier.rss Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnecomnotifier/data/vpnecomnotifier.rss Wed Oct 13 15:42:16 2010 +0300 @@ -373,50 +373,6 @@ }; } -RESOURCE DIALOG r_kmd_crack_sid_pin_query - { - flags=EEikDialogFlagNotifyEsc; - buttons=R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type=EAknCtMultilineQuery; - id=EEikCidPassword; - control=AVKON_DATA_QUERY - { - layout = EMultiDataFirstEdwin; - label = qtn_vpn_prmpt_gw_username_legacy; - control=EDWIN - { - flags=0; - width=5; - lines=1; - maxlength=32; - default_case = EAknEditorLowerCase; - allowed_case_modes = EAknEditorAllCaseModes; - avkon_flags = EAknEditorFlagNoT9 | - EAknEditorFlagLatinInputModesOnly; - }; - }; - }, - DLG_LINE - { - type=EAknCtMultilineQuery; - id=EEikCidPasswordConfirm; - control= AVKON_DATA_QUERY - { - layout = EMultiDataSecondSecEd; - label = qtn_vpn_prmpt_gw_securid_pin; - control = SECRETED - { - num_letters = 8; - }; - }; - } - }; - } - RESOURCE DIALOG r_kmd_crack_sid_next_query { flags=EEikDialogFlagNotifyEsc; @@ -468,16 +424,6 @@ buf = qtn_vpn_err_auth_failed; } -RESOURCE TBUF r_kmd_token_not_found - { - buf = qtn_vpn_err_token_not_found; - } - -RESOURCE TBUF r_kmd_token_expired - { - buf = qtn_vpn_err_token_expired; - } - RESOURCE TBUF r_acu_next_server_identity { buf = qtn_vpn_info_verify_hash; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnecomnotifier/loc/vpnnotifier.loc --- a/vpnui/vpnecomnotifier/loc/vpnnotifier.loc Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnecomnotifier/loc/vpnnotifier.loc Wed Oct 13 15:42:16 2010 +0300 @@ -72,12 +72,6 @@ // #define qtn_vpn_prmpt_gw_password_legacy "VPN password:" -//d:SecurID PIN in VPN gateway user authentication query -//d:SecurID based authentication -//l:popup_query_data_window/opt5 -// -#define qtn_vpn_prmpt_gw_securid_pin "SecurID (C) PIN:" - //d:User identity query presented to the user during VPN certificate enrollment (fetching) //d:%U is replaced during run-time with a domain name such as "company.com" or "OU=Unit, O=Company" //l:popup_query_data_window/opt5 @@ -116,16 +110,6 @@ // #define qtn_vpn_err_auth_failed "Authentication failed" -//d:SecurID software token is not installed. -//l:popup_note_window -// -#define qtn_vpn_err_token_not_found "SecurID (C) token not found" - -//d:SecurID software token is expired. -//l:popup_note_window -// -#define qtn_vpn_err_token_expired "SecurID (C) token expired" - //d:Incorrect characters were entered //l:popup_note_window // diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/data/vpnmanagementuirsc.rss --- a/vpnui/vpnmanagementui/data/vpnmanagementuirsc.rss Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/data/vpnmanagementuirsc.rss Wed Oct 13 15:42:16 2010 +0300 @@ -233,11 +233,16 @@ items= { MENU_ITEM { + command=EVpnUiCmdInstallPolicies; + txt = qtn_vpn_options_install_policies; }, + MENU_ITEM { command=EVpnUiCmdPolicyDetails; txt = qtn_vpn_options_policy_details; flags=EEikMenuItemSpecific; }, - + MENU_ITEM { + command=EVpnUiCmdUpdatePolicy; + txt = qtn_vpn_options_update_policy; }, MENU_ITEM { command=EVpnUiCmdDeletePolicy; txt = qtn_vpn_options_delete_policy; @@ -1183,18 +1188,6 @@ //---------------------------------------------------- // -// r_vpn_wait_importing_policy -// wait note for synchronizing and importing policy -// -//---------------------------------------------------- -// -RESOURCE TBUF r_vpn_wait_importing_policy - { - buf = qtn_vpn_wait_importing_policy; - } - -//---------------------------------------------------- -// // r_vpn_wait_note // wait note for synchronise and update process // diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/group/vpnmanagementui.mmp --- a/vpnui/vpnmanagementui/group/vpnmanagementui.mmp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/group/vpnmanagementui.mmp Wed Oct 13 15:42:16 2010 +0300 @@ -65,7 +65,6 @@ USERINCLUDE ../../../vpnapiimpl/inc USERINCLUDE ../../../vpnengine/vpncommon/inc //for logcommon.h USERINCLUDE ../../vpnecomnotifier/data -USERINCLUDE ../../../vpnengine/vpnextapi/inc MW_LAYER_SYSTEMINCLUDE APP_LAYER_SYSTEMINCLUDE @@ -89,7 +88,6 @@ LIBRARY eventviewer.lib LIBRARY centralrepository.lib LIBRARY cmmanager.lib -LIBRARY vpnextapi.lib #ifdef __SCALABLE_ICONS LIBRARY AknSkins.lib #endif //__SCALABLE_ICONS diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/inc/vpnapiwrapper.h --- a/vpnui/vpnmanagementui/inc/vpnapiwrapper.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/inc/vpnapiwrapper.h Wed Oct 13 15:42:16 2010 +0300 @@ -19,15 +19,13 @@ #define __VPNAPIWRAPPER_H__ #include - -#include "vpnextapi.h" +#include "vpnapi.h" class MVpnApiWrapperCaller { public: - - virtual void NotifySynchroniseServerCompleteL(TInt aResult) = 0; + virtual void NotifyPolicyImportComplete(TInt aResult) = 0; }; /** @@ -67,18 +65,23 @@ TInt aPolicyIndex, TVpnPolicyDetails& aPolicyDetails); /** - * Cretes the specified server definition. + * Imports a new VPN policy to the policy store. * - * @param aServerDetails [in] Server details structure - */ - TInt CreateServer( const TAgileProvisionApiServerSettings& aServerDetails ); - - TAgileProvisionApiServerListElem& ServerListL(); - - void GetServerDetailsL( TAgileProvisionApiServerSettings& aServerDetails ); - TInt DeleteServer(); - void SynchroniseServerL( MVpnApiWrapperCaller* aCaller ); - void CancelSynchronise( ); + * @param aImportDir An absolute path to the VPN policy files directory + * + * @param aCaller + */ + void ImportPolicyL( + const TDesC& aImportDir, MVpnApiWrapperCaller* aCaller); + + /** + * Gets the last update time of the specified policy. + * @param aPolicyIndex Index of the listbox in the policy view. + * @param aTime Last update time to be returned. + * @return Returns KErrNone if succeed. + * Otherwise it returns KErrNotFound. + */ + TInt GetLastUpdateTime(TInt aPolicyIndex, TTime& aTime); protected: // From CActive void DoCancel(); @@ -100,27 +103,16 @@ */ void BuildPolicyListL(); - /** - * Deletes all VPN AP that referes to policy aPolicyId. - * Ignores possible errors --> In case of an error the remaining - * APs are not deleted. - */ - void DeleteReferringVpnAps(const TVpnPolicyId& aPolicyId) const; - void DeleteReferringVpnApsL(const TVpnPolicyId& aPolicyId) const; - private: enum TTask { ETaskNone = 1, - ETaskSynchroniseServer, - + ETaskImportPolicies }; + RVpnApi iVpnApi; - RVpnExtApi iVpnExtApi; - TAgileProvisionApiServerSettings iPolicyServer; - TAgileProvisionApiServerListElem iVpnPolicyServerList; CArrayFixFlat* iPolicyList; TFileName iImportDir; diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/inc/vpnmanagementuipolicycontainer.h --- a/vpnui/vpnmanagementui/inc/vpnmanagementuipolicycontainer.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/inc/vpnmanagementuipolicycontainer.h Wed Oct 13 15:42:16 2010 +0300 @@ -88,6 +88,16 @@ void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType); + void InstallPoliciesL(); + + void SynchroniseServerL(); + + void UpdatePolicyL(TVpnPolicyId aPolicyId); + + // from MAcuApiWrapperCaller + void NotifyUpdatePolicyCompleteL(TInt aResult); + void NotifySynchroniseServerCompleteL(TInt aResult); + void NotifyStepChangedL(TInt aResult); public: // data @@ -116,7 +126,7 @@ /** * If ETrue, Show Waitnote. */ - + TBool iShowWaitNote; private: // functions @@ -172,7 +182,7 @@ */ void ShowPoliciesL(); - + void PoliciesListEmptyL(); @@ -184,6 +194,12 @@ void GetHelpContext(TCoeHelpContext& aContext) const; #endif //__SERIES60_HELP + protected: //data + + /** + * If ETrue, ConstructL calls PoliciesListEmptyL() method. + */ + TBool iCallPoliciesListEmpty; private: //data diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/inc/vpnmanagementuiservercontainer.h --- a/vpnui/vpnmanagementui/inc/vpnmanagementuiservercontainer.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/inc/vpnmanagementuiservercontainer.h Wed Oct 13 15:42:16 2010 +0300 @@ -33,8 +33,7 @@ */ class CVpnManagementUiServerContainer : public CCoeControl, public MCoeControlObserver, - public MEikListBoxObserver, - public MVpnApiWrapperCaller + public MEikListBoxObserver { /** * Policy Container needs to get access to CVpnManagementUiServerView's DoActivateL @@ -87,14 +86,14 @@ void DeleteServerL(TInt aIndex); /** - * Calls Agile provision web service to Synchronise mVPN configuration + * Calls AcuAgent API's SynchroniseServerL */ - void SynchroniseServerL(); + void SynchroniseServerL(TInt aIndex); - // from vpnapiwrapper - + // from MAcuApiWrapperCaller + void NotifyUpdatePolicyCompleteL(TInt aResult); void NotifySynchroniseServerCompleteL(TInt aResult); - + void NotifyStepChangedL(TInt aResult); void HandleListBoxEventL (CEikListBox *aListBox, TListBoxEvent aEventType); @@ -123,7 +122,7 @@ /** * If ETrue, Show Waitnote. */ - + TBool iShowWaitNote; private: // functions diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/inc/vpnmanagementuiserversettingscontainer.h --- a/vpnui/vpnmanagementui/inc/vpnmanagementuiserversettingscontainer.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/inc/vpnmanagementuiserversettingscontainer.h Wed Oct 13 15:42:16 2010 +0300 @@ -20,8 +20,6 @@ #include -#include "vpnextapi.h" - /** * CServerSettingsContainer container control class. @@ -64,8 +62,10 @@ */ void ChangeSettingValueL(); - - const TAgileProvisionApiServerSettings& ServerDetailsL(); + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + const TAcuApiServerDetails& ServerDetailsL(); ***/ static HBufC* GetDestinationNameL( TUint aId ); static HBufC* GetConnectionMethodNameL( TUint aId ); @@ -113,7 +113,7 @@ CVpnUiLoader& iLoader; /// Server details - TAgileProvisionApiServerSettings iServerDetails; + // TAcuApiServerDetails iServerDetails; TBuf iServerAddressBuffer; /** diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/inc/vpnmanagementuiview.h --- a/vpnui/vpnmanagementui/inc/vpnmanagementuiview.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/inc/vpnmanagementuiview.h Wed Oct 13 15:42:16 2010 +0300 @@ -96,8 +96,9 @@ */ void HandleCommandL(TInt aCommand); + // from MAcuApiWrapperCaller + void NotifyPolicyImportComplete(TInt aResult); - void NotifySynchroniseServerCompleteL(TInt aResult); public: /** @@ -229,8 +230,6 @@ TInt iCurrentItem; // currently selected listbox item TInt iTopItemIndex; // first item in the listbox - - HBufC* iCaption; // caption text }; #endif // __VPNMANAGEMENTUIVIEW_H__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/inc/vpnuiloader.h --- a/vpnui/vpnmanagementui/inc/vpnuiloader.h Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/inc/vpnuiloader.h Wed Oct 13 15:42:16 2010 +0300 @@ -24,7 +24,6 @@ #include "vpnapiwrapper.h" #include "vpnmanagementuidefs.h" #include "uirunner.h" -#include "vpnextapi.h" // CONSTANTS /** @@ -204,9 +203,6 @@ TInt iCurrentServerIndex; TBool iPolicyUpdate; TBuf iSelectionName; - - TBool iShowWaitNote; - RVpnExtApi iVpnExtApi; private: // data @@ -274,9 +270,6 @@ TBool iKeepOpen; TBool iPolicyViewVisited; TBool iLogViewVisited; - TBool iServerViewVisited; - TBool iServerSettingsViewVisited; - }; #endif // __VPNUILOADER_H__ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/loc/vpnmanagementui.loc --- a/vpnui/vpnmanagementui/loc/vpnmanagementui.loc Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/loc/vpnmanagementui.loc Wed Oct 13 15:42:16 2010 +0300 @@ -46,7 +46,7 @@ //d:Item opens Policy servers view //l:list_setting_pane_t1 // -#define qtn_vpn_policy_servers "VPN policy server" +#define qtn_vpn_policy_servers "VPN policy servers" //d:Text of a list item in VPN management view //d:Item opens VPN log view @@ -182,7 +182,7 @@ //d:Name of view for title pane //l:title_pane_t2/opt9 // -#define qtn_vpn_policy_servers_title "VPN policy server" +#define qtn_vpn_policy_servers_title "VPN policy servers" //d:Policy server view empty list placeholder text //l:main_list_empty_pane diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnapiwrapper.cpp --- a/vpnui/vpnmanagementui/src/vpnapiwrapper.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnapiwrapper.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -15,14 +15,10 @@ * */ -#include -#include -#include #include "vpnapiwrapper.h" - +#include "vpnapi.h" #include "log_vpnmanagementui.h" -using namespace CMManager; CVpnApiWrapper* CVpnApiWrapper::NewL() { @@ -40,19 +36,20 @@ CVpnApiWrapper::~CVpnApiWrapper() { - LOG_("CVpnApiWrapper::~CVpnApiWrapper() called\n"); delete iPolicyList; Cancel(); - - iVpnExtApi.Close(); + iVpnApi.Close(); } void CVpnApiWrapper::DoCancel() { LOG_("CVpnApiWrapper::DoCancel() called\n"); - TInt i=iVpnExtApi.CancelPolicyProvision(); - + if (iOngoingTask == ETaskImportPolicies) + { + iVpnApi.CancelImport(); + } + iOngoingTask = ETaskNone; } @@ -60,10 +57,10 @@ { LOG_1("CVpnApiWrapper::RunL():%d", iStatus.Int()); - if (iOngoingTask == ETaskSynchroniseServer) - { - iCaller->NotifySynchroniseServerCompleteL(iStatus.Int()); - } + if (iOngoingTask == ETaskImportPolicies) + { + iCaller->NotifyPolicyImportComplete(iStatus.Int()); + } iOngoingTask = ETaskNone; } @@ -73,8 +70,9 @@ LOG_("CVpnApiWrapper::ConstructL() - begin"); CActiveScheduler::Add(this); + LOG_("CVpnApiWrapper::ConstructL() - begin 2"); + User::LeaveIfError(iVpnApi.Connect()); - User::LeaveIfError(iVpnExtApi.Connect()); LOG_("CVpnApiWrapper::ConstructL() - end"); } @@ -93,7 +91,7 @@ iPolicyList = new (ELeave) CArrayFixFlat(2); - User::LeaveIfError(iVpnExtApi.GetPolicyInfoList(iPolicyList)); + User::LeaveIfError(iVpnApi.GetPolicyInfoList(iPolicyList)); TKeyArrayFix Key( _FOFF(TVpnPolicyInfo,iName), ECmpCollated ); Key.SetPtr( iPolicyList ); @@ -107,10 +105,7 @@ LOG_("CVpnApiWrapper::DeletePolicyL() - begin"); TVpnPolicyId& policyToDelete = iPolicyList->At(aPolicyIndex).iId; - User::LeaveIfError(iVpnExtApi.DeletePolicy(policyToDelete)); - - //Delete all VPN APs pointing deleted policy - DeleteReferringVpnAps(policyToDelete); + User::LeaveIfError(iVpnApi.DeletePolicy(policyToDelete)); LOG_("CVpnApiWrapper::DeletePolicyL() - end"); } @@ -120,131 +115,29 @@ LOG_("CVpnApiWrapper::GetPolicyDetailsL() - begin"); TVpnPolicyId& policyOfInterest = iPolicyList->At(aPolicyIndex).iId; - User::LeaveIfError(iVpnExtApi.GetPolicyDetails(policyOfInterest, aPolicyDetails)); + User::LeaveIfError(iVpnApi.GetPolicyDetails(policyOfInterest, aPolicyDetails)); LOG_("CVpnApiWrapper::GetPolicyDetailsL() - end"); } - - -TInt CVpnApiWrapper::CreateServer( const TAgileProvisionApiServerSettings& aServerDetails) +void CVpnApiWrapper::ImportPolicyL(const TDesC& aImportDir, MVpnApiWrapperCaller* aCaller) { - - iPolicyServer.iServerNameLocal = aServerDetails.iServerNameLocal; - iPolicyServer.iServerUrl = aServerDetails.iServerUrl; - iPolicyServer.iSelection = aServerDetails.iSelection; - - return iVpnExtApi.CreateServer(iPolicyServer); - } + LOG_("CVpnApiWrapper::ImportPolicyL() - begin"); -TAgileProvisionApiServerListElem& CVpnApiWrapper::ServerListL() - { - TInt err(iVpnExtApi.ServerListL( iVpnPolicyServerList )); - User::LeaveIfError( err ); - - return iVpnPolicyServerList; - - } - -void CVpnApiWrapper::GetServerDetailsL( TAgileProvisionApiServerSettings& aServerDetails ) - { - User::LeaveIfError( iVpnExtApi.ServerDetails(aServerDetails)); - } + if (iOngoingTask != ETaskNone) + { + User::Leave(KErrInUse); + } -TInt CVpnApiWrapper::DeleteServer() - { - - return iVpnExtApi.DeleteServer(); + iCaller = aCaller; + iImportDir.Copy(aImportDir); - } + iVpnApi.ImportPolicy(iImportDir, iStatus); -void CVpnApiWrapper::SynchroniseServerL( MVpnApiWrapperCaller* aCaller ) - { - iCaller=aCaller; - iVpnExtApi.SynchronizePolicyServer(iStatus); + iOngoingTask = ETaskImportPolicies; SetActive(); - iOngoingTask = ETaskSynchroniseServer; - } - -void CVpnApiWrapper::CancelSynchronise() - { - - Cancel(); - - } - -void CVpnApiWrapper::DeleteReferringVpnAps(const TVpnPolicyId& aPolicyId) const - { - TRAP_IGNORE(DeleteReferringVpnApsL(aPolicyId)); + LOG_("CVpnApiWrapper::ImportPolicyL() - end"); } -void CVpnApiWrapper::DeleteReferringVpnApsL(const TVpnPolicyId& aPolicyId) const - { - RCmManager cmManager; - cmManager.OpenLC(); - - //First collect all VPN connection methods from destinations - RArray destinationArray; - cmManager.AllDestinationsL( destinationArray ); - CleanupClosePushL(destinationArray); - - for (TInt i = 0; i < destinationArray.Count(); ++i) - { - RCmDestination destination = cmManager.DestinationL( destinationArray[i] ); - CleanupClosePushL(destination); - - TInt connectionMethodCount = destination.ConnectionMethodCount(); - for (TInt j = connectionMethodCount - 1; j >= 0; --j) - { - RCmConnectionMethod connectionMethod = destination.ConnectionMethodL( j ); - CleanupClosePushL(connectionMethod); - - if ( connectionMethod.GetBoolAttributeL(ECmVirtual) && - connectionMethod.GetIntAttributeL( ECmBearerType ) == KPluginVPNBearerTypeUid) - { - HBufC* policyId = connectionMethod.GetStringAttributeL( EVpnServicePolicy ); - CleanupStack::PushL(policyId); - if (policyId->Compare(aPolicyId) == 0) - { - destination.DeleteConnectionMethodL( connectionMethod ); - destination.UpdateL(); - } - CleanupStack::PopAndDestroy(policyId); - } - CleanupStack::PopAndDestroy(); //connectionMethod - } - - CleanupStack::PopAndDestroy(); //destination - } - CleanupStack::PopAndDestroy(); //destinationArray - - //Second collect VPN connection methods, which are not inside a destination. - RArray connectionMethodArray; - cmManager.ConnectionMethodL( connectionMethodArray ); - CleanupClosePushL(connectionMethodArray); - - for ( TInt i = 0; i < connectionMethodArray.Count(); ++i) - { - RCmConnectionMethod connectionMethod = - cmManager.ConnectionMethodL( connectionMethodArray[i] ); - CleanupClosePushL(connectionMethod); - if ( connectionMethod.GetBoolAttributeL(ECmVirtual) && - connectionMethod.GetIntAttributeL( ECmBearerType ) == KPluginVPNBearerTypeUid) - { - HBufC* policyId = connectionMethod.GetStringAttributeL( EVpnServicePolicy ); - CleanupStack::PushL(policyId); - if (policyId->Compare(aPolicyId) == 0) - { - connectionMethod.DeleteL(); - connectionMethod.UpdateL(); - } - CleanupStack::PopAndDestroy(policyId); - } - CleanupStack::PopAndDestroy(); //connectionMethod - } - CleanupStack::PopAndDestroy(); //connectionMethodArray - - CleanupStack::PopAndDestroy(); //cmManager - } /***/ diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnmanagementuicontainer.cpp --- a/vpnui/vpnmanagementui/src/vpnmanagementuicontainer.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnmanagementuicontainer.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -247,10 +247,12 @@ CleanupStack::PopAndDestroy(); // resourceText //Create Policy servers setting listbox item - - resourceText = StringLoader::LoadLC( R_VPN_POLICY_SERVERS ); - itemTextArray->AppendL(*resourceText); - CleanupStack::PopAndDestroy(); // resourceText + // Hide policy server from UI + // NSSM support is discontinued + // Policy server UI may be used for another purpose in future + // resourceText = StringLoader::LoadLC( R_VPN_POLICY_SERVERS ); + // itemTextArray->AppendL(*resourceText); + // CleanupStack::PopAndDestroy(); // resourceText //Create Log setting listbox item resourceText = StringLoader::LoadLC( R_VPN_LOG ); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnmanagementuipolicycontainer.cpp --- a/vpnui/vpnmanagementui/src/vpnmanagementuipolicycontainer.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnmanagementuipolicycontainer.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -25,7 +25,7 @@ #include "vpnuiloader.h" #include "vpnmanagementuipolicycontainer.h" #include "vpnmanagementui.hrh" -#include "vpnextapi.h" + #ifdef __SERIES60_HELP #include // for help context of VPN Management UI @@ -68,7 +68,7 @@ CreateListBoxL(); //Initialization - + iShowWaitNote = EFalse; ShowPoliciesL(); SetRect( aRect ); @@ -83,10 +83,152 @@ void CVpnManagementUiPolicyContainer::ActivateL() { CCoeControl::ActivateL(); + // put empty list checking & required actions here. + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + if (!iLoader.iBackFromServerDefinition) + { + PoliciesListEmptyL(); + } + if (iLoader.iNewServerDefinition) + {//Synchronise server query + HBufC* temp; + temp = StringLoader::LoadLC( R_VPN_QUEST_SYNCHRONISE_SERVER ); + CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); + TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp ); + CleanupStack::PopAndDestroy(); // temp + if ( retval ) + { + //Show wait dialog + //ShowWaitNoteL(); called now from NotifyStepChangedL + iShowWaitNote = ETrue; + // Get selection neme for connecting via note + // and save it to the member variable of iLoader + iLoader.GetSelectionNameL( iLoader.iSelectionName ); + + //Save server index for Connecting via note + iLoader.iCurrentServerIndex = 0; + //Synchronise server + iLoader.AcuApiWrapperL().SynchroniseServerL(0,this); + + //Set iNewServerDefinition to false, because + //we are now synchronised server + iLoader.iNewServerDefinition = EFalse; + } + } ***/ + } +void CVpnManagementUiPolicyContainer::PoliciesListEmptyL() + { + if (iListItemCount == 0) + { + //Set iNewServerDefinition to false, because + //we don't want to show note + //"new server defined synchronise now" + iLoader.iNewServerDefinition = EFalse; + // no policies installed, confirmation query + HBufC* temp; + temp = StringLoader::LoadLC( R_VPN_QUEST_DL_POLICIES_NOW ); + CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); + TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp ); + CleanupStack::PopAndDestroy(); // temp + if ( retval ) + { // start policy install procedure + InstallPoliciesL(); + } + } } +void CVpnManagementUiPolicyContainer::InstallPoliciesL() + { + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + CArrayFix* serverList = iLoader.AcuApiWrapperL().ServerListL(); + TInt serverCount = serverList->Count(); + //if policy servers defined show policy server list query + if (serverCount > 0 ) + { + TInt index = 0; + CDesCArrayFlat *array = new(ELeave) CDesCArrayFlat(1); + CleanupStack::PushL(array); + + for (TInt i = 0; i < serverCount; ++i) + { + TBuf serverName; + serverName.Append(serverList->At(i).iServerNameLocal); + array->AppendL(serverName); + } + CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog(&index); + dlg->PrepareLC( R_LIST_QUERY ); + dlg->SetItemTextArray(array); + dlg->SetOwnershipType(ELbmDoesNotOwnItemArray); + + TInt queryOk = dlg->RunLD(); + if(queryOk == EAknSoftkeyOk || queryOk == EAknSoftkeySelect) + { + TBool selectionExists = iLoader.SelectionExistsL( index ); + + if( selectionExists ) + { + //Save server index for Connecting via note + iLoader.iCurrentServerIndex = index; + //Show wait dialog + iShowWaitNote = ETrue; + // Get selection neme for connecting via note + // and save it to the member variable of iLoader + iLoader.GetSelectionNameL( iLoader.iSelectionName ); + + iLoader.AcuApiWrapperL().SynchroniseServerL( index, this ); + } + } + CleanupStack::PopAndDestroy(); // array + + } + else + { ***/ + //No policy servers defined show define new policy + //server conrirmation query + HBufC* temp; + temp = StringLoader::LoadLC( R_VPN_QUEST_DEFINE_NEW_SERVER ); + CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); + TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp ); + CleanupStack::PopAndDestroy(); // temp + if ( retval ) + { + if (!SysUtil::FFSSpaceBelowCriticalLevelL(0, 0)) + { + iLoader.iBackFromServerDefinition = ETrue; + iLoader.ChangeViewL(KChangeViewSettings); + } + else + { + CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) ); + errorUi->ShowGlobalErrorNoteL( KErrDiskFull ); + CleanupStack::PopAndDestroy(); // errorUi + } + } + // } + } + +void CVpnManagementUiPolicyContainer::SynchroniseServerL() + { +/*NOT USED ANYMORE + //Conrirmation query + HBufC* temp; + temp = StringLoader::LoadLC( R_VPN_QUEST_SYNCHRONISE_SERVER ); + CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); + TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp ); + CleanupStack::PopAndDestroy(); // temp + if ( retval ) + { + TInt currentPosition = iListBox->CurrentItemIndex(); + iLoader.iAcuApiWrapper->SynchroniseServer(currentPosition, this); + } +*/ + } // --------------------------------------------------------- // CVpnManagementUiPolicyContainer::SizeChanged() // Called by framework when the view size is changed @@ -338,8 +480,151 @@ iListBox->HandleItemAdditionL(); } +// --------------------------------------------------------- +// CVpnManagementUiPolicyContainer:::UpdatePolicy +// --------------------------------------------------------- +// +void CVpnManagementUiPolicyContainer::UpdatePolicyL(TVpnPolicyId /* aPolicyId */) + { + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + TBool selectionExists = iLoader.SelectionExistsL( 0 ); + + if( selectionExists ) + { + // Get selection name for connecting via note + // and save it to the member variable of iLoader + iLoader.GetSelectionNameL( iLoader.iSelectionName ); + + iLoader.ShowWaitNoteL(); + TAcuContentId contentId; + contentId.iContentId = aPolicyId; + iLoader.AcuApiWrapperL().UpdatePolicyL( contentId, this ); + } ***/ + } +void CVpnManagementUiPolicyContainer::NotifyUpdatePolicyCompleteL( + TInt aResult) + { + if ( iLoader.iWaitDialog ) + { + iLoader.DeleteWaitNoteL();//iWaitDialog->ProcessFinishedL(); // deletes the wait dialog + } + + if (aResult == KErrNone) + { + //Confirmation note + HBufC* string = StringLoader::LoadLC( R_VPN_CONF_POLICY_UPDATE_COMPLETE ); + CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue ); + note->ExecuteLD( *string ); + CleanupStack::PopAndDestroy( string ); + } + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + else if (aResult == KAcuErrServerCertExpiredByPkiService) + { + //Show an information note + HBufC* noteText; + noteText = StringLoader::LoadLC( R_VPN_INFO_SERVER_CERT_EXPIRED ); + CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue); + note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec + note->ExecuteLD(noteText->Des()); + CleanupStack::PopAndDestroy(); // noteText + } ***/ + else if (aResult == KErrDiskFull) + { + CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) ); + errorUi->ShowGlobalErrorNoteL( KErrDiskFull ); + CleanupStack::PopAndDestroy(); // errorUi + } + else if (aResult == KErrCancel) + { + // No operation, i.e. don't show anything + } + else + { + //Show an information note + HBufC* noteText; + noteText = StringLoader::LoadLC( R_VPN_INFO_POLICY_DL_ERROR ); + CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue); + note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec + note->ExecuteLD(noteText->Des()); + CleanupStack::PopAndDestroy(); // noteText + } + } + +void CVpnManagementUiPolicyContainer::NotifySynchroniseServerCompleteL(TInt aResult) + { + //CloseWaitDialog(); + + if ( iLoader.iWaitDialog ) + { + iLoader.DeleteWaitNoteL();//iWaitDialog->ProcessFinishedL(); // deletes the wait dialog + } + + if (aResult == KErrNone) + { + //Confirmation note + HBufC* string = StringLoader::LoadLC( R_VPN_CONF_POLICY_SERVER_SYNC_OK ); + CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue ); + note->ExecuteLD( *string ); + CleanupStack::PopAndDestroy( string ); + } + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + else if (aResult == KAcuErrServerCertExpiredByPkiService) + { + //Show an information note + HBufC* noteText; + noteText = StringLoader::LoadLC( R_VPN_INFO_SERVER_CERT_EXPIRED ); + CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue); + note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec + note->ExecuteLD(noteText->Des()); + CleanupStack::PopAndDestroy(); // noteText + } ***/ + else if (aResult == KErrDiskFull) + { + CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) ); + errorUi->ShowGlobalErrorNoteL( KErrDiskFull ); + CleanupStack::PopAndDestroy(); // errorUi + } + else if (aResult == KErrCancel) + { + // No operation, i.e. don't show anything + } + else + { + //Show an information note + HBufC* noteText; + noteText = StringLoader::LoadLC( R_VPN_INFO_POLICY_SERVER_SYNC_ERROR ); + CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue); + note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec + note->ExecuteLD(noteText->Des()); + CleanupStack::PopAndDestroy(); // noteText + } + + ShowPoliciesL(); + iParent.SetMiddleSoftKeyL(ETrue); + } + + +void CVpnManagementUiPolicyContainer::NotifyStepChangedL(TInt /*aResult*/) + { + if (iShowWaitNote) + { + iLoader.ShowWaitNoteL(); + iShowWaitNote = EFalse; + } + if ( iLoader.iWaitDialog ) + { + iLoader.SetTextL(); + } + } + // --------------------------------------------------------- // CVpnManagementUiPolicyContainer::GetHelpContext // This function is called when Help application is launched. diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnmanagementuipolicyview.cpp --- a/vpnui/vpnmanagementui/src/vpnmanagementuipolicyview.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnmanagementuipolicyview.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -108,13 +108,22 @@ { TInt currentItem = iPolicyContainer->iListBox->CurrentItemIndex(); + // the policy list is empty all except Install and Exit is dimmed if ( currentItem == -1 ) { aMenuPane->SetItemDimmed( EVpnUiCmdPolicyDetails, ETrue ); aMenuPane->SetItemDimmed( EVpnUiCmdDeletePolicy, ETrue ); - + aMenuPane->SetItemDimmed( EVpnUiCmdUpdatePolicy, ETrue ); + // NSSM support is discontinued + aMenuPane->SetItemDimmed( EVpnUiCmdInstallPolicies, ETrue ); } - + // at least one policy is installed, + else + { + aMenuPane->SetItemDimmed( EVpnUiCmdInstallPolicies, ETrue ); + // NSSM support is discontinued + aMenuPane->SetItemDimmed( EVpnUiCmdUpdatePolicy, ETrue ); + } } } @@ -135,7 +144,8 @@ // void CVpnManagementUiPolicyView::HandleCommandL( TInt aCommand ) { - switch ( aCommand ) + TBool ffsLow; + switch ( aCommand ) { case EAknSoftkeyBack: { @@ -155,7 +165,34 @@ break; } - + case EVpnUiCmdInstallPolicies: + { + ffsLow = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 ); + if(!ffsLow) + { + iPolicyContainer->InstallPoliciesL(); + } + break; + } + case EVpnUiCmdUpdatePolicy: + { + ffsLow = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 ); + if(!ffsLow) + { + iCurrentPosition = iPolicyContainer->iListBox->CurrentItemIndex(); + //Save policy index for Connecting via note + iLoader.iCurrentPolicyIndex = iCurrentPosition; + //Save update operation for Connecting via note + iLoader.iPolicyUpdate = ETrue; + + TVpnPolicyInfo policyInfo; + policyInfo.iId = iLoader.VpnApiWrapperL().PolicyListL()->At( + iCurrentPosition).iId; + iPolicyContainer->UpdatePolicyL(policyInfo.iId); + } + break; + } + case EVpnUiCmdDeletePolicy: { //confirmation query @@ -275,6 +312,8 @@ ReadResourceL(*text, aResourceId); cbaGroup->RemoveCommandFromStack( KVpnMSKControlId, EVpnUiCmdPolicyDetails); + cbaGroup->RemoveCommandFromStack( + KVpnMSKControlId, EVpnUiCmdInstallPolicies); cbaGroup->AddCommandToStackL( KVpnMSKControlId, aCommandId, text->Des()); CleanupStack::PopAndDestroy(text); diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnmanagementuiservercontainer.cpp --- a/vpnui/vpnmanagementui/src/vpnmanagementuiservercontainer.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnmanagementuiservercontainer.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -73,7 +73,7 @@ iLoader.iShowDefineQuery = ETrue; } iLoader.iBackFromServerDefinition = EFalse; - + iShowWaitNote = EFalse; SetRect( aRect ); } @@ -112,7 +112,36 @@ } } } + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + if (iLoader.iNewServerDefinition) + {//Synchronise server query + HBufC* temp; + temp = StringLoader::LoadLC( R_VPN_QUEST_SYNCHRONISE_SERVER ); + CAknQueryDialog* query = CAknQueryDialog::NewL( + CAknQueryDialog::EConfirmationTone ); + TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp ); + CleanupStack::PopAndDestroy(); // temp + if ( retval ) + { + //Show wait dialog + //Save server index for Connecting via note + iLoader.iCurrentServerIndex = iLoader.AcuApiWrapperL().GetLastCreatedServerIndexL(); + //ShowWaitNoteL(); + iShowWaitNote = ETrue; + // Get selection name for connecting via note + // and save it to the member variable of iLoader + iLoader.GetSelectionNameL( iLoader.iSelectionName ); + + //Synchronise server + iLoader.AcuApiWrapperL().SynchroniseLastCreatedServerL(this); + //Set iNewServerDefinition to false, because + //we are now synchronised server + iLoader.iNewServerDefinition = EFalse; + } + } ***/ } @@ -274,6 +303,13 @@ iListBox->SetTopItemIndex( aTopItem ); iListBox->SetCurrentItemIndex( aCurrentPosition ); } + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + if(iLoader.iNewServerDefinition) + { + iListBox->SetCurrentItemIndex(iLoader.AcuApiWrapperL().GetLastCreatedServerIndexL()); + } ***/ ActivateL(); DrawNow(); @@ -318,52 +354,79 @@ void CVpnManagementUiServerContainer::ShowServersL() { - - TAgileProvisionApiServerListElem& serverList = iLoader.VpnApiWrapperL().ServerListL(); + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + CArrayFix* serverList = iLoader.AcuApiWrapperL().ServerListL(); CDesCArrayFlat* itemTextArray = static_cast(iListBox->Model()->ItemTextArray()); itemTextArray->Reset(); iListBox->Reset(); - if ( serverList.iServerUrl.Length()>0 ) - { - iListItemCount = 1; - TBuf serverName; + iListItemCount = serverList->Count(); + + for (TInt i = 0; i < iListItemCount; ++i) + { + TBuf serverName; serverName.Append(_L("\t")); - serverName.Append(serverList.iServerNameLocal); + serverName.Append(serverList->At(i).iServerNameLocal); itemTextArray->AppendL(serverName); } + iListBox->HandleItemAdditionL(); - + ***/ } void CVpnManagementUiServerContainer::DeleteServerL(TInt /* aIndex */) { LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL\n"))); - - TAgileProvisionApiServerListElem& serverList = iLoader.VpnApiWrapperL().ServerListL(); - TBuf serverName; - serverName.Append(serverList.iServerNameLocal); + + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + + TBuf serverName; + serverName.Append( + iLoader.AcuApiWrapperL().ServerListL()->At(aIndex).iServerNameLocal); + LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL - server name %S\n"), &serverName)); + HBufC* temp; + + TAcuServerId serverId; + serverId = iLoader.AcuApiWrapperL().ServerListL()->At(aIndex).iServerId; - HBufC* temp = StringLoader::LoadLC( R_VPN_QUEST_DELETE_SERVER, serverName ); - + //Get server policy count from vpnapiext + TInt policyCount = 0; + TInt ret = iLoader.VpnApiWrapperL().GetServerPolicyCount( + serverId, policyCount); + + LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL - server policy count %d\n"), policyCount)); + + if ((ret== KErrNone) && (policyCount > 0)) //at least one policy related to given ACU server is found + { + // policies related to the server, confirmation query + temp = StringLoader::LoadLC( R_VPN_QUEST_DELETE_SERVER_ASSOCIATED ); + } + else + { + // no policies related to the server, confirmation query + temp = StringLoader::LoadLC( R_VPN_QUEST_DELETE_SERVER, serverName ); + } + CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp ); CleanupStack::PopAndDestroy(); // temp if ( retval ) { - TInt ret = iLoader.VpnApiWrapperL().DeleteServer(); - TInt ind = 0; + TInt ret = iLoader.AcuApiWrapperL().DeleteServer(aIndex); if(ret == KErrNone) { //Update listbox - UpdateListBoxL( ind ); - + UpdateListBoxL( aIndex ); //Update iServerList - iLoader.VpnApiWrapperL().ServerListL(); + iLoader.AcuApiWrapperL().ServerListL(); //Set iNewServerDefinition to false iLoader.iNewServerDefinition = EFalse; @@ -379,30 +442,40 @@ CleanupStack::PopAndDestroy(); // noteText } } - + ***/ } -void CVpnManagementUiServerContainer::SynchroniseServerL() +void CVpnManagementUiServerContainer::SynchroniseServerL(TInt /* aIndex */) { LOG_("CVpnManagementUiServerContainer::SynchroniseServerL"); + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + + TBool selectionExists = iLoader.SelectionExistsL( aIndex ); + if( selectionExists ) + { + //Save server index for Connecting via note + iLoader.iCurrentServerIndex = aIndex; // Get selection name for connecting via note // and save it to the member variable of iLoader iLoader.GetSelectionNameL( iLoader.iSelectionName ); //Show wait dialog iLoader.ShowWaitNoteL(); - iLoader.VpnApiWrapperL().SynchroniseServerL( this ); - - + iLoader.AcuApiWrapperL().SynchroniseServerL( aIndex,this ); //Set iNewServerDefinition to false, because when //we go to the policy view we don't want to show note //"new server defined synchronise now" iLoader.iNewServerDefinition = EFalse; - + } ***/ } +void CVpnManagementUiServerContainer::NotifyUpdatePolicyCompleteL(TInt /*aResult*/) + { + } void CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL(TInt aResult) { @@ -410,7 +483,7 @@ if ( iLoader.iWaitDialog ) { - iLoader.DeleteWaitNoteL();//// deletes the wait dialog + iLoader.DeleteWaitNoteL();//->iWaitDialog->ProcessFinishedL(); // deletes the wait dialog } @@ -422,7 +495,19 @@ note->ExecuteLD( *string ); CleanupStack::PopAndDestroy( string ); } - + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + else if (aResult == KAcuErrServerCertExpiredByPkiService) + { + //Show an information note + HBufC* noteText; + noteText = StringLoader::LoadLC( R_VPN_INFO_SERVER_CERT_EXPIRED ); + CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue); + note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec + note->ExecuteLD(noteText->Des()); + CleanupStack::PopAndDestroy(); // noteText + } ***/ else if (aResult == KErrDiskFull) { CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) ); @@ -445,7 +530,19 @@ } iParent.SetMiddleSoftKeyL(ETrue); + } +void CVpnManagementUiServerContainer::NotifyStepChangedL(TInt /*aResult*/) + { + if (iShowWaitNote) + { + iLoader.ShowWaitNoteL(); + iShowWaitNote = EFalse; + } + if ( iLoader.iWaitDialog ) + { + iLoader.SetTextL(); + } } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnmanagementuiserversettingscontainer.cpp --- a/vpnui/vpnmanagementui/src/vpnmanagementuiserversettingscontainer.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnmanagementuiserversettingscontainer.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -24,8 +24,6 @@ #include #include #include -#include - #include #include "vpnuiloader.h" #include "vpnmanagementuiserversettingscontainer.h" @@ -80,10 +78,12 @@ // --------------------------------------------------------------------------- // CAknSettingItem* CServerSettingsContainer::CreateSettingItemL( - TInt aSettingId ) + TInt /* aSettingId */) { CAknSettingItem* settingItem(NULL); - + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. switch (aSettingId) { case EVpnUiSettingServerName: @@ -98,53 +98,15 @@ settingItem = new (ELeave) CAknTextSettingItem( aSettingId, iServerAddressBuffer ); break; - case EVpnUiSettingIap: - if ( iServerDetails.iSelection.iId <1 ) - { - RCmManagerExt cmManagerExt; - cmManagerExt.OpenL(); - CleanupClosePushL( cmManagerExt ); - - //Makes sure that Internet Destination Exists - RArray destinationArray; - cmManagerExt.AllDestinationsL( destinationArray ); - CleanupClosePushL(destinationArray); - - TUint32 internetDestinationId = 0; - for (TInt i = 0; i < destinationArray.Count(); ++i) - { - RCmDestinationExt destination = cmManagerExt.DestinationL( destinationArray[i] ); - CleanupClosePushL(destination); - - TUint32 purposeMetaData = destination.MetadataL( ESnapMetadataPurpose ); - if ( ESnapPurposeInternet == purposeMetaData ) - { - internetDestinationId = destinationArray[i]; - CleanupStack::PopAndDestroy(); //destination - break; - } - CleanupStack::PopAndDestroy(); //destination - } - - iServerDetails.iSelection.iId = internetDestinationId; - - iServerDetails.iSelection.iResult=EDestination; - - - settingItem = new (ELeave) CServerSettingConnectionSettingItem( - aSettingId, iServerDetails.iSelection); - CleanupStack::PopAndDestroy(2); //destinationArray,cmManagerExt - - } - else - settingItem = new (ELeave) CServerSettingConnectionSettingItem( - aSettingId, iServerDetails.iSelection); + case EVpnUiSettingIap: + settingItem = new (ELeave) CServerSettingConnectionSettingItem( + aSettingId, iServerDetails.iSelection); break; default: // Do nothing break; } - + ***/ return settingItem; } @@ -157,54 +119,17 @@ { // Server settings view sets iServerIndex to -1 when creating a new // server + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. if ( iServerIndex >= 0 ) { - iLoader.VpnApiWrapperL().GetServerDetailsL( iServerDetails ); + iLoader.AcuApiWrapperL().GetServerDetailsL( + iServerIndex, iServerDetails ); UpdateTitleL( iServerDetails.iServerNameLocal ); } - ConstructFromResourceL(R_VPN_SERVER_SETTING_LIST); - CAknSettingItem* item = SettingItemArray()->At(EVpnUiSettingIap); - - using namespace CMManager; - - RCmManagerExt cmManagerExt; - cmManagerExt.OpenL(); - CleanupClosePushL( cmManagerExt ); - - //Makes sure that Internet Destination Exists - RArray destinationArray; - cmManagerExt.AllDestinationsL( destinationArray ); - CleanupClosePushL(destinationArray); - TBool internetIapExist=EFalse; - TUint32 internetDestinationId = 0; - for (TInt i = 0; i < destinationArray.Count(); ++i) - { - RCmDestinationExt destination = cmManagerExt.DestinationL( destinationArray[i] ); - CleanupClosePushL(destination); - - TUint32 purposeMetaData = destination.MetadataL( ESnapMetadataPurpose ); - if ( ESnapPurposeInternet == purposeMetaData ) - { - internetDestinationId = destinationArray[i]; - CleanupStack::PopAndDestroy(); //destination - internetIapExist=ETrue; - break; - } - CleanupStack::PopAndDestroy(); //destination - } - - if ( internetIapExist != EFalse) - { - HBufC* defaultConn = GetDestinationNameL(internetDestinationId); - CleanupStack::PushL(defaultConn); - item->SetEmptyItemTextL(*defaultConn); - item->LoadL(); - item->UpdateListBoxTextL(); - CleanupStack::PopAndDestroy(defaultConn); - } - - CleanupStack::PopAndDestroy(); //destinationArray - CleanupStack::PopAndDestroy(); //cmManagerExt + ***/ + ConstructFromResourceL(R_VPN_SERVER_SETTING_LIST); } @@ -218,6 +143,34 @@ } +// --------------------------------------------------------------------------- +// ServerNameExistsL +// --------------------------------------------------------------------------- +// +TBool CServerSettingsContainer::ServerNameExistsL( const TDesC& /* aText */) const + { + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. + const CArrayFix* serverList = iLoader.AcuApiWrapperL().ServerListL(); + TInt count = serverList->Count(); + + for (TInt i = 0; i < count; ++i) + { + //If we are editing name, we don't want to compare itself + if(i != iServerIndex) + { + if (serverList->At(i).iServerNameLocal.Compare(aText)==0) + { + //Name is already in use + return ETrue; + } + } + } ***/ + return EFalse; + } + + void CServerSettingsContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType) { switch(aEventType) @@ -238,25 +191,58 @@ // void CServerSettingsContainer::ChangeSettingValueL() { - + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. TInt currentItem( ListBox()->CurrentItemIndex() ); switch(currentItem) { case EVpnUiSettingServerName: { - EditItemL(EVpnUiSettingServerName, ETrue); - SettingItemArray()->At(EVpnUiSettingServerName)->StoreL(); - } + TBool alreadyInUse = ETrue; + while(alreadyInUse) + { + EditItemL(EVpnUiSettingServerName, ETrue); + SettingItemArray()->At(EVpnUiSettingServerName)->StoreL(); + alreadyInUse = ServerNameExistsL( iServerDetails.iServerNameLocal ); + if(alreadyInUse) + { + //Show an information note that server is currently in use + HBufC* noteText; + noteText = StringLoader::LoadLC( R_FLDR_NAME_ALREADY_USED, iServerDetails.iServerNameLocal ); + CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue); + note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec + note->ExecuteLD(noteText->Des()); + CleanupStack::PopAndDestroy(); // noteText + } + + } if (iServerDetails.iServerNameLocal.Length() > 0) - { - UpdateTitleL( iServerDetails.iServerNameLocal ); + { + UpdateTitleL( iServerDetails.iServerNameLocal ); + } } - break; case EVpnUiSettingServerAddress: { - EditItemL(EVpnUiSettingServerAddress, ETrue); + if( iServerDetails.iServerUrlReadOnly ) + { + //Show an information note that server cannot be + //modified + HBufC* noteText; + noteText = StringLoader::LoadLC( + R_VPN_INFO_CANNOT_MODIFY_SERVER_DEF ); + CAknInformationNote* note = + new(ELeave) CAknInformationNote(ETrue); + note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec + note->ExecuteLD(noteText->Des()); + CleanupStack::PopAndDestroy(); // noteText + } + else + { + EditItemL(EVpnUiSettingServerAddress, ETrue); + } } break; case EVpnUiSettingIap: @@ -267,12 +253,18 @@ default: User::Invariant(); break; - } + } ***/ } - -const TAgileProvisionApiServerSettings& CServerSettingsContainer::ServerDetailsL() +// --------------------------------------------------------------------------- +// ServerDetails +// --------------------------------------------------------------------------- +// +/*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. +const TAcuApiServerDetails& CServerSettingsContainer::ServerDetailsL() { StoreSettingsL(); if (iServerAddressBuffer.Length() > 0) @@ -289,6 +281,8 @@ //If the address is already in use as server name, generate //a new unique name. TUint16 i = 1; + do + { static const TInt KSuffixLength = 10; _LIT(KSuffixFormat, "(%d)"); @@ -313,15 +307,16 @@ TPtrC8 serverNameAddress = iServerDetails.iServerUrl.Left(numberOfCharactersCopiedFromAddress); iServerDetails.iServerNameLocal.Copy(serverNameAddress); iServerDetails.iServerNameLocal.Append(suffix); - + + }while(ServerNameExistsL( iServerDetails.iServerNameLocal) ); + CAknSettingItem* item = SettingItemArray()->At(EVpnUiSettingServerName); - item->LoadL(); item->UpdateListBoxTextL(); } return iServerDetails; } - +***/ // --------------------------------------------------------------------------- // GetIapNameL diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnmanagementuiserversettingsview.cpp --- a/vpnui/vpnmanagementui/src/vpnmanagementuiserversettingsview.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnmanagementuiserversettingsview.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -116,9 +116,11 @@ // Handles Softkey and Options list commands // --------------------------------------------------------- // -void CServerSettingsView::HandleCommandL( TInt aCommand) +void CServerSettingsView::HandleCommandL( TInt /* aCommand */) { - + /*** NSSM support is discontinued. + Code is kept in comments temporarily because similar UI functionality + might be needed for another purpose. TBool ffs(EFalse); switch ( aCommand ) { @@ -127,7 +129,7 @@ //GET CURRENT ADDRESS ASSERT( iContainer ); - const TAgileProvisionApiServerSettings& serverDetails = iContainer->ServerDetailsL(); + const TAcuApiServerDetails& serverDetails = iContainer->ServerDetailsL(); ffs = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 ); if (ffs) @@ -147,11 +149,20 @@ } else { - - int aResult = iLoader.VpnApiWrapperL().CreateServer(serverDetails); + TBool createServer = ETrue; + if(createServer) + { + //Creating a new VPN policy server + if( iContainer->ServerIndex() == -1) + { + int aResult = iLoader.AcuApiWrapperL().CreateServer(serverDetails); if (aResult == KErrNone) { - + //Update iServerList of CAcuApiWrapper + //After that we can call Synchronise server from + //CVpnManagementUiPolicyContainer::ActivateL() + + iLoader.AcuApiWrapperL().ServerListL(); iLoader.iNewServerDefinition = ETrue; } @@ -160,16 +171,23 @@ iLoader.iShowDefineQuery = EFalse; iLoader.iBackFromServerDefinition = ETrue; iLoader.iNewServerDefinition = EFalse; + createServer = EFalse; CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) ); errorUi->ShowGlobalErrorNoteL( aResult ); CleanupStack::PopAndDestroy(); // errorUi } - + } + //Editing an existing policy server + else + { + iLoader.AcuApiWrapperL().SaveServerDetails(serverDetails); + } } iLoader.ChangeViewL( KChangeViewPrevious ); - break; + } + break; } case EAknCmdExit: { @@ -196,7 +214,7 @@ AppUi()->HandleCommandL( aCommand ); break; } - } + } ***/ } // --------------------------------------------------------- diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnmanagementuiserverview.cpp --- a/vpnui/vpnmanagementui/src/vpnmanagementuiserverview.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnmanagementuiserverview.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -123,8 +123,6 @@ aMenuPane->SetItemDimmed( EVpnUiCmdSynchronise, ETrue ); aMenuPane->SetItemDimmed( EVpnUiCmdDeleteServer, ETrue ); } - else - aMenuPane->SetItemDimmed( EVpnUiCmdAddServer, ETrue ); } } @@ -185,7 +183,8 @@ ffsLow = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 ); if(!ffsLow) { - iServerContainer->SynchroniseServerL(); + iCurrentPosition = iServerContainer->iListBox->CurrentItemIndex(); + iServerContainer->SynchroniseServerL(iCurrentPosition); } break; } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnmanagementuiview.cpp --- a/vpnui/vpnmanagementui/src/vpnmanagementuiview.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnmanagementuiview.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -45,7 +45,6 @@ enum TVpnUiCommands { KVpnUiPolicyViewListItemId, - KVpnUiServerViewListItemId, KVpnUiLogViewListItemId }; @@ -72,8 +71,7 @@ AppUi()->RemoveFromViewStack(*this, iContainer); delete iContainer; } - delete iLoader; - delete iCaption; + delete iLoader; LOG_("CVpnManagementUiView::~CVpnManagementUiView() exited"); } @@ -114,12 +112,8 @@ LOG_("CVpnManagementUiView::ConstructL() entered"); iLoader = CVpnUiLoader::NewL(iAvkonViewAppUi->ClientRect(), KVpnManagementPluginUid, this ); - - iLoader->AddResourceFileL(); - BaseConstructL( R_VPNUI_MANAGEMENT_VIEW ); - iCaption = StringLoader::LoadL( R_VPN_MANAGEMENT_TITLE_BUF ); + BaseConstructL( R_VPNUI_MANAGEMENT_VIEW ); iLoader->ReleaseResource(); - LOG_("CVpnManagementUiView::ConstructL() exited"); } @@ -129,17 +123,9 @@ void CVpnManagementUiView::GetCaptionL( TDes& aCaption ) const { LOG_("CVpnManagementUiView::GetCaptionL() entered"); - - __ASSERT_DEBUG(iCaption != NULL, User::Invariant()); - - if (aCaption.MaxLength() < iCaption->Length()) - { - aCaption = iCaption->Left(aCaption.MaxLength()); - } - else - { - aCaption = *iCaption; - } + iLoader->AddResourceFileL(); + StringLoader::Load( aCaption, R_VPN_MANAGEMENT_TITLE_BUF ); + iLoader->ReleaseResource(); LOG_("CVpnManagementUiView::GetCaptionL() exited"); } @@ -165,8 +151,7 @@ { case EAknSoftkeyBack: { - iLoader->ChangeViewL( KChangeViewBack ); - iLoader->ReleaseResource(ETrue); + iLoader->ChangeViewL( KChangeViewBack ); break; } case EAknCmdExit: @@ -309,11 +294,13 @@ iLoader->ChangeViewL(KChangeViewPolicy); break; - + /*** NSSM support is discontinued. The code is left here in comments + because the server view might be used for another purpose in + future. case KVpnUiServerViewListItemId: iLoader->ChangeViewL(KChangeViewServer); break; - + ***/ case KVpnUiLogViewListItemId: iLoader->ChangeViewL(KChangeViewLog); @@ -326,11 +313,13 @@ } - -void CVpnManagementUiView::NotifySynchroniseServerCompleteL(TInt aResult) +// --------------------------------------------------------------------------- +// CVpnManagementUiView::NotifyPolicyImportComplete() +// --------------------------------------------------------------------------- +void CVpnManagementUiView::NotifyPolicyImportComplete(TInt aResult) { if ( aResult != KErrNone) - LOG_1("CVpnManagementUiView::NotifySynchroniseServerCompleteL:%d", aResult); + LOG_1("CVpnManagementUiView::NotifyPolicyImportComplete:%d", aResult); } // --------------------------------------------------------------------------- diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnmanagementui/src/vpnuiloader.cpp --- a/vpnui/vpnmanagementui/src/vpnuiloader.cpp Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnmanagementui/src/vpnuiloader.cpp Wed Oct 13 15:42:16 2010 +0300 @@ -28,7 +28,6 @@ #include #include #include -#include #include #include "vpnuiloader.h" #include "vpnmanagementuiview.h" @@ -71,7 +70,10 @@ { LOG_("CVpnUiLoader::~CVpnUiLoader()"); iVpnManagementUiView = NULL; - + + delete iVpnManagementUiParametersView; + delete iVpnManagementUiServerView; + if(iVersionInfoInNaviPane) { delete iVersionInfoInNaviPane; @@ -116,6 +118,7 @@ { LOG_("CVpnUiLoader::ConstructL() - begin"); + AddResourceFileL(); //Initialization iBackFromServerDefinition = EFalse; iNewServerDefinition = EFalse; @@ -130,8 +133,10 @@ iPreviousAppViewId = aViewId; CreateWindowL(); - - User::LeaveIfError( iVpnExtApi.Connect() ); + iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( + aRect, *this); + iVpnManagementUiParametersView = CServerSettingsView::NewL( aRect, *this); + SetRect(aRect); LOG(Log::Printf(_L("CVpnUiLoader::ConstructL() - end\n"))); @@ -181,14 +186,12 @@ break; } case KChangeViewBack: - ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId); + ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId); iPolicyViewVisited = EFalse; ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiLogViewId); iLogViewVisited = EFalse; ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiParametersViewId); - iServerSettingsViewVisited = EFalse; ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiServerViewId); - iServerViewVisited = EFalse; ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( iGsViewId.iViewUid ); if(iObserver) { @@ -226,13 +229,8 @@ localCurrentViewId ); iPreviousViewId = localCurrentViewId.iViewUid; - if ( iServerViewVisited == EFalse) - { - TRect rect; - iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( rect, *this); - ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView); - } - iServerViewVisited = ETrue; + + ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView); ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( KVpnManagementUiServerViewId ); break; @@ -267,14 +265,8 @@ localCurrentViewId ); iPreviousViewId = localCurrentViewId.iViewUid; - //Put selected server to CustomMessageId - if ( iServerSettingsViewVisited == EFalse) - { - TRect rect; - iVpnManagementUiParametersView = CServerSettingsView::NewL( rect, *this); - ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView); - } - iServerSettingsViewVisited = ETrue; + //Put selected server to CustomMessageId + ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView); ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( KVpnManagementUiParametersViewId, TUid::Uid( aSelectionIndex), KNullDesC8 ); @@ -453,11 +445,6 @@ TVwsViewId activeViewId; ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(activeViewId); ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(activeViewId.iViewUid); - - if ( !iShowWaitNote ) - { - iVpnApiWrapper->CancelSynchronise( ); - } } // --------------------------------------------------------- @@ -467,6 +454,7 @@ void CVpnUiLoader::ShowWaitNoteL() { // Initialization (before the progress dialog is shown) + iTextToShow = EConnectingVia; // "Connecting via '%U'" iWaitNoteStartTime.UniversalTime(); if ( iWaitDialog ) @@ -497,18 +485,40 @@ delete iWaitDialog; } iWaitDialog = NULL; - iShowWaitNote = EFalse; } void CVpnUiLoader::SetTextL() { LOG(Log::Printf(_L("CVpnUiLoader::SetTextL()\n"))); - - HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_IMPORTING_POLICY ); + TTime now; + now.UniversalTime(); + + TTimeIntervalSeconds secondsPassed; + now.SecondsFrom(iWaitNoteStartTime, secondsPassed); + + if (secondsPassed.Int() < KSecondsToShowConnectingVia) + { + iTextToShow = EConnectingVia; //0 + } + else + { + iTextToShow = EProcessingStepN; //1 + iStateCodeToShow = 0; + } + + if (iTextToShow == EConnectingVia) + { + HBufC* string = StringLoader::LoadLC( R_VPN_CONNECTING_VIA_AP, iSelectionName ); iWaitDialog->SetTextL( *string ); CleanupStack::PopAndDestroy( string ); - + } + else + { + HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_POLICY_DL_PROCESSING, iStateCodeToShow ); + iWaitDialog->SetTextL( *string ); + CleanupStack::PopAndDestroy( string ); + } } diff -r 29c8f9bc68e1 -r 5960d2d03390 vpnui/vpnpolicyrecognizer/rom/vpnpolicyrecognizer.iby --- a/vpnui/vpnpolicyrecognizer/rom/vpnpolicyrecognizer.iby Wed Sep 15 13:20:54 2010 +0300 +++ b/vpnui/vpnpolicyrecognizer/rom/vpnpolicyrecognizer.iby Wed Oct 13 15:42:16 2010 +0300 @@ -22,9 +22,13 @@ #ifdef FF_VPN_CLIENT +#ifndef FF_GENERIC_ACCESS_NETWORK // UMA not supported + ECOM_PLUGIN(vpnpolicyrecognizer.dll,vpnpolicyrecognizer.rsc) data=ZRESOURCE\plugins\vpnpolicyrecognizer.rsc RESOURCE_FILES_DIR\plugins\vpnpolicyrecognizer.rsc #endif +#endif // FF_VPN_CLIENT + #endif // __VPNPOLICYRECOGNIZER_IBY__