Revision: 201031 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:54:34 +0300
branchRCL_3
changeset 38 9f4e37332ce5
parent 32 352850cbed81
child 40 473321461bba
Revision: 201031 Kit: 201033
group/bld.inf
group/update_version_h.pl
help/group/bld.inf
rom/ipsecvpn.iby
vpnclient_sis/group/nokia_vpn_client_localised_armv5_udeb.pkg
vpnclient_sis/group/nokia_vpn_client_localised_armv5_urel.pkg
vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg
vpnengine/agileprovisionws/.cproject
vpnengine/agileprovisionws/.project
vpnengine/agileprovisionws/BWINS/agileprovisionwsu.def
vpnengine/agileprovisionws/EABI/agileprovisionwsu.def
vpnengine/agileprovisionws/group/ABLD.BAT
vpnengine/agileprovisionws/group/agileprovisionws.mmp
vpnengine/agileprovisionws/group/bld.inf
vpnengine/agileprovisionws/inc/agilecrypto.h
vpnengine/agileprovisionws/inc/agileprovisiondefs.h
vpnengine/agileprovisionws/inc/agileprovisionservice.h
vpnengine/agileprovisionws/inc/agileprovisionws.h
vpnengine/agileprovisionws/rom/agileprovisionws.iby
vpnengine/agileprovisionws/src/agilecrypto.cpp
vpnengine/agileprovisionws/src/agileprovisionservice.cpp
vpnengine/agileprovisionws/src/agileprovisionws.cpp
vpnengine/dmadpki/src/DmAdRtNodeData.cpp
vpnengine/dmadpki/src/DmAdStore.cpp
vpnengine/ikepolparser/inc/ikepolparser.h
vpnengine/ikepolparser/src/ikepolparser.cpp
vpnengine/ikeutils/bwins/ikeutilsu.def
vpnengine/ikeutils/eabi/ikeutilsu.def
vpnengine/ikeutils/group/ikeutils.mmp
vpnengine/ikeutils/inc/cmutils.h
vpnengine/ikeutils/src/cmutils.cpp
vpnengine/ikev1lib/group/ikev1lib.mmp
vpnengine/ikev1lib/inc/credentialcache.h
vpnengine/ikev1lib/inc/ikev1crack.h
vpnengine/ikev1lib/inc/ikev1dialog.h
vpnengine/ikev1lib/inc/ikev1negotiation.h
vpnengine/ikev1lib/inc/ikev1trans.h
vpnengine/ikev1lib/src/credentialcache.cpp
vpnengine/ikev1lib/src/ikev1crack.cpp
vpnengine/ikev1lib/src/ikev1dialog.cpp
vpnengine/ikev1lib/src/ikev1negotiation.cpp
vpnengine/ikev1lib/src/ikev1pluginsession.cpp
vpnengine/ikev1lib/src/ikev1trans.cpp
vpnengine/pkiservice/inc/mapdescriptor.h
vpnengine/pkiservice/inc/pkisupport.h
vpnengine/pkiservice/inc/pkiwrapper.h
vpnengine/pkiservice/src/mapdescriptor.cpp
vpnengine/pkiservice/src/pkimapper.cpp
vpnengine/pkiservice/src/pkisession.cpp
vpnengine/pkiservice/src/pkisupport.cpp
vpnengine/pkiservice/src/pkiwrapper.cpp
vpnengine/pkiserviceapi/src/pkiserviceapi.cpp
vpnengine/sit/EABI/eventmedsitU.DEF
vpnengine/sit/bwins/EVENTMEDSITU.DEF
vpnengine/sit/group/sit.mmp
vpnengine/sit/inc/eventlogger.h
vpnengine/sit/inc/extender.h
vpnengine/sit/inc/extenderhelper.h
vpnengine/sit/src/eventlogger.cpp
vpnengine/sit/src/extender.cpp
vpnengine/sit/src/extenderhelper.cpp
vpnengine/vpnextapi/.cproject
vpnengine/vpnextapi/.project
vpnengine/vpnextapi/bwins/vpnextapiu.def
vpnengine/vpnextapi/eabi/vpnextapiu.def
vpnengine/vpnextapi/group/ABLD.BAT
vpnengine/vpnextapi/group/bld.inf
vpnengine/vpnextapi/group/vpnextapi.mmp
vpnengine/vpnextapi/inc/vpnextapi.h
vpnengine/vpnextapi/inc/vpnextapiservantdefs.h
vpnengine/vpnextapi/rom/vpnextapi.iby
vpnengine/vpnextapi/src/vpnextapi.cpp
vpnengine/vpnmanager/group/vpnmanager.mmp
vpnengine/vpnmanager/group/vpnmanager_test.mmp
vpnengine/vpnmanager/inc/cmmanagerutils.h
vpnengine/vpnmanager/inc/policyimporter.h
vpnengine/vpnmanager/inc/vpnapiservant.h
vpnengine/vpnmanager/inc/vpnmanagerserverdefs.h
vpnengine/vpnmanager/src/cmmanagerutils.cpp
vpnengine/vpnmanager/src/fileutil.cpp
vpnengine/vpnmanager/src/policyimporter.cpp
vpnengine/vpnmanager/src/vpnapiservant.cpp
vpnengine/vpnmanager/src/vpnmanagerserver.cpp
vpnui/vpnmanagementui/data/vpnmanagementuirsc.rss
vpnui/vpnmanagementui/group/vpnmanagementui.mmp
vpnui/vpnmanagementui/inc/vpnapiwrapper.h
vpnui/vpnmanagementui/inc/vpnmanagementuipolicycontainer.h
vpnui/vpnmanagementui/inc/vpnmanagementuiservercontainer.h
vpnui/vpnmanagementui/inc/vpnmanagementuiserversettingscontainer.h
vpnui/vpnmanagementui/inc/vpnmanagementuiview.h
vpnui/vpnmanagementui/inc/vpnuiloader.h
vpnui/vpnmanagementui/loc/vpnmanagementui.loc
vpnui/vpnmanagementui/src/vpnapiwrapper.cpp
vpnui/vpnmanagementui/src/vpnmanagementuicontainer.cpp
vpnui/vpnmanagementui/src/vpnmanagementuipolicycontainer.cpp
vpnui/vpnmanagementui/src/vpnmanagementuipolicyview.cpp
vpnui/vpnmanagementui/src/vpnmanagementuiservercontainer.cpp
vpnui/vpnmanagementui/src/vpnmanagementuiserversettingscontainer.cpp
vpnui/vpnmanagementui/src/vpnmanagementuiserversettingsview.cpp
vpnui/vpnmanagementui/src/vpnmanagementuiserverview.cpp
vpnui/vpnmanagementui/src/vpnmanagementuiview.cpp
vpnui/vpnmanagementui/src/vpnuiloader.cpp
vpnui/vpnpolicyrecognizer/rom/vpnpolicyrecognizer.iby
--- a/group/bld.inf	Mon Jun 21 16:49:56 2010 +0300
+++ b/group/bld.inf	Thu Aug 19 10:54:34 2010 +0300
@@ -46,8 +46,9 @@
 ../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)
@@ -78,7 +79,8 @@
 
 #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"
--- a/group/update_version_h.pl	Mon Jun 21 16:49:56 2010 +0300
+++ b/group/update_version_h.pl	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-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"
@@ -72,14 +72,9 @@
 }
 
 
-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;
--- a/help/group/bld.inf	Mon Jun 21 16:49:56 2010 +0300
+++ b/help/group/bld.inf	Thu Aug 19 10:54:34 2010 +0300
@@ -24,6 +24,4 @@
 
 ../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
--- a/rom/ipsecvpn.iby	Mon Jun 21 16:49:56 2010 +0300
+++ b/rom/ipsecvpn.iby	Thu Aug 19 10:54:34 2010 +0300
@@ -22,13 +22,9 @@
 
 #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__
--- a/vpnclient_sis/group/nokia_vpn_client_localised_armv5_udeb.pkg	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnclient_sis/group/nokia_vpn_client_localised_armv5_udeb.pkg	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 ;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; Copyright (c) 2009-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"
@@ -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
+&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
 
 ; INSTALLATION HEADER 
 ; UID of acuagentcrypto
@@ -68,6 +68,7 @@
   "Nokia VPN client",
   "Nokia VPN",
   "Nokia VPN",
+  "Nokia VPN",
   "Nokia VPN"},
 (0x101F5147),32,08,0124, TYPE=SA, RU
 
@@ -120,6 +121,7 @@
 "Series60ProductID",
 "Series60ProductID",
 "Series60ProductID",
+"Series60ProductID",
 "Series60ProductID"}
 
 ; Product / platform version compatibility - S60 5.2
@@ -171,6 +173,7 @@
 "Series60ProductID",
 "Series60ProductID",
 "Series60ProductID",
+"Series60ProductID",
 "Series60ProductID"}
 
 ; List of localised vendor names - one per language.
@@ -221,6 +224,7 @@
 "Nokia",
 "Nokia",
 "Nokia",
+"Nokia",
 "Nokia"}
 
 ; The non-localised, globally unique vendor name (mandatory)
@@ -267,6 +271,11 @@
 "\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"
@@ -326,64 +335,13 @@
 "\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"
@@ -468,13 +426,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"
 
-; During installation check languages that HW supports 
-; and install resources only for them.
+; Install only languages that device supports
 ; EN - 01 - English  
 IF EXISTS ("z:\resource\avkon.r01")
 "\epoc32\data\z\resource\vpnecomnotifier.r01"-"!:\resource\vpnecomnotifier.r01"
@@ -715,49 +673,41 @@
 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
--- a/vpnclient_sis/group/nokia_vpn_client_localised_armv5_urel.pkg	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnclient_sis/group/nokia_vpn_client_localised_armv5_urel.pkg	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 ;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; Copyright (c) 2009-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"
@@ -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
+&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
 
 ; INSTALLATION HEADER 
 ; UID of acuagentcrypto
@@ -68,6 +68,7 @@
   "Nokia VPN client",
   "Nokia VPN",
   "Nokia VPN",
+  "Nokia VPN",
   "Nokia VPN"},
 (0x101F5147),32,08,0124, TYPE=SA, RU
 
@@ -120,6 +121,7 @@
 "Series60ProductID",
 "Series60ProductID",
 "Series60ProductID",
+"Series60ProductID",
 "Series60ProductID"}
 
 ; Product / platform version compatibility - S60 5.2
@@ -171,6 +173,7 @@
 "Series60ProductID",
 "Series60ProductID",
 "Series60ProductID",
+"Series60ProductID",
 "Series60ProductID"}
 
 ; List of localised vendor names - one per language.
@@ -221,6 +224,7 @@
 "Nokia",
 "Nokia",
 "Nokia",
+"Nokia",
 "Nokia"}
 
 ; The non-localised, globally unique vendor name (mandatory)
@@ -267,6 +271,11 @@
 "\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"
@@ -326,84 +335,35 @@
 "\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)
@@ -466,12 +426,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\urel\utlxml.dll"-"!:\sys\bin\utlxml.dll"
 
-; Install only languages that HW supports
+; Install only languages that device supports
 ; EN - 01 - English  
 IF EXISTS ("z:\resource\avkon.r01")
 "\epoc32\data\z\resource\vpnecomnotifier.r01"-"!:\resource\vpnecomnotifier.r01"
@@ -712,51 +673,41 @@
 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
--- a/vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg	Thu Aug 19 10:54:34 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
+&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
 
 ; INSTALLATION HEADER 
 ; UID of acuagentcrypto
@@ -67,6 +67,7 @@
   "Nokia VPN client",
   "Nokia VPN",
   "Nokia VPN",
+  "Nokia VPN",
   "Nokia VPN"},
 (0x101F5147),32,08,0124, TYPE=SA, RU
 
@@ -119,6 +120,7 @@
 "Series60ProductID",
 "Series60ProductID",
 "Series60ProductID",
+"Series60ProductID",
 "Series60ProductID"}
 
 ; Product / platform version compatibility - S60 5.2
@@ -170,6 +172,7 @@
 "Series60ProductID",
 "Series60ProductID",
 "Series60ProductID",
+"Series60ProductID",
 "Series60ProductID"}
 
 ; List of localised vendor names - one per language.
@@ -220,6 +223,7 @@
 "Nokia",
 "Nokia",
 "Nokia",
+"Nokia",
 "Nokia"}
 
 ; The non-localised, globally unique vendor name (mandatory)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/.cproject	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="2" extraSBSv2Args="" infBuildComponents="" infFileLocation="group\bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="false" promptForMMPChangedAction="false" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="Emulator Debug (WINSCW) [s60_92]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [s60_92]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [s60_92]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="P:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="P:\vpnclient\vpnengine\agileprovisionws\group\bld.inf;P:\vpnclient\vpnengine\agileprovisionws\group\agileprovisionws.mmp;" includesCache="P:/vpnclient/vpnengine/agileprovisionws/inc[LOCAL];P:/vpnclient/vpnengine/utlbase64/inc[LOCAL];P:/vpnclient/vpnengine/utlcrypto/inc[LOCAL];P:/vpnclient/vpnengine/vpnmanager/inc[LOCAL];P:/vpnclient/vpnengine/pkiserviceapi/inc[LOCAL];P:/vpnclient/vpnengine/vpncommon/inc[LOCAL];P:/vpnclient/vpnui/vpnpolins/inc[LOCAL];P:/epoc32/include;P:/epoc32/include/mw;P:/epoc32/include/platform/mw;P:/epoc32/include/platform;P:/epoc32/include/platform/loc;P:/epoc32/include/platform/mw/loc;P:/epoc32/include/platform/loc/sc;P:/epoc32/include/platform/mw/loc/sc;P:/epoc32/include/oem;" macrosCache="__DLL__;__S60_51__;_UNICODE;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__S60_3X__;__SERIES60_3X__;__S60_5X__;__CW32__;__WINS__;__WINSCW__;_DEBUG;" moduleId="configDataCache" sourcesCache="/agileprovisionws/inc;/agileprovisionws/src;" timestampCache="1278588933449" useMmpMacrosCache="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/.project	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>agileprovisionws</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.core.ccnature</nature>
+		<nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
+		<nature>com.nokia.carbide.cdt.builder.carbideSBSv2BuilderNature</nature>
+	</natures>
+</projectDescription>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/BWINS/agileprovisionwsu.def	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,21 @@
+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 *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/EABI/agileprovisionwsu.def	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,29 @@
+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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/group/ABLD.BAT	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,15 @@
+@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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/group/agileprovisionws.mmp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/group/bld.inf	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/inc/agilecrypto.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/inc/agileprovisiondefs.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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 <e32base.h>
+
+
+_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, "<xdb:GetConf xmlns:xdb=\"");
+_LIT8(KCertificatRequestPrefix, "<xdb:GetCertificate xmlns:xdb=\"");
+_LIT8 (KSoapActionGetPolicySuffix, "/GetConf");
+_LIT8 (KSoapActionGetCertificateSuffix, "/GetCertificate");
+_LIT(KPolFileExtension, ".pol");
+
+_LIT8(KSoapAction, "http://vpn.agileprovision/GetConf");
+_LIT8(KRequest, "<xdb:GetConf xmlns:xdb=\"http://vpn.agileprovision\"/>");
+
+_LIT8(KSoapActionCert, "http://vpn.agileprovision/GetCertificate");
+
+_LIT8(KRequest1, "<xdb:GetCertificate xmlns:xdb=\"http://vpn.agileprovision\"><xdb:certreq>");
+_LIT8(KRequest2, "</xdb:certreq></xdb:GetCertificate>");
+
+
+#endif  // __VPNAGILEPROVISIONDEFS_H__
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/inc/agileprovisionservice.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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 <e32base.h>
+#include <base64.h>
+#include <MSenServiceConsumer.h>
+#include <SenServiceConnection.h>
+#include <SenSoapFault.h>
+
+ 
+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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/inc/agileprovisionws.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* 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 <e32base.h>
+#include <MSenServiceConsumer.h>
+#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<CSenElement>& 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/rom/agileprovisionws.iby	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* 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__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/src/agilecrypto.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,317 @@
+/*
+* 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 <x509cert.h>
+
+#include <x500dn.h>
+#include <random.h>
+#include <signed.h>
+
+#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<TUid> 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();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/src/agileprovisionservice.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* 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 <SenXmlServiceDescription.h>
+#include <SenSoapMessage.h>
+#include <SenHttpTransportProperties.h>
+#include <e32debug.h>
+#include <cmmanagerext.h>
+#include <cmdestinationext.h>
+#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<TUint32> 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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/agileprovisionws/src/agileprovisionws.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,378 @@
+/*
+* 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 <SenXmlServiceDescription.h>
+#include <SenServiceConnection.h>
+#include <SenServiceManager.h>
+#include <SenIdentityProvider.h>
+#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<CSenElement>& 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<CSenElement>& 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<CSenElement>& aArray, 
+                                                       TInt aContentType,TInt aLevel, TDesC& aFileName )
+    {
+
+    TInt size = aArray.Count();
+    for(TInt i=0; i<size; i++)
+        {
+        //get an element
+        CSenElement* pElement = aArray[i];
+        if ( pElement->HasContent() )
+            {
+            //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<CSenElement>& 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 );
+        }
+    }
--- a/vpnengine/dmadpki/src/DmAdRtNodeData.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/dmadpki/src/DmAdRtNodeData.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2000-2008 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -644,7 +644,7 @@
         TUid uid = { TDmAdUtil::DesToInt(attribute) };
         DEBUG_LOG1(_L("Uid: 0x%x"), uid.iUid);
         
-        aApplicabilityList.Append(uid);
+        aApplicabilityList.AppendL(uid);
         parser->NextL();
         
         while (parser->State() == CXmlPullParser::EStateText)
--- a/vpnengine/dmadpki/src/DmAdStore.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/dmadpki/src/DmAdStore.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -40,6 +40,7 @@
     TRACE("CDmAdStore::ConstructL");
             
     TInt status = iPkiServiceApi.Connect();
+    iPkiServiceApi.SetInformational(ETrue);
     DEBUG_LOG1(_L("Connect status: %d"), status);
     User::LeaveIfError(status);    
     iCert = CDmAdCert::NewL(iPkiServiceApi);
--- a/vpnengine/ikepolparser/inc/ikepolparser.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikepolparser/inc/ikepolparser.h	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1999-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"
@@ -15,8 +15,6 @@
 *
 */
 
-
-
 #ifndef __IKEPOLPARSER_H
 #define __IKEPOLPARSER_H
 
@@ -291,7 +289,7 @@
     TOwnCertInfo iOwnCert;
     TCertInfo iPrivKey;
     TCertInfo iPeerCert;
-
+    TBool     iUseCache;  // Use credential cache
 };
 
 
--- a/vpnengine/ikepolparser/src/ikepolparser.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikepolparser/src/ikepolparser.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1999-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"
@@ -169,6 +169,8 @@
             CleanupStack::Pop(ca_copy);
             }
         }
+        
+    iUseCache = aData->iUseCache;
     }
 
 void CIkeData::Empty()
@@ -725,6 +727,13 @@
         //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;
+        }
     }
 	if ( err == KErrNone )
 		errCA=CheckPolicy(aConf);
@@ -1105,6 +1114,16 @@
     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;
+
     if ( aConf->iCRACKLAMUserName )
 	{
 		line.Copy(_L8("CRACK_LAM_USERNAME: "));
--- a/vpnengine/ikeutils/bwins/ikeutilsu.def	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikeutils/bwins/ikeutilsu.def	Thu Aug 19 10:54:34 2010 +0300
@@ -28,4 +28,5 @@
 	?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> &)
 
--- a/vpnengine/ikeutils/eabi/ikeutilsu.def	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikeutils/eabi/ikeutilsu.def	Thu Aug 19 10:54:34 2010 +0300
@@ -46,4 +46,5 @@
 	_ZTV19TPfkeySupportedAuth @ 45 NONAME
 	_ZTV20CIpsecSaSpiRetriever @ 46 NONAME
 	_ZTV22TPfkeySupportedEncrypt @ 47 NONAME
+	_ZN7CmUtils12GetPolicyIdLEmR4TBufILi50EE @ 48 NONAME
 
--- a/vpnengine/ikeutils/group/ikeutils.mmp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikeutils/group/ikeutils.mmp	Thu Aug 19 10:54:34 2010 +0300
@@ -35,6 +35,7 @@
 SOURCE          pfkeymsg.cpp
 SOURCE          pfkeysocketif.cpp
 SOURCE          vpnaddrinfo.cpp
+SOURCE          cmutils.cpp
 
 USERINCLUDE     .
 USERINCLUDE     ../inc
@@ -49,5 +50,6 @@
 LIBRARY         ipsecpolapi.lib
 LIBRARY         lib_pfkey.lib
 LIBRARY         random.lib
+LIBRARY         cmmanager.lib
 
 CAPABILITY ALL -Tcb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/ikeutils/inc/cmutils.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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 <e32base.h>
+#include <vpnapidefs.h>
+
+
+/**
+ * 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/ikeutils/src/cmutils.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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 <cmmanager.h>
+#include <cmconnectionmethod.h>
+#include <cmpluginvpndef.h>
+
+#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
+}
+
+
+/***/
--- a/vpnengine/ikev1lib/group/ikev1lib.mmp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/group/ikev1lib.mmp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -11,12 +11,10 @@
 *
 * Contributors:
 *
-* Description:   Project definition file for project ikev1lib
+* Description:  Project definition file for project ikev1lib
 *
 */
 
-
-
 #include <platform_paths.hrh>
 
 TARGET          ikev1lib.dll
@@ -46,6 +44,7 @@
 SOURCE          ikev1trans.cpp
 SOURCE          ikev1isakmpstream.cpp    
 SOURCE          ikev1nokianattkeepalive.cpp
+SOURCE          credentialcache.cpp
 
 USERINCLUDE    ../inc
 USERINCLUDE    ../../ikesocket/inc
@@ -73,5 +72,3 @@
 LIBRARY     ikesocket.lib
 LIBRARY     random.lib
 LIBRARY     ikeutils.lib
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/ikev1lib/inc/credentialcache.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* 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 <e32base.h>
+#include <vpnapidefs.h>
+
+
+class MIkeDebug;
+
+
+const TInt KCredentialMaxLen = 64;
+
+
+/**
+ * Cache buffer stored to file.
+ */
+struct TCacheBuffer{
+  TVpnPolicyId             iId;
+  TBuf8<KCredentialMaxLen> iUser;
+  TBuf8<KCredentialMaxLen> 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
--- a/vpnengine/ikev1lib/inc/ikev1crack.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/inc/ikev1crack.h	Thu Aug 19 10:54:34 2010 +0300
@@ -58,28 +58,39 @@
 class CIkev1PluginSession;
 class MIkeDebug;
 
-class CAuthDialogInfo : public CBase
+
+NONSHARABLE_CLASS(CAuthDialogInfo) : public CBase
     {
 public:
     CAuthDialogInfo(CIkev1PluginSession* aPluginSession, TUint32 aObjId, TUint32 aSAId, TUint32 aMsgId)
                     { iPluginSession = aPluginSession; iSAId = aSAId; iObjId  = aObjId; iMsgId  = aMsgId; }
-    ~CAuthDialogInfo() {iObjId = 0;}    
+    ~CAuthDialogInfo();  
     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: 
-//  Credentials data get from user with asynchronous dialog 
-	HBufC8     *iUsername;     
-    HBufC8     *iSecret;
-    HBufC8     *iDomain;    
+    /**
+     * Username from UI dialog or cache.
+     * Own.
+     */
+	HBufC8* iUsername;
+	
+	/**
+     * Secret from UI dialog or cache.
+     * Own.
+     */    
+    HBufC8* iSecret;
     };
 
 
@@ -92,9 +103,8 @@
     TInt   ExecuteCRACKMsgL(const ThdrISAKMP &aHdr);
     TInt   ProcessUserResponseL(CAuthDialogInfo *aUserInfo);
     TInt   CrackAuthenticationFailedL(const TNotificationISAKMP *aNotifPayload);
-	
-	TInt   DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain);
-	
+
+	TInt DialogCompleteL(TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret);
     
 private:
     TInt    GetDataL(HBufC8* aChallenge);
@@ -117,7 +127,7 @@
 
 	HBufC8           *iUserName;    // Saved for User name caching 	
 	HBufC8           *iDomain;      // Fixed domain value for this CRACK negotiation
-	
+
 	MIkeDebug& iDebug;
 };
 
--- a/vpnengine/ikev1lib/inc/ikev1dialog.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/inc/ikev1dialog.h	Thu Aug 19 10:54:34 2010 +0300
@@ -28,6 +28,7 @@
 class RFs;
 class MIkeDebug;
 
+
 /** 
 * IKE dialog complete
 * @internalComponent
@@ -38,13 +39,12 @@
 		/** 
          * IKE dialog completed 
          * @internalComponent
-         * 
          */
-		virtual TInt DialogCompleteL(CIkev1Dialog* aDialog, TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain)=0; 
+		virtual TInt DialogCompleteL(
+		    TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret) = 0;
 };
 
 
-
 NONSHARABLE_CLASS(CDialogTimeout) : public CTimer
 {
 public:
--- a/vpnengine/ikev1lib/inc/ikev1negotiation.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/inc/ikev1negotiation.h	Thu Aug 19 10:54:34 2010 +0300
@@ -177,10 +177,9 @@
                              TInt aStatus, 
                              TUint32 aSpi);	
     
-    TInt   ProcessUserResponseL(CAuthDialogInfo *aUserInfo);
-    TInt   DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain);
+    TInt ProcessUserResponseL(CAuthDialogInfo *aUserInfo);
+    TInt DialogCompleteL(TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret);
 
-	
 private:
 
     CIkev1Negotiation( CIkev1PluginSession* aPluginSession,
--- a/vpnengine/ikev1lib/inc/ikev1trans.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/inc/ikev1trans.h	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -63,6 +63,8 @@
 class TIkev1IsakmpStream;
 class MIkeDebug;
 class TInetAddr;
+class CCredentialCache;
+
 
 /**--------------------------------------------------------------------------
  *
@@ -100,8 +102,7 @@
     static TUint16 GetAuthMethod(TUint16 aAuthMethod, TBool aXauthUsed, TInt aRole);
     static void BuildXauthVendorId(TIkev1IsakmpStream &aMsg);
 
-	TInt DialogCompleteL(CIkev1Dialog* aDialog, TAny* aUserInfo, HBufC8* aUsername,
-	                     HBufC8* aSecret, HBufC8* aDomain);	
+	TInt DialogCompleteL(TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret);
 	TInt BuildConfigRequestL();
     
 private:
@@ -128,7 +129,8 @@
                        CIkev1PluginSession* aPluginSession,
                        CIkev1Negotiation* aNegotiation,
                        MIkeDebug& aDebug );
-    void ConstructL(); 
+    void ConstructL();
+    void GetCredentialsL();
 
 private:
     CIkev1PluginSession* iPluginSession;
@@ -145,9 +147,13 @@
     TUint32 iRequestFlags;
     TBool   iXauthCompleted;
     TBool   iCfgModeCompleted;
-	TBool   iUseOlderPIXXauth;     // use draft-ietf-ipsec-isakmp-xauth-04.txt  
-                                   
-    TLastIKEMsg iLastTransMsgInfo;    
+	TBool   iUseOlderPIXXauth;     // use draft-ietf-ipsec-isakmp-xauth-04.txt
+	TInt    iCredentialType; 
+
+    TLastIKEMsg iLastTransMsgInfo;
+    
+    CCredentialCache* iCache;
+
     MIkeDebug& iDebug;
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/ikev1lib/src/credentialcache.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,260 @@
+ /*
+* 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 <f32file.h>
+
+#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;
+}
+
+
+/***/
--- a/vpnengine/ikev1lib/src/ikev1crack.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/src/ikev1crack.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -26,6 +26,27 @@
 #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
 //
@@ -518,8 +539,8 @@
 //
 // The implementation for class MIkeDialogComplete virtual function
 //
-TInt CIKECRACKNegotiation::DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo,
-                                            HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain)
+TInt CIKECRACKNegotiation::DialogCompleteL(
+    TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret)
 {
 /*---------------------------------------------------------------------------
  *  
@@ -541,14 +562,11 @@
 	   DEBUG_LOG1(_L("Preparing to call AuthDialogCompletedL(), ObjId = %x"), obj_id);
        if ( obj_id == DIALOG_INFO_ID )
 	   {
-          info->iUsername = aUsername;
-          info->iSecret   = aSecret;
-          info->iDomain   = aDomain;
+          info->SetUserName( aUsername );
+          info->SetSecret( aSecret );
           obj_id = info->PluginSession()->AuthDialogCompletedL(info);
-       }   
+       }
     }
 
     return obj_id;
 }
-
-
--- a/vpnengine/ikev1lib/src/ikev1dialog.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/src/ikev1dialog.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -189,12 +189,9 @@
     if ( iCallback )
 	{
 		TInt err;
-		TRAP(err, delete_obj = iCallback->DialogCompleteL(this, iUserInfo,
-								                          un_bfr,               //User name
-			                                              pw_bfr,               //Password
-			                                              NULL));               //domain
-	    delete un_bfr; 
-	    delete pw_bfr;
+		TRAP(err, delete_obj = iCallback->DialogCompleteL(
+		    iUserInfo, un_bfr, pw_bfr));
+	    
 	    if ( err != KErrNone )
 		  delete_obj = 1;
     }
@@ -607,11 +604,9 @@
     {
 		TInt err;
 		DEBUG_LOG2(_L("Calling DialogCompleteL(), UserInfo = %x, Callback = %x"), (TUint32)iDialog->UserInfo(), (TUint32)Callback);					
-        TRAP(err, delete_dialog = Callback->DialogCompleteL(iDialog,
-                                                            iDialog->UserInfo(),
-                                                            NULL,               //User name
-                                                            NULL,               //Password
-                                                            NULL));             //domain
+        TRAP(err, delete_dialog = Callback->DialogCompleteL(
+            iDialog->UserInfo(), NULL, NULL));
+
 		DEBUG_LOG2(_L("DialogCompleteL() completed, err = %d, delete_dialog = %d"), err, delete_dialog);			
 		if ( err != KErrNone )
 			delete_dialog = 1;
--- a/vpnengine/ikev1lib/src/ikev1negotiation.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/src/ikev1negotiation.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -8409,11 +8409,12 @@
     return KErrNone;
 
 }
+
 //
 // The implementation for class MIkeDialogComplete virtual function
 //
-TInt CIkev1Negotiation::DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo,
-                                            HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain)
+TInt CIkev1Negotiation::DialogCompleteL(
+    TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret)
 {
 /*---------------------------------------------------------------------------
  *  
@@ -8424,24 +8425,20 @@
  *  
  *-------------------------------------------------------------------------*/
     TUint32 obj_id = 1;
-     CAuthDialogInfo* info = (CAuthDialogInfo*)aUserInfo;
-     DEBUG_LOG1(_L("CIkev1Negotiation::DialogCompleteL(), aUserInfo =  %x"), aUserInfo);
+    CAuthDialogInfo* info = (CAuthDialogInfo*)aUserInfo;
+    DEBUG_LOG1(_L("CIkev1Negotiation::DialogCompleteL(), aUserInfo =  %x"), aUserInfo);
              
-     if ( info )
-     {
+    if ( info )
+    {
         obj_id = info->GetObjId();
         DEBUG_LOG1(_L("Preparing to call AuthDialogCompletedL(), ObjId = %x"), obj_id);
         if ( obj_id == DIALOG_INFO_ID )
         {
-           info->iUsername = aUsername;
-           info->iSecret   = aSecret;
-           info->iDomain   = aDomain;
-           obj_id = info->PluginSession()->AuthDialogCompletedL(info);
+            info->SetUserName(aUsername);
+            info->SetSecret(aSecret);
+            obj_id = info->PluginSession()->AuthDialogCompletedL(info);
         }   
-     }
-
-     return obj_id;
-    
-}
-
-
+    }
+
+    return obj_id;
+}
--- a/vpnengine/ikev1lib/src/ikev1pluginsession.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/src/ikev1pluginsession.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1536,7 +1536,7 @@
                                                     aDestAddr,
                                                     aLocalPort,
                                                     aDscp );
-        iSendQueue.Append( item );                
+        iSendQueue.AppendL( item );  
         }        
     }
 
--- a/vpnengine/ikev1lib/src/ikev1trans.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/ikev1lib/src/ikev1trans.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -36,11 +36,17 @@
 #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,
@@ -93,8 +99,9 @@
     delete iInternalAddr;
     delete iDialog;
     delete iDialogInfo;
-	delete iUserName; 	
-            
+	delete iUserName;
+	delete iCache;
+
     for ( TInt i = 0; i < Count(); i++ )
     {
         delete At(i);
@@ -114,8 +121,7 @@
     {
         User::Leave(KErrArgument);   
     }
-       
-    DEBUG_LOG(_L("Transaction exchange object constructed"));  
+    
     if ( !iUseXauth ) 
     {
        iXauthCompleted = ETrue;
@@ -126,7 +132,14 @@
        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"));  
 }
 
 /**-------------------------------------------------------------------
@@ -283,7 +296,12 @@
   	      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 ) {
@@ -308,9 +326,12 @@
                   break;
 
               default:
+                  if( iCache && KCredentialTypeNew == iCredentialType )
+                  {
+                      iCache->SetSecret( *aDialogInfo->iSecret );
+                  }
                   break;
-                   
-          }   
+          }
           AddAttributeData(attr_ptr, AttrType, aDialogInfo->iSecret->Length(),
                           (TUint8*)aDialogInfo->iSecret->Ptr());           
        }
@@ -800,9 +821,7 @@
             //
             //  User name/Password authentication required
             //
-			iDialog     = CIkev1Dialog::NewL(iPluginSession, iPluginSession->DialogAnchor(), iDebug);			
-            iDialogInfo = new(ELeave) CAuthDialogInfo(iPluginSession, XAUTH_DIALOG_ID, iNegotiation->SAId(), iCurrExchange->iMessageId);
-            iDialog->GetAsyncUNPWDialogL(iDialogInfo, (MIkeDialogComplete*)this);          
+			GetCredentialsL();
             break;
 
         case ( (1 << (ATTR_USER_NAME - ATTR_XAUTH_TYPE)) | (1 << (ATTR_PASSCODE - ATTR_XAUTH_TYPE))):
@@ -841,7 +860,6 @@
     }   
     
     return status;
-
 }
 
 /**-------------------------------------------------------------------
@@ -856,12 +874,13 @@
     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;
         }
 
@@ -901,14 +920,19 @@
        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"));
@@ -918,13 +942,16 @@
 		  }	   
        }            
        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;
 }
 
@@ -980,7 +1007,6 @@
  *--------------------------------------------------------------------*/
 TInt CTransNegotiation::BuildConfigRequestL()
 {
-
     TBuf8<16> attributes;
     
     TUint32  message_id = iNegotiation->RandomMessageId();
@@ -998,8 +1024,6 @@
     DEBUG_LOG(_L("CONFIG-MODE started, request xmitted!")); 
 
     return TRANSACTION_CONTINUE;
-
-    
 }
 
 /**-------------------------------------------------------------------
@@ -1114,8 +1138,8 @@
 //
 // The implementation for class MIkeDialogComplete virtual function
 //
-TInt CTransNegotiation::DialogCompleteL(CIkev1Dialog* /*aDialog*/, TAny* aUserInfo,
-								        HBufC8* aUsername, HBufC8* aSecret, HBufC8* aDomain)
+TInt CTransNegotiation::DialogCompleteL(
+    TAny* aUserInfo, HBufC8* aUsername, HBufC8* aSecret)
 {
 /*---------------------------------------------------------------------------
  *  
@@ -1129,7 +1153,7 @@
  *-------------------------------------------------------------------------*/
 	TUint32 obj_id = 1;
 	CAuthDialogInfo* info = (CAuthDialogInfo*)aUserInfo;
-	DEBUG_LOG1(_L("CIKECRACKNegotiation::DialogCompleteL(), aUserInfo =  %x"), aUserInfo);
+	DEBUG_LOG1(_L("CTransNegotiation::DialogCompleteL(), aUserInfo=%x"), aUserInfo);
 
 	if ( info )
 	{
@@ -1137,12 +1161,56 @@
 		DEBUG_LOG1(_L("Preparing to call AuthDialogCompletedL(), ObjId = %x"), obj_id);
 		if ( obj_id == XAUTH_DIALOG_ID )
 		{
-			info->iUsername = aUsername;
-			info->iSecret   = aSecret;
-			info->iDomain   = aDomain;
+			info->SetUserName( aUsername );
+			info->SetSecret( aSecret );
 			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;
+        TUint32 id = iPluginSession->AuthDialogCompletedL( iDialogInfo );
+    }
+    else
+    {
+        iCredentialType = KCredentialTypeNew;
+
+        delete iDialog;  iDialog = NULL;
+
+        iDialog = CIkev1Dialog::NewL(
+            iPluginSession, iPluginSession->DialogAnchor(), iDebug );
+
+        iDialog->GetAsyncUNPWDialogL( iDialogInfo, (MIkeDialogComplete*)this );
+    }
+}
+
+
+/***/
--- a/vpnengine/pkiservice/inc/mapdescriptor.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiservice/inc/mapdescriptor.h	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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"
@@ -59,7 +59,7 @@
     TBool IsEqual(CMapDescriptor &aDesc);       
     void SetMapDeletable(TBool aDeletable);
     void SetMapTrusted(const TBool &aTrusted);
-    void SetMapApplications(const RArray<TUid> &aApplications);
+    void SetMapApplicationsL(const RArray<TUid> &aApplications);
     
     TPtrC Label() const;
     const TPKIKeyIdentifier& CertificateKeyId() const;
--- a/vpnengine/pkiservice/inc/pkisupport.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiservice/inc/pkisupport.h	Thu Aug 19 10:54:34 2010 +0300
@@ -157,8 +157,8 @@
         void DoRunOperationL();
         void DoRunLoggedInOperationL();
         
-        // Function to remove all MIDP2 certificates from the 
-        // local listing (MIDP2 certs shouldn't be supported by VPN)
+        // Function to remove all "Java Trust Root" certificates from the 
+        // local listing ("Java Trust Root" certs shouldn't be supported by VPN)
         void CleanupCertListL();
 
         // CActive methods
--- a/vpnengine/pkiservice/inc/pkiwrapper.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiservice/inc/pkiwrapper.h	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -47,7 +47,7 @@
 
         void InitializeL(const RMessage2& aMessage);        
         void SetTrusted(TBool aValue);
-        void SetApplications(const RArray<TUid>& aApplUids);
+        void SetApplicationsL(const RArray<TUid>& aApplUids);
                 
         void SetCertStoreType(TPkiServiceStoreType aStoreType);
                
--- a/vpnengine/pkiservice/src/mapdescriptor.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiservice/src/mapdescriptor.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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"
@@ -410,12 +410,12 @@
     iIsDeletable = aDeletable;
     }
 
-void CMapDescriptor::SetMapApplications(const RArray<TUid> &aApplications) 
+void CMapDescriptor::SetMapApplicationsL(const RArray<TUid> &aApplications) 
     {
     iApplUids.Close();
     for(TInt i=0; i<aApplications.Count();i++)
         { 
-        iApplUids.Append(aApplications[i]);
+        User::LeaveIfError(iApplUids.Append(aApplications[i]));
         }
     }
 
--- a/vpnengine/pkiservice/src/pkimapper.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiservice/src/pkimapper.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -445,11 +445,9 @@
         if(mapping->IsMatchingL(aDescriptor, aInfoOnly, aStoreType))
             {
             // If we found a match, process it further
-            _LIT(KMidp2Label, "MIDP2");
-            TBuf<12> buf;
-            buf.Append(KMidp2Label);
-            // Discard all MIDP2 certificates to avoid label-mapping problem
-            if (buf.Compare(mapping->Label()) != 0)
+            _LIT(KJavaTrustRootLabel, "Java Trust Root");
+            // Discard all "Java Trust Root" certificates to avoid label-mapping problem
+            if (mapping->Label().Compare(KJavaTrustRootLabel) != 0)
                 {
                 if(mapping->EndTime() > furthestEndTime)
                     {
@@ -461,7 +459,7 @@
                 }
             else 
                 {
-                LOG(Log::Printf(_L("Found a cert, but it was a MIDP2 one - continuing search")));
+                LOG(Log::Printf(_L("Found a cert, but it was a \"Java Trust Root\" one - continuing search")));
                 }
             }
         }
--- a/vpnengine/pkiservice/src/pkisession.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiservice/src/pkisession.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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"
@@ -135,7 +135,7 @@
     			for (TInt i = 0; i < aC; i++)
     				{
     				list->Read(i * sizeof(TUid), (TAny*)&tempUid, sizeof(TUid));
-    				iUidArray.Append(tempUid);
+    				iUidArray.AppendL(tempUid);
     				}
     			}
     		CleanupStack::PopAndDestroy(1);     // list
--- a/vpnengine/pkiservice/src/pkisupport.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiservice/src/pkisupport.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -263,7 +263,7 @@
     CleanupStack::PushL(newMapping);
     
     newMapping->SetMapDeletable(currentCertInfo->IsDeletable());
-    newMapping->SetMapApplications(iApplUids);
+    newMapping->SetMapApplicationsL(iApplUids);
     iApplUids.Reset();
     User::LeaveIfError(iMapper.AddMapping(newMapping));
             
@@ -433,7 +433,7 @@
 	if((iSupportStatus == KErrNotSupported) && 
 	    iToggleSwitch && (iInitState == EInitCompleteImportCerts))
 		{
-		// Some implementations of MIDP2 certstore return KErrNotSupported
+		// Some implementations of "Java Trust Root" 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 MIDP2 and non X509 certificates are removed.
-    (MIDP2 certificates can never have a "VPN" trust setting.)
+    More specifically, all "Java Trust Root" and non X509 certificates are removed.
+    ("Java Trust Root" 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 (MIDP2 certs)");
+    LOG_("Removing invalid certs (\"Java Trust Root\" certs)");
 
     TInt certcount = iCerts.Count();
-    _LIT(KMidp2Label, "MIDP2");
+    _LIT(KJavaTrustRootLabel, "Java Trust Root");
     LOG_1("Total cert count, before cleanup: %d", iCerts.Count());
     RMPointerArray<CCTCertInfo> removedInfos;
     CleanupClosePushL(removedInfos);
     for (TInt i = certcount - 1; i >= 0; i--) 
         {
         CCTCertInfo* info = iCerts[i];
-        if (info->Label().Compare(KMidp2Label) == 0 ||
+        if (info->Label().Compare(KJavaTrustRootLabel) == 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 MIDP2 certificates first,
+            // Cert list might be new. Remove all "Java Trust Root" certificates first,
             // if it hasn't been already done
             CleanupCertListL();
             iInitState = EInitCompleteImportCerts;
@@ -1019,7 +1019,7 @@
                 case ESSComplete:
                     if(iCurrentFunction == PkiService::EApplications)
                         {
-                        iWrapper.SetApplications(iApplUids);
+                        iWrapper.SetApplicationsL(iApplUids);
                         }
                             
                     iSubState = ESSCompleteRequest;
@@ -1162,7 +1162,7 @@
 	iApplUids.Close();
 	for(TInt i = 0;i<aApplUids.Count();i++)
 		{
-		iApplUids.Append(aApplUids[i]);
+		iApplUids.AppendL(aApplUids[i]);
 		}
     SetCallerStatusPending( aStatus );
     SelectCertificateL(aLabel);
--- a/vpnengine/pkiservice/src/pkiwrapper.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiservice/src/pkiwrapper.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 - 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006 - 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"
@@ -151,12 +151,12 @@
     iTrusted = aValue;
 }
 
-void CPKIWrapper::SetApplications(const RArray<TUid>& aApplUids)
+void CPKIWrapper::SetApplicationsL(const RArray<TUid>& aApplUids)
 {
     iUidArray.Close();
 	for(TInt i=0;i<aApplUids.Count();i++)
 		{
-		iUidArray.Append(aApplUids[i]);
+		User::LeaveIfError(iUidArray.Append(aApplUids[i]));
 		}
 }
 
@@ -265,7 +265,7 @@
         for (TUint i = 0; i < iCount; i++)
             {
             list->Read(i * sizeof(TUid), (TAny*)&tempUid, sizeof(TUid));
-            iUidArray.Append(tempUid);
+            iUidArray.AppendL(tempUid);
             }
         }
     CleanupStack::PopAndDestroy(1);     // list
@@ -592,7 +592,7 @@
 		case PkiService::ESetApplicability:
 			if (iCurrentStatus == KErrNone)
 				{
-				iMapper.GetMapDescriptorAtIndex(iIndex).SetMapApplications(iUidArray); 
+				iMapper.GetMapDescriptorAtIndex(iIndex).SetMapApplicationsL(iUidArray); 
 				}
 			break;
 
--- a/vpnengine/pkiserviceapi/src/pkiserviceapi.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/pkiserviceapi/src/pkiserviceapi.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -1041,7 +1041,7 @@
     for (TInt i = 0; i < count; i++)
         {
         applList->Read(i * sizeof(TUid), (TAny*)&temp, sizeof(TUid));
-        aApplications.Append(temp);
+        aApplications.AppendL(temp);
         }
 	CleanupStack::PopAndDestroy(1);  // applList
     CleanupStack::PopAndDestroy(); //certDesc
--- a/vpnengine/sit/EABI/eventmedsitU.DEF	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/sit/EABI/eventmedsitU.DEF	Thu Aug 19 10:54:34 2010 +0300
@@ -12,4 +12,6 @@
 	_ZN4CSitD2Ev @ 11 NONAME
 	_ZTI4CSit @ 12 NONAME ; #<TI>#
 	_ZTV4CSit @ 13 NONAME ; #<VT>#
+	_ZTI9CExtender @ 14 NONAME
+	_ZTV9CExtender @ 15 NONAME
 
--- a/vpnengine/sit/bwins/EVENTMEDSITU.DEF	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/sit/bwins/EVENTMEDSITU.DEF	Thu Aug 19 10:54:34 2010 +0300
@@ -1,10 +1,10 @@
 EXPORTS
-	??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)
+	??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)
 
--- a/vpnengine/sit/group/sit.mmp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/sit/group/sit.mmp	Thu Aug 19 10:54:34 2010 +0300
@@ -35,6 +35,8 @@
 SOURCE          realiapconnobserver.cpp
 SOURCE          vpnconncloser.cpp
 SOURCE          eventlogger.cpp
+SOURCE		extender.cpp
+SOURCE		extenderhelper.cpp
 
 USERINCLUDE     ../inc
 USERINCLUDE     ../../../vpnapiimpl/inc
@@ -45,6 +47,7 @@
 USERINCLUDE     ../../vpnmanager/inc
 USERINCLUDE     ../../vpncommon/inc
 USERINCLUDE     ../../eventviewer/inc
+USERINCLUDE	../../vpnextapi/inc
 USERINCLUDE     ../../pkiserviceapi/inc
 USERINCLUDE     ../../../vpnui/vpnecomnotifier/inc
 
@@ -63,5 +66,6 @@
 LIBRARY         eventviewer.lib
 LIBRARY         featmgr.lib
 LIBRARY         cmmanager.lib
+LIBRARY		vpnextapi.lib
 
 DEBUGLIBRARY    flogger.lib
--- a/vpnengine/sit/inc/eventlogger.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/sit/inc/eventlogger.h	Thu Aug 19 10:54:34 2010 +0300
@@ -38,6 +38,7 @@
 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
   	{
@@ -58,6 +59,7 @@
     REventMediator& iEventMediator;
     TUint32 iVpnIapId;
     TUint32 iRealIapId;
+    CExtender* iExtender;
 	};
 
 #define DEFINE_EVENT_LOGGER         CEventLogger* iEventLogger;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/sit/inc/extender.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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 <e32base.h>
+#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<TVpnDialogInfo>    iDialogInfoDes;
+    TPckgBuf<TVpnDialogOutput>  iDialogResponseDes;
+    };
+
+
+#endif // __EXTENDER__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/sit/inc/extenderhelper.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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 <e32base.h>
+
+#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<TVpnDialogInfo>    iDialogInfoDes;
+    TPckgBuf<TVpnDialogOutput>  iDialogResponseDes;
+    
+    };
+#endif // __EXTENDERHELPER__
--- a/vpnengine/sit/src/eventlogger.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/sit/src/eventlogger.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -22,6 +22,7 @@
 #include "log.h"
 #include "eventmediatorapi.h"
 #include "vpnconnstarter.h"
+#include "extender.h"
 
 
 /**
@@ -47,6 +48,8 @@
     {
     // Set default access point names just
     // in case the real name fetching fails
+    iExtender=CExtender::NewL();
+    
     iVpnApName.Copy(KUnknownVpnAp);
     iRealApName.Copy(KUnknownIap);
 
@@ -56,6 +59,7 @@
 CEventLogger::~CEventLogger()
     {
     LOG(Log::Printf(_L("CEventLogger::~CEventLogger\n")));
+    delete iExtender;
     }
 
 void CEventLogger::LogEvent(TUint aMsgId, TAny* aAnyPtr, TInt aStatusCode, TInt aReasonCode)
@@ -141,13 +145,15 @@
             break;
 
         case R_VPN_MSG_VPN_IAP_ACT_START:
-            // NSSM removal
+            iExtender->OnVpnApActStart(static_cast<CVpnConnStarter*>(aAnyPtr));
             break;
             
         case R_VPN_MSG_VPN_IAP_ACT_CANCEL:
+            iExtender->OnVpnApActCancel();
             break;
 
         case R_VPN_MSG_VPN_IAP_ACT_END:
+            iExtender->OnVpnApActEnd(static_cast<TVpnPolicyId*>(aAnyPtr), aStatusCode, iRealIapId);
             break;
             
         default:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/sit/src/extender.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,413 @@
+/*
+* 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 <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+#include <cmdestinationext.h>
+#include <cmconnectionmethoddef.h>
+#include <centralrepository.h>
+
+#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();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/sit/src/extenderhelper.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/.cproject	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="2" concurrentBuildJobs="4" defaultMMPChangedAction="0" extraSBSv2Args="" infBuildComponents="" infFileLocation="group\bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="false" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="true" promptForMMPChangedAction="true" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="Emulator Debug (WINSCW) [MCL]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [MCL]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [MCL]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="P:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="P:\vpnclient\vpnengine\vpnextapi\group\bld.inf;P:\epoc32\include\platform_paths.hrh;P:\vpnclient\vpnengine\vpnextapi\group\vpnextapi.mmp;" includesCache="P:/vpnclient/vpnengine/vpnextapi/inc[LOCAL];P:/vpnclient/vpnengine/vpnmanager/inc[LOCAL];P:/epoc32/include;P:/epoc32/include/mw;P:/epoc32/include/platform/mw;P:/epoc32/include/platform;P:/epoc32/include/platform/loc;P:/epoc32/include/platform/mw/loc;P:/epoc32/include/platform/loc/sc;P:/epoc32/include/platform/mw/loc/sc;P:/epoc32/include/oem;" macrosCache="__DLL__;__S60_51__;_UNICODE;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__S60_3X__;__SERIES60_3X__;__S60_5X__;__CW32__;__WINS__;__WINSCW__;_DEBUG;" moduleId="configDataCache" sourcesCache="/vpnextapi/inc;/vpnextapi/src;/vpnmanager/inc;" timestampCache="1268727470530" useMmpMacrosCache="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
+<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/.project	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>vpnextapi</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.core.ccnature</nature>
+		<nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
+	</natures>
+</projectDescription>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/bwins/vpnextapiu.def	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,10 @@
+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)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/eabi/vpnextapiu.def	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,11 @@
+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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/group/ABLD.BAT	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,15 @@
+@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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/group/bld.inf	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* 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 <platform_paths.hrh>
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+vpnextapi.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/group/vpnextapi.mmp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 <platform_paths.hrh>
+
+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 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/inc/vpnextapi.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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 <e32base.h>
+#include <vpnapi.h>
+#include <cmapplicationsettingsui.h>
+#include "vpnextapiservantdefs.h"
+
+
+
+class TAgileProvisionApiServerSettings
+
+   {
+   public:
+       TCmSettingSelection             iSelection;
+       TBuf8<KMaxProvisionServerUrlLength>   iServerUrl;
+       TBuf<KMaxProvisionServerNameLength> iServerNameLocal;
+   };
+
+   class TAgileProvisionApiServerListElem
+
+   {
+   public:
+       TBuf8<KMaxProvisionServerUrlLength>   iServerUrl;
+       TBuf<KMaxProvisionServerNameLength> iServerNameLocal;
+   };
+
+   class TAgileProvisionPolicy
+   
+   {
+   public:
+       TBuf<KMaxNameLength> 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/inc/vpnextapiservantdefs.h	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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<KMaxProvisionServerUrlLength>        iServerAddress;
+    TBuf<KMaxProvisionServerNameLength>        iServerNameLocal;
+};
+
+
+#endif // VPNEXTAPISERVANTDEFS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/rom/vpnextapi.iby	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnextapi/src/vpnextapi.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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<TAgileProvisionApiServerSettings> serverCreatePckg(aServerDetails);
+    return SendReceive(EExtCreateProvisionServer, TIpcArgs(&serverCreatePckg));
+    }
+
+
+EXPORT_C TInt RVpnExtApi::ServerDetails( TAgileProvisionApiServerSettings& aServerDetails )
+    {
+    TPckg<TAgileProvisionApiServerSettings> serverPckg( aServerDetails );
+   
+    return SendReceive(EExtVPNPolicyServerDetails, TIpcArgs(&serverPckg));
+    }
+
+EXPORT_C TInt RVpnExtApi::DeleteServer( )
+    {
+    return SendReceive(EExtDeletePolicyServer);
+    }
+
+EXPORT_C TInt RVpnExtApi::ServerListL(  TAgileProvisionApiServerListElem& aVpnPolicyServerList )
+    {
+    TPckg<TAgileProvisionApiServerListElem> 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<TAgileProvisionPolicy> serverPckg( aVpnPolicyName );
+    return SendReceive(EExtGetPolicyName, TIpcArgs(&serverPckg));
+    }
+
--- a/vpnengine/vpnmanager/group/vpnmanager.mmp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/group/vpnmanager.mmp	Thu Aug 19 10:54:34 2010 +0300
@@ -52,8 +52,11 @@
 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
 
@@ -75,8 +78,9 @@
 LIBRARY         charconv.lib 
 LIBRARY         cmmanager.lib
 LIBRARY         cryptography.lib
+LIBRARY         agileprovisionws.lib
 LIBRARY         centralrepository.lib
 
 DEBUGLIBRARY    flogger.lib
 
-EPOCSTACKSIZE     0x4000
+EPOCSTACKSIZE     0x5000
--- a/vpnengine/vpnmanager/group/vpnmanager_test.mmp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/group/vpnmanager_test.mmp	Thu Aug 19 10:54:34 2010 +0300
@@ -52,8 +52,11 @@
 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
 
@@ -76,8 +79,9 @@
 LIBRARY         charconv.lib 
 LIBRARY         cmmanager.lib
 LIBRARY         cryptography.lib
+LIBRARY         agileprovisionws.lib
 LIBRARY         centralrepository.lib
 
 DEBUGLIBRARY    flogger.lib
 
-EPOCSTACKSIZE     0x4000
+EPOCSTACKSIZE     0x5000
--- a/vpnengine/vpnmanager/inc/cmmanagerutils.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/inc/cmmanagerutils.h	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -37,9 +37,12 @@
     {
 public:
 
-    static void CreateVPNConnectionMethodToIntranetL(const TVpnPolicyInfo& aVpnPolicyInfo,
+    static TUint32 CreateVPNConnectionMethodToIntranetL(const TVpnPolicyInfo& aVpnPolicyInfo,
                                                      CEventLogger& aEventLogger);
     
+    static TBool ProvisionIAPNameExistL(TUint32 aAgileProvisionAPId);
+    
+    
 private:
 
     static void SetVpnConnectionMethodAttributesL(RCmConnectionMethodExt& aConnectionMethod,
--- a/vpnengine/vpnmanager/inc/policyimporter.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/inc/policyimporter.h	Thu Aug 19 10:54:34 2010 +0300
@@ -34,6 +34,7 @@
 class CPolicyPatchInfoList;
 class CIkeDataArray;
 class CIkeData;
+class CAgileProvisionWs;
 
 const TInt KMaxExtPolicyIdLength = 256;
 const TInt KDoNotGetKeySize      = -1;
@@ -59,7 +60,9 @@
 
     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);
@@ -96,6 +99,8 @@
     void StateImportPinAndPolL();
     void StateCreateVpnDestinationL();
     void StateEndPolicyImportL();
+    void StateGetPolicyProvisionServiceL();
+    void StateAfterGetPolicyProvisionServiceL();
     void BuildPolicyIdListL();
     TPkiServiceStoreType GetStoreTypeL(CIkeData* aData);
 
@@ -151,9 +156,25 @@
     /**
      * Returns Issuer name of certificate
      */
-    HBufC8* CPolicyImporter::CertIssuerL(const TFileName& aCertFile);
-    TFileName CPolicyImporter::GetCAFromFileListL(const TDesC8& aCertSubjectName, CArrayFixFlat<TFileName>* aCertFileArray);
+    HBufC8* CertIssuerL(const TFileName& aCertFile);
+    TFileName GetCAFromFileListL(const TDesC8& aCertSubjectName, CArrayFixFlat<TFileName>* aCertFileArray);
+    
+    /**
+     * Checks whether mVPN policy provision is requested 
+     */
+    TBool GetPolicyService();
+    
+    void GetPolicyWsL();
+ 
+    HBufC8* GetPolicyNameL(HBufC* aPolicyFileName);
+    
+    void PatchPolicyProvisionL();
 
+    
+public:
+    //Policy provision service
+    CAgileProvisionWs* iAgileProvisionWs;
+    
 private:
     RMessage2 iMessage;
     TRequestStatus* iExtStatus;
@@ -198,9 +219,16 @@
     TAny* iPkiOpContext;
 
     TBool iImportSinglePolicy;
+    TBool iAgileProvision;
     TVpnPolicyId* iNewPolicyId;
+    TVpnPolicyId iNewPolicyIdBuf;
+    TVpnPolicyId iPolicyId;
+    
+    TBuf<KMaxIdLength> iPolicyIdBuf;
+    
+    HBufC8* iAgileProvisionWSAddr;
 
-    TVpnPolicyId iPolicyId;
+    TUint32 iAgileProvisionAPId;
     };
 
 #endif // __POLICYIMPORTER_H__
--- a/vpnengine/vpnmanager/inc/vpnapiservant.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/inc/vpnapiservant.h	Thu Aug 19 10:54:34 2010 +0300
@@ -22,7 +22,11 @@
 
 #include <e32base.h>
 #include "vpnapi.h"
+#include "vpnextapi.h"
+#include "vpnextapiservantdefs.h"
 #include "eventlogger.h"
+#include "fileutil.h"
+
 
 class RFs;
 class CPolicyStore;
@@ -68,12 +72,20 @@
     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__
--- a/vpnengine/vpnmanager/inc/vpnmanagerserverdefs.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/inc/vpnmanagerserverdefs.h	Thu Aug 19 10:54:34 2010 +0300
@@ -53,7 +53,16 @@
     // OMA DM based policy management)
     EVpnAddPolicy,
     EVpnUpdatePolicyDetails,
-    EVpnUpdatePolicyData
+    EVpnUpdatePolicyData,
+    
+    //Policy provision
+    EExtCreateProvisionServer,
+    EExtDeletePolicyServer,
+    EExtVPNPolicyServerList,
+    EExtVPNPolicyServerDetails,
+    EExtSynchronizePolicyServer,
+    EExtCancelSynchronize,
+    EExtGetPolicyName
     };
 
 // Panic codes
--- a/vpnengine/vpnmanager/src/cmmanagerutils.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/src/cmmanagerutils.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -29,11 +29,13 @@
 static const TUint KMaxDestinationNameLength = 32;
 
 
-void CmManagerUtils::CreateVPNConnectionMethodToIntranetL(const TVpnPolicyInfo& aVpnPolicyInfo,
+TUint32 CmManagerUtils::CreateVPNConnectionMethodToIntranetL(const TVpnPolicyInfo& aVpnPolicyInfo,
                                                           CEventLogger& aEventLogger)
     {
     LOG_("CmManagerUtils::CreateVPNConnectionMethodToIntranetL \n");
     
+    TUint32 connectionMethodId(0);
+    
     using namespace CMManager;
     
     RCmManagerExt cmManagerExt;
@@ -75,7 +77,7 @@
                                                  internetDestinationId);                        
             
         CleanupClosePushL( vpnConnectionMethod );
-        TUint32 connectionMethodId = vpnConnectionMethod.GetIntAttributeL( ECmId );
+        connectionMethodId = vpnConnectionMethod.GetIntAttributeL( ECmId );
         aEventLogger.LogEvent(R_VPN_MSG_CREATED_VPN_ACCESS_POINT_WITH_SNAP,
                               &(aVpnPolicyInfo.iId), NULL,
                               connectionMethodId, internetDestinationId);
@@ -91,6 +93,8 @@
     CleanupStack::PopAndDestroy(); //cmManagerExt
     
     LOG_("CmManagerUtils::CreateVPNConnectionMethodToIntranetL - end \n");
+    return connectionMethodId;
+    
     }
 
 void CmManagerUtils::SetVpnConnectionMethodAttributesL(RCmConnectionMethodExt& aConnectionMethod,
@@ -102,7 +106,7 @@
     
     LOG_("CmManagerUtils::SetVpnConnectionMethodAttributesL \n");                                                   
     
-    aConnectionMethod.SetIntAttributeL( ECmNamingMethod, ENamingNothing );
+    aConnectionMethod.SetIntAttributeL( ECmNamingMethod, ENamingUnique );
     aConnectionMethod.SetStringAttributeL( ECmName, aConnectionMethodName );
     aConnectionMethod.SetStringAttributeL( EVpnServicePolicy, aPolicyId );      
     aConnectionMethod.SetIntAttributeL( ECmNextLayerSNAPId, aInternetDestinationId );
@@ -259,3 +263,42 @@
     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<TUint32> 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;
+    }
+
+
--- a/vpnengine/vpnmanager/src/fileutil.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/src/fileutil.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -19,6 +19,7 @@
 
 #include <f32file.h>
 #include "fileutil.h"
+#include "log_r6.h"
 
 TFileUtil::TFileUtil(RFs& aFs) : iFs(aFs)
     {
--- a/vpnengine/vpnmanager/src/policyimporter.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/src/policyimporter.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -15,7 +15,11 @@
 *
 */
 
-
+#include <f32file.h>
+#include <x509cert.h>
+#include <f32file.h>
+#include <x509cert.h>
+#include <e32const.h>
 
 #include "policyimporter.h"
 #include "vpnapiservant.h"
@@ -28,12 +32,16 @@
 #include "pkiutil.h"
 #include "cmmanagerutils.h"
 #include "log_r6.h"
+#include "agileprovisionws.h"
+#include "agileprovisiondefs.h"
+#include "policyinstaller_constants.h"
 
-#include <f32file.h>
-#include <x509cert.h>
+
 
 const TInt KDefaultKeySize(1024);
 
+_LIT8 (KPinFileNameTitle, "[POLICYNAME]");
+
 enum TImportState
     {
     EStateBeginPolicyImport = 1,
@@ -47,7 +55,9 @@
     EStateAfterAttachCertificate,
     EStateImportPinAndPol,
     EStateCreateVpnDestination,
-    EStateEndPolicyImport
+    EStateEndPolicyImport,
+    EStateGetPolicyProvisionService,
+    EStateAfterGetPolicyProvisionService
     };
 
 CPolicyImporter* CPolicyImporter::NewL(const RMessage2& aMessage, CVpnApiServant& aVpnApiServant,
@@ -116,6 +126,10 @@
 
     delete iCertFileData;
     delete iKeyFileData;
+    
+    delete iAgileProvisionWSAddr;
+    delete iAgileProvisionWs;
+    
     LOG_("<- CPolicyImporter::~CPolicyImporter()");
     }
 
@@ -228,7 +242,14 @@
         case EStateEndPolicyImport:
             StateEndPolicyImportL();
             break;
+            
+        case EStateGetPolicyProvisionService:
+            StateGetPolicyProvisionServiceL();
+            break;
 
+        case EStateAfterGetPolicyProvisionService:
+            StateAfterGetPolicyProvisionServiceL();
+            break;
         default:
             User::Panic(KVpnManagerServer, EInvalidImportState);
             break;
@@ -597,9 +618,41 @@
     {
     LOG_("-> CPolicyImporter::StateImportPinAndPolL()");
     SetCurrState(EStateImportPinAndPol);
-
-    HBufC* pinFile = iFileUtil.MakeFileNameLC(iImportDir, iCurrPolicyId, KPinFileExt);
-    HBufC* polFile = iFileUtil.MakeFileNameLC(iImportDir, iCurrPolicyId, KPolFileExt);
+    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);
+        }
+     
 
     if (!iFileUtil.FileExists(*pinFile))
         {
@@ -616,9 +669,14 @@
         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 or ACU. If the policy is installed from .vpn file
+        //OMA DM. If the policy is installed from .vpn file
         //the iImportSinglePolicy is not used.
         //The VPN destination is only created in .vpn case.
         if (iImportSinglePolicy)
@@ -639,16 +697,51 @@
     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) )
+               {
+               HBufC8* fileData=iFileUtil.LoadFileDataL(serverSettingsFile);
+               CleanupStack::PushL(fileData);
+               HBufC8* newFileData =HBufC8::New(fileData->Length() + KCRLF().Length() + 4);
+               CleanupStack::PushL(newFileData);
+               TPtr8 fileDataPtr = newFileData->Des();
+               fileDataPtr.Copy(*fileData);
+               fileDataPtr.Append(KCRLF);
+               fileDataPtr.AppendNum(provisionIapId);
+               iFileUtil.SaveFileDataL(serverSettingsFile,fileDataPtr);
+               CleanupStack::PopAndDestroy(newFileData);
+               CleanupStack::PopAndDestroy(fileData);
+               }
+            }
+        }
 
-    CmManagerUtils::CreateVPNConnectionMethodToIntranetL(*policyInfo,
-                                                         *(iVpnApiServant.iEventLogger));
-
-    CleanupStack::PopAndDestroy(); //policyInfo
+    CleanupStack::PopAndDestroy(policyInfo);
     GotoState(EStateEndPolicyImport);
 
     LOG_("<- CPolicyImporter::StateCreateVpnDestinationL()");
@@ -668,13 +761,58 @@
     iFileUtil.DeleteFilesL(*fileFilter);
 
     CleanupStack::PopAndDestroy(); // fileFilter
-
-    LOG_EVENT_2B(R_VPN_MSG_INSTALLED_POLICY_FILE, iNewPolicyId, NULL, 0, iImportSinglePolicy);
-
+    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);
+        }
     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<TFileName>(2);
+    
+    delete iCurrUserCertList;
+    iCurrUserCertList = NULL;
+    iCurrUserCertList = new (ELeave) CArrayFixFlat<TFileName>(2);
+    
+    iNewPolicyId = &iPolicyId;
+    
+    BuildPolicyIdListL();
+    iCurrPolicyId.Copy(iPolicyIdList->At(iCurrPolicyIdIndex));
+    iImportSinglePolicy = EFalse;
+    iAgileProvision = ETrue;
+    GotoState(EStateImportPinAndPol);
+    
+    }
+
+
 void CPolicyImporter::BuildPolicyIdListL()
     {
     delete iPolicyIdList;
@@ -1153,6 +1291,191 @@
         }       
     
     return aCertFileArray->At(currCaIndex);
+    }
     
+    
+    void CPolicyImporter::GetPolicyWsL()
+        {
+        const TInt KEolLen = 2;
+        
+        delete iAgileProvisionWs;
+        iImportDir=KTempDirectory();
+        iFileUtil.CreateDirIfNeededL(iImportDir);
+        iAgileProvisionWs = CAgileProvisionWs::NewL();
+             
+        TFileName serverSettingsFile;
+        User::LeaveIfError(iFs.PrivatePath(serverSettingsFile));
+              
+        serverSettingsFile.Append(KProvisionServerSettings);
+                    
+               
+        HBufC8* fileData;
+        TInt endOfLine;
+        HBufC8* serviceEndPoint;
+        TUint iapIdInt;
+        
+        if ( iFileUtil.FileExists(serverSettingsFile) )
+            {
+            fileData=iFileUtil.LoadFileDataL(serverSettingsFile);
+            CleanupStack::PushL(fileData);
+            endOfLine=fileData->Find(KCRLF);
+                    
+            serviceEndPoint=HBufC8::NewL( KHTTPprefix().Length() + KServiceSuffix().Length() +  fileData->Mid(0,endOfLine).Length());
+            CleanupStack::PushL(serviceEndPoint);
+            TPtr8 endPointPtr(serviceEndPoint->Des());
+            endPointPtr=KHTTPprefix;
+            HBufC8* serviceAddrBuf=(fileData->Mid(0,endOfLine)).AllocL();
+            CleanupStack::PushL(serviceAddrBuf);
+            
+            //serviceAddrBuf ownership transfer
+            iAgileProvisionWs->SetServiceAddr(serviceAddrBuf);
+            endPointPtr.Append(fileData->Mid(0,endOfLine));
+            endPointPtr.Append(KServiceSuffix);
+            CleanupStack::Pop(serviceAddrBuf);
+            
+            TInt startOfLine(endOfLine+KEolLen);
+            TPtrC8 nameData=fileData->Right(fileData->Length()-startOfLine);
+            endOfLine=nameData.Find(KCRLF);      
+                                        
+            startOfLine = endOfLine + KEolLen;
+            TPtrC8 iapIdData=nameData.Right(nameData.Length()-startOfLine);
+            endOfLine=iapIdData.Find(KCRLF);
+            TLex8 iapIdConverter(iapIdData.Left(endOfLine));
+            
+            iapIdConverter.Val(iapIdInt);
+            iAgileProvisionWs->GetPolicy( *serviceEndPoint, iapIdInt, iStatus );
+            CleanupStack::PopAndDestroy(serviceEndPoint);
+            CleanupStack::PopAndDestroy(fileData); 
+            }
+                
+       
+        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);
+            
+                
+        if ( iFileUtil.FileExists(fileNamePtr) )
+           {
+           HBufC8* fileData=iFileUtil.LoadFileDataL(fileNamePtr);
+           CleanupStack::PushL(fileData);
+        
+           TPtrC8 restOfData = *fileData;
+           
+           TInt bofInt;
+           TInt line=1;             
+           while ( (bofInt=restOfData.Find(KCRLF)) != KErrNotFound && line < KPolicyFileLine )
+                 {
+                 restOfData.Set(restOfData.Mid(bofInt + KCRLF().Length()));
+                 line++;                                  
+                 }
+           TInt iapIdStart=restOfData.Find(KCRLF);
+           HBufC16* iapIdBuf;
+           if ( iapIdStart!=KErrNotFound )
+              {
+              TPtrC8 iapIdPtr=restOfData.Mid(iapIdStart + KCRLF().Length(),restOfData.Length()-KCRLF().Length()-iapIdStart);
+              iapIdBuf=iFileUtil.To16BitL(iapIdPtr);
+              CleanupStack::PushL(iapIdBuf);
+              TLex iapIdConverter(*iapIdBuf);
+              iapIdConverter.Val(iAgileProvisionAPId,EDecimal);     
+              CleanupStack::PopAndDestroy(iapIdBuf);           
+              }
+           
+           if ( iAgileProvisionAPId >0)
+               restOfData.Set(restOfData.Mid(0,iapIdStart));
+               HBufC16* policyFileNameBuf = iFileUtil.To16BitL(restOfData);
+               CleanupStack::PushL(policyFileNameBuf);
+               HBufC* policyFilePath = iFileUtil.MakeFileNameLC(privateDir, *policyFileNameBuf, KPolFileExt);
+               
+               //server configuration file includes installed policy file name and policy exists.
+               if ( line == KPolicyFileLine && iFileUtil.FileExists(*policyFilePath) )
+                   { 
+                   HBufC16* restOfDataBuf=iFileUtil.To16BitL(restOfData);
+                   CleanupStack::PushL(restOfDataBuf);
+                   iPolicyIdBuf.Append(*restOfDataBuf);
+                   iNewPolicyIdBuf=iPolicyIdBuf;
+                   iPolicyStore.ReplacePolicyL(iPolicyIdBuf,*iNewPolicyId);
+                   iNewPolicyId= &iNewPolicyIdBuf;
+                   CleanupStack::PopAndDestroy(restOfDataBuf);
+                   }
+               //either first configuration or policy removed
+               else
+                   {
+                   HBufC* serverFile = HBufC::NewL(fileData->Length() + KCRLF().Length() + iNewPolicyId->Length());
+                   CleanupStack::PushL(serverFile);
+                   TPtr tPtr(serverFile->Des());
+                   HBufC16* fileData16=iFileUtil.To16BitL(*fileData);
+                   CleanupStack::PushL(fileData16);
+                   tPtr.Copy(*fileData16);
+                   _LIT(KCRLF, "\r\n");
+              
+                   //policy removed
+                   if ( line == KPolicyFileLine )
+                       {
+                       TInt lengthOfPolicyId=restOfData.Length();
+                       tPtr.Replace(fileData->Length()-lengthOfPolicyId,lengthOfPolicyId,*iNewPolicyId);
+                       }
+                   //first configuration
+                   else
+                       {
+                       tPtr.Append(KCRLF);
+                       tPtr.Append(*iNewPolicyId);
+                       }
+                   iFileUtil.SaveFileDataL(fileNamePtr,tPtr);
+                   
+                   CleanupStack::PopAndDestroy(fileData16);
+                   CleanupStack::PopAndDestroy(serverFile);
+                   }
+             
+               CleanupStack::PopAndDestroy(policyFilePath);
+               CleanupStack::PopAndDestroy(policyFileNameBuf); 
+               CleanupStack::PopAndDestroy(fileData);
+               CleanupStack::PopAndDestroy(policyServerSettingsFileName);
+           }
+
     }
 /***/
--- a/vpnengine/vpnmanager/src/vpnapiservant.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/src/vpnapiservant.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -16,15 +16,22 @@
 */
 
 
+#include <e32std.h>
+#include <f32file.h>
 
+#include "fileutil.h"
 #include "vpnapiservant.h"
 #include "policystore.h"
 #include "policyimporter.h"
 #include "pwdchanger.h"
 #include "vpnapidefs.h"
 #include "vpnmanagerserverdefs.h"
+#include "vpnextapiservantdefs.h"
 #include "vpnmaninternal.h"
 #include "log_r6.h"
+#include "agileprovisionws.h"
+#include "agileprovisiondefs.h"
+#include "cmmanagerutils.h"
 
 
 CVpnApiServant* CVpnApiServant::NewL(RFs& aFs)
@@ -36,7 +43,7 @@
     return self;
     }
 
-CVpnApiServant::CVpnApiServant(RFs& aFs) : iFs(aFs)
+CVpnApiServant::CVpnApiServant(RFs& aFs) : iFs(aFs), iFileUtil(aFs)
     {
     }
 
@@ -113,6 +120,36 @@
             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;
@@ -244,7 +281,7 @@
             
     aMessage.Complete(ret);
     
-    LOG(Log::Printf(_L("CVpnApiServant::GetPolicyDetailsL: aMesage completed withd %d"), ret));    
+    LOG(Log::Printf(_L("CVpnApiServant::GetPolicyDetailsL: aMessage completed withd %d"), ret));    
     }
 
 void CVpnApiServant::DeletePolicyL(const RMessage2& aMessage)
@@ -518,3 +555,308 @@
 
     aMessage.Complete(KErrNone);
     }
+
+void CVpnApiServant::CreateProvisionServerL( const RMessage2& aMessage )
+    {
+      TAgileProvisionApiServerSettings* serverCreate = new (ELeave) TAgileProvisionApiServerSettings();
+      CleanupStack::PushL(serverCreate);
+      TPckg<TAgileProvisionApiServerSettings> 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;
+            
+      if ( iFileUtil.FileExists(serverFilePath) )
+         {
+          HBufC8* fileData=iFileUtil.LoadFileDataL(serverFilePath);
+          CleanupStack::PushL(fileData);
+             
+          TPtrC8 restOfData = fileData->Des();
+                
+          TInt bofInt;
+          TInt line=1;             
+          while ( (bofInt=restOfData.Find(KCRLF)) != KErrNotFound && line < KPolicyFileLine )
+                {
+                restOfData.Set(restOfData.Mid(bofInt + KCRLF().Length()));
+                line++;                                  
+                }
+          TInt iapIdStart=restOfData.Find(KCRLF);
+          HBufC16* iapIdBuf;
+                 
+          if ( iapIdStart!=KErrNotFound )
+              {
+              TPtrC8 iapIdPtr=restOfData.Mid(iapIdStart + KCRLF().Length(),restOfData.Length()-KCRLF().Length()-iapIdStart);
+              iapIdBuf=iFileUtil.To16BitL(iapIdPtr);
+              CleanupStack::PushL(iapIdBuf);
+              TLex iapIdConverter(*iapIdBuf);
+              iapIdConverter.Val(agileProvisionAPId,EDecimal);     
+              CleanupStack::PopAndDestroy(iapIdBuf);           
+              }
+                 
+          if ( agileProvisionAPId >0)
+              {
+               restOfData.Set(restOfData.Mid(0,iapIdStart));
+               HBufC16* policyFileNameBuf = iFileUtil.To16BitL(restOfData);
+               policyFileName = *policyFileNameBuf;
+               delete policyFileNameBuf;
+              }
+          CleanupStack::PopAndDestroy(fileData);
+          }
+      /* end of saving old values */
+      
+      //IAP data Max value 255 
+      TBuf<10> iapIdStr;
+      TBuf<10> iapModeStr;
+      TBuf<10> iapAgileIdStr;
+      
+      iapIdStr.Num(serverAccountLocalData->iSelection.iId);
+      iapModeStr.Num(serverAccountLocalData->iSelection.iResult);
+      HBufC* serverSettingsDataBuf;
+      if ( agileProvisionAPId >0 )
+          {
+          iapAgileIdStr.Num(agileProvisionAPId);
+                                                                                                                          
+          serverSettingsDataBuf = HBufC::NewL(serverAccountLocalData->iServerNameLocal.Length() + serverAccountLocalData->iServerAddress.Length() + 
+                                              iapIdStr.Length() + iapModeStr.Length() + policyFileName.Length() + iapAgileIdStr.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);
+      _LIT(KCRLF, "\r\n"); 
+      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(iapAgileIdStr);
+          }
+     
+      iFileUtil.SaveFileDataL(serverFilePath,tPtr);
+      CleanupStack::PopAndDestroy(3);
+      aMessage.Complete(KErrNone);
+    }
+
+void CVpnApiServant::ListProvisionServerL( const RMessage2& aMessage )
+    {
+      _LIT8(KCRLF, "\r\n");
+      
+      const TInt KEolLen = 2;
+      
+      TAgileProvisionApiServerListElem* serverList = new (ELeave) TAgileProvisionApiServerListElem();
+      CleanupStack::PushL(serverList);
+      TPckg<TAgileProvisionApiServerListElem> serverPckg(*serverList);
+          
+      TFileName serverFilePath;
+      User::LeaveIfError(iFs.PrivatePath(serverFilePath));
+      serverFilePath.Append(KProvisionServerSettings);   
+      
+      HBufC8* fileData(NULL);
+     
+      if ( iFileUtil.FileExists(serverFilePath) )
+          {
+          fileData=iFileUtil.LoadFileDataL(serverFilePath);
+          CleanupStack::PushL(fileData);
+          TInt endOfLine=fileData->Find(KCRLF);
+          serverList->iServerUrl=fileData->Mid(0,endOfLine);
+          
+          TInt startOfLine(endOfLine+KEolLen);
+          TPtrC8 nameData=fileData->Right(fileData->Length()-startOfLine);
+          endOfLine=nameData.Find(KCRLF);
+          HBufC16* serverName=iFileUtil.To16BitL(nameData.Left(endOfLine));
+          serverList->iServerNameLocal=*serverName;
+          delete serverName;
+          serverName = NULL;
+          }
+      
+      aMessage.WriteL(0, serverPckg);
+      if ( iFileUtil.FileExists(serverFilePath) )
+          CleanupStack::PopAndDestroy(fileData);
+      
+      CleanupStack::PopAndDestroy(serverList);
+      aMessage.Complete(KErrNone);
+    }
+
+void CVpnApiServant::GetProvisionServerDetailsL( const RMessage2& aMessage )
+    {
+     
+      TAgileProvisionApiServerSettings* serverList = new (ELeave) TAgileProvisionApiServerSettings();
+      CleanupStack::PushL(serverList);
+      TPckg<TAgileProvisionApiServerSettings> serverPckg(*serverList);
+      
+      _LIT8(KCRLF, "\r\n");     
+      
+      TFileName serverFilePath;
+      User::LeaveIfError(iFs.PrivatePath(serverFilePath));
+      serverFilePath.Append(KProvisionServerSettings);  
+      
+      HBufC8* fileData(NULL);
+      const TInt KEolLen = 2;
+      TBool serverFileExist = EFalse;
+      
+      if ( iFileUtil.FileExists(serverFilePath) )
+         {
+          fileData=iFileUtil.LoadFileDataL(serverFilePath);
+          CleanupStack::PushL(fileData);  
+          TInt endOfLine=fileData->Find(KCRLF);
+          serverList->iServerUrl=fileData->Mid(0,endOfLine);
+                
+          TInt startOfLine(endOfLine+2);
+          TPtrC8 nameData=fileData->Right(fileData->Length()-startOfLine);
+          endOfLine=nameData.Find(KCRLF);      
+             
+          HBufC16* serverName=iFileUtil.To16BitL(nameData.Left(endOfLine));
+          serverList->iServerNameLocal=*serverName;
+          delete serverName;
+          serverName = NULL;
+          
+          startOfLine = endOfLine + KEolLen;
+          TPtrC8 iapIdData=nameData.Right(nameData.Length()-startOfLine);
+          endOfLine=iapIdData.Find(KCRLF);
+          TLex8 iapIdConverter(iapIdData.Left(endOfLine));
+          TUint idInt;
+          iapIdConverter.Val(idInt);
+          serverList->iSelection.iId = idInt;
+        
+          startOfLine = endOfLine + KEolLen;
+          TPtrC8 iapModeData=iapIdData.Right(iapIdData.Length()-startOfLine);
+          TLex8 iapModeConverter;
+          endOfLine=iapModeData.Find(KCRLF);
+          if ( endOfLine==KErrNotFound )
+              iapModeConverter = iapModeData;
+          else
+              iapModeConverter = iapModeData.Left(endOfLine);
+              
+          iapModeConverter.Val(idInt);
+          CMManager::TCmSettingSelectionMode selectionMode = (CMManager::TCmSettingSelectionMode) idInt;
+          serverList->iSelection.iResult = selectionMode; 
+          serverFileExist = ETrue;   
+          }
+      aMessage.WriteL(0, serverPckg);
+      
+      if ( serverFileExist )
+          CleanupStack::PopAndDestroy(fileData);
+      
+      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<TAgileProvisionPolicy> serverPckg(*policy);
+    
+    _LIT8(KCRLF, "\r\n");
+    
+    TFileName serverFilePath;
+    User::LeaveIfError(iFs.PrivatePath(serverFilePath));
+    serverFilePath.Append(KProvisionServerSettings);  
+    
+    HBufC8* fileData(NULL);
+         
+    const TInt KEolLen = 2;
+    TBool serverFileExist = EFalse;
+    
+    if ( iFileUtil.FileExists(serverFilePath) )
+       {
+        fileData=iFileUtil.LoadFileDataL(serverFilePath);
+        CleanupStack::PushL(fileData);   
+        TInt endOfLine=fileData->Find(KCRLF);
+        if (endOfLine<=0)
+            User::Leave(KErrArgument);
+                        
+        TInt startOfLine(endOfLine + KEolLen);
+        TPtrC8 nameData=fileData->Right(fileData->Length()-startOfLine);
+        endOfLine=nameData.Find(KCRLF);      
+        if (endOfLine<=0)
+            User::Leave(KErrArgument);      
+                
+        startOfLine = endOfLine + KEolLen;
+        TPtrC8 iapIdData=nameData.Right(nameData.Length()-startOfLine);
+        endOfLine=iapIdData.Find(KCRLF);
+        if (endOfLine<=0)
+            User::Leave(KErrArgument);      
+           
+        startOfLine = endOfLine + KEolLen;
+        TPtrC8 iapModeData=iapIdData.Right(iapIdData.Length()-startOfLine);
+        endOfLine=iapModeData.Find(KCRLF);
+        if (endOfLine<=0)
+            User::Leave(KErrArgument);      
+        
+        startOfLine = endOfLine + KEolLen;
+        TPtrC8 policyData=iapModeData.Right(iapModeData.Length()-startOfLine);
+        endOfLine=policyData.Find(KCRLF);
+        if (endOfLine<=0)
+            User::Leave(KErrArgument);      
+        
+        HBufC16* policyName = iFileUtil.To16BitL(policyData.Left(endOfLine));
+        policy->iPolicyName = *policyName;
+        delete policyName;
+        policyName=NULL;
+        serverFileExist = ETrue;
+        }
+
+    aMessage.WriteL(0, serverPckg);
+    
+    if ( serverFileExist )
+        CleanupStack::PopAndDestroy(fileData);
+    
+    CleanupStack::PopAndDestroy(policy);
+    
+    aMessage.Complete(KErrNone);
+    }
--- a/vpnengine/vpnmanager/src/vpnmanagerserver.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnengine/vpnmanager/src/vpnmanagerserver.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -30,7 +30,7 @@
 	{
 	0,
     EVpnImportPolicy,
-    EVpnUpdatePolicyData+1
+    EExtGetPolicyName+1
 	};
 
 const TUint8 CVpnManagerServer::iVpnManElementIndex[iVpnManRangeCount] = 
--- a/vpnui/vpnmanagementui/data/vpnmanagementuirsc.rss	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/data/vpnmanagementuirsc.rss	Thu Aug 19 10:54:34 2010 +0300
@@ -233,16 +233,11 @@
     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;
@@ -1188,6 +1183,18 @@
 
 //----------------------------------------------------
 //    
+//     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
 //
--- a/vpnui/vpnmanagementui/group/vpnmanagementui.mmp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/group/vpnmanagementui.mmp	Thu Aug 19 10:54:34 2010 +0300
@@ -65,6 +65,7 @@
 USERINCLUDE ../../../vpnapiimpl/inc
 USERINCLUDE ../../../vpnengine/vpncommon/inc //for logcommon.h
 USERINCLUDE ../../vpnecomnotifier/data
+USERINCLUDE ../../../vpnengine/vpnextapi/inc
 
 MW_LAYER_SYSTEMINCLUDE
 APP_LAYER_SYSTEMINCLUDE
@@ -88,6 +89,7 @@
 LIBRARY     eventviewer.lib
 LIBRARY     centralrepository.lib
 LIBRARY     cmmanager.lib
+LIBRARY		vpnextapi.lib
 #ifdef __SCALABLE_ICONS
 LIBRARY     AknSkins.lib
 #endif //__SCALABLE_ICONS
--- a/vpnui/vpnmanagementui/inc/vpnapiwrapper.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/inc/vpnapiwrapper.h	Thu Aug 19 10:54:34 2010 +0300
@@ -19,13 +19,15 @@
 #define __VPNAPIWRAPPER_H__
 
 #include <e32base.h>
-#include "vpnapi.h"
+
+#include "vpnextapi.h"
 
 
 class MVpnApiWrapperCaller
     {
 public:
-    virtual void NotifyPolicyImportComplete(TInt aResult) = 0;
+  
+    virtual void NotifySynchroniseServerCompleteL(TInt aResult) = 0;
     };
 
 /**
@@ -65,23 +67,18 @@
         TInt aPolicyIndex, TVpnPolicyDetails& aPolicyDetails);
     
     /**
-     * Imports a new VPN policy to the policy store.
+     * Cretes the specified server definition.
      *
-     * @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);
+     * @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( );
 
 protected: // From CActive
     void DoCancel();
@@ -103,16 +100,27 @@
      */
     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,
-        ETaskImportPolicies
+        ETaskSynchroniseServer,
+
         };
 
-    RVpnApi iVpnApi;
 
+    RVpnExtApi iVpnExtApi;
+    TAgileProvisionApiServerSettings iPolicyServer;
+    TAgileProvisionApiServerListElem iVpnPolicyServerList;
     CArrayFixFlat<TVpnPolicyInfo>* iPolicyList;
     TFileName iImportDir;
 
--- a/vpnui/vpnmanagementui/inc/vpnmanagementuipolicycontainer.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/inc/vpnmanagementuipolicycontainer.h	Thu Aug 19 10:54:34 2010 +0300
@@ -88,16 +88,6 @@
         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
@@ -126,7 +116,7 @@
         /**
         * If ETrue, Show Waitnote.
         */
-        TBool iShowWaitNote;
+
 
     private: // functions
 
@@ -182,7 +172,7 @@
         */
         void ShowPoliciesL(); 
 
-        void PoliciesListEmptyL();
+
 
 
 
@@ -194,12 +184,6 @@
         void GetHelpContext(TCoeHelpContext& aContext) const;
 #endif //__SERIES60_HELP
 
-    protected: //data
-
-        /**
-        * If ETrue, ConstructL calls PoliciesListEmptyL() method.
-        */
-        TBool iCallPoliciesListEmpty;
        
     private: //data
 
--- a/vpnui/vpnmanagementui/inc/vpnmanagementuiservercontainer.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/inc/vpnmanagementuiservercontainer.h	Thu Aug 19 10:54:34 2010 +0300
@@ -33,7 +33,8 @@
 */
 class CVpnManagementUiServerContainer : public CCoeControl, 
                                         public MCoeControlObserver, 
-                                        public MEikListBoxObserver
+                                        public MEikListBoxObserver,
+                                        public MVpnApiWrapperCaller
     {
     /**
     * Policy Container needs to get access to CVpnManagementUiServerView's DoActivateL
@@ -86,14 +87,14 @@
         void DeleteServerL(TInt aIndex);
 
         /**
-        * Calls AcuAgent API's SynchroniseServerL
+        * Calls Agile provision web service to Synchronise mVPN configuration
         */
-        void SynchroniseServerL(TInt aIndex);
+        void SynchroniseServerL();
 
-        // from MAcuApiWrapperCaller
-        void NotifyUpdatePolicyCompleteL(TInt aResult);
+        // from vpnapiwrapper
+
         void NotifySynchroniseServerCompleteL(TInt aResult);
-        void NotifyStepChangedL(TInt aResult);
+
 
         void  HandleListBoxEventL (CEikListBox *aListBox, TListBoxEvent aEventType);
 
@@ -122,7 +123,7 @@
         /**
         * If ETrue, Show Waitnote.
         */
-        TBool iShowWaitNote;
+
 
     private: // functions
 
--- a/vpnui/vpnmanagementui/inc/vpnmanagementuiserversettingscontainer.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/inc/vpnmanagementuiserversettingscontainer.h	Thu Aug 19 10:54:34 2010 +0300
@@ -20,6 +20,8 @@
 
 #include <aknsettingitemlist.h>
 
+#include "vpnextapi.h"
+
 
 /**
  *  CServerSettingsContainer container control class.
@@ -62,10 +64,8 @@
      */
     void ChangeSettingValueL();
     
-    /*** NSSM support is discontinued.
-         Code is kept in comments temporarily because similar UI functionality
-         might be needed for another purpose.
-    const TAcuApiServerDetails& ServerDetailsL(); ***/
+   
+    const TAgileProvisionApiServerSettings& ServerDetailsL();
 
     static HBufC* GetDestinationNameL( TUint aId );
     static HBufC* GetConnectionMethodNameL( TUint aId );
@@ -113,7 +113,7 @@
 	CVpnUiLoader& iLoader;
 	
 	/// Server details
-    // TAcuApiServerDetails iServerDetails;
+	TAgileProvisionApiServerSettings iServerDetails;
     TBuf<KMaxServerUrlLength> iServerAddressBuffer;
     
    /**
--- a/vpnui/vpnmanagementui/inc/vpnmanagementuiview.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/inc/vpnmanagementuiview.h	Thu Aug 19 10:54:34 2010 +0300
@@ -96,9 +96,8 @@
         */
         void HandleCommandL(TInt aCommand);
 
-        // from MAcuApiWrapperCaller
-        void NotifyPolicyImportComplete(TInt aResult);
         
+        void NotifySynchroniseServerCompleteL(TInt aResult);
     public:
     
         /**
--- a/vpnui/vpnmanagementui/inc/vpnuiloader.h	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/inc/vpnuiloader.h	Thu Aug 19 10:54:34 2010 +0300
@@ -24,6 +24,7 @@
 #include "vpnapiwrapper.h"
 #include "vpnmanagementuidefs.h"
 #include "uirunner.h"
+#include "vpnextapi.h"
 
 // CONSTANTS
 /**
@@ -203,6 +204,9 @@
         TInt iCurrentServerIndex;
         TBool iPolicyUpdate;
         TBuf<KMaxUiSelectionNameLength> iSelectionName;
+        
+        TBool iShowWaitNote;
+        RVpnExtApi iVpnExtApi;
     
     private: // data
         
@@ -270,6 +274,9 @@
         TBool iKeepOpen;
         TBool iPolicyViewVisited;
         TBool iLogViewVisited;
+        TBool iServerViewVisited;
+        TBool iServerSettingsViewVisited;
+       
    };
 
 #endif // __VPNUILOADER_H__
--- a/vpnui/vpnmanagementui/loc/vpnmanagementui.loc	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/loc/vpnmanagementui.loc	Thu Aug 19 10:54:34 2010 +0300
@@ -46,7 +46,7 @@
 //d:Item opens Policy servers view
 //l:list_setting_pane_t1
 //
-#define qtn_vpn_policy_servers      "VPN policy servers"
+#define qtn_vpn_policy_servers      "VPN policy server"
 
 //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 servers"
+#define qtn_vpn_policy_servers_title        "VPN policy server"
 
 //d:Policy server view empty list placeholder text
 //l:main_list_empty_pane
--- a/vpnui/vpnmanagementui/src/vpnapiwrapper.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnapiwrapper.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -15,10 +15,14 @@
 *
 */
 
+#include <cmmanager.h>
+#include <cmdestination.h>
+#include <cmpluginvpndef.h>
 #include "vpnapiwrapper.h"
-#include "vpnapi.h"
+
 #include "log_vpnmanagementui.h"
 
+using namespace CMManager;
 
 CVpnApiWrapper* CVpnApiWrapper::NewL()
     {
@@ -36,20 +40,19 @@
 
 CVpnApiWrapper::~CVpnApiWrapper()
     {
+    LOG_("CVpnApiWrapper::~CVpnApiWrapper() called\n");
     delete iPolicyList;
     Cancel();
-    iVpnApi.Close();
+
+    iVpnExtApi.Close();
     }
 
 void CVpnApiWrapper::DoCancel()
     {
     LOG_("CVpnApiWrapper::DoCancel() called\n");
 
-    if (iOngoingTask == ETaskImportPolicies)
-        {
-        iVpnApi.CancelImport();
-        }
-    
+    TInt i=iVpnExtApi.CancelPolicyProvision();
+
     iOngoingTask = ETaskNone;
     }
 
@@ -57,10 +60,10 @@
     {
     LOG_1("CVpnApiWrapper::RunL():%d", iStatus.Int());
        
-    if (iOngoingTask == ETaskImportPolicies)
-        {
-        iCaller->NotifyPolicyImportComplete(iStatus.Int());
-        }
+    if (iOngoingTask == ETaskSynchroniseServer)
+       {
+        iCaller->NotifySynchroniseServerCompleteL(iStatus.Int());
+       }
     
     iOngoingTask = ETaskNone;
     }
@@ -70,9 +73,8 @@
     LOG_("CVpnApiWrapper::ConstructL() - begin");
 
     CActiveScheduler::Add(this);
-    LOG_("CVpnApiWrapper::ConstructL() - begin 2");
-    User::LeaveIfError(iVpnApi.Connect());
 
+    User::LeaveIfError(iVpnExtApi.Connect());
     LOG_("CVpnApiWrapper::ConstructL() - end");
     }
 
@@ -91,7 +93,7 @@
     
     iPolicyList = new (ELeave) CArrayFixFlat<TVpnPolicyInfo>(2);
 
-    User::LeaveIfError(iVpnApi.GetPolicyInfoList(iPolicyList));
+    User::LeaveIfError(iVpnExtApi.GetPolicyInfoList(iPolicyList));
     
     TKeyArrayFix Key( _FOFF(TVpnPolicyInfo,iName), ECmpCollated );
     Key.SetPtr( iPolicyList );
@@ -105,7 +107,10 @@
     LOG_("CVpnApiWrapper::DeletePolicyL() - begin");
 
     TVpnPolicyId& policyToDelete = iPolicyList->At(aPolicyIndex).iId;
-    User::LeaveIfError(iVpnApi.DeletePolicy(policyToDelete));
+    User::LeaveIfError(iVpnExtApi.DeletePolicy(policyToDelete));
+    
+    //Delete all VPN APs pointing deleted policy
+    DeleteReferringVpnAps(policyToDelete);
     
     LOG_("CVpnApiWrapper::DeletePolicyL() - end");
     }
@@ -115,29 +120,131 @@
     LOG_("CVpnApiWrapper::GetPolicyDetailsL() - begin");
 
     TVpnPolicyId& policyOfInterest = iPolicyList->At(aPolicyIndex).iId;
-    User::LeaveIfError(iVpnApi.GetPolicyDetails(policyOfInterest, aPolicyDetails));
+    User::LeaveIfError(iVpnExtApi.GetPolicyDetails(policyOfInterest, aPolicyDetails));
 
     LOG_("CVpnApiWrapper::GetPolicyDetailsL() - end");
     }
 
-void CVpnApiWrapper::ImportPolicyL(const TDesC& aImportDir, MVpnApiWrapperCaller* aCaller)
+
+
+TInt CVpnApiWrapper::CreateServer( const TAgileProvisionApiServerSettings& aServerDetails)
     {
-    LOG_("CVpnApiWrapper::ImportPolicyL() - begin");
+    
+    iPolicyServer.iServerNameLocal = aServerDetails.iServerNameLocal;
+    iPolicyServer.iServerUrl = aServerDetails.iServerUrl;
+    iPolicyServer.iSelection = aServerDetails.iSelection;
+  
+    return iVpnExtApi.CreateServer(iPolicyServer);
+    }
 
-    if (iOngoingTask != ETaskNone)
-        {
-        User::Leave(KErrInUse);
-        }
+TAgileProvisionApiServerListElem& CVpnApiWrapper::ServerListL()
+    {
+    TInt err(iVpnExtApi.ServerListL( iVpnPolicyServerList ));
+    User::LeaveIfError( err );    
+    
+    return iVpnPolicyServerList;
+    
+    }
+
+void CVpnApiWrapper::GetServerDetailsL( TAgileProvisionApiServerSettings& aServerDetails )
+    {
+    User::LeaveIfError( iVpnExtApi.ServerDetails(aServerDetails));
+    }
 
-    iCaller = aCaller;
-    iImportDir.Copy(aImportDir);
+TInt CVpnApiWrapper::DeleteServer()
+    {
+ 
+    return iVpnExtApi.DeleteServer();
+
+    }
 
-    iVpnApi.ImportPolicy(iImportDir, iStatus);
+void CVpnApiWrapper::SynchroniseServerL( MVpnApiWrapperCaller* aCaller )
+    {
+    iCaller=aCaller;
+    iVpnExtApi.SynchronizePolicyServer(iStatus);
+    SetActive();
+    iOngoingTask = ETaskSynchroniseServer;
+    }
 
-    iOngoingTask = ETaskImportPolicies;
-    SetActive();
-    LOG_("CVpnApiWrapper::ImportPolicyL() - end");
+void CVpnApiWrapper::CancelSynchronise()
+    {
+   
+    Cancel();
+  
+    }
+
+void CVpnApiWrapper::DeleteReferringVpnAps(const TVpnPolicyId& aPolicyId) const
+    {
+    TRAP_IGNORE(DeleteReferringVpnApsL(aPolicyId));
     }
 
+void CVpnApiWrapper::DeleteReferringVpnApsL(const TVpnPolicyId& aPolicyId) const
+    {
+    RCmManager cmManager;
+    cmManager.OpenLC();
+                                      
+    //First collect all VPN connection methods from destinations
+    RArray<TUint32> 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<TUint32> 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
+    }
 /***/
--- a/vpnui/vpnmanagementui/src/vpnmanagementuicontainer.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnmanagementuicontainer.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -247,12 +247,10 @@
     CleanupStack::PopAndDestroy();  // resourceText
         
     //Create Policy servers setting listbox item
-    // 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
+   
+    resourceText = StringLoader::LoadLC( R_VPN_POLICY_SERVERS );
+     itemTextArray->AppendL(*resourceText);
+     CleanupStack::PopAndDestroy();  // resourceText
 
     //Create Log setting listbox item
     resourceText = StringLoader::LoadLC( R_VPN_LOG );
--- a/vpnui/vpnmanagementui/src/vpnmanagementuipolicycontainer.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnmanagementuipolicycontainer.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -25,7 +25,7 @@
 #include "vpnuiloader.h"
 #include "vpnmanagementuipolicycontainer.h"
 #include "vpnmanagementui.hrh"
-
+#include "vpnextapi.h"
 
 #ifdef __SERIES60_HELP
 #include <csxhelp/vpn.hlp.hrh> // for help context of VPN Management UI
@@ -68,7 +68,7 @@
     CreateListBoxL();
     
     //Initialization
-    iShowWaitNote = EFalse;
+
     
     ShowPoliciesL();
 	SetRect( aRect );
@@ -83,152 +83,10 @@
 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<TAcuApiServerListElem>* 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<KAcuMaxServerNameLocalLth+2> 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
@@ -480,151 +338,8 @@
 	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.  
--- a/vpnui/vpnmanagementui/src/vpnmanagementuipolicyview.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnmanagementuipolicyview.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -108,22 +108,13 @@
         {
         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 );
-            }
+         
         }
     }
 
@@ -144,8 +135,7 @@
 //
 void CVpnManagementUiPolicyView::HandleCommandL( TInt aCommand )
     {
-    TBool ffsLow;
-    switch ( aCommand )
+     switch ( aCommand )
         {
         case EAknSoftkeyBack:
             {
@@ -165,34 +155,7 @@
             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
@@ -312,8 +275,6 @@
 		ReadResourceL(*text, aResourceId);
 		cbaGroup->RemoveCommandFromStack(
 		    KVpnMSKControlId, EVpnUiCmdPolicyDetails);
-		cbaGroup->RemoveCommandFromStack(
-		    KVpnMSKControlId, EVpnUiCmdInstallPolicies);
 		cbaGroup->AddCommandToStackL(
 		    KVpnMSKControlId, aCommandId, text->Des());
 		CleanupStack::PopAndDestroy(text);
--- a/vpnui/vpnmanagementui/src/vpnmanagementuiservercontainer.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnmanagementuiservercontainer.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -73,7 +73,7 @@
         iLoader.iShowDefineQuery = ETrue;
         }
     iLoader.iBackFromServerDefinition = EFalse;
-    iShowWaitNote = EFalse;
+
 	SetRect( aRect );
     }
 
@@ -112,36 +112,7 @@
 	            }
             }
         }
-    /*** 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;
-                }
-        } ***/
     }
 
 
@@ -303,13 +274,6 @@
 		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();
@@ -354,79 +318,52 @@
 
 void CVpnManagementUiServerContainer::ShowServersL() 
     {
-    /*** NSSM support is discontinued.
-         Code is kept in comments temporarily because similar UI functionality
-         might be needed for another purpose.
-    CArrayFix<TAcuApiServerListElem>* serverList = iLoader.AcuApiWrapperL().ServerListL();
+  
+    TAgileProvisionApiServerListElem& serverList = iLoader.VpnApiWrapperL().ServerListL();
 
    	CDesCArrayFlat* itemTextArray = static_cast<CDesCArrayFlat*>(iListBox->Model()->ItemTextArray());
 
 	itemTextArray->Reset();
 	iListBox->Reset();
 
-    iListItemCount = serverList->Count();
-
-    for (TInt i = 0; i < iListItemCount; ++i)
-        {
-        TBuf<KAcuMaxServerNameLocalLth+2> serverName;
+    if ( serverList.iServerUrl.Length()>0 )
+       {
+        iListItemCount = 1;
+        TBuf<KMaxProvisionServerNameLength+2> serverName;
         serverName.Append(_L("\t"));
-        serverName.Append(serverList->At(i).iServerNameLocal);
+        serverName.Append(serverList.iServerNameLocal);
         itemTextArray->AppendL(serverName);
        }
 
-
 	iListBox->HandleItemAdditionL();
-	***/
+	
     }
 
 
 void CVpnManagementUiServerContainer::DeleteServerL(TInt /* aIndex */)
     {
   	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL\n")));
-
-    /*** NSSM support is discontinued.
-         Code is kept in comments temporarily because similar UI functionality
-         might be needed for another purpose.
-
-    TBuf<KAcuMaxServerNameLocalLth> 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;
+  
+  	TAgileProvisionApiServerListElem& serverList = iLoader.VpnApiWrapperL().ServerListL();
+  	TBuf<KMaxProvisionServerNameLength> serverName;
+  	serverName.Append(serverList.iServerNameLocal);
 
-    //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 );
-        }
-
+  	HBufC* 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.AcuApiWrapperL().DeleteServer(aIndex);
+        TInt ret = iLoader.VpnApiWrapperL().DeleteServer();
+        TInt ind = 0;
         if(ret == KErrNone)
             {
             //Update listbox
-            UpdateListBoxL( aIndex );
+            UpdateListBoxL( ind );
+            
             //Update iServerList
-            iLoader.AcuApiWrapperL().ServerListL();
+            iLoader.VpnApiWrapperL().ServerListL();
             
             //Set iNewServerDefinition to false
             iLoader.iNewServerDefinition = EFalse;
@@ -442,40 +379,30 @@
             CleanupStack::PopAndDestroy();  // noteText
             }
         }
-    ***/
+  
     }
 
-void CVpnManagementUiServerContainer::SynchroniseServerL(TInt /* aIndex */)
+void CVpnManagementUiServerContainer::SynchroniseServerL()
     {
   	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.AcuApiWrapperL().SynchroniseServerL( aIndex,this );
+        iLoader.VpnApiWrapperL().SynchroniseServerL( 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)
     {
@@ -483,7 +410,7 @@
 
     if ( iLoader.iWaitDialog ) 
         {
-        iLoader.DeleteWaitNoteL();//->iWaitDialog->ProcessFinishedL(); // deletes the wait dialog
+        iLoader.DeleteWaitNoteL();//// deletes the wait dialog
         }
 
 
@@ -495,19 +422,7 @@
         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()) );
@@ -530,19 +445,7 @@
         }
 
     iParent.SetMiddleSoftKeyL(ETrue);
-    }
 
-void CVpnManagementUiServerContainer::NotifyStepChangedL(TInt /*aResult*/)
-    {
-    if (iShowWaitNote)
-        {
-        iLoader.ShowWaitNoteL();
-        iShowWaitNote = EFalse;
-        }
-    if ( iLoader.iWaitDialog ) 
-        {
-        iLoader.SetTextL();
-        }
     }
 
 
--- a/vpnui/vpnmanagementui/src/vpnmanagementuiserversettingscontainer.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnmanagementuiserversettingscontainer.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -24,6 +24,8 @@
 #include <cmdestinationext.h>
 #include <cmpluginvpndef.h>
 #include <commdb.h>
+#include <e32def.h>
+
 #include <vpnmanagementuirsc.rsg>
 #include "vpnuiloader.h"
 #include "vpnmanagementuiserversettingscontainer.h"
@@ -78,12 +80,10 @@
 // ---------------------------------------------------------------------------
 //
 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,15 +98,53 @@
             settingItem = new (ELeave) CAknTextSettingItem(
                 aSettingId, iServerAddressBuffer );
             break;
-        case EVpnUiSettingIap:                        
-            settingItem = new (ELeave) CServerSettingConnectionSettingItem(
-                aSettingId, iServerDetails.iSelection);
+        case EVpnUiSettingIap:              
+            if ( iServerDetails.iSelection.iId <1 )
+                {
+                 RCmManagerExt cmManagerExt;
+                 cmManagerExt.OpenL();        
+                 CleanupClosePushL( cmManagerExt );     
+
+                 //Makes sure that Internet Destination Exists
+                 RArray<TUint32> 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);
             break;
         default:
             // Do nothing
             break;
             }
-    ***/
+   
     return settingItem;
     }
     
@@ -119,17 +157,54 @@
     {
 	// 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.AcuApiWrapperL().GetServerDetailsL( 
-	        iServerIndex, iServerDetails );
+	    iLoader.VpnApiWrapperL().GetServerDetailsL( iServerDetails );
 	    UpdateTitleL( iServerDetails.iServerNameLocal );    
 	    }    
-	***/  
-    ConstructFromResourceL(R_VPN_SERVER_SETTING_LIST);	    
+	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<TUint32> 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 
 	}
 	
 	
@@ -143,34 +218,6 @@
     } 
 
 
-// ---------------------------------------------------------------------------
-// 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<TAcuApiServerListElem>* 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)
@@ -191,58 +238,25 @@
 //
 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:
             {
-            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                                
-                    }
-
-                }
+            EditItemL(EVpnUiSettingServerName, ETrue);   
+            SettingItemArray()->At(EVpnUiSettingServerName)->StoreL(); 
+            }
             if (iServerDetails.iServerNameLocal.Length() > 0)
-                {                
-                UpdateTitleL( iServerDetails.iServerNameLocal );
-                }
+            {                
+            UpdateTitleL( iServerDetails.iServerNameLocal );
             }
+            
             break;            
         case EVpnUiSettingServerAddress:
             {
-            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);    
-                }
+            EditItemL(EVpnUiSettingServerAddress, ETrue);    
             }
             break;
         case EVpnUiSettingIap:
@@ -253,18 +267,12 @@
         default:            
             User::Invariant();
             break;
-        } ***/
+        }
     }
 
 
-// ---------------------------------------------------------------------------
-// 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()
+
+const TAgileProvisionApiServerSettings& CServerSettingsContainer::ServerDetailsL()
     {
     StoreSettingsL();
     if (iServerAddressBuffer.Length() > 0)
@@ -281,8 +289,6 @@
         //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)");
                         
@@ -307,16 +313,15 @@
             TPtrC8 serverNameAddress = iServerDetails.iServerUrl.Left(numberOfCharactersCopiedFromAddress);
             iServerDetails.iServerNameLocal.Copy(serverNameAddress);             
             iServerDetails.iServerNameLocal.Append(suffix);                                                             
-                           
-            }while(ServerNameExistsL( iServerDetails.iServerNameLocal) );                                                          
+   
+        CAknSettingItem* item = SettingItemArray()->At(EVpnUiSettingServerName); 
         
-        CAknSettingItem* item = SettingItemArray()->At(EVpnUiSettingServerName); 
         item->LoadL();
         item->UpdateListBoxTextL();        
         }
     return iServerDetails;
     }
-***/
+
 
 // ---------------------------------------------------------------------------
 // GetIapNameL
--- a/vpnui/vpnmanagementui/src/vpnmanagementuiserversettingsview.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnmanagementuiserversettingsview.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -116,11 +116,9 @@
 // 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 )
         {
@@ -129,7 +127,7 @@
             //GET CURRENT ADDRESS
             ASSERT( iContainer );
             
-            const TAcuApiServerDetails& serverDetails = iContainer->ServerDetailsL();
+            const TAgileProvisionApiServerSettings& serverDetails = iContainer->ServerDetailsL();
 
             ffs = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 );
             if (ffs)
@@ -149,20 +147,11 @@
                 }
             else
                 {
-                TBool createServer = ETrue;
-                if(createServer)
-                    {
-                    //Creating a new VPN policy server
-                    if( iContainer->ServerIndex() == -1)
-                        {
-	                        int aResult = iLoader.AcuApiWrapperL().CreateServer(serverDetails);
+              
+	                        int aResult = iLoader.VpnApiWrapperL().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;
 		                        }
@@ -171,23 +160,16 @@
 			                    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:
 			{
@@ -214,7 +196,7 @@
             AppUi()->HandleCommandL( aCommand );
             break;
             }
-        } ***/
+        }
     }
 
 // ---------------------------------------------------------
--- a/vpnui/vpnmanagementui/src/vpnmanagementuiserverview.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnmanagementuiserverview.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -123,6 +123,8 @@
             aMenuPane->SetItemDimmed( EVpnUiCmdSynchronise, ETrue );
             aMenuPane->SetItemDimmed( EVpnUiCmdDeleteServer, ETrue );
             }
+        else
+            aMenuPane->SetItemDimmed( EVpnUiCmdAddServer, ETrue );
         }
     }
 
@@ -183,8 +185,7 @@
             ffsLow = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 );
     		if(!ffsLow)
     			{
-    			iCurrentPosition = iServerContainer->iListBox->CurrentItemIndex();
-            	iServerContainer->SynchroniseServerL(iCurrentPosition);
+                iServerContainer->SynchroniseServerL();
     			}
     		break;
             }
--- a/vpnui/vpnmanagementui/src/vpnmanagementuiview.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnmanagementuiview.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -45,6 +45,7 @@
 enum TVpnUiCommands 
     {
     KVpnUiPolicyViewListItemId,
+    KVpnUiServerViewListItemId,
     KVpnUiLogViewListItemId
     };
 
@@ -294,13 +295,11 @@
             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);
@@ -313,13 +312,11 @@
     }
 
 
-// ---------------------------------------------------------------------------
-// CVpnManagementUiView::NotifyPolicyImportComplete()
-// ---------------------------------------------------------------------------
-void CVpnManagementUiView::NotifyPolicyImportComplete(TInt aResult)
+
+void CVpnManagementUiView::NotifySynchroniseServerCompleteL(TInt aResult)
     {
     if ( aResult != KErrNone)
-        LOG_1("CVpnManagementUiView::NotifyPolicyImportComplete:%d", aResult);
+           LOG_1("CVpnManagementUiView::NotifySynchroniseServerCompleteL:%d", aResult);
     }
 
 // ---------------------------------------------------------------------------
--- a/vpnui/vpnmanagementui/src/vpnuiloader.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnuiloader.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -28,6 +28,7 @@
 #include <sysutil.h>
 #include <ErrorUI.h>
 #include <bautils.h>
+#include <e32def.h>
 #include <vpnmanagementuirsc.rsg>
 #include "vpnuiloader.h"
 #include "vpnmanagementuiview.h"
@@ -70,10 +71,7 @@
     {
     LOG_("CVpnUiLoader::~CVpnUiLoader()");
     iVpnManagementUiView = NULL;
-       
-    delete iVpnManagementUiParametersView;
-    delete iVpnManagementUiServerView;
-        
+     
     if(iVersionInfoInNaviPane)
         {
         delete iVersionInfoInNaviPane; 
@@ -133,10 +131,8 @@
     
 	iPreviousAppViewId = aViewId;
 	CreateWindowL();
-    iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( 
-        aRect, *this);
-    iVpnManagementUiParametersView = CServerSettingsView::NewL( aRect, *this);
-
+    
+    User::LeaveIfError( iVpnExtApi.Connect() );
 	SetRect(aRect);
 
     LOG(Log::Printf(_L("CVpnUiLoader::ConstructL() - end\n")));
@@ -186,12 +182,14 @@
 			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)
                 {
@@ -229,8 +227,13 @@
                 localCurrentViewId );
 
 			iPreviousViewId = localCurrentViewId.iViewUid;
-
-			((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView);
+			if ( iServerViewVisited == EFalse)
+			    {
+			    TRect rect;
+			    iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( rect, *this);
+			    ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView);
+			    } 
+			iServerViewVisited = ETrue;
 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( 
                   KVpnManagementUiServerViewId ); 
 			break;
@@ -265,8 +268,14 @@
                 localCurrentViewId );
 
 			iPreviousViewId = localCurrentViewId.iViewUid;
-            //Put selected server to CustomMessageId 
-			((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView);
+            //Put selected server to CustomMessageId
+			if ( iServerSettingsViewVisited == EFalse)
+			   {
+			    TRect rect;
+			    iVpnManagementUiParametersView = CServerSettingsView::NewL( rect, *this);
+			    ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView);
+			   }
+			iServerSettingsViewVisited = ETrue;
 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
                   KVpnManagementUiParametersViewId,
                 TUid::Uid( aSelectionIndex), KNullDesC8 );
@@ -445,6 +454,11 @@
     TVwsViewId activeViewId;
     ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(activeViewId);
     ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(activeViewId.iViewUid);
+    
+    if ( !iShowWaitNote )
+        {
+        iVpnApiWrapper->CancelSynchronise( );
+        }
     }
 
 // ---------------------------------------------------------
@@ -454,7 +468,6 @@
 void CVpnUiLoader::ShowWaitNoteL()
     {
     // Initialization (before the progress dialog is shown)
-    iTextToShow = EConnectingVia; // "Connecting via '%U'"
     iWaitNoteStartTime.UniversalTime();
             
     if ( iWaitDialog )
@@ -485,40 +498,18 @@
         delete iWaitDialog;
         }
     iWaitDialog = NULL;
+    iShowWaitNote = EFalse;
     }
 
 void CVpnUiLoader::SetTextL()
     {
 	LOG(Log::Printf(_L("CVpnUiLoader::SetTextL()\n")));
 
-    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 );
+       
+        HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_IMPORTING_POLICY );
         iWaitDialog->SetTextL( *string ); 
         CleanupStack::PopAndDestroy( string );
-        }
-    else
-        {
-        HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_POLICY_DL_PROCESSING, iStateCodeToShow );
-        iWaitDialog->SetTextL( *string ); 
-        CleanupStack::PopAndDestroy( string );
-        }
+   
     }
 
 
--- a/vpnui/vpnpolicyrecognizer/rom/vpnpolicyrecognizer.iby	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnpolicyrecognizer/rom/vpnpolicyrecognizer.iby	Thu Aug 19 10:54:34 2010 +0300
@@ -22,13 +22,9 @@
 
 #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__