Revision: 200951
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 07 Jan 2010 13:15:03 +0200
changeset 1 a9c0ce913924
parent 0 b497e44ab2fc
child 2 5594fba90824
Revision: 200951 Kit: 201001
devicediagnosticsfw/diagpluginbase/src/diagpluginwaitingdialogwrapper.cpp
fotaapplication/fotaserver/FotaEngine/group/fotaengine.mmp
fotaapplication/fotaserver/FotaRfsPlugin/group/RfsFotaPlugin.mmp
fotaapplication/fotaserver/FotaScheduleHandler/group/fotaschedulehandler.mmp
fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp
fotaapplication/fotaserver/FotaStorage/group/fotadiskstorage.mmp
fotaapplication/fotaserver/FotaStorage/group/fotastorage.mmp
fotaapplication/fotaserver/fmsclient/group/fmsclient.mmp
fotaapplication/fotaserver/fmserver/group/fmsserver.mmp
fotaapplication/fotaserver/fotacustcmds/group/fotacustcmds.mmp
omaprovisioning/provisioning/Group/bld.inf
omaprovisioning/provisioning/Rom/Provisioning.iby
omaprovisioning/provisioning/Rom/ProvisioningResources.iby
omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPAccesspointItem.h
omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPAdapter.h
omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPItemBase.h
omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPLogicalProxy.h
omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPNapdef.h
omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPhysicalProxy.h
omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPort.h
omaprovisioning/provisioning/accesspointadapter/Inc/ProvisioningDebug.h
omaprovisioning/provisioning/accesspointadapter/Inc/WPAPAdapter.pan
omaprovisioning/provisioning/accesspointadapter/Inc/WPAPDefs.h
omaprovisioning/provisioning/accesspointadapter/Inc/WPAPSharedDataKeys.h
omaprovisioning/provisioning/accesspointadapter/Inc/WPAPUtil.h
omaprovisioning/provisioning/accesspointadapter/Src/CWPAPAccesspointItem.cpp
omaprovisioning/provisioning/accesspointadapter/Src/CWPAPAdapter.cpp
omaprovisioning/provisioning/accesspointadapter/Src/CWPAPItemBase.cpp
omaprovisioning/provisioning/accesspointadapter/Src/CWPAPLogicalProxy.cpp
omaprovisioning/provisioning/accesspointadapter/Src/CWPAPNapdef.cpp
omaprovisioning/provisioning/accesspointadapter/Src/CWPAPPhysicalProxy.cpp
omaprovisioning/provisioning/accesspointadapter/Src/CWPAPPort.cpp
omaprovisioning/provisioning/accesspointadapter/Src/CWPLog.cpp
omaprovisioning/provisioning/accesspointadapter/Src/CWPLog.h
omaprovisioning/provisioning/accesspointadapter/Src/CWPLogDef.h
omaprovisioning/provisioning/accesspointadapter/Src/WPAPAdapterGroupProxy.cpp
omaprovisioning/provisioning/accesspointadapter/Src/WPAPAdapterPanics.cpp
omaprovisioning/provisioning/accesspointadapter/Src/WPAPUtil.cpp
omaprovisioning/provisioning/accesspointadapter/group/101F84D8.rss
omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapter.mmp
omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapterResource.rss
omaprovisioning/provisioning/accesspointadapter/group/bld.inf
omaprovisioning/provisioning/accesspointadapter/loc/WPAPAdapter.loc
omaprovisioning/provisioning/accesspointadapter/rom/WPAPAdapter.iby
omaprovisioning/provisioning/accesspointadapter/rom/WPAPAdapterResources.iby
omaprovisioning/provisioning/cpdestinationnwadapter/data/2000b4af.rss
omaprovisioning/provisioning/cpdestinationnwadapter/data/wpdestinationnwadapter.rss
omaprovisioning/provisioning/cpdestinationnwadapter/group/bld.inf
omaprovisioning/provisioning/cpdestinationnwadapter/group/wpdestinationnwadapter.mmp
omaprovisioning/provisioning/cpdestinationnwadapter/inc/cwpdestinationnwadapter.h
omaprovisioning/provisioning/cpdestinationnwadapter/inc/cwpdestinationnwadapter.inl
omaprovisioning/provisioning/cpdestinationnwadapter/inc/cwpdestinationnwitem.h
omaprovisioning/provisioning/cpdestinationnwadapter/inc/wpdestinationnwadapteruids.h
omaprovisioning/provisioning/cpdestinationnwadapter/inc/wpdestinationnwdebug.h
omaprovisioning/provisioning/cpdestinationnwadapter/loc/wpdestinationnwadapter.loc
omaprovisioning/provisioning/cpdestinationnwadapter/rom/wpdestinationnwadapter.iby
omaprovisioning/provisioning/cpdestinationnwadapter/rom/wpdestinationnwadapter_resources.iby
omaprovisioning/provisioning/cpdestinationnwadapter/src/cwpdestinationnwadapter.cpp
omaprovisioning/provisioning/cpdestinationnwadapter/src/cwpdestinationnwitem.cpp
omaprovisioning/provisioning/cpdestinationnwadapter/src/wpdestinationnwadaptergroupproxy.cpp
policymanagement/policyengine/group/PolicyEngineServer.mmp
policymanagement/policyengine/policyengineserver/inc/OperationParser.h
policymanagement/policyengine/policyengineserver/inc/PolicyParser.h
syncmlfw/common/http/inc/nsmlhttp.h
syncmlfw/common/syncagent/src/NSmlAgentBase.cpp
syncmlfw/dm/wappushalert/src/nsmldmwappushalert.cpp
syncmlfw/ds/wappushalert/src/nsmldswappushalert.cpp
syncmlfw/rom/NSmlDMSync.iby
terminalsecurity/SCP/DmEventNotifier/group/DmEventNotifier.mmp
terminalsecurity/SCP/SCPClient/group/SCPClient.mmp
terminalsecurity/SCP/SCPClient/src/SCPClient.cpp
terminalsecurity/SCP/SCPDatabase/group/SCPDatabase.mmp
terminalsecurity/SCP/SCPEventHandler/group/SCPEventHandler.mmp
terminalsecurity/SCP/SCPHistoryPlugin/group/SCPHistoryPlugin.mmp
terminalsecurity/SCP/SCPPatternPlugin/group/SCPPatternPlugin.mmp
terminalsecurity/SCP/SCPServer/group/SCPServer.mmp
terminalsecurity/SCP/SCPTimestampPlugin/group/SCPTimestampPlugin.mmp
terminalsecurity/client/group/TerminalControlClient.mmp
terminalsecurity/server/group/TerminalControlServer.mmp
terminalsecurity/tcadapter/bld/tcadapter.mmp
--- a/devicediagnosticsfw/diagpluginbase/src/diagpluginwaitingdialogwrapper.cpp	Thu Dec 17 09:07:52 2009 +0200
+++ b/devicediagnosticsfw/diagpluginbase/src/diagpluginwaitingdialogwrapper.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -58,8 +58,8 @@
     // Dialog must not be NULL
     __ASSERT_ALWAYS( iWaitingDialog, Panic( EDiagPluginBasePanicBadArgument ) );
 
-    // Dialog must have EEikDialogFlagWait flag set
-    __ASSERT_ALWAYS( !(iWaitingDialog->DialogFlags() & EEikDialogFlagWait),
+    // Coverity Change .....  Dialog must have EEikDialogFlagWait flag set
+    __ASSERT_ALWAYS( (iWaitingDialog->DialogFlags() & EEikDialogFlagWait),
                      Panic( EDiagPluginBasePanicBadArgument ) );
     }
 
--- a/fotaapplication/fotaserver/FotaEngine/group/fotaengine.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/FotaEngine/group/fotaengine.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -55,4 +55,6 @@
 LIBRARY			centralrepository.lib
 LIBRARY	flogger.lib
 
+SMPSAFE
+
 //End of file
--- a/fotaapplication/fotaserver/FotaRfsPlugin/group/RfsFotaPlugin.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/FotaRfsPlugin/group/RfsFotaPlugin.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -47,3 +47,5 @@
 LIBRARY euser.lib       // Base library
 LIBRARY ecom.lib	    // ECom library
 LIBRARY flogger.lib
+
+SMPSAFE
\ No newline at end of file
--- a/fotaapplication/fotaserver/FotaScheduleHandler/group/fotaschedulehandler.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/FotaScheduleHandler/group/fotaschedulehandler.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -54,4 +54,4 @@
 LIBRARY	fotaengine.lib
 LIBRARY	flogger.lib
 
-
+SMPSAFE
\ No newline at end of file
--- a/fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -125,3 +125,4 @@
 LIBRARY    flogger.lib
 // #endif
 
+SMPSAFE
\ No newline at end of file
--- a/fotaapplication/fotaserver/FotaStorage/group/fotadiskstorage.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/FotaStorage/group/fotadiskstorage.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -61,4 +61,4 @@
 LIBRARY			flogger.lib
 LIBRARY			sysutil.lib
 
-
+SMPSAFE
--- a/fotaapplication/fotaserver/FotaStorage/group/fotastorage.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/FotaStorage/group/fotastorage.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -52,4 +52,5 @@
 LIBRARY			estor.lib
 LIBRARY			efsrv.lib
 
+SMPSAFE
 
--- a/fotaapplication/fotaserver/fmsclient/group/fmsclient.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/fmsclient/group/fmsclient.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -43,3 +43,5 @@
 LIBRARY 	  efsrv.lib 
 LIBRARY		  centralrepository.lib
 LIBRARY       flogger.lib
+
+SMPSAFE
\ No newline at end of file
--- a/fotaapplication/fotaserver/fmserver/group/fmsserver.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/fmserver/group/fmsserver.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -52,3 +52,4 @@
 LIBRARY       etelmm.lib 
 LIBRARY       etel.lib 
 
+SMPSAFE
--- a/fotaapplication/fotaserver/fotacustcmds/group/fotacustcmds.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/fotaapplication/fotaserver/fotacustcmds/group/fotacustcmds.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -47,3 +47,5 @@
 LIBRARY         schsvr.lib  
 LIBRARY		apgrfx.lib
 LIBRARY		apparc.lib
+
+SMPSAFE
\ No newline at end of file
--- a/omaprovisioning/provisioning/Group/bld.inf	Thu Dec 17 09:07:52 2009 +0200
+++ b/omaprovisioning/provisioning/Group/bld.inf	Thu Jan 07 13:15:03 2010 +0200
@@ -50,7 +50,8 @@
 //../ProvisioningCx/loc/ProvisioningCx.loc					MW_LAYER_LOC_EXPORT_PATH(provisioningcx.loc)
 ../StreamingAdapter/loc/StreamingAdapter.loc				MW_LAYER_LOC_EXPORT_PATH(streamingadapter.loc)
 ../AuthTypePlugin/loc/Authtypeplugin.loc 					MW_LAYER_LOC_EXPORT_PATH(authtypeplugin.loc)
-
+../accesspointadapter/loc/WPAPAdapter.loc                       MW_LAYER_LOC_EXPORT_PATH(wpapadapter.loc)
+../cpdestinationnwadapter/loc/wpdestinationnwadapter.loc	MW_LAYER_LOC_EXPORT_PATH(wpdestinationnwadapter.loc)
 
 PRJ_EXTENSIONS
 #ifdef SBSV2
@@ -88,13 +89,14 @@
 ../ProvisioningEngine/Group/ProvisioningEngine.mmp
 ../ProvisioningParser/Group/ProvisioningParser.mmp
 ../ProvisioningHandler/Group/ProvisioningHandler.mmp
-//../AccesspointAdapter/group/WPAPAdapter.mmp
+../accesspointAdapter/group/WPAPAdapter.mmp
 ../WAPAdapter/Group/WPWAPAdapter.mmp
 ../IMAdapter/Group/IMAdapter.mmp
 ../StreamingAdapter/Group/StreamingAdapter.mmp
 //../ProvisioningCx/group/ProvisioningCx.mmp
 ../ProvisioningBC/Group/ProvisioningBC.mmp
 ../MbxNbrAdapter/Group/MbxNbrAdapter.mmp
+../cpdestinationnwadapter/group/wpdestinationnwadapter.mmp
 
 
 
--- a/omaprovisioning/provisioning/Rom/Provisioning.iby	Thu Dec 17 09:07:52 2009 +0200
+++ b/omaprovisioning/provisioning/Rom/Provisioning.iby	Thu Jan 07 13:15:03 2010 +0200
@@ -37,6 +37,13 @@
 // Streaming Adapter
 ECOM_PLUGIN(WPStreamingAdapter.dll,101F85CB.rsc)
 
+//Accesspoint adapter
+ECOM_PLUGIN(WPAPAdapter.dll, WPAPAdapter.rsc)
+
+//Destination Adapter
+
+ECOM_PLUGIN( wpdestinationnwadapter.dll, 2000b4af.rsc )
+
 // Mailbox Number adapter
 ECOM_PLUGIN(WPMbxNbrAdapter.dll,10207281.rsc)	// this publishes the DLL and the
 													  						// resource file to the correct location
--- a/omaprovisioning/provisioning/Rom/ProvisioningResources.iby	Thu Dec 17 09:07:52 2009 +0200
+++ b/omaprovisioning/provisioning/Rom/ProvisioningResources.iby	Thu Jan 07 13:15:03 2010 +0200
@@ -52,4 +52,7 @@
   data=DATAZ_\RESOURCE_FILES_DIR\AuthtypepluginRsc.rsc            RESOURCE_FILES_DIR\AuthtypepluginRsc.rsc
 #endif
 
+data=DATAZ_\RESOURCE_FILES_DIR\WPAPAdapterResource.rsc      RESOURCE_FILES_DIR\WPAPAdapterResource.rsc
+data=DATAZ_\RESOURCE_FILES_DIR\wpdestinationnwadapter.rsc   RESOURCE_FILES_DIR\wpdestinationnwadapter.rsc
+
 #endif // __PROVISIONINGRESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPAccesspointItem.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2002 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:    Class stores data for one accesspoint
+*
+*/
+
+
+
+#ifndef CWPAPACCESSPOINTITEM_H
+#define CWPAPACCESSPOINTITEM_H
+
+// INCLUDES
+#include <e32def.h>
+#include <e32std.h>
+#include <e32base.h>
+#include <cmmanagerext.h>
+
+// FORWARD DECLARATIONS
+class CWPEngine;
+class CWPAPItemBase;
+class CWPParameter;
+class CWPCharacteristic;
+class CCommsDatabase;
+class CWPAPNapdef;
+class RCmManagerExt;
+
+// CLASS DECLARATION
+
+/**
+ * CWPAPAccesspointItem handles accesspoint settings. It links data from
+ * logical proxy, physical proxy and napdef into one item.
+ */ 
+class CWPAPAccesspointItem : public CBase
+	{
+	public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aDefaultName The default name if none is found
+        * @param aLogicalProxy The logical proxy 
+        * @param aPhysicalProxy The physical proxy 
+        * @param aNapdef The napdef
+        * @param aCharacteristic The characteristic 
+        */
+		static CWPAPAccesspointItem* NewLC(
+		                            const TDesC& aDefaultName,
+                                    CWPAPItemBase* iLogicalProxy,
+                                    CWPAPItemBase* iPhysicalProxy,
+                                    CWPAPItemBase* aNapdef,
+                                    CWPCharacteristic& aCharacteristic );
+
+        /**
+        * Destructor.
+        */
+		virtual ~CWPAPAccesspointItem();
+
+	public: // New methods
+
+		/**
+		* Get the accesspoint name.
+		* @return reference to name.
+		*/
+		const TDesC& Name() const;
+		
+		/**
+		* Get the NAPdef pointer
+		* @return pointer to napdef.
+		*/
+	  	CWPAPItemBase* NapDef();
+	  	
+	  	/**
+		* Set the pointer to the CM manager
+		* @return void
+		*/
+	  	void SetCMManager( RCmManagerExt* aCm );
+	  	
+	  	/**
+		* Get the characteristic value
+		* @return iCharacteristic.
+		*/
+	  	TInt Characteristic();
+		
+		/**
+		* Save this accesspoint to comms database.
+		* @param aCommsDb reference to CCommsdatabase
+		*/
+		TUint32 SaveL( CCommsDatabase& aCommsDb );
+
+        /**
+        * Return the UID of the saved access point.
+        * @return UID
+        */
+        const TDesC8& Uid() const;
+
+        /**
+        * Delete old data from engine model.
+        */
+        void DeleteUidData() const;
+
+	private:  // New functions
+
+		/**
+		* Store the accesspoint data to comms database.
+		* @param aCommsDb reference to CCommsdatabase
+		*/ 
+		TUint32 StoreL( CCommsDatabase& aCommsDb );
+
+		/**
+        * C++ default constructor.
+        * @param aDefaultName The default name if none is found
+        * @param aLogicalProxy The logical proxy 
+        * @param aPhysicalProxy The physical proxy 
+        * @param aNapdef The napdef
+        * @param aCharacteristic The characteristic 
+        */
+		CWPAPAccesspointItem( const TDesC& aDefaultName,
+                              CWPAPItemBase* iLogicalProxy,
+                              CWPAPItemBase* iPhysicalProxy,
+                              CWPAPItemBase* aNapdef,
+                              CWPCharacteristic& aCharacteristic );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+		void ConstructL();
+
+	private: // Data (Total ownership is assumed unless otherwise stated)
+
+        /// The default name if no other is found
+        const TDesC& iDefaultName;
+
+        /// The napdef
+        CWPAPItemBase* iNapdef;
+
+        /// The physical proxy
+        CWPAPItemBase* iPhysicalProxy;
+
+        /// The logical proxy
+        CWPAPItemBase* iLogicalProxy;
+
+        /// The uid created when saving
+        TPckgBuf<TUint32> iUid;
+
+        /// The characteristic the caused the creation of an access point
+        CWPCharacteristic& iCharacteristic;
+        RCmManagerExt* iCmManager;
+
+	private: // For testing usage.
+		friend class T_CWPAPAccesspointItem;
+		friend class T_CWPAPAdapter;
+		friend class T_WPAPTestUtils;
+	};
+
+#endif	// CWPAPACCESSPOINTITEM_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPAdapter.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2002 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:    Main class for handling provisioning accesspoint data
+*
+*/
+
+
+
+#ifndef CWPAPADAPTER_H
+#define CWPAPADAPTER_H
+
+// INCLUDES
+
+#include <CWPAdapter.h>
+#include <MWPContextExtension.h>
+#include <cmmanagerext.h>
+
+// FORWARD DECLARATIONS
+
+class CWPAPAccesspointItem;
+class CCommsDatabase;
+
+// CLASS DECLARATION
+
+/**
+ * CWPAPAdapter handles accesspoint settings.
+ */ 
+class CWPAPAdapter : public CWPAdapter, public MWPContextExtension
+	{
+	public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+		* @return a instance of class.
+        */
+		static CWPAPAdapter* NewL();
+
+		/**
+		* Destructor
+		*/
+		~CWPAPAdapter();
+
+	public: // From CWPAdapter
+
+		TInt ItemCount() const;
+		const TDesC16& SummaryTitle(TInt aIndex) const;
+		const TDesC16& SummaryText(TInt aIndex) const;
+		TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
+		void SaveL( TInt aItem );
+		TBool CanSetAsDefault( TInt aItem ) const;
+		void SetAsDefaultL( TInt aItem );
+		void VisitL(CWPCharacteristic& aElement);
+		void VisitL(CWPParameter& aElement);
+		void VisitLinkL(CWPCharacteristic& aCharacteristic );
+		TInt ContextExtension( MWPContextExtension*& );
+
+	public: // From MWPContextExtension
+
+		const TDesC8& SaveDataL( TInt aIndex ) const;
+		void DeleteL( const TDesC8& aSaveData );
+        TUint32 Uid() const;
+
+	private:  // New functions
+
+        /**
+        * C++ default constructor.
+        */
+		CWPAPAdapter();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+		void ConstructL();
+
+		/**
+		* Check whether this characteristic is already linked.
+		* @param aCharacteristic characteristic to compare.
+		* @return ETrue if link to given characteristic was found.
+		*/
+		TBool IsAlreadyLinked( CWPCharacteristic& aCharacteristic );
+
+	private: // Data
+
+		/// Array of linked NAPDEF and PXLOGICAL characteristics. Refs.
+		RPointerArray<CWPCharacteristic> iLinks;
+		/// Array of data items for memory management. Owns.
+		RPointerArray<CBase> iDataItems;
+        /// Array of save items. Owns.
+        RPointerArray<CWPAPAccesspointItem> iSaveItems;
+		/// Pointer to commsdatabase used in saving. Owns.
+		CCommsDatabase* iCommsDb;
+		/// Summary title. Owns.
+		HBufC* iTitle;
+        /// Default name. Owns.
+        HBufC* iDefaultName;
+		/// Indicates whether these settings are already saved.
+		TBool iAlreadySavedOnce;
+		// CMManager for managing connection methods
+		RCmManagerExt* iCmManager;
+	  RArray<TInt> iAPValue;
+
+	private: // For testing.
+		friend class T_CWPAPAdapter;
+	};
+
+#endif	// CWPAPADAPTER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPItemBase.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2002 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:     Defines a base class for all the items in WPAPAdapter
+*
+*/
+
+
+
+
+
+#ifndef CWPAPITEMBASE_H
+#define CWPAPITEMBASE_H
+
+// INCLUDES
+
+#include <e32base.h>
+#include <cmconnectionmethodext.h>
+#include <cmmanagerext.h>
+
+// DATA TYPES
+
+// Field types that can be marked received.
+// Values defined to the power of to to enable masking.
+enum TMarkedField
+	{
+	EWPParameterPxAddrType_id	= 2,
+	EWPParameterPxAddrFQDN_id	= 4,
+	EWPParameterNapID_id		= 8,
+	EWPParameterService_id		= 16,
+	EWPParameterPortNbr_id		= 32,
+	EWPParameterPxAddr_id		= 64,
+	EWPParameterAuthentication_id = 512,
+    EWPParameterIfNetworks_id   = 1024,
+    EWPParameterInternet_id     = 2048,
+    EWPParameterWlan_id         = 4096
+	};
+
+// FORWARD DECLARATIONS
+
+class CApAccessPointItem;
+class CWPAPAccesspointItem;
+class CCommsDatabase;
+
+// CLASS DECLARATION
+
+/**
+ * CWPAPItemBase is a base class for all the items in WPAPAdapter.
+ */ 
+class CWPAPItemBase : public CBase
+	{
+	public:
+
+        /**
+        * Destructor.
+        */
+		~CWPAPItemBase();
+
+	public: // New methods
+
+		/**
+		* Store the item data to APEngine's accesspoint item.
+		* @param aAPItem item where data is stored.
+		*/
+		virtual void AddDataL( RCmConnectionMethodExt& ) = 0;
+
+        /**
+        * Add access point items to an array.
+        * @param aItems The array to add to
+        * @param aLogicalProxy The related logical proxy, if any
+        * @param aPhysicalProxy The related physical proxy, if any
+        */
+        virtual TInt AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
+            CWPAPItemBase* aLogicalProxy,
+            CWPAPItemBase* aPhysicalProxy ) = 0;
+
+        /**
+        * The name of the item to be displayed to the user.
+        * @return The name
+        */
+        virtual const TDesC& Name() = 0;
+        
+        /**
+        * SaveWlanDataL
+        */    
+        virtual void SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb ) = 0;
+    
+        virtual void UpdateLingerL(const TUint32 aIapId) = 0;
+
+	protected: // New methods. Only for subclasses use.
+
+        /**
+        * Base constructor.
+        * @param aDefaultName The default name to use for an access point
+        */
+        CWPAPItemBase( const TDesC& aDefaultName );
+
+		/**
+		* Mark that this field has arrived and was correctly handled.
+		* @param aField received field enumeration
+		*/
+		void MarkReceived( TMarkedField aField );
+
+		/**
+		* Check has the given field been received.
+		* @param aField received field enumeration
+		* @return ETrue if the field has already been received and handled
+		*/
+		TBool IsReceived( TMarkedField aField );
+
+	protected:
+
+        /// The default name for an access point
+        const TDesC& iDefaultName;
+
+	private: // Data
+
+		/// Received fields marked here.
+		TUint32 iReceivedFieldsFlags;
+
+	private: // For testing.
+		friend class T_CWPAPItemBase;
+	};
+
+#endif	// CWPAPITEMBASE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPLogicalProxy.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002 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:     Defines a class, which holds logical proxy information.
+*
+*/
+
+
+
+
+
+#ifndef CWPAPLOGICALPROXY_H
+#define CWPAPLOGICALPROXY_H
+
+// INCLUDES
+
+#include <MWPVisitor.h>
+#include "CWPAPItemBase.h"
+#include <cmconnectionmethodext.h>
+
+// FORWARD DECLARATIONS
+
+class CWPAPPhysicalProxy;
+class CWPAPAccesspointItem;
+class CWPAPPort;
+
+// CLASS DECLARATION
+
+/**
+ * CWPAPLogicalProxy contains logical proxy data.
+ */ 
+class CWPAPLogicalProxy : public CWPAPItemBase, private MWPVisitor
+	{
+	public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aDefaultName The default name of an access point
+        * @param aCharacteristic The PXLOGICAL characteristic
+        */
+		static CWPAPLogicalProxy* NewLC( const TDesC& aDefaultName, 
+            CWPCharacteristic& aCharacteristic );
+
+        /**
+        * Destructor.
+        */
+		~CWPAPLogicalProxy();
+
+	public: // From CWPAPItemBase
+
+		TBool ValidateL();
+		void AddDataL( RCmConnectionMethodExt& aCmItem );
+        TInt AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
+            CWPAPItemBase* aLogicalProxy,
+            CWPAPItemBase* aPhysicalProxy );
+        const TDesC& Name();
+        void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {};
+
+        void UpdateLingerL(const TUint32 /*aIapId*/){};
+
+	private: // From CWPAPItemBase
+
+		void VisitL(CWPCharacteristic& aElement);		
+		void VisitL(CWPParameter& aElement);
+        void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {};
+
+	private: // New methods
+
+        /**
+        * C++ default constructor.
+        * @param aDefaultName The default name of an access point
+        */
+		CWPAPLogicalProxy( CWPCharacteristic& aCharacteristic,
+            const TDesC& aDefaultName );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+		void ConstructL();
+		
+	private: // Data
+
+		/// Pointer to data model parameter. Refs.
+		CWPParameter* iHomepage;
+
+		/// Pointer to data model parameter. Refs.
+		CWPParameter* iName;
+
+		/// Pointer to port object. Owns.
+		CWPAPPort* iPort;
+
+		/// Array of physical proxy objects. Owns.
+		RPointerArray<CWPAPPhysicalProxy> iPhysicalProxies;
+
+        /// Characteristic
+        CWPCharacteristic& iCharacteristic;
+
+	private: // For testing
+
+		friend class T_CWPAPLogicalProxy;
+		friend class T_CWPAPAdapter;
+		friend class T_WPAPTestUtils;
+	};
+
+#endif	// CWPAPLOGICALPROXY_H
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPNapdef.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,387 @@
+/*
+* Copyright (c) 2002-2006 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:     Class stores data for one accesspoint
+*
+*/
+
+
+
+
+
+#ifndef CWPAPNAPDEF_H
+#define CWPAPNAPDEF_H
+
+// INCLUDES
+#include <e32def.h>
+#include <e32std.h>
+#include <MWPVisitor.h>
+#include "CWPAPItemBase.h"
+#include "WPAPDefs.h"
+#include <cmconnectionmethodext.h>
+#include <cmplugindialcommondefs.h>
+#include <cmmanagerext.h>
+#include <etelpckt.h>
+
+// FORWARD DECLARATIONS
+class CWPAPPhysicalProxy;
+class CApAccessPointItem;
+class CWPParameter;
+class CCommsDatabase;
+class EAPSettings;
+class CertificateEntry;
+class RCmManagerExt;
+
+
+// CLASS DECLARATION
+
+/**
+ * CEapTypeElement is arrray element for several EapTypes  
+ */ 
+class CEapTypeElement: public CBase
+        {
+        public:
+        ~CEapTypeElement();
+        TBuf8<KExpandedEapIdLength> iEapTypeString;
+        TBuf8<KExpandedEapIdLength> iEncapsulatingExpandedEapId;
+        EAPSettings* iEAPSettings;
+        CertificateEntry* iCertificate;
+        };
+
+struct SECssID
+		{
+        CWPParameter* iSSSID;
+        CWPParameter* iSUSSID;
+		}; 
+/**
+ * CWPAPNapdef handles NAPDEF characteristics.
+ */ 
+class CWPAPNapdef : public CWPAPItemBase, private MWPVisitor
+	{
+	public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aFollowingLink ETrue if the NAPDEF was reached
+        *                       via a link.
+        * @param aDefaultName   The default name of an access point
+        * @param aLogicalCharacteristic The PXLOGICAL, if following a link from 
+        *                       there, or NAPDEF, if a direct link to NAPDEF.
+        * @param aLink          The NAPDEF characteristic
+        */
+		static CWPAPNapdef* NewLC( TBool aFollowingLink,
+                                   const TDesC& aDefaultName, 
+                                   CWPCharacteristic& aLogicalCharacteristic,
+                                   CWPCharacteristic& aLink );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CWPAPNapdef();
+
+	public: // From CWPAPItemBase
+
+		/**
+		* @precondition characteristic must be set otherwise Panics.
+		*/
+		TBool ValidateL();
+		
+        /**
+        * AddDataL
+        */     		
+		void AddDataL( RCmConnectionMethodExt& aCmItem );
+		
+        /**
+        * AddItemsL
+        */           
+        TInt AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
+                        CWPAPItemBase* aLogicalProxy,
+                        CWPAPItemBase* aPhysicalProxy );
+        /**
+        * Name
+        */
+        const TDesC& Name();
+    
+        /**
+        * SaveWlanDataL
+        */    
+        void SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb );
+
+        /**
+        * UpdateLingerL from the ItemBase
+        */    
+
+        void UpdateLingerL(const TUint32 aIapId);
+        
+        /**
+        * Set The Internet Parameter Indicator 
+        */
+        void SetInternetIndicator(TInt value);
+
+        /**
+        * Get The Internet Parameter Indicator 
+        */
+        TInt GetInternetIndicator();
+
+
+	private: // From MWPVisitor
+
+        /**
+        * VisitL
+        */   
+		void VisitL( CWPCharacteristic& aElement );		
+
+        /**
+        * VisitL
+        */   
+		void VisitL( CWPParameter& aElement );
+      
+        /**
+        * VisitLinkL
+        */   
+        void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {};
+
+	private:  // New functions
+
+		/**
+        * C++ default constructor.
+        * @param aFollowingLink ETrue if the NAPDEF was reached
+        *                       via a link.
+        * @param aDefaultName   The default name of an access point
+        * @param aLogicalCharacteristic The PXLOGICAL, if following a link from 
+        *                       there, or NAPDEF, if a direct link to NAPDEF.
+        */
+		CWPAPNapdef( TBool aFollowingLink,
+                     const TDesC& aDefaultName, 
+                     CWPCharacteristic& aLogicalCharacteristic );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+		void ConstructL();
+
+        /**
+        * Writes a DNS address in either IPv4 or IPv6 format
+        * to an access point item.
+        * @param aAPItem The access point item
+        * @param aValue The DNS address to write
+        */
+        void WriteDNSAddressL( RCmConnectionMethodExt& aCmItem,
+                               const TDesC& aValue );
+                               
+        /**
+        * AddWlanDataL
+        */            
+        void AddWlanDataL( RCmConnectionMethodExt& aCmItem );
+        
+        /**
+        * HandleWLanParameters
+        */            
+        void HandleWLanParametersL( CWPParameter& aParameter );
+        
+        void HandleEAPParametersCCL( CWPParameter& aParameter );
+        
+        /**
+        * ConvertAsciiToHex
+        */            
+        void ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest );
+        
+        /**
+        * StrCopy
+        */                    
+        void StrCopy( TDes8& aTarget, const TDesC& aSource );
+        
+        /**
+        * Add linger value
+        */                    
+        void AddLingerL( const TInt , const TInt );
+        
+        /**
+        * Update linger value	
+        */                    
+        void UdateligerValueL(CWPParameter* aLinger);
+        /**
+        * Isalpha	
+        */                    
+        TBool Notalpha(const TDesC& aValue);
+        /**
+        * CheckIPv4values	
+        */  
+        TBool CheckIPv4values(const TDesC& aValue );
+        
+        /**
+        * CheckAddressPart	
+        */  
+        TBool CheckAddressPart( TLex& aLex );
+        
+        /**
+        * ConvertEAPStringToIds
+        */  
+        void ConvertEAPStringToIds(const TDesC& aEAPString, TDes8& aExpandedId, TUint& aId);
+  public: // new function
+  
+        /**
+        * NapId value
+        */  
+        const TDesC& NapId();
+        /**
+        * Bearer value
+        */
+        TUint Bearer();
+        
+        /**
+        * SetCMManager
+        */
+        void SetCMManager( RCmManagerExt* aCm );
+
+	private: // Data (Total ownership is assumed unless otherwise stated)
+
+        enum TAPWEPKeyFormat
+            {
+            EAscii,                 // Ascii format
+            EHexadecimal            // Hex format
+            };
+        /// PXLOGICAL characteristic
+        CWPCharacteristic& iCharacteristic;
+
+        /// The human-readable name of the connection. Refs.
+		CWPParameter* iConnectionName; 
+
+        /// The access point address. Refs.
+		CWPParameter* iAccesspointName;
+
+        /// The access point address. Refs.
+		CWPParameter* iAccesspointNameType;
+
+        /// The user name. Refs.
+		CWPParameter* iUserName;
+
+        /// The password. Refs.
+		CWPParameter* iPassword;
+
+        /// The IP address of the phone. Refs.
+		CWPParameter* iPhoneIPAddress;
+
+        /// The network type of the access point. Refs.
+        CWPParameter* iIfNetworks;
+
+        /// Array of name servers. Refs.
+        RPointerArray<CWPParameter> iNameServers;
+
+        /// Number of IPv4 name servers found so far.
+        TInt iNumIPv4NameServers;
+
+        /// Number of IPv6 name servers found so far.
+        TInt iNumIPv6NameServers;
+
+        /// The bearer of the access point.
+        //TApBearerType iBearer;
+        TUint iBearer;
+        
+        // Received bearer was unsupported
+        TBool iBearerUnsupported;
+
+        /// The PDP type of a GPRS access point.
+        TUint32 iPdpType;
+
+        /// ETrue of secure authentication must be used.
+		TBool iSecureAuthentication;
+
+        /// ETrue if the user must be prompted for password.
+		TBool iPromptPassword;
+
+        /// ETrue if we arrived to NAPDEF via a link
+        TBool iFollowingLink;
+        
+//JMan for WLan        
+
+		// Is WLAN supported (queried from Feature Manager)
+        TBool iWlanSupported;
+        
+        // The Network Access Point ID.
+        CWPParameter* iNapID;
+        
+        // WLAN characteristic parameters
+        
+        // The Primary Service Set Identifier name.
+        CWPParameter* iPriSSID;
+        
+        // The Used Primary Service Set Identifier name.
+        CWPParameter* iPriUSSID;
+        
+        // The Hidden Primary Service Set Identifier name.
+        CWPParameter* iPriHSSID;
+        
+        //for secssid 
+        RPointerArray<SECssID> iSecSSID;
+        
+        
+        // The operation mode of the WLAN network.
+        TUint32 iNetMode;
+        
+        // The Security mode of the WLAN network.
+        TUint32 iSecMode;
+        
+        // The ascii formed pre-shared key.
+        CWPParameter* iWpaPresKeyAsc;
+                
+        // The wep authentication mode
+        CWPParameter* iWepAuthMode;
+        
+        // Indicates the default wepkey
+        TUint iDefaultWepKeyIndex;
+        
+        // WEPKEY characteristic parameters
+        
+        // The lenght of the wepkey
+        CWPParameter* iWepKeyLength;
+
+        // The index of the wepkey
+        TUint iWepInd;
+        
+        // The wepkey data
+        CWPParameter* iWepKeyData;
+        
+        // Type of authentication (EAuthOpen, EAuthShared)
+        TWEPAuthentication iAuthentication;
+
+        // Data of the key
+        TBuf8<KMaxLengthOfKeyData> iKeyData[KMaxNumberofKeys];
+        
+        // Format of the key
+        TAPWEPKeyFormat iKeyFormat[KMaxNumberofKeys];
+        
+        RPointerArray<CEapTypeElement> iEapTypeArray;      
+        
+		// Pointer to Linger value parameter. Refs.
+		CWPParameter*   iLinger;
+
+		//linger value
+		TUint iLingerValue;
+		TBool iLingerFlag;
+		
+		// Pointer to the used CMManager, needed to save WLAN data
+		RCmManagerExt* iCm;
+		
+		//Internet parameter Indicator
+    TInt iInternetIndicator;
+
+	private: // For testing usage.
+		friend class T_CWPAPNapdef;
+		friend class T_CWPAPAdapter;
+		friend class T_WPAPTestUtils;
+	};
+
+#endif	// CWPAPNAPDEF_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPhysicalProxy.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2002 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:     Defines a class, which holds physical proxy information.
+*
+*/
+
+
+
+
+
+#ifndef CWPAPPHYSICALPROXY_H
+#define CWPAPPHYSICALPROXY_H
+
+// INCLUDES
+
+#include <MWPVisitor.h>
+#include "CWPAPItemBase.h"
+#include <cmconnectionmethodext.h>
+
+// DATA TYPES
+
+enum TWPAPPxAddrType
+	{
+	EPxAddrTypeIPv4 = 1,
+    EPxAddrTypeIPv6,
+	EPxAddrTypeUnsupported // (IPv6, E164, ALPHA are not supported)
+	};
+
+// FORWARD DECLARATIONS
+
+class CWPAPLogicalProxy;
+class CWPAPPort;
+class CWPAPNapdef;
+
+// CLASS DECLARATION
+
+/**
+ * CWPAPPhysicalProxy contains physical proxy information
+ */ 
+class CWPAPPhysicalProxy : public CWPAPItemBase, private MWPVisitor
+	{
+	public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+		* @param aDefaultName The default name of an access point
+        * @param aCharacteristic The PXPHYSICAL characteristic.
+        * @param aPort Reference to a pointer containing PORT of a PXLOGICAL.
+        */
+		static CWPAPPhysicalProxy* NewLC( const TDesC& aDefaultName, 
+            CWPCharacteristic& aCharacteristic, 
+            CWPCharacteristic& aLogicalCharacteristic,
+            CWPAPPort*& aPort );
+
+        /**
+        * Destructor.
+        */
+		~CWPAPPhysicalProxy();
+
+	public: // From CWPAPItemBase
+
+		TBool ValidateL();
+		void AddDataL( RCmConnectionMethodExt& aCmItem );
+        TInt AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
+            CWPAPItemBase* aLogicalProxy,
+            CWPAPItemBase* aPhysicalProxy  );
+        const TDesC& Name();
+        void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {};
+        void UpdateLingerL(const TUint32 /*aIapId*/){};
+
+	private: // From CWPAPItemBase. Override default implementation.
+
+		void VisitL( CWPCharacteristic& aElement );		
+		void VisitL( CWPParameter& aElement );	
+		void VisitLinkL( CWPCharacteristic& aCharacteristic );
+
+	private:  // New functions
+
+        /**
+        * C++ default constructor.
+		* @param aDefaultName The default name of an access point
+        * @param aPort Reference to a pointer containing PORT of a PXLOGICAL.
+        */
+		CWPAPPhysicalProxy( const TDesC& aDefaultName, 
+            CWPCharacteristic& aLogicalCharacteristic,
+            CWPAPPort*& aPort );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+		void ConstructL();
+		
+	private: // Data
+
+		/// Pointer to data model parameter. Refs.
+		CWPParameter* iProxyAddr;
+
+        /// Pointer to data model parameter. Refs.
+        CWPParameter* iName;
+
+		/// Proxy address type
+		TWPAPPxAddrType iPxAddrType;
+
+		/// Pointer to port object. Owns.
+		CWPAPPort* iPort;
+
+        /// Pointer to port object owned by logical proxy. Refs.
+        CWPAPPort*& iLogicalPort;
+
+        /// Napdefs linked to by PXPHYSICAL
+        RPointerArray<CWPAPNapdef> iNapdefs;
+
+        /// Pointer to characteristic
+        CWPCharacteristic& iLogicalCharacteristic;
+
+	private: // For testing
+
+		friend class T_CWPAPLogicalProxy;
+		friend class T_CWPAPAdapter;
+		friend class T_WPAPTestUtils;
+	};
+
+#endif	// CWPAPPHYSICALPROXY_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPort.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2002 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:     Defines a class, which holds proxy port information.
+*
+*/
+
+
+
+
+
+#ifndef CWPAPPORT_H
+#define CWPAPPORT_H
+
+// INCLUDES
+
+#include <MWPVisitor.h>
+#include "CWPAPItemBase.h"
+
+// FORWARD DECLARATIONS
+
+class CApAccessPointItem;
+
+// CLASS DECLARATION
+
+/**
+ * CWPAPPort contains port information
+ */ 
+class CWPAPPort : public CWPAPItemBase, private MWPVisitor
+	{
+	public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aCharacteristic The PORT characteristic
+        */
+		static CWPAPPort* NewLC( CWPCharacteristic& aCharacteristic );
+
+        /**
+        * Destructor.
+        */
+		virtual ~CWPAPPort();
+
+	public: // From CWPAPItemBase 
+
+		TBool ValidateL();
+		void AddDataL( RCmConnectionMethodExt& aCmItem ); //CMManager
+        TInt AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
+                        CWPAPItemBase* aLogicalProxy,
+                        CWPAPItemBase* aPhysicalProxy );
+        const TDesC& Name();
+        void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {};
+        void UpdateLingerL(const TUint32 /*aIapId*/){};
+
+	private: // From MWPVisitor
+
+		void VisitL(CWPCharacteristic& aCharacteristic);
+		void VisitL(CWPParameter& aParameter);
+        void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {};
+		
+	private:  // New functions
+		
+        /**
+        * Constructor.
+        */
+		CWPAPPort();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+		void ConstructL();
+		
+		/**
+		* Helper method to set the internal values.
+		* @param aConnectionSecurity sets value for iConnectionSecurity.
+		* @param aSessionMode sets value for iSessionMode.
+		* @param aReceivedField marks the field as received
+		*/
+		void SetValues( TBool aConnectionSecurity, 
+			            TInt aSessionMode,
+			            TMarkedField aReceivedField );
+
+	private:  // Data
+
+        /// ETrue if secure connection should be established
+		TBool           iConnectionSecurity;
+        /// Session mode for WAP connections: connection oriented/less.
+		TInt            iSessionMode;
+		/// Pointer to port number parameter. Refs.
+		CWPParameter*   iPortNbr;
+
+	private:
+		friend class T_CWPAPProxyData;
+		friend class T_CWPAPAdapter;
+		friend class T_WPAPTestUtils;
+	};
+
+#endif // CWPAPPORT_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/ProvisioningDebug.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2005 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 defines logging macros for Provisioning
+*
+*/
+
+
+
+
+
+
+#ifndef PROVISIONINGDEBUG_H
+#define PROVISIONINGDEBUG_H
+
+#include <e32debug.h> 
+#include <f32file.h>
+
+//Examples
+//FLOG( _L( "[Provisioning] ProvisioningEngine::ConstructL:" ) );
+//FTRACE(RDebug::Print(_L("[Provisioning] ProvisioningEngine::ConstructL: err (%d)"), err));
+#ifdef _DEBUG
+
+const TInt KBTHexDumpWidth=16;
+const TInt KBTLogBufferSize=100;
+const TText KFullStopChar='.';
+
+_LIT(KBTFirstFormatString,"%04x: ");
+_LIT(KBTSecondFormatString,"%02x ");
+_LIT(KBTThirdFormatString,"%c");
+_LIT(KBTThreeSpaces,"   ");
+_LIT(KBTSeparator," ");
+
+inline void HexDump(const TUint8* aPtr, TInt aLen)
+    {
+	if( aPtr != NULL )
+	    {
+    	TBuf<KBTLogBufferSize> line;
+	    TInt i = 0;
+
+    	while (aLen>0)
+    		{
+    		TInt n = (aLen>KBTHexDumpWidth ? KBTHexDumpWidth : aLen);
+    		line.AppendFormat(KBTFirstFormatString,i);
+    		TInt j;
+    		for (j=0; j<n; j++)
+    			line.AppendFormat(KBTSecondFormatString,aPtr[i+j]);
+    		while (j++<KBTHexDumpWidth)
+    			line.Append(KBTThreeSpaces);
+    		line.Append(KBTSeparator);
+    		for (j=0; j<n; j++)
+    			line.AppendFormat(KBTThirdFormatString,(aPtr[i+j]<32 || aPtr[i+j]>126 || aPtr[i+j]==37) ? KFullStopChar : aPtr[i+j]);
+
+    		RDebug::Print(line);
+
+            line.Zero();
+    		aLen-=n;
+    		i+=n;
+    	    }
+        }
+    }
+
+
+// ------------------------------------------
+
+inline void FHex(const TUint8* aPtr, TInt aLen)
+    {
+    HexDump( aPtr, aLen );
+    }
+
+// ------------------------------------------
+
+inline void FHex(const TDesC8& aDes)
+    {
+	RFs fs;
+	RFile file;
+	_LIT( TmpOutputName, "C:\\provisioning.wbxml" );
+	fs.Connect();
+	CleanupClosePushL(fs);
+	//if( aFile.Open(aFileSession, TmpOutputName(), EFileShareAny|EFileWrite) == KErrNone )
+	file.Replace(fs, TmpOutputName(), EFileShareAny|EFileWrite);
+	CleanupClosePushL(file);
+	TInt pos(0);
+	file.Seek(ESeekEnd, pos);
+//	HBufC8* tmp = HBufC8::NewLC(line.Size());
+//	TPtr8 ptr = tmp->Des();
+//	ptr.Copy(line);
+	TInt result = file.Write(aDes);
+	CleanupStack::PopAndDestroy(2); // file,  fs
+///////////////////////////////////////////////////
+
+//    HexDump(aDes.Ptr(), aDes.Length());
+    }
+
+// ===========================================================================
+#ifdef __WINS__     // File logging for WINS
+// ===========================================================================
+#include <e32std.h>
+#include <f32file.h>
+#include <flogger.h>
+
+_LIT( KLogFile, "Provisioning.log" );
+_LIT( KLogDirFullName, "c:\\logs\\" );
+_LIT( KLogDir, "Provisioning" );
+
+#define FLOG( a )   { FPrint(a); }
+#define FTRACE( a ) { a; }
+
+// Declare the FPrint function
+//
+inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    RFileLogger::WriteFormat( KLogDir,
+                              KLogFile,
+                              EFileLoggingModeAppend,
+                              aFmt,
+                              list );
+    }
+
+// ===========================================================================
+#else               // RDebug logging for target HW
+// ===========================================================================
+/*#include <e32svr.h>
+
+#define FLOG( a )   { RDebug::Print( a ); }
+#define FTRACE( a ) { a; }
+
+*/
+
+//////////////MIKA///////////////
+#include <e32std.h>
+#include <f32file.h>
+#include <flogger.h>
+
+_LIT( KLogFile, "Provisioning.log" );
+_LIT( KLogDirFullName, "c:\\logs\\" );
+_LIT( KLogDir, "Provisioning" );
+
+#define FLOG( a )   { FPrint(a); }
+#define FTRACE( a ) { a; }
+
+// Declare the FPrint function
+//
+inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    RFileLogger::WriteFormat( KLogDir,
+                              KLogFile,
+                              EFileLoggingModeAppend,
+                              aFmt,
+                              list );
+    }
+
+//////////////MIKA///////////////
+
+
+#endif //__WINS__
+
+// ===========================================================================
+#else // // No loggings --> Reduced binary size
+// ===========================================================================
+#define FLOG( a )
+#define FTRACE( a )
+
+#endif // _DEBUG
+
+///////// Kailash ///////////////////////
+inline void LOGX(TInt aSource)
+	{
+		HBufC *iMyBufNumber = HBufC::NewLC(255);
+   		TPtr bufNumberPtr(iMyBufNumber->Des());
+   		bufNumberPtr.FillZ();
+   		bufNumberPtr.AppendFormat(_L("%d"),aSource);
+    	FLOG(iMyBufNumber->Des());
+    	CleanupStack::PopAndDestroy();
+	}
+///////// Kailash ///////////////////////
+	
+#endif      // PROVISIONINGDEBUG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/WPAPAdapter.pan	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2002 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:    Panic codes for Provisioning accesspoint adapter
+*
+*/
+
+
+
+
+
+#ifndef WPAPADAPTER_PAN
+#define WPAPADAPTER_PAN
+
+enum TWPAPAdapterPanicCodes
+    {
+	EDebugCode = 1000,
+	EIllegalCharacteristic,
+	EIllegalState,
+	EIndexOutOfBounds,
+	ENullPointer,
+	EPreConditionFail,
+	EPostConditionFail, 
+	ESaveOperationAlreadyActive,
+	ENoUniqueNameResolved
+    };
+
+GLDEF_C void Panic( TInt aPanic );
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/WPAPDefs.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2005-2006 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:     Definitions to WPAPAdapter
+*
+*/
+
+
+
+
+
+#ifndef WPAPDEFS_H
+#define WPAPDEFS_H
+
+#include <e32base.h>
+
+// CONSTANTS
+
+const TUint32 KMaxWEPKeyLength = 29;
+// The maximum WPA Pre-Shared Key length.
+const TUint KMaxWpaPskLength = 63;
+// same as connection name max length in Prov req.
+const TInt KNameMaxLength = 30;
+const TInt KTwoNameServersPerNetworkType = 2;
+// The maximum length of key data
+const TUint KMaxLengthOfKeyData = 58;
+const TUint KMaxLengthOfEapList = 50;
+const TUint KExpandedEapIdLength = 8;
+// Number of keys
+const TUint KMaxNumberofKeys = 4;
+
+const TInt KInitialArraySize = 3;
+
+const TUint KMaxSubKeyLenght = 255;
+
+_LIT(KIPV4, "IPV4");
+_LIT(KIPV6, "IPV6");
+_LIT(KCLWSP, "CL-WSP");
+_LIT(KCOWSP, "CO-WSP");
+_LIT(KCLSECWSP, "CL-SEC-WSP");
+_LIT(KCOSECWSP, "CO-SEC-WSP");
+_LIT(K9200, "9200");
+_LIT(K9201, "9201");
+_LIT(K9202, "9202");
+_LIT(K9203, "9203");
+_LIT(K80, "80");
+_LIT(K8080, "8080");
+_LIT(K443, "443");
+
+_LIT(KGSMGPRS, "GSM-GPRS");
+
+//Characteristic WLAN
+_LIT(KWLAN, "WLAN");
+_LIT(PRISSID, "PRI-SSID");
+_LIT(PRIUSSID, "PRI-U-SSID");
+_LIT(PRIHSSID, "PRI-H-SSID");
+
+//Characteristic WLAN/SEC-SSID
+_LIT(SECSSID, "SEC-SSID");
+_LIT(SSSID, "S-SSID");
+_LIT(SUSSID, "S-U-SSID");
+
+_LIT(NETMODE, "NETMODE");
+_LIT(SECMODE, "SECMODE");
+
+//Characteristic WLAN/EAP
+_LIT(KEAP, "EAP");
+_LIT(EAPTYPE, "EAPTYPE");
+_LIT(EAPUSERNAME, "USERNAME");
+_LIT(EAPPASSWORD, "PASSWORD");
+_LIT(EAPREALM, "REALM");
+_LIT(EAPUSEPSEUD, "USE-PSEUD");
+_LIT(EAPMAXAUTHS, "MAXAUTHS");
+_LIT(EAPENCAPS, "ENCAPS");
+_LIT(EAPVERSERREALM, "VER-SER-REALM");
+_LIT(EAPCLIENTHAUTH, "CLIENTH-AUTH");
+_LIT(EAPSESVALTIME, "SES-VAL-TIME");
+_LIT(EAPCIPSUIT, "CIP-SUIT");
+_LIT(EAPPEAPV0, "PEAP-V0");
+_LIT(EAPPEAPV1, "PEAP-V1");
+_LIT(EAPPEAPV2, "PEAP-V2");
+
+//Characteristic WLAN/EAP/CERT
+_LIT(KCERT, "CERT");
+_LIT(EAPISSNAME, "ISS-NAME");
+_LIT(EAPSUBNAME, "SUB-NAME");
+_LIT(EAPCERTTYPE, "CERT-TYPE");
+_LIT(EAPSERNUM, "SER-NUM");
+_LIT(EAPSUBKEYID, "SUB-KEY-ID");
+_LIT(EAPTHUMBPRINT, "THUMBPRINT");
+
+_LIT(EAPCERTUSER, "USER");
+_LIT(EAPCERTCA, "CA");
+
+_LIT(WPAPRESKEYASC, "WPA-PRES-KEY-ASC");
+_LIT(WPAPRESKEYHEX, "WPA-PRES-KEY-HEX");
+_LIT(DEFAULTWEPIND, "WEPKEYIND");
+_LIT(WEPAUTHMODE, "WEPAUTHMODE");
+
+//Characteristic WLAN/WEPKEY
+_LIT(KWEP, "WEPKEY");
+_LIT(WEPKEYLENGTH, "LENGTH");
+_LIT(WEPKEYINDEX, "INDEX");
+_LIT(WEPKEYDATA, "DATA");
+
+_LIT(KPAP, "PAP");
+_LIT(KCHAP, "CHAP");
+_LIT(KMD5, "MD5");
+_LIT(KANALOGMODEM, "ANALOG-MODEM");
+_LIT(KV110, "V.110");
+_LIT(KV120, "V.120");
+_LIT(KAUTOBAUDING, "AUTOBAUDING");
+_LIT(K9600, "9600");
+_LIT(K14400, "14400");
+_LIT(K19200, "19200");
+_LIT(K28800, "28800");
+_LIT(K38400, "38400");
+_LIT(K43200, "43200");
+_LIT(KIPv6, "IPv6");
+_LIT(KIPv4, "IPv4");
+_LIT(KAddrTypeE164, "E164");
+_LIT(KAddrTypeAPN, "APN");
+
+_LIT(KADHOC, "ADHOC");
+
+_LIT(KWEPSEC, "WEP");
+_LIT(KWPASEC, "WPA");
+_LIT(KWPA2SEC, "WPA2");
+_LIT(K8021XSEC, "8021X");
+_LIT(KWPAPRESSEC, "WPA-PRESHARED-KEY");
+_LIT(KWPA2PRESSEC, "WPA2-PRESHARED-KEY");
+
+
+_LIT(KEAPSIM, "EAP-SIM");
+_LIT(KEAPAKA, "EAP-AKA");
+_LIT(KEAPTLS, "EAP-TLS");
+_LIT(KEAPPEAP, "EAP-PEAP");
+_LIT(KEAPTTLS, "EAP-TTLS");
+_LIT(KEAPLEAP, "EAP-LEAP");
+_LIT(KEAPMSCHAPV2, "EAP-MSCHAPV2");
+_LIT(KEAPGTC, "EAP-GTC");
+_LIT(KEAPFAST, "EAP-FAST");
+
+/*
+_LIT8(KEapNone,"0");
+_LIT8(KEapGtc,"6");
+_LIT8(KEapTls, "13"); 
+_LIT8(KEapLeap,"17");
+_LIT8(KEapSim,"18");
+_LIT8(KEapTtls,"21");
+_LIT8(KEapAka,"23");
+_LIT8(KEapPeap,"25");
+_LIT8(KEapMschapv2,"26");
+_LIT8(KEapSecurid,"32");
+_LIT8(KEapFast,"43");
+*/
+_LIT8(KEapAll,"-017,-018,-023,-013,-025,-021,-043" );
+
+const TUint8 KEapNoneId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+const TUint8 KEapTlsTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d};
+const TUint8 KEapGtcTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06};
+const TUint8 KEapLeapTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11};
+const TUint8 KEapSimTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12};
+const TUint8 KEapTtlsTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15};
+const TUint8 KEapAkaTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17};
+const TUint8 KEapPeapTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19};
+const TUint8 KEapMschapv2TypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A};
+const TUint8 KEapSecuridTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20};
+const TUint8 KEapFastTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B};
+
+
+const TUint8 KEapPlus = '+'; 
+
+_LIT(KWEPAUTHMODEOPEN, "OPEN");
+_LIT(KWEPAUTHMODESHARED, "SHARED");
+
+enum TWEPAuthentication
+    {
+    EAuthOpen,              // Open authentication
+    EAuthShared             // Shared authentication
+    };
+    
+// DATA TYPES
+
+/**
+* Data structure for storing a WEP key.
+*/
+struct TWep
+    {
+    /** Specifies which key to add or remove. Range: 0-3 */
+    TUint32 KeyIndex;
+    /** The length of KeyMaterial in bytes. Range: 0-29 */
+    TUint32 KeyLength;
+    /** Array that stores the WEP key. */
+    TUint8 KeyMaterial[KMaxWEPKeyLength];
+    };
+
+/**
+* Data structure for storing a WPA Pre-Shared Key.
+*/
+struct TWpaPsk
+	{
+	/** The length of KeyMaterial in bytes. Range: 0-63 */
+	TUint KeyLength;
+	/** Array of that stores the WPA Pre-Shared Key. */
+	TUint8 KeyMaterial[KMaxWpaPskLength];
+	};
+
+
+
+#endif // WPAPDEFS_H
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/WPAPSharedDataKeys.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2002 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:     Shared data keys for operator AP settings
+*
+*/
+
+
+
+
+
+#ifndef WPAPSHAREDDATAKEYS_H
+#define WPAPSHAREDDATAKEYS_H
+
+// CONSTANTS
+
+// -----------------------------------------------------------------------------
+// AP Operator setting 0x101F466B
+// -----------------------------------------------------------------------------
+
+const TUid KSDUidOperatorSettings = {0x101F466B};
+
+/**
+* Modification of locked APs via OTA allowed 
+*
+* Possible values:
+* 0 (no)
+* 1 (yes)
+*
+* Default value: 0
+**/
+_LIT( KOsOtaModificationAllowed, "A" );
+
+#endif // WPAPSharedDataKeys_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Inc/WPAPUtil.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002 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:     Class offers common utility methods.
+*
+*/
+
+
+
+
+
+#ifndef WPAPUTIL_H
+#define WPAPUTIL_H
+
+// INCLUDES
+
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+ * WPAPUtil offers common helper methods.
+ */ 
+class WPAPUtil
+	{
+	public: // New methods
+
+		/**
+		* Loads a specified resource string from resource file.
+		* @param aResourceId is of a resource string.
+		* @return pointer to loaded descriptor.
+		*/
+		static HBufC* ReadHBufCL( TInt aResourceId );
+
+	};
+
+#endif // WPAPUTIL_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPAccesspointItem.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,320 @@
+/*
+* Copyright (c) 2002 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:   Class stores data for one accesspoint
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CWPAPAccesspointItem.h"		// Own header
+
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+#include <CWPAdapter.h>
+
+
+#include <bldvariant.hrh>
+#include <featmgr.h>					// Feature manager
+#include <CWPAdapter.h>					// Leave code for protected	
+#include "CWPAPItemBase.h"
+#include "CWPAPNapdef.h"
+#include "WPAPAdapter.pan"
+#include "ProvisioningDebug.h"
+#include <cmconnectionmethodext.h>
+#include <cmmanagerext.h>
+#include <cmpluginpacketdatadef.h> 
+#include <cmpluginwlandef.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::NewLC
+// -----------------------------------------------------------------------------
+CWPAPAccesspointItem* CWPAPAccesspointItem::NewLC(
+                                            const TDesC& aDefaultName,
+                                            CWPAPItemBase* aLogicalProxy,
+                                            CWPAPItemBase* aPhysicalProxy,
+                                            CWPAPItemBase* aNapdef,
+                                            CWPCharacteristic& aCharacteristic )
+	{
+	CWPAPAccesspointItem* self = 
+                        new(ELeave) CWPAPAccesspointItem( aDefaultName, 
+                                                          aLogicalProxy,
+                                                          aPhysicalProxy,
+                                                          aNapdef,
+                                                          aCharacteristic ); 
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+CWPAPAccesspointItem::~CWPAPAccesspointItem()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::Name
+// -----------------------------------------------------------------------------
+//
+const TDesC& CWPAPAccesspointItem::Name() const
+	{
+	if ( iLogicalProxy && iLogicalProxy->Name() != KNullDesC )
+        {
+        return iLogicalProxy->Name();
+		}
+    else if( iPhysicalProxy && iPhysicalProxy->Name() != KNullDesC )
+        {
+        return iPhysicalProxy->Name();
+        }
+    else if( iNapdef && iNapdef->Name() != KNullDesC )
+        {
+        return iNapdef->Name();
+        }
+	else
+		{
+		return iDefaultName;
+		}
+	}
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::NapDef
+// -----------------------------------------------------------------------------
+//
+CWPAPItemBase* CWPAPAccesspointItem::NapDef()
+	{
+	return iNapdef;
+	}
+	
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::SetCMManager
+// -----------------------------------------------------------------------------
+//
+void CWPAPAccesspointItem::SetCMManager( RCmManagerExt* aCm )
+	{
+	iCmManager = aCm;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::Characteristic
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPAccesspointItem::Characteristic()
+	{
+	return iCharacteristic.Type();
+	}
+	
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::SaveL
+// -----------------------------------------------------------------------------
+//
+TUint32 CWPAPAccesspointItem::SaveL( CCommsDatabase& aCommsDb )
+	{
+	FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::SaveL:" ) );
+	
+	if ( FeatureManager::FeatureSupported( KFeatureIdSettingsProtection ) )
+		{
+		// This protection check is no longer needed since CMManager 
+		// initiates the transactions to the database
+		/*if( CApProtHandler::IsTableProtectedL( &aCommsDb ) )
+			{
+			// Table protected -> leave with specific code.
+			User::Leave( EWPAccessPointsProtected );
+			}*/	
+		}
+
+	  TUint32 iap = 0;
+    TRAPD( err,iap = StoreL( aCommsDb ) );
+    if( err == KErrLocked )
+        {
+        err = EWPCommsDBLocked;
+        }
+    User::LeaveIfError( err );
+    return iap;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::StoreL
+// -----------------------------------------------------------------------------
+//
+TUint32 CWPAPAccesspointItem::StoreL( CCommsDatabase& aCommsDb )
+	{
+	FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL:" ) );
+    
+    // CMManager
+    // Create the cmIten, give the bearer as parameter if it is available
+    RCmConnectionMethodExt cmItem;
+    TBool created = EFalse;
+    TUint bearer;
+    TInt err(KErrNone);
+    
+    // If the NapDef object exists and the bearer is defined, then we can
+    // create the connection method using the bearer
+    if ( iNapdef != NULL )
+    	{
+    	bearer = static_cast<CWPAPNapdef*>(iNapdef)->Bearer();
+    	if ( bearer != 0 )
+    		{
+    		cmItem = iCmManager->CreateConnectionMethodL(bearer);
+    		created = ETrue;
+    		}
+    	}
+    	
+    // If the bearer id is not known we will use packet data
+    if ( !created)
+    	{
+    	cmItem = iCmManager->CreateConnectionMethodL(KUidPacketDataBearerType);
+    	}
+    // Create the connection method into the DB
+    TRAP( err,cmItem.UpdateL() );
+    // Leave if the creation fails for some reason
+    if(err!=KErrNone)
+		{
+       	User::Leave(err);
+       	}
+       
+    if( iNapdef )
+        {
+        FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: napdef" ) );
+        
+        // CMManager 
+        TRAP (err, iNapdef->AddDataL( cmItem ));
+       	TRAP ( err,cmItem.UpdateL() );
+       	// Leave if the update of the parameters fails
+    	if(err!=KErrNone)
+			{
+       		User::Leave(err);
+       		}
+        }
+        
+    if( iLogicalProxy )
+        {
+        FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: logicalproxy" ) );
+        // CMManager 
+        iLogicalProxy->AddDataL( cmItem );
+        TRAP( err,cmItem.UpdateL() );
+        // Leave if the update of the parameters fails
+    	if(err!=KErrNone)
+			{
+       		User::Leave(err);
+       		}
+        }
+
+    if( iPhysicalProxy )
+        {
+        FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: physicalproxy" ) );
+        // CMManager 
+        iPhysicalProxy->AddDataL( cmItem );
+        TRAP( err,cmItem.UpdateL() );
+        // Leave if the update of the parameters fails
+    	if(err!=KErrNone)
+			{
+       		User::Leave(err);
+       		}
+        }
+
+    FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: cmItem.UpdateL" ) );
+    
+    // CMManager
+    iUid = cmItem.GetIntAttributeL( CMManager::ECmWapId );
+    
+    TInt test( KErrNone );
+    // Update parameter data to CM
+    TRAP( test,cmItem.UpdateL() );
+    FTRACE(RDebug::Print(_L("[AccessPointAdapter] CWPAPAccesspointItem::StoreL: UpdateL err: %d"), test ));
+    
+    TUint32 cmId = cmItem.GetIntAttributeL( CMManager::ECmId ); 
+    cmItem.Close();
+    
+	if( iNapdef )
+    	{
+		iNapdef->UpdateLingerL(iUid());
+    	}
+       
+
+    FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: SaveWlanDataL" ) );
+    if( iNapdef )
+        { 
+        // Give CMManager pointer and save WLAN data
+		static_cast<CWPAPNapdef*>(iNapdef)->SetCMManager( iCmManager );
+        iNapdef->SaveWlanDataL( cmId, aCommsDb );
+        }
+    
+    
+    TInt i( 0 );
+    TPtrC8 data( iCharacteristic.Data(i) );
+    while( data != KNullDesC8 )
+        {
+        i++;
+        data.Set( iCharacteristic.Data(i) );
+        }
+        
+    iCharacteristic.SetDataL( iUid, i );
+    
+    FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: done" ) );
+    return iUid();
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::Uid
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CWPAPAccesspointItem::Uid() const
+	{
+    return iUid;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::DeleteUidData
+// -----------------------------------------------------------------------------
+//
+void CWPAPAccesspointItem::DeleteUidData() const
+	{
+    iCharacteristic.DeleteAllData();
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::CWPAPAccesspointItem
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPAPAccesspointItem::CWPAPAccesspointItem( const TDesC& aDefaultName,
+                                            CWPAPItemBase* aLogicalProxy,
+                                            CWPAPItemBase* aPhysicalProxy,
+                                            CWPAPItemBase* aNapdef,
+                                            CWPCharacteristic& aCharacteristic )
+                                        : iDefaultName( aDefaultName ),
+                                          iNapdef( aNapdef ),
+                                          iPhysicalProxy( aPhysicalProxy ),
+                                          iLogicalProxy( aLogicalProxy ),
+                                          iCharacteristic( aCharacteristic )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAccesspointItem::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPAPAccesspointItem::ConstructL()
+	{
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPAdapter.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,452 @@
+/*
+* Copyright (c) 2002 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:   Main class for handling provisioning accesspoint data
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CWPAPAdapter.h"			// Own header
+
+#include <CWPCharacteristic.h>
+#include <commdb.h>
+#include <WPAPAdapterResource.rsg>
+#include <featmgr.h>					// Feature manager
+#include "WPAPUtil.h"
+#include "CWPAPAccesspointItem.h"
+#include "CWPAPNapdef.h"
+#include "CWPAPLogicalProxy.h"
+#include "WPAPAdapter.pan"
+#include "CWPLog.h"
+#include "ProvisioningDebug.h"
+#include "WPAPDefs.h"
+#include <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+#include <WPAdapterUtil.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::CWPAPAdapter
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPAPAdapter::CWPAPAdapter() : CWPAdapter(), 
+                               iLinks( KInitialArraySize ), 
+                               iDataItems( KInitialArraySize ), 
+                               iSaveItems( KInitialArraySize )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPAPAdapter::ConstructL()
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::ConstructL:" ) );
+	
+	iTitle = WPAPUtil::ReadHBufCL( R_QTN_SM_WML_ACCESSPOINTS );
+	iDefaultName = WPAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME );
+
+	FeatureManager::InitializeLibL();
+	
+	iCmManager = new RCmManagerExt;
+	iCmManager->OpenL();
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPAPAdapter* CWPAPAdapter::NewL()
+	{
+	CWPAPAdapter* self = new(ELeave) CWPAPAdapter; 
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+CWPAPAdapter::~CWPAPAdapter()
+	{
+	// Contents of iLinks array are not owned
+    iLinks.Close();
+
+    iDataItems.ResetAndDestroy();
+    iDataItems.Close();
+
+    iSaveItems.ResetAndDestroy();
+    iSaveItems.Close();
+    iAPValue.Reset();
+
+	delete iTitle;
+    delete iDefaultName;
+	delete iCommsDb;
+	
+	if ( iCmManager !=  NULL )
+	    {
+	    iCmManager->Close();
+	    delete iCmManager;
+	    }
+	
+    FeatureManager::UnInitializeLib();
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::ItemCount
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPAdapter::ItemCount() const
+	{
+	LOG1("Number of Access points: %d", iSaveItems.Count() );
+	return iSaveItems.Count();
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::SummaryTitle
+// -----------------------------------------------------------------------------
+//
+const TDesC16& CWPAPAdapter::SummaryTitle(TInt aIndex) const
+	{
+	__ASSERT_DEBUG( aIndex >= 0 && aIndex < iSaveItems.Count(), 
+		Panic( EIndexOutOfBounds ));
+	// The title is always the same.
+	return *iTitle;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::SummaryText
+// -----------------------------------------------------------------------------
+//
+const TDesC16& CWPAPAdapter::SummaryText(TInt aIndex) const
+	{
+	__ASSERT_DEBUG( aIndex >= 0 && aIndex < iSaveItems.Count(), 
+		Panic( EIndexOutOfBounds ));
+	return iSaveItems[ aIndex ]->Name();
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::DetailsL
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/)
+	{
+	// Detail view is a feature for later release.
+	return KErrNotSupported;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::SaveL
+// -----------------------------------------------------------------------------
+//
+void CWPAPAdapter::SaveL( TInt aItem )
+	{
+    FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::SaveL:" ) );
+
+	__ASSERT_DEBUG(aItem >= 0 &&
+		aItem < iSaveItems.Count(), 
+		Panic( EPreConditionFail ));
+
+    TBool internetparmfound = EFalse;
+    TInt err1;
+
+    for (TInt i = 0; i < iAPValue.Count(); i++)
+        {
+        if (aItem == iAPValue[i])
+            {
+            internetparmfound = ETrue;
+            break;
+            }
+
+        }
+
+	// Create the commsdb when the save is initiated first time.
+	// This stays alive until the adapter is destroyed.
+	if ( !iCommsDb )
+		{
+		iCommsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
+		}
+
+    if( iAlreadySavedOnce && aItem == 0 )
+        {
+        for( TInt i( 0 ); i < iSaveItems.Count(); i++ )
+            {
+            iSaveItems[i]->DeleteUidData();
+            }
+        }
+    
+    // ********************************************************************************** //            	
+    // ***** check that the napdefs with a certain id are only saved once SKSS-79REKH *** //
+    // ********************************************************************************** //
+    TBool found = EFalse;
+    if (iSaveItems[ aItem ]->Characteristic() == KWPNapDef)
+    	{
+    	
+    	// Get the napdef pointer from the saved items and check that it is not NULL
+    	CWPAPNapdef* napdef = static_cast<CWPAPNapdef*>(iSaveItems[ aItem ]->NapDef());
+
+    	if ( napdef )
+        	{
+        	// Store the id of the NAP that is being saved now
+        	TBufC<KNameMaxLength> napId = napdef->NapId();
+        
+        	// check whether napdef with same id has been already saved.
+        	for ( TInt j( 0 ); j < aItem; j++ )
+        	    {
+        	    // If a napdef is not in question we can move to the next item
+        	    if ( iSaveItems[ j ]->Characteristic() != KWPNapDef)
+        	   		{
+        	    	continue;
+        	    	}
+        	    	
+        	    // Store the pointer to to comparison napdef and make the nap id check if
+        	    // the pointer is other than NULL
+        	    CWPAPNapdef* tmpNap = static_cast<CWPAPNapdef*>(iSaveItems[ j ]->NapDef());
+        	    
+        	    if ( tmpNap != NULL )
+        	        {
+        	        // If the id was found, the napdef with this id is already stored
+        	        if ( tmpNap->NapId() == napId )
+        	        	{
+        	        	found = ETrue;
+        	        	break;
+        	 	       	}
+       	         	}
+        	    }
+        	}
+    	}
+        
+    // if access point is not already stored, then we store it
+    if ( !found )
+        {
+        TUint32 iap = 0;
+        if (internetparmfound)
+            {    
+            // Give pointer to cm manager to access point item
+            iSaveItems[ aItem ]->SetCMManager(iCmManager);
+            TRAPD(err,iap = iSaveItems[ aItem ]->SaveL( *iCommsDb));
+            if(err!=KErrNone)
+			          {
+			          User::LeaveIfError(err);	
+			          }
+			          
+			     TRAP(err1, WPAdapterUtil::SetAPDetailsL(iap));
+			     if (err1 == KErrNone)
+               {
+               iAlreadySavedOnce = ETrue;
+               }
+           }
+			   
+			   if (!internetparmfound || (internetparmfound && err1 != KErrNone))
+             {     
+             // Give pointer to cm manager to access point item
+            iSaveItems[ aItem ]->SetCMManager(iCmManager);
+            TRAPD(err,iap = iSaveItems[ aItem ]->SaveL( *iCommsDb));
+            if(err!=KErrNone)
+			          {
+			          User::LeaveIfError(err);	
+			          }
+			      iAlreadySavedOnce = ETrue;
+            }
+        }
+  FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::SaveL: done" ) );
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::CanSetAsDefault
+// -----------------------------------------------------------------------------
+//
+TBool CWPAPAdapter::CanSetAsDefault( TInt /*aItem*/ ) const
+	{
+	return EFalse;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::SetAsDefault
+// -----------------------------------------------------------------------------
+//
+void CWPAPAdapter::SetAsDefaultL( TInt /*aItem*/ )
+	{
+	// This shouldn't be called because CanSetAsDefault
+	// always returns EFalse.
+	Panic( EPreConditionFail );
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPAdapter::VisitL( CWPCharacteristic& aCharacteristic )
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL:" ) );
+	
+	TInt type = aCharacteristic.Type();
+
+	if ( type == KWPApplication )
+		{
+		FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL: KWPApplication" ) );
+		aCharacteristic.AcceptL( *this );
+		}
+	// Check every NAPDEF characteristic. If it contains INTERNET
+	// parameter then new access point is created from NAPDEF data.
+	else if ( type == KWPNapDef && !IsAlreadyLinked( aCharacteristic ) )
+		{
+		FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL: KWPNapDef" ) );
+        CWPAPNapdef* item = CWPAPNapdef::NewLC( EFalse, 
+            *iDefaultName, 
+            aCharacteristic,
+            aCharacteristic );
+        if( item->AddItemsL( iSaveItems, NULL, NULL ) > 0 )
+            {
+            User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) );
+            }
+        User::LeaveIfError( iDataItems.Append( item ) );
+        
+       
+    TInt val = item->GetInternetIndicator();
+    if (val != -1)
+        {
+        iAPValue.Append(val);
+        }
+    CleanupStack::Pop( item );
+		}
+		FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL:done" ) );
+
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPAdapter::VisitL( CWPParameter& /*aParameter*/ ) 
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::VisitLinkL
+// -----------------------------------------------------------------------------
+//
+void CWPAPAdapter::VisitLinkL( CWPCharacteristic& aCharacteristic )
+	{
+    if( !IsAlreadyLinked( aCharacteristic ) )
+        {
+        switch( aCharacteristic.Type() )
+            {
+            // This is link in APPLICATION characteristic to certain NAPDEF or LOGICAL proxy
+            case KWPPxLogical:
+                {
+                CWPAPLogicalProxy* item = CWPAPLogicalProxy::NewLC( 
+                    *iDefaultName, aCharacteristic );
+                item->AddItemsL( iSaveItems, NULL, NULL );
+                User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) );
+                User::LeaveIfError( iDataItems.Append( item ) );
+                CleanupStack::Pop( item );
+                break;
+                }
+            case KWPNapDef:
+                {
+                CWPAPNapdef* item = CWPAPNapdef::NewLC( ETrue, 
+                    *iDefaultName, 
+                    aCharacteristic,
+                    aCharacteristic );
+                item->AddItemsL( iSaveItems, NULL, NULL );
+                User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) );
+                User::LeaveIfError( iDataItems.Append( item ) );
+                CleanupStack::Pop( item );
+                break;
+                }
+            }
+        }
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::ContextExtension
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPAdapter::ContextExtension( MWPContextExtension*& aContextExtension )
+	{
+	aContextExtension = this;
+	return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::SaveDataL
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CWPAPAdapter::SaveDataL( TInt aIndex ) const
+	{
+	return iSaveItems[ aIndex ]->Uid();
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::DeleteL
+// -----------------------------------------------------------------------------
+//
+void CWPAPAdapter::DeleteL( const TDesC8& aSaveData )
+	{
+	if ( !iCommsDb )
+		{
+		iCommsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
+		}
+
+    TPckgBuf<TUint32> uid;
+    if( aSaveData.Length() == uid.MaxLength() )
+        {
+        LOG1( "DeleteL: Deleting %08x", uid() );
+        uid.Copy( aSaveData );
+
+        // CMManager
+        TRAPD( err, iCmManager->ConnectionMethodL( uid()).DeleteL() );
+        
+        LOG1( "DeleteL: Result: %d", err );
+        if( err == KErrLocked )
+            {
+            User::Leave( EWPCommsDBLocked );
+            }
+        else if ( err != KErrNone && err != KErrNotFound )
+            {
+            User::Leave( err );
+            }
+        }
+
+	//CleanupStack::PopAndDestroy( dataHandler );
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::Uid
+// -----------------------------------------------------------------------------
+//
+TUint32 CWPAPAdapter::Uid() const
+	{
+    return iDtor_ID_Key.iUid;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPAdapter::IsAlreadyLinked
+// -----------------------------------------------------------------------------
+//
+TBool CWPAPAdapter::IsAlreadyLinked( CWPCharacteristic& aCharacteristic )
+	{
+    return iLinks.FindInAddressOrder( &aCharacteristic ) >= 0;
+	}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPItemBase.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 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:    Defines a base class for all the items in WPAPAdapter
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+
+#include "CWPAPItemBase.h"
+#include "WPAPAdapter.pan"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+CWPAPItemBase::~CWPAPItemBase()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// C++ constructor
+// -----------------------------------------------------------------------------
+CWPAPItemBase::CWPAPItemBase( const TDesC& aDefaultName )
+                          : iDefaultName( aDefaultName )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPItemBase::MarkReceived
+// -----------------------------------------------------------------------------
+//
+void CWPAPItemBase::MarkReceived( TMarkedField aField )
+	{
+	iReceivedFieldsFlags |= aField;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPItemBase::IsReceived
+// -----------------------------------------------------------------------------
+//
+TBool CWPAPItemBase::IsReceived( TMarkedField aField )
+	{
+	return ( iReceivedFieldsFlags & aField );
+	}
+	
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPLogicalProxy.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,269 @@
+/*
+* Copyright (c) 2002 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:    Defines a class, which holds logical proxy information.
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+
+#include "CWPAPLogicalProxy.h"
+#include <e32svr.h>
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+#include "CWPLog.h"
+#include "CWPAPPhysicalProxy.h"
+#include "CWPAPPort.h"
+#include "WPAPAdapter.pan"
+#include "WPAPDefs.h"
+#include <cmconnectionmethodext.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPAPLogicalProxy* CWPAPLogicalProxy::NewLC( 
+                                        const TDesC& aDefaultName, 
+                                        CWPCharacteristic& aCharacteristic )
+	{
+	CWPAPLogicalProxy* self = new(ELeave) CWPAPLogicalProxy( aCharacteristic, 
+                                                             aDefaultName ); 
+	CleanupStack::PushL( self );
+	self->ConstructL();
+    aCharacteristic.AcceptL( *self );
+	return self;
+	}
+	
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CWPAPLogicalProxy::~CWPAPLogicalProxy()
+	{
+	delete iPort;
+	iPhysicalProxies.ResetAndDestroy();
+	iPhysicalProxies.Close();
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::ValidateL
+// -----------------------------------------------------------------------------
+//
+TBool CWPAPLogicalProxy::ValidateL()
+	{
+	// Logical proxy is valid if it contains either one or more
+	// physical proxies
+	return iPhysicalProxies.Count() > 0;
+	}
+
+
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::AddDataL
+// -----------------------------------------------------------------------------
+//
+void CWPAPLogicalProxy::AddDataL( RCmConnectionMethodExt& aCmItem )
+	{    
+	LOG("--CWPAP CWPAPLogicalProxy::AddDataL begin--");	
+	// This method is called by child physical proxy. 
+
+	// Store name if came along with the document. If missing then access point
+	// name is used.
+	if ( iName )
+		{
+		// CMManager
+		aCmItem.SetStringAttributeL( CMManager::ECmName, iName->Value() );
+		}
+
+	// Store homepage if defined.
+	if ( iHomepage )
+		{
+		// CMManager 
+		TRAPD( err, aCmItem.SetStringAttributeL( CMManager::ECmStartPage, iHomepage->Value() ));
+		
+		LOG2("CWPAP EApWapStartPage, value: %S, err: %d", &iHomepage->Value(), err);
+		User::LeaveIfError( err );
+		}
+
+	// Store port data, which overrides the data stored by child physical proxy.
+
+	if ( iPort )
+		{
+		//CMManager 
+		iPort->AddDataL (aCmItem);
+		
+		}
+	LOG("--CWPAP CWPAPLogicalProxy::AddDataL end--");	
+	}
+
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::AddItemsL
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPLogicalProxy::AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
+                                   CWPAPItemBase* /*aLogicalProxy*/,
+                                   CWPAPItemBase* /*aPhysicalProxy*/ ) 
+	{
+    TInt count( 0 );
+    for( TInt i( 0 ); i < iPhysicalProxies.Count(); i++ )
+        {
+        CWPAPPhysicalProxy* pp = iPhysicalProxies[ i ];
+        if( pp->ValidateL() )
+            {
+            count += pp->AddItemsL( aItems, this, NULL );
+            }
+        }
+
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::Name
+// -----------------------------------------------------------------------------
+//
+const TDesC& CWPAPLogicalProxy::Name()
+	{
+	if ( iName )
+		{
+		return iName->Value();
+		}
+	else
+		{
+		return KNullDesC;
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPLogicalProxy::VisitL( CWPCharacteristic& aCharacteristic )
+	{
+	TInt type = aCharacteristic.Type();
+
+	// KWPPort
+	
+	// One valid port is enough for us.
+	if ( type == KWPPort && !iPort )
+		{
+        CWPAPPort* port = CWPAPPort::NewLC( aCharacteristic );
+
+		if ( port->ValidateL() )
+			{
+			iPort = port;
+			CleanupStack::Pop( port );
+			}
+		else // Data not valid.
+			{
+			CleanupStack::PopAndDestroy( port );
+			}
+		}
+
+	// KWPPxPhysical
+
+	else if ( type == KWPPxPhysical )
+		{
+		CWPAPPhysicalProxy* physicalProxy = CWPAPPhysicalProxy::NewLC( 
+                                                            iDefaultName, 
+                                                            aCharacteristic,
+                                                            iCharacteristic,
+                                                            iPort );
+
+		if ( physicalProxy->ValidateL() )
+			{
+            User::LeaveIfError( iPhysicalProxies.Append( physicalProxy ) );
+			CleanupStack::Pop( physicalProxy );
+			}
+		else // Data not valid.
+			{
+			CleanupStack::PopAndDestroy( physicalProxy );
+			}
+		}
+	else if ( type == KWPPxAuthInfo )
+		{
+		// Not supported
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPLogicalProxy::VisitL( CWPParameter& aParameter)
+	{
+	TInt id = aParameter.ID();
+	const TDesC& value = aParameter.Value();
+
+	if ( value.Length() == 0 )
+		{
+		// No use process zero length value.
+		return;
+		}
+
+	switch ( id )
+		{
+		case EWPParameterStartPage: // iHomepage
+			{
+			if ( !iHomepage )
+				{
+				iHomepage = &aParameter;
+				}
+			break;
+			}
+		case EWPParameterName:
+			{
+			if ( !iName )
+				{
+				iName = &aParameter;
+				}
+			break;
+			}
+		default:
+			{
+			// Just let through
+			}
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::CWPAPLogicalProxy
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPAPLogicalProxy::CWPAPLogicalProxy( CWPCharacteristic& aCharacteristic,
+                                      const TDesC& aDefaultName )
+                                    : CWPAPItemBase( aDefaultName ),
+                                      iPhysicalProxies( KInitialArraySize ),
+                                      iCharacteristic( aCharacteristic )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPLogicalProxy::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPAPLogicalProxy::ConstructL()
+	{
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPNapdef.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,2020 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* 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:    Class stores data for one accesspoint
+*
+*/
+
+
+
+ 
+// INCLUDE FILES
+
+#include "CWPAPNapdef.h"
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+#include <WPAPAdapterResource.rsg>
+#include <featmgr.h>
+#include <WPAdapterUtil.h>
+#include "CWPAPAccesspointItem.h"
+#include "WPAPAdapter.pan"
+#include <WlanCdbCols.h>
+#include <EapType.h>
+#include <EapSettings.h>
+#include "ProvisioningDebug.h"
+#include <cmconnectionmethodext.h>
+#include <cmpluginpacketdatadef.h>
+#include <cmpluginwlandef.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+#include <commdb.h>
+#include <WlanCdbCols.h>
+
+#include <centralrepository.h>
+#include <pdpcontextmanagerinternalcrkeys.h>
+
+const TUint KIapColumn        = 0x00000100;
+const TUint KLingerColumn     = 0x00000200;
+const TUint KColumnMask       = 0xFFFFFF00;
+const TUint KRowMask          = 0x000000FF;
+
+// Delay for comms db begintransaction retry (microseconds)
+const TInt KBeginTransRetryDelay = 1000000; 
+// Maximum number of retries
+const  TInt KBeginTransRetryCount = 7;      
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::NewLC
+// -----------------------------------------------------------------------------
+//
+CWPAPNapdef* CWPAPNapdef::NewLC( TBool aFollowingLink,
+                                 const TDesC& aDefaultName, 
+                                 CWPCharacteristic& aLogicalCharacteristic,
+                                 CWPCharacteristic& aLink )
+	{
+	CWPAPNapdef* self = new(ELeave) CWPAPNapdef( aFollowingLink,
+	                                             aDefaultName,
+                                                 aLogicalCharacteristic ); 
+	CleanupStack::PushL( self );
+	self->ConstructL();
+    aLink.AcceptL( *self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+CWPAPNapdef::~CWPAPNapdef()
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::~CWPAPNapdef" ) );
+    
+    iEapTypeArray.ResetAndDestroy();
+    iEapTypeArray.Close();
+    iSecSSID.ResetAndDestroy();
+	iSecSSID.Close();
+    iNameServers.Close();
+  
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::ValidateL
+// -----------------------------------------------------------------------------
+//
+TBool CWPAPNapdef::ValidateL()
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL" ) );
+	
+    TBool result( ETrue );
+
+	if ( iBearer == KUidWlanBearerType )
+	    {	    	
+	    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan" ) );
+	    if ( iWlanSupported )
+	    	{	    	
+	    	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan supported" ) );
+	    	return result;
+	    	}
+	    else
+	    	{
+	   		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan NOT supported" ) );
+	    	return EFalse;
+	    	}
+	    }
+	    
+	// Received unsupported bearer
+	if( iBearerUnsupported )
+	    {
+	    return EFalse;
+	    }
+	    
+	// Didn't receive a bearer value.
+	if ( iBearer == 0 )
+		{
+    // Access point address type can also tell the bearer
+		if( iAccesspointNameType )
+            {
+            TPtrC addrType( iAccesspointNameType->Value() );
+            if( addrType == KAddrTypeAPN )
+                {
+                iBearer =KUidPacketDataBearerType;
+                }
+            }
+        
+        // If still couldn't determine the bearer, default to GPRS
+        if( iBearer == 0 )
+			{
+			iBearer = KUidPacketDataBearerType;
+			}
+		}
+		        
+    // "NAP-ADDRESS" (Access point name) must be defined
+    if( iAccesspointName )
+        {
+        if( iAccesspointName->Value() == KNullDesC )
+            {
+            return EFalse;
+            }
+        }
+    else
+        {
+        return EFalse;
+        }
+
+	/* 
+	Combinations of authentication type, username and password and corressponding
+	value of prompt for password field. AuthType in this table means that provisioning document
+	contained authtype parameter and it was supported by the implementation.
+	Provisioning document names are used in table.
+	x means that value of the specified parameter is received and it was valid.
+	AuthType received & supported 
+	| AuthName 
+	| | AuthSecret 
+	| |	| "Prompt for Password"
+		  no
+	x     no
+      x   no
+	x x   yes
+        x no
+    x   x yes
+      x x no
+    x x	x no
+	*/
+
+	// Set the "prompt password"-value. See the table above. Value is set to true
+	// only if we have supported authentication type and either username or password
+	// is empty.
+	if ( IsReceived( EWPParameterAuthentication_id ) &&
+	     ( ( !iPassword && iUserName ) ||( iPassword && !iUserName ) ) )
+		{
+		iPromptPassword = ETrue;	
+		}
+
+    // IFNETWORKS is a list of possible protocols that a GPRS access points can be 
+    // used for. 
+    if( iBearer == KUidPacketDataBearerType && IsReceived( EWPParameterIfNetworks_id ) )
+        {
+        TLex lex( iIfNetworks->Value() );
+        lex.Mark();
+        do
+            {
+            TChar ch( lex.Get() );
+
+            if( ( !iPdpType && !ch.IsAlphaDigit() ) || ( !iPdpType && lex.Eos() ) )
+                {
+				if(!lex.Eos())
+					{
+					lex.UnGet();
+					}
+                TPtrC value( lex.MarkedToken() );
+				if( !lex.Eos() )
+					{
+					lex.Inc();
+					}
+                
+                if( value == KIPv6 
+                    && FeatureManager::FeatureSupported( KFeatureIdIPv6 ) )
+                    {
+                    //iPdpType = EIPv6;
+                    // CMManager
+                    iPdpType = RPacketContext::EPdpTypeIPv6;
+                    result = ETrue;
+                    }
+                else if( value == KIPv6 
+                    && !FeatureManager::FeatureSupported( KFeatureIdIPv6 ) )
+                    {
+                    result = EFalse;
+                    }
+                else if( value == KIPv4 )
+                    {
+                    //iPdpType = EIPv4;
+                    // CMManager
+                    iPdpType = RPacketContext::EPdpTypeIPv4;
+                    result = ETrue;
+                    }
+                }
+            } while( !lex.Eos() );
+        }
+
+	return result;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::AddItemsL
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPNapdef::AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
+                            CWPAPItemBase* aLogicalProxy,
+                            CWPAPItemBase* aPhysicalProxy ) 
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL" ) );
+	
+    TInt count( 0 );
+
+    if( ( iFollowingLink || IsReceived( EWPParameterInternet_id ) 
+                         || IsReceived( EWPParameterWlan_id ) )
+                         && ValidateL() )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL append" ) );
+        CWPAPAccesspointItem* item = CWPAPAccesspointItem::NewLC(
+                                                             iDefaultName,
+                                                             aLogicalProxy,
+                                                             aPhysicalProxy,
+                                                             this,
+                                                             iCharacteristic );
+        User::LeaveIfError( aItems.Append( item ) );
+        //Internet Parameter is received
+        if (IsReceived(EWPParameterInternet_id) && !iFollowingLink)
+            {
+            SetInternetIndicator(aItems.Count() - 1);
+            }
+
+        
+        count++;
+        CleanupStack::Pop( item );
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL append done" ) );
+        }
+    return count;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::SetInternetIndicator
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::SetInternetIndicator(TInt aValue)
+    {
+    iInternetIndicator = aValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::GetInternetIndicator
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPNapdef::GetInternetIndicator()
+    {
+    return iInternetIndicator;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::AddDataL
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::AddDataL( /*CApAccessPointItem& aAPItem*/ RCmConnectionMethodExt& aCmItem ) 
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL" ) );
+	
+	TInt err( KErrNone );
+
+    if ( iBearer == KUidWlanBearerType )    
+	    {			    	
+	    	if ( iWlanSupported )
+        	{
+        	// CMManager
+        	AddWlanDataL( aCmItem);
+        	}
+        else
+        	{
+        	// WLAN is disabled (or does not exist) in the device.
+        	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL WLAN disabled." ) );
+        	User::Leave( KErrNotSupported );
+        	}
+	    }
+    else
+        {	    
+    	if ( iConnectionName )
+    		{
+    		// CMManager
+    		aCmItem.SetStringAttributeL( CMManager::ECmName, (iConnectionName->Value().Left( KNameMaxLength ))); 
+    		}
+    	else // Use default name
+    		{
+    		// CMManager
+    		aCmItem.SetStringAttributeL( CMManager::ECmName, iDefaultName );
+    		}
+    	
+    	if ( iAccesspointName )
+    		{
+    		if ( iBearer == KUidPacketDataBearerType )
+    			{
+    			// CMManager
+    			TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EPacketDataAPName, iAccesspointName->Value() ));
+                FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL value: %S, err: %d"),
+                                                                     &iAccesspointName->Value(), err));    			                              
+    			}
+    		else
+    			{
+    			// CMManager
+    			TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialDefaultTelNum, iAccesspointName->Value() ));
+                FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::EApIspDefaultTelNumber value: %S, err: %d"),
+                			      &iAccesspointName->Value(), err ) );
+    			}
+    		}
+    		
+    	TRAP ( err, aCmItem.UpdateL() );
+
+    	 if ( iUserName )
+    		{
+    		// CMManager
+    		TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialLoginName, iUserName->Value() ));
+    		FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialLoginName value: %S, err: %d"),
+    		                    		      &iUserName->Value(), err));
+    		TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialIFAuthName, iUserName->Value() ));
+    		FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialIFAuthName value: %S, err: %d"),
+    		                    		      &iUserName->Value(), err));
+    		TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIFAuthName, iUserName->Value() ));
+    		FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFAuthName value: %S, err: %d"),
+    		                    		      &iUserName->Value(), err));
+    		}
+    		
+		// CMManager
+    	TRAP ( err, aCmItem.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, iPromptPassword));
+    	FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFPromptForAuth value: %d, err: %d"),
+    	                            	      iPromptPassword, err ));
+
+    	if ( iPassword )
+    		{
+    		// CMManager 
+    		TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialLoginPassword, iPassword->Value() ));
+    		FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialLoginPassword value: %d, err: %d"),
+    		                		      &iPassword->Value(), err ) );
+    		TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIFAuthPass, iPassword->Value() ));
+    		FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFAuthPass value: %d, err: %d"),
+    		                		      &iPassword->Value(), err ) );
+    		}	
+
+		// CMManager
+    	TRAP ( err, aCmItem.SetBoolAttributeL( CMManager::ECmDisablePlainTextAuth, iSecureAuthentication ));
+        FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EApEApIspDisablePlainTextAuth value: %d, err: %d"),    	                         
+                	                        iSecureAuthentication, err ) );
+                	                        
+			
+        // IPv6 APs always have dynamic phone address
+    	//CMManager
+    	if ( iPhoneIPAddress && iPdpType != RPacketContext::EPdpTypeIPv6 )
+    		{
+    		// CMManager IS CORRECT?
+    		//err = aAPItem.WriteTextL( EApIspIPAddr, iPhoneIPAddress->Value() );
+    		TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIPAddress, iPhoneIPAddress->Value() ));
+    		FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EApIspIPAddr value: %S, err: %d"),
+                        		     &iPhoneIPAddress->Value(), err ) );
+    		}
+
+		TRAP ( err, aCmItem.UpdateL() );
+        for( TInt i( 0 ); i < iNameServers.Count(); i++ )
+            {
+            WriteDNSAddressL( aCmItem, iNameServers[i]->Value() );
+            }
+		TRAP ( err, aCmItem.UpdateL() );
+        if( FeatureManager::FeatureSupported( KFeatureIdIPv6 )
+            && iPdpType )
+            {
+         	// CMManager
+            TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EPacketDataPDPType, iPdpType ));
+            }
+    
+    if ( err ) err = 0; // prevent compiler warning
+        }
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL" ) );
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::AddWlanDataL
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::AddWlanDataL( RCmConnectionMethodExt& aCmItem )
+    {
+    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL" ) );
+    
+    if ( !iWlanSupported )
+    	{
+    		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL WLAN NOT supported." ) );
+    		User::Leave( KErrNotSupported);
+    	}
+        
+    TInt err = KErrNone;
+    
+	if ( iConnectionName )
+		{
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName" ) );
+		
+		//Connection name
+		// CMManager
+		aCmItem.SetStringAttributeL( CMManager::ECmName, iConnectionName->Value().Left( KNameMaxLength ) );
+		
+		// CMManager 
+		// Network name
+		aCmItem.SetStringAttributeL( CMManager::EWlanSSID, iConnectionName->Value());
+		
+        FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName err (%d) (%S)"), err, &iConnectionName->Value()));
+				
+		}
+	else // Use default name
+		{
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName default" ) );
+		aCmItem.SetStringAttributeL( CMManager::EWlanSSID, iDefaultName);
+		}
+		   	
+   	//EApWlanNetworkMode Gives network mode, TUint32
+   	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanNetworkMode" ) );
+	// CMManager
+   	TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EWlanConnectionMode, iNetMode ));
+   	FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanNetworkMode err (%d)"), err));
+        
+    //EApWlanSecurityMode The security mode, TUint32
+    if ( iSecMode == 0 )
+        {
+        // This is needed if Provisioning message does not contain SECMODE parameter
+        // AP does not work if secmode is not set
+        iSecMode = CMManager::EWlanSecModeOpen;
+        }
+        
+    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanSecurityMode" ) );
+   	// CMManager, securitymode causes error -1, this will be set manually in SaveWlanData
+   	//TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EWlanSecurityMode, iSecMode ));
+    FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanSecurityMode err (%d)"), err));
+    	
+    if (err)
+        {
+        err = KErrNone;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::WriteDNSAddressL
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::WriteDNSAddressL( /*CApAccessPointItem& aAPItem*/ RCmConnectionMethodExt& aCmItem,
+                                    const TDesC& aValue )
+	{
+    // GPRS access points supports IPv6 only if explicitly stated. 
+    // CMManager
+    TBool apSupportsIPv6( iPdpType == RPacketContext::EPdpTypeIPv6 | iBearer != KUidPacketDataBearerType );
+
+    // If IPv6 is supported, write the DNS address as IPv6 if
+    // bearer supports IPv6 and the address format is IPv6    
+    if( FeatureManager::FeatureSupported( KFeatureIdIPv6 )
+        && apSupportsIPv6
+        && WPAdapterUtil::CheckIPv6( aValue ) )
+        {
+        // Two name servers per network type
+        if( iNumIPv6NameServers < KTwoNameServersPerNetworkType )
+            {
+            // CMManager
+            TRAPD (err, aCmItem.SetStringAttributeL( CMManager::TConnectionMethodCommonAttributes( 
+            													( CMManager::ECmIP6NameServer1 ) + iNumIPv6NameServers ), aValue ) );
+            User::LeaveIfError( err );
+            iNumIPv6NameServers++;
+            }
+        }
+     else if( CheckIPv4values( aValue) )
+        {
+        // Two name servers per network type
+        if( iNumIPv4NameServers < KTwoNameServersPerNetworkType )
+            {
+            // CMManager 
+            TRAPD ( err, aCmItem.SetStringAttributeL( CMManager::TConnectionMethodCommonAttributes( 
+            													( CMManager::ECmIPNameServer1 ) + iNumIPv4NameServers ), aValue ) );
+            User::LeaveIfError( err );
+            aCmItem.SetBoolAttributeL( CMManager::ECmIPDNSAddrFromServer, EFalse);
+            iNumIPv4NameServers++;
+            }
+        }
+	}
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::CheckAddressPart
+// -----------------------------------------------------------------------------
+//
+
+TBool CWPAPNapdef:: CheckAddressPart( TLex& aLex )
+    {
+    TBool result( aLex.Peek().IsDigit() );
+    aLex.Inc();
+    if( aLex.Peek().IsDigit() )
+        {
+        aLex.Inc();
+        if( aLex.Peek().IsDigit() )
+            {
+            aLex.Inc();
+            }
+        }
+
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::CheckIPv4values
+// -----------------------------------------------------------------------------
+//
+
+TBool CWPAPNapdef::CheckIPv4values( const TDesC& aValue )
+{
+	
+	TLex aLex( aValue );
+	return CheckAddressPart( aLex ) 
+        && aLex.Get() == '.'
+        && CheckAddressPart( aLex ) 
+        && aLex.Get() == '.'
+        && CheckAddressPart( aLex ) 
+        && aLex.Get() == '.'
+        && CheckAddressPart( aLex )
+        && aLex.Get() == '\0';
+     
+}
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::Name
+// -----------------------------------------------------------------------------
+//
+const TDesC& CWPAPNapdef::Name()
+	{
+	if ( iConnectionName )
+		{
+		return iConnectionName->Value();
+		}
+	else
+		{
+		return KNullDesC;
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::VisitL( CWPCharacteristic& aCharacteristic )
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic)" ) );
+	
+	TInt type = aCharacteristic.Type();
+    FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) type (%d)"), type));
+	switch ( type )
+		{
+		case KWPNapAuthInfo:
+		case KWPValidity:				
+			{
+			FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) normal" ) );
+			aCharacteristic.AcceptL( *this );
+			break;
+			}
+		case KWPWLAN:
+		case KWPWepKey:
+			{
+			if( iWlanSupported )
+				{
+					FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) accept WLAN characteristic" ) );
+					aCharacteristic.AcceptL( *this );
+				}
+			}
+		default:
+			{
+			if ( ( ( ( aCharacteristic.Name().Compare( KWLAN ) ) == 0 )    ||
+			     ( ( aCharacteristic.Name().Compare( SECSSID ) ) == 0 )  ||
+			     ( ( aCharacteristic.Name().Compare( KEAP ) ) == 0 )     ||
+			     ( ( aCharacteristic.Name().Compare( KCERT ) ) == 0 )    ||
+			     ( ( aCharacteristic.Name().Compare( KWEP ) ) == 0 ) ) && iWlanSupported )
+			    {
+			    if(aCharacteristic.Name().Compare( KEAP ) == 0)
+			        {
+                    CEapTypeElement* newEap = new (ELeave) CEapTypeElement;
+                    newEap->iEAPSettings = new (ELeave) EAPSettings;
+               	    newEap->iCertificate = new (ELeave) CertificateEntry;
+                    iEapTypeArray.AppendL(newEap);
+			        }
+			    else if(aCharacteristic.Name().Compare( SECSSID ) == 0)
+			        {
+                    SECssID* newsecSSID = new (ELeave) SECssID;
+                    newsecSSID->iSSSID = NULL;
+                    newsecSSID->iSUSSID = NULL;
+                    iSecSSID.AppendL(newsecSSID);
+			        }
+    
+			    aCharacteristic.AcceptL( *this );
+			    }
+			}
+		}
+		
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) done" ) );
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::VisitL( CWPParameter& aParameter )
+	{
+	TInt id = aParameter.ID();
+	TPtrC value( aParameter.Value() );
+
+	FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::VisitL(CWPParameter) id: %d value: %S"), id, &value));
+
+	switch ( id )
+		{
+		case EWPParameterName:
+			{
+			if ( !iConnectionName )
+				{
+				iConnectionName = &aParameter;
+				}
+			break;
+			}
+		case EWPParameterBearer:
+			{
+			if ( iBearer != 0 || iBearerUnsupported )
+				{
+				break; // Already received a bearer information
+				}
+
+			if ( value == KGSMGPRS )
+				{
+				iBearer = KUidPacketDataBearerType;
+				}
+			else if ( value == KWLAN && iWlanSupported )
+				{
+				iBearer = KUidWlanBearerType;
+				MarkReceived( EWPParameterWlan_id );
+				}				
+			else
+				{
+				// Unsupported bearer type
+				iBearerUnsupported = ETrue;
+				}
+			break;
+			}
+		case EWPParameterNapAddress:
+			{
+			if ( !iAccesspointName )
+				{
+				iAccesspointName = &aParameter;
+				}
+			break;
+			}
+		case EWPParameterLinger:
+			{
+			iLinger = &aParameter;
+			UdateligerValueL( iLinger );
+			break;
+			}
+		case EWPParameterNapAddrType:
+			{
+			if ( !iAccesspointNameType )
+				{
+				iAccesspointNameType = &aParameter;
+				}
+			break;
+			}
+		case EWPParameterAuthName:
+			{
+			if ( !iUserName )
+				{
+				iUserName = &aParameter;
+				}
+			break;
+			}
+		case EWPParameterAuthSecret:
+			{
+			if ( !iPassword )
+				{
+				iPassword = &aParameter;
+				}
+			break;
+			}
+		case EWPParameterAuthType:
+			{
+			// If already received don't accept
+			if (IsReceived(EWPParameterAuthentication_id))
+				{
+				break;
+				}
+
+			if ( value == KCHAP || value == KMD5 )
+				{
+				iSecureAuthentication = ETrue;
+				MarkReceived( EWPParameterAuthentication_id );
+				}
+			else if ( value == KPAP )
+				{
+				iSecureAuthentication = EFalse;
+				MarkReceived( EWPParameterAuthentication_id );
+				}
+			else
+				{
+				// Not supported...
+				}
+			break;
+			}
+		case EWPParameterLocalAddr: // iPhoneIPAddress
+			{
+			if ( !iPhoneIPAddress )
+				{
+				iPhoneIPAddress = &aParameter;
+				}
+			break;
+			}
+		case EWPParameterDNSAddr:
+			{
+            // All name servers must be stored, as some of them might
+            // be IPv6 and some IPv4
+            User::LeaveIfError( iNameServers.Append( &aParameter ) );
+			break;
+			}
+        case EWPParameterIfNetworks:
+            {
+            if( !iIfNetworks )
+                {
+                iIfNetworks = &aParameter;
+                MarkReceived( EWPParameterIfNetworks_id );
+                }
+            break;
+            }
+        case EWPParameterInternet:
+            {
+            MarkReceived( EWPParameterInternet_id );
+            break;
+            }
+//JMan for WLan
+        case EWPParameterNapID:
+            {
+            if ( !iNapID )
+                {
+                iNapID = &aParameter;
+                }
+            break;
+            }    
+        // Here case 0 are handled the WLAN parameters that are extensions  
+        // to OMA Client Provisioning parameter set.
+        case 0:
+            {
+        if( iWlanSupported )
+        	{
+        	HandleWLanParametersL( aParameter );
+        	}
+        break;
+            }
+//JMan for WLan ends
+		default:
+			{
+			}
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::HandleWLanParametersL
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::HandleWLanParametersL( CWPParameter& aParameter )
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL" ) );
+	
+	if( !iWlanSupported )
+		{
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WLAN not supported." ) );
+		User::Leave( KErrNotSupported );
+		}
+	
+	SECssID* scssid = NULL;
+	if( iSecSSID.Count() )
+	{
+		scssid = iSecSSID[iSecSSID.Count()-1];
+	}
+	
+	TPtrC value( aParameter.Value() );
+    if( ( aParameter.Name().Compare( PRISSID ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriSSID" ) );
+        if ( !iPriSSID )
+            {
+            iPriSSID = &aParameter;
+            }
+        }
+    else if( ( aParameter.Name().Compare( PRIUSSID ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriUSSID" ) );
+        if ( !iPriUSSID )
+            {
+            iPriUSSID = &aParameter;
+            }
+        }// else if
+
+    else if( ( aParameter.Name().Compare( PRIHSSID ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) );
+        if ( !iPriHSSID )
+            {
+            iPriHSSID = &aParameter;
+            }
+        }// else if
+        
+    else if( ( aParameter.Name().Compare( SSSID ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) );
+			  scssid->iSSSID = &aParameter;
+
+        }// else if
+
+    else if( ( aParameter.Name().Compare( SUSSID ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) );
+			  scssid->iSUSSID = &aParameter;
+        }// else if
+                        
+    else if( ( aParameter.Name().Compare( NETMODE ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode" ) );
+        if ( value == KADHOC )
+			{
+			FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode adhoc" ) );
+			iNetMode = CMManager::EAdhoc;
+			}
+        else // default is INFRA
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode infra" ) );
+            iNetMode =CMManager::EInfra;
+            }
+        }
+
+    else if( ( aParameter.Name().Compare( SECMODE ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode" ) );
+        if ( value == KWEPSEC )
+			{
+			FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWEPSEC" ) );
+			iSecMode = CMManager::EWlanSecModeWep;
+			}
+        else if( value == K8021XSEC )
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode K8021XSEC" ) );
+			iSecMode = CMManager::EWlanSecMode802_1x;
+            }
+        else if( value == KWPASEC )
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPASEC" ) );
+
+			iSecMode = CMManager::EWlanSecModeWpa;
+            }
+        else if( value == KWPA2SEC )
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPA2SEC" ) );
+			iSecMode = CMManager::EWlanSecModeWpa2;
+            }
+        else if( value == KWPAPRESSEC )
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPAPRESSEC" ) );
+			iSecMode = CMManager::EWlanSecModeWpa;
+            }
+        else if( value == KWPA2PRESSEC )
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPA2PRESSEC" ) );
+			iSecMode = CMManager::EWlanSecModeWpa2;
+            }          
+        else
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode open" ) );
+			iSecMode = CMManager::EWlanSecModeOpen;
+            }
+        }
+
+    else if( ( aParameter.Name().Compare( WPAPRESKEYASC ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WPAPRESKEYASC" ) );
+        if ( !iWpaPresKeyAsc )
+            {
+            iWpaPresKeyAsc = &aParameter;
+            }
+        }// else if
+        // indicates the default wepkey index
+    else if( ( aParameter.Name().Compare( DEFAULTWEPIND ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepind" ) );
+
+        TLex lex( value );
+        lex.Val( iDefaultWepKeyIndex );
+        if ( iDefaultWepKeyIndex >= 4 )
+            {
+            iDefaultWepKeyIndex = 0;
+            }
+        }// else if
+        
+    else if( ( aParameter.Name().Compare( WEPAUTHMODE ) ) == 0 )
+        {
+        if ( value == KWEPAUTHMODEOPEN )
+			{
+			FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepauthmode OPEN" ) );
+			iAuthentication = EAuthOpen;
+			}
+		else if ( value == KWEPAUTHMODESHARED )
+		    {
+		    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepauthmode SHARED" ) );
+			iAuthentication = EAuthShared;
+		    }
+        }// else if
+        
+    else if( ( aParameter.Name().Compare( WEPKEYLENGTH ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYLENGTH" ) );
+        if ( !iWepKeyLength )
+            {
+            iWepKeyLength = &aParameter;
+            }
+        }// else if
+    else if( ( aParameter.Name().Compare( WEPKEYINDEX ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYINDEX" ) );
+        TLex lex( value );
+        lex.Val( iWepInd );
+        }// else if 
+    else if( ( aParameter.Name().Compare( WEPKEYDATA ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYDATA" ) );
+
+        if ( iWepInd <  4 )
+            {
+            const TUint8 K40Bits = 5;
+            const TUint8 K104Bits = 13;
+            const TUint8 K232Bits = 29;
+
+            TBuf8<KMaxLengthOfKeyData> buf8;
+            StrCopy( buf8, aParameter.Value() );
+            
+            if(buf8.Length() == K232Bits ||
+                buf8.Length() == K104Bits ||
+                buf8.Length() == K40Bits  )
+                {
+                FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL ASCI Wep Key" ) );
+                HBufC8* buf8Conv = HBufC8::NewLC( KMaxLengthOfKeyData );
+                ConvertAsciiToHex( buf8, buf8Conv );
+                iKeyData[iWepInd] = *buf8Conv;
+                iKeyFormat[iWepInd] = CWPAPNapdef::EAscii;
+                CleanupStack::PopAndDestroy( buf8Conv );
+                }
+            else if( buf8.Length()==K232Bits*2 ||
+                buf8.Length()== K104Bits*2 ||
+                buf8.Length() == K40Bits*2)
+                {
+                FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL HEX Wep Key" ) );
+                iKeyData[iWepInd] = buf8;
+                iKeyFormat[iWepInd] = CWPAPNapdef::EHexadecimal;
+                }
+            }
+        
+        }// else if	
+    
+    // Handle EAP parameter
+    HandleEAPParametersCCL( aParameter );        
+    
+    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL done" ) );
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::HandleEAPParametersL
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::HandleEAPParametersCCL( CWPParameter& aParameter )
+    {
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL" ) );
+   	
+   	CEapTypeElement* eap = NULL;
+   	if ( iEapTypeArray.Count() )
+   	    {
+   	    eap = iEapTypeArray[iEapTypeArray.Count()-1];
+   	    }
+   	
+	TPtrC value( aParameter.Value() );
+	
+    if( ( aParameter.Name().Compare( EAPTYPE ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPTYPE" ) );
+              
+        ConvertEAPStringToIds( value, eap->iEapTypeString, reinterpret_cast<TUint &> ( eap->iEAPSettings->iEAPType )  );
+        
+        }
+    else if( ( aParameter.Name().Compare( EAPUSERNAME ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPUSERNAME" ) );
+        if ( eap->iEAPSettings->iUsername.Length() == 0 )
+            {
+            eap->iEAPSettings->iUsername = value;
+            eap->iEAPSettings->iUsernamePresent = ETrue;
+            }
+        }// else if 
+    else if( ( aParameter.Name().Compare( EAPPASSWORD ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPASSWORD" ) );
+        if ( eap->iEAPSettings->iPassword.Length() == 0 )
+            {
+            eap->iEAPSettings->iPassword = value;
+            eap->iEAPSettings->iPasswordPresent = ETrue;
+            }
+        }// else if 
+    else if( ( aParameter.Name().Compare( EAPREALM ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPREALM" ) );
+
+        if ( eap->iEAPSettings->iRealm.Length() == 0 )
+            {
+            eap->iEAPSettings->iRealm = value;
+            eap->iEAPSettings->iRealmPresent = ETrue;
+            }
+        }// else if 
+    else if( ( aParameter.Name().Compare( EAPUSEPSEUD ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPUSEPSEUD" ) );
+        TInt pseudonyms;
+        TLex lex( value );
+        lex.Val( pseudonyms );
+        
+        eap->iEAPSettings->iUsePseudonymsPresent = ETrue;
+        if ( pseudonyms == 1 )
+            {        
+            eap->iEAPSettings->iUsePseudonyms = ETrue;
+            }
+        else
+            {
+            eap->iEAPSettings->iUsePseudonyms = EFalse;            
+            }
+        }// else if 
+    else if( ( aParameter.Name().Compare( EAPMAXAUTHS ) ) == 0 )
+        {
+        // not supported
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPMAXAUTHS" ) );
+        }// else if 
+    else if( ( aParameter.Name().Compare( EAPENCAPS ) ) == 0 )
+        {
+        
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPENCAPS" ) );
+        TUint dummy;
+        ConvertEAPStringToIds( value, eap->iEncapsulatingExpandedEapId, dummy );
+                     
+        }// else if    
+    else if( ( aParameter.Name().Compare( EAPVERSERREALM ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPVERSERREALM" ) );
+        
+        TInt serverRealm;
+        TLex lex( value );
+        lex.Val( serverRealm );
+        
+        eap->iEAPSettings->iVerifyServerRealmPresent = ETrue;
+        
+        if ( serverRealm == 1 )
+            {        
+            eap->iEAPSettings->iVerifyServerRealm = ETrue;
+            }
+        else
+            {
+            eap->iEAPSettings->iVerifyServerRealm = EFalse;            
+            }
+        }// else if    
+    else if( ( aParameter.Name().Compare( EAPCLIENTHAUTH ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCLIENTHAUTH" ) );
+        
+        TInt clientAuthentication;
+        TLex lex( value );
+        lex.Val( clientAuthentication );
+        
+        eap->iEAPSettings->iRequireClientAuthenticationPresent = ETrue;
+        
+        if ( clientAuthentication == 1 )
+            {        
+            eap->iEAPSettings->iRequireClientAuthentication = ETrue;
+            }
+        else
+            {
+            eap->iEAPSettings->iRequireClientAuthentication = EFalse;            
+            }
+        }// else if    
+    else if( ( aParameter.Name().Compare( EAPSESVALTIME ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSESVALTIME" ) );
+        
+        TInt sessionValidityTime;
+        TLex lex( value );
+        lex.Val( sessionValidityTime );
+        eap->iEAPSettings->iSessionValidityTime = sessionValidityTime;
+        eap->iEAPSettings->iSessionValidityTimePresent = ETrue;
+
+        }// else if    
+    else if( ( aParameter.Name().Compare( EAPCIPSUIT ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCIPSUIT" ) );
+        
+        TInt cipherSuites;
+        TLex lex( value );
+        lex.Val( cipherSuites );
+        eap->iEAPSettings->iCipherSuites.Append( cipherSuites );
+        eap->iEAPSettings->iCipherSuitesPresent = ETrue;
+        
+        }// else if
+    else if( ( aParameter.Name().Compare( EAPPEAPV0 ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV0" ) );
+        
+        TInt peap;
+        TLex lex( value );
+        lex.Val( peap );
+        
+        eap->iEAPSettings->iPEAPVersionsPresent = ETrue;
+        if ( peap == 1 )
+            {        
+            eap->iEAPSettings->iPEAPv0Allowed = ETrue;
+            }
+        else
+            {
+            eap->iEAPSettings->iPEAPv0Allowed = EFalse;            
+            }
+        }// else if     
+    else if( ( aParameter.Name().Compare( EAPPEAPV1 ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV1" ) );
+        TInt peap;
+        TLex lex( value );
+        lex.Val( peap );
+        eap->iEAPSettings->iPEAPVersionsPresent = ETrue;
+        if ( peap == 1 )
+            {        
+            eap->iEAPSettings->iPEAPv1Allowed = ETrue;
+            }
+        else
+            {
+            eap->iEAPSettings->iPEAPv1Allowed = EFalse;            
+            }
+        }// else if
+    else if( ( aParameter.Name().Compare( EAPPEAPV2 ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV2" ) );
+        TInt peap;
+        TLex lex( value );
+        lex.Val( peap );
+        eap->iEAPSettings->iPEAPVersionsPresent = ETrue;
+        if ( peap == 1 )
+            {        
+            eap->iEAPSettings->iPEAPv2Allowed = ETrue;
+            }
+        else
+            {
+            eap->iEAPSettings->iPEAPv2Allowed = EFalse;            
+            }
+        }// else if  
+        
+    else if( ( aParameter.Name().Compare( EAPISSNAME ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPISSNAME" ) );
+        
+        eap->iCertificate->iSubjectName = value;
+        eap->iCertificate->iSubjectNamePresent = ETrue;
+        }// else if        
+        
+    else if( ( aParameter.Name().Compare( EAPSUBNAME ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSUBNAME" ) );
+        
+        eap->iCertificate->iIssuerName = value;
+        eap->iCertificate->iIssuerNamePresent = ETrue;
+       
+        }// else if        
+        
+    else if( ( aParameter.Name().Compare( EAPCERTTYPE ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCERTTYPE" ) );
+        if ( value == EAPCERTCA )
+			{
+			FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EEapSim" ) );
+            
+            eap->iCertificate->iCertType = CertificateEntry::ECA;
+			}
+		else
+		    {
+		    eap->iCertificate->iCertType = CertificateEntry::EUser;
+		    }
+		// Certificates must be present since this field was added
+		eap->iEAPSettings->iCertificatesPresent = ETrue; 
+        
+        }// else if        
+    else if( ( aParameter.Name().Compare( EAPSERNUM ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSERNUM" ) );
+        
+        eap->iCertificate->iSerialNumber = value;
+        eap->iCertificate->iSerialNumberPresent = ETrue;
+        }// else if
+        
+    else if( ( aParameter.Name().Compare( EAPSUBKEYID ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSUBKEYID" ) );
+           
+        _LIT(KHexIdLC, "0x");
+       	_LIT(KHexIdUC, "0X");
+       	TBuf<2> HexIdBuf;
+       	TInt keyLen = aParameter.Value().Length();
+       	
+       	// setting the given key to the key buffer
+       	TBuf<KMaxSubKeyLenght> origKey;
+       	origKey.SetLength(keyLen);
+       	origKey = aParameter.Value();
+       	TBuf<KMaxSubKeyLenght> key;
+       	TLex tmpByte;
+       	TInt err(KErrNone);
+       	TUint16 byte;
+       	
+       	// Remove possible spaces from the beginning
+       	origKey.TrimLeft();
+       	
+       	// if the key is over two chars long, then we have to check
+       	// whether there is 0x or 0X in the beginning
+       	if (origKey.Length() >= 2)
+            {
+        	// Copy the two left most characters in to the buffer
+        	HexIdBuf.Copy(origKey.Left(2));
+        	
+        	// If the first characters are 0x or 0X, then they should be ignored
+        	if (HexIdBuf.Compare(KHexIdLC) == 0
+        			|| HexIdBuf.Compare(KHexIdUC) == 0)
+        		{
+        		// delete two characters
+        		origKey.Delete(0, 2);
+        		}
+            }
+        
+       	// looping the subject key through, removing whitespaces
+       	for (TInt i = 0; i < keyLen; i++)
+       		{
+       		// removing white spaces from the left side of the key
+       		origKey.TrimLeft();
+       		// check that there are characters left
+       		if (origKey.Length() >= 2)
+       			{
+       			// pick the two left most bytes from the key
+       			tmpByte = origKey.Left(2);
+       			// convert byte into binary format
+       			err = tmpByte.Val(byte, EHex);
+       			
+       			// delete two characters from the left side of the character array in the buffer
+       			origKey.Delete(0, 2);
+       			
+       			// check whether conversion to decimal went ok
+       			if (err != KErrNone)
+       				{
+       				// if there are problems, then leave the loop
+       				break;
+       				}
+       			
+       			// store the appended byte into the key variable
+       			key.Append(byte);
+       			}
+       			
+       		else if (origKey.Length() == 1)
+       			{
+       			// pick the left most bytes from the key
+       			tmpByte = origKey.Left(1);
+       			// convert byte into binary format
+       			err = tmpByte.Val(byte, EHex);
+       			
+       			// delete two characters from the left side of the character array in the buffer
+       			origKey.Delete(0, 1);
+       			
+       			// check whether conversion to decimal went ok
+       			if (err != KErrNone)
+       				{
+       				// if there are problems, then leave the loop
+       				break;
+       				}
+       			
+       			// store the appended byte into the key variable
+       			key.Append(byte);
+       			}
+       		else
+       			{
+       			break;
+       			}
+       		}
+       	// store key value only if no errors occurred
+       	if (err == KErrNone) 
+       		{
+       		eap->iCertificate->iSubjectKeyID.Copy(key);
+       		eap->iCertificate->iSubjectKeyIDPresent = ETrue;
+       		eap->iEAPSettings->iCertificatesPresent = ETrue; 
+       		}
+       	}
+       	
+        
+    else if( ( aParameter.Name().Compare( EAPTHUMBPRINT ) ) == 0 )
+        {
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPTHUMBPRINT" ) );
+        eap->iCertificate->iThumbprintPresent = ETrue;
+        eap->iCertificate->iThumbprint = value;
+        }// else if                  
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::CWPAPNapdef
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPAPNapdef::CWPAPNapdef( TBool aFollowingLink,
+                          const TDesC& aDefaultName, 
+                          CWPCharacteristic& aLogicalCharacteristic )
+                        : CWPAPItemBase( aDefaultName ),
+                          iCharacteristic( aLogicalCharacteristic ),
+                          iFollowingLink( aFollowingLink )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::ConstructL()
+	{
+	iLingerValue = NULL;
+	iLingerFlag = ETrue;
+	iInternetIndicator = -1;
+	//checks if Wlan feature is supported
+  FeatureManager::InitializeLibL();
+  iWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+  FeatureManager::UnInitializeLib();
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::SaveWlanDataL
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb )
+    {
+    FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL APid: (%d)"),  aIapId) );
+    
+    if ( iBearer == KUidWlanBearerType )
+	    {
+        CCommsDbTableView* wLanServiceTable;
+        
+        // CMManager
+        // Search the Iap Service Id using the received IapId
+        RCmConnectionMethodExt cm = iCm->ConnectionMethodL( aIapId );
+        TUint32 serviceId = cm.GetIntAttributeL( CMManager::ECmIapServiceId );
+     	
+        // The BeginTransaction might fail if someone else has locked CommsDat
+        TInt dberr = aCommsDb.BeginTransaction();
+        if( dberr == KErrLocked )
+            {
+            // Try BeginTransaction again to get lock
+            TInt retry = KBeginTransRetryCount;            
+            while ( retry > 0 && dberr == KErrLocked )
+                {                   
+                User::After(KBeginTransRetryDelay);
+                dberr = aCommsDb.BeginTransaction();
+                FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL: Database locked. BeginTransaction retry." ) );
+                retry--;
+                }
+            if(dberr != KErrNone)
+                {                            
+                // Could not get lock to CommsDat at all
+                FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL: BeginTransaction failed completely." ) );
+                User::Leave( dberr ); 
+                }           
+            }                             
+        
+        TInt indexToSec = 0;
+        wLanServiceTable = aCommsDb.OpenViewMatchingUintLC( 
+                        TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), serviceId );
+        TInt errorCode = wLanServiceTable->GotoFirstRecord();
+
+        if ( errorCode == KErrNone )
+            {
+            indexToSec = serviceId;
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL updaterecord" ) );
+            wLanServiceTable->UpdateRecord();
+            }
+        else
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL insertrecord" ) );
+            TUint32 dummyUid( 0 );
+            User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) );
+
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_SERVICE_ID" ) );
+            // Save link to LAN service
+            wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), aIapId );
+            indexToSec = aIapId;
+            }
+        
+        // Setting the security mode manually, because CMManager does not do that
+        wLanServiceTable->WriteUintL( TPtrC( WLAN_SECURITY_MODE ), iSecMode );
+
+    	if( iSecSSID.Count() )
+			{
+	        CCommsDbTableView* wLanSecserviceTable;
+			wLanSecserviceTable = aCommsDb.OpenTableLC( TPtrC( WLAN_SECONDARY_SSID ) ); 
+			//CleanupStack::Pop(wLanSecserviceTable); // wLanSecserviceTable
+		 	TBuf<4> blank;
+		 	blank.Append(KNullDesC);
+		    
+		    TBool sssid = EFalse;
+	        TBool sussid = EFalse;
+
+	        for(TInt i = 0; i < iSecSSID.Count(); i++ )
+	        	{
+	        	TUint32 id ;
+	        	
+		        
+		        TInt retval = wLanSecserviceTable->InsertRecord(id);
+		        wLanSecserviceTable->WriteUintL(TPtrC(WLAN_SEC_SSID_SERVICE_ID), indexToSec );
+		        wLanSecserviceTable->WriteUintL(TPtrC(WLAN_SEC_SSID_ID), id );
+
+		 	    if( iSecSSID[i]->iSSSID != NULL)
+		 	    sssid = ETrue;
+		 	    if(iSecSSID[i]->iSUSSID != NULL)
+		 	    sussid = ETrue;
+		 	    
+		 	    if((sssid && iSecSSID[i]->iSSSID->Value() != blank) || (sussid && iSecSSID[i]->iSUSSID->Value() != blank ))
+		 	    {
+		 		if( sssid )
+		 		wLanSecserviceTable->WriteTextL(TPtrC(WLAN_SEC_SSID_SCANNED_SSID), iSecSSID[i]->iSSSID->Value());
+			
+				if(sussid)
+				wLanSecserviceTable->WriteTextL(TPtrC(WLAN_SEC_SSID_USED_SSID), iSecSSID[i]->iSUSSID->Value());
+		        
+		 	    }
+		 	    wLanSecserviceTable->PutRecordChanges();
+		 	    sssid = EFalse;
+	            sussid = EFalse;
+	        	}
+	        	CleanupStack::PopAndDestroy( wLanSecserviceTable );
+			}
+			
+			iSecSSID.ResetAndDestroy();
+			iSecSSID.Close();
+        if ( iPriSSID )
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_SSID" ) );
+            // Save NU_WLAN_SSID
+        	wLanServiceTable->WriteTextL( TPtrC(NU_WLAN_SSID), iPriSSID->Value() );
+            }
+        if ( iPriUSSID )
+            {        
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_USED_SSID" ) );
+            // Save WLAN_USED_SSID	
+    	      wLanServiceTable->WriteTextL( TPtrC(WLAN_USED_SSID), iPriUSSID->Value() );
+            }
+        if ( iPriHSSID )
+            {        
+    	    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_SCAN_SSID" ) );
+            // Save WLAN_SCAN_SSID
+    	    wLanServiceTable->WriteBoolL( TPtrC(WLAN_SCAN_SSID), ETrue );
+            }
+        else
+            {
+    	    wLanServiceTable->WriteBoolL( TPtrC(WLAN_SCAN_SSID), EFalse );            	
+            }
+
+       	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WEP_INDEX" ) );
+        // Save index of key in use
+        wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_INDEX ), 
+                                      (TUint32&) iDefaultWepKeyIndex );
+        FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WEP_INDEX: (%d)"),  iDefaultWepKeyIndex) );
+
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL NU_WLAN_AUTHENTICATION_MODE" ) );
+        // Open / Shared (0/1)
+        // Save index of key in use
+        wLanServiceTable->WriteUintL( TPtrC( NU_WLAN_AUTHENTICATION_MODE ), 
+                                     ( TUint32& ) iAuthentication );
+        FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL NU_WLAN_AUTHENTICATION_MODE: (%d)"),  iAuthentication) );
+        
+        
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY1" ) );
+        // Save first WEP key
+        wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY1 ), iKeyData[0] );
+        wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY1_FORMAT ), 
+                                 ( TUint32& ) iKeyFormat[0] );
+        FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[0] ) );
+        
+        
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY2" ) );
+        // Save second WEP key
+        wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY2 ), iKeyData[1] );
+        wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY2_FORMAT ), 
+                                 ( TUint32& ) iKeyFormat[1] );
+        FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[1] ) );
+            
+        
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY3" ) );
+        // Save third WEP key
+        wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY3 ), iKeyData[2] );
+        wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY3_FORMAT ), 
+                                 ( TUint32& ) iKeyFormat[2] );
+        FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[2] ) );
+            
+            
+        
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY4" ) );
+        // Save fourth WEP key
+        wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY4 ), iKeyData[3] );
+        wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY4_FORMAT ), 
+                                 ( TUint32& ) iKeyFormat[3] );
+        FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[3] ) );
+            
+        
+        if ( iWpaPresKeyAsc )
+            {     
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL convert WPAKEY to ascii" ) );
+            // convert unicode to 8-bit ascii
+            TBuf8<KMaxWpaPskLength> wpaKey;
+            StrCopy( wpaKey, iWpaPresKeyAsc->Value() );
+            
+            // Enable WPA Pre Shared key mode
+            wLanServiceTable->WriteBoolL( TPtrC( WLAN_ENABLE_WPA_PSK ), ETrue );
+            
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WPA_PRE_SHARED_KEY" ) );
+            // Save PreShared Key
+            wLanServiceTable->WriteTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), 
+                                         wpaKey );
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WPA_KEY_LENGTH" ) ); 
+            // Save PreShared Key Length
+            wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), 
+                                         wpaKey.Length() );                                         
+            }
+
+        TBuf<KMaxLengthOfEapList> eapList;
+        eapList.Copy(KEapAll);
+
+        for (TInt i=0;i<iEapTypeArray.Count();i++)
+            {
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings" ) );
+            CEapTypeElement* eap = iEapTypeArray[i];
+            
+            if ( eap->iEAPSettings->iCertificatesPresent )
+            	{
+            	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL Certificate was present." ) );
+            	eap->iEAPSettings->iCertificates.AppendL( *eap->iCertificate );	
+            	}                  
+
+            // Save EAP list
+            if ( eap->iEapTypeString.Length() > 0  
+            	 && eap->iEncapsulatingExpandedEapId.Length() == 0) // AND method is not encapsulated
+                {
+                FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_EAPS" ) );
+                
+                TBuf8<3> buf;
+                _LIT8(KFormat, "%d");
+                // pick the last byte from the array
+                buf.Format(KFormat, eap->iEapTypeString[KExpandedEapIdLength - 1]);
+                // search for the correct offset for the eap type from the KEapAll literal
+                TInt index = KEapAll().Find(buf);
+                
+                const TUint8 offset = 2; //length = f "-0" string
+                // Add '+' to the correct offset, so that the eap is repsesented activated in the list
+                if(index >= offset)
+                    {
+                    eapList[index-offset] = KEapPlus; 
+                    }
+                
+                }
+            
+			// Set iEncapsulatingEapTypes
+			for ( TInt j = 0; j < iEapTypeArray.Count(); j++ )
+				{
+				// Check if any method has this method as the encapsulating method
+				if ( eap->iEapTypeString == iEapTypeArray[j]->iEncapsulatingExpandedEapId )
+					{
+					// Append this method to iEncapsulatedEAPType
+					eap->iEAPSettings->iEncapsulatedEAPTypes.Append( iEapTypeArray[j]->iEAPSettings->iEAPType );
+					eap->iEAPSettings->iEncapsulatedEAPTypesPresent = ETrue;
+					}
+				}			
+			
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings CEapType::NewL" ) );        
+            CEapType* eapType = NULL;
+
+            TRAPD( error, ( eapType = CEapType::NewL( eap->iEapTypeString, ELan, serviceId ) ) );
+
+            if ( ( error == KErrNone ) && eapType )
+                {
+                CleanupStack::PushL( eapType );
+                
+                // Check if this type is tunneled
+                if ( eap->iEncapsulatingExpandedEapId.Length() > 0 )
+                	{
+                	// It is tunneled. Take the last byte of the expanded id.
+                	eapType->SetTunnelingType( eap->iEncapsulatingExpandedEapId[KExpandedEapIdLength - 1] );
+                	
+                	}
+                
+                FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings SetConfigurationL" ) );
+                TRAP_IGNORE( eapType->SetConfigurationL( *eap->iEAPSettings ) );
+                
+                CleanupStack::PopAndDestroy( eapType );
+                
+                }
+            else
+                {
+                FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL CEapType::NewL err: %d"), error ) );
+                }
+
+
+            FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings done" ) );
+            }
+            
+            
+	
+	  		// Expanded EAP types in use. Write the eap list to the new columns.
+    		
+    		// generate appropriate entries in the new enabled and disabled list,
+    		// overwriting those values 
+    		
+    		// count the + and - signs to determine the size of enabled and 
+    		// disabled descriptors
+
+    		TLex lex( eapList );
+    		TInt numPlus = 0;
+    		TInt numMinus = 0;
+    		TChar ch;
+    		while ( !lex.Eos() )
+    		    {
+    		    ch = lex.Get();
+    		    if ( ch == '+' ) ++numPlus;
+    		    else if ( ch == '-' ) ++numMinus;
+    		    }
+    		    
+    		// each entry consumes 8 bytes in binary format
+    		HBufC8* enabledEAPPlugin = HBufC8::NewL( 8 * numPlus );
+    		CleanupStack::PushL( enabledEAPPlugin );
+    		
+    		HBufC8* disabledEAPPlugin = HBufC8::NewL( 8 * numMinus );
+    		CleanupStack::PushL( disabledEAPPlugin );
+    		    
+    		lex.Assign( eapList );
+    		
+    		while ( !lex.Eos() )
+    		    {
+    		    // beginning of implementation UID
+    		    TInt16 implUid = 0;
+    		    
+    		    if ( lex.Val( implUid ) != KErrNone || !implUid )
+    		        {
+    		        // if the old string is corrupted, null out both lists
+    		        enabledEAPPlugin->Des().Zero();
+    		        disabledEAPPlugin->Des().Zero();
+    		        break;
+    		        }
+    		
+    		    // append it to the appropriate list ('+' enabled, '-' disabled)
+    		    _LIT8( KPadding, "\xFE\0\0\0\0\0\0" );
+    		    _LIT8( KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0");
+    		    const TInt KPlainMsChapV2ImplUid = 99;
+    		    
+    		    if ( implUid > 0 )
+    		        {
+    		        enabledEAPPlugin->Des().Append( 
+    		                            Abs( implUid ) == KPlainMsChapV2ImplUid? 
+    		                                        KMsChapV2Padding: KPadding );
+    		        enabledEAPPlugin->Des().Append( Abs( implUid ) );
+    		        }
+    		    else if (implUid < 0 )
+    		        {
+    		        disabledEAPPlugin->Des().Append( 
+    		                            Abs( implUid ) == KPlainMsChapV2ImplUid? 
+    		                                        KMsChapV2Padding: KPadding );
+    		        disabledEAPPlugin->Des().Append( Abs( implUid ) );
+    		        }
+    		    
+    		    // swallow the delimiter (',')
+    		    lex.Get();
+    		    }
+                	
+	
+	
+	  		wLanServiceTable->WriteTextL( TPtrC( WLAN_ENABLED_EAPS ), 
+    		                              enabledEAPPlugin? 
+    		                                    (const TDesC8&)*enabledEAPPlugin: 
+    		                                    (const TDesC8&)KNullDesC8 );
+    		
+    		wLanServiceTable->WriteTextL( TPtrC( WLAN_DISABLED_EAPS ), 
+    		                              disabledEAPPlugin? 
+    		                                    (const TDesC8&)*disabledEAPPlugin: 
+    		                                    (const TDesC8&)KNullDesC8 );
+    		CleanupStack::PopAndDestroy( disabledEAPPlugin );
+    		CleanupStack::PopAndDestroy( enabledEAPPlugin );
+    
+     
+            
+       iEapTypeArray.ResetAndDestroy();
+       wLanServiceTable->PutRecordChanges();
+  
+
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL PutRecordChanges" ) ); 
+        CleanupStack::PopAndDestroy( wLanServiceTable );
+        
+        FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL done" ) );
+	    aCommsDb.CommitTransaction();
+	    }
+	else
+	    {
+	    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL ignored not a WLAN AP" ) );
+	    }
+	    
+    }
+
+//------------------------------------------------------------------------------
+// CWPAPNapdef::ConvertAsciiToHex
+//------------------------------------------------------------------------------
+//
+void CWPAPNapdef::ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest )
+	{
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertAsciiToHex" ) );
+	
+	_LIT( hex, "0123456789ABCDEF" );
+	TInt size = aSource.Size();
+	TPtr8 ptr = aDest->Des();
+	for ( TInt ii = 0; ii < size; ii++ )
+		{
+		TText8 ch = aSource[ii];
+		ptr.Append( hex()[(ch/16)&0x0f] );
+		ptr.Append( hex()[ch&0x0f] );
+		}
+    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertAsciiToHex Done" ) );
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::StrCopy
+// String copy with lenght check.
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::StrCopy( TDes8& aTarget, const TDesC& aSource )
+    {
+    FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::StrCopy" ) );
+    
+	TInt len = aTarget.MaxLength();
+    if( len < aSource.Length() ) 
+	    {
+		aTarget.Copy( aSource.Left( len ) );
+		return;
+	    }
+	aTarget.Copy( aSource );
+	
+	FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::StrCopy Done" ) );
+    }
+
+CEapTypeElement::~CEapTypeElement()
+    {
+    delete iEAPSettings;
+    delete iCertificate;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::UpdateLingerL
+// 
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::UpdateLingerL(const TUint32 aIapId)
+{
+		if ( iLinger && ( !iLingerFlag ) )
+		{
+    	AddLingerL( aIapId , iLingerValue );
+		}
+		
+}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::UdateligerValueL
+// 
+// -----------------------------------------------------------------------------
+//
+void CWPAPNapdef::UdateligerValueL(CWPParameter* aLinger)
+{
+		TInt err(KErrNone);
+		const TDesC& value = aLinger->Value();
+		if( !Notalpha(value))
+		{
+		TLex lex( value );
+		TUint Linger = 0;
+		TInt lingerint;
+		err = lex.Val( Linger, EDecimal );
+		if( err == KErrNone )
+		{
+		    lingerint = Linger;
+			if( lingerint >= 0 )
+		    {
+		    	iLingerValue = lingerint;
+		    	iLingerFlag = EFalse;
+		    }
+		}
+		}
+}
+
+// -----------------------------------------------------------------------------
+// CWPAPNapdef::UdateligerValueL
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CWPAPNapdef::Notalpha(const TDesC& aValue)
+{
+	TBool NotAlpha = EFalse;
+	TChar character;
+	for(TInt i = 0 ; i < aValue.Length(); i++)
+	{
+		character = aValue[i];
+		NotAlpha = character.IsAlpha();
+		if(NotAlpha)
+		break;
+	}
+	
+	return NotAlpha;
+}
+
+
+// ---------------------------------------------------------------------------
+// Adds iapID and linger interval to CentralRepository
+// ---------------------------------------------------------------------------
+//
+void CWPAPNapdef::AddLingerL( const TInt aIapId, const TInt aLingerInterval )
+    {
+    TInt    err( KErrNone );
+    
+    // Open repository
+    CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager );
+    
+    // Find if an entry for "iapId" already exists in CentRep 
+    RArray< TUint32 > foundKeys;
+    foundKeys.Reset();
+    
+    err = repository->FindEqL( KIapColumn,       // partial key
+                               KColumnMask,      // key mask
+                               aIapId,           // value
+                               foundKeys );      // found keys
+    
+    if ( err == KErrNone || err == KErrNotFound )
+        {
+        if ( foundKeys.Count() == 0 )
+            {
+            // Add a new entry
+            TInt arrayCount( 0 );
+            
+            // Get number of iapId&linger entries in Centrep
+            err = repository->Get( KPdpContextManagerLingerArrayCount, 
+                                   arrayCount );
+        
+            if ( err == KErrNone )
+                {
+                arrayCount++;
+                
+                err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); 
+                
+                if ( err == KErrNone )
+                    {
+                    err = repository->Create( ( KLingerColumn | arrayCount ), 
+                                               aLingerInterval );     
+                    }
+                
+                if ( err == KErrNone )
+                    {
+                    // Update number of iapId&linger entries in Centrep
+                    err = repository->Set( KPdpContextManagerLingerArrayCount, 
+                                           arrayCount );
+                    }
+                }
+            }
+        else
+            {
+            // Update existing entry on current row
+            TInt32 row = foundKeys[ 0 ] & KRowMask;
+            
+            err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); 
+            }         
+        }
+        
+    foundKeys.Close();
+    CleanupStack::PopAndDestroy( repository );
+    
+    User::LeaveIfError( err );
+    
+    }
+
+void CWPAPNapdef::ConvertEAPStringToIds( const TDesC& aEAPString, TDes8& aExpandedId, TUint& aId)
+	{
+    if ( aEAPString == KEAPSIM )
+		{	
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapSim" ) );
+		aExpandedId.Copy( KEapSimTypeId, KExpandedEapIdLength );		
+		aId = EAPSettings::EEapSim;
+		}
+    else if( aEAPString == KEAPAKA )
+        {
+  		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapAka" ) );
+		aExpandedId.Copy( KEapAkaTypeId, KExpandedEapIdLength );	
+		aId = EAPSettings::EEapAka;	
+        }
+    else if( aEAPString == KEAPTLS )
+        {
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapTls" ) );
+		aExpandedId.Copy( KEapTlsTypeId, KExpandedEapIdLength );	
+		aId = EAPSettings::EEapTls;	
+        }
+    else if( aEAPString == KEAPPEAP )
+        {
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapPeap" ) );
+		aExpandedId.Copy( KEapPeapTypeId, KExpandedEapIdLength );	
+		aId = EAPSettings::EEapPeap;	
+        }
+    else if( aEAPString == KEAPTTLS )
+        {
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapTtls" ) );
+		aExpandedId.Copy( KEapTtlsTypeId, KExpandedEapIdLength );		
+		aId = EAPSettings::EEapTtls;
+        }
+   else if( aEAPString == KEAPLEAP )
+        {
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapLeap" ) );
+		aExpandedId.Copy( KEapLeapTypeId, KExpandedEapIdLength );
+		aId = EAPSettings::EEapLeap;		
+        }                                    
+   else if( aEAPString == KEAPMSCHAPV2 )
+        {
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapMschapv2" ) );
+		aExpandedId.Copy( KEapMschapv2TypeId, KExpandedEapIdLength );		
+		aId = EAPSettings::EEapMschapv2;
+        }     
+   else if( aEAPString == KEAPGTC )
+        {
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapGtc" ) );
+		aExpandedId.Copy( KEapGtcTypeId, KExpandedEapIdLength );
+		aId = EAPSettings::EEapGtc;
+        }
+   else if( aEAPString == KEAPFAST )
+        {
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapFast" ) );
+		aExpandedId.Copy( KEapFastTypeId, KExpandedEapIdLength );
+		aId = EAPSettings::EEapFast;
+        }
+
+    else
+        {
+		FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapNone" ) );
+		aExpandedId.Copy( KEapNoneId, KExpandedEapIdLength );
+		aId = EAPSettings::EEapNone;
+        }
+
+	}
+ 
+// ---------------------------------------------------------------------------
+// Returns the NAP-ID
+// ---------------------------------------------------------------------------
+//
+const TDesC& CWPAPNapdef::NapId()
+    {
+	return iNapID->Value();	
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the bearer value
+// ---------------------------------------------------------------------------
+//    
+TUint CWPAPNapdef::Bearer()
+	{
+	return iBearer;
+	}
+    
+// ---------------------------------------------------------------------------
+// Returns the bearer value
+// ---------------------------------------------------------------------------
+//    
+void CWPAPNapdef::SetCMManager( RCmManagerExt* aCm )
+	{
+	iCm = aCm;
+	}
+    
+    
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPPhysicalProxy.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 2002 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:    Defines a class, which holds physical proxy information.
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+
+#include "CWPAPPhysicalProxy.h"				// Own header
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+#include <WPAdapterUtil.h>
+#include <featmgr.h>
+#include "CWPAPLogicalProxy.h"
+#include "CWPAPPort.h"
+#include "CWPAPNapdef.h"
+#include "WPAPAdapter.pan"
+#include "CWPLog.h"
+#include "WPAPDefs.h"
+#include <cmconnectionmethodext.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPAPPhysicalProxy* CWPAPPhysicalProxy::NewLC( 
+                                            const TDesC& aDefaultName, 
+                                            CWPCharacteristic& aCharacteristic, 
+    CWPCharacteristic& aLogicalCharacteristic,
+    CWPAPPort*& aPort )
+	{
+	CWPAPPhysicalProxy* self = new(ELeave) CWPAPPhysicalProxy( 
+	                                                    aDefaultName, 
+                                                        aLogicalCharacteristic,
+                                                        aPort ); 
+	CleanupStack::PushL( self );
+	self->ConstructL();
+    aCharacteristic.AcceptL( *self );
+	return self;
+	}
+	
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CWPAPPhysicalProxy::~CWPAPPhysicalProxy()
+	{
+	delete iPort;
+
+    iNapdefs.ResetAndDestroy();
+    iNapdefs.Close();
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::ValidateL
+// -----------------------------------------------------------------------------
+//
+TBool CWPAPPhysicalProxy::ValidateL()
+	{
+	TBool isValid( EFalse );
+
+	// We must have proxy address otherwise this proxy isn't valid.
+	if ( iProxyAddr )
+		{
+		switch ( iPxAddrType )
+			{
+			case EPxAddrTypeIPv4:
+				{
+				isValid = WPAdapterUtil::CheckIPv4( iProxyAddr->Value() );
+				break;
+				}
+            case EPxAddrTypeIPv6:
+                {
+                isValid = FeatureManager::FeatureSupported( KFeatureIdIPv6 )
+                    && WPAdapterUtil::CheckIPv6( iProxyAddr->Value() );
+                break;
+                }
+			case EPxAddrTypeUnsupported:
+				{
+				isValid = EFalse;
+				break;
+				}
+			default: // default value is assumed to be EPxAddrTypeIPv4
+				{
+				isValid = WPAdapterUtil::CheckIPv4( iProxyAddr->Value() );
+				}
+			}
+		}
+	return isValid;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::AddDataL
+// -----------------------------------------------------------------------------
+//
+void CWPAPPhysicalProxy::AddDataL( RCmConnectionMethodExt& aCmItem )
+	{  
+	LOG("--CWPAP CWPAPPhysicalProxy::AddDataL begin--");	
+	TInt err(KErrNone);
+	
+	// CMManager
+	aCmItem.SetStringAttributeL( CMManager::ECmWapIPGatewayAddress, iProxyAddr->Value());
+	LOG2("CWPAP EApWapStartPage, value: %S, err: %d",
+	                                             &iProxyAddr->Value(), err);
+
+	//CMManager
+	aCmItem.SetStringAttributeL( CMManager::ECmIPGateway, iProxyAddr->Value());
+	LOG2("CWPAP EApIspIPGateway, value: %S, err: %d",
+	                                             &iProxyAddr->Value(), err);
+
+	//CMManager 
+	aCmItem.SetStringAttributeL( CMManager::ECmProxyServerName, iProxyAddr->Value() );
+	LOG2("CWPAP EApProxyServerAddress, value: %S, err: %d",
+	                                                &iProxyAddr->Value(), err);
+	                                               
+
+	// Store port data
+	if ( iPort )
+        {
+        iPort->AddDataL( aCmItem );
+        }
+    
+    if ( iLogicalPort)
+        {
+        iLogicalPort->AddDataL( aCmItem );
+        }
+    if ( err ) err = 0; // prevent compiler warning
+    
+	LOG("--CWPAP CWPAPPhysicalProxy::AddDataL end--");	
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::AddItemsL
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPPhysicalProxy::AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
+                                    CWPAPItemBase* iLogicalProxy, 
+                                    CWPAPItemBase* /*iPhysicalProxy*/ ) 
+	{
+    TInt count( 0 );
+    for( TInt i( 0 ); i < iNapdefs.Count(); i++ )
+        {
+        CWPAPNapdef* pp = iNapdefs[ i ];
+        if( pp->ValidateL() )
+            {
+            count += pp->AddItemsL( aItems, iLogicalProxy, this );
+            }
+        }
+
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::Name
+// -----------------------------------------------------------------------------
+//
+const TDesC& CWPAPPhysicalProxy::Name()
+	{
+    if( iName )
+        {
+        return iName->Value();
+        }
+    else 
+        {
+        return KNullDesC;
+        }
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPPhysicalProxy::VisitL( CWPCharacteristic& aCharacteristic )
+	{
+	TInt type = aCharacteristic.Type();
+	
+	// Accept only KWPPort characteristics
+	// One valid port is enough for us
+	if ( type == KWPPort && !iPort )
+		{
+        CWPAPPort* port = CWPAPPort::NewLC( aCharacteristic );
+
+		if ( port->ValidateL() )
+			{
+			iPort = port;
+			CleanupStack::Pop( port );
+			}
+		else // Data not valid.
+			{
+			CleanupStack::PopAndDestroy( port );
+			}
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPPhysicalProxy::VisitL( CWPParameter& aParameter)
+	{
+	TInt id = aParameter.ID();
+	const TDesC& value = aParameter.Value();
+
+	if ( value.Length() == 0 )
+		{
+		// No use to store zero length value.
+		return;
+		}
+
+	switch ( id )
+		{
+		case EWPParameterPxAddrFQDN: // iGatewayIPAddress
+			{
+			// Implementation comments:
+			// The value of this field is a domain name but we can't 
+			// at the moment resolve this to IP address 
+			// (at least from this adapter).
+			// Therefore this field can't be used. 
+			// EWPParameterPxAddr is supported
+			// and should be used.
+
+			/// Validate the domain name
+			/// Resolve to IP address
+
+			/* // Uncomment if domain name can be validated and IP address resolved
+			// Add only if we haven't already received this field
+			if ( !IsReceived( EWPParameterPxAddrFQDN_id ))
+				{
+				iGatewayIPAddress = &aParameter;
+				MarkReceived( EWPParameterPxAddrFQDN_id );
+				}
+			*/
+			break;
+			}
+		case EWPParameterPxAddr: // iGatewayIPAddress
+			{
+			// Accept only first occurrence of either PxAddr or PxAddrFQDN
+			if ( IsReceived( EWPParameterPxAddrFQDN_id ) ||
+				IsReceived( EWPParameterPxAddr_id ) )
+				{
+				return;
+				}
+			else 
+				{
+				// The max allowed lenght for proxy address is 45 bytes. 
+				// Nothing is stored if max lenght is exceeded
+				if ( aParameter.Value().Length() < 46 )
+					{
+					iProxyAddr = &aParameter;
+					MarkReceived( EWPParameterPxAddr_id );
+					}
+				}
+			break;
+			}
+		case EWPParameterPxAddrType:
+			{
+			if ( !IsReceived( EWPParameterPxAddrType_id ) )
+				{
+				// Only IPv4 addresses are supported.
+				if ( value == KIPV4 )
+					{
+					iPxAddrType = EPxAddrTypeIPv4;
+					}
+                else if( value == KIPV6 )
+                    {
+                    iPxAddrType = EPxAddrTypeIPv6;
+                    }
+				else
+					{
+					iPxAddrType = EPxAddrTypeUnsupported;
+					}
+				MarkReceived( EWPParameterPxAddrType_id );
+				}
+			break;
+			}
+        case EWPParameterName:
+            {
+            if( !iName )
+                {
+                iName = &aParameter;
+                }
+            break;
+            }
+		default:
+			{
+			// Just let through
+			}
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPPhysicalProxy::VisitLinkL( CWPCharacteristic& aLink )
+	{
+    CWPAPNapdef* item = CWPAPNapdef::NewLC( ETrue,
+                                            iDefaultName,
+                                            iLogicalCharacteristic,
+                                            aLink );
+    User::LeaveIfError( iNapdefs.Append( item ) );
+    CleanupStack::Pop( item ); // item
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::CWPAPPhysicalProxy
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPAPPhysicalProxy::CWPAPPhysicalProxy( 
+                               const TDesC& aDefaultName, 
+                               CWPCharacteristic& aLogicalCharacteristic,
+                               CWPAPPort*& aPort ) 
+	                         : CWPAPItemBase( aDefaultName ), 
+                               iLogicalPort( aPort ),
+                               iNapdefs( KInitialArraySize ),
+                               iLogicalCharacteristic( aLogicalCharacteristic )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPhysicalProxy::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPAPPhysicalProxy::ConstructL()
+	{
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPPort.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2002 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:    Defines a class, which holds proxy port information.
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+
+#include "CWPAPPort.h"					// Own header
+#include "WPAPAdapter.pan"
+#include "CWPLog.h"
+#include "WPAPDefs.h"
+
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPAPPort* CWPAPPort::NewLC( CWPCharacteristic& aCharacteristic )
+	{
+	CWPAPPort* self = new(ELeave) CWPAPPort(); 
+	CleanupStack::PushL( self );
+	self->ConstructL();
+    aCharacteristic.AcceptL( *self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::CWPAPPort
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPAPPort::CWPAPPort() : CWPAPItemBase( KNullDesC )
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CWPAPPort::~CWPAPPort()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::Validate
+// -----------------------------------------------------------------------------
+//
+TBool CWPAPPort::ValidateL()
+	{
+	// If we got either service or portnumber and 
+	// Those we successfully interpreted the port
+	// information is valid.
+	if ( IsReceived( EWPParameterService_id ) ||
+		IsReceived( EWPParameterPortNbr_id ))
+		{
+		return ETrue;
+		}
+	LOG("CWPAP ERROR! Port not valid");
+	return EFalse; // Nothing received so this is invalid.
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::AddData
+// -----------------------------------------------------------------------------
+//
+void CWPAPPort::AddDataL( RCmConnectionMethodExt& aCmItem )
+	{    
+	LOG("--CWPAP CWPAPPort::AddDataL begin--");	
+	TInt err(KErrNone);
+	
+	// CMManager
+	TRAP (err, aCmItem.SetBoolAttributeL( CMManager::ECmWapIPSecurity, iConnectionSecurity ));
+	LOG2("CWPAP EApWapSecurity, value: %d, err: %d", iConnectionSecurity, err);
+
+	// CMManager
+	TRAP (err, aCmItem.SetIntAttributeL( CMManager::ECmWapIPWSPOption, iSessionMode ));
+	LOG2("CWPAP EApWapWspOption, value: %d, err: %d", iSessionMode, err);
+
+	if ( iPortNbr )
+		{
+		const TDesC& value = iPortNbr->Value();
+		TLex lex( value );
+		TUint32 intValue=0;
+		err = lex.Val( intValue, EDecimal );
+		if ( err == KErrNone )
+			{
+			if( intValue > 65535 )
+				{
+				intValue = 0;
+				}
+				
+			// CMManager 
+			TRAP (err, aCmItem.SetIntAttributeL( CMManager::ECmProxyPortNumber, intValue ));
+			LOG2("CWPAP EApProxyPortNumber, value: %d, err: %d",
+			                                                 intValue, err);
+			}
+		}
+	LOG("--CWPAP CWPAPPort::AddDataL end--");	
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::Name
+// -----------------------------------------------------------------------------
+//
+const TDesC& CWPAPPort::Name()
+	{
+    return KNullDesC;
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::AddItemsL
+// -----------------------------------------------------------------------------
+//
+TInt CWPAPPort::AddItemsL( RPointerArray<CWPAPAccesspointItem>& /*aItems*/,
+                           CWPAPItemBase* /*aLogicalProxy*/,
+                           CWPAPItemBase* /*aPhysicalProxy*/ ) 
+	{
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPPort::VisitL( CWPCharacteristic& /*aCharacteristic*/ )
+	{	
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::VisitL
+// -----------------------------------------------------------------------------
+//
+void CWPAPPort::VisitL( CWPParameter& aParameter )
+	{
+	TInt id = aParameter.ID();
+	const TDesC& value = aParameter.Value();
+
+	if ( value.Length() == 0 )
+		{
+		// No use of checking the zero legth parameter.
+		return;
+		}
+
+	switch ( id )
+		{
+		case EWPParameterService: // iConnectionSecurity and iSessionMode
+			{
+			// If EWPParameterService value have already received
+			// or service type has been solved from EWPParameterPortNbr value
+			// don't accept this anymore. 
+			if ( IsReceived( EWPParameterService_id ) )
+				{
+				break;
+				}
+
+			if ( value == KCLWSP)
+				{
+				// CMManager
+				SetValues( EFalse, CMManager::ECmWapWspOptionConnectionless, 
+					EWPParameterPortNbr_id );
+				}
+			else if ( value == KCOWSP)
+				{
+				// CMManager
+				SetValues( EFalse, CMManager::ECmWapWspOptionConnectionOriented, 
+					EWPParameterPortNbr_id );
+					
+				}
+			else if ( value == KCLSECWSP)
+				{
+				// CMManager
+				SetValues( ETrue, CMManager::ECmWapWspOptionConnectionless, 
+					EWPParameterPortNbr_id );
+				}
+			else if ( value == KCOSECWSP)
+				{
+				// CMManager
+				SetValues( ETrue, CMManager::ECmWapWspOptionConnectionOriented, 
+					EWPParameterPortNbr_id );
+				}
+			else
+				{
+				// Not supported...
+				}
+			break;
+			}
+		case EWPParameterPortNbr: // iConnectionSecurity and iSessionMode
+			{
+			// If EWPParameterPortNbr value have already handled 
+			// don't accept it anymore.
+			if ( IsReceived( EWPParameterPortNbr_id ) )
+				{
+				break;
+				}
+
+			// Store the pointer to port parameter
+			iPortNbr = &aParameter;
+            MarkReceived( EWPParameterPortNbr_id );
+
+			if ( value == K9200 )
+				{
+				// CMManager
+				SetValues( EFalse, CMManager::ECmWapWspOptionConnectionless, 
+					EWPParameterPortNbr_id );
+					
+				// Type of service identified. 
+				// No need for Service parameter anymore.
+				MarkReceived( EWPParameterService_id );
+				}
+			else if ( value == K9201 || value == K80 ||	value == K8080)
+				{
+				// CMManager
+				SetValues( EFalse, CMManager::ECmWapWspOptionConnectionOriented, 
+					EWPParameterPortNbr_id );
+				MarkReceived( EWPParameterService_id );
+				}
+			else if ( value == K9202 )
+				{
+				// CMManager
+				SetValues( ETrue, CMManager::ECmWapWspOptionConnectionless, 
+					EWPParameterPortNbr_id );
+				MarkReceived( EWPParameterService_id );
+				}
+			else if ( value == K9203 || value == K443 )
+				{
+				// CMManager
+				SetValues( ETrue, CMManager::ECmWapWspOptionConnectionOriented, 
+					EWPParameterPortNbr_id );
+				MarkReceived( EWPParameterService_id );
+				}
+			else
+				{
+				// Not supported...
+				}
+			break;
+			}
+		default:
+			{
+			// Just let through
+			}
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::SetValues
+// -----------------------------------------------------------------------------
+//
+void CWPAPPort::SetValues( TBool aConnectionSecurity, 
+                           TInt aSessionMode,
+	                       TMarkedField aReceivedField )
+	{
+	__ASSERT_DEBUG( aReceivedField == EWPParameterService_id || 
+                    aReceivedField == EWPParameterPortNbr_id,
+                    Panic( EPreConditionFail ) );
+
+	iConnectionSecurity = aConnectionSecurity;
+	iSessionMode = aSessionMode;
+
+	MarkReceived( aReceivedField );
+	}
+
+// -----------------------------------------------------------------------------
+// CWPAPPort::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPAPPort::ConstructL()
+	{
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPLog.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2002 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:   Class offers static utility functions for CWmlBMSubItem.
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include "CWPLog.h"
+
+
+#ifdef ENABLE_LOGGING
+#include <flogger.h>
+
+/// Folder where the WMLBC log resides
+_LIT( KLogFolder, "ringbc" );
+
+/// The name of the log file
+_LIT( KLogFileName, "ringbc.txt" );
+
+/// The format in which the time is formatted in log
+_LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d ");
+
+/// The length of the string produced by KLogTimeFormat
+const TInt KLogTimeFormatLength = 16;
+
+/// How many characters a log line can contain
+const TInt KLogLineLength = 256;
+
+#endif // ENABLE_LOGGING       
+
+// ================= MEMBER FUNCTIONS =======================
+
+#ifdef ENABLE_LOGGING
+// ---------------------------------------------------------
+// Log() 
+//
+// ---------------------------------------------------------
+void Log::DoLog( TRefByValue<const TDesC> aText, ... )
+    {
+    VA_LIST args;
+    VA_START( args, aText );
+
+    TBuf<KLogLineLength> buf;
+    buf.FormatList( aText, args );
+
+#ifdef _DEBUG
+#ifdef LOG_TO_FILE
+	RFileLogger logger;
+	TInt ret = logger.Connect();
+	if (ret==KErrNone)
+		{
+		logger.SetDateAndTime( EFalse,EFalse );
+		logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend );		
+		TBuf<KLogTimeFormatLength> timeStamp;
+		TTime now;
+		now.HomeTime();
+		TDateTime dateTime;
+		dateTime = now.DateTime();
+		timeStamp.Format( KLogTimeFormat, 
+            dateTime.Hour(), dateTime.Minute(),
+            dateTime.Second(), dateTime.MicroSecond() );
+		buf.Insert( 0, timeStamp );
+
+		logger.Write(buf);
+		}
+
+	logger.Close();
+
+#else
+    RDebug::Print( buf );
+#endif // LOG_TO_FILE
+#endif // _DEBUG
+    VA_END( args );
+    }
+
+#endif // ENABLE_LOGGING
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPLog.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2002 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:   Logging class
+*
+*/
+
+
+
+
+
+#ifndef CWPLOG_H
+#define CWPLOG_H
+
+/////////////////////////////////////////////////////////////////////////////
+// #Defines that control printing of additional information to debug stream.
+/////////////////////////////////////////////////////////////////////////////
+
+// INCLUDES
+
+#include "CWPLogDef.h"
+#include <e32std.h>
+
+// DEFINES
+
+#ifdef ENABLE_LOGGING
+#define LOG(s) Log::DoLog(_L(s))
+#define LOG1(s, v) Log::DoLog( _L(s), v )
+#define LOG2(s, v1, v2) Log::DoLog( _L(s), v1, v2 )
+#else
+#define LOG(s)
+#define LOG1(s, v)
+#define LOG2(s, v1, v2)
+#endif // ENABLE_LOGGING
+
+// DATA TYPES
+
+
+// CLASS DECLARATION
+
+/**
+* Class offers logging functionality.
+*/
+class Log
+    {
+
+    public:
+
+        /**
+        * Log the message.
+		* @param aText text to be written to log.
+        */
+        static void DoLog( TRefByValue<const TDesC> aText, ... );
+
+    private: // constructor
+        
+		/// Prohibited default constructor
+		Log();
+
+		/// Prohibited copy constructor
+		Log( const Log& );
+    
+		/// Prohibited assignment operator
+		Log& operator=( const Log& );
+    };
+
+#endif // CWPLOG_H
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/CWPLogDef.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2002 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:   Logging class definition
+*
+*/
+
+
+
+
+
+#ifndef CWPLOGDEF_H
+#define CWPLOGDEF_H
+
+/////////////////////////////////////////////////////////////////////////////
+// #Defines that control printing of additional information to debug stream.
+/////////////////////////////////////////////////////////////////////////////
+
+// Defining this enables logging
+//#define ENABLE_LOGGING
+
+// Defining this will direct all messages to a log file
+//#define LOG_TO_FILE
+
+#endif // LOGDEF_H
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/WPAPAdapterGroupProxy.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2002 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:    Table of plugins for ECom
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "CWPAPAdapter.h"
+
+// CONSTANTS
+const TImplementationProxy KImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY(0x101F84D9, CWPAPAdapter::NewL)
+	};
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
+
+	return KImplementationTable;
+	}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/WPAPAdapterPanics.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2002 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:    Panic implementation
+*
+*/
+
+
+
+
+// INCLUDES
+
+#include <e32std.h>             // for GLDEF_C
+#include "WPAPAdapter.pan"
+
+// CONSTANTS
+
+_LIT(KWPAPAdapter, "wpapadapter.dll");
+
+GLDEF_C void Panic( TInt aPanic )
+    {
+    User::Panic( KWPAPAdapter, aPanic );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/Src/WPAPUtil.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2002 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:    Class offers common utility methods.
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "WPAPUtil.h"			// Own header
+#include <WPAdapterUtil.h>
+
+// CONSTANTS
+// Commented out by JN
+//#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+    _LIT( KAdapterName, "WPAPAdapterResource" );
+//#else
+//    _LIT( KAdapterName, "WPAPAdapter" );
+//#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// WPAPUtil::ReadHBufCLC
+// -----------------------------------------------------------------------------
+//
+HBufC* WPAPUtil::ReadHBufCL( TInt aResourceId )
+	{
+    TFileName fileName;
+    Dll::FileName( fileName );
+
+    return WPAdapterUtil::ReadHBufCL( fileName, KAdapterName, aResourceId );
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/group/101F84D8.rss	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2002 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:   Resource file defining the AccesspointAdapter plugin.
+*
+*/
+
+
+
+
+//  INCLUDES
+#include "registryinfo.rh"
+
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// theInfo
+// Resource defining the ProvisioningAdapter plugin.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x101F84D8;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x101F84D5;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x101F84D9;
+					version_no = 1;
+					display_name = "WAP AP PA"; // Use short name to save RAM and ROM space
+					default_data = "";
+					opaque_data = "0";
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapter.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002-2006 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 accesspoint adapter.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+
+TARGET          WPAPAdapter.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101F84D8
+
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+SOURCEPATH      ../Src
+SOURCE          CWPAPAdapter.cpp 
+SOURCE          CWPAPItemBase.cpp
+SOURCE          CWPAPAccesspointItem.cpp
+SOURCE          CWPAPNapdef.cpp
+SOURCE          CWPAPLogicalProxy.cpp
+SOURCE          CWPAPPhysicalProxy.cpp
+SOURCE          CWPAPPort.cpp
+SOURCE          WPAPUtil.cpp
+SOURCE          WPAPAdapterPanics.cpp
+SOURCE          WPAPAdapterGroupProxy.cpp
+SOURCE          CWPLog.cpp
+
+SOURCEPATH      ../group
+
+START RESOURCE 101F84D8.rss
+TARGET WPAPAdapter.rsc
+END
+
+START RESOURCE WPAPAdapterResource.rss
+HEADER
+TARGET WPAPAdapterResource.rsc
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END  
+
+
+USERINCLUDE     ../Inc
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE 	/epoc32/include/ecom
+
+LIBRARY         euser.lib
+LIBRARY         ProvisioningEngine.lib
+LIBRARY         apengine.lib
+LIBRARY         commdb.lib
+LIBRARY         FeatMgr.lib
+LIBRARY         ecom.lib
+LIBRARY 		centralrepository.lib
+LIBRARY			cmmanager.lib
+DEBUGLIBRARY    flogger.lib     // Only in debug builds
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapterResource.rss	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2002 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:   Resource file.
+*
+*/
+
+
+
+
+//  INCLUDES
+#include <badef.rh>
+#include <wpapadapter.loc>
+
+// Rich text labels
+
+RESOURCE LBUF r_qtn_sm_wapap_name
+	{ 
+	txt = qtn_sm_wapap_name; 
+	}
+
+RESOURCE LBUF r_qtn_sm_wml_accesspoints
+	{ 
+	txt = qtn_sm_wml_accesspoints; 
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/group/bld.inf	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2001-2007 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 AccesspointAdapter CP adapter
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/WPAPAdapter.iby	CORE_MW_LAYER_IBY_EXPORT_PATH(WPAPAdapter.iby) 
+../rom/WPAPAdapterResources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(WPAPAdapterResources.iby) 
+
+// export localised loc file
+../loc/WPAPAdapter.loc        MW_LAYER_LOC_EXPORT_PATH(wpapadapter.loc)
+
+PRJ_MMPFILES
+WPAPAdapter.mmp
+
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/loc/WPAPAdapter.loc	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2002-2004 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 is a localisation file for AccesspointAdapter
+*
+*/
+
+
+
+
+// LOCALISATION STRINGS
+
+//d: Summary text for access points
+//l: popup_info_list_pane_t2/opt1
+//r: 5.0 
+
+#define qtn_sm_wml_accesspoints "Access points:"
+
+//d:This is the default name for new WAP access point. 
+//l:query_popup_data_pane_t1/opt4
+//r: 5.0
+
+#define qtn_sm_wapap_name "WAP access point"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/rom/WPAPAdapter.iby	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007 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 wpapadapter
+*
+*/
+
+
+
+
+#ifndef WPAPADAPTER_IBY
+#define WPAPADAPTER_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+#include <bldvariant.hrh>
+
+ECOM_PLUGIN(WPAPAdapter.dll, WPAPAdapter.rsc)
+
+#endif // WPAPADAPTER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/accesspointadapter/rom/WPAPAdapterResources.iby	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007 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 wpapadapter
+*
+*/
+
+
+
+
+#ifndef WPAPADAPTERRESOURCES_IBY
+#define WPAPADAPTERRESOURCES_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+#include <bldvariant.hrh>
+
+data=DATAZ_\RESOURCE_FILES_DIR\WPAPAdapterResource.rsc RESOURCE_FILES_DIR\WPAPAdapterResource.rsc
+
+#endif // WPAPADAPTERRESOURCES_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/data/2000b4af.rss	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2007 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:   Resource definitions for project wpdestinationnwadapter
+*
+*/
+
+
+
+#include <registryinfov2.rh>
+#include "wpdestinationnwadapteruids.h"
+
+// ---------------------------------------------------------------------------
+// theInfo
+// Resource defining the Destination network adapter plugin.
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = KDestinationNetworkAdapterDllUid3;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KProvisioningAdapterInterface;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KDestinationNetworkAdapterUid;
+                    version_no = 1;
+                    display_name = "Destination Network Provisioning Adapter||Copyright © 2007 Nokia Corporation.";
+                    default_data = "";
+                    opaque_data = "10";
+                    rom_only = 1;
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/data/wpdestinationnwadapter.rss	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2007 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:   Resource definitions for project wpdestinationnwadapter
+*
+*/
+
+
+
+
+#include <badef.rh>
+#include <bldvariant.hrh>
+#include <wpdestinationnwadapter.loc>
+
+RESOURCE LBUF r_qtn_sm_head_destination_network
+    {
+    txt = qtn_sm_head_destination_network;
+    }
+
+RESOURCE LBUF r_qtn_sm_default_name_destination_network
+    {
+    txt = qtn_sm_default_name_destination_network;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/group/bld.inf	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007 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 wpnwdestinationadapter
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/wpdestinationnwadapter.iby	CORE_MW_LAYER_IBY_EXPORT_PATH(wpdestinationnwadapter.iby) 
+../rom/wpdestinationnwadapter_resources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(wpdestinationnwadapter_resources.iby) 
+
+// export localised loc file
+../loc/wpdestinationnwadapter.loc	MW_LAYER_LOC_EXPORT_PATH(wpdestinationnwadapter.loc)
+
+
+PRJ_MMPFILES
+
+./wpdestinationnwadapter.mmp
+
+
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/group/wpdestinationnwadapter.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* 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
+*                whole of cwpdestinationnwadapter.dll.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          wpdestinationnwadapter.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x2000B4AF
+
+OPTION GCC  -save-temps
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          cwpdestinationnwadapter.cpp
+SOURCE          cwpdestinationnwitem.cpp
+SOURCE          wpdestinationnwadaptergroupproxy.cpp
+
+SOURCEPATH      ../data
+
+START RESOURCE 2000b4af.rss
+TARGET wpdestinationnwadapter.rsc
+END
+
+START RESOURCE wpdestinationnwadapter.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     .
+USERINCLUDE     ../inc
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../inc
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY         euser.lib
+LIBRARY         provisioningengine.lib
+LIBRARY         charconv.lib
+LIBRARY         apengine.lib
+LIBRARY         commdb.lib
+LIBRARY         cmmanager.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/inc/cwpdestinationnwadapter.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,283 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* 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:   Handles destination network provisioning.
+*
+*/
+
+
+
+#ifndef CWPDESTINATIONNWADAPTER_H
+#define CWPDESTINATIONNWADAPTER_H
+
+#include <CWPAdapter.h>
+#include <MWPContextExtension.h>
+
+#include "cwpdestinationnwitem.h"
+
+class CWPCharacteristic;
+
+/**
+ *  Realizes destination network provisioning adapter.
+ *
+ *  Destination network adapter handles destination network provisioning and
+ *  stores them via Connection Method Manager API.
+ *
+ *  @lib cwpdestinationnwadapter.lib
+ *  @since S60 v3.2.
+ */
+class CWPDestinationNwAdapter : public CWPAdapter, public MWPContextExtension
+    {
+    /**
+     * Friend class for unit testing - uncomment when running tests.
+     */
+    //friend class UT_wpdestinationnwadapter;
+
+public:
+
+    static CWPDestinationNwAdapter* NewL();
+
+    virtual ~CWPDestinationNwAdapter();
+
+    /**
+     * Converts given 8-bit descriptor to TUint32.
+     *
+     * @since S60 v3.2.
+     * @param aDes Descriptor to be converted.
+     * @return Unsigned 32-bit integer.
+     */
+    TUint32 CWPDestinationNwAdapter::Des8ToUint32L( const TDesC8& aDes );
+
+// from base class CWPAdapter
+
+    /**
+     * From CWPAdapter.
+     * Checks the number of settings items.
+     *
+     * @since S60 v3.2.
+     * @return Quantity of items (always one).
+     */
+    TInt ItemCount() const;
+
+    /**
+     * From CWPAdapter.
+     * Getter for the summary title of Destination network settings. The text
+     * is shown to the user in an opened configuration message.
+     *
+     * @since S60 v3.2.
+     * @param aIndex Location of the settings item. Not used.
+     * @return Summary title.
+     */
+    const TDesC16& SummaryTitle( TInt aIndex ) const;
+
+    /**
+     * From CWPAdapter.
+     * Getter for the summary text of Destination network settings. The text
+     * is shown to the user in opened configuration message.
+     *
+     * @since S60 v3.2.
+     * @param aIndex Location of the settings item.
+     * @return Summary text.
+     */
+    const TDesC16& SummaryText( TInt aIndex ) const;
+
+    /**
+     * From CWPAdapter.
+     * Saves a destination network.
+     *
+     * @since S60 v3.2.
+     * @param aIndex Location of the settings item.
+     */
+    void SaveL( TInt aIndex );
+
+    /**
+     * From CWPAdapter.
+     * Returns EFalse since a destination cannot be set as default.
+     *
+     * @since S60 v3.2.
+     * @param aIndex Location of the settings item to be queried. Not used.
+     * @return Information whether these settings can be set as default.
+     */
+    TBool CanSetAsDefault( TInt /*aIndex*/ ) const;
+
+    /**
+     * From CWPAdapter.
+     * Adapter sets the settings as default. Not supported.
+     *
+     * @since S60 v3.2.
+     * @param aIndex Location of the settings item to be set as default.
+     */
+    inline void SetAsDefaultL( TInt /*aIndex*/ );
+
+    /**
+     * From CWPAdapter.
+     * Query for detailed information about the destination network.
+     * This is not supported feature as in other adapters in the framework.
+     * Always returns KErrNotSupported.
+     *
+     * @since S60 v3.2.
+     * @param aItem Not used but here because of inheritance.
+     * @param aVisitor Object for retrieveing details of a setting entry.
+     *                 Not used.
+     * @return KErrNotSupported if not supported.
+     */
+    TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
+
+    /**
+     * From CWPAdapter.
+     * Visit method. Visits the adapter. Adapter checks from 
+     * aCharacteristic if the data is targeted to it and acts according to
+     * that.
+     *
+     * @since S60 v3.2.
+     * @param aCharacteristic The characteristic found.
+     */
+    void VisitL( CWPCharacteristic& aCharacteristic );        
+
+    /**
+     * From CWPAdapter.
+     * Visit method. Visits the adapter. Method sets parameter values to
+     * destination network settings item.
+     *
+     * @since S60 v3.2.
+     * @param aParameter The parameter found.
+     */
+    void VisitL( CWPParameter& aParameter );        
+
+    /**
+     * From CWPAdapter.
+     * Visit method. Used for linking settings to NAPDEF definition.
+     *
+     * @since S60 v3.2.
+     * @param aLink Link to the characteristic.
+     */
+    void VisitLinkL( CWPCharacteristic& aLink );
+
+    /**
+     * From CWPAdapter.
+     * Gets the saving information from the adapter that has saved settings.
+     *
+     * @since S60 v3.2.
+     * @param aIndex Index of the previously saved item.
+     * @param aSavingInfo Saving info.
+     */
+    void GetSavingInfoL( TInt aIndex, RPointerArray<HBufC8>& aSavingInfo );
+
+    /**
+     * From CWPAdapter.
+     * Informs the adapters of the saved settings.
+     * Not used.
+     *
+     * @since S60 v3.2.
+     * @param aAppIdOfSavingItem UID of the adapter component. 
+     * @param aAppRef APPREF of the saved settings.
+     * @param aStorageIdValue Value that identifies the settings in its
+     *        storage.
+     */
+    inline void SettingsSavedL( const TDesC8& /*aAppIdOfSavingItem*/,
+        const TDesC8& /*aAppRef*/, const TDesC8& /*aStorageIdValue*/ );
+
+    /**
+     * From CWPAdapter.
+     * Lets the adapters know when the saving has been finalized in 
+     * viewpoint of the provisioning framework. The adapters can make 
+     * finalization of saving the settings after receiving this call.
+     * Not used.
+     *
+     * @since S60 v3.2.
+     */
+    inline void SavingFinalizedL();
+
+// from base class MWPContextExtension
+
+    /**
+     * From MWPContextExtension.
+     * Returns a pointer to a context extension.
+     *
+     * @since S60 v3.2.
+     * @param aExtension Contains a pointer to MWPContextExtension if
+     *                   supported.
+     * @return KErrNotSupported if not supported, otherwise KErrNone.
+     */
+    TInt ContextExtension( MWPContextExtension*& aExtension );
+
+    /**
+     * From MWPContextExtension.
+     * Returns the data used for saving.
+     *
+     * @since S60 v3.2.
+     * @param aIndex The index of the data.
+     * @return The data; ownership is transferred.
+     */
+    const TDesC8& SaveDataL( TInt aIndex ) const;
+
+    /**
+     * From MWPContextExtension.
+     * Deletes a saved destination network.
+     *
+     * @since S60 v3.2.
+     * @param aSaveData The data used for saving.
+     */
+    void DeleteL( const TDesC8& aSaveData );
+
+    /**
+     * From MWPContextExtension.
+     * Returns the UID of the adapter.
+     *
+     * @since S60 v3.2.
+     * @return UID of the adapter.
+     */
+    TUint32 Uid() const;
+
+private:
+
+    CWPDestinationNwAdapter();
+
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Application ID of the current characteristic.
+     */
+    TPtrC iAppId;
+
+    /**
+     * Title for destination network. Value read from the resource file 
+     * in initiation phase.
+     * Own.
+     */
+    HBufC16* iDefaultTitle;
+
+    /**
+     * Name for destination network. Value read from the resource file 
+     * in initiation phase.
+     * Own.
+     */
+    HBufC16* iDefaultName;
+
+    /**
+     * Destination network item.
+     * Own.
+     */
+    CWPDestinationNwItem* iCurrentItem;
+
+    /**
+     * Destination Network items.
+     */
+    RPointerArray<CWPDestinationNwItem> iItems;
+    };
+
+#include "cwpdestinationnwadapter.inl"
+
+#endif // CWPDESTINATIONNWADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/inc/cwpdestinationnwadapter.inl	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007 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:   cwpdestinationnwadapter.h inline functions.
+*
+*/
+
+
+
+// -----------------------------------------------------------------------------
+// CWPDestinationNwAdapter::SetAsDefaultL
+// -----------------------------------------------------------------------------
+//
+inline void CWPDestinationNwAdapter::SetAsDefaultL( TInt /*aIndex*/ )
+    {
+    };
+
+// -----------------------------------------------------------------------------
+// CWPDestinationNwAdapter::SettingsSavedL
+// -----------------------------------------------------------------------------
+//
+inline void CWPDestinationNwAdapter::SettingsSavedL( 
+    const TDesC8& /*aAppIdOfSavingItem*/, const TDesC8& /*aAppRef*/, 
+    const TDesC8& /*aStorageIdValue*/ )
+    {
+    };    
+
+// -----------------------------------------------------------------------------
+// CWPDestinationNwAdapter::SavingFinalizedL
+// -----------------------------------------------------------------------------
+//
+inline void CWPDestinationNwAdapter::SavingFinalizedL()
+    {
+    };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/inc/cwpdestinationnwitem.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2007 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:   Settings item for one destination network. Also handles
+*                saving destination networks to permanent storage.
+*
+*/
+
+
+
+#ifndef CWPDESTINATIONNWITEM_H
+#define CWPDESTINATIONNWITEM_H
+
+#include <e32base.h>
+#include <cmmanagerext.h>
+
+class CWPCharacteristic;
+
+/**
+ *  Destination network settings item.
+ *
+ *  Destination network item handles saving destination networks via
+ *  Connection Method Manager API.
+ *
+ *  @lib cwpdestinationnwadapter.lib
+ *  @since S60 v3.2.
+ */
+class CWPDestinationNwItem : public CBase
+    {
+    /**
+     * Friend classes for unit testing - uncomment when running tests.
+     */
+    //friend class UT_wpdestinationnwadapter;
+
+public:
+
+    static CWPDestinationNwItem* NewL();
+
+    virtual ~CWPDestinationNwItem();
+
+    /**
+     * Setter for APPREF.
+     * @since S60 v3.2.
+     * @param aAPPREF.
+     */
+    void SetAppRefL( const TDesC8& aAppRef );
+
+    /**
+     * Setter for user viewable name of the setting.
+     * @since S60 v3.2.
+     * @param aNAME. Value is TCP or UDP.
+     */
+    void SetSettingsNameL( const TDesC& aSettingsName );
+
+    /**
+     * Setter for NAPDEF (IAP settings).
+     * @since S60 v3.2.
+     * @param aNapDef.
+     */
+    void AddNapDefL( CWPCharacteristic* aNapDef );
+
+    /**
+     * Getter for APPREF value.
+     * @since S60 v3.2.
+     * @return APPREF.
+     */
+    const TDesC8& AppRef() const;
+
+    /**
+     * Getter for user viewable name of Destination network.
+     * @since S60 v3.2.
+     * @return Settings name.
+     */
+    const TDesC& SettingsName() const;
+
+    /**
+     * Saves the destination network settings.
+     * @since S60 v3.2.
+     */
+    void SaveL();
+
+    /**
+     * Return destination network ID.
+     * @since S60 v3.2.
+     * @return ID of the destination network.
+     */
+    const TDesC8& SaveData() const;
+
+private:
+
+    /**
+     * Creates a network destination.
+     * @since S60 v3.2.
+     * @param aCmManager Connection Method Manager handle.
+     * @return Network destination.
+     */
+    RCmDestinationExt CreateDestinationL( RCmManagerExt& aCmManager );
+
+		/**
+     * Returnes the Iap id that matches the given Wap id.
+     * @since S60 v3.2.3
+     * @param aWapId IAP's Wap Id.
+     * @return Iap Id.
+     */
+		TUint32 IapIdFromWapIdL( TUint32 aWapId );
+		
+private:
+
+    void ConstructL();
+    CWPDestinationNwItem();
+
+private: // data
+
+    /**
+     * Destination network reference identity in provisioning document.
+     * Own.
+     */
+    HBufC8* iAppRef;
+
+    /**
+     * Name of destination network visible to user when viewing the
+     * provisioning message.
+     * Own.
+     */
+    HBufC* iSettingsName;
+
+    /**
+     * Array of NAPDEFs, IAP settings.
+     * Not own. (Contained pointers are deleted by ProvisioningEngine.)
+     */
+    RPointerArray<CWPCharacteristic> iNapDefs;
+
+    /**
+     * ID value of the referred IAP.
+     */
+    TUint32 iIAPId;
+
+    /** 
+     * Destination network ID as a descriptor to be returned by the
+     * SaveData method to the framework via adapters SaveDataL.
+     * Own.
+     */
+    HBufC8* iSavedProfileId;
+
+    };
+
+#endif // CWPDESTINATIONNWITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/inc/wpdestinationnwadapteruids.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007 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:   Destination network adapter UIDs.
+*
+*/
+
+
+
+#ifndef WPDESTINATIONNWADAPTERUIDS_H
+#define WPDESTINATIONNWADAPTERUIDS_H
+
+// MACROS
+ 
+// ECOM plugin
+#define KECOMUid2 0x10009D8D
+
+// UID2 for the Destination Network adapter. ECOM plug-in.
+#define KDestinationNetworkAdapterDllUid2 KECOMUid2
+
+// UID3 for the Destination Network adapter DLL.
+#define KDestinationNetworkAdapterDllUid3 0x2000B4AF
+
+// Implementation UID for the Destination Network adapter.
+#define KDestinationNetworkAdapterUid 0x2000B4AE
+
+// Interface UID from Client Provisioning adapter base class.
+#define KProvisioningAdapterInterface 0x101F84D5
+
+#endif //  WPDESTINATIONNWADAPTERUIDS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/inc/wpdestinationnwdebug.h	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007 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:   Enables and disables debug prints.
+*
+*/
+
+
+
+#ifndef WPDESTINATIONNWDEBUG_H
+#define WPDESTINATIONNWDEBUG_H
+
+#include <e32debug.h>
+
+#ifdef _DEBUG
+#define DBG_PRINT( p )          RDebug::Print( _L( p ) )
+#define DBG_PRINT_2( p, i )     RDebug::Print( _L( p ), i )
+#define DBG_PRINT_3( p, i, u )  RDebug::Print( _L( p ), i, u )
+#else
+#define DBG_PRINT( p )
+#define DBG_PRINT_2( p, i )
+#define DBG_PRINT_3( p, i, u )
+#endif // _DEBUG
+
+
+#endif // WPDESTINATIONNWDEBUG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/loc/wpdestinationnwadapter.loc	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2007 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:   Localization strings for project wpdestinationnwadapter
+*
+*/
+
+
+
+
+// d:Summary text for destination network.
+// l:msg_body_pane/opt
+// r:3.2
+//
+#define qtn_sm_default_name_destination_network "Unnamed"
+
+// d:Summary title for destination network.
+// l:msg_body_pane_t1
+// r:3.2
+//
+#define qtn_sm_head_destination_network "Destination networks:"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/rom/wpdestinationnwadapter.iby	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007 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:   wpdestinationnwadapter iby file
+*
+*/
+
+
+#ifndef WPDESTINATIONNWADAPTER_IBY
+#define WPDESTINATIONNWADAPTER_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( wpdestinationnwadapter.dll, 2000b4af.rsc )
+
+#endif // WPDESTINATIONNWADAPTER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/rom/wpdestinationnwadapter_resources.iby	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2007 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:   wpdestinationnwadapter resource iby file
+*
+*/
+
+
+#ifndef __WPDESTINATIONNWADAPTER_RESOURCES_IBY__
+#define __WPDESTINATIONNWADAPTER_RESOURCES_IBY__
+
+
+//Client Provisioning Destination network adapter resources
+data=DATAZ_\RESOURCE_FILES_DIR\wpdestinationnwadapter.rsc   RESOURCE_FILES_DIR\wpdestinationnwadapter.rsc
+
+
+#endif // __WPDESTINATIONNWADAPTER_RESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/src/cwpdestinationnwadapter.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* 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:    Receives and stores Destination network settings.
+*
+*/
+
+
+
+
+#include <e32base.h>
+#include <CWPAdapter.h>
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+#include <wpdestinationnwadapter.rsg>
+#include <e32des8.h>
+#include <WPAdapterUtil.h> // Adapter utils
+#include <utf.h> // Unicode conversion
+#include <cmmanagerext.h>
+#include <cmdestinationext.h>
+#include <cmconnectionmethodext.h>
+#include <cmmanagerdef.h>
+
+#include "cwpdestinationnwadapter.h"
+#include "wpdestinationnwdebug.h"
+
+_LIT( KDestinationNwAdapterName, "WPDestinationNwAdapter");
+_LIT( KDestinationNwAppID,       "w904C" ); // OMA CP registration document.
+_LIT8( KDestinationNwAppID8,     "w904C" ); // OMA CP registration document.
+
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::CWPDestinationNwAdapter
+// ---------------------------------------------------------------------------
+//
+CWPDestinationNwAdapter::CWPDestinationNwAdapter() : CWPAdapter()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwAdapter::ConstructL()
+    {
+    DBG_PRINT( "CWPDestinationNwAdapter::ConstructL - begin" );
+    TFileName fileName;
+    Dll::FileName( fileName );
+    // Read settings title from localization file. The title is shown to UI
+    // when OMA CP message is provisioned using WAPPUSH.
+    iDefaultTitle = WPAdapterUtil::ReadHBufCL( 
+        fileName,
+        KDestinationNwAdapterName,
+        R_QTN_SM_HEAD_DESTINATION_NETWORK );
+    // Read default settings name from localization file.
+    iDefaultName = WPAdapterUtil::ReadHBufCL( 
+        fileName,
+        KDestinationNwAdapterName,
+        R_QTN_SM_DEFAULT_NAME_DESTINATION_NETWORK );
+    DBG_PRINT( "CWPDestinationNwAdapter::ConstructL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::NewL
+// ---------------------------------------------------------------------------
+//
+CWPDestinationNwAdapter* CWPDestinationNwAdapter::NewL()
+    {
+    CWPDestinationNwAdapter* self = new (ELeave) 
+        CWPDestinationNwAdapter;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::~CWPDestinationNwAdapter
+// ---------------------------------------------------------------------------
+//
+CWPDestinationNwAdapter::~CWPDestinationNwAdapter()
+    {
+    DBG_PRINT( "CWPDestinationNwAdapter::~CWPDestinationNwAdapter - begin" );
+    delete iDefaultTitle;
+    delete iDefaultName;
+    iItems.ResetAndDestroy();
+    iItems.Close();
+    DBG_PRINT( "CWPDestinationNwAdapter::~CWPDestinationNwAdapter - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::Des8ToUint32L()
+// Converts an 8 bit descriptor to TUint32.
+// ---------------------------------------------------------------------------
+//
+TUint32 CWPDestinationNwAdapter::Des8ToUint32L( const TDesC8& aDes )
+    {
+    TLex8 lex( aDes );
+    TUint32 value( 0 );
+    User::LeaveIfError( lex.Val( value, EDecimal ) );
+    return value;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::ItemCount
+// From class CWPAdapter.
+// Checks the number of settings items.
+// ---------------------------------------------------------------------------
+//
+TInt CWPDestinationNwAdapter::ItemCount() const
+    {
+    return iItems.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// From class CWPAdapter.
+// CWPDestinationNwAdapter::SummaryTitle
+// Returns the summary title.
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CWPDestinationNwAdapter::SummaryTitle( TInt /*aIndex*/ ) const
+    {
+    return *iDefaultTitle;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::SummaryText
+// From class CWPAdapter.
+// Returns the summary text of a destination network.
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CWPDestinationNwAdapter::SummaryText( TInt aIndex ) const
+    {
+    if ( !iItems[aIndex]->SettingsName().Length() )
+        {
+        return *iDefaultName;
+        }
+    return iItems[aIndex]->SettingsName();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::SaveL
+// From class CWPAdapter.
+// Calls settings items saving method.
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwAdapter::SaveL( TInt aIndex )
+    {
+    __ASSERT_ALWAYS( aIndex >= 0 && aIndex < iItems.Count(),
+        User::Leave( KErrArgument ) );
+
+    iItems[aIndex]->SaveL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::CanSetAsDefault
+// From class CWPAdapter.
+// Not supported; always return EFalse.
+// ---------------------------------------------------------------------------
+//
+TBool CWPDestinationNwAdapter::CanSetAsDefault( TInt /*aIndex*/ ) const
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::DetailsL
+// From class CWPAdapter.
+// Not supported.
+// ---------------------------------------------------------------------------
+//
+TInt CWPDestinationNwAdapter::DetailsL( TInt /*aItem*/, 
+    MWPPairVisitor& /*aVisitor */ )
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::VisitL
+// From class CWPAdapter.
+// OMA CP characteristics are handled in this method.
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwAdapter::VisitL( 
+    CWPCharacteristic& aCharacteristic )
+    {
+    DBG_PRINT( "CWPDestinationNwAdapter::VisitL( characteristic ) - begin" );
+    switch ( aCharacteristic.Type() )
+        {
+        // This adapter only handles APPLICATION characteristic.
+        case KWPApplication:
+            {
+            iCurrentItem = CWPDestinationNwItem::NewL();
+            // Set default name for destination - replaced later if a name
+            // has been provisioned.
+            iCurrentItem->SetSettingsNameL( iDefaultName->Des() );
+            aCharacteristic.AcceptL( *this );
+
+            // Settings are for Destination network - append current item to
+            // item array to be saved later.
+            if ( 0 == iAppId.Compare( KDestinationNwAppID() ) )
+                {
+                iItems.AppendL( iCurrentItem );
+                }
+            // Settings are not for Destination network.
+            else
+                {
+                delete iCurrentItem;
+                iCurrentItem = NULL;
+                }
+            break;
+            }
+        // All other than APPLICATION are ignored.
+        default:
+            break;
+        }
+    DBG_PRINT( "CWPDestinationNwAdapter::VisitL( characteristic ) - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::VisitL
+// From class CWPAdapter.
+// Destination network parameters are handled in this method.
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwAdapter::VisitL( CWPParameter& aParameter )
+    {
+    DBG_PRINT( "CWPDestinationNwAdapter::VisitL( parameter ) - begin" );
+    // tmpValue holds the value converted from Unicode to UTF8.
+    HBufC8* tmpValue = HBufC8::NewLC( aParameter.Value().Length() ); // CS:1
+    TPtr8 ptrTmpValue( tmpValue->Des() );
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( ptrTmpValue,
+        aParameter.Value() );
+
+    switch ( aParameter.ID() )
+        {
+        // APPLICATION/APPID
+        case EWPParameterAppID:
+            {
+            iAppId.Set( aParameter.Value() );
+            break;
+            }
+
+        // APPLICATION/NAME
+        case EWPParameterName:
+            {
+            if ( iCurrentItem )
+                {
+                iCurrentItem->SetSettingsNameL( aParameter.Value() );
+                }
+            break;
+            }
+
+        // APPLICATION/APPREF
+        case EWPParameterAppRef:
+            {
+            if ( iCurrentItem )
+                {
+                iCurrentItem->SetAppRefL( tmpValue->Des() );
+                }
+            break;
+            }
+
+        // Other settings are ignored.
+        default:
+            {
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy( tmpValue ); // CS:0
+    DBG_PRINT( "CWPDestinationNwAdapter::VisitL( parameter ) - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::VisitLinkL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwAdapter::VisitLinkL( CWPCharacteristic& aLink )
+    {
+    if ( KWPNapDef == aLink.Type() && iCurrentItem )
+        {
+        iCurrentItem->AddNapDefL( &aLink );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::GetSavingInfoL
+// APPID is set to [0], APPREF to [1] and saving info (storage ID) to [2].
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwAdapter::GetSavingInfoL( TInt aIndex, 
+    RPointerArray<HBufC8>& aSavingInfo )
+    {
+    __ASSERT_ALWAYS( aIndex >= 0 && aIndex < iItems.Count(),
+        User::Leave( KErrArgument ) );
+
+    aSavingInfo.AppendL( KDestinationNwAppID8().AllocL() );
+    aSavingInfo.AppendL( iItems[aIndex]->AppRef().AllocL() );
+    aSavingInfo.AppendL( iItems[aIndex]->SaveData().AllocL() );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::ContextExtension
+// From class MWPContextExtension.
+// Returns a pointer to context extension.
+// ---------------------------------------------------------------------------
+//
+TInt CWPDestinationNwAdapter::ContextExtension( 
+    MWPContextExtension*& aExtension )
+    {
+    aExtension = this;
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::SaveDataL
+// From class MWPContextExtension.
+// Returns ID of saved data.
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPDestinationNwAdapter::SaveDataL( TInt aIndex ) const
+    {
+    __ASSERT_ALWAYS( aIndex >= 0 && aIndex < iItems.Count(),
+        User::Leave( KErrArgument ) );
+
+    return iItems[aIndex]->SaveData();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::DeleteL
+// From class MWPContextExtension.
+// Deletes a Destination network.
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwAdapter::DeleteL( const TDesC8& aSaveData )
+    {
+    DBG_PRINT( "CWPDestinationNwAdapter::DeleteL - begin" );
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager ); // CS:1
+    TUint32 destinationId = Des8ToUint32L( aSaveData );
+    RCmDestinationExt destination = cmManager.DestinationL( destinationId );
+    CleanupClosePushL( destination ); // CS:2
+    const TInt cmCount = destination.ConnectionMethodCount();
+    // First remove IAPs from destination network because this adapter must
+    // not delete IAPs.
+    for ( TInt counter = 0; counter < cmCount; counter++ )
+        {
+        destination.RemoveConnectionMethodL( 
+            destination.ConnectionMethodL( 0 ) );
+        destination.UpdateL();
+        }
+    CleanupStack::Pop( &destination ); // CS:1
+    destination.DeleteLD();
+    CleanupStack::PopAndDestroy( &cmManager ); // CS:0
+    DBG_PRINT( "CWPDestinationNwAdapter::DeleteL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwAdapter::Uid
+// From class MWPContextExtension.
+// Returns the UID of this adapter.
+// ---------------------------------------------------------------------------
+//
+TUint32 CWPDestinationNwAdapter::Uid() const
+    {
+    return iDtor_ID_Key.iUid;
+    }
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/src/cwpdestinationnwitem.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,345 @@
+/*
+* Copyright (c) 2007 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:    Settings item for one destination network. Also handles
+*                saving destination networks to permanent storage.
+*
+*/
+
+
+
+
+#include <wpdestinationnwadapter.rsg>
+#include <charconv.h>
+#include <CWPCharacteristic.h>
+#include <cmmanagerext.h>
+#include <cmdestinationext.h>
+#include <cmconnectionmethodext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmpluginwlandef.h> // For WLAN plugin UID, i.e. bearer type.
+
+#include "cwpdestinationnwitem.h"
+#include "wpdestinationnwdebug.h"
+
+const TInt KMaxCharsInTUint32 = 10;
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::NewL
+//
+// ---------------------------------------------------------------------------
+//
+CWPDestinationNwItem* CWPDestinationNwItem::NewL()
+    {
+    CWPDestinationNwItem* self = new ( ELeave ) CWPDestinationNwItem();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::CWPDestinationNwItem
+//
+// ---------------------------------------------------------------------------
+//
+CWPDestinationNwItem::CWPDestinationNwItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::~CWPDestinationNwItem
+//
+// ---------------------------------------------------------------------------
+//
+CWPDestinationNwItem::~CWPDestinationNwItem()
+    {
+    DBG_PRINT( "CWPDestinationNwItem::~CWPDestinationNwItem - begin" );
+    delete iAppRef;
+    delete iSettingsName;
+    iNapDefs.Close();
+    delete iSavedProfileId;
+    DBG_PRINT( "CWPDestinationNwItem::~CWPDestinationNwItem - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::ConstructL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwItem::ConstructL()
+    { 
+    DBG_PRINT( "CWPDestinationNwItem::ConstructL - begin" );
+    iAppRef         = HBufC8::NewL( 0 );
+    iSettingsName   = HBufC::NewL( 0 );
+    iSavedProfileId = HBufC8::NewL( KMaxCharsInTUint32 );
+    DBG_PRINT( "CWPDestinationNwItem::ConstructL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::SetAppRefL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwItem::SetAppRefL( const TDesC8& aAppRef )
+    {
+    delete iAppRef;
+    iAppRef = NULL;
+    iAppRef = aAppRef.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::SetSettingsNameL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwItem::SetSettingsNameL( const TDesC& aSettingsName )
+    {
+    delete iSettingsName;
+    iSettingsName = NULL;
+    iSettingsName = aSettingsName.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::AddNapDefL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwItem::AddNapDefL( CWPCharacteristic* aNapDef )
+    {
+    iNapDefs.AppendL( aNapDef );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::AppRef
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPDestinationNwItem::AppRef() const
+    {
+    return *iAppRef;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::SettingsName
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC& CWPDestinationNwItem::SettingsName() const
+    {
+    return *iSettingsName;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::SaveL()
+// Saves the Destination network using Extended connection settings API. 
+// ---------------------------------------------------------------------------
+//
+void CWPDestinationNwItem::SaveL()
+    {
+    DBG_PRINT( "CWPDestinationNwItem::SaveL - begin" );
+    // Number of IAPs that have been linked to this destination.
+    const TInt iapCount( iNapDefs.Count() );
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager ); // CS:1
+    RCmDestinationExt destination = CreateDestinationL( cmManager );
+    CleanupClosePushL( destination ); // CS:2
+    RCmConnectionMethodExt tempconn;
+    
+    // Add linked IAPs to destination.    
+    for ( TInt counter = 0; counter < iapCount; counter++ )
+        {
+        TPckgBuf<TUint32> apUid;
+        apUid.Copy( iNapDefs[counter]->Data( 0 ) );
+        // The stored id is the wap id. Convert it into the iap id
+        
+        TUint32 iapId = IapIdFromWapIdL( apUid() );
+        
+        apUid = NULL;
+        RCmConnectionMethodExt connection = 
+            cmManager.ConnectionMethodL( iapId );
+        CleanupClosePushL( connection ); // CS:5
+
+        RArray<TUint32> destinationIds;        
+        cmManager.AllDestinationsL( destinationIds );
+        CleanupClosePushL( destinationIds );
+        
+        TInt counter2(0);        
+        for ( counter2 = 0; counter2 < destinationIds.Count(); counter2++ )
+            {
+            RCmDestinationExt tempdest = cmManager.DestinationL( 
+                        destinationIds[counter2] );            
+            
+            TRAPD( err, tempconn = tempdest.ConnectionMethodByIDL( iapId ));
+                        
+            tempconn.Close();
+            tempdest.Close();
+            
+            if ( err != KErrNotFound )
+                {
+                // Found from other destination                  
+                break;                
+                }           
+            }                
+        if ( counter2 == destinationIds.Count() )
+            {
+            // Not found in any other destination
+            destination.AddConnectionMethodL( connection );            
+            }
+        else
+            {            
+            // Found in some other destination -> create copy
+            destination.AddConnectionMethodL( tempconn = connection.CreateCopyL() );
+            tempconn.Close();            
+            }
+        CleanupStack::PopAndDestroy( &destinationIds );
+
+        // Change seamlessness level for linked WLAN IAPs.
+        TUint32 bearerType = connection.GetIntAttributeL( 
+            CMManager::ECmBearerType );
+        if ( KUidWlanBearerType == bearerType )
+            {
+            connection.SetIntAttributeL( CMManager::ECmSeamlessnessLevel, 
+                CMManager::ESeamlessnessShowprogress );
+            connection.UpdateL();
+            }
+
+        destination.UpdateL();
+        CleanupStack::PopAndDestroy( &connection ); // CS:4
+        }    
+    destination.UpdateL(); // In case there were no IAP linkages.
+    // Destination ID is needed as a descriptor (used in linking settings).
+    TUint32 destinationId = destination.Id();
+    iSavedProfileId->Des().Num( destinationId, EDecimal );
+    // Pop destination & cmManager.
+    CleanupStack::PopAndDestroy( 2, &cmManager ); // CS:0
+    DBG_PRINT( "CWPDestinationNwItem::SaveL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::SaveData
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPDestinationNwItem::SaveData() const
+    {
+    return *iSavedProfileId;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::CreateDestinationL
+// Checks that settings name if unique, renames if necessary, and creates
+// a destination network.
+// ---------------------------------------------------------------------------
+//
+RCmDestinationExt CWPDestinationNwItem::CreateDestinationL( 
+    RCmManagerExt& aCmManager )
+    {
+    DBG_PRINT( "CWPDestinationNwItem::CreateDestinationL - begin" );
+    RArray<TUint32> destinationIds;
+    // Get destination ID's for checking if name to be set is reserved.
+    CleanupClosePushL( destinationIds ); // CS:1
+    aCmManager.AllDestinationsL( destinationIds );
+    const TInt destinationCount = destinationIds.Count();
+    // Destination's name to actually be used.
+    HBufC* newName = HBufC::NewLC( 
+        iSettingsName->Des().Length() + KMaxCharsInTUint32 ); // CS:2
+    newName->Des().Copy( iSettingsName->Des() );
+
+    // Check names from all existing destinations.
+    for ( TInt counter = 0; counter < destinationCount; counter++ )
+        {
+        RCmDestinationExt destination = aCmManager.DestinationL( 
+            destinationIds[counter] );
+        CleanupClosePushL( destination ); // CS:3
+        HBufC* settingsName = destination.NameLC(); // CS:4
+        // If destination exists, return it.
+        if ( 0 == newName->Des().Compare( settingsName->Des() ) )
+            {
+            // Pop settingsName & destination & newName
+            CleanupStack::PopAndDestroy( 3, &destination ); // CS:1
+            
+            RCmDestinationExt dest2 = aCmManager.DestinationL( 
+                    destinationIds[counter] );
+            
+            CleanupStack::PopAndDestroy( &destinationIds ); // CS:0
+            DBG_PRINT( "CWPDestinationNwItem::CreateDestinationL - end" );
+            return dest2;
+            }
+        // Pop settingsName & destination.
+        CleanupStack::PopAndDestroy( 2, &destination ); // CS:2
+        }
+   
+    // Create new a destination and return it.
+    RCmDestinationExt destination = aCmManager.CreateDestinationL( *newName );
+    // Pop newName & destinationIds
+    CleanupStack::PopAndDestroy( 2, &destinationIds ); // CS:0
+    DBG_PRINT( "CWPDestinationNwItem::CreateDestinationL - end" );
+    return destination;
+    }
+    
+// ---------------------------------------------------------------------------
+// CWPDestinationNwItem::IapIdFromWapId
+// Returns IAP ID from WAP ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CWPDestinationNwItem::IapIdFromWapIdL( TUint32 aWapId )
+    {
+    RCmManagerExt cmManager;
+    cmManager.OpenLC(); // CS:1
+    RArray<TUint32> iapIds;
+    TUint32 iapId( 0 );
+
+    // First get all free IAP ID's.
+    cmManager.ConnectionMethodL( iapIds );
+    CleanupClosePushL( iapIds ); // CS:2
+
+    // Then get IAP ID's from all destinations.
+    RArray<TUint32> destIds;
+    cmManager.AllDestinationsL( destIds );
+    CleanupClosePushL( destIds ); // CS:3
+    TInt destCount = destIds.Count();
+    for ( TInt destIndex = 0; destIndex < destCount; destIndex++ )
+        {
+        RCmDestinationExt dest = cmManager.DestinationL( 
+            destIds[destIndex] );
+        CleanupClosePushL( dest ); // CS:4
+        TInt cmCount = dest.ConnectionMethodCount();
+        for ( TInt cmIndex = 0; cmIndex < cmCount; cmIndex++ )
+            {
+            TUint32 apId = dest.ConnectionMethodL( 
+                cmIndex ).GetIntAttributeL( CMManager::ECmIapId );
+            iapIds.AppendL( apId );
+            }
+        CleanupStack::PopAndDestroy( &dest ); // CS:3
+        }
+    // Finally, go through all connection methods and find correct IAP ID.
+    const TInt cmCount = iapIds.Count();
+    for ( TInt counter = 0; counter < cmCount; counter++ )
+        {
+        TUint32 id = cmManager.GetConnectionMethodInfoIntL( 
+            iapIds[counter], CMManager::ECmWapId );
+        if ( id == aWapId )
+            {
+            iapId = iapIds[counter];
+            // No need to go through rest of IAPs.
+            break;
+            }
+        }
+    // PopAndDestroy destIds, iapIds, cmManager.
+    CleanupStack::PopAndDestroy( 3, &cmManager ); // CS:0
+    return iapId;
+    }
+
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/cpdestinationnwadapter/src/wpdestinationnwadaptergroupproxy.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007 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:    Destination network adapter implementation group proxy
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "wpdestinationnwadapteruids.h"
+#include "cwpdestinationnwadapter.h"
+
+// CONSTANTS
+const TImplementationProxy KImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KDestinationNetworkAdapterUid, 
+                                CWPDestinationNwAdapter::NewL )
+    };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Returns: TImplementationProxy*: pointer to TImplementationProxy
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+    TInt& aTableCount )
+    {
+    aTableCount = sizeof( KImplementationTable ) / 
+        sizeof( TImplementationProxy );
+    return KImplementationTable;
+    }
+
+// End of file.
--- a/policymanagement/policyengine/group/PolicyEngineServer.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/policymanagement/policyengine/group/PolicyEngineServer.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -52,6 +52,7 @@
 USERINCLUDE   ../../../inc // domain private headers
 
 MW_LAYER_SYSTEMINCLUDE
+APP_LAYER_SYSTEMINCLUDE
 SYSTEMINCLUDE /epoc32/include/xml
 SYSTEMINCLUDE /epoc32/include/comms-infras/commdb/protection
 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
--- a/policymanagement/policyengine/policyengineserver/inc/OperationParser.h	Thu Dec 17 09:07:52 2009 +0200
+++ b/policymanagement/policyengine/policyengineserver/inc/OperationParser.h	Thu Jan 07 13:15:03 2010 +0200
@@ -27,10 +27,10 @@
 #include "PolicyEngineClientServer.h"
 
 #include <e32base.h>
-#include <contenthandler.h>
-#include <documentparameters.h>
+#include <xml/contenthandler.h>
+#include <xml/documentparameters.h>
 #include <cstack.h>
-#include <parser.h>
+#include <xml/parser.h>
 
 // CONSTANTS
 // MACROS
--- a/policymanagement/policyengine/policyengineserver/inc/PolicyParser.h	Thu Dec 17 09:07:52 2009 +0200
+++ b/policymanagement/policyengine/policyengineserver/inc/PolicyParser.h	Thu Jan 07 13:15:03 2010 +0200
@@ -26,10 +26,10 @@
 #include "PolicyEngineClientServer.h"
 
 #include <e32base.h>
-#include <contenthandler.h>
-#include <documentparameters.h>
+#include <xml/contenthandler.h>
+#include <xml/documentparameters.h>
 #include <cstack.h>
-#include <parser.h>
+#include <xml/parser.h>
 
 // CONSTANTS
 
--- a/syncmlfw/common/http/inc/nsmlhttp.h	Thu Dec 17 09:07:52 2009 +0200
+++ b/syncmlfw/common/http/inc/nsmlhttp.h	Thu Jan 07 13:15:03 2010 +0200
@@ -27,7 +27,7 @@
 
 #include <http.h>
 #include <chttpformencoder.h>
-#include <mhttpauthenticationcallback.h>
+#include <http/mhttpauthenticationcallback.h>
 #include <e32test.h>
 #include <f32file.h>
 #include <uri8.h>
--- a/syncmlfw/common/syncagent/src/NSmlAgentBase.cpp	Thu Dec 17 09:07:52 2009 +0200
+++ b/syncmlfw/common/syncagent/src/NSmlAgentBase.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -31,7 +31,7 @@
 #include <centralrepository.h>
 #include <DevManInternalCRKeys.h>
 #include <e32property.h>
-#include <thttpevent.h>
+#include <http/thttpevent.h>
 #include "nsmlprivatepskeys.h"
 #include "nsmlcliagconstants.h"
 #include "NSmlAgentBase.h"
--- a/syncmlfw/dm/wappushalert/src/nsmldmwappushalert.cpp	Thu Dec 17 09:07:52 2009 +0200
+++ b/syncmlfw/dm/wappushalert/src/nsmldmwappushalert.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -23,7 +23,7 @@
 #include <pushlog.h>
 #include <pushmessage.h>
 #include <pluginkiller.h>
-#include <pushdispatcher.h>
+//#include <pushdispatcher.h>
 #include <ccontenthandlerbase.h>
 #include <implementationproxy.h> // For TImplementationProxy definition
 #include <SyncMLDef.h>
--- a/syncmlfw/ds/wappushalert/src/nsmldswappushalert.cpp	Thu Dec 17 09:07:52 2009 +0200
+++ b/syncmlfw/ds/wappushalert/src/nsmldswappushalert.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -23,7 +23,7 @@
 #include <pushlog.h>
 #include <pushmessage.h>
 #include <pluginkiller.h>
-#include <pushdispatcher.h>
+//#include <pushdispatcher.h>
 #include <ccontenthandlerbase.h>
 #include <implementationproxy.h> // For TImplementationProxy definition
 
--- a/syncmlfw/rom/NSmlDMSync.iby	Thu Dec 17 09:07:52 2009 +0200
+++ b/syncmlfw/rom/NSmlDMSync.iby	Thu Jan 07 13:15:03 2010 +0200
@@ -97,6 +97,24 @@
 REM wappushalert
 ECOM_PLUGIN(nsmldmwappushalert.dll,101F6DE3.rsc)
 
+#ifdef FF_DM_CONNMO_ADAPTER 
+// old internet adapter is not used in that case for access point provisioning.
+ECOM_PLUGIN(connmoadapter.dll,connmoadapter.rsc)
+#else
+ECOM_PLUGIN(nsmlinternetadapter.dll,nsmlinternetadapter.rsc)
+#endif FF_DM_CONNMO_ADAPTER
+
+#ifdef __SYNCML_DM_WLAN 
+ECOM_PLUGIN(globalwlanadapter.dll,globalwlanadapter.rsc)
+#endif // __SYNCML_DM_WLAN
+
+#ifdef __ALWAYS_ONLINE_PDPCONTEXT2
+ECOM_PLUGIN( nsmldmalwaysonadapter.dll, nsmldmalwaysonadapter.rsc )
+#endif // __ALWAYS_ONLINE_PDPCONTEXT2
+
+ECOM_PLUGIN( nsmldmbmadapter.dll, nsmldmbmadapter.rsc )
+ECOM_PLUGIN(wlanctrldcmoadapter.dll,wlanctrldcmoadapter.rsc)
+
 #ifdef __SYNCML_DM_OTA
 REM DM OMA provisioning 
 ECOM_PLUGIN(wpdm.dll,wpdm.rsc)
--- a/terminalsecurity/SCP/DmEventNotifier/group/DmEventNotifier.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/DmEventNotifier/group/DmEventNotifier.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -63,3 +63,5 @@
 //Added for SCPEventHandler dll 
 LIBRARY		scpeventhandler.lib
 LIBRARY		flogger.lib
+
+SMPSAFE
\ No newline at end of file
--- a/terminalsecurity/SCP/SCPClient/group/SCPClient.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/SCPClient/group/SCPClient.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -67,5 +67,7 @@
 LIBRARY					aknnotify.lib
 LIBRARY 		estor.lib
 
+SMPSAFE
+
 // End of file
 
--- a/terminalsecurity/SCP/SCPClient/src/SCPClient.cpp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/SCPClient/src/SCPClient.cpp	Thu Jan 07 13:15:03 2010 +0200
@@ -1198,42 +1198,54 @@
             TSCPButtonConfig aButtonsShown, TBool aECSSupport, TInt aFlags, TInt& aResFileSCP, TInt& aResFileSecUi) {
     Dprint((_L("[RSCPClient]-> SetSecurityCodeL() >>>")));
     Dprint((_L("[RSCPClient]-> input params - aButtonsShown=%d, aECSSupport=%d"), aButtonsShown, aECSSupport));
-    
+
     if(EFalse == isFlagEnabled) {
         (void)aPassword;
         Dprint((_L("[RSCPClient]-> ERROR: Function not supported in this variant")));
         User :: Invariant();
         return KErrNotSupported;
     }
+
     TInt lRet = LoadResources(aResFileSCP, aResFileSecUi);
+
     if(lRet != KErrNone) {
         return lRet;
     }
+
     TInt lDefCode = 0;
     CRepository* lRepository = CRepository :: NewLC(KCRUidSCPLockCode);
     lRet = lRepository->Get(KSCPLockCodeDefaultLockCode, lDefCode);
+
     if(lRet != KErrNone) {
         Dprint(_L("[RSCPClient]-> ERROR: Unable to perform get on CenRep, lErr=%d"), lRet);
         CleanupStack :: PopAndDestroy(lRepository);
         return lRet;
     }
+
     HBufC* codeHBuf = HBufC :: NewLC(KSCPPasscodeMaxLength + 1);
     HBufC8* addParamsHBuf = HBufC8 :: NewLC(KSCPMaxTARMNotifParamLen);
     TPtr codeBuffer = codeHBuf->Des();
     TPtr8 addParams = addParamsHBuf->Des();
+
     if(lDefCode == 0) {
         Dprint(_L("[RSCPClient]-> INFO: Default lock code has been set already by the user..."));
+
         lRet = RunDialogL(codeBuffer, aButtonsShown, KSCPPasscodeMinLength, KSCPPasscodeMaxLength,
                 R_SECUI_TEXT_ENTER_SEC_CODE, NULL, aECSSupport);
+
         if((lRet) && (lRet != ESecUiEmergencyCall) && (lRet != EAknSoftkeyEmergencyCall)) {
             Dprint(_L("[RSCPClient]-> INFO: User has updated the lock code..."));
+
             lRet = SendReceive( ESCPServAuthenticateS60, TIpcArgs( &codeBuffer, &aPassword, &addParams, aFlags));
+
             Dprint((_L("[RSCPClient]-> INFO: addParams.Length()=%d")), addParams.Length());
             Dprint((_L("[RSCPClient]-> INFO: lRet=%d")), lRet);
         }
         else {
             switch(lRet) {
             case 0:
+				lRet = KErrCancel;
+				break;
             case EAknSoftkeyEmergencyCall:
                 //lRet = KErrCancel;
                 break;
@@ -1251,7 +1263,7 @@
 
         HBufC* msgConfirmSave = NULL;
         CAknGlobalConfirmationQuery* query = CAknGlobalConfirmationQuery :: NewLC();
-        
+
         if(aButtonsShown == SCP_OK || aButtonsShown == SCP_OK_ETEL) {
             //msgConfirmSave = CEikonEnv :: Static()->AllocReadResourceLC(R_SET_SEC_CODE_STARTUP_QUERY);
             msgConfirmSave = CEikonEnv :: Static()->AllocReadResourceLC(R_SET_SEC_CODE);
@@ -1259,31 +1271,31 @@
         }
         else {
             msgConfirmSave = CEikonEnv :: Static()->AllocReadResourceLC(R_SET_SEC_CODE);
-        query->ShowConfirmationQueryL(statusSave, *msgConfirmSave, R_AVKON_SOFTKEYS_YES_NO__YES, R_QGN_NOTE_QUERY_ANIM);
+        	query->ShowConfirmationQueryL(statusSave, *msgConfirmSave, R_AVKON_SOFTKEYS_YES_NO__YES, R_QGN_NOTE_QUERY_ANIM);
         }
-        
+
         User :: WaitForRequest(statusSave);
         CleanupStack :: PopAndDestroy(2); // msgConfirmSave query
 
         if((statusSave == EAknSoftkeyYes) || (statusSave == EAknSoftkeyOk)) {
             Dprint(_L("[RSCPClient]-> INFO: calling GetNewCodeAndChange() ..."));
-            
+
             TBufC<10> NBuf(KSCPDefaultEnchSecCode);
             TPtr codeBuf = NBuf.Des();
-            
+
             TSCPSecCode lNewSecCode;
             TInt lButtonCfg = (aButtonsShown == SCP_OK || aButtonsShown == SCP_OK_ETEL) ? KSCPForcedChange : KSCPNormalChange;
             HBufC* lNewLkCodeBuf = NULL;
             lRet = GetNewCodeAndChange(codeBuf, lButtonCfg, &lNewSecCode, &lNewLkCodeBuf);
-            
+
             Dprint(_L("[RSCPClient]-> INFO: GetNewCodeAndChange() complete, err=%d"), lRet);
-            
+
             if(KErrNone == lRet) {
-                /* This is being called as a workaround for a freezing issue with SecUI. This is in place 
+                /* This is being called as a workaround for a freezing issue with SecUI. This is in place
                  * as a temporary measure until the source is identified.
                 */
                 TInt lTmpRet = SendReceive(ESCPServAuthenticateS60, TIpcArgs(&lNewLkCodeBuf->Des(), &aPassword, &addParams, aFlags));
-                
+
                 Dprint(_L("[RSCPClient]-> INFO: lTmpRet from SendReceive()=%d"), lTmpRet);
                 if(KErrNone == lRet) {
                     Dprint(_L("[RSCPClient]-> INFO: updating CenRep ..."));
@@ -1291,7 +1303,7 @@
                     Dprint(_L("[RSCPClient]-> INFO: User updated lock code for the first time...err= %d"), lRet);
                 }
             }
-            
+
             if(lNewLkCodeBuf) {
                 delete lNewLkCodeBuf;
             }
@@ -1300,52 +1312,56 @@
             Dprint(_L("[RSCPClient]-> INFO: Returning KErrCancel"));
             lRet = KErrCancel;
         }
-        
+
         if(KErrAbort == lRet) {
             Dprint(_L("[RSCPClient]-> INFO: Returning KErrCancel"));
             lRet = KErrCancel;
         }
 
     }
-    
+
     if(addParams.Length() > 0) {
-        CSCPParamObject* tmp = CSCPParamObject :: NewLC();            
+        CSCPParamObject* tmp = CSCPParamObject :: NewLC();
         TInt lTempRet = tmp->Parse(addParams);
-        
+
         if(lTempRet == KErrNone) {
             lTempRet = tmp->Set(KSCPParamPassword, codeBuffer);
         }
-        
+
         if(lTempRet == KErrNone) {
             addParams.Zero();
             HBufC8* tmpBuf;
             lTempRet = tmp->GetBuffer(tmpBuf);
-            
+
             if(lTempRet == KErrNone) {
                 addParams.Copy(tmpBuf->Des());
                 delete tmpBuf;
             }
         }
-        
+
         if(lTempRet == KErrNone) {
             CSCPParamObject* outParams = NULL;
             ProcessServerCommandsL(addParams, &outParams);
-            
+
             if(outParams != NULL) {
                 TSCPSecCode newSecCode;
                 if(outParams->Get(KSCPParamPassword, newSecCode) == KErrNone) {
                     Dprint((_L("[RSCPClient]-> INFO: Updating encoded password received from the server into aPassword...")));
                     aPassword.Copy(newSecCode);
                 }
+
                 delete outParams;
             }
         }
+
         CleanupStack :: PopAndDestroy(tmp);
     }
+
     CleanupStack :: PopAndDestroy(3); // repository, addParamsHBuf, codeHBuf
     Dprint(_L("[RSCPClient]-> SetSecurityCodeL() <<< lRet=%d"), lRet);
     return lRet;
 }
+
 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS
 // <<-- *********** Device lock new features *************
 
--- a/terminalsecurity/SCP/SCPDatabase/group/SCPDatabase.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/SCPDatabase/group/SCPDatabase.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -44,4 +44,6 @@
 LIBRARY		apgrfx.lib
 LIBRARY		apparc.lib
 
+SMPSAFE
+
 //End of file
--- a/terminalsecurity/SCP/SCPEventHandler/group/SCPEventHandler.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/SCPEventHandler/group/SCPEventHandler.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -51,4 +51,5 @@
 LIBRARY 	siscontroller.lib
 //LIBRARY	javaregistryclient.lib
 
+SMPSAFE
 
--- a/terminalsecurity/SCP/SCPHistoryPlugin/group/SCPHistoryPlugin.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/SCPHistoryPlugin/group/SCPHistoryPlugin.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -68,4 +68,7 @@
 LIBRARY			efsrv.lib			// FileServer
 LIBRARY					flogger.lib
 LIBRARY                 featmgr.lib
+
+SMPSAFE
+
 // End of File
--- a/terminalsecurity/SCP/SCPPatternPlugin/group/SCPPatternPlugin.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/SCPPatternPlugin/group/SCPPatternPlugin.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -68,4 +68,7 @@
 LIBRARY			efsrv.lib	// FileServer
 LIBRARY					flogger.lib
 LIBRARY                 featmgr.lib
+
+SMPSAFE
+
 // End of File
--- a/terminalsecurity/SCP/SCPServer/group/SCPServer.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/SCPServer/group/SCPServer.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -97,6 +97,9 @@
 LIBRARY 	estor.lib
 LIBRARY 	charconv.lib
 LIBRARY		devenccommonutils.lib //Device encryption utility
+
+SMPSAFE
+
 // End of file
 
 
--- a/terminalsecurity/SCP/SCPTimestampPlugin/group/SCPTimestampPlugin.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/SCP/SCPTimestampPlugin/group/SCPTimestampPlugin.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -73,4 +73,6 @@
 LIBRARY         platformenv.lib 
 #endif
 
+SMPSAFE
+
 // End of File
--- a/terminalsecurity/client/group/TerminalControlClient.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/client/group/TerminalControlClient.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -38,4 +38,4 @@
 LIBRARY         euser.lib
 LIBRARY       	flogger.lib
 
-
+SMPSAFE
--- a/terminalsecurity/server/group/TerminalControlServer.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/server/group/TerminalControlServer.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -57,3 +57,5 @@
 LIBRARY       flogger.lib
 LIBRARY                 featmgr.lib
 LIBRARY       devenccommonutils.lib // Device encryption utility
+
+SMPSAFE
\ No newline at end of file
--- a/terminalsecurity/tcadapter/bld/tcadapter.mmp	Thu Dec 17 09:07:52 2009 +0200
+++ b/terminalsecurity/tcadapter/bld/tcadapter.mmp	Thu Jan 07 13:15:03 2010 +0200
@@ -53,6 +53,8 @@
 LANGUAGE_IDS
 END
 
+SMPSAFE
+
 LIBRARY     		euser.lib
 LIBRARY     		ecom.lib 
 LIBRARY     		efsrv.lib