Revision: 201023
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 14:52:21 +0300
changeset 40 34fc115b8742
parent 34 6646e488a904
child 52 7b12f9e0db43
child 65 41cc8e7ff496
Revision: 201023 Kit: 2010123
baseconnectionproviders/refcpr/group/ReferenceCPR.iby
baseconnectionproviders/refcpr/group/ReferenceCPR.mmp
baseconnectionproviders/refcpr/group/bld.inf
baseconnectionproviders/refcpr/group/networking_ReferenceCPR.mrp
baseconnectionproviders/refcpr/group/networking_referencecpr.history.xml
baseconnectionproviders/refcpr/inc/ReferenceCPR_connProv.h
baseconnectionproviders/refcpr/inc/ReferenceCPR_connProvFactory.h
baseconnectionproviders/refcpr/src/102738D0.rss
baseconnectionproviders/refcpr/src/ReferenceCPR_connProv.cpp
baseconnectionproviders/refcpr/src/ReferenceCPR_connProvFactory.cpp
baseconnectionproviders/refscpr/Documentation/readme.txt
baseconnectionproviders/refscpr/group/ReferenceSCPR.iby
baseconnectionproviders/refscpr/group/ReferenceSCPR.mmp
baseconnectionproviders/refscpr/group/bld.inf
baseconnectionproviders/refscpr/group/networking_ReferenceSCPR.mrp
baseconnectionproviders/refscpr/group/networking_referencescpr.history.xml
baseconnectionproviders/refscpr/inc/ReferenceSCPR_defaultSubconnProv.h
baseconnectionproviders/refscpr/inc/ReferenceSCPR_subconnProv.h
baseconnectionproviders/refscpr/inc/ReferenceSCPR_subconnProvFactory.h
baseconnectionproviders/refscpr/inc/ReferenceSCPR_subconparams.h
baseconnectionproviders/refscpr/inc/ReferenceSCPR_subconparams.inl
baseconnectionproviders/refscpr/src/102738C2.rss
baseconnectionproviders/refscpr/src/ReferenceSCPR_defaultSubconnProv.cpp
baseconnectionproviders/refscpr/src/ReferenceSCPR_subconnProv.cpp
baseconnectionproviders/refscpr/src/ReferenceSCPR_subconnProvFactory.cpp
baseconnectionproviders/refscpr/src/ReferenceSCPR_subconparams.cpp
build.config.xml
commsconfig/commsdatabaseshim/group/comms-infras_commdbshim.mrp
commsfw_info/commsfw_metadata/commsfw_metadata.mrp
commsfw_info/commsinfrastructuredocs/comms-infras_documentation.mrp
commsfwsupport/commselements/ResponseMsg/src/ResponseMsg.cpp
commsfwsupport/commselements/commsfw/group/comms-infras_commsfw.mrp
commsfwsupport/commselements/commsfw/inc/cftransport.h
commsfwsupport/commselements/group/comms-infras_elements.mrp
commsfwsupport/commselements/group/systemdesignbase_elements.mrp
commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def
commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def
commsfwsupport/commselements/meshmachine/inc/mm_activities.h
commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h
commsfwsupport/commselements/meshmachine/src/mm_activities.cpp
commsfwsupport/commselements/meshmachine/src/mm_node.cpp
commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def
commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def
commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h
commsfwsupport/commselements/nodemessages/inc/nm_node.h
commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp
commsfwtools/commstools/group/comms-infras_tools.mrp
commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/comms-infras_defaultcommdb.mrp
commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat.mrp
commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat_tools_symport.mrp
commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat_tools_symport_l.mrp
commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/comms-infras_installdefaultcommdb.mrp
commsfwutils/commsbufs/TS_mbufmgr/Test06SplitL.cpp
commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-1st.ini
commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini
commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini
commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-4th.ini
commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/mbuftest.script
commsfwutils/commsbufs/group/bld.inf
commsfwutils/commsbufs/group/comms-infras_commsbufs.mrp
commsfwutils/commsbufs/group/testmbuf.iby
commsfwutils/commsbufs/mbufmgr/inc/MBufPanic.h
commsfwutils/commsbufs/mbufmgr/inc/nifmbuf.h
commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp
commsfwutils/commsbufs/src/commsbufasyncrequest.cpp
commsinfrastructureapitest/commsinfrastructuresvs/group/commsinfrastructuresvs.mrp
commsprocess/commsrootserverconfig/group/comms-infras_rootserver-config.mrp
commsprocess/commsrootserverconfig/group/comms-infras_rootserver.mrp
datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF
datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF
datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h
datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp
datacommsserver/esockserver/CoreProviders/src/corescpr.cpp
datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def
datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp
datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp
datacommsserver/esockserver/bwins/esocksvrU.DEF
datacommsserver/esockserver/core_states/ss_corepractivities.cpp
datacommsserver/esockserver/core_states/ss_corepractivities.h
datacommsserver/esockserver/core_states/ss_coreprstates.cpp
datacommsserver/esockserver/eabi/esocksvrU.DEF
datacommsserver/esockserver/group/comms-infras_esock-config.mrp
datacommsserver/esockserver/group/comms-infras_esock.mrp
datacommsserver/esockserver/inc/ss_mmcommsprov.h
datacommsserver/esockserver/ssock/ss_conn.cpp
datacommsserver/esockserver/ssock/ss_connstates.cpp
datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp
datacommsserver/esockserver/ssock/ss_sapshim.cpp
datacommsserver/esockserver/test/TE_DummyProvider/configs/TE_DummyProvider_ip.tcpip.esk
datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_006.ini
datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_008.ini
datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_009.ini
datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg
datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby
datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf
datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script
datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_006.script
datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_008.script
datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_009.script
datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h
datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Sockets.TestSteps.h
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Sockets.TestSteps.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp
datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760640.ini
datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760640.script
datacommsserver/esockserver/test/TE_RSubconnection/configs/te_RSubConnectionCase70.ini
datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp
datacommsserver/esockserver/test/providers/dummy/inc/activityTest.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_flow.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_network_flow.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h
datacommsserver/esockserver/test/providers/dummy/src/1028302A.rss
datacommsserver/esockserver/test/providers/dummy/src/activityTest.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_flow.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_network_flow.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp
datacommsserver/networkcontroller/group/networking_netcon.mrp
datacommsserver/networkingdialogapi/default/networking_dialog_default.mrp
datacommsserver/networkingdialogapi/group/networking_dialog.mrp
datacommsserver/networkingdialogapi/inc/AgentDialog.h
general/bld.inf
general/commsframework.iby
general/commsframeworktest.iby
general/te_initialiseboard.script
group/bld.inf
serialserver/c32serialserver/group/ser-comms_c32.mrp
serialserver/c32serialserverconfig/ser-comms_c32-config.mrp
serialserver/c32serialserverdocs/ser-comms_documentation.mrp
serialserver/packetloopbackcsy/group/PacketLoopbackCSY.mrp
serialserver/serialportcsy/ser-comms_serialportcsy.mrp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/group/ReferenceCPR.iby	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* 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:
+*
+*/
+
+#ifndef __ReferenceCPR_IBY__
+#define __ReferenceCPR_IBY__
+
+REM IP Connection Provider
+
+ECOM_PLUGIN(ReferenceCPR.dll,102738D0.rss)
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/group/ReferenceCPR.mmp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// ReferenceCPR.MMP New IP Connection Provider ECOM plugin with BM support
+// 
+//
+
+/**
+ @file
+*/
+
+
+TARGET          referencecpr.dll
+TARGETTYPE      PLUGIN
+
+UID             0x10009D8D 0x102738D0
+VENDORID 		0x70000001
+
+SOURCEPATH      ../src
+SOURCE          ReferenceCPR_connProv.cpp 
+SOURCE			ReferenceCPR_connProvFactory.cpp
+
+USERINCLUDE     ../inc
+
+SYSTEMINCLUDE   /epoc32/include
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   /epoc32/include/comms-infras
+
+START RESOURCE 102738D0.rss
+TARGET referencecpr.rsc
+END
+
+LIBRARY         euser.lib esock.lib esocksvr.lib eintsock.lib insock.lib
+LIBRARY         netmeta.lib		// for the ABIv2
+#include	    "comms-infras/commsdebugutility.mmh"
+
+CAPABILITY ALL -Tcb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/group/bld.inf	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,28 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+//
+
+#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTEXPORTS
+../group/ReferenceCPR.iby /epoc32/rom/include/referencecpr.iby
+
+PRJ_TESTMMPFILES
+ReferenceCPR.mmp
+
+#endif // SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/group/networking_ReferenceCPR.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,9 @@
+component		networking_ReferenceCPR
+source			\sf\os\commsfw\baseconnectionproviders\refcpr
+binary			\sf\os\commsfw\baseconnectionproviders\refcpr\group	all
+exports			\sf\os\commsfw\baseconnectionproviders\refcpr\group
+notes_source	\component_defs\release.src
+
+
+ipr T 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/group/networking_referencecpr.history.xml	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<relnotes name="Connection Provider Plugin">
+  <purpose>
+  </purpose>
+</relnotes>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/inc/ReferenceCPR_connProv.h	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,105 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference Connection Provider class definition.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#if !defined(__REFERENCECPR_CONNPROV_H__)
+#define __REFERENCECPR_CONNPROV_H__
+
+#include <comms-infras/ss_connprov.h>
+#include <comms-infras/commsdebugutility.h>
+
+#ifdef __FLOG_ACTIVE
+// CommsDebugUtility logging tags. Use them to enable tracing for ReferenceCPR
+_LIT8(KReferenceLogTag1,"ConnProvd");
+_LIT8(KReferenceLogTag2,"Reference");
+#endif
+
+class CConnectionSettings;
+
+
+class CReferenceConnectionProvider : public CConnectionProviderBase, public MConnectionControlClient
+/**
+
+@internalComponent
+@released since v9.2
+ */
+	{  
+protected:
+
+	//-=========================================================
+	// Custom methods
+	//-=========================================================
+
+	CReferenceConnectionProvider(CConnectionProviderFactoryBase& aFactory);
+			
+	~CReferenceConnectionProvider();
+
+	static CReferenceConnectionProvider* NewL(CConnectionProviderFactoryBase& aFactory);
+	friend class CReferenceProviderFactory;
+	
+	
+	//-=========================================================
+	// MConnectionControlClient methods
+	//-=========================================================
+	virtual void ConnectionGoingDown(CConnectionProviderBase& aConnProvider);
+	virtual void ProgressNotification(TInt aStage, TInt aError);
+	virtual void ConnectionError(TInt aStage,  TInt aError);
+	virtual void ServiceChangeNotification(TUint32 aId, const TDesC& aType);
+	virtual void SubConnectionEvent(CSubConnectionProviderBase* aSubConnNextLayerProvider, const TSubConnectionEvent& aSubConnectionEvent);
+	virtual void LayerUp(TInt aError);
+	virtual TCtlType CtlType() const;
+
+
+	//-=========================================================
+	// CConnectionProviderBase methods
+	//-=========================================================
+	virtual void DoDataClientJoiningL(MConnectionDataClient& aDataClient);
+	virtual void DoDataClientLeaving(MConnectionDataClient& aDataClient);
+	virtual void DoControlClientJoiningL(MConnectionControlClient& aControlClient);
+	virtual void DoControlClientLeaving(MConnectionControlClient& aControlClient);
+
+	virtual void DoStartL(Meta::SMetaData& aParams, const RMessagePtr2* aMessage);	
+	virtual TInt DoStop(TInt aError, const RMessagePtr2* aMessage);   
+
+	virtual void DoProgressL(Meta::SMetaData& aBuffer) const;
+	virtual void DoLastProgressError(Meta::SMetaData& aBuffer);
+	virtual void DoRequestServiceChangeNotificationL();
+	virtual void DoCancelServiceChangeNotification();
+	virtual void DoControlL(TUint aOptionLevel, TUint aOptionName, Meta::SMetaData& aOption, const RMessagePtr2* aMessage);
+	virtual TInt DoAllSubConnectionNotificationEnable();
+	virtual TInt DoCancelAllSubConnectionNotification();
+	virtual void DoSendIoctlMessageL(const RMessage2& aMessage);
+	virtual void DoSendCancelIoctl();   
+	virtual TInt DoEnumerateSubConnectionsL(TUint& aCount);
+	virtual TUint DoEnumerateClientsL(HBufC8*& aClientInfoBuffer, TEnumClients aClientType);
+	virtual void DoConnectionControlActivityL( TControlActivity aControlActivity, const Meta::SMetaData* aData, const RMessagePtr2* aMessage );
+	virtual CConnectionSettings& DoSettingsAccessL();
+	virtual TInt DoCanDoSubConnection(RSubConnection::TSubConnType aSubConnType) const;
+	virtual CConnectionProviderBase* DoNextLayer() const;
+	virtual void DoJoinNextLayerL(CConnectionProviderBase* aNextLayer);
+	
+	CConnectionProviderBase* iNextLayer;
+	
+public:
+	__FLOG_DECLARATION_MEMBER;	
+	};
+
+#endif // __REFERENCECPR_CONNPROV_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/inc/ReferenceCPR_connProvFactory.h	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,120 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference Connection Provider Factory class definition.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#if !defined(__REFERENCECPR_CONNPROVFACTORY_H__)
+#define __REFERENCECPR_CONNPROVFACTORY_H__
+
+
+#include <comms-infras/ss_connprov.h>
+#include <ss_select.h>
+
+
+//phony protocol family id, replace with the actual
+const TUint KReferenceConnectionProviderFactoryId = 0xF0F0; 
+
+class CReferenceProviderFactory : public CConnectionProviderFactoryBase
+/**This is a sample/reference derivation of the connection provider factory.
+Each such derivation should be able to produce a specific type of connection providers,
+where the type usually denotes a particular technology (e.g.: IP, UMTS, SIP).
+A connection provider factory is also responsible for handling selection,
+i.e.: given or having access to all sorts of input (connection preferences, policies, 
+bearer availablity) the factory should be able to select the provider on the given 
+level and select the provider type on the level below.
+
+@internalComponent
+@released since v9.2
+*/
+ 	{
+public:
+
+	static CReferenceProviderFactory* NewL(TAny* aParentContainer);
+
+protected:   
+	CReferenceProviderFactory(TUint aFactoryId, CConnectionFactoryContainer& aParentContainer);
+	virtual CConnectionProviderBase* DoCreateProviderL();	
+	virtual MProviderSelector* DoSelectProvider( Meta::SMetaData& aPreferences, ISelectionNotify& aSelectionNotify, const RMessagePtr2* aMessage );
+	virtual MProviderSelector* DoSelectNextLayerProvider( Meta::SMetaData& aPreferences, ISelectionNotify& aSelectionNotify, const RMessagePtr2* aMessage );
+	virtual void DoEnumerateConnectionsL(RPointerArray<TConnectionInfo>& aConnectionInfoPtrArray);
+	};
+
+
+
+
+class XConnectionFindSameLowerLayerQuery : public MCommsFactoryQuery
+/**
+
+@internalComponent
+@released since v9.2
+*/
+ 	{
+public:
+	XConnectionFindSameLowerLayerQuery( CConnectionProviderBase* aConnectionProviderBase ) :
+		iConnectionProviderBase( aConnectionProviderBase )
+		{
+		}
+
+protected:
+	CConnectionProviderBase* iConnectionProviderBase;
+
+public:
+	virtual TMatchResult Match( TFactoryObjectInfo& aConnectionInfo );
+	};
+
+
+
+
+
+class CReferenceSelector : public CBase, public MProviderSelector
+/**
+
+@internalComponent
+@released since v9.2
+*/
+	{
+public:	
+	CReferenceSelector(ISelectionNotify& aNotify, CReferenceProviderFactory& aFactory);
+
+	TInt Select(Meta::SMetaData& aPreferences, const RMessagePtr2* aMessage);
+	void SelectComplete(CConnectionProviderBase* aConnProvider, TInt aError);
+	void ProgressNotification(TInt aStage, TInt aError);
+	void LayerUp(TInt aError);
+	void ServiceChangeNotification(TUint32 aId, const TDesC& aType);
+	void SubConnectionEvent(CSubConnectionProviderBase* aSubConnNextLayerProvider, const TSubConnectionEvent& aSubConnectionEvent);
+	void Detach();
+	
+	virtual TInt Cancel();
+	virtual TInt Cancel(TInt aReason, const RMessage2* aMessage);
+	
+protected:
+    	
+	virtual ~CReferenceSelector();	
+private:
+    //ISelectionNotify must be stored by value, cos' it's just a short-lived wrapper class.
+    //It doesn't exist as a someone that waits for the completion, but stores refereneces
+    //to the one that does.
+    ISelectionNotify iNotify;
+    CReferenceProviderFactory& iFactory;
+    MProviderSelector* iNextLayerSelector;
+	};
+
+
+#endif // __REFERENCECPR_CONNPROVFACTORY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/src/102738D0.rss	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,61 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Registry info for Reference Connection Provider plug-in
+// 
+//
+
+/**
+ @file 102738D0.RSS
+*/
+
+#include <ecom/registryinfo.rh>
+
+/** 
+ * Description:
+ * [1] dll_uid should be the same as the name of this file. It stands for the UID of 
+ *     this ECOM plugin. In order to obtain a new UID, register at the 
+ *     "EPOC UID Allocation Database". Each plugin needs a array of UIDs:
+ *     - one for the dll
+ *     - one for the Connection Factory implementation id.
+ *     The UIDs listed in this file are either interface UIDs or implementation
+ *     UIDs registered for this particular plug-in. The latter should be replaced
+ *     for each new plug-in. 
+ * [2] interface_uid is the ECOM plugin intergface id. In this file:
+ *     0x102738D1 - Connection Provider Factory interface id.
+ * 
+ */ 
+
+
+RESOURCE REGISTRY_INFO theInfo
+{
+dll_uid =  0x102738D0;
+interfaces = 
+    {
+    INTERFACE_INFO
+        {
+        interface_uid =  0x102070EE;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x102738D1;
+                version_no = 1;
+                display_name = "Reference Connection Provider Factory";
+                default_data = "ReferenceConnectionProviderFactory";
+                opaque_data = "";
+                }
+            };
+        }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/src/ReferenceCPR_connProv.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,350 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference (empty) implementation file for a Connection Provider
+//
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "ReferenceCPR_connProv.h"
+
+_LIT(KPanicReferenceCPRText,"Reference CPR not filled in properly");
+
+#ifdef _DEBUG
+// Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
+// (if it could happen through user error then you should give it an explicit, documented, category + code)
+_LIT(KSpecAssert_RefCprConProv, "RefCprConProv");
+#endif
+
+//-=========================================================
+// Custom methods
+//-=========================================================
+CReferenceConnectionProvider* CReferenceConnectionProvider::NewL(CConnectionProviderFactoryBase& aFactory)
+	{
+	CReferenceConnectionProvider* p = new (ELeave) CReferenceConnectionProvider(aFactory);
+	return p;
+	}
+
+CReferenceConnectionProvider::CReferenceConnectionProvider(CConnectionProviderFactoryBase& aFactory)
+:CConnectionProviderBase(aFactory),
+ iNextLayer(NULL)
+	{
+	__FLOG_OPEN(KReferenceLogTag1, KReferenceLogTag2);
+	}
+
+CReferenceConnectionProvider::~CReferenceConnectionProvider()
+	{
+	__FLOG_CLOSE;
+	}
+
+
+
+//-=========================================================
+// MConnectionControlClient methods
+//-=========================================================
+void CReferenceConnectionProvider::ConnectionGoingDown(CConnectionProviderBase& aConnProvider)
+	{
+	__FLOG_2(_L("CReferenceConnectionProvider %08x:\tConnectionGoingDown(aConnProvider %08x)"), this, &aConnProvider);
+	if (&aConnProvider == iNextLayer)
+		{
+		iNextLayer = NULL;
+		DeleteMeNow();
+		}
+	}
+
+void CReferenceConnectionProvider::ProgressNotification(TInt aStage, TInt aError)
+	{
+	__FLOG_3(_L("CReferenceConnectionProvider %08x:\tProgressNotification(aStage %d aError %d)"), this, aStage, aError);
+	TInt max = iControlClients.Count();
+	for (TInt i = max - 1 ; i >= 0 ; i--)
+   		{
+	   	iControlClients[i]->ProgressNotification(aStage, aError);
+		}
+	}
+
+void CReferenceConnectionProvider::ConnectionError(TInt aStage,  TInt aError)
+	{
+	__FLOG_3(_L("CReferenceConnectionProvider %08x:\tConnectionError(aStage %d aError %d)"), this, aStage, aError);
+	TInt max = iControlClients.Count();
+	for (TInt i = max - 1 ; i >= 0 ; i--)
+		{
+		iControlClients[i]->ConnectionError(aStage, aError);
+		}
+	max = iDataClients.Count();
+	for (TInt i = max - 1 ; i >= 0 ; i--)
+		{
+		iDataClients[i]->ConnectionError(aStage, aError);
+		}
+  	}
+
+void CReferenceConnectionProvider::ServiceChangeNotification(TUint32 aId, const TDesC& aType)
+	{
+	__FLOG_3(_L("CReferenceConnectionProvider %08x:\tServiceChangeNotification(aId %u aType %s)"), this, aId, &aType);
+   	TInt max = iControlClients.Count();
+	for (TInt i = max - 1 ; i >= 0 ; i--)
+   		{
+	   	iControlClients[i]->ServiceChangeNotification(aId, aType);
+		}
+  	}
+
+void CReferenceConnectionProvider::SubConnectionEvent(CSubConnectionProviderBase* aSubConnNextLayerProvider, const TSubConnectionEvent& aSubConnectionEvent)
+	{
+	TInt max = iControlClients.Count();
+	for (TInt i = max - 1 ; i >= 0 ; i--)
+		{
+	   	iControlClients[i]->SubConnectionEvent(aSubConnNextLayerProvider, aSubConnectionEvent);
+		}
+	}
+
+void CReferenceConnectionProvider::LayerUp(TInt aError)
+	{
+	TInt max = iControlClients.Count();
+	for (TInt i = max - 1 ; i >= 0 ; --i)
+		{
+		iControlClients[i]->LayerUp(aError);
+		}
+
+	// broadcast the event to the data clients also, sideways
+	max = iDataClients.Count();
+	for (TInt j = max - 1; j >= 0 ; --j)
+		{
+		iDataClients[j]->Notify(MConnectionDataClient::ENotifyLayerUp, this, aError, NULL);
+		}
+   }
+
+MConnectionControlClient::TCtlType CReferenceConnectionProvider::CtlType() const
+	{
+	return MConnectionControlClient::ENormal;
+	}
+
+
+
+
+
+
+//-=========================================================
+// CConnectionProviderBase methods
+//-=========================================================
+void CReferenceConnectionProvider::DoDataClientJoiningL(MConnectionDataClient& /*aDataClient*/)
+	{
+	__FLOG_2(_L("CReferenceConnectionProvider %08x:\tDoDataClientJoiningL number %d"), this, iDataClients.Count());
+	//TODO: fill up with handling code if applicable.
+	}
+
+void CReferenceConnectionProvider::DoDataClientLeaving(MConnectionDataClient& /*aDataClient*/)
+	{
+	__FLOG_2(_L("CReferenceConnectionProvider %08x:\tDoDataClientLeaving number %d"), this, iDataClients.Count());
+	//TODO: fill up with handling code if applicable.
+	}
+
+void CReferenceConnectionProvider::DoControlClientJoiningL(MConnectionControlClient& /*aControlClient*/)
+	{
+	__FLOG_2(_L("CReferenceConnectionProvider %08x:\tDoControlClientJoiningL number %d"), this, iControlClients.Count());
+	//TODO: fill up with handling code if applicable.
+	}
+
+void CReferenceConnectionProvider::DoControlClientLeaving(MConnectionControlClient& /*aControlClient*/)
+	{
+	__FLOG_2(_L("CReferenceConnectionProvider %08x:\tDoControlClientLeaving number %d"), this, iControlClients.Count());
+	//TODO: fill up with handling code if applicable.
+  	}
+
+void CReferenceConnectionProvider::DoStartL(Meta::SMetaData& aParams, const RMessagePtr2* aMessage)
+	{
+	//TODO: start this connection
+	if (NULL != iNextLayer)
+		{
+		iNextLayer->StartL(aParams, aMessage);
+		}
+  	}
+
+TInt CReferenceConnectionProvider::DoStop(TInt aError, const RMessagePtr2* aMessage)
+	{
+	if (NULL != iNextLayer)
+		{
+		//The next layer present. We'll now stop it here and anticipate ConnectionGoingDown() called on 'this'
+		//when indeed, the connection is stopped.
+		return iNextLayer->Stop(aError, aMessage);
+		}
+	else
+    	{
+    	//No next layer present, we're just need to delete this connection to complete the Stop message.
+    	DeleteMeNow();
+    	}
+	return KErrNotReady;
+  	}
+
+void CReferenceConnectionProvider::DoProgressL(Meta::SMetaData& aBuffer) const
+	{
+	//TODO: update the progress info.
+	if (NULL != iNextLayer)
+		{
+		iNextLayer->ProgressL(aBuffer);
+		}
+  	}
+
+void CReferenceConnectionProvider::DoLastProgressError(Meta::SMetaData& aBuffer)
+	{
+	//TODO: return the last error actually ocurred.
+	if (NULL != iNextLayer)
+		{
+		return iNextLayer->LastProgressError(aBuffer);
+		}
+  	}
+
+void CReferenceConnectionProvider::DoRequestServiceChangeNotificationL()
+	{
+	if (NULL != iNextLayer)
+		{
+		iNextLayer->RequestServiceChangeNotificationL();
+		}
+  	}
+
+void CReferenceConnectionProvider::DoCancelServiceChangeNotification()
+	{
+	if (NULL != iNextLayer)
+		{
+		iNextLayer->CancelServiceChangeNotification();
+		}
+  	}
+
+void CReferenceConnectionProvider::DoControlL(TUint aOptionLevel, TUint aOptionName, Meta::SMetaData& aOption, const RMessagePtr2* aMessage)
+	{
+	if (NULL != iNextLayer)
+		{
+		return iNextLayer->ControlL(aOptionLevel, aOptionName, aOption, aMessage);
+		}
+  	}
+
+TInt CReferenceConnectionProvider::DoEnumerateSubConnectionsL(TUint& /*aCount*/)
+	{
+	return KErrNotReady;
+	//TODO: fill up aCount with the number of subconnections active.
+	}
+
+TUint CReferenceConnectionProvider::DoEnumerateClientsL(HBufC8*& aClientInfoBuffer, TEnumClients aClientType)
+/**
+Returns information about the clients of this Interface
+
+@param aCount on return contains the number of clients using this Interface
+@param aClientInfoBuffer on return contains a TPckg<> containing information about each client
+@exception leaves with KErrNoMemory if memory allocation fails
+*/
+	{
+	const TInt KInfoBufMaxLength = 1024;  //is this large enough?
+	TBuf8<KInfoBufMaxLength> infoBuf;
+
+	TUint count = 0;
+	STypeId tid(KConnectionClientExtUid,EConnectionClientDesc);
+	TInt max = iControlClients.Count();
+	for ( TInt n = 0; n < max; n++ )
+		{
+		MConnectionClientDesc* intf = reinterpret_cast<MConnectionClientDesc*>(iControlClients[n]->FetchInterfaceInstanceL(*this,tid));
+		if ( intf )
+			{
+			TConnectionProcessInfo cinfo;
+			cinfo.GetInfoL(aClientType, count, *intf, infoBuf);
+			}
+		}
+	STypeId tid2(KConnectionClientExtUid,EConnectionEnumerateClients);
+	max = iDataClients.Count();
+	for ( TInt n = 0; n < max; n++ )
+		{
+		MConnectionEnumerateClients* intf = reinterpret_cast<MConnectionEnumerateClients*>(iDataClients[n]->FetchInterfaceInstanceL(*this,tid2));
+		if ( intf )
+			{
+			intf->EnumerateClientsL(count, infoBuf, aClientType);
+			}
+		}
+
+	aClientInfoBuffer = infoBuf.AllocL();
+	return count;
+	}
+
+void CReferenceConnectionProvider::DoConnectionControlActivityL( CConnectionProviderBase::TControlActivity /*aControlActivity*/, const Meta::SMetaData* /*aData*/, const RMessagePtr2* /*aMessage*/ )
+	{
+	//TODO:
+	}
+
+CConnectionSettings& CReferenceConnectionProvider::DoSettingsAccessL()
+	{
+	//TODO: If no lower layer, derive your own CConnectionSettings
+	//class and return a reference to an instance of it here.
+	if (NULL != iNextLayer)
+		{
+		return iNextLayer->SettingsAccessL();
+		}
+	User::Panic(KPanicReferenceCPRText, KErrNotFound);
+
+	CConnectionSettings* null = NULL;
+	return *static_cast<CConnectionSettings*>(null);
+	}
+
+TInt CReferenceConnectionProvider::DoAllSubConnectionNotificationEnable()
+	{
+	if (NULL != iNextLayer)
+		{
+		return iNextLayer->AllSubConnectionNotificationEnable();
+		}
+	return KErrNotReady;
+  	}
+
+TInt CReferenceConnectionProvider::DoCancelAllSubConnectionNotification()
+	{
+	if (NULL != iNextLayer)
+		{
+		return iNextLayer->CancelAllSubConnectionNotification();
+		}
+	return KErrNotReady;
+  	}
+
+void CReferenceConnectionProvider::DoSendIoctlMessageL(const RMessage2& aMessage)
+	{
+	if (NULL != iNextLayer)
+		{
+		iNextLayer->SendIoctlMessageL(aMessage);
+		}
+  	}
+
+void CReferenceConnectionProvider::DoSendCancelIoctl()
+	{
+	if (NULL != iNextLayer)
+		{
+		iNextLayer->SendCancelIoctl();
+		}
+  	}
+
+TInt CReferenceConnectionProvider::DoCanDoSubConnection(RSubConnection::TSubConnType /*aSubConnType*/) const
+	{
+	return ETrue;
+  	}
+
+void CReferenceConnectionProvider::DoJoinNextLayerL(CConnectionProviderBase* aNextLayer)
+	{
+	__ASSERT_DEBUG(( !iNextLayer && aNextLayer), User::Panic(KSpecAssert_RefCprConProv, 1));
+	iNextLayer = aNextLayer;
+    SetConnectionInfo(iNextLayer->ConnectionInfo());
+    // join ourselves as a connection control client to the lower provider
+    iNextLayer->JoinL(*this);
+	}
+
+CConnectionProviderBase* CReferenceConnectionProvider::DoNextLayer() const
+	{
+  	return iNextLayer;
+  	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refcpr/src/ReferenceCPR_connProvFactory.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,272 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference (empty) implementation file for a SubConnection Provider Factory
+//
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <implementationproxy.h>
+#include <ss_glob.h>
+
+#include "ReferenceCPR_connProv.h"
+#include "ReferenceCPR_connProvFactory.h"
+
+#ifdef _DEBUG
+// Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
+// (if it could happen through user error then you should give it an explicit, documented, category + code)
+_LIT(KSpecAssert_RefCprConProvFac, "RefCprConProvFac");
+#endif
+
+//-=========================================================
+// Data/functions required for instantiating ECOM Plugin
+//-=========================================================
+const TInt KReferenceConnectionProviderImplementationUid=0x102738D0;
+
+const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY(KReferenceConnectionProviderImplementationUid, CReferenceProviderFactory::NewL)
+	};
+
+/**
+ECOM Implementation Factory
+*/
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+
+
+
+
+//-=========================================================
+// CReferenceProviderFactory
+//-=========================================================
+
+/**NewL is the actual ECOM Connection Provider interface implemented.
+ESOCK will call it to instantiate the factory and store it in the
+CConnectionProviderFactoryContainer.
+
+@param aConstructionParameters construction data passed by ECOM
+@returns pointer to a constructed factory
+*/
+CReferenceProviderFactory* CReferenceProviderFactory::NewL(TAny* aParentContainer)
+	{
+ 	return new (ELeave) CReferenceProviderFactory(KReferenceConnectionProviderFactoryId,
+ 					*(reinterpret_cast<CConnectionFactoryContainer*>(aParentContainer)));
+	}
+
+/**C'tor
+@param aFactoryId - the id of this factory. The id should represent the type of subconnection
+                    providers this factory can produce.
+@param aParentContainer - the factory container the new factory object should add itself to.
+*/
+CReferenceProviderFactory::CReferenceProviderFactory(TUint aFactoryId, CConnectionFactoryContainer& aParentContainer)
+:CConnectionProviderFactoryBase(aFactoryId, aParentContainer)
+	{
+	}
+
+CConnectionProviderBase* CReferenceProviderFactory::DoCreateProviderL()
+	{
+    return CReferenceConnectionProvider::NewL(*this);
+	}
+
+
+/**A sample/reference derivation of DoSelectProvider. The method is responsible for:
+- selecting an instance of the connection provider at this level of the connection provider stack.
+- determining the connection provider type at the layer below this
+- triggering the selection at the layer below.
+
+@param aPreferences     - connection preferences for the connection to be selected.
+@param aSelectionNotify - the notify interface (see class ISelectionNotify and see its usage
+                          in the implementation file).
+@param aMessage         - the orignal IPC message.
+@returns pointer to a MProviderSelector object. The pointer can be used by the caller to cancel the
+selection. Please note, this is a self-destructing object - the caller should assume the pointer
+becomes invalid after the selection.
+*/
+MProviderSelector* CReferenceProviderFactory::DoSelectProvider( Meta::SMetaData& aPreferences, ISelectionNotify& aSelectionNotify, const RMessagePtr2* aMessage )
+	{
+	CReferenceSelector* selector = new CReferenceSelector(aSelectionNotify,*this);
+	if (NULL == selector)
+		{
+		aSelectionNotify.SelectComplete(NULL, KErrNoMemory);
+		}
+	else if (selector->Select(aPreferences, aMessage) != KErrNone)
+		{
+		selector = NULL;
+		}
+	return selector;
+
+  	}
+
+/**A sample/reference derivation of DoSelectNextLayerProvider. The method is responsible for:
+- determining the connection provider type at the layer below this
+- triggering the selection at the layer below.
+One can observe that DoSelectNextLayerProvider has a subset of the responsibilities held by
+DoSelectNextLayerProvider.
+
+@param aPreferences     - connection preferences for the connection to be selected.
+@param aSelectionNotify - the notify interface (see class ISelectionNotify and see its usage
+                          in the implementation file).
+@param aMessage         - the orignal IPC message.
+@returns pointer to a MProviderSelector object. The pointer can be used by the caller to cancel the
+selection. Please note, this is a self-destructing object - the caller should assume the pointer
+becomes invalid after the selection.
+*/
+MProviderSelector* CReferenceProviderFactory::DoSelectNextLayerProvider( Meta::SMetaData& aPreferences, ISelectionNotify& aSelectionNotify, const RMessagePtr2* aMessage )
+	{
+	//This method should determine the type (factoryId) of the connection below this layer.
+	TInt factoryId = KInvalidFactoryId;
+	//When done
+	CConnectionFactoryContainer* connectionFactories = SockManGlobals::Get()->iConnectionFactories;
+	__ASSERT_DEBUG(connectionFactories, User::Panic(KSpecAssert_RefCprConProvFac, 1));
+	CConnectionProviderFactoryBase* factory = connectionFactories->FindFactory(factoryId);
+
+	return factory->SelectProvider(aPreferences, aSelectionNotify, aMessage);
+	}
+
+void CReferenceProviderFactory::DoEnumerateConnectionsL(RPointerArray<TConnectionInfo>& /*aConnectionInfoPtrArray*/)
+	{
+	//TODO: enumerate connections.
+	}
+
+
+
+
+
+
+
+
+//-=========================================================
+// CReferenceSelector
+//-=========================================================
+
+CReferenceSelector::CReferenceSelector(ISelectionNotify& aNotify, CReferenceProviderFactory& aFactory)
+:iNotify(aNotify),
+ iFactory(aFactory),
+ iNextLayerSelector(NULL)
+	{
+	}
+
+//CReferenceSelector
+TInt CReferenceSelector::Cancel()
+	{
+	//TODO: cancel the selection
+    if (iNextLayerSelector)
+        {
+        return iNextLayerSelector->Cancel();
+        }
+    return KErrNotReady;
+	}
+
+TInt CReferenceSelector::Cancel(TInt aReason, const RMessage2* aMessage)
+	{
+	//TODO: cancel the selection
+    if (iNextLayerSelector)
+        {
+        return iNextLayerSelector->Cancel(aReason, aMessage);
+        }
+    return KErrNotReady;
+	}
+
+TInt CReferenceSelector::Select(Meta::SMetaData& aPreferences, const RMessagePtr2* aMessage)
+    {
+	//Prepare ISelectionNotify. MProviderSelector may choose the events it wishes to be notified
+	//about by implementing a subset of the possible upcalls. The list of the actually implemented
+	//is used to create an ISelectionNotify object (a loose function pointer holder) and passed
+	//to the factory below to perform the selection at the lower level.
+	ISelectionNotify selectNotify( this, TSelectionNotify<CReferenceSelector>::SelectComplete,
+	                                     TProgressNotify<CReferenceSelector>::ProgressNotification,
+	                                     TServiceChangeNotify<CReferenceSelector>::ServiceChangeNotification,
+	                                     TLayerUp<CReferenceSelector>::LayerUp,
+	                                     TSubConnectionEventTmpl<CReferenceSelector>::SubConnectionEvent,
+	                                     TDetachNotify<CReferenceSelector>::Detach);
+
+	iNextLayerSelector = iFactory.SelectNextLayerProvider(aPreferences, selectNotify, aMessage);
+	return (iNextLayerSelector ? KErrNone : KErrNotReady);
+    }
+
+
+void CReferenceSelector::SelectComplete(CConnectionProviderBase* aConnProvider, TInt aError)
+    {
+    CReferenceConnectionProvider* connProvider = NULL;
+    if (aError == KErrNone)
+        {
+	    __ASSERT_DEBUG(aConnProvider, User::Panic(KSpecAssert_RefCprConProvFac, 2));
+        XConnectionFindSameLowerLayerQuery query(aConnProvider);
+
+        TRAP( aError, connProvider = static_cast<CReferenceConnectionProvider*>(iFactory.FindOrCreateProviderL(query)));
+        if (aError == KErrNone && connProvider->NextLayer() == NULL)
+            {
+            //the factory returned a new instance - must set the lower layer
+            TRAP(aError,connProvider->JoinNextLayerL(aConnProvider));
+            }
+        }
+    iNotify.SelectComplete(connProvider, aError);
+    }
+
+void CReferenceSelector::ProgressNotification(TInt aStage, TInt aError)
+    {
+    iNotify.ProgressNotification(aStage, aError);
+    }
+
+void CReferenceSelector::LayerUp(TInt aError)
+	{
+    iNotify.LayerUp(aError);
+	}
+
+void CReferenceSelector::SubConnectionEvent(CSubConnectionProviderBase* aSubConnNextLayerProvider, const TSubConnectionEvent& aSubConnectionEvent)
+	{
+	iNotify.SubConnectionEvent(aSubConnNextLayerProvider, aSubConnectionEvent);
+	}
+
+void CReferenceSelector::ServiceChangeNotification(TUint32 aId, const TDesC& aType)
+	{
+    iNotify.ServiceChangeNotification(aId, aType);
+	}
+
+void CReferenceSelector::Detach()
+	{
+	iNotify.Detach();
+	iNextLayerSelector = NULL;
+	delete this;
+	}
+
+CReferenceSelector::~CReferenceSelector()
+    {
+	if (iNextLayerSelector)
+		{
+		iNextLayerSelector->Cancel();
+		}
+    }
+
+
+
+
+//-=========================================================
+// XConnectionFindSameLowerLayerQuery
+//-=========================================================
+
+MCommsFactoryQuery::TMatchResult XConnectionFindSameLowerLayerQuery::Match( TFactoryObjectInfo& aProviderInfo )
+	{
+	CConnectionProviderBase* prov = static_cast<CConnectionProviderBase*>(aProviderInfo.iInfo.iFactoryObject);
+	return prov->NextLayer() == iConnectionProviderBase ? EMatch : EContinue;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/Documentation/readme.txt	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,12 @@
+SubConnProv\ReferenceSCPR
+
+This component is an example/reference implementation of:
+- a subconnection provider (as defined by CSubConnectionProviderBase)
+- a subconnection parameter extension set.
+
+Developers are encouraged to use this reference whatever way they
+like (e.g.: fill it up with content).
+
+This component does not hold any functionality and should not be 
+built during system build.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/group/ReferenceSCPR.iby	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* 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:
+*
+*/
+
+#ifndef __IPSCPR_IBY__
+#define __IPSCPR_IBY__
+
+REM Refercnce Subconnection Provider
+
+ECOM_PLUGIN(ReferenceSCPR.dll,102738C2.rss)
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/group/ReferenceSCPR.mmp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,50 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// ReferenceSCPR.MMP Umts/Gprs Subconnection Provider ECOM plugin
+// 
+//
+
+/**
+ @file ReferenceSCPR.MMP
+*/
+
+TARGET          referencescpr.dll
+TARGETTYPE      PLUGIN
+
+UID             0x10009D8D 0x102738C2
+VENDORID 	    0x70000001
+
+
+SOURCEPATH      ../src
+SOURCE          ReferenceSCPR_subconparams.cpp 
+SOURCE          ReferenceSCPR_defaultSubconnProv.cpp
+SOURCE          ReferenceSCPR_subconnProv.cpp 
+SOURCE          ReferenceSCPR_subconnProvFactory.cpp
+
+START RESOURCE 102738C2.rss
+TARGET referencescpr.rsc
+END
+
+USERINCLUDE     ../inc
+
+SYSTEMINCLUDE   /epoc32/include
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   /epoc32/include/comms-infras
+SYSTEMINCLUDE   /epoc32/include/networking
+
+LIBRARY         euser.lib esock.lib esocksvr.lib eintsock.lib insock.lib
+LIBRARY         netmeta.lib etelpckt.lib etel.lib umtsif.lib
+#include	    "comms-infras/commsdebugutility.mmh"
+
+CAPABILITY ALL -Tcb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/group/bld.inf	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,36 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Exporting headers of the extension parameters this SCPR supports.
+// The headers can be included by applications wishing to use the extension
+// instead of the generic parameter sets.
+// 
+//
+
+#ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
+
+PRJ_MMPFILES
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+../inc/ReferenceSCPR_subconparams.h         SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(networking/reference_subconparams.h)
+#ifdef SYMBIAN_OLD_EXPORT_LOCATION
+../inc/ReferenceSCPR_subconparams.inl       /epoc32/include/networking/reference_subconparams.inl
+#endif
+../group/ReferenceSCPR.iby                  /epoc32/rom/include/referencescpr.iby
+
+PRJ_TESTMMPFILES
+ReferenceSCPR.mmp
+
+#endif // SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/group/networking_ReferenceSCPR.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,9 @@
+component		networking_referenceSCPR
+source			\sf\os\commsfw\baseconnectionproviders\refscpr
+binary			\sf\os\commsfw\baseconnectionproviders\refscpr\group	all
+exports			\sf\os\commsfw\baseconnectionproviders\refscpr\group
+notes_source	\component_defs\release.src
+
+
+ipr T 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/group/networking_referencescpr.history.xml	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<relnotes name="Connection Provider Plugin">
+  <purpose>
+  </purpose>
+</relnotes>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/inc/ReferenceSCPR_defaultSubconnProv.h	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,115 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference Default SubConnection Provider class definition.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+#if !defined(__REFERENCESCPR_DEFAULTSUBCONNPROV_H__)
+#define __REFERENCESCPR_DEFAULTSUBCONNPROV_H__
+
+
+#include "ReferenceSCPR_subconnProv.h"
+
+
+class CReferenceDefaultSubConnectionProvider : public CSubConnectionProviderBase, public MConnectionDataClient
+/** 
+CReferenceDefaultSubConnectionProvider is a reference implementation for a shared subconnection,
+that is: either 
+* a subconnection explicitly requested by a client openning an RSubConnection in EAttachToDefault mode
+* an implicitly created shared subconnection.
+Typically reserved and shared subconnection providers, although represent the
+same layer/technology, require different implementations of CSubConnectionProviderBase. 
+This example code takes that into account and provides two separate classes for reserved and 
+shared subconnections respectivelly. Should the implementation differ little or not differ at all,
+developers are encouraged to introduce inheritance between the two types or implement just one
+universal CSubConnectionProviderBase subclass, if sensible.
+The following should be read like a class diagram for a CSubConnectionProviderBase:
+===================================================================================
+
+                            [MSubConnectionControlClient]
+LAYER N-1                               ^
+                                        |
+    [MSubConnectionDataClient]<-n-      n         [MSubConnectionDataClient]<-n-
+                                  |     |              /\                       |
+LAYER N                           1     1             is a                      1
+                                  |     |              ||                       |
+    [ServiceAccessPoint]<-n--1-[CSubConnectionProviderBase]-1-----n->[CConnectionProviderBase]
+                                        |
+                                        n
+                                        |
+                                        1
+LAYER N+1                               v
+                                     [CSubConnectionProviderBase]
+====================================================================================
+@internalComponent
+@released since v9.2
+*/
+	{
+public:	    
+
+	//-=========================================================
+	// MConnectionDataClient methods
+	//-=========================================================	
+	virtual void Notify(TNotify aNotifyType, CConnectionProviderBase* aConnProvider, TInt aError, const CConNotificationEvent* aConNotificationEvent);
+  	virtual void AttachToNext(CSubConnectionProviderBase* aSubConnProvider);
+	virtual void ConnectionGoingDown(CConnectionProviderBase& aConnProvider);
+	virtual void ConnectionError(TInt aStage, TInt aError);
+
+
+
+	//-=========================================================
+	// CSubConnectionProviderBase methods
+	//-=========================================================
+	virtual void DoDataClientJoiningL(MSubConnectionDataClient& aDataClient);
+	virtual void DoDataClientLeaving(MSubConnectionDataClient& aDataClient);
+	virtual void DoControlClientJoiningL(MSubConnectionControlClient& aControlClient);
+	virtual void DoControlClientLeaving(MSubConnectionControlClient& aControlClient);
+	virtual void DoSourceAddressUpdate(MSubConnectionDataClient& aDataClient, const TSockAddr& aSource);
+	virtual void DoDestinationAddressUpdate(MSubConnectionDataClient& aDataClient, const TSockAddr& aDestination);
+	virtual void DoDataClientRouted(MSubConnectionDataClient& aDataClient, const TSockAddr& aSource, const TSockAddr& aDestination, const TDesC8& aConnectionInfo);
+	virtual void DoParametersAboutToBeSetL(CSubConParameterBundle& aParameterBundle);
+	virtual TInt DoControl(TUint aOptionLevel, TUint aOptionName, TDes8& aOption);
+	virtual CConnDataTransfer& DoDataTransferL();
+	virtual MConnectionDataClient* DoSelfConnectionDataClient();
+    virtual void DoStartL();
+	virtual void DoStop();
+	virtual CSubConnectionProviderBase* DoNextLayer();
+	
+
+protected:
+	
+	//-=========================================================
+	// Custom methods
+	//-=========================================================	
+	friend class CReferenceSubConnectionProviderFactory;	
+
+	CReferenceDefaultSubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory, 
+	                                       CConnectionProviderBase& aConnProvider);
+	static CReferenceDefaultSubConnectionProvider* NewL(CSubConnectionProviderFactoryBase& aFactory, 
+	                                       CConnectionProviderBase& aConnProvider);
+	void ConstructL();
+	virtual ~CReferenceDefaultSubConnectionProvider();
+	
+public:
+	__FLOG_DECLARATION_MEMBER;
+	
+	};
+
+#endif	// __REFERENCESCPR_DEFAULTSUBCONNPROV_H__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/inc/ReferenceSCPR_subconnProv.h	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,121 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference SubConnection Provider class definition.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#if !defined(__REFERENCESCPR_SUBCONNPROV_H__)
+#define __REFERENCESCPR_SUBCONNPROV_H__
+
+
+#include <comms-infras/ss_subconnprov.h>
+#include <comms-infras/commsdebugutility.h>
+
+
+#ifdef __FLOG_ACTIVE
+// CommsDebugUtility logging tags. Use them to enable tracing for ReferenceSCPR
+_LIT8(KReferenceLogTag1,"SubConnProvd");
+_LIT8(KReferenceLogTag2,"Reference");
+#endif
+
+
+
+class CReferenceSubConnectionProvider : public CSubConnectionProviderBase, public MConnectionDataClient
+/** 
+CReferenceSubConnectionProvider is a reference implementation for a reserved subconnection,
+that is: a subconnection explicitly requested by a client openning an RSubConnection
+in ECreateNew mode. Typically reserved and shared subconnection providers, although represent the
+same layer/technology, require different implementations of CSubConnectionProviderBase. 
+This example code takes that into account and provides two separate classes for reserved and 
+shared subconnections respectivelly. Should the implementation differ little or not differ at all,
+developers are encouraged to introduce inheritance between the two types or implement just one
+universal CSubConnectionProviderBase subclass, if sensible.
+The following should be read like a class diagram for a CSubConnectionProviderBase:
+===================================================================================
+
+                            [MSubConnectionControlClient]
+LAYER N-1                               ^
+                                        |
+    [MSubConnectionDataClient]<-n-      n         [MSubConnectionDataClient]<-n-
+                                  |     |              /\                       |
+LAYER N                           1     1             is a                      1
+                                  |     |              ||                       |
+    [ServiceAccessPoint]<-n--1-[CSubConnectionProviderBase]-1-----n->[CConnectionProviderBase]
+                                        |
+                                        n
+                                        |
+                                        1
+LAYER N+1                               v
+                                     [CSubConnectionProviderBase]
+====================================================================================
+@internalComponent
+@released since v9.2
+*/
+	{
+public:	    
+
+	//-=========================================================
+	// MConnectionDataClient methods
+	//-=========================================================	
+	virtual void Notify(TNotify aNotifyType, CConnectionProviderBase* aConnProvider, TInt aError, const CConNotificationEvent* aConNotificationEvent);
+  	virtual void AttachToNext(CSubConnectionProviderBase* aSubConnProvider);
+	virtual void ConnectionGoingDown(CConnectionProviderBase& aConnProvider);
+	virtual void ConnectionError(TInt aStage, TInt aError);
+
+
+
+	//-=========================================================
+	// CSubConnectionProviderBase methods
+	//-=========================================================
+	virtual void DoDataClientJoiningL(MSubConnectionDataClient& aDataClient);
+	virtual void DoDataClientLeaving(MSubConnectionDataClient& aDataClient);
+	virtual void DoControlClientJoiningL(MSubConnectionControlClient& aControlClient);
+	virtual void DoControlClientLeaving(MSubConnectionControlClient& aControlClient);
+	virtual void DoSourceAddressUpdate(MSubConnectionDataClient& aDataClient, const TSockAddr& aSource);
+	virtual void DoDestinationAddressUpdate(MSubConnectionDataClient& aDataClient, const TSockAddr& aDestination);
+	virtual void DoDataClientRouted(MSubConnectionDataClient& aDataClient, const TSockAddr& aSource, const TSockAddr& aDestination, const TDesC8& aConnectionInfo);
+	virtual void DoParametersAboutToBeSetL(CSubConParameterBundle& aParameterBundle);
+	virtual TInt DoControl(TUint aOptionLevel, TUint aOptionName, TDes8& aOption);
+	virtual CConnDataTransfer& DoDataTransferL();
+	virtual MConnectionDataClient* DoSelfConnectionDataClient();
+    virtual void DoStartL();
+	virtual void DoStop();
+	virtual CSubConnectionProviderBase* DoNextLayer();
+	
+
+protected:
+	
+	//-=========================================================
+	// Custom methods
+	//-=========================================================	
+	friend class CReferenceSubConnectionProviderFactory;
+	
+	CReferenceSubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory, 
+	                                CConnectionProviderBase& aConnProvider);
+	static CReferenceSubConnectionProvider* NewL(CSubConnectionProviderFactoryBase& aFactory, 
+	                                CConnectionProviderBase& aConnProvider);
+	void ConstructL();
+	virtual ~CReferenceSubConnectionProvider();
+	
+public:
+	__FLOG_DECLARATION_MEMBER;
+	
+	};
+
+#endif	// __REFERENCESCPR_SUBCONNPROV_H__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/inc/ReferenceSCPR_subconnProvFactory.h	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,53 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference SubConnection Provider Factory class definition.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#if !defined(__REFERENCE_SUBCONNPROVFACTORY_H__)
+#define __REFERENCE_SUBCONNPROVFACTORY_H__
+
+
+#include <comms-infras/ss_subconnprov.h>
+
+//phony protocol family id, replace with the actual
+const TUint KReferenceSubConnectionProviderFactoryId = 0xF0F0; 
+
+class CReferenceSubConnectionProviderFactory : public CSubConnectionProviderFactoryBase
+/**This is a sample/reference derivation of the subconnection provider factory.
+Each such derivation should be able to produce a specific type of subconnection providers,
+where the type usually denotes a particular technology (e.g.: IP, UMTS, SIP).
+
+@internalComponent
+@released since v9.2
+*/
+	{
+public:
+	static CReferenceSubConnectionProviderFactory* NewL(TAny* aConstructionParameters);	
+	
+protected:
+
+	CReferenceSubConnectionProviderFactory(TUint aFactoryId, CSubConnectionFactoryContainer& aParentContainer);
+	virtual ~CReferenceSubConnectionProviderFactory();
+	virtual CSubConnectionProviderBase* DoCreateProviderL(CConnectionProviderBase& aConnProvider, RSubConnection::TSubConnType aType);
+
+	};
+
+
+#endif	// __REFERENCE_SUBCONNPROVFACTORY_H__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/inc/ReferenceSCPR_subconparams.h	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,121 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference_subconparams.h
+// Header file for the Reference (example) SubConnection Parameter Extension Set.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef __REFERENCE_SUBCONPARAMS_H__
+#define __REFERENCE_SUBCONPARAMS_H__
+
+#include <es_sock.h>
+
+//The ECOM plugin identifier for this SubConnection parameter extension.
+//See the assisting *.rss file.
+const TInt KSubConReferenceParamsUid = 0x102738C4;
+//The sub-identifier for CSubConReferenceParamSet extension parameter set.
+const TInt KSubConReferenceParamsType = 1;
+
+
+
+class CSubConReferenceParamSet : public CSubConExtensionParameterSet
+/** 
+ An example/reference extension set of SubConnection Parameters.
+ 
+ A typical client application wishing to use this extension set would
+ look like this:
+ ====================================================================
+ void foo()
+   {
+    ...
+    //Instantiate a parameter bundle - a generic container for subconnection
+    //parameter sets.
+	RSubConParameterBundle subconnParamBundle;
+	
+    //Since the bundle is about to hold heap-objects, must push onto
+    //the cleanup stack.	
+	CleanupClosePushL(subconnParams);
+
+    //Instantiate a family - a subcontainer within a bundle. The subcontainer
+    //should hold QoS subconnection parameter sets.
+	CSubConParameterFamily* family = CSubConParameterFamily::NewL(subconnParamBundle, KSubConQoSFamily);
+
+	//Specific parameter sets can be instantiated in either of the three modes (designating their semantics):
+	//	enum TParameterSetType
+    //   {
+    //   ERequested = 0, //parameters requested by the application
+    //   EAcceptable = 1,//parameters the application can accept (minimum)
+	//	 EGranted = 2    //parameters granted by the network.
+    //   }; (see ES_SOCK.H)
+    //Consequently the bundle would usually contain ERequested and EAcceptable (or at least ERequested)
+    //parameter sets.
+    
+    //Instantiating the ERequested Reference Extension:
+	CSubConReferenceParamSet* subConRefRequestedParSet = CSubConReferenceParamSet::NewL(*family, CSubConParameterFamily::ERequested);
+
+    //Instantiating the EAccepted Reference Extension:
+	CSubConExtensionParameterSet* subConRefAcceptedParSet = CSubConReferenceParamSet::NewL(*family, CSubConParameterFamily::EAccepted);
+        
+    //At this point subconnParamBundle holds 2 instances (ERequested and EAcceptable) of CSubConReferenceParamSet.
+    
+   }
+ ====================================================================
+
+@publishedAll
+@released since v9.2 
+*/
+{
+public:
+	inline static CSubConReferenceParamSet* NewL(CSubConParameterFamily& aFamily, CSubConParameterFamily::TParameterSetType aType);
+	inline static CSubConReferenceParamSet* NewL();
+
+	inline CSubConReferenceParamSet();
+
+	inline TInt   GetDummyTIntParameter() const;
+	inline const TName& GetDummyTNameParameter() const;	
+	inline void   SetDummyTIntParameter(TInt aDummyTIntParameter);
+	inline void   SetDummyTNameParameter(const TName& iDummyName);	
+
+protected:
+
+	DATA_VTABLE
+
+protected:
+	TInt	iDummyTIntParameter;
+	TName	iDummyName;
+	};
+
+
+
+
+
+class CReferenceSubConnExtensionParamsFactory : public CBase
+/** Factory used to create instances of the Reference SubConnection Parameter Extension Sets.
+
+@internalComponent
+@released since v9.2 
+*/
+	{
+public:
+	static CSubConExtensionParameterSet* NewL(TAny* aConstructionParameters);
+	};
+
+#include <networking/reference_subconparams.inl>
+
+#endif // __REFERENCE_SUBCONPARAMS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/inc/ReferenceSCPR_subconparams.inl	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,65 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Inline Functions file for the Reference SubConnection Parameter Set.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+inline CSubConReferenceParamSet* CSubConReferenceParamSet::NewL(CSubConParameterFamily& aFamily, CSubConParameterFamily::TParameterSetType aType)
+	{
+	CSubConReferenceParamSet* obj = NewL();
+	CleanupStack::PushL(obj);
+	aFamily.AddExtensionSetL(*obj, aType);
+	CleanupStack::Pop(obj);
+	return obj;
+	}
+
+inline CSubConReferenceParamSet* CSubConReferenceParamSet::NewL()
+	{
+	STypeId typeId(KSubConReferenceParamsUid, KSubConReferenceParamsType);
+	return static_cast<CSubConReferenceParamSet*>(CSubConParameterSet::NewL(typeId));
+	}
+
+inline CSubConReferenceParamSet::CSubConReferenceParamSet()
+	: CSubConExtensionParameterSet(), 
+	iDummyTIntParameter(0),
+	iDummyName()
+	{
+	}
+	
+	
+inline TInt CSubConReferenceParamSet::GetDummyTIntParameter() const
+	{
+	return iDummyTIntParameter;
+	}
+	
+inline const TName& CSubConReferenceParamSet::GetDummyTNameParameter() const
+	{
+	return iDummyName;
+	}
+	
+inline void CSubConReferenceParamSet::SetDummyTIntParameter(TInt aDummyTIntParameter)
+	{
+	iDummyTIntParameter = aDummyTIntParameter;
+	}
+	
+inline void CSubConReferenceParamSet::SetDummyTNameParameter(const TName& aDummyName)
+	{
+	iDummyName = aDummyName;	
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/src/102738C2.rss	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,73 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Registry info for Reference Sub-Connection Provider plug-in
+// [1] dll_uid should be the same as the name of this file. It stands for the UID of 
+// this ECOM plugin. In order to obtain a new UID, register at the 
+// "EPOC UID Allocation Database". Each plugin needs a array of UIDs:
+// - one for the dll
+// - one for the SubConnection Factory implementation id.
+// - one for the SubConnection Extension Parameters Factory implementation id 
+// (if there is an extension parameter set in this plug-in).
+// The UIDs listed in this file are either interface UIDs or implementation
+// UIDs registered for this particular plug-in. The latter should be replaced
+// for each new plug-in. 
+// [2] interface_uid is the ECOM plugin intergface id. In this file:
+// 0x10204301 - SubConnection Factory interface id.
+// 0x10204303 - SubConnection Extension Parameters Factory interface id.
+// 
+//
+
+/**
+ @file 102738C2.RSS
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+{
+dll_uid = 0x102738C2;
+interfaces = 
+    {
+    INTERFACE_INFO
+        {
+        interface_uid = 0x10204301;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x102738C3;
+                version_no = 1;
+                display_name = "Reference SubConnection Provider Factory";
+                default_data = "ReferenceSubConnProvdFactory";
+                opaque_data = "";
+                }
+            };
+        },
+    INTERFACE_INFO
+        {
+        interface_uid = 0x10204303;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x102738C4;
+                version_no = 1;
+                display_name = "Reference Extension Set of SubConnection Paremers";
+                default_data = "text/wml";
+                opaque_data = "";
+                }
+            };
+        }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/src/ReferenceSCPR_defaultSubconnProv.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,347 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Implementation file for the Default Reference SubConnection Provider
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "ReferenceSCPR_defaultSubconnProv.h"
+
+	
+//-=========================================================
+// Custom methods
+//-=========================================================	
+CReferenceDefaultSubConnectionProvider::CReferenceDefaultSubConnectionProvider(
+                                 CSubConnectionProviderFactoryBase& aFactory, 
+	                             CConnectionProviderBase& aConnProvider)
+:CSubConnectionProviderBase(aFactory, aConnProvider)
+/** 
+
+@param aFactory CSubConnectionProviderFactoryBase that should own the reference to 'this'
+@param aConnProvider a connection that 'this' subconnection belongs to
+*/
+	{
+	__FLOG_OPEN(KReferenceLogTag1, KReferenceLogTag2);
+	}
+	
+
+/** NewL for the two stage construction. Calls the CReferenceDefaultSubConnectionProvider constructor
+ and ConstructL on the constructed instance.
+
+@param aFactory      - the subconnection provider factory the new CReferenceDefaultSubConnectionProvider 
+                       will belong to and is to be instantiated by.
+@param aConnProvider - the connection (represented by a connection provieder) the new 
+                       CReferenceSubConnectionProvider will belong to.
+@return              - a new, constructed instance of CReferenceDefaultSubConnectionProvider.
+*/
+CReferenceDefaultSubConnectionProvider* CReferenceDefaultSubConnectionProvider::NewL(
+										CSubConnectionProviderFactoryBase& aFactory, 
+	                                    CConnectionProviderBase& aConnProvider)
+	{
+    CReferenceDefaultSubConnectionProvider* provider = 
+    		new(ELeave)CReferenceDefaultSubConnectionProvider(aFactory, aConnProvider);
+	CleanupStack::PushL(provider);
+    provider->ConstructL();
+    CleanupStack::Pop();
+    return provider;
+    }
+    
+	                             
+/** ConstructL for the two stage construction
+*/
+void CReferenceDefaultSubConnectionProvider::ConstructL()
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::ConstructL()"), this);	
+	//TODO: perform 2nd stage construction, if needed.
+	}
+
+
+CReferenceDefaultSubConnectionProvider::~CReferenceDefaultSubConnectionProvider()
+/** 
+Destroys 'this'
+*/
+    {
+    __FLOG_CLOSE;
+    }
+
+
+
+//-=========================================================
+// MConnectionDataClient methods
+//-=========================================================	
+
+/** Called by the connection provider, of which 'this' is a data client and to which
+ 'this' belongs. The connection provider will call this method to notify its data clients.
+
+@param aNotifyType   - one of MConnectionDataClient::TNotify enums indicating the notification type.
+@param aConnProvider - the connection provider originating this notification.
+@param aError        - the error indication
+@param aConNotificationEvent - the actual event. 
+*/
+void CReferenceDefaultSubConnectionProvider::Notify(MConnectionDataClient::TNotify /*aNotifyType*/,  CConnectionProviderBase* /*aConnProvider*/, TInt /*aError*/, const CConNotificationEvent* /*aConNotificationEvent*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::Notify()"), this);
+	//TODO:		
+	}
+
+
+/** Called to associate 'this' with a lower layer subconnection provider. 
+
+@param aSubConnProvider to be the lower layer for 'this'
+*/
+void CReferenceDefaultSubConnectionProvider::AttachToNext(CSubConnectionProviderBase* /*aSubConnProvider*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::AttachToNext()"), this);
+	//TODO:		
+	}
+
+
+
+/** Called to inform 'this' that the connection, to which 'this' belongs, is going down.
+
+@param aConnProvider - the connection going down.
+*/
+void CReferenceDefaultSubConnectionProvider::ConnectionGoingDown(CConnectionProviderBase& /*aConnProvider*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::ConnectionGoingDown()"), this);
+	//TODO:		
+	}
+
+/** Called to inform 'this' about a generic connection error.
+
+@param aStage - stage at which the error has occured (currently as specified by NIFVAR.H)
+@param aError - the error indication.
+*/
+void CReferenceDefaultSubConnectionProvider::ConnectionError(TInt /*aStage*/, TInt /*aError*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::ConnectionError()"), this);
+	//TODO:		
+	}
+
+
+
+
+
+
+
+//-=========================================================
+// CSubConnectionProviderBase methods
+//-=========================================================
+
+
+
+/** Override this if you observe data clients joining the sub-connection
+    provider. This method is called before the data client is added to
+	the lists, so if you wish to stop it being added, leave with an
+	appropriate System wide error
+
+@param aDataClient Data client wishing to join the sub-connection provider
+@exception If the specific sub-connection provider does not want the data client to join
+*/
+void CReferenceDefaultSubConnectionProvider::DoDataClientJoiningL(MSubConnectionDataClient& /*aDataClient*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoDataClientJoiningL()"), this);
+	//TODO:		
+	}
+	
+	
+	
+/** Override this if you observe data clients leaving the sub-connection
+    provider. This method is called before the data client leaves the
+	the. Please note that it is not possible to to stop a data client
+	from leaving.
+
+@param aDataClient Data client about to leave the sub-connection provider
+*/
+void CReferenceDefaultSubConnectionProvider::DoDataClientLeaving(MSubConnectionDataClient& /*aDataClient*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoDataClientLeaving()"), this);
+	//TODO:		
+	}
+	
+	
+	
+/** Override this if you observe control clients leaving the sub-connection
+    provider. This method is called before the control client leaves the
+	the. Please note that it is not possible to to stop a control client
+	from leaving.
+
+@param aDataClient Data client about to leave the sub-connection provider
+*/
+void CReferenceDefaultSubConnectionProvider::DoControlClientJoiningL(MSubConnectionControlClient& /*aControlClient*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoControlClientJoiningL()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe control clients leaving the sub-connection
+    provider. This method is called before the control client leaves the
+	the. Please note that it is not possible to to stop a control client
+	from leaving.
+
+@param aDataClient Data client about to leave the sub-connection provider
+*/
+void CReferenceDefaultSubConnectionProvider::DoControlClientLeaving(MSubConnectionControlClient& /*aControlClient*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoControlClientLeaving()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe a data client receiving a new source
+    address.
+
+@param aDataClient Data client about to leave the sub-connection provider
+@param aSource New source address
+*/
+void CReferenceDefaultSubConnectionProvider::DoSourceAddressUpdate(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aSource*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoSourceAddressUpdate()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe a data client receiving a new destination
+    address.
+
+@param aDataClient Data client about to leave the sub-connection provider
+@param aDestination New destination address
+*/
+void CReferenceDefaultSubConnectionProvider::DoDestinationAddressUpdate(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aDestination*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoDestinationAddressUpdate()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe a data client receiving all its address
+    address information.
+
+@param aDataClient Data client about to leave the sub-connection provider
+@param aSource New source address
+@param aDestination New destination address
+@param aConnectionInfo Connection Information (including IAP)
+*/
+void CReferenceDefaultSubConnectionProvider::DoDataClientRouted(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aSource*/, const TSockAddr& /*aDestination*/, const TDesC8& /*aConnectionInfo*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoDataClientRouted()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe a data client about to receive new paramaters.
+    This method is called before the parameters are associated with the sub-connection
+	provider, so it is possible to abort this by leaving from this method with
+	an appropriate system wide error code.
+
+@param aParameterBundle Parameters received from the control client
+@exception If the specific sub-connection provider does not want the parameters to be set
+*/
+void CReferenceDefaultSubConnectionProvider::DoParametersAboutToBeSetL(CSubConParameterBundle& /*aParameterBundle*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoParametersAboutToBeSetL()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this to implement specific control behaviour request by the client
+
+@param aOptionLevel Control Option level
+@param aOptionName Control Option name
+@param aOption Control Option value
+@return KErrNone if successful, otherwise system error code
+*/
+TInt CReferenceDefaultSubConnectionProvider::DoControl(TUint /*aOptionLevel*/, TUint /*aOptionName*/, TDes8& /*aOption*/)
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoControl()"), this);
+	//TODO:
+	
+	return KErrNotSupported;
+	}
+	
+	
+	
+	
+/** DoDataTransferL
+*/
+CConnDataTransfer& CReferenceDefaultSubConnectionProvider::DoDataTransferL()
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoDataTransferL()"), this);
+	//TODO: 
+	User::Leave(KErrNotSupported);
+	CConnDataTransfer* null = NULL;
+	return *static_cast<CConnDataTransfer*>(null);
+	}
+	
+	
+	
+	
+/** DoSelfConnectionDataClient
+*/
+MConnectionDataClient* CReferenceDefaultSubConnectionProvider::DoSelfConnectionDataClient()
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoSelfConnectionDataClient()"), this);
+	//CReferenceDefaultSubConnectionProvider is a MConnectionDataClient, hence returning 'this'
+	return this;
+	}
+	
+
+	
+/** Called to start 'this'.
+	   
+*/
+void CReferenceDefaultSubConnectionProvider::DoStartL()
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoStartL()"), this);
+	//TODO:		
+	}
+	
+	
+/** Called to stop 'this'.
+   
+*/
+void CReferenceDefaultSubConnectionProvider::DoStop()
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoStop()"), this);
+	//TODO:		
+	}
+	
+	
+/** Called to retrieve the lower subconnection provider of 'this'
+  
+ @return the subconnection provider below 'this'
+*/	
+CSubConnectionProviderBase* CReferenceDefaultSubConnectionProvider::DoNextLayer()
+	{
+	__FLOG_1(_L("CReferenceDefaultSubConnectionProvider[%x]::DoNextLayer()"), this);
+	return iNextLayer;
+	}
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/src/ReferenceSCPR_subconnProv.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,348 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Reference (empty) implementation file for a SubConnection Provider
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+#include "ReferenceSCPR_subconnProv.h"
+
+
+	
+
+//-=========================================================
+// Custom methods
+//-=========================================================	
+CReferenceSubConnectionProvider::CReferenceSubConnectionProvider(
+                                 CSubConnectionProviderFactoryBase& aFactory, 
+	                             CConnectionProviderBase& aConnProvider)
+:CSubConnectionProviderBase(aFactory, aConnProvider)
+/** 
+
+@param aFactory CSubConnectionProviderFactoryBase that should own the reference to 'this'
+@param aConnProvider a connection that 'this' subconnection belongs to
+*/
+	{
+	__FLOG_OPEN(KReferenceLogTag1, KReferenceLogTag2);
+	}
+
+/** NewL for the two stage construction. Calls the CReferenceSubConnectionProvider constructor
+ and ConstructL on the constructed instance.
+
+@param aFactory      - the subconnection provider factory the new CReferenceSubConnectionProvider 
+                       will belong to and is to be instantiated by.
+@param aConnProvider - the connection (represented by a connection provieder) the new 
+                       CReferenceSubConnectionProvider will belong to.
+@return              - a new, constructed instance of CReferenceSubConnectionProvider.
+*/
+CReferenceSubConnectionProvider* CReferenceSubConnectionProvider::NewL(
+										CSubConnectionProviderFactoryBase& aFactory, 
+	                                    CConnectionProviderBase& aConnProvider)
+	{
+    CReferenceSubConnectionProvider* provider = 
+    		new(ELeave)CReferenceSubConnectionProvider(aFactory, aConnProvider);
+	CleanupStack::PushL(provider);
+    provider->ConstructL();
+    CleanupStack::Pop();
+    return provider;
+    }
+    
+	                             
+/** ConstructL for the two stage construction
+*/
+void CReferenceSubConnectionProvider::ConstructL()
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::ConstructL()"), this);	
+	//TODO: perform 2nd stage construction, if needed.
+	}
+	
+
+CReferenceSubConnectionProvider::~CReferenceSubConnectionProvider()
+/** 
+Destroys 'this'
+*/
+    {
+    __FLOG_CLOSE;
+    }
+
+
+
+//-=========================================================
+// MConnectionDataClient methods
+//-=========================================================	
+
+/** Called by the connection provider, of which 'this' is a data client and to which
+ 'this' belongs. The connection provider will call this method to notify its data clients.
+
+@param aNotifyType   - one of MConnectionDataClient::TNotify enums indicating the notification type.
+@param aConnProvider - the connection provider originating this notification.
+@param aError        - the error indication
+@param aConNotificationEvent - the actual event. 
+*/
+void CReferenceSubConnectionProvider::Notify(MConnectionDataClient::TNotify /*aNotifyType*/,  CConnectionProviderBase* /*aConnProvider*/, TInt /*aError*/, const CConNotificationEvent* /*aConNotificationEvent*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::Notify()"), this);
+	//TODO:		
+	}
+
+
+/** Called to associate 'this' with a lower layer subconnection provider. 
+
+@param aSubConnProvider to be the lower layer for 'this'
+*/
+void CReferenceSubConnectionProvider::AttachToNext(CSubConnectionProviderBase* /*aSubConnProvider*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::AttachToNext()"), this);
+	//TODO:		
+	}
+
+
+
+/** Called to inform 'this' that the connection, to which 'this' belongs, is going down.
+
+@param aConnProvider - the connection going down.
+*/
+void CReferenceSubConnectionProvider::ConnectionGoingDown(CConnectionProviderBase& /*aConnProvider*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::ConnectionGoingDown()"), this);
+	//TODO:		
+	}
+
+/** Called to inform 'this' about a generic connection error.
+
+@param aStage - stage at which the error has occured (currently as specified by NIFVAR.H)
+@param aError - the error indication.
+*/
+void CReferenceSubConnectionProvider::ConnectionError(TInt /*aStage*/, TInt /*aError*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::ConnectionError()"), this);
+	//TODO:		
+	}
+
+
+
+
+
+
+
+//-=========================================================
+// CSubConnectionProviderBase methods
+//-=========================================================
+
+
+
+/** Override this if you observe data clients joining the sub-connection
+    provider. This method is called before the data client is added to
+	the lists, so if you wish to stop it being added, leave with an
+	appropriate System wide error
+
+@param aDataClient Data client wishing to join the sub-connection provider
+@exception If the specific sub-connection provider does not want the data client to join
+*/
+void CReferenceSubConnectionProvider::DoDataClientJoiningL(MSubConnectionDataClient& /*aDataClient*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoDataClientJoiningL()"), this);
+	//TODO:		
+	}
+	
+	
+	
+/** Override this if you observe data clients leaving the sub-connection
+    provider. This method is called before the data client leaves the
+	the. Please note that it is not possible to to stop a data client
+	from leaving.
+
+@param aDataClient Data client about to leave the sub-connection provider
+*/
+void CReferenceSubConnectionProvider::DoDataClientLeaving(MSubConnectionDataClient& /*aDataClient*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoDataClientLeaving()"), this);
+	//TODO:		
+	}
+	
+	
+	
+/** Override this if you observe control clients leaving the sub-connection
+    provider. This method is called before the control client leaves the
+	the. Please note that it is not possible to to stop a control client
+	from leaving.
+
+@param aDataClient Data client about to leave the sub-connection provider
+*/
+void CReferenceSubConnectionProvider::DoControlClientJoiningL(MSubConnectionControlClient& /*aControlClient*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoControlClientJoiningL()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe control clients leaving the sub-connection
+    provider. This method is called before the control client leaves the
+	the. Please note that it is not possible to to stop a control client
+	from leaving.
+
+@param aDataClient Data client about to leave the sub-connection provider
+*/
+void CReferenceSubConnectionProvider::DoControlClientLeaving(MSubConnectionControlClient& /*aControlClient*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoControlClientLeaving()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe a data client receiving a new source
+    address.
+
+@param aDataClient Data client about to leave the sub-connection provider
+@param aSource New source address
+*/
+void CReferenceSubConnectionProvider::DoSourceAddressUpdate(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aSource*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoSourceAddressUpdate()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe a data client receiving a new destination
+    address.
+
+@param aDataClient Data client about to leave the sub-connection provider
+@param aDestination New destination address
+*/
+void CReferenceSubConnectionProvider::DoDestinationAddressUpdate(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aDestination*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoDestinationAddressUpdate()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe a data client receiving all its address
+    address information.
+
+@param aDataClient Data client about to leave the sub-connection provider
+@param aSource New source address
+@param aDestination New destination address
+@param aConnectionInfo Connection Information (including IAP)
+*/
+void CReferenceSubConnectionProvider::DoDataClientRouted(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aSource*/, const TSockAddr& /*aDestination*/, const TDesC8& /*aConnectionInfo*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoDataClientRouted()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this if you observe a data client about to receive new paramaters.
+    This method is called before the parameters are associated with the sub-connection
+	provider, so it is possible to abort this by leaving from this method with
+	an appropriate system wide error code.
+
+@param aParameterBundle Parameters received from the control client
+@exception If the specific sub-connection provider does not want the parameters to be set
+*/
+void CReferenceSubConnectionProvider::DoParametersAboutToBeSetL(CSubConParameterBundle& /*aParameterBundle*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoParametersAboutToBeSetL()"), this);
+	//TODO:		
+	}
+	
+	
+	
+	
+/** Override this to implement specific control behaviour request by the client
+
+@param aOptionLevel Control Option level
+@param aOptionName Control Option name
+@param aOption Control Option value
+@return KErrNone if successful, otherwise system error code
+*/
+TInt CReferenceSubConnectionProvider::DoControl(TUint /*aOptionLevel*/, TUint /*aOptionName*/, TDes8& /*aOption*/)
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoControl()"), this);
+	//TODO:
+	
+	return KErrNotSupported;
+	}
+	
+	
+	
+	
+/** DoDataTransferL
+*/
+CConnDataTransfer& CReferenceSubConnectionProvider::DoDataTransferL()
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoDataTransferL()"), this);
+	//TODO: 
+	User::Leave(KErrNotSupported);
+	CConnDataTransfer* null = NULL;
+	return *static_cast<CConnDataTransfer*>(null);
+	}
+	
+	
+	
+	
+/** DoSelfConnectionDataClient
+*/
+MConnectionDataClient* CReferenceSubConnectionProvider::DoSelfConnectionDataClient()
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoSelfConnectionDataClient()"), this);
+	//CReferenceSubConnectionProvider is a MConnectionDataClient, hence returning 'this'
+	return this;
+	}
+	
+
+	
+/** Called to start 'this'.
+	   
+*/
+void CReferenceSubConnectionProvider::DoStartL()
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoStartL()"), this);
+	//TODO:		
+	}
+	
+	
+/** Called to stop 'this'.
+   
+*/
+void CReferenceSubConnectionProvider::DoStop()
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoStop()"), this);
+	//TODO:		
+	}
+	
+	
+/** Called to retrieve the lower subconnection provider of 'this'
+  
+ @return the subconnection provider below 'this'
+*/	
+CSubConnectionProviderBase* CReferenceSubConnectionProvider::DoNextLayer()
+	{
+	__FLOG_1(_L("CReferenceSubConnectionProvider[%x]::DoNextLayer()"), this);
+	return iNextLayer;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/src/ReferenceSCPR_subconnProvFactory.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,126 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Implementation file for the the Reference SubConnection Provider Factory
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+#include "ReferenceSCPR_subconnProvFactory.h"
+#include "ReferenceSCPR_defaultSubconnProv.h"
+#include "ReferenceSCPR_subconnProv.h"
+#include "ReferenceSCPR_subconparams.h"
+#include <implementationproxy.h>
+
+//The following represents the Factory ID for the Reference subconnection
+//provider. See the assisting *.rss file in the ../src directory.
+const TUint KReferenceSubConnectionProviderImplementationUid = 0x102738C3;
+
+//-=========================================================
+// Data/functions required for instantiating ECOM Plugin
+//-=========================================================
+const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY(KReferenceSubConnectionProviderImplementationUid, CReferenceSubConnectionProviderFactory::NewL),
+	IMPLEMENTATION_PROXY_ENTRY(KSubConReferenceParamsUid, CReferenceSubConnExtensionParamsFactory::NewL)
+	};
+
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+    return ImplementationTable;
+    }
+
+
+
+
+
+//-=========================================================
+// CReferenceSubConnectionProviderFactory
+//-=========================================================
+
+CReferenceSubConnectionProviderFactory* CReferenceSubConnectionProviderFactory::NewL(TAny* aConstructionParameters)
+/**NewL is the actual ECOM SubConnection Provider interface implemented.
+ESOCK with call it to instantiate the factory and store it the 
+CSubConnectionProviderFacoryContainer.
+   
+@param aConstructionParameters construction data passed by ECOM
+@returns pointer to a constructed factory 
+*/
+	{
+	CReferenceSubConnectionProviderFactory* ptr = 
+	    new (ELeave) CReferenceSubConnectionProviderFactory(KReferenceSubConnectionProviderFactoryId, 
+	    *(reinterpret_cast<CSubConnectionFactoryContainer*>(aConstructionParameters)));
+	return ptr;
+	}
+
+	
+
+CReferenceSubConnectionProviderFactory::CReferenceSubConnectionProviderFactory(TUint aFactoryId, 
+                                        CSubConnectionFactoryContainer& aParentContainer)
+:CSubConnectionProviderFactoryBase(aFactoryId, aParentContainer)
+/**C'tor
+@param aFactoryId - the id of this factory. The id should represent the type of subconnection 
+                    providers this factory can produce.
+@param aParentContainer - the factory container the new factory object should add itself to.
+*/
+	{
+	}
+	
+
+
+/**D'tor
+
+*/	
+CReferenceSubConnectionProviderFactory::~CReferenceSubConnectionProviderFactory()
+    {
+    }
+    
+
+/**A sample/reference derivation of DoCreateProviderL. The method must be overriden to create 
+(instantiate) the actual CSubConnectionProviderBase objects.
+
+@param aConnProvider - the connection, the subconnection provider object should belong to. 
+@param aType - the type of the subconnection provider object within the meaning defined by 
+			   RSubConnection::TSubConnType:
+	           * ECreateNew - the subconnection provider object shall represent a new, reserved, 
+	           	 private flow.
+	           * EAttachToDefault - the subconnection provider object shall represent the 
+	             default channel - a singular channel that each connection always has.
+*/
+CSubConnectionProviderBase* CReferenceSubConnectionProviderFactory::DoCreateProviderL(
+                                   CConnectionProviderBase& aConnProvider, 
+                                   RSubConnection::TSubConnType aType)
+    {
+    CSubConnectionProviderBase* provider = NULL;
+    if (aType == RSubConnection::EAttachToDefault)
+        {
+        provider = CReferenceDefaultSubConnectionProvider::NewL(*this, aConnProvider);
+        }
+    else if (aType == RSubConnection::ECreateNew)
+        {
+        provider = CReferenceSubConnectionProvider::NewL(*this, aConnProvider);
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    return provider;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseconnectionproviders/refscpr/src/ReferenceSCPR_subconparams.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// The implementation file for the Reference SubConnection Parameter Set.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+#include <ecom/ecom.h>
+#include "ReferenceSCPR_subconparams.h"
+#include <comms-infras/metatypearray.h>
+
+
+START_ATTRIBUTE_TABLE( CSubConReferenceParamSet, KSubConReferenceParamsUid, KSubConReferenceParamsType )
+	REGISTER_ATTRIBUTE( CSubConReferenceParamSet, iDummyTIntParameter, TMetaNumber )
+	REGISTER_ATTRIBUTE( CSubConReferenceParamSet, iDummyName, TMetaNumber )
+END_ATTRIBUTE_TABLE()
+
+
+CSubConExtensionParameterSet* CReferenceSubConnExtensionParamsFactory::NewL(TAny* aConstructionParameters)
+	{
+	TInt32 type = reinterpret_cast<TInt32>(aConstructionParameters);
+	switch (type)
+		{
+	case (KSubConReferenceParamsType):
+		return new (ELeave) CSubConReferenceParamSet;
+	default:
+		User::Leave(KErrNotFound);
+		}
+	return NULL;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build.config.xml	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/os/commsfw" >
+]>
+
+<SystemDefinition name="commsfw" schema="1.4.0">
+  <systemModel>
+    <layer name="os_layer">
+      <module name="commsfw">
+        <unit unitID="netdo.commsfw" mrp="" bldFile="&layer_real_source_path;/group" name="commsfw" />
+      </module>
+    </layer>
+	<layer name="api_test_layer">
+      <module name="commsfw_test">
+        <unit unitID="netdo.commsfw.test" mrp="" bldFile="&layer_real_source_path;/group" name="commsfw" />
+      </module>
+    </layer>
+  </systemModel>
+</SystemDefinition>
--- a/commsconfig/commsdatabaseshim/group/comms-infras_commdbshim.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsconfig/commsdatabaseshim/group/comms-infras_commdbshim.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_commdbshim
 source	\sf\os\commsfw\commsconfig\commsdatabaseshim
 
--- a/commsfw_info/commsfw_metadata/commsfw_metadata.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfw_info/commsfw_metadata/commsfw_metadata.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component           commsfw_metadata
 source   \sf\os\commsfw\commsfw_info\commsfw_metadata 
 source   \sf\os\commsfw\package_definition.xml
--- a/commsfw_info/commsinfrastructuredocs/comms-infras_documentation.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfw_info/commsinfrastructuredocs/comms-infras_documentation.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_documentation
 
 source	\sf\os\commsfw\commsfw_info\commsinfrastructuredocs\
--- a/commsfwsupport/commselements/ResponseMsg/src/ResponseMsg.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/ResponseMsg/src/ResponseMsg.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -170,6 +170,10 @@
 	  		//That would usually be the fault of the client's CExtItfMsgPluginInfo.
 	  		//Depending on the state the client will be errored or panicked.
   			__DEBUGGER(); //diagnostic
+
+			// Mark the client buffer as read so that client can clean up gracefully
+			RMessage2::Write(iRequestMsgParam, KNullDesC8);
+
   			return NULL;
   			}
   		}
--- a/commsfwsupport/commselements/commsfw/group/comms-infras_commsfw.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/commsfw/group/comms-infras_commsfw.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_commsfw
 source	\sf\os\commsfw\commsfwutils\commfw
 binary	\sf\os\commsfw\commsfwutils\commfw\group	all
--- a/commsfwsupport/commselements/commsfw/inc/cftransport.h	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/commsfw/inc/cftransport.h	Fri Jun 11 14:52:21 2010 +0300
@@ -262,9 +262,6 @@
 	IMPORT_C void RegisterAddress(Messages::TRuntimeCtxId& aCookie);
 	IMPORT_C void DeregisterAddress(Messages::TRuntimeCtxId& aCookie);
 
-	// From MTransportSender
-	IMPORT_C void PostMessage(const Messages::TRuntimeCtxId& aPostFrom, const Messages::TRuntimeCtxId& aPostTo, const Meta::SMetaData& aMessage);
-
 	// TCFMessage + legacy
 	IMPORT_C void RegisterLegacyInterface(MLegacyMessageReceiver* aLegacyInterface);
 	IMPORT_C void PostMessage(const TCFMessage& aMessage);
--- a/commsfwsupport/commselements/group/comms-infras_elements.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/group/comms-infras_elements.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_elements
 source	\sf\os\commsfw\commsfwsupport\commselements
 binary	\sf\os\commsfw\commsfwsupport\commselements\group	all
--- a/commsfwsupport/commselements/group/systemdesignbase_elements.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/group/systemdesignbase_elements.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	systemdesignbase_elements
 source	\sf\os\unref\orphan\comgen\systemdesignbase\elements
 binary	\sf\os\unref\orphan\comgen\systemdesignbase\elements\group	all
--- a/commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def	Fri Jun 11 14:52:21 2010 +0300
@@ -45,7 +45,7 @@
 	?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVTRuntimeCtxId@Messages@@@Z @ 44 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::TRuntimeCtxId const &) const
 	?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVTNodePeerId@Messages@@@Z @ 45 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::TNodePeerId const &) const
 	?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVRNodeInterface@Messages@@@Z @ 46 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::RNodeInterface const &) const
-	?GetNextActivityCountL@CNodeParallelActivityBase@MeshMachine@@KAIABUTNodeActivity@2@ABVAMMNodeBase@2@@Z @ 47 NONAME ; unsigned int MeshMachine::CNodeParallelActivityBase::GetNextActivityCountL(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase const &)
+	?GetNextActivityCount@CNodeParallelActivityBase@MeshMachine@@KAIABUTNodeActivity@2@ABVAMMNodeBase@2@@Z @ 47 NONAME ; unsigned int MeshMachine::CNodeParallelActivityBase::GetNextActivityCount(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase const &)
 	?GetVTablePtr@TAwaitingAny@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 48 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingAny::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TAwaitingCancel@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 49 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingCancel::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TAwaitingClientLeavingRequest@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 50 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingClientLeavingRequest::GetVTablePtr(class TDesC8 &, void *)
@@ -135,5 +135,7 @@
 	??1CNodeParallelMessageStoreActivityBase@MeshMachine@@UAE@XZ @ 134 NONAME ; MeshMachine::CNodeParallelMessageStoreActivityBase::~CNodeParallelMessageStoreActivityBase(void)
 	??0CNodeParallelMessageStoreActivityBase@MeshMachine@@IAE@ABUTNodeActivity@1@AAVAMMNodeBase@1@I@Z @ 135 NONAME ; MeshMachine::CNodeParallelMessageStoreActivityBase::CNodeParallelMessageStoreActivityBase(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase &, unsigned int)
 	?StartL@CNodeParallelMessageStoreActivityBase@MeshMachine@@MAEXAAVTNodeContextBase@2@ABVXNodePeerId@Messages@@ABUTStateTriple@NetStateMachine@@@Z @ 136 NONAME ; void MeshMachine::CNodeParallelMessageStoreActivityBase::StartL(class MeshMachine::TNodeContextBase &, class Messages::XNodePeerId const &, struct NetStateMachine::TStateTriple const &)
+	?SetPostedTo@CNodeActivityBase@MeshMachine@@QAEXABVRNodeInterface@Messages@@@Z @ 137 NONAME ; void MeshMachine::CNodeActivityBase::SetPostedTo(class Messages::RNodeInterface const &)
+	?PostedToNodeId@CNodeActivityBase@MeshMachine@@QBEABVTNodeId@Messages@@XZ @ 138 NONAME ; class Messages::TNodeId const & MeshMachine::CNodeActivityBase::PostedToNodeId(void) const
+	?PostedToPeer@CNodeActivityBase@MeshMachine@@QBEPBVRNodeInterface@Messages@@XZ @ 139 NONAME ; class Messages::RNodeInterface const * MeshMachine::CNodeActivityBase::PostedToPeer(void) const
 
-
--- a/commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def	Fri Jun 11 14:52:21 2010 +0300
@@ -81,7 +81,7 @@
 	_ZN11MeshMachine19TRaiseActivityError3DoLEv @ 80 NONAME
 	_ZN11MeshMachine22TAwaitingLeaveComplete12GetVTablePtrER6TDesC8Pv @ 81 NONAME
 	_ZN11MeshMachine22TAwaitingLeaveComplete6AcceptEv @ 82 NONAME
-	_ZN11MeshMachine25CNodeParallelActivityBase21GetNextActivityCountLERKNS_13TNodeActivityERKNS_11AMMNodeBaseE @ 83 NONAME
+	_ZN11MeshMachine25CNodeParallelActivityBase20GetNextActivityCountERKNS_13TNodeActivityERKNS_11AMMNodeBaseE @ 83 NONAME
 	_ZN11MeshMachine25CNodeParallelActivityBase4NewLERKNS_13TNodeActivityERNS_11AMMNodeBaseE @ 84 NONAME
 	_ZN11MeshMachine25CNodeParallelActivityBaseC1ERKNS_13TNodeActivityERNS_11AMMNodeBaseEj @ 85 NONAME
 	_ZN11MeshMachine25CNodeParallelActivityBaseC2ERKNS_13TNodeActivityERNS_11AMMNodeBaseEj @ 86 NONAME
@@ -203,5 +203,7 @@
 	_ZTIN11MeshMachine37CNodeParallelMessageStoreActivityBaseE @ 202 NONAME
 	_ZTVN11MeshMachine37CNodeParallelMessageStoreActivityBaseE @ 203 NONAME
 	_ZN11MeshMachine37CNodeParallelMessageStoreActivityBase6StartLERNS_16TNodeContextBaseERKN8Messages11XNodePeerIdERKN15NetStateMachine12TStateTripleE @ 204 NONAME
+	_ZN11MeshMachine17CNodeActivityBase11SetPostedToERKN8Messages14RNodeInterfaceE @ 205 NONAME
+	_ZNK11MeshMachine17CNodeActivityBase12PostedToPeerEv @ 206 NONAME
+	_ZNK11MeshMachine17CNodeActivityBase14PostedToNodeIdEv @ 207 NONAME
 
-
--- a/commsfwsupport/commselements/meshmachine/inc/mm_activities.h	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities.h	Fri Jun 11 14:52:21 2010 +0300
@@ -91,7 +91,7 @@
 	#define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
 		EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
 		EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
-		const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, _S8(#name)}; \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
 		DEFINE_TRIPLES_TABLE( name :: iData )
 
 /**
@@ -110,7 +110,7 @@
 @see CNodeActivityBase
 */
 	#define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
-		const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, _S8(#name)}; \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
 		DEFINE_TRIPLES_TABLE( name :: iData )
 
 #else
@@ -128,7 +128,7 @@
 	#define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
 		EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
 		EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
-		const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, NULL}; \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
 		DEFINE_TRIPLES_TABLE( name :: iData )
 
 /**
@@ -147,7 +147,7 @@
 @see CNodeActivityBase
 */
 	#define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
-		const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, NULL}; \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
 		DEFINE_TRIPLES_TABLE( name :: iData )
 
 #endif
@@ -417,6 +417,126 @@
 	};
 
 /**
+RESERVED MACROS NOT TO BE USED.
+The following are new macro definitions allowing the context to be passed as a parameter rather than the node.
+In time the ability to pass context rather than node will be placed in the original macros. For the meantime,
+only critical commsFw activities which must have the context passed instead of the node should use these macros.
+All other activities should continue to use original macros declared above.
+*/
+/**
+Declare and export a node activity.
+
+@param name  The name of the activity, which will be used to put it into the node's activity map
+
+@see DECLARE_NODEACTIVITY
+*/
+#define DECLARE_RESERVED_EXPORT_NODEACTIVITY( name ) \
+	struct name \
+		{ \
+		IMPORT_C static const MeshMachine::TNodeActivity& Self(); \
+		IMPORT_C static const NetStateMachine::TStateTriple& FirstTriple(); \
+		static const MeshMachine::TNodeActivity iSelf; \
+		static const NetStateMachine::TStateTriple iData[]; \
+		};
+
+/**
+Declares a node activity. A node activity is a state machine. It contains multiple nodeactivity
+entries, which respresent the states, transitions and forks of the state machine.
+
+@param name  The name of the activity, which will be used to put it into the node's activity map
+
+@see DEFINE_NODEACTIVITY
+@see NODEACTIVITY_ENTRY
+*/
+#define DECLARE_RESERVED_NODEACTIVITY( name ) \
+	struct name \
+		{ \
+		inline static const MeshMachine::TNodeActivity& Self() {return iSelf;} \
+		inline static const NetStateMachine::TStateTriple& FirstTriple() {return iData[1];} \
+		static const MeshMachine::TNodeActivity iSelf; \
+		static const NetStateMachine::TStateTriple iData[]; \
+		};
+
+#ifdef SYMBIAN_TRACE_ENABLE
+
+/**
+Define a custom node activity. A custom node activity is a node activity which defines its own
+node activity class. This is used, for example, if the activity wishes to share some custom context
+information between the states and transition in the activity.
+
+Node activity class must derive from CNodeActivityBase.
+
+@param id        Identifier for the activity
+@param name      The name of the activity
+@param msgtype   Message which will kickoff this activity
+@param ctor      Constructor for the custom activity class
+
+@see DEFINE_RESERVED_NODEACTIVITY
+@see CNodeActivityBase
+	
+*/
+	#define DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
+		DEFINE_TRIPLES_TABLE( name :: iData )
+
+#else
+
+/**
+Define and export a custom node activity.
+
+@param id        Identifier for the activity
+@param name      The name of the activity
+@param msgtype   Message which will kickoff this activity
+@param ctor      Constructor for the custom activity class
+
+@see DEFINE_RESERVED_CUSTOM_NODEACTIVITY
+*/
+	#define DEFINE_RESERVED_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
+		EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
+		EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
+		DEFINE_TRIPLES_TABLE( name :: iData )
+
+/**
+Define a custom node activity. A custom node activity is a node activity which defines its own
+node activity class. This is used, for example, if the activity wishes to share some custom context
+information between the states and transition in the activity.
+
+Node activity class must derive from CNodeActivityBase.
+
+@param id        Identifier for the activity
+@param name      The name of the activity
+@param msgtype   Message which will kickoff this activity
+@param ctor      Constructor for the custom activity class
+
+@see DEFINE_RESERVED_NODEACTIVITY
+@see CNodeActivityBase
+*/
+	#define DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
+		DEFINE_TRIPLES_TABLE( name :: iData )
+
+#endif
+
+/**
+Define and declare a custom node activity
+
+@param id        Identifier for the activity
+@param name      The name of the activity
+@param msgtype   Message which will kickoff this activity
+@param ctor      Constructor for the custom activity class
+
+@see DEFINE_RESERVED_CUSTOM_NODEACTIVITY
+*/
+#define DECLARE_DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
+	DECLARE_RESERVED_NODEACTIVITY( name ) \
+	DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor )
+
+/**
+END OF RESERVED MACROS
+*/
+
+/**
 Mark the end of an activity map. This macro should be used for an activity map based
 on other activity maps.
 
@@ -432,6 +552,7 @@
 
 namespace MeshMachine
 {
+
 /**
 Base class for all node activity objects. Non custom node activities will use this by default.
 **/
@@ -516,10 +637,13 @@
 	Get the id of the node that the last request from this activity was sent to.
 	   @return Node id of the last node the activity has posted a request to
 	*/
-	const Messages::TNodeId PostedToId() const
-		{
-		return iPostedToId;
-		}
+	IMPORT_C const Messages::TNodeId& PostedToNodeId() const;
+	
+    /**
+    Get the id of the node that the last request from this activity was sent to.
+       @return Node id of the last node the activity has posted a request to
+    */
+	IMPORT_C const Messages::RNodeInterface* PostedToPeer() const;
 
 	/**
 	Get the id of the message that started this activity.
@@ -576,6 +700,13 @@
 	   @param aNodeId Node id to set the postedTo id to
 	*/
 	IMPORT_C void SetPostedTo(const Messages::TNodeId& aNodeId);
+	
+    /**
+       Manually set the postedTo id
+
+       @param aNodeId Node id to set the postedTo id to
+    */
+	IMPORT_C void SetPostedTo(const Messages::RNodeInterface& aRecipient);
 
 	/**
 	   Clear the postedTo id
@@ -809,8 +940,60 @@
 
 	const TNodeActivity& iActivitySig;
 
-	// Last node a message was sent to
-	Messages::TNodeId iPostedToId;
+	class RPostedToNodeOrPeer
+	/*
+	 * Class is used to store the recipient of the last request sent from the 'this' 
+	 * (the activity). This recipient can be represented either by its TNodeId address 
+	 * or, if it's a peer of the local node, by RNodeInterface. 
+     * The implementation may seem awkward or overengineered. This is to protect binary
+     * compatibility (it used to be TNodeId here and sizeof TNodeId was all there was at hand).
+     * 
+     * Rules of the game are that RPostedToNodeOrPeer:iBuf is a shared dwelling for either:
+     * - address of an RNodeInterface (in case posted to is a peer)
+     * - TNodeId (in case posted to is not a peer)
+     * Inspecting the content of iBuf and the assumptions around it are a little fragile 
+     * (based on TNodeId class layout a bit), so the code must be viligent. 
+     * _Node and _Peer perform arbitral happy conversion, so there can be 3 reasons why _Node()->Ptr() is NULL:
+     * (1) iBuf stores a 4 byte ptr to RNodeInterface and what Ptr normally returns is beyond these 4 bytes in a land hopefully zeroed by ::Close
+     * (2) iBuf stores nothing. 
+     * (3) iBuf stores a TNodeId pointing a NULL node (effectivelly TNodeId::NullId()). (3) is only theoretical as Open(TNodeId) prevens Ptr be NULL
+     * Therefore it is safe to assume that if Ptr() is NULL, it is either a valid pointer to a peer or NULL.
+     * Happily _Peer() will return that pointer or NULL respectivelly.* 
+	 */
+	    {
+	private:
+	    typedef Messages::RNodeInterface* TPeerType;
+    public:
+	    RPostedToNodeOrPeer();
+	    void Open(const Messages::RNodeInterface& aPeer);
+	    void Open(const Messages::TNodeId& aNode);
+	    void Close();
+	    
+	    const Messages::RNodeInterface* Peer() const;
+	    const Messages::TNodeId& NodeId() const;
+	    
+	private:
+	    TPeerType* _Peer() 
+	        {
+            return reinterpret_cast<TPeerType*>(&iBuf[0]);
+	        }
+        
+	    const TPeerType* _Peer() const 
+            {
+            return reinterpret_cast<const TPeerType*>(&iBuf[0]);
+            }	    
+	    
+	    Messages::TNodeId* _Node()
+	        {
+	        return reinterpret_cast<Messages::TNodeId*>(&iBuf[0]);
+	        }
+	    
+        const Messages::TNodeId* _Node() const
+            {
+            return reinterpret_cast<const Messages::TNodeId*>(&iBuf[0]);
+            }
+        TUint8 iBuf[__Align8(sizeof(Messages::TNodeId))];	    
+	    } iPostedToId;
 	};
 
 
@@ -846,7 +1029,14 @@
 	@param aNode        The node to which this activity will belong.
 	@return Generated unique component of activity id
 	*/
-	IMPORT_C static TUint GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
+	static TUint GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
+	/**
+	For use by custom activity News to generate the unique part of the activity id.
+	@param aActivitySig Context information about how the activity is to be started
+	@param aNode        The node to which this activity will belong.
+	@return Generated unique component of activity id
+	*/
+	IMPORT_C static TUint GetNextActivityCount( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
 
 	/**
 	Constructor for CNodeParallelActivityBase
@@ -1387,6 +1577,13 @@
     static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
 	};
 
+
+inline TUint CNodeParallelActivityBase::GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode )
+    {
+    //Historical. Method ceased to leave, but must keep the old, L-ending overload.
+    return GetNextActivityCount(aActivitySig, aNode);
+    }
+
 } //namespace MeshMachine
 
 #endif //SYMBIAN_MM_ACTIVITIES_H
--- a/commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h	Fri Jun 11 14:52:21 2010 +0300
@@ -46,15 +46,29 @@
 /**
 */
 	{
+	enum TNodeActivityFlags
+	{
+	EContextCtor = 1
+	};
+	
+	/*There are now two types of activity c'tors (hence TAny iCtor supported:
+	(1) The legacy ctor based on AMMNodeBase that must be supported for source backwards compatibility
+	(2) The new ctor based on TNodeContextBase that is desired because TNodeContextBase gives access to AMMNodeBase as well as the message 
+	    and peer and it is therefore more powerful. This new ctor has been introduced to aid leave activities to be infallible
+		by allowing access to the peer, which stores the space preallocated for the activity
+	Ideally this once fixed to only leave (2) especially since differentiating (1) from (2) is rather obscure. iCtor is a pointer
+	to a pointer to a ctor function and the distinction is based on where iCtor points (see AMMNodeBase::StartActivityL) */
 	typedef CNodeActivityBase* (*TStaticActivityCtor)(const TNodeActivity& aActivitySig, AMMNodeBase& aNode);
+	typedef CNodeActivityBase* (*TStaticActivityContextCtor)(const TNodeActivity& aActivitySig, TNodeContextBase& aCtx);
 	const TUint8 iId;
+	const TUint8 iFlags;
 	//Message starting the activity (state in iFirstTriple is waiting for),
 	//used by error handling, could be NULL for "single triple" activities because
 	//than the current message associated with context is used.
     const TUint16 iKickOffMessageId;
     const TUint32 iKickOffMessageRealm;
 	const NetStateMachine::TStateTriple& iFirstTriple;
-	const TStaticActivityCtor iCtor;
+	const TAny* iCtor;
 	const TText8* iName;
 	};
 
--- a/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -45,7 +45,9 @@
 enum
 	{
 	EPanicCorruptedContext = 1,
-	EPanicNoPreallocatedSpace = 2
+	EPanicNoPreallocatedSpace = 2,
+	EPanicOutOfActivities = 3,
+	EPanicOutOfBounds
 	};
 
 //-=========================================================
@@ -167,8 +169,8 @@
     //what's set as iPostedToId or from one of the orginators. 
     //if the message's recipient specifies the activity id, then that
     //activity must much that of 'this'.
-    TBool sender = iPostedToId.IsNull() || 
-    			   aContext.iSender == iPostedToId || 
+    TBool sender = PostedToNodeId().IsNull() || 
+    			   aContext.iSender == PostedToNodeId() || 
     			   FindOriginator(aContext.iSender) != KErrNotFound;
     const TNodeCtxId* recipient = address_cast<const TNodeCtxId>(&aContext.iRecipient);
     TBool activity = (recipient == NULL || ActivityId() == recipient->NodeCtx());
@@ -181,7 +183,7 @@
 		if(!sender)
 			{
 			MESH_LOG((KMeshMachineSubTag(), _L8("CNodeActivityBase %08x:\tiPostedToId mismatch:"), this));
-			NM_LOG_ADDRESS(KMeshMachineSubTag(), iPostedToId);
+			NM_LOG_ADDRESS(KMeshMachineSubTag(), PostedToNodeId());
 			NM_LOG_ADDRESS(KMeshMachineSubTag(), aContext.iSender);
 			MESH_LOG((KMeshMachineSubTag(), _L8("CNodeActivityBase %08x:\toriginators' mismatch:"), this));
 			for (TInt i = iOriginators.Count() - 1; i>=0; i--)
@@ -317,11 +319,12 @@
 
 EXPORT_C void CNodeActivityBase::Cancel(TNodeContextBase& aContext)
 	{//we expect KErrCancel be set as a result of the state cancelation
-    MESH_LOG((KMeshMachineSubTag, _L8("CNodeActivityBase %08x:\tCancel(), iPostedToId %08x"), this, iPostedToId.Ptr() ? &iPostedToId.Node() : NULL));
+    MESH_LOG((KMeshMachineSubTag, _L8("CNodeActivityBase %08x:\tCancel(), PostedToNodeId %08x"), this, PostedToNodeId().Ptr()));
 
-	if (!iPostedToId.IsNull())
-		{
-		RClientInterface::OpenPostMessageClose(TNodeCtxId(ActivityId(), iNode.Id()), iPostedToId, TEBase::TCancel().CRef());
+	if ((PostedToPeer() && !(PostedToPeer()->Flags() & TClientType::ELeaving)) ||
+	     PostedToNodeId() == aContext.Node().Id())
+		{//only safe to forward TCancels to non-leavers or self. There is an underlying assumption that a node won't dissapear in presence of activities (see AMMNodeBase::~AMMNodeBase)
+		RClientInterface::OpenPostMessageClose(TNodeCtxId(ActivityId(), iNode.Id()), PostedToNodeId(), TEBase::TCancel().CRef());
 		}
     else
         {
@@ -352,8 +355,8 @@
 		if (PostToOriginator(iOriginators[n], aMessage))
 			{
 			++msgSendCount;
-	    	iOriginators[n].Peer().SetFlags(aFlagsToSet);
-	    	iOriginators[n].Peer().ClearFlags(aFlagsToClear);
+	    	iOriginators[n].SetFlags(aFlagsToSet);
+	    	iOriginators[n].ClearFlags(aFlagsToClear);
 			};
 		}
 	return msgSendCount;
@@ -361,12 +364,44 @@
 
 EXPORT_C void CNodeActivityBase::SetPostedTo(const TNodeId& aNodeId)
     {
-    iPostedToId = aNodeId;
+    //You are being punished for storing a postedto TNodeId that you also know as your peer.
+    //the Messages::RNodeInterface& overload of CNodeActivityBase::SetPostedTo
+    //It is dangerous to use this overload for peers when the relation with these peers
+    //is being terminated. the PostedTo facility is also used to forward TCancel in
+    //the automatic calencallation handling. No message can be posted to a leaving peer
+    //but only peers (Messages::RNodeInterfaces) can be recognised as leaving. 
+    //
+    //ASSERT temporarily commened out as it is a behavioural break. A Polonium BR
+    //has been drafted and will be raised when the RNodeInterface overloads end up in the
+    //codeline. http://polonium.ext.nokia.com/changerequests/cr/601/
+    //__ASSERT_DEBUG(iNode.FindClient(aNodeId) == NULL, User::Panic(KSpecAssert_ElemMeshMachActC, 14));     
+    
+    if (aNodeId == Messages::TNodeId::NullId())
+        {
+        ClearPostedTo();
+        return;
+        }
+    iPostedToId.Open(aNodeId);
+    }
+
+EXPORT_C void CNodeActivityBase::SetPostedTo(const Messages::RNodeInterface& aRecepient)
+    {
+    iPostedToId.Open(aRecepient);
     }
 
 EXPORT_C void CNodeActivityBase::ClearPostedTo()
     {
-    iPostedToId.SetNull();
+    iPostedToId.Close();
+    }
+
+EXPORT_C const Messages::TNodeId& CNodeActivityBase::PostedToNodeId() const
+    {
+    return iPostedToId.NodeId();
+    }
+
+EXPORT_C const Messages::RNodeInterface* CNodeActivityBase::PostedToPeer() const
+    {
+    return iPostedToId.Peer();
     }
 
 EXPORT_C void CNodeActivityBase::PostRequestTo(const RNodeInterface& aRecipient, const TSignalBase& aMessage, const TBool aRecipientIdCritical)
@@ -374,7 +409,11 @@
 	aRecipient.PostMessage(TNodeCtxId(ActivityId(), iNode.Id()), aMessage);
 
 	// Provide the option for the identity of the receipient to be unimportant when the response arrives
-	iPostedToId = aRecipientIdCritical ? aRecipient.RecipientId() : TNodeId::NullId();
+	ClearPostedTo();
+    if (aRecipientIdCritical)
+        {
+        SetPostedTo(aRecipient);
+        }
 	}
 
 //Avoid using this function, always prefer PostRequestTo(const RNodeInterface& aRecipient, const TNodeSignal& aMessage)
@@ -383,7 +422,11 @@
 	RClientInterface::OpenPostMessageClose(TNodeCtxId(ActivityId(), iNode.Id()), aRecipient, aMessage);
 
 	// Provide the option for the identity of the receipient to be unimportant when the response arrives
-	iPostedToId = aRecipientIdCritical ? aRecipient : TNodeId::NullId();
+	ClearPostedTo();
+	if (aRecipientIdCritical)
+	    {
+        SetPostedTo(aRecipient);
+	    }
 	}
 
 EXPORT_C TBool CNodeActivityBase::IsIdle() const
@@ -417,6 +460,49 @@
         }
     }
 
+
+
+
+//-=========================================================
+//
+//CNodeActivityBase::RPostedToNodeOrPeer
+//
+//-=========================================================
+CNodeActivityBase::RPostedToNodeOrPeer::RPostedToNodeOrPeer() 
+    {
+    Close();
+    }
+
+void CNodeActivityBase::RPostedToNodeOrPeer::Open(const Messages::RNodeInterface& aPeer)
+    {
+    Close();
+    *_Peer() = const_cast<Messages::RNodeInterface*>(&aPeer);
+    }
+
+void CNodeActivityBase::RPostedToNodeOrPeer::Open(const Messages::TNodeId& aNode)
+    {
+    __ASSERT_DEBUG(aNode.Ptr(), User::Panic(KSpecAssert_ElemMeshMachActC, 15));    
+    //see Messages::TNodeId::operator= (snapping size is essential in case aNode is more than just plain TNodeId).
+    *_Node() = Messages::TNodeId(); 
+    
+    //normal assigment
+    *_Node() = aNode;
+    }
+void CNodeActivityBase::RPostedToNodeOrPeer::Close()
+    {
+    Mem::FillZ(iBuf, sizeof(iBuf));
+    }
+
+const Messages::RNodeInterface* CNodeActivityBase::RPostedToNodeOrPeer::Peer() const
+    {
+    return _Node()->Ptr() ? NULL : *_Peer();
+    }
+const Messages::TNodeId& CNodeActivityBase::RPostedToNodeOrPeer::NodeId() const
+    {
+    return (_Node()->Ptr() ? *_Node() : (*_Peer() ? (*_Peer())->RecipientId() : Messages::TNodeId::NullId()));
+    }
+
+
 //-=========================================================
 //
 //CNodeRetryActivity
@@ -461,20 +547,80 @@
     aInterface = this;
     }
 
+// BitMap utility used only by CNodeParallelActivityBase::GetNextActivityCount
+template<TInt SIZE>
+class TBitmap {
+public:
+    static const TInt iSize = sizeof(TUint32) * 8;
+    static const TUint32 iSizeMask = iSize - 1;
+    static const TUint32 iFull = ~0;
+    static const TInt iCount = (SIZE + iSizeMask) / iSize;
+    TBitmap();
+    void SetBit(TUint aBitNum);
+    TInt GetFreeBit() const;
+
+private:
+    TUint32 iBits[iCount];
+};
+
+template<TInt SIZE>
+TBitmap<SIZE>::TBitmap()
+{
+    for (TInt i = 0 ; i < iCount ; ++i)
+        {
+        iBits[i] = 0;
+        }
+}
+
+template<TInt SIZE>
+void TBitmap<SIZE>::SetBit(TUint aBitNum)
+    {
+    const TInt index = aBitNum / iSize;
+	__ASSERT_ALWAYS(index < iCount,User::Panic(KMMActivityPanic,EPanicOutOfBounds));
+
+    iBits[index] |= 1 << (aBitNum & iSizeMask);
+    }
+
+template<TInt SIZE>
+TInt TBitmap<SIZE>::GetFreeBit() const
+    {
+    for (TInt i = 0 ; i < iCount ; ++i)
+        {
+        const TUint32 bits = iBits[i];
+        if (bits != iFull)
+            {
+			// Bitmap represents list of activity IDs. Activity ID 1 is a reserved value.
+			// In order to mirror this fact the first bit of the bitmap is also always reserved
+            TUint32 mask = 2;
+            for (TInt bitIndex = 1 ; bitIndex < iSize ; ++bitIndex)
+                {
+                if ((bits & mask) == 0)
+                    {
+                    return (i * iSize) + bitIndex;
+                    }
+                mask <<= 1;
+                }
+            }
+        }
+    return KErrNotFound;
+    }
+
+
 //-=========================================================
 //
 //CNodeParallelActivityBase
 //
 //-=========================================================
-// For custom activities to implement NewL
-EXPORT_C TUint CNodeParallelActivityBase::GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode )
+
+
+// For custom activities to implement New
+EXPORT_C TUint CNodeParallelActivityBase::GetNextActivityCount( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode )
 	{
-	TInt c = 1, i = 0;
+	TInt c = 1;
 	
 	const RPointerArray<CNodeActivityBase>& activities = aNode.Activities();
-	RArray<TInt> activityids;
-	CleanupClosePushL(activityids);
-
+	
+	TBitmap<256> activityids;
 	// collect the currently used ids
 	for (TInt i = 0; i < activities.Count(); i++)
 		{
@@ -482,23 +628,12 @@
 		if ((id&0xff) == aActivitySig.iId)
 			{
 			TInt8 uniqueid = id >> 8;
-			activityids.InsertInOrderL(uniqueid);
+			activityids.SetBit(uniqueid);
 			}
 		}
-
-	// find first available.
-	while (i < activityids.Count()
-          && activityids[i] == c)
-		{
-		++i;
-		++c;
-		}
-	CleanupStack::PopAndDestroy(&activityids);
-
-	if(c > KActivityParallelRangeMax>>8)
-		{
-		User::Leave(KErrInUse);
-		}
+	c = activityids.GetFreeBit();
+	
+	__ASSERT_ALWAYS(c>=0,User::Panic(KMMActivityPanic,EPanicOutOfActivities));
     return c;
 	}
 
--- a/commsfwsupport/commselements/meshmachine/src/mm_node.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/src/mm_node.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -26,7 +26,6 @@
 #include <elements/nm_messages_base.h>
 #include <elements/nm_messages_child.h>
 
-
 #ifdef _DEBUG
 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
 // (if it could happen through user error then you should give it an explicit, documented, category + code)
@@ -232,7 +231,7 @@
 	for (TInt i = iActivities.Count() - 1; i>=0 && a==NULL; i--)
 		{
 		CNodeActivityBase* act = iActivities[i];
-		const TNodeId& postedTo = act->iPostedToId;
+		const TNodeId& postedTo = act->PostedToNodeId();
 		if (!act->IsIdle()
 			&& (postedTo.IsNull() || aContext.iSender == postedTo)
 				&& (recipient->NodeCtx() == act->ActivityId()))
@@ -430,6 +429,7 @@
 		}
 	}
 
+
 EXPORT_C void AMMNodeBase::AbortActivitiesOriginatedBy(TNodeContextBase& aContext, const TNodeId& aCommsId, TBool aIsNodeBeingDestroyed)
     {
     CNodeActivityBase* caller = aContext.iNodeActivity;
@@ -438,6 +438,20 @@
     for (TInt i = iActivities.Count() - 1; i>=0; i--)
         {
         aContext.iNodeActivity = iActivities[i];
+        
+        if (!abortAll && aContext.iNodeActivity->PostedToNodeId() == aCommsId)
+            {//clear postedto if a leaver has been set as a postedto at any of the running activities.
+             //No other messages will ever come from the leaver and it is not gonna be safe to forward TCancels
+             //to the leaver, so at least postedto must be cleared to avoid the crash. It could be speculated that
+             //if the postedto is still set, then either the postedto node failed to respond or the local activity failed to
+             //clear postedto when it had responded. Worth putting a speculative ASSERT here to catch misdeeds. 
+        
+             //clearing postedto shouldn't be done in here (AbortActivitiesOriginatedBy), but I (RZ) have expressed my disrespect to the
+             //this method before and the suggestion that it should go (replaced by a CancelActivitiesOriginatedBy).
+             //So instead of introducing another method that  loops through activities i decided to piggyback the function in an 
+             //existing method. Note that the final logic should be based on RNodeInterfaces and not TNodeIds.
+            aContext.iNodeActivity->ClearPostedTo();
+            }
 		
 		// We dont want to abort already idle activities or they may error.		
 		if(aContext.iNodeActivity->IsIdle())
@@ -458,25 +472,31 @@
       	        TInt idx = aContext.iNodeActivity->FindOriginator(aCommsId);
       	        if (KErrNotFound!=idx)
       	        	{
+                    TBool canSend = ETrue;
 					if(aContext.iNodeActivity->iOriginators.Count() == 1) // only if this is the final originator
 						{
 						aContext.iNodeActivity->SetError(KErrAbort);
            	        	aContext.iNodeActivity->Cancel(aContext);
+           	        	//This is a workaround for CCommsBinderRequest. The proper fix is to abolish the concept of aborting activities.
+                        //Aborting activities is a bad idea as an aborted activity isn't given a chance to perform graceful cleanup.
+           	        	//Today activities get aborted because their orinators urgently leave. I.e.: they are trully leaving now! Last orders!
+           	        	//It is then incorrect to leave the activity d'tor to finish the wrap up - because the node will be gone by then.
+           	        	//So whether and when to send an error must be decided here, by this generic code that has no clue on the subtleties
+           	        	//of individual activities. If there is no abort - there is urgent leavers. They send TLeaveRequest and they politely
+           	        	//wait for the completion and all this code is unnecessary.
+           	        	canSend = (aContext.iNodeActivity->Error() != KErrNone);
 						}
-					
-    					
+                    
                     //In the "quiet mode", when the hosting node is being destroyed, we can not afford sending
                     //an error to the node as it would hit void.
                     TNodePeerId& originator = aContext.iNodeActivity->iOriginators[idx];
-                    TBool canSend = !((aIsNodeBeingDestroyed && originator == aContext.NodeId())
-                        || aContext.iMessage.IsMessage<TEChild::TLeft>());
+                    canSend &= !((aIsNodeBeingDestroyed && originator == aContext.NodeId())
+                        || aContext.iMessage.IsMessage<TEChild::TLeft>()); 
                     if (canSend)
                         {
                         aContext.iNodeActivity->PostToOriginator(originator, TEBase::TError(aContext.iMessage.MessageId(), KErrAbort).CRef());
                         }
-    					
-
-	 	        	aContext.iNodeActivity->RemoveOriginator(idx);
+                    aContext.iNodeActivity->RemoveOriginator(idx);
       	        	}
       	        }
             }
@@ -616,21 +636,36 @@
 
 void AMMNodeBase::StartActivityL(TNodeContextBase& aContext, const TNodeActivity& aActivitySig, const NetStateMachine::TStateTriple& aFirst)
     {
-    CNodeActivityBase* a = aActivitySig.iCtor(aActivitySig,*this);
-    if (iActivities.Find(a)==KErrNotFound)
+	CNodeActivityBase* nodeActivity;
+	// Activity is based on one of 2 declarations. One of which has an extra member. In the case of the instance
+	// with a second member the activities Ctor will point to this second member. Since the first member is a TNodeActivity
+	// We can compare the activities Ctor pointer to the address of the second member to assess which type of declarations
+	// this is.
+	
+	if (aActivitySig.iFlags & TNodeActivity::EContextCtor)
+		{ // TNodeActivity's iCtor is a pointer to Activity Ctor
+		nodeActivity = ((TNodeActivity::TStaticActivityContextCtor)aActivitySig.iCtor)(aActivitySig,aContext);
+		}
+	else
+		{ // TNodeActivity's iCtor is a pointer to activity constructor
+		nodeActivity = ((TNodeActivity::TStaticActivityCtor)aActivitySig.iCtor)(aActivitySig,*this);
+		}
+
+    if (iActivities.Find(nodeActivity)==KErrNotFound)
     	{
     	//The activity did not add itself to the list in any special way, append it here
-	    CleanupStack::PushL(a);
-   		a->AppendActivityL();
-	    CleanupStack::Pop(a);
+	    CleanupStack::PushL(nodeActivity);
+   		nodeActivity->AppendActivityL();
+	    CleanupStack::Pop(nodeActivity);
 		}
+
 	//assign only after the activity is successfully appended
-	aContext.iNodeActivity = a;
+	aContext.iNodeActivity = nodeActivity;
 
     //if StartL leaves the "a" will be removed from the array and deleted in ::PostReceived
     //since it will be idle
     XNodePeerId originator(aContext.iSender, aContext.iPeer);
-    a->StartL(aContext, originator, aFirst);
+    nodeActivity->StartL(aContext, originator, aFirst);
     }
 
 void AMMNodeBase::PreallocateSpaceL(TUint aSize)
--- a/commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def	Fri Jun 11 14:52:21 2010 +0300
@@ -37,7 +37,7 @@
 	??8TNodeIdRemainder@Messages@@QBEHABVTRuntimeCtxId@1@@Z @ 36 NONAME ; int Messages::TNodeIdRemainder::operator==(class Messages::TRuntimeCtxId const &) const
 	??8TRuntimeCtxId@Messages@@QBEHABV01@@Z @ 37 NONAME ; int Messages::TRuntimeCtxId::operator==(class Messages::TRuntimeCtxId const &) const
 	??ATClientIterBase@Messages@@QAEPAVRNodeInterface@1@H@Z @ 38 NONAME ; class Messages::RNodeInterface * Messages::TClientIterBase::operator[](int)
-	?AddClientL@ANodeBase@Messages@@QAEPAVRNodeInterface@2@ABVTNodeId@2@ABVTClientType@2@PAX@Z @ 39 NONAME ; class Messages::RNodeInterface * Messages::ANodeBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *)
+	?AddClientL@ANodeBase@Messages@@UAEPAVRNodeInterface@2@ABVTNodeId@2@ABVTClientType@2@PAX@Z @ 39 NONAME ; class Messages::RNodeInterface * Messages::ANodeBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *)
 	?AddPersistentItf@CGlobals@Messages@@QAEXABVTNodeId@2@@Z @ 40 NONAME ABSENT ; void Messages::CGlobals::AddPersistentItf(class Messages::TNodeId const &)
 	?Close@RClientInterface@Messages@@QAEXXZ @ 41 NONAME ; void Messages::RClientInterface::Close(void)
 	?Close@RNodeInterface@Messages@@QAEXXZ @ 42 NONAME ; void Messages::RNodeInterface::Close(void)
@@ -201,5 +201,8 @@
 	?GetVDataTableStatic@TSigNodeIdNumberNumberNumber@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 200 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigNodeIdNumberNumberNumber::GetVDataTableStatic(void)
 	?GetVDataTableStatic@TSigTypeId@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 201 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigTypeId::GetVDataTableStatic(void)
 	?GetVDataTableStatic@TSigTypeIdAnyNumber@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 202 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigTypeIdAnyNumber::GetVDataTableStatic(void)
+	??1RNodeInterface@Messages@@UAE@XZ @ 203 NONAME ; Messages::RNodeInterface::~RNodeInterface(void)
+	?PreAllocL@RNodeInterface@Messages@@AAEXI@Z @ 204 NONAME ; void Messages::RNodeInterface::PreAllocL(unsigned int)
+	??0RNodeInterface@Messages@@QAE@XZ @ 205 NONAME ; Messages::RNodeInterface::RNodeInterface(void)
+	?ClaimPreallocatedSpace@RNodeInterface@Messages@@AAEPAXI@Z @ 206 NONAME ; void * Messages::RNodeInterface::ClaimPreallocatedSpace(unsigned int)
 
-
--- a/commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def	Fri Jun 11 14:52:21 2010 +0300
@@ -331,5 +331,13 @@
 	_ZTVN8Messages13TSigMessageIdE @ 330 NONAME
 	_ZTVN8Messages19TSigTypeIdAnyNumberE @ 331 NONAME
 	_ZTVN8Messages28TSigNodeIdNumberNumberNumberE @ 332 NONAME
+	_ZN8Messages14RNodeInterface22ClaimPreallocatedSpaceEj @ 333 NONAME
+	_ZN8Messages14RNodeInterface9PreAllocLEj @ 334 NONAME
+	_ZN8Messages14RNodeInterfaceC1Ev @ 335 NONAME
+	_ZN8Messages14RNodeInterfaceC2Ev @ 336 NONAME
+	_ZN8Messages14RNodeInterfaceD0Ev @ 337 NONAME
+	_ZN8Messages14RNodeInterfaceD1Ev @ 338 NONAME
+	_ZN8Messages14RNodeInterfaceD2Ev @ 339 NONAME
+	_ZTIN8Messages14RNodeInterfaceE @ 340 NONAME
+	_ZTVN8Messages14RNodeInterfaceE @ 341 NONAME
 
-
--- a/commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h	Fri Jun 11 14:52:21 2010 +0300
@@ -33,6 +33,17 @@
 _LIT(KSpecAssert_ElemNodeMessIntH, "ElemNodeMessIntH");
 #endif
 
+// Forward declarations to be used with RNodeInterface to allow for friend assignment
+namespace ESock
+	{
+	class CMMCommsProviderBase;
+	}
+
+namespace CprClientLeaveActivity
+	{
+	class CClientLeaveActivity;
+	}
+
 namespace Messages
 {
 
@@ -288,7 +299,16 @@
 	{
 	friend class TClientIterBase;
 
+	// Friend classes needed to allow access to memory preallocation functionality
+	// This friend funtionality is to be removed when the preallocation functionality is revisited
+	// These friends are not to be used for any further functionality
+	friend class ESock::CMMCommsProviderBase;
+	friend class CprClientLeaveActivity::CClientLeaveActivity;
+
 public:
+	IMPORT_C RNodeInterface();
+	IMPORT_C virtual ~RNodeInterface();
+
 	IMPORT_C void Open(TNodeId aPostTo, const TClientType& aClientType = TClientType::NullType(), MTransportSender* aSender = NULL);
 	IMPORT_C void Close();
 	IMPORT_C TBool operator==(const RNodeInterface& aRHS) const;
@@ -367,8 +387,40 @@
 #endif
 	    }
 
+// Handling of preallocating memory to be used by the Leave activity
+private:
+	IMPORT_C void PreAllocL(TUint aAllocSize);
+
+	/**
+	Claim some preallocated memory from the RNodeInterface. This preallocated memory is used for activities that
+	absolutely cannot fail in any scenario, such as for Leaving the node. For this reason, when the
+	RNodeInterface is created, some memory is allocated so that a leaving activity can't even fail in an out
+	of memory situation.
+
+	This method is static as the memory must be claimed before the activity object is constructed.
+
+	@param aNode The node that owns the preallocated space. This must be the node that the activity runs on.
+	@param aSize Size of buffer to allocate.
+
+	@return A pointer to the allocated block of memory
+	*/
+	IMPORT_C TAny* ClaimPreallocatedSpace(TUint aSize);
+
 protected:
 	TClientType iClientType;
+private:
+	struct TPreAllocStore
+		{
+		TPreAllocStore()
+			{
+			iPreAllocSize=0;
+			iPreAllocatedActivityChunk=NULL;
+			}
+		TUint iPreAllocSize;
+		TAny* iPreAllocatedActivityChunk;
+		};
+
+	TPreAllocStore* iPreAlloc;
 	};
 
 class RRequestOriginator
--- a/commsfwsupport/commselements/nodemessages/inc/nm_node.h	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/inc/nm_node.h	Fri Jun 11 14:52:21 2010 +0300
@@ -127,7 +127,7 @@
 
 public:
     IMPORT_C virtual RNodeInterface* NewClientInterfaceL(const TClientType& aClientType, TAny* aClientInfo = NULL);
-    IMPORT_C RNodeInterface* AddClientL(const TNodeId& aClientId, const TClientType& aClientType, TAny* aClientInfo = NULL);
+    IMPORT_C virtual RNodeInterface* AddClientL(const TNodeId& aClientId, const TClientType& aClientType, TAny* aClientInfo = NULL);
     IMPORT_C void RemoveClient(RNodeInterface& aClient);
     IMPORT_C void RemoveClient(TInt aIndex);
     inline const TNodeId& Id() const
--- a/commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -115,6 +115,15 @@
 *
 *
 *******************************************************************************************************/
+
+EXPORT_C RNodeInterface::RNodeInterface() : iPreAlloc(NULL)
+	{}
+
+EXPORT_C RNodeInterface::~RNodeInterface()
+	{
+	__ASSERT_DEBUG(iPreAlloc == NULL, User::Panic(KSpecAssert_ElemNodeMessIntC, 1));
+	}
+
 EXPORT_C void RNodeInterface::Open(TNodeId aPostTo, const TClientType& aClientType, MTransportSender* aSender)
 /*
 Opens 'this'.
@@ -129,9 +138,14 @@
 	{
 	RClientInterface::Close();
 	iClientType = TClientType::NullType();
+	if(iPreAlloc!=NULL)
+		{
+		delete iPreAlloc->iPreAllocatedActivityChunk;
+		}
+	delete iPreAlloc;
+	iPreAlloc = NULL;
 	}
 
-
 EXPORT_C void RNodeInterface::PostMessage(const TRuntimeCtxId& aPostFrom, const TNodeId::TRemainder& aPostTo, const TSignalBase& aMessage) const
 	{
 	TUint8 postTo[__Align8(TRuntimeCtxId::KMaxInlineAddressSize)];
@@ -149,6 +163,40 @@
 	return RecipientId() == aRHS.RecipientId();
 	}
 
+EXPORT_C void RNodeInterface::PreAllocL(TUint aAllocSize)
+/**	Pre-allocates memory and stores the pointer and its size
+@param size of memory space to prealloc
+*/
+	{
+	if(iPreAlloc!=NULL)
+		// Memory already allocated for this client
+		{
+		__ASSERT_DEBUG(iPreAlloc->iPreAllocatedActivityChunk != NULL, User::Panic(KSpecAssert_ElemNodeMessIntC, 5));
+		return;
+		}
+	iPreAlloc = new (ELeave) TPreAllocStore();
+	iPreAlloc->iPreAllocatedActivityChunk = User::AllocL(aAllocSize);
+	iPreAlloc->iPreAllocSize = aAllocSize;
+	}
+
+EXPORT_C TAny* RNodeInterface::ClaimPreallocatedSpace(TUint aSize)
+/**	Finds a pointer of the requested size from the preallocation array (see PreallocActivitySpaceL) and returns it
+@param size of memory space requested
+@return pointer to memory allocation or NULL if no preallocation and allocation here fails
+*/
+	{
+	if(!(iPreAlloc && aSize <= iPreAlloc->iPreAllocSize))
+		{
+		// By this stage the PreAllocL must have been triggered and memory space must have been allocated.
+		__ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ElemNodeMessIntC, 3));
+		delete iPreAlloc->iPreAllocatedActivityChunk;
+		iPreAlloc->iPreAllocatedActivityChunk = User::AllocL(aSize);
+		}
+	TAny* preallocatedSpace = (RNodeInterface*)iPreAlloc->iPreAllocatedActivityChunk;
+	iPreAlloc->iPreAllocatedActivityChunk=NULL;
+	return preallocatedSpace;
+	}
+
 /******************************************************************************************************
 *
 *
@@ -204,7 +252,7 @@
 
 EXPORT_C void RRequestOriginator::Open(RRequestOriginator& aOriginalRequest)
 	{
-	__ASSERT_DEBUG(aOriginalRequest.IsOpen(), User::Panic(KSpecAssert_ElemNodeMessIntC, 1));
+	__ASSERT_DEBUG(aOriginalRequest.IsOpen(), User::Panic(KSpecAssert_ElemNodeMessIntC, 4));
 	iNode = aOriginalRequest.iNode;
 	iRemainder = aOriginalRequest.iRemainder;
 	aOriginalRequest.Close();
--- a/commsfwtools/commstools/group/comms-infras_tools.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwtools/commstools/group/comms-infras_tools.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_tools
 source			\sf\os\commsfw\commsfwtools\commstools
 exports			\sf\os\commsfw\commsfwtools\commstools\group
--- a/commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/comms-infras_defaultcommdb.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/comms-infras_defaultcommdb.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_defaultcommdb
 
 source  \sf\os\commsfw\commsfwtools\preparedefaultcommsdatabase\defaultcommdb
--- a/commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_commsdat
 
 source		\sf\os\commsfw\commsfwtools\preparedefaultcommsdatabase\bwins
--- a/commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat_tools_symport.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat_tools_symport.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_commsdat_tools_symport
 
 source		\src\mcl\os\commsfw\commsfwtools\preparedefaultcommsdatabase\Documentation
--- a/commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat_tools_symport_l.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwtools/preparedefaultcommsdatabase/group/comms-infras_commsdat_tools_symport_l.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_commsdat_tools_symport_l
 
 source		\src\mcl\os\commsfw\commsfwtools\preparedefaultcommsdatabase\Documentation
--- a/commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/comms-infras_installdefaultcommdb.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/comms-infras_installdefaultcommdb.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_installdefaultcommdb
 
 source  \sf\os\commsfw\commsfwtools\preparedefaultcommsdatabase\installdefaultcommdb
--- a/commsfwutils/commsbufs/TS_mbufmgr/Test06SplitL.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/TS_mbufmgr/Test06SplitL.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -61,6 +61,8 @@
 		{
 		return EFail;
 		}
+	TBool forceSmallBuf = EFalse;
+    bRet = GetIntFromConfig(_L("MBufMgrTest06"), _L("ForceSmallBuf"), forceSmallBuf);
  	Log(_L("     ------- Chain & Desc LENGTH   = %d --"), aLength);
  	Log(_L("     ------- OFFSET where to Split = %d --"), aOffset);
 	if ( (aLength > 1000)    ||(aLength <0) ||
@@ -79,7 +81,36 @@
 	Log(_L("  01 Creating CMBufManager and installing active scheduler:"));
     CleanupStack::PushL( iActSch = new(ELeave) CActiveScheduler );
 	CActiveScheduler::Install(iActSch);
-	CreateInstanceMBufMgrL(KMBufDefaultHeapSize);
+
+	enum { KBigBuf = 256, KSmallBuf = 128 };
+	if(forceSmallBuf)
+	    {
+        RArray<TCommsBufPoolCreateInfo> createInfoArray;
+        
+        TCommsBufPoolCreateInfo createInfo;
+        createInfo.iBufSize = KSmallBuf;
+        createInfo.iInitialBufs = 128;
+        createInfo.iGrowByBufs = 64;
+        createInfo.iMinFreeBufs = 40;
+        createInfo.iCeiling = 410; 
+        createInfoArray.AppendL(createInfo);
+        
+        createInfo.iBufSize = KBigBuf;
+        createInfo.iInitialBufs = 3;
+        createInfo.iGrowByBufs = 1;
+        createInfo.iMinFreeBufs = 1;
+        createInfo.iCeiling = 3;
+        createInfoArray.AppendL(createInfo);
+
+        CreateInstanceMBufMgrL(createInfoArray);
+
+        createInfoArray.Close();
+	    }	
+	else
+	    {
+        CreateInstanceMBufMgrL(KMBufDefaultHeapSize);
+	    }
+	
 	CleanupClosePushL(iBufPond);
 
 	//-------------- substep 2 --------------------
@@ -111,6 +142,18 @@
 #endif
 		User::Leave(EFail);
 		}
+	
+	if(forceSmallBuf)
+	    {
+        for(RMBuf* buf = aChain1.First(); buf; buf = buf->Next())
+            {
+            if(buf->Size() != KBigBuf)
+                {
+                Log(_L("-- initial chain should be composed of %d buf, found %d buf"), KBigBuf, buf->Size());
+                User::Leave(EFail);
+                }
+            }
+	    }
 
 	//-------------- substep 6 --------------------
 	Log(_L("  06 Copy in Des1 into Chain1:"));
@@ -158,6 +201,16 @@
 #endif
 		User::Leave(EFail);
 		}
+	
+    if(forceSmallBuf)
+        {
+        if(!aChain2.First() || aChain2.First()->Size() != KSmallBuf ||
+           !aChain2.First()->Next() || aChain2.First()->Next()->Size() != KSmallBuf)
+            {
+            Log(_L("-- split chain should start with two %d buf"), KSmallBuf);
+            User::Leave(EFail);
+            }
+        }
 
 	//-------------- substep 9 --------------------
 	Log(_L("  09 Copy out Chain1 into Des2:"));
@@ -184,7 +237,7 @@
 	//-------------- substep 12 --------------------
 	Log(_L("  12 Copy out the whole Chain2 into Des2 at offset = OFFSET"));
 	TPtr8 dest((TUint8*)aDes2->Ptr() + aOffset, aLength-aOffset, aLength - aOffset);
-	aChain1.CopyOut(dest);
+	aChain2.CopyOut(dest);
 
 	//-------------- substep 13 --------------------
 	Log(_L("  13 Compare the content of Des1 & Des2:"));
--- a/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-1st.ini	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-1st.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -1,3 +1,4 @@
 [MBufMgrTest06]
 Length=100
 Offset=60
+ForceSmallBuf=0
--- a/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -1,3 +1,4 @@
 [MBufMgrTest06]
 Length=200
 Offset=129
+ForceSmallBuf=0
--- a/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -1,3 +1,4 @@
 [MBufMgrTest06]
 Length=300
 Offset=160
+ForceSmallBuf=0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/MBufTest06-4th.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,4 @@
+[MBufMgrTest06]
+Length=700
+Offset=260
+ForceSmallBuf=1
--- a/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/mbuftest.script	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/TS_mbufmgr/scriptfiles/mbuftest.script	Fri Jun 11 14:52:21 2010 +0300
@@ -125,6 +125,17 @@
 PRINT
 END_TESTCASE			COMINF-MBUFMGR-0602
 
+START_TESTCASE			COMINF-MBUFMGR-0603
+//! @SYMTestCaseID		COMINF-MBUFMGR-0603
+PRINT Test 06: Split a chain of big bufs when only small reamaining
+HANDLES_MARK
+RUN_TEST_STEP 10000, TS_CTMBufMgr, MBufMgrTest06 ,z:\testdata\configs\MBufTest06-4th.ini
+TEST_COMPLETE
+HANDLES_CHECK
+PRINT ------------------------------
+PRINT
+END_TESTCASE			COMINF-MBUFMGR-0603
+
 START_TESTCASE			COMINF-MBUFMGR-0700
 //! @SYMTestCaseID		COMINF-MBUFMGR-0700
 PRINT Test 07: TrimStart the chain on the first and only RMBuf
--- a/commsfwutils/commsbufs/group/bld.inf	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/group/bld.inf	Fri Jun 11 14:52:21 2010 +0300
@@ -59,44 +59,26 @@
 
 PRJ_TESTEXPORTS
 //MBuf ComponentTest scripts & configs
-../TS_mbufmgr/scriptfiles/mbuftest.script /epoc32/release/wins/udeb/z/testdata/scripts/mbuftest.script
-../TS_mbufmgr/scriptfiles/mbuftest.script /epoc32/release/winscw/udeb/z/testdata/scripts/mbuftest.script
-../TS_mbufmgr/scriptfiles/MBufTest05-CopyIn.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest05-copyin.ini
-../TS_mbufmgr/scriptfiles/MBufTest05-CopyIn.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest05-copyin.ini
-../TS_mbufmgr/scriptfiles/MBufTest05-CopyOut.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest05-copyout.ini
-../TS_mbufmgr/scriptfiles/MBufTest05-CopyOut.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest05-copyout.ini
-../TS_mbufmgr/scriptfiles/MBufTest06-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest06-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest06-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest06-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest06-2nd.ini
-../TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest06-2nd.ini
-../TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest06-3rd.ini
-../TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest06-3rd.ini
-../TS_mbufmgr/scriptfiles/MBufTest07-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest07-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest07-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest07-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest07-2nd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest07-2nd.ini
-../TS_mbufmgr/scriptfiles/MBufTest07-2nd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest07-2nd.ini
-../TS_mbufmgr/scriptfiles/MBufTest07-3rd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest07-3rd.ini
-../TS_mbufmgr/scriptfiles/MBufTest07-3rd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest07-3rd.ini
-../TS_mbufmgr/scriptfiles/MBufTest08-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest08-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest08-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest08-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest08-2nd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest08-2nd.ini
-../TS_mbufmgr/scriptfiles/MBufTest08-2nd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest08-2nd.ini
-../TS_mbufmgr/scriptfiles/MBufTest08-3rd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest08-3rd.ini
-../TS_mbufmgr/scriptfiles/MBufTest08-3rd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest08-3rd.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-2nd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-2nd.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-2nd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-2nd.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-3rd.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-3rd.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-3rd.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-3rd.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-4th.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-4th.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-4th.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-4th.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-5th.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest09-5th.ini
-../TS_mbufmgr/scriptfiles/MBufTest09-5th.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest09-5th.ini
-../TS_mbufmgr/scriptfiles/MBufTest10-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest10-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest10-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest10-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest13-1st.ini /epoc32/release/wins/udeb/z/testdata/configs/mbuftest13-1st.ini
-../TS_mbufmgr/scriptfiles/MBufTest13-1st.ini /epoc32/release/winscw/udeb/z/testdata/configs/mbuftest13-1st.ini
+../TS_mbufmgr/scriptfiles/mbuftest.script z:/testdata/scripts/mbuftest.script
+../TS_mbufmgr/scriptfiles/MBufTest05-CopyIn.ini z:/testdata/configs/mbuftest05-copyin.ini
+../TS_mbufmgr/scriptfiles/MBufTest05-CopyOut.ini z:/testdata/configs/mbuftest05-copyout.ini
+../TS_mbufmgr/scriptfiles/MBufTest06-1st.ini z:/testdata/configs/mbuftest06-1st.ini
+../TS_mbufmgr/scriptfiles/MBufTest06-2nd.ini z:/testdata/configs/mbuftest06-2nd.ini
+../TS_mbufmgr/scriptfiles/MBufTest06-3rd.ini z:/testdata/configs/mbuftest06-3rd.ini
+../TS_mbufmgr/scriptfiles/MBufTest06-4th.ini z:/testdata/configs/mbuftest06-4th.ini
+../TS_mbufmgr/scriptfiles/MBufTest07-1st.ini z:/testdata/configs/mbuftest07-1st.ini
+../TS_mbufmgr/scriptfiles/MBufTest07-2nd.ini z:/testdata/configs/mbuftest07-2nd.ini
+../TS_mbufmgr/scriptfiles/MBufTest07-3rd.ini z:/testdata/configs/mbuftest07-3rd.ini
+../TS_mbufmgr/scriptfiles/MBufTest08-1st.ini z:/testdata/configs/mbuftest08-1st.ini
+../TS_mbufmgr/scriptfiles/MBufTest08-2nd.ini z:/testdata/configs/mbuftest08-2nd.ini
+../TS_mbufmgr/scriptfiles/MBufTest08-3rd.ini z:/testdata/configs/mbuftest08-3rd.ini
+../TS_mbufmgr/scriptfiles/MBufTest09-1st.ini z:/testdata/configs/mbuftest09-1st.ini
+../TS_mbufmgr/scriptfiles/MBufTest09-2nd.ini z:/testdata/configs/mbuftest09-2nd.ini
+../TS_mbufmgr/scriptfiles/MBufTest09-3rd.ini z:/testdata/configs/mbuftest09-3rd.ini
+../TS_mbufmgr/scriptfiles/MBufTest09-4th.ini z:/testdata/configs/mbuftest09-4th.ini
+../TS_mbufmgr/scriptfiles/MBufTest09-5th.ini z:/testdata/configs/mbuftest09-5th.ini
+../TS_mbufmgr/scriptfiles/MBufTest10-1st.ini z:/testdata/configs/mbuftest10-1st.ini
+../TS_mbufmgr/scriptfiles/MBufTest13-1st.ini z:/testdata/configs/mbuftest13-1st.ini
 testmbuf.iby /epoc32/rom/include/testmbuf.iby
 
 PRJ_MMPFILES
--- a/commsfwutils/commsbufs/group/comms-infras_commsbufs.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/group/comms-infras_commsbufs.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_commsbufs
 source	\sf\os\commsfw\commsfwutils\commsbufs
 binary	\sf\os\commsfw\commsfwutils\commsbufs\group	all
--- a/commsfwutils/commsbufs/group/testmbuf.iby	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/group/testmbuf.iby	Fri Jun 11 14:52:21 2010 +0300
@@ -22,25 +22,26 @@
 #include <commsbufs.iby>
 
 file=ABI_DIR\DEBUG_DIR\TS_CTMBUFMGR.DLL						\System\libs\TS_CTMBUFMGR.DLL
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\scripts\mbuftest.script		\testdata\scripts\mbuftest.script
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\scripts\mbuftest.script		\testdata\scripts\mbuftest_zc.script
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest05-CopyIn.ini		\testdata\configs\MBufTest05-CopyIn.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest05-CopyOut.ini	\testdata\configs\MBufTest05-CopyOut.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest06-1st.ini		\testdata\configs\MBufTest06-1st.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest06-2nd.ini		\testdata\configs\MBufTest06-2nd.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest06-3rd.ini		\testdata\configs\MBufTest06-3rd.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest07-1st.ini		\testdata\configs\MBufTest07-1st.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest07-2nd.ini		\testdata\configs\MBufTest07-2nd.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest07-3rd.ini		\testdata\configs\MBufTest07-3rd.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest08-1st.ini		\testdata\configs\MBufTest08-1st.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest08-2nd.ini		\testdata\configs\MBufTest08-2nd.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest08-3rd.ini		\testdata\configs\MBufTest08-3rd.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-1st.ini		\testdata\configs\MBufTest09-1st.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-2nd.ini		\testdata\configs\MBufTest09-2nd.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-3rd.ini		\testdata\configs\MBufTest09-3rd.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-4th.ini		\testdata\configs\MBufTest09-4th.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest09-5th.ini		\testdata\configs\MBufTest09-5th.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest10-1st.ini		\testdata\configs\MBufTest10-1st.ini
-data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest13-1st.ini		\testdata\configs\MBufTest13-1st.ini
+data=EPOCROOT##epoc32\data\z\TestData\scripts\mbuftest.script		\testdata\scripts\mbuftest.script
+data=EPOCROOT##epoc32\data\z\TestData\scripts\mbuftest.script		\testdata\scripts\mbuftest_zc.script
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest05-CopyIn.ini		\testdata\configs\MBufTest05-CopyIn.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest05-CopyOut.ini	\testdata\configs\MBufTest05-CopyOut.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest06-1st.ini		\testdata\configs\MBufTest06-1st.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest06-2nd.ini		\testdata\configs\MBufTest06-2nd.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest06-3rd.ini		\testdata\configs\MBufTest06-3rd.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest06-4th.ini		\testdata\configs\MBufTest06-4th.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest07-1st.ini		\testdata\configs\MBufTest07-1st.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest07-2nd.ini		\testdata\configs\MBufTest07-2nd.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest07-3rd.ini		\testdata\configs\MBufTest07-3rd.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest08-1st.ini		\testdata\configs\MBufTest08-1st.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest08-2nd.ini		\testdata\configs\MBufTest08-2nd.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest08-3rd.ini		\testdata\configs\MBufTest08-3rd.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-1st.ini		\testdata\configs\MBufTest09-1st.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-2nd.ini		\testdata\configs\MBufTest09-2nd.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-3rd.ini		\testdata\configs\MBufTest09-3rd.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-4th.ini		\testdata\configs\MBufTest09-4th.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest09-5th.ini		\testdata\configs\MBufTest09-5th.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest10-1st.ini		\testdata\configs\MBufTest10-1st.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\MBufTest13-1st.ini		\testdata\configs\MBufTest13-1st.ini
 
 #endif
--- a/commsfwutils/commsbufs/mbufmgr/inc/MBufPanic.h	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/mbufmgr/inc/MBufPanic.h	Fri Jun 11 14:52:21 2010 +0300
@@ -85,7 +85,8 @@
 	EMBuf_IndexOutofRange =43,
 	EMBuf_InvalidLengthOrOffset =44,
 	EMBuf_AsyncAllocInvalidState =45,
-	EMBuf_InsufficientSpaceToStorePond = 45
+	EMBuf_InsufficientSpaceToStorePond = 46,
+	EMBuf_InvalidAsyncReqImpl = 47
 	};
 
 #endif // __MBufPanic_h__
--- a/commsfwutils/commsbufs/mbufmgr/inc/nifmbuf.h	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/mbufmgr/inc/nifmbuf.h	Fri Jun 11 14:52:21 2010 +0300
@@ -46,7 +46,6 @@
 */
 	{
 public:
-	IMPORT_C RMBufCell(RMBufCell* aPktHdr);
 	IMPORT_C static TAny* operator new(TUint aSize, TLeave aLeave, TUint aExtra);
 	IMPORT_C static TAny* operator new(TUint aSize, TUint aExtra) __NO_THROW;
 	IMPORT_C static void operator delete(TAny*);
--- a/commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -272,7 +272,23 @@
 		len = Min(aLen, len);	
 		}		
 
-	TInt err = newChain.Alloc(len + aHdrReserve, *this);
+// Suppress the "follow-the-leader" behaviour of preserving the buffer sizing of the
+// existing chain. The goal of preserving buffer characteristics remains desirable but
+// not at the cost of having TCP use unnecessarily small buffers - this area needs 
+// rework once the Comms stack really adopts buffer pools and zero copy  	
+//	TInt err = newChain.Alloc(len + aHdrReserve, *this);
+	TInt err;
+    if(First())
+        {
+        newChain.iNext = First()->Pool()->Pond().Alloc(len + aHdrReserve, 0, KMaxTInt);
+        err = iNext ? KErrNone : KErrNoMBufs;      
+        }
+    else
+        {
+        RMBufAllocator allocator;
+        err = newChain.Alloc(aLen + aHdrReserve, allocator);  
+        }
+	
 	if(err != KErrNone)
 		{
 		return err;
@@ -532,10 +548,10 @@
 @param newChain The result chain
 */
 	{
-	User::LeaveIfError(RCommsBufChain::Split(anOffset, newChain));
+	User::LeaveIfError(Split(anOffset, newChain));
 	}
 
-EXPORT_C TInt RMBufChain::Split(TInt anOffset, RMBufChain& newChain)
+EXPORT_C TInt RMBufChain::Split(TInt aOffset, RMBufChain& aNewChain)
 /** 	  	 
 Split a chain into two new chains Original chain gets the 1st half 	  	 
 newChain gets the other half. 	  	 
@@ -544,8 +560,63 @@
 @param newChain The result chain 	  	 
 */
 	{
-	return RCommsBufChain::Split(anOffset, newChain);		
-	}
+    // RCommsBuf::Split() will not allocate a smaller buffer size than the current, as part of its approach of (trying to)
+    // support zero-copy transfer by respecting the buffer pool in use. This work is incomplete (needs support throughout
+    // the stack and probably a cleverer idea of what constitutes an acceptable buffer than simply size), so in the meantime
+    // having MBufMgr reflect this behaviour by refusing to Split() a big buf into smaller bufs is unnecessarily purist.
+    // Hence the functionality is implemented directly here
+    
+    __ASSERT_ALWAYS(iNext!=NULL, CommsBuf::Panic(EMBuf_EmptyChain));
+    __ASSERT_ALWAYS(aOffset>=0, CommsBuf::Panic(EMBuf_NegativeOffset));
+    
+    // For testing post-conditions
+#ifdef _DEBUG
+    TInt origLen = Length();
+#endif
+    TInt splitBufOffset;
+    TInt splitBufRemainder;
+    RMBuf* splitBuf;
+    RMBuf* splitBufPrev;
+    
+    if(!Goto(aOffset, splitBuf, splitBufOffset, splitBufRemainder, splitBufPrev))
+        {
+        aNewChain.Init();
+        return KErrNone;
+        }
+    
+    if(splitBufOffset != splitBuf->Offset()) // Not on an mbuf boundary
+        {
+        // Copy tail of splitBuf out to a new chain (hopefully a single buf, but needn't be)
+        TInt splitDataOffset = splitBufOffset - splitBuf->Offset();
+        TInt err = RMBufChain(splitBuf).Copy(aNewChain, splitDataOffset, splitBufRemainder);
+        if(err != KErrNone)
+            {
+            return err;
+            }
+        splitBuf->AdjustDataEnd(-splitBufRemainder);
+        RMBufChain splitTail(splitBuf->Next());
+        aNewChain.Append(splitTail);
+        splitBuf->SetNext(NULL);
+        }
+    else
+        {
+        // Split cleaves chain between bufs
+        aNewChain = splitBuf;
+        if(splitBufPrev)
+            {
+            splitBufPrev->Unlink();
+            }
+        }
+    
+    // Check post-conditions
+#ifdef _DEBUG
+    TInt frag1Len = Length(); 
+    TInt frag2Len = aNewChain.Length();
+    ASSERT(origLen == frag1Len + frag2Len);
+    ASSERT(frag1Len == aOffset);
+#endif
+    return KErrNone;
+	}           
 
 // overloading for TLS
 EXPORT_C TInt RMBufChain::Split(TInt anOffset, RMBufChain& newChain, RMBufAllocator& /* aRMBufAllocator */)
--- a/commsfwutils/commsbufs/src/commsbufasyncrequest.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/commsfwutils/commsbufs/src/commsbufasyncrequest.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -76,7 +76,8 @@
 @param  aAllocator      The handle to the allocator
 */
     {
-    iAsyncReqImpl->Alloc(aChain, aSize, aMinSize, aMaxSize, aStatus);
+    __ASSERT_ALWAYS(iAsyncReqImpl != NULL, CommsBuf::Panic(EMBuf_InvalidAsyncReqImpl));
+	iAsyncReqImpl->Alloc(aChain, aSize, aMinSize, aMaxSize, aStatus);
     }
 
 
@@ -85,7 +86,10 @@
 Cancel the asynchronous request
 */
 	{
-	iAsyncReqImpl->Cancel();
+	if (iAsyncReqImpl)
+		{
+		iAsyncReqImpl->Cancel();
+		}
 	}
 
 EXPORT_C void RCommsBufAsyncRequest::Complete(TInt aCode)
@@ -95,5 +99,6 @@
 @param	aCode	The request completion code
 */
 	{
+	__ASSERT_ALWAYS(iAsyncReqImpl != NULL, CommsBuf::Panic(EMBuf_InvalidAsyncReqImpl));
 	iAsyncReqImpl->Complete(aCode);
 	}
--- a/commsinfrastructureapitest/commsinfrastructuresvs/group/commsinfrastructuresvs.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsinfrastructureapitest/commsinfrastructuresvs/group/commsinfrastructuresvs.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	commsinfrastructuresvs
 source	\sf\os\commsfw\commsinfrastructureapitest\commsinfrastructuresvs
 notes_source	\sf\os\commsfw\commsinfrastructureapitest\commsinfrastructuresvs\group\release.txt
--- a/commsprocess/commsrootserverconfig/group/comms-infras_rootserver-config.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsprocess/commsrootserverconfig/group/comms-infras_rootserver-config.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_rootserver-config
 
 # configuration files disowned from rootserver. Now owned by this MRP file.
--- a/commsprocess/commsrootserverconfig/group/comms-infras_rootserver.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/commsprocess/commsrootserverconfig/group/comms-infras_rootserver.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_rootserver
 source	\sf\os\commsfw\commsprocess\commsrootserverconfig\bmarm
 source	\sf\os\commsfw\commsprocess\commsrootserverconfig\bwins
--- a/datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF	Fri Jun 11 14:52:21 2010 +0300
@@ -193,7 +193,7 @@
 	?TransitionTag@TAddClientOrUpdatePriority@CControlClientJoinActivity@CprControlClientJoinActivity@@UAEHXZ @ 192 NONAME ; int CprControlClientJoinActivity::CControlClientJoinActivity::TAddClientOrUpdatePriority::TransitionTag(void)
 	?DoL@TSendLeaveCompleteIfRequest@CClientLeaveActivity@CprClientLeaveActivity@@UAEXXZ @ 193 NONAME ; void CprClientLeaveActivity::CClientLeaveActivity::TSendLeaveCompleteIfRequest::DoL(void)
 	?DoL@TAddControlClient@CprStates@@UAEXXZ @ 194 NONAME ; void CprStates::TAddControlClient::DoL(void)
-	?NewL@CClientLeaveActivity@CprClientLeaveActivity@@SAPAVCNodeActivityBase@MeshMachine@@ABUTNodeActivity@4@AAVAMMNodeBase@4@@Z @ 195 NONAME ; class MeshMachine::CNodeActivityBase * CprClientLeaveActivity::CClientLeaveActivity::NewL(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase &)
+	?New@CClientLeaveActivity@CprClientLeaveActivity@@SAPAVCNodeActivityBase@MeshMachine@@ABUTNodeActivity@4@AAVTNodeContextBase@4@@Z @ 195  NONAME ; class MeshMachine::CNodeActivityBase * CprClientLeaveActivity::CClientLeaveActivity::New(struct MeshMachine::TNodeActivity const &, class MeshMachine::TNodeContextBase &)
 	??1CControlClientJoinActivity@CprControlClientJoinActivity@@UAE@XZ @ 196 NONAME ; CprControlClientJoinActivity::CControlClientJoinActivity::~CControlClientJoinActivity(void)
 	?GetVTablePtr@TProcessDataClientRejoin@MCprStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 197 NONAME ; class NetStateMachine::MStateTransition * MCprStates::TProcessDataClientRejoin::GetVTablePtr(class TDesC8 &, void *)
 	??0CContentionManager@@QAE@ABVCTierManagerBase@ESock@@@Z @ 198 NONAME ; CContentionManager::CContentionManager(class ESock::CTierManagerBase const &)
--- a/datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF	Fri Jun 11 14:52:21 2010 +0300
@@ -413,7 +413,7 @@
 	_ZN22CprClientLeaveActivity20CClientLeaveActivity21TSaveLeaveMessageData3DoLEv @ 412 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivity27TSendLeaveCompleteIfRequest12GetVTablePtrER6TDesC8Pv @ 413 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivity27TSendLeaveCompleteIfRequest3DoLEv @ 414 NONAME
-	_ZN22CprClientLeaveActivity20CClientLeaveActivity4NewLERKN11MeshMachine13TNodeActivityERNS1_11AMMNodeBaseE @ 415 NONAME
+	_ZN22CprClientLeaveActivity20CClientLeaveActivity3NewERKN11MeshMachine13TNodeActivityERNS1_16TNodeContextBaseE @ 415 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivityD0Ev @ 416 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivityD1Ev @ 417 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivityD2Ev @ 418 NONAME
--- a/datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h	Fri Jun 11 14:52:21 2010 +0300
@@ -165,7 +165,7 @@
 class CClientLeaveActivity : public CprPriorityUpdateActivity::CPriorityUpdateActivity
 	{
 public:
-	IMPORT_C static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+	IMPORT_C static MeshMachine::CNodeActivityBase* New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::TNodeContextBase& aContext);
 	IMPORT_C virtual ~CClientLeaveActivity();
 
 public:
--- a/datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -43,7 +43,16 @@
 using namespace MeshMachine;
 using namespace Messages;
 
-
+//-=========================================================
+//
+//Panics
+//
+//-=========================================================
+_LIT (KCoreCPRActivityPanic,"CoreCPRActivityPanic");
+enum
+	{
+	EPanicNoPrealloc = 1
+	};
 
 //-=========================================================
 //
@@ -202,8 +211,8 @@
 
 namespace CprClientLeaveActivity
 {
-DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityClientLeave, CprClientLeave, TNodeSignal::TNullMessageId, CClientLeaveActivity::NewL)
-	FIRST_NODEACTIVITY_ENTRY(CoreStates::TAwaitingClientLeave, MeshMachine::TNoTag)
+DECLARE_DEFINE_RESERVED_CUSTOM_NODEACTIVITY(ECFActivityClientLeave, CprClientLeave, TCFServiceProvider::TLeaveRequest, CClientLeaveActivity::New)
+	FIRST_NODEACTIVITY_ENTRY(MeshMachine::TAwaitingMessageState<TCFServiceProvider::TLeaveRequest>, MeshMachine::TNoTag)
 	THROUGH_NODEACTIVITY_ENTRY(KNoTag, CClientLeaveActivity::TRemoveClientAndDestroyOrphanedDataClients, CClientLeaveActivity::TNoTagOrSendPriorityToCtrlProvider)
 	NODEACTIVITY_ENTRY(CprStates::KSendPriorityToCtrlProvider, CClientLeaveActivity::TUpdatePriorityForControlProvider, CoreStates::TAwaitingJoinComplete, CClientLeaveActivity::TNoTagOrSendPriorityToServProvider)
 	NODEACTIVITY_ENTRY(CprStates::KSendPriorityToServProvider, CClientLeaveActivity::TUpdatePriorityForServiceProviders, CoreStates::TAwaitingJoinComplete, MeshMachine::TNoTag)
@@ -286,10 +295,16 @@
 
 namespace CprClientLeaveActivity
 {
-EXPORT_C MeshMachine::CNodeActivityBase* CClientLeaveActivity::NewL(  const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode )
+EXPORT_C MeshMachine::CNodeActivityBase* CClientLeaveActivity::New(  const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::TNodeContextBase& aContext )
 	{
-	TUint c = GetNextActivityCountL(aActivitySig,aNode);
-	return new(ELeave)CClientLeaveActivity(aActivitySig, aNode, c);
+	TUint c = GetNextActivityCount(aActivitySig,aContext.Node());
+	
+	// Instantiate using memory preallocated and stored in the RCFNodeInterface
+	TAny* preallocatedSpace = aContext.iPeer->ClaimPreallocatedSpace(sizeof(CClientLeaveActivity));
+	__ASSERT_ALWAYS(preallocatedSpace != NULL,User::Panic(KCoreCPRActivityPanic,EPanicNoPrealloc));
+
+	CClientLeaveActivity* self = new(preallocatedSpace)CClientLeaveActivity(aActivitySig, aContext.Node(), c);
+	return self;
 	}
 
 CClientLeaveActivity::CClientLeaveActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode, TUint aActivitiesCount)
--- a/datacommsserver/esockserver/CoreProviders/src/corescpr.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/src/corescpr.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+ // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -41,9 +41,9 @@
 
 //We reserve space for two preallocated activities that may start concurrently on the SCPR
 //node: destroy and data client stop.
-static const TUint KDefaultMaxPreallocatedActivityCount = 2;
+static const TUint KSCPRDefaultMaxPreallocatedActivityCount = 2;
 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KSCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
+static const TUint KSCPRPreallocatedActivityBufferSize = KSCPRDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
 
 EXPORT_C CCoreSubConnectionProvider::CCoreSubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory,
                                                                 const MeshMachine::TNodeActivityMap& aActivityMap)
--- a/datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def	Fri Jun 11 14:52:21 2010 +0300
@@ -52,15 +52,14 @@
 	_ZThn140_N27CMobilityConnectionProviderD0Ev @ 51 NONAME ABSENT
 	_ZThn140_N27CMobilityConnectionProviderD1Ev @ 52 NONAME ABSENT
 	_ZThn20_N27CMobilityConnectionProvider9ReceivedLERKN8Messages13TRuntimeCtxIdERKNS0_7TNodeIdERNS0_14TSignatureBaseE @ 53 NONAME
-	_ZThn152_N27CMobilityConnectionProvider18CancelSubscriptionEj @ 54 NONAME
-	_ZThn152_N27CMobilityConnectionProvider18NewCarrierAcceptedEj @ 55 NONAME
-	_ZThn152_N27CMobilityConnectionProvider18NewCarrierRejectedEj @ 56 NONAME
-	_ZThn152_N27CMobilityConnectionProvider19SubscribeForMessageEjP21CCommsMobilitySrvResp @ 57 NONAME
-	_ZThn152_N27CMobilityConnectionProvider22IgnorePreferredCarrierEj @ 58 NONAME
-	_ZThn152_N27CMobilityConnectionProvider22OpenExtensionInterfaceEjRKN8Messages13TRuntimeCtxIdEPN5ESock21CCommsApiExtResponderE @ 59 NONAME
-	_ZThn152_N27CMobilityConnectionProvider23CloseExtensionInterfaceEj @ 60 NONAME
-	_ZThn152_N27CMobilityConnectionProvider25MigrateToPreferredCarrierEj @ 61 NONAME
-	_ZThn152_N27CMobilityConnectionProviderD0Ev @ 62 NONAME
-	_ZThn152_N27CMobilityConnectionProviderD1Ev @ 63 NONAME
+	_ZThn156_N27CMobilityConnectionProvider18CancelSubscriptionEj @ 54 NONAME
+	_ZThn156_N27CMobilityConnectionProvider18NewCarrierAcceptedEj @ 55 NONAME
+	_ZThn156_N27CMobilityConnectionProvider18NewCarrierRejectedEj @ 56 NONAME
+	_ZThn156_N27CMobilityConnectionProvider19SubscribeForMessageEjP21CCommsMobilitySrvResp @ 57 NONAME
+	_ZThn156_N27CMobilityConnectionProvider22IgnorePreferredCarrierEj @ 58 NONAME
+	_ZThn156_N27CMobilityConnectionProvider22OpenExtensionInterfaceEjRKN8Messages13TRuntimeCtxIdEPN5ESock21CCommsApiExtResponderE @ 59 NONAME
+	_ZThn156_N27CMobilityConnectionProvider23CloseExtensionInterfaceEj @ 60 NONAME
+	_ZThn156_N27CMobilityConnectionProvider25MigrateToPreferredCarrierEj @ 61 NONAME
+	_ZThn156_N27CMobilityConnectionProviderD0Ev @ 62 NONAME
+	_ZThn156_N27CMobilityConnectionProviderD1Ev @ 63 NONAME
 
-
--- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -48,9 +48,9 @@
 
 //We reserve space for two preallocated activities that may start concurrently on the CPR
 //node: destroy and data client stop.
-static const TUint KDefaultMaxPreallocatedActivityCount = 2;
+static const TUint KMobilityCPRDefaultMaxPreallocatedActivityCount = 2;
 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KMobilityCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
+static const TUint KMobilityCPRPreallocatedActivityBufferSize = KMobilityCPRDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
 
 //-=========================================================
 //
--- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -179,7 +179,7 @@
 	__ASSERT_DEBUG(cp, User::Panic(KSpecAssert_ESockMbCrCPRAct, 4)); //We are a Cpr, must exist.
 
 	//PostedTo() could be our service provider or possibly other peer
-	if (PostedToId() != cp->RecipientId())
+	if (PostedToPeer() != cp)
 		{
 		cp->PostMessage(TNodeCtxId(ActivityId(), iNode.Id()),
 			TEBase::TCancel().CRef());
@@ -197,7 +197,8 @@
 		TErrResponse& resp = message_cast<TEErrorRecovery::TErrorRecoveryResponse>(iContext.iMessage).iErrResponse;
 		if (resp.iAction == TErrResponse::ERetry)
 			{
-		    return KNoTag | NetStateMachine::EBackward;
+			iContext.Activity()->SetError(KErrNone);
+      		return KNoTag | NetStateMachine::EBackward;
 			}
 		else if  (resp.iAction == TErrResponse::EPropagate || resp.iError == KErrCancel)
 			{
--- a/datacommsserver/esockserver/bwins/esocksvrU.DEF	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/bwins/esocksvrU.DEF	Fri Jun 11 14:52:21 2010 +0300
@@ -472,7 +472,7 @@
 	?DoL@TSendBindTo@CoreNetStates@@UAEXXZ @ 471 NONAME ; void CoreNetStates::TSendBindTo::DoL(void)
 	?DoL@TSendBindToComplete@ABindingActivity@CoreActivities@@UAEXXZ @ 472 NONAME ; void CoreActivities::ABindingActivity::TSendBindToComplete::DoL(void)
 	?DoL@TSendBindToComplete@CoreNetStates@@UAEXXZ @ 473 NONAME ; void CoreNetStates::TSendBindToComplete::DoL(void)
-	?DoL@TSendBindToCompleteIfExpected@ABindingActivity@CoreActivities@@UAEXXZ @ 474 NONAME ABSENT; void CoreActivities::ABindingActivity::TSendBindToCompleteIfExpected::DoL(void)
+	?DoL@TSendBindToCompleteIfExpected@ABindingActivity@CoreActivities@@UAEXXZ @ 474 NONAME ABSENT ; void CoreActivities::ABindingActivity::TSendBindToCompleteIfExpected::DoL(void)
 	?DoL@TSendBinderResponse@CCommsBinderActivity@PRActivities@@UAEXXZ @ 475 NONAME ; void PRActivities::CCommsBinderActivity::TSendBinderResponse::DoL(void)
 	?DoL@TSendClientLeavingAndRemoveControlProvider@CoreNetStates@@UAEXXZ @ 476 NONAME ; void CoreNetStates::TSendClientLeavingAndRemoveControlProvider::DoL(void)
 	?DoL@TSendClientLeavingAndRemoveControlProviderIfNoServiceProviders@CoreNetStates@@UAEXXZ @ 477 NONAME ; void CoreNetStates::TSendClientLeavingAndRemoveControlProviderIfNoServiceProviders::DoL(void)
@@ -808,7 +808,7 @@
 	?GetVTablePtr@TSendBindToComplete@ABindingActivity@CoreActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 807 NONAME ; class NetStateMachine::MStateTransition * CoreActivities::ABindingActivity::TSendBindToComplete::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendBindToComplete@CBindToActivity@PRActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 808 NONAME ; class NetStateMachine::MStateTransition * PRActivities::CBindToActivity::TSendBindToComplete::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendBindToComplete@CoreNetStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 809 NONAME ; class NetStateMachine::MStateTransition * CoreNetStates::TSendBindToComplete::GetVTablePtr(class TDesC8 &, void *)
-	?GetVTablePtr@TSendBindToCompleteIfExpected@ABindingActivity@CoreActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 810 NONAME ABSENT; class NetStateMachine::MStateTransition * CoreActivities::ABindingActivity::TSendBindToCompleteIfExpected::GetVTablePtr(class TDesC8 &, void *)
+	?GetVTablePtr@TSendBindToCompleteIfExpected@ABindingActivity@CoreActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 810 NONAME ABSENT ; class NetStateMachine::MStateTransition * CoreActivities::ABindingActivity::TSendBindToCompleteIfExpected::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendBinderResponse@CCommsBinderActivity@PRActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 811 NONAME ; class NetStateMachine::MStateTransition * PRActivities::CCommsBinderActivity::TSendBinderResponse::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendClientLeavingAndRemoveControlProvider@CoreNetStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 812 NONAME ; class NetStateMachine::MStateTransition * CoreNetStates::TSendClientLeavingAndRemoveControlProvider::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendClientLeavingAndRemoveControlProviderIfNoServiceProviders@CoreNetStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 813 NONAME ; class NetStateMachine::MStateTransition * CoreNetStates::TSendClientLeavingAndRemoveControlProviderIfNoServiceProviders::GetVTablePtr(class TDesC8 &, void *)
@@ -903,7 +903,7 @@
 	?TransitionTag@TBearerPresent@CoreNetStates@@UAEHXZ @ 902 NONAME ; int CoreNetStates::TBearerPresent::TransitionTag(void)
 	?TransitionTag@TBearerReady@CoreNetStates@@UAEHXZ @ 903 NONAME ABSENT ; int CoreNetStates::TBearerReady::TransitionTag(void)
 	?TransitionTag@TDataClientPresent@CoreNetStates@@UAEHXZ @ 904 NONAME ABSENT ; int CoreNetStates::TDataClientPresent::TransitionTag(void)
-	?TransitionTag@TLayerCompleted@CoreNetStates@@UAEHXZ @ 905 NONAME ABSENT ; int CoreNetStates::TLayerCompleted::TransitionTag(void)
+	?Cancel@CCommsBinderActivity@PRActivities@@UAEXAAVTNodeContextBase@MeshMachine@@@Z @ 905 NONAME ; void PRActivities::CCommsBinderActivity::Cancel(class MeshMachine::TNodeContextBase &)
 	?TransitionTag@TNoTagBackwardsOrProviderStopped@CoreNetStates@@UAEHXZ @ 906 NONAME ; int CoreNetStates::TNoTagBackwardsOrProviderStopped::TransitionTag(void)
 	?TransitionTag@TNoTagOrBearerPresent@CNoBearer@PRActivities@@UAEHXZ @ 907 NONAME ; int PRActivities::CNoBearer::TNoTagOrBearerPresent::TransitionTag(void)
 	?FetchNodeInterfaceControlL@CTierManagerBase@ESock@@MAEPAVTInterfaceControl@NetInterfaces@@H@Z @ 908 NONAME ; class NetInterfaces::TInterfaceControl * ESock::CTierManagerBase::FetchNodeInterfaceControlL(int)
@@ -1053,4 +1053,5 @@
 	??0TTierTypeIdFactoryQuery@ESock@@QAE@XZ @ 1052 NONAME ; ESock::TTierTypeIdFactoryQuery::TTierTypeIdFactoryQuery(void)
 	?Match@TTierTypeIdFactoryQuery@ESock@@MAE?AW4TMatchResult@MFactoryQuery@Factories@@AAUTFactoryObjectInfo@5@@Z @ 1053 NONAME ; enum Factories::MFactoryQuery::TMatchResult ESock::TTierTypeIdFactoryQuery::Match(struct Factories::TFactoryObjectInfo &)
 	?GetVDataTableStatic@TTierTypeIdFactoryQuery@ESock@@SAPBUSVDataTableEntry@Meta@@XZ @ 1054 NONAME ; struct Meta::SVDataTableEntry const * ESock::TTierTypeIdFactoryQuery::GetVDataTableStatic(void)
+	?AddClientL@CMMCommsProviderBase@ESock@@UAEPAVRNodeInterface@Messages@@ABVTNodeId@4@ABVTClientType@4@PAX@Z @ 1055 NONAME ; class Messages::RNodeInterface * ESock::CMMCommsProviderBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *)
 
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -1604,12 +1604,20 @@
 // CommsBinderActivity and CCommsBinderCombiningActivity.
 //
 //-=========================================================
-
+// When I node need to create the data client, this mutex block if the dataclient is leaving.
+// A scenario can arise when a connection is being started, stopped and started again in succession.
+// the stop might interfere with the second start and ccause the second start to fail.
+// this mutex will ensure that the leaving DC is completely destroyed, and then the second start is continued
+// - when any of the data clients is being destroyed 
+// - when a non-leaving data client is present or the activity is already running
+//
 EXPORT_C TBool CCommsBinderActivity::TDataClientMutex::IsBlocked(MeshMachine::TNodeContextBase& aContext)
   	{
   	TInt c = aContext.Node().CountActivities(aContext.iNodeActivity->ActivitySigId());
   	__ASSERT_DEBUG(c>0, User::Panic(KSpecAssert_ESockCrStaCPRAC, 17)); //Diagnostic
-  	if (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext))
+    TInt numOfLeavingDataClients = aContext.Node().CountClients<TDefaultClientMatchPolicy>(
+                                   /*include*/TClientType(TCFClientType::EData, TCFClientType::ELeaving));
+  	if (numOfLeavingDataClients == 0 && (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext)))
   		{
   		return EFalse;
   		}
@@ -1620,7 +1628,9 @@
   	{
   	TInt c = aContext.Node().CountActivities(aContext.iNodeActivity->ActivitySigId());
   	__ASSERT_DEBUG(c>0, User::Panic(KSpecAssert_ESockCrStaCPRAC, 18)); //Diagnostic
-  	if (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext, TCFClientType::EDefault))
+    TInt numOfLeavingDataClients = aContext.Node().CountClients<TDefaultClientMatchPolicy>(
+                                   /*include*/TClientType(TCFClientType::EData, TCFClientType::ELeaving));
+  	if (numOfLeavingDataClients == 0 && (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext, TCFClientType::EDefault)))
   		{
   		return EFalse;
   		}
@@ -1701,6 +1711,28 @@
 	iPendingBinder->SetFlags(TCFClientType::EActivating);
     }
 
+
+EXPORT_C void CCommsBinderActivity::Cancel(TNodeContextBase& aContext)
+    {
+    if (iPendingBinder)
+        {
+        //iPendingBinder is set when CCommsBinderActivity decides which of its dataclients it 
+        //wishes to send along with its TCommsBinderResponse and promptly (on the same stack) as
+        //this response is sent. After TCommsBinderResponse, the error handling of CCommsBinderActivity
+        //changes in that it should not flag any errors back to the recpient of TCommsBinderResponse.
+        //Such response may be when:
+        //(1) the recipient responds to TCommsBinderResponse with TError - the activity is finished, the recipients doesn't wait for anything (certainly not for an error)
+        //(2) the recipients explicitly cancels (or implicitly cancells by leaving the local node) - the activity is finished, the recipient doesn't wait for anything (certainly not for an error) 
+        SetError(KErrNone);
+        BindToComplete();
+        SetIdle();
+        }
+    else
+        {
+        CNodeRetryParallelActivity::Cancel(aContext);
+        }
+    }
+
 void CCommsBinderActivity::BindToComplete()
     {
     __ASSERT_DEBUG(iPendingBinder, User::Panic(KSpecAssert_ESockCrStaCPRAC, 23));
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.h	Fri Jun 11 14:52:21 2010 +0300
@@ -685,6 +685,8 @@
 public:
     static const TInt KInterfaceId = 0x102864DE;
 
+    IMPORT_C virtual void Cancel(MeshMachine::TNodeContextBase& aContext);    
+
 	IMPORT_C static Messages::RNodeInterface* IsDataClientPresent(MeshMachine::TNodeContextBase& aContext, TUint aClientFlags = 0);
 
     IMPORT_C void StoreBinder(Messages::RNodeInterface* aDataClient);
--- a/datacommsserver/esockserver/core_states/ss_coreprstates.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_coreprstates.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -1333,28 +1333,42 @@
 
 EXPORT_DEFINE_SMELEMENT(TAwaitingStarted, NetStateMachine::MState, CoreNetStates::TContext)
 EXPORT_C TBool TAwaitingStarted::Accept()
-	{
+    {
     if (iContext.iMessage.IsMessage<TCFServiceProvider::TStarted>())
         {
-	    if (iContext.iPeer)
-	        {
-			iContext.iPeer->ClearFlags(TCFClientType::EStarting);
-	        iContext.iPeer->SetFlags(TCFClientType::EStarted);
-	        }
-	    return ETrue;
+        if (iContext.iPeer)
+            {
+            iContext.iPeer->ClearFlags(TCFClientType::EStarting);
+            iContext.iPeer->SetFlags(TCFClientType::EStarted);
+            }
+        if (iContext.iNodeActivity)
+            {//The node has responded. Core providers doesn't support the notion of multiple service providers,
+             //therefore this code has been written to expect that TCFServiceProvider::TStart would only ever be
+             //sent to one service provider as a simple request<>response handshake. The client has now responded
+             //and its job is now done. ClearPostedTo so that TCancels aren't forwarded.
+            iContext.iNodeActivity->ClearPostedTo();
+            }
+        return ETrue;
         }
 
-	//If this is TError, clean the EStarting flag but do not accept, clean or otherwise process
-	if (iContext.iMessage.IsMessage<TEBase::TError>())
-    	{
-	    if (iContext.iPeer)
-	        {
-	        iContext.iPeer->ClearFlags(TCFClientType::EStarting);
-	        }
-    	}
+    //If this is TError, clean the EStarting flag but do not accept, clean or otherwise process
+    if (iContext.iMessage.IsMessage<TEBase::TError>())
+        {
+        if (iContext.iPeer)
+            {
+            iContext.iPeer->ClearFlags(TCFClientType::EStarting);
+            }
+        if (iContext.iNodeActivity)
+            {//The node has responded. Core providers doesn't support the notion of multiple service providers,
+             //therefore this code has been written to expect that TCFServiceProvider::TStart would only ever be
+             //sent to one service provider as a simple request<>response handshake. The client has now responded
+             //and its job is now done. ClearPostedTo so that TCancels aren't forwarded.
+            iContext.iNodeActivity->ClearPostedTo();
+            }
+        }
 
-	return EFalse;
-	}
+    return EFalse;
+    }
 
 EXPORT_DEFINE_SMELEMENT(TSendBindToComplete, NetStateMachine::MStateTransition, CoreNetStates::TContext)
 EXPORT_C void TSendBindToComplete::DoL()
@@ -1891,7 +1905,16 @@
 EXPORT_DEFINE_SMELEMENT(TForwardStateChange, NetStateMachine::MStateTransition, PRStates::TContext)
 EXPORT_C void TForwardStateChange::DoL()
 	{
-	//Forward to control clients if there are any
+    //In some cirumstances a node can have more than one TCFClientType::EServProvider peer (for instance MCPRs can have more than one potential service provider), 
+    //but within the coreprovider code there is no concept of multiple service providers per-se. There is only one service provider and it is the TCFClientType::EServProvider 
+    //with TCFClientType::EActive flag set. If a progress comes from a TCFClientType::EServProvider that is not a service provider, the progress will be ignored here.
+
+    if (iContext.iPeer && 
+        iContext.iPeer->Type() == TCFClientType::EServProvider && 
+        !(iContext.iPeer->Flags() & TCFClientType::EActive) )
+        {
+        return;
+        }
 	TInt ctrlClientCount = iContext.Node().PostToClients<TDefaultClientMatchPolicy>(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.iMessage, TClientType(TCFClientType::ECtrl));
 	if (0==ctrlClientCount)
 		{ //If there are no control clients any more, forward to the control provider
--- a/datacommsserver/esockserver/eabi/esocksvrU.DEF	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/eabi/esocksvrU.DEF	Fri Jun 11 14:52:21 2010 +0300
@@ -1031,7 +1031,7 @@
 	_ZN5ESock25RCFParameterFamilyBundleC4OpenEv @ 1030 NONAME
 	_ZN17CConnDataTransfer31DataReceivedNotificationRequestEjj @ 1031 NONAME
 	_ZThn20_N5ESock22CSubConnectionFlowBase26FetchNodeInterfaceControlLEi @ 1032 NONAME
-	_ZThn136_NK5ESock20CMMCommsProviderBase20GetAccessPointConfigEv @ 1033 NONAME
+	_ZThn140_NK5ESock20CMMCommsProviderBase20GetAccessPointConfigEv @ 1033 NONAME
 	_ZN5ESock30TDefaultConnectionFactoryQuery19GetVDataTableStaticEv @ 1034 NONAME
 	_ZN5ESock30TDefaultConnectionFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1035 NONAME
 	_ZN5ESock30TDefaultConnectionFactoryQueryC1ERKN8Messages7TNodeIdE @ 1036 NONAME
@@ -1712,7 +1712,7 @@
 	_ZN13CoreNetStates15TAwaitingBindTo6AcceptEv @ 1711 NONAME
 	_ZN13CoreNetStates15TLayerCompleted13TransitionTagEv @ 1712 NONAME ABSENT
 	_ZN13CoreNetStates18TAwaitingProvision6AcceptEv @ 1713 NONAME
-	_ZN13CoreNetStates18TDataClientPresent13TransitionTagEv @ 1714 NONAME ABSENT
+	_ZN12PRActivities20CCommsBinderActivity6CancelERN11MeshMachine16TNodeContextBaseE @ 1714 NONAME
 	_ZN13CoreNetStates21TNoTagOrNoDataClients13TransitionTagEv @ 1715 NONAME
 	_ZN13CoreNetStates25TNoTagOrDataClientPresent13TransitionTagEv @ 1716 NONAME
 	_ZN13CoreNetStates25TNoTagOrDataClientsToStop13TransitionTagEv @ 1717 NONAME
@@ -1959,4 +1959,6 @@
 	_ZTIN5ESock23TTierTypeIdFactoryQueryE @ 1958 NONAME
 	_ZTVN5ESock23TTierTypeIdFactoryQueryE @ 1959 NONAME
 	_ZThn4_N5ESock23TTierTypeIdFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1960 NONAME
+	_ZN5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1961 NONAME
+	_ZThn36_N5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1962 NONAME
 
--- a/datacommsserver/esockserver/group/comms-infras_esock-config.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/group/comms-infras_esock-config.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_esock-config
 
 # configuration files disowned from esock. Now owned by this MRP file.
--- a/datacommsserver/esockserver/group/comms-infras_esock.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/group/comms-infras_esock.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	comms-infras_esock
 
 source  \sf\os\commsfw\datacommsserver\esockserver\eabi
--- a/datacommsserver/esockserver/inc/ss_mmcommsprov.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_mmcommsprov.h	Fri Jun 11 14:52:21 2010 +0300
@@ -71,10 +71,13 @@
 	friend class IpCprStates::TSendParamsToSelf;
 	friend class IpCprStates::TUpdateNetMCPR;
 	friend class PRStates::TRespondWithRetrievedParams;
-
+	
 public:
 	typedef ITFHIERARCHY_LINK_1(CMMCommsProviderBase, MeshMachine::AMMNodeBase, MAccessPointConfigApi) TIfStaticFetcherNearestInHierarchy;
 	IMPORT_C void ReturnInterfacePtrL(MAccessPointConfigApi*& aInterface);
+
+	IMPORT_C virtual Messages::RNodeInterface* AddClientL(const Messages::TNodeId& aClientId, const Messages::TClientType& aClientType, TAny* aClientInfo = NULL);
+
 	void DestroyOrphanedDataClients();
 
 	IMPORT_C void SetParametersL(const RCFParameterFamilyBundleC& aParameterBundle);
--- a/datacommsserver/esockserver/ssock/ss_conn.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_conn.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -316,7 +316,7 @@
 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityGoneDown, ConnectionGoingDown, TCFControlClient::TGoneDown, PRActivities::CGoneDownActivity::NewL)
 	FIRST_NODEACTIVITY_ENTRY(ConnStates::TAwaitingGoneDown, MeshMachine::TNoTag)
 	THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnectionGoingDownActivity::TStoreGoneDownError, MeshMachine::TNoTag)
-	THROUGH_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TCancelAndCloseZone0ClientExtIfaces, MeshMachine::TNoTag)
+	THROUGH_NODEACTIVITY_ENTRY(KNoTag, SubSessStates::TCancelAndCloseClientExtIfaces, MeshMachine::TNoTag)
     THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TCancelAllLegacyRMessage2Activities, ConnStates::TNoTagBlockedByLegacyRMessage2Activities)
     THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionDownProgress, MeshMachine::TNoTag)
 	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendClientLeavingRequestToServiceProviders, MeshMachine::TAwaitingLeaveComplete, MeshMachine::TNoTag)
--- a/datacommsserver/esockserver/ssock/ss_connstates.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -259,7 +259,8 @@
 	__ASSERT_DEBUG(iContext.Node().ServiceProvider()==NULL, ConnPanic(KPanicExpectedNoServiceProvider));
 
 	TCFDataClient::TBindTo& bt = message_cast<TCFDataClient::TBindTo>(iContext.iMessage);
-    iContext.Node().AddClientL(bt.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EActive));
+    RNodeInterface* newSP = iContext.Node().AddClientL(bt.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EActive));
+    __ASSERT_DEBUG(iContext.Node().ServiceProvider()==newSP, ConnPanic(KPanicNoServiceProvider)); //[RZ] revise this, possibly overdefensive
 
     //If this is attach, we need to see if we are a monitor or not
     TClientType clientType(TCFClientType::ECtrl);
@@ -276,7 +277,7 @@
     	{
 		clientType.SetFlags(TCFClientType::EAttach);
     	}
-    iContext.iNodeActivity->PostRequestTo(bt.iNodeId,
+    iContext.iNodeActivity->PostRequestTo(*newSP,
     	TCFServiceProvider::TJoinRequest(iContext.NodeId(), clientType).CRef());
 	}
 
@@ -287,7 +288,7 @@
 	__ASSERT_DEBUG(iContext.iPeer == iContext.Node().ServiceProvider(), ConnPanic(KPanicExpectedNoServiceProvider));
 
 	TCFServiceProvider::TCommsBinderResponse& br = message_cast<TCFServiceProvider::TCommsBinderResponse>(iContext.iMessage);
-    iContext.Node().AddClientL(br.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EDefault));
+    RNodeInterface* scpr = iContext.Node().AddClientL(br.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EDefault));
 
     //If this is attach, we need to see if we are a monitor or not
     TCFClientType clientType(TCFClientType::ECtrl);
@@ -304,7 +305,7 @@
 		clientType.SetFlags(TCFClientType::EAttach);
     	}
 
-    iContext.iNodeActivity->PostRequestTo(br.iNodeId,
+    iContext.iNodeActivity->PostRequestTo(*scpr,
     	TCFServiceProvider::TJoinRequest(iContext.NodeId(), clientType).CRef());
 	}
 
@@ -315,10 +316,10 @@
 	__ASSERT_DEBUG(iContext.Node().ServiceProvider()==NULL, ConnPanic(KPanicExpectedNoServiceProvider));
 
 	TCFSelector::TSelectComplete& sc = message_cast<TCFSelector::TSelectComplete>(iContext.iMessage);
-	iContext.Node().AddClientL(sc.iNodeId,TClientType(TCFClientType::EServProvider, TCFClientType::EAvailabilityProvider));
+	RNodeInterface* mcpr = iContext.Node().AddClientL(sc.iNodeId,TClientType(TCFClientType::EServProvider, TCFClientType::EAvailabilityProvider));
 
 
-	iContext.iNodeActivity->PostRequestTo(sc.iNodeId,
+	iContext.iNodeActivity->PostRequestTo(*mcpr,
 		TCFServiceProvider::TJoinRequest(iContext.NodeId(), TCFClientType(TCFClientType::ECtrl)).CRef());
 	}
 
@@ -351,7 +352,8 @@
 
 	TCFServiceProvider::TCommsBinderResponse& br = message_cast<TCFServiceProvider::TCommsBinderResponse>(iContext.iMessage);
 
-	iContext.Node().AddClientL(br.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EActive));
+	RNodeInterface* sp = iContext.Node().AddClientL(br.iNodeId, TClientType(TCFClientType::EServProvider, TCFClientType::EActive));
+    __ASSERT_DEBUG(iContext.Node().ServiceProvider()==sp, ConnPanic(KPanicNoServiceProvider)); //[RZ] revise this, possibly overdefensive
 
 	//If this is attach, we need to see if we are a monitor or not
 	TCFClientType clientType;
@@ -368,7 +370,7 @@
 		clientType.SetFlags(TCFClientType::EAttach);
 		}
 	
-	iContext.iNodeActivity->PostRequestTo(br.iNodeId,
+	iContext.iNodeActivity->PostRequestTo(*sp,
 		TCFServiceProvider::TJoinRequest(iContext.NodeId(), clientType).CRef());
 	}
 
--- a/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -19,7 +19,8 @@
 
 #include "ss_mmcommsprov.h"
 #include <elements/nm_messages_child.h>
-#include <elements/mm_activities.h> 
+#include <elements/mm_activities.h>
+#include <comms-infras/corecpractivities.h> 
 #include "ss_nodemessages_internal.h"
 #include "ss_internal_activities.h"
 
@@ -32,6 +33,10 @@
 using namespace ESock;
 using namespace Messages;
 
+//We reserve space for two preallocated activities that may start concurrently on the connection
+//node: destroy (connection close) and connection stop.
+static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
+
 CMMCommsProviderBase::CMMCommsProviderBase(CCommsFactoryBase& aFactory,
                                     const MeshMachine::TNodeActivityMap& aActivityMap)
 :	ACommsFactoryNodeId(aFactory),
@@ -112,6 +117,23 @@
 	aInterface = this;
 	}
 
+EXPORT_C RNodeInterface* CMMCommsProviderBase::AddClientL(const Messages::TNodeId& aClientId, const Messages::TClientType& aClientType, TAny* aClientInfo)
+	{
+	RNodeInterface* nodeInterface = ANodeBase::AddClientL(aClientId, aClientType, aClientInfo);
+
+	if(aClientType.Type() == TCFClientType::ECtrl)
+		{
+		TRAPD(err, nodeInterface->PreAllocL(KMaxPreallocatedActivitySize));
+		if(err!=KErrNone)
+			{
+			RemoveClient(nodeInterface->RecipientId());
+			User::Leave(err);
+			}
+		}
+
+	return nodeInterface;
+	}
+
 void CMMCommsProviderBase::DestroyOrphanedDataClients()
 	{
     // Note: If PRDataClientStopActivity is running, it will call PRStates::TDestroyOrphanedDataClients
--- a/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -1369,6 +1369,17 @@
 	        {
             iHostResolverNotify->Error(KErrDisconnected);
 	        }
+	    else
+	    if (iFlowParams.iFlowRequestType == TFlowParams::EExplicitConnection)
+	        {
+            // Re-issue explicit host resolver requests here rather than later on in StartFlowL().  This is
+            // to accomodate the HotSpot server and Internet Connectivity Test (ICT).  The ICT hooks into the
+            // NetCfgExtensionBase mechanism, blocks the interface startup at 8400 and performs a host resolver
+            // request.  However, the TransportFlowShim will only receive StartFlowL() after the interface has
+            // fully come up, so chicken and egg.  Implicit host resolver requests must still be re-issued in
+            // StartFlowL().
+            iHostResolverNotify->StartSending();
+	        }
 	    }
 	}
 
@@ -1409,8 +1420,9 @@
 		SetStarted();
 		ClearStopped();
 
-        // A held-over resolution request will now work (if it ever will)
-        if (iHostResolverNotify)
+        // A held-over implicit resolution request will now work (if it ever will).
+		// Explicit host resolver requests have already been re-issued in BindToL().
+        if (iHostResolverNotify && (iFlowParams.iFlowRequestType != TFlowParams::EExplicitConnection))
 	        {
     	    iHostResolverNotify->StartSending();
 	        }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/TE_DummyProvider_ip.tcpip.esk	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,51 @@
+[sockman]
+protocols= tcp,udp,icmp,icmp6,ip,ip6,rawip,resolver,dummy
+
+[rawip]
+filename= tcpip6.prt
+bindto= ip6
+index= 8
+
+[icmp]
+filename= tcpip6.prt
+bindto= ip6
+index= 7
+
+[ip]
+filename= tcpip6.prt
+bindto= ip6,resolver
+index= 6
+
+[resolver]
+filename= tcpip6.prt
+index= 5
+
+[tcp]
+filename= tcpip6.prt
+bindto= ip6
+index= 4
+
+[udp]
+filename= tcpip6.prt
+bindto= ip6
+index= 3
+
+[icmp6]
+filename= tcpip6.prt
+bindto= ip6
+index= 2
+
+[ip6]
+filename= tcpip6.prt
+index= 1
+bindto= resolver
+
+[nifman]
+default= csd
+
+[interfaces]
+ppp= ppp.nif
+
+[dummy]
+flow_factory_uid= 271080847
+flow_protocol_id= 254
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_006.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,28 @@
+[CreateSockSvr1]
+SocketServName=SockSvr1
+
+[CreateConn1]
+ConnName=Conn1
+
+[ConnectSockSvr1]
+SocketServName=SockSvr1
+
+[OpenConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+ConnType=271069227
+
+[StartConn1]
+ConnName=Conn1
+SocketServName=SockSvr0
+SNAP=60
+
+[StopConn1]
+ConnName=Conn1
+ConnStopType=EStopNormal
+
+[CloseConn1]
+ConnName=Conn1
+
+[CloseSockSvr1]
+SocketServName=SockSvr1
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_008.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,28 @@
+[CreateSockSvr1]
+SocketServName=SockSvr1
+
+[CreateConn1]
+ConnName=Conn1
+
+[ConnectSockSvr1]
+SocketServName=SockSvr1
+
+[OpenConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+ConnType=271069227
+
+[StartConn1]
+ConnName=Conn1
+SocketServName=SockSvr0
+SNAP=70
+
+[StopConn1]
+ConnName=Conn1
+ConnStopType=EStopNormal
+
+[CloseConn1]
+ConnName=Conn1
+
+[CloseSockSvr1]
+SocketServName=SockSvr1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_009.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,47 @@
+[CreateSockSvr1]
+SocketServName=SockSvr1
+
+[CreateConn1]
+ConnName=Conn1
+
+[ConnectSockSvr1]
+SocketServName=SockSvr1
+
+[OpenConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+ConnType=271069227
+
+[StartConn1]
+ConnName=Conn1
+SocketServName=SockSvr0
+SNAP=10
+
+[CreateSocket]
+SocketName=Socket1
+
+[OpenSocket]
+SocketName=Socket1
+SocketServName=SockSvr1
+ConnName=Conn1
+Protocol=DummyProtocol
+ConnType=271069227
+
+[BindSocket]
+SocketName=Socket1
+SrcAddr=0.0.0.0
+SrcPort=0
+Protocol=DummyProtocol
+
+[StopConn1]
+ConnName=Conn1
+ConnStopType=EStopNormal
+
+[CloseSocket]
+SocketName=Socket1
+
+[CloseConn1]
+ConnName=Conn1
+
+[CloseSockSvr1]
+SocketServName=SockSvr1
\ No newline at end of file
--- a/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg	Fri Jun 11 14:52:21 2010 +0300
@@ -108,6 +108,63 @@
 	FIELD_COUNT=8
 END_ADD
 ## CASE005 END ##
+#############################################################
+## CASE006 BEGIN ##
+ADD_SECTION
+# COMMDB_ID = 7
+	Id=60
+	Name=DummyVanillaWithNextVanillaLayer
+	Tier=Link.TierTable.0x1028302B
+	MCpr=MCprTable.1
+	AccessPointSelectionPolicy=Link.APPrioritySelectionPolicyTable.4
+	Cpr=CprTable.2
+	SCpr=SCprTable.2
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 8
+	Id=61
+	Name=DummyVanillaWithNoNextLayer
+	Tier=Link.TierTable.0x1028302B
+	MCpr=MCprTable.1
+	Cpr=CprTable.2
+	SCpr=SCprTable.2
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=7
+END_ADD
+## CASE005 END ##
+
+##############################################################
+## CASE008 BEGIN ##
+ADD_SECTION
+# COMMDB_ID = 9
+	Id=70
+	Name=DummyAPHasNextLayer
+	Tier=Link.TierTable.0x1028302B
+	MCpr=MCprTable.1
+	AccessPointSelectionPolicy=Link.APPrioritySelectionPolicyTable.5
+	Cpr=CprTable.1
+	SCpr=SCprTable.1
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 10
+	Id=71
+	Name=DummyAPBottom
+	Tier=Link.TierTable.0x1028302B
+	MCpr=MCprTable.1
+	Cpr=CprTable.1
+	CprConfig=0x0010 #behavioural differentiator. See dummypr_metaconnprov.h. This cpr will arrest TDestroy for 3 sec 	
+	SCpr=SCprTable.1
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=8
+END_ADD
+## CASE008 END ##
+
 
 ############################################################
 ## APPrioritySelectionPolicyTable
@@ -115,7 +172,7 @@
 [APPrioritySelectionPolicyTable]
 ADD_SECTION
 # COMMDB_ID = 1
-    Id=1
+  Id=1
 	Name=SelectionPolicyCase001
 	AP1=Link.AccessPointTable.11
 	APCOUNT=1
@@ -124,7 +181,7 @@
 
 ADD_SECTION
 # COMMDB_ID = 2
-    Id=2
+  Id=2
 	Name=SelectionPolicyCase002
 	AP1=Link.AccessPointTable.21
 	APCOUNT=1
@@ -133,7 +190,7 @@
 
 ADD_SECTION
 # COMMDB_ID = 3
-    Id=3
+  Id=3
 	Name=SelectionPolicyCase003
 	AP1=Link.AccessPointTable.21
 	AP2=Link.AccessPointTable.11
@@ -141,6 +198,22 @@
 	FIELD_COUNT=5
 END_ADD
 
+ADD_SECTION
+# COMMDB_ID = 4
+  Id=4
+	Name=SelectionPolicyCase002
+	AP1=Link.AccessPointTable.61
+	APCOUNT=1
+	FIELD_COUNT=4
+END_ADD
+ADD_SECTION
+# COMMDB_ID = 5
+    Id=5
+	Name=SelectionPolicyCase004
+	AP1=Link.AccessPointTable.71
+	APCOUNT=1
+	FIELD_COUNT=4
+END_ADD
 
 ############################################################
 ## TierTable
@@ -173,6 +246,9 @@
 ############################################################
 ## CprTable
 ## 
+# The cpr below is:
+# The corecpr with some of its activities overriden in order to test the production code executed by the
+# peers of the cpr. See code.
 [CprTable]
 ADD_SECTION
 # COMMDB_ID = 1
@@ -181,10 +257,23 @@
 	FIELD_COUNT=2
 END_ADD
 
+# The cpr below is:
+# The corecpr with local test activities designed to test the production code on the local node. 
+# It is important than that the production code (to be tested) is unpolluted by the test code.
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=dummyvanillacpr
+	CprUid=0x10283030
+	FIELD_COUNT=2
+END_ADD
+
 ############################################################
 ## SCprTable
 ## 
 [SCprTable]
+# The scpr below is:
+# The corescpr with some of its activities overriden in order to test the production code executed by the
+# peers of the scpr. See code.
 ADD_SECTION
 # COMMDB_ID = 1
 	Name=dummyscpr
@@ -192,6 +281,16 @@
 	FIELD_COUNT=2
 END_ADD
 
+# The scpr below is:
+# The corescpr with local test activities designed to test the production code on the local node. 
+# It is important than that the production code (to be tested) is unpolluted by the test code.
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=dummyscprvanilla
+	SCprUid=0x10283031
+	FIELD_COUNT=2
+END_ADD
+
 ############################################################
 ## ProtocolTable
 ## 
--- a/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby	Fri Jun 11 14:52:21 2010 +0300
@@ -26,6 +26,8 @@
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_003.script TestData\scripts\te_dummyprovider_003.script
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_004.script TestData\scripts\te_dummyprovider_004.script
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_005.script TestData\scripts\te_dummyprovider_005.script
+data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_006.script TestData\scripts\te_dummyprovider_006.script
+data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_008.script TestData\scripts\te_dummyprovider_008.script
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_incomingSCPR.script TestData\scripts\te_dummyprovider_incomingSCPR.script
 
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyproviders.cfg TestData\configs\te_dummyproviders.cfg
@@ -34,6 +36,7 @@
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_003.ini TestData\configs\te_dummyprovider_003.ini
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_004.ini TestData\configs\te_dummyprovider_004.ini
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_005.ini TestData\configs\te_dummyprovider_005.ini
-
+data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_006.ini TestData\configs\te_dummyprovider_006.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_008.ini TestData\configs\te_dummyprovider_008.ini
 #endif // __TE_DummyProviders_IBY__
 
--- a/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf	Fri Jun 11 14:52:21 2010 +0300
@@ -27,6 +27,11 @@
 ../scripts/te_dummyprovider_003.script	z:/testdata/scripts/te_dummyprovider_003.script
 ../scripts/te_dummyprovider_004.script	z:/testdata/scripts/te_dummyprovider_004.script
 ../scripts/te_dummyprovider_005.script	z:/testdata/scripts/te_dummyprovider_005.script
+../scripts/te_dummyprovider_006.script	z:/testdata/scripts/te_dummyprovider_006.script
+../scripts/te_dummyprovider_009.script	z:/testdata/scripts/te_dummyprovider_009.script
+
+
+../scripts/te_dummyprovider_008.script	z:/testdata/scripts/te_dummyprovider_008.script
 
 ../scripts/te_dummyprovider_incomingSCPR.script	z:/testdata/scripts/te_dummyprovider_incomingscpr.script
 ../configs/te_dummyproviders.cfg	z:/testdata/configs/te_dummyproviders.cfg
@@ -35,4 +40,9 @@
 ../configs/te_dummyprovider_003.ini	z:/testdata/configs/te_dummyprovider_003.ini
 ../configs/te_dummyprovider_004.ini	z:/testdata/configs/te_dummyprovider_004.ini
 ../configs/te_dummyprovider_005.ini	z:/testdata/configs/te_dummyprovider_005.ini
+../configs/te_dummyprovider_006.ini	z:/testdata/configs/te_dummyprovider_006.ini
+../configs/te_dummyprovider_009.ini	z:/testdata/configs/te_dummyprovider_009.ini
+../configs/TE_DummyProvider_ip.tcpip.esk z:/testdata/configs/TE_DummyProvider_ip.tcpip.esk
 
+
+../configs/te_dummyprovider_008.ini	z:/testdata/configs/te_dummyprovider_008.ini
--- a/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script	Fri Jun 11 14:52:21 2010 +0300
@@ -31,6 +31,9 @@
 RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_003.script
 RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_004.script
 RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_005.script
+RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_006.script
+RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_008.script
+RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_009.script
 
 RUN_SCRIPT z:\testdata\scripts\te_esock_test_unloadesockForced.script
 RUN_SCRIPT z:\testdata\scripts\te_esock_test_remove_config_files.script
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_006.script	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,51 @@
+//
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+//
+
+PRINT Running CASE001
+PRINT Two dummy vanilla layers starting successfully. 
+PRINT vanilla layers will test progressive cancel on a number of activities
+
+//
+LOAD_SUITE te_esockteststepsSuite -SharedData
+RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script
+
+
+START_TESTCASE COMINF-ESOCK-DummyProviders-006
+//! @SYMTestCaseID COMINF-ESOCK-DummyProviders-006
+//! @SYMTestCaseDesc  Tests the resiliance of the TBindTo activity to progressive TCancel.
+//! @SYMTestActions   The app level starts an access point consisting of two dummy (corepr) layers. The layers (cpr and scpr) are modified to test the TBindTo activity using CancelTestBindToActivity
+//! @SYMTestExpectedResults    The access point is expected to start with success. The test case assumes the layers are armed (with CancelTestBindToActivity), but will do nothin to verify that progressive cancel took place.
+//! @SYMTestPriority  Critical 
+//! @SYMTestType CT
+//! @SYMComponent   comms-infras_esock
+
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_006.ini CreateSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_006.ini CreateConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_006.ini ConnectSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_006.ini OpenConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_006.ini StartConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_006.ini StopConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_006.ini CloseConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_006.ini CloseSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep
+END_TESTCASE COMINF-ESOCK-DummyProviders-006
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+
+PRINT Completed CASE001
+
+END_TESTCASE  COMINF-ESOCK-DummyProviders-006
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_008.script	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,47 @@
+//
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRINT Running CASE008
+PRINT Connection from application started, stopped and started again. The leaving CPR needs
+PRINT to be destroyed before a new one is created by MCPR. In order to simulate this scenario
+PRINT the lower later CPR arrests TDestroy for 3 sec. The stop completes and the second start resumes
+PRINT The CommsBinderRequest is parked at MCPR till the time CPR is leaving. The activity is unparked
+PRINT after CPR is destroyed a new one is created by MCPR. This results in only 1 dataclient to MCPR at a time 
+
+
+//
+LOAD_SUITE te_esockteststepsSuite -SharedData
+RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script
+
+START_TESTCASE			COMINF-ESOCK-DummyProviders-008
+//! @SYMTestCaseID		COMINF-ESOCK-DummyProviders-008
+
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_008.ini CreateSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_008.ini CreateConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_008.ini ConnectSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_008.ini OpenConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_008.ini StartConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_008.ini StopConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_008.ini StartConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_008.ini StopConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_008.ini CloseConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_008.ini CloseSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep
+END_TESTCASE COMINF-ESOCK-DummyProviders-008
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+
+PRINT Completed CASE008
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_009.script	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,63 @@
+//
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+//
+
+PRINT Running CASE009
+
+//
+LOAD_SUITE te_esockteststepsSuite -SharedData
+
+START_TESTCASE COMINF-ESOCK-DummyProviders-009
+//! @SYMTestCaseID COMINF-ESOCK-DummyProviders-009
+//! @SYMTestCaseDesc  
+//! @SYMTestActions   
+//! @SYMTestExpectedResults    
+//! @SYMTestPriority  
+//! @SYMTestType CT
+//! @SYMComponent   comms-infras_esock
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+RUN_UTILS CopyFile c:\private\101f7989\ESock\ip.tcpip.esk c:\private\101f7989\ESock\ip.tcpip.esk.te_RSubConnectionCase70.archive
+RUN_UTILS DeleteFile c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_UTILS CopyFile z:\testdata\configs\TE_DummyProvider_ip.tcpip.esk c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script
+
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_009.ini CreateSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_009.ini CreateConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_009.ini ConnectSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_009.ini OpenConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_009.ini StartConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketStep z:\testdata\configs\te_dummyprovider_009.ini CreateSocket
+RUN_TEST_STEP 100 te_esockteststepsSuite openrsocketStep z:\testdata\configs\te_dummyprovider_009.ini OpenSocket
+RUN_TEST_STEP 100 te_esockteststepsSuite bindrsocketStep z:\testdata\configs\te_dummyprovider_009.ini BindSocket
+RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_009.ini StopConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketStep z:\testdata\configs\te_dummyprovider_009.ini CloseSocket
+RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_009.ini CloseConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_009.ini CloseSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep
+END_TESTCASE COMINF-ESOCK-DummyProviders-009
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+
+RUN_UTILS MakeReadWrite c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_UTILS DeleteFile c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_UTILS CopyFile c:\private\101f7989\ESock\ip.tcpip.esk.te_RSubConnectionCase70.archive c:\private\101f7989\ESock\ip.tcpip.esk
+RUN_UTILS DeleteFile c:\private\101f7989\ESock\ip.tcpip.esk.te_RSubConnectionCase70.archive
+
+
+PRINT Completed CASE001
+
+END_TESTCASE  COMINF-ESOCK-DummyProviders-009
+
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h	Fri Jun 11 14:52:21 2010 +0300
@@ -105,6 +105,7 @@
 
     TUint iSocketType;
    	TUint iProtocol;
+   	TUint iAddrFamily;
 	TInt iPacketSize;
 	TInt iNrOfPackets;
    	TInetAddr iLocalIP;
@@ -482,7 +483,7 @@
     RSocket* FindSocket(const TDesC& aSocketName);
     TInt CreateSocket(const TDesC& aSocketName);
     TInt OpenSocket(const TRSocketParams& aParams);
-    TInt BindSocket(const TRSocketParams& aParams);
+    TInt BindSocket(TRSocketParams& aParams);
     TInt ConnectSocket(TRSocketParams& aParams, TRequestStatus& aRequestStatus);
     TInt CancelConnectSocket(const TRSocketParams& aParams);
     void SendAndReceiveDataL(const TRSocketParams& aParams);
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Sockets.TestSteps.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Sockets.TestSteps.h	Fri Jun 11 14:52:21 2010 +0300
@@ -25,7 +25,7 @@
 
 #include <test/testexecutestepbase.h>
 #include "Te_EsockStepBase.h"
-
+#include "Connections.TestSteps.h"
 
 // General constants
 //------------------
@@ -34,6 +34,9 @@
 _LIT(KTe_ProtocolName,"ProtocolName");
 _LIT(KTe_SourceAddressName,"SrcAddr");
 _LIT(KTe_SourcePortName,"SrcPort");
+_LIT(KTe_SocketType,"SocketType");
+_LIT(KTe_SocketDatagram,"SockDatagram");
+_LIT(KTe_SocketStream,"SockStream");
 _LIT(KTe_DestinationAddressName,"DstAddr");
 _LIT(KTe_DestinationPortName,"DstPort");
 _LIT(KTe_PacketSizeName,"PacketSize");
@@ -55,9 +58,12 @@
 // Protocol types
 _LIT(KTe_TCPName,"TCP");
 _LIT(KTe_UDPName,"UDP");
-_LIT(KDummyProtocolName,"Dummy");
+_LIT(KTe_DummyNetworkProtocolName,"DummyNetworkProtocol");
+_LIT(KTe_DummyProtocolName,"DummyProtocol");
 
-static const TInt KProtocolInetDummy = 253;
+
+static const TInt KDummyNetworkProtocol = 253;
+static const TInt KDummyProtocol = 254;
 
 _LIT(KSocketDataCheckTransformType, "SocketDataCheckTransformType");
 
@@ -74,12 +80,30 @@
 	TInt ConfigureFromIni();
 
 private:
-    TBool iCancelFlag;
+    TBool iCancelFlag;	
     TRSocketParams iParams; //current params (.ini)
 	};
 
 _LIT(KConnectRSocketStep,"ConnectRSocketStep");
 
+/**
+Class implementing BindRSocketStep
+
+@internalComponent
+*/
+class CBindRSocketStep : public CTe_EsockStepBase
+    {
+public:
+    CBindRSocketStep(CCEsockTestBase*& aEsockTest);
+    TVerdict doSingleTestStep();
+    TInt ConfigureFromIni();
+
+private:
+    TRSocketParams iParams; //current params (.ini)
+    };
+
+_LIT(KBindRSocketStep,"BindRSocketStep");
+
 
 /**
 Class implementing AddRSocketToRSubConnectionOOMStep
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -952,8 +952,12 @@
 		}
 
 	TPtrC eventName;
-
-	if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
+    TInt event;
+    if (GetIntFromConfig(iSection,KTe_SelectedProgress, event)==1)
+        {
+        iParams.iEventMask = event;
+        }
+    else if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
 		{
 		if (eventName.Compare(KTe_LinkLayerOpen)==0)
 			{ iParams.iEventMask = KLinkLayerOpen; }
@@ -1009,8 +1013,12 @@
 		return KErrNotFound;
 
 	TPtrC eventName;
-
-	if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
+    TInt event;
+    if (GetIntFromConfig(iSection,KTe_SelectedProgress, event)==1)
+        {
+        iParams.iEventMask = event;
+        }
+    else if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
 		{
 		if (eventName.Compare(KTe_LinkLayerOpen)==0)
 			{ iParams.iEventMask = KLinkLayerOpen; }
@@ -1111,24 +1119,28 @@
 		return KErrNotFound;
 
 	TPtrC eventName;
-
-	if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
-		{
-		if (eventName.Compare(KTe_LinkLayerOpen)==0)
-			{ iParams.iEventMask = KLinkLayerOpen; }
-		else if (eventName.Compare(KTe_LinkLayerClosed)==0)
-			{ iParams.iEventMask = KLinkLayerClosed; }
-		else
-			{
-			INFO_PRINTF3(_L("%S: Event type (%S) not recognised."),&iParams.iEventName,&eventName);
-			return KErrNotFound;
-			}
-		}
-	else
-		{
-		INFO_PRINTF1(_L("Event type missing."));
-		return KErrNotFound;
-		}
+	TInt event;
+	if (GetIntFromConfig(iSection,KTe_SelectedProgress, event)==1)
+	    {
+        iParams.iEventMask = event;
+	    }
+	else if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
+	    {
+        if (eventName.Compare(KTe_LinkLayerOpen)==0)
+            { iParams.iEventMask = KLinkLayerOpen; }
+        else if (eventName.Compare(KTe_LinkLayerClosed)==0)
+            { iParams.iEventMask = KLinkLayerClosed; }
+        else
+            {
+            INFO_PRINTF3(_L("%S: Event type (%S) not recognised."),&iParams.iEventName,&eventName);
+            return KErrNotFound;
+            }
+        }
+    else
+        {
+        INFO_PRINTF1(_L("Event type missing."));
+        return KErrNotFound;
+        }	
 
 	if (!GetIntFromConfig(iSection, KExpectedError, iExpectedError))
 		{
@@ -1157,18 +1169,17 @@
 	TNifProgress* event = NULL;
 	TInt err = iEsockTest->ReceiveProgressNotificationEvent(event, iParams.iEventName, iParams.iTimeoutMiliSecs);
 
-	if (event == NULL || err == KErrNone)
+	if (event == NULL && err == KErrNone)
 		{
 		INFO_PRINTF2(_L("%S: Did not receive any event."),&iParams.iEventName);
-
 		return EPass;
 		}
-		else if (event == NULL || err != KErrNone)
-		{
-		INFO_PRINTF2(_L("%S: Did not receive any event but error condiction detected !"),&iParams.iEventName);
-		INFO_PRINTF2(_L("The error code returned was %d."),err);
-		return EFail;
-		}
+    else if (event == NULL || err != KErrNone)
+        {
+        INFO_PRINTF2(_L("%S: Did not receive any event but error condiction detected !"),&iParams.iEventName);
+        INFO_PRINTF2(_L("The error code returned was %d."),err);
+        return EFail;
+        }
 
 
 	TInt eventId = event->iStage;
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -835,7 +835,7 @@
 		RConnection* c = iConns.Find(aParams.iConnectionName);
 		if (c==NULL)
 			return KErrNotFound;
-		error = s->Open(*ss, KAfInet, aParams.iSocketType, aParams.iProtocol, *c);
+		error = s->Open(*ss, aParams.iAddrFamily, aParams.iSocketType, aParams.iProtocol, *c);
 		}
 	else if (aParams.iSubconnectionName.Length()>0)
     	{
@@ -844,7 +844,7 @@
 			{
 			return KErrNotFound;
 			}
-		error = s->Open(*ss, KAfInet, aParams.iSocketType, aParams.iProtocol, *sc);
+		error = s->Open(*ss, aParams.iAddrFamily, aParams.iSocketType, aParams.iProtocol, *sc);
 		}
 	else if (aParams.iProtocolName.Length()>0)
 		{
@@ -852,17 +852,15 @@
 		}
 	else
 		{
-		error = s->Open(*ss, KAfInet, aParams.iSocketType, aParams.iProtocol);
+		error = s->Open(*ss, aParams.iAddrFamily, aParams.iSocketType, aParams.iProtocol);
 		}
 
 
 	return error;
 	}
 
-TInt CCEsockTestBase::BindSocket(const TRSocketParams& /*aParams*/)
+TInt CCEsockTestBase::BindSocket(TRSocketParams& aSockeSParams)
 	{
-    return KErrNotSupported;
-    /*
     RSocket* s = iSocks.Find(aSockeSParams.iSocketName);
 	if (s==NULL)
 		return KErrNotFound;
@@ -874,8 +872,8 @@
 		return error;
 
 	//bind to Local address for TCP or UDP
+	
 	return s->Bind(aSockeSParams.iLocalIP);
-	*/
 	}
 
 TInt CCEsockTestBase::ConnectSocket(TRSocketParams& aParams, TRequestStatus& aRequestStatus)
@@ -1483,7 +1481,7 @@
 	    User::WaitForRequest(ec->iEventReceived);
 	    }
 	aNifProgress = (ec->iEventReceived.Int()==KErrNone)? &ec->iProgressBuf() : NULL;
-	return ec->iEventReceived.Int();
+	return ec->iEventReceived.Int() == KRequestPending ? KErrNone : ec->iEventReceived.Int();
 	}
 
 
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Sockets.TestSteps.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Sockets.TestSteps.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -73,28 +73,58 @@
         }
 	else
 		{
-	    TPtrC protocol;
-	    if (GetStringFromConfig(iSection,KTe_Protocol,protocol)!=1)
-        {
-	        INFO_PRINTF2(_L("%S: Protocol missing."),&iParams.iSocketName);
-        	return KErrNotFound;
+        TInt protocolInt = 0;
+        //Try obtaining protocol type as int, failing that, go to predefined types
+        if (GetIntFromConfig(iSection, KTe_Protocol, protocolInt)!=1)
+            {
+            TPtrC protocolStr;
+            if (GetStringFromConfig(iSection, KTe_Protocol,protocolStr)!=1 )
+                {
+                INFO_PRINTF2(_L("%S: Protocol missing."),&iParams.iSocketName);
+                return KErrNotFound;        
+                }
+            if (protocolStr.Compare(KTe_TCPName)==0)
+                { protocolInt = KProtocolInetTcp; iParams.iSocketType = KSockStream;}
+            else if (protocolStr.Compare(KTe_UDPName)==0)
+                { protocolInt = KProtocolInetUdp; iParams.iSocketType = KSockDatagram;}
+            else if (protocolStr.Compare(KTe_DummyNetworkProtocolName)==0)
+                { protocolInt = KDummyNetworkProtocol; iParams.iSocketType = KSockDatagram;} 
+            else if (protocolStr.Compare(KTe_DummyProtocolName)==0)
+                { protocolInt = KDummyProtocol; iParams.iSocketType = KSockDatagram;} 
+            else
+                {
+                INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocolStr);
+                return KErrNotFound;
+                }
+            }
+        iParams.iProtocol = protocolInt;
         }
-
-	    if (protocol.Compare(KTe_TCPName)==0)
-		    { iParams.iProtocol = KProtocolInetTcp; iParams.iSocketType = KSockStream; }
-	    else if (protocol.Compare(KTe_UDPName)==0)
-		    { iParams.iProtocol = KProtocolInetUdp; iParams.iSocketType = KSockDatagram; }
-	    else if (protocol.Compare(KDummyProtocolName)==0)
-		    {
-			iParams.iProtocol = KProtocolInetDummy;
-			iParams.iSocketType = KSockDatagram;
-			}
-	    else
-	        {
-	        INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocol);
-	        return KErrNotFound;
-	        }
+    
+	TPtrC socketTypeStr;	
+    if (GetStringFromConfig(iSection, KTe_SocketType,socketTypeStr)!=1 )
+        {
+        INFO_PRINTF2(_L("%S: Socket type missing, defaulting based on specified protocol"),&iParams.iSocketName);
         }
+    else
+        {
+        if (socketTypeStr.Compare(KTe_SocketDatagram)==0)
+             { iParams.iSocketType = KSockDatagram;}
+        else if (socketTypeStr.Compare(KTe_SocketStream)==0)
+             { iParams.iSocketType = KSockStream; }
+        else
+            {
+            INFO_PRINTF3(_L("%S: Socket type (%S) not recognised."),&iParams.iSocketName,&socketTypeStr);
+            return KErrNotFound;
+            }
+        }
+    
+    
+    TInt protocolInt = KAfInet;
+    if (GetIntFromConfig(iSection, KTe_ConnectionType, protocolInt)!=1 )
+        {
+        INFO_PRINTF2(_L("%S: Address Family (ConnType) missing, defaulting to KAfInet"),&iParams.iSocketName);
+        }
+    iParams.iAddrFamily = protocolInt;
 
     // All ok if we got this far
     return KErrNone;
@@ -199,6 +229,71 @@
 	return EPass;
     }
 
+// Bind Socket
+//---------------
+
+CBindRSocketStep::CBindRSocketStep(CCEsockTestBase*& aEsockTest)
+:   CTe_EsockStepBase(aEsockTest)
+    {
+    SetTestStepName(KBindRSocketStep);
+    }
+
+TInt CBindRSocketStep::ConfigureFromIni()
+    {
+    // Read in appropriate fields
+    if((GetStringFromConfig(iSection, KTe_SocketName, iParams.iSocketName) != 1)
+        || (iParams.iSocketName.Length() == 0))
+        {
+        INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
+        return KErrNotFound;
+        }
+        
+    TInt protocolInt = 0;
+    if (GetIntFromConfig(iSection, KTe_Protocol, protocolInt)!=1)
+        {
+        TPtrC protocolStr;
+        if (GetStringFromConfig(iSection, KTe_Protocol,protocolStr)!=1 )
+            {
+            INFO_PRINTF2(_L("%S: Protocol missing."),&iParams.iSocketName);
+            return KErrNotFound;        
+            }
+        if (protocolStr.Compare(KTe_TCPName)==0)
+            { protocolInt = KProtocolInetTcp; }
+        else if (protocolStr.Compare(KTe_UDPName)==0)
+            { protocolInt = KProtocolInetUdp; }
+        else if (protocolStr.Compare(KTe_DummyNetworkProtocolName)==0)
+            { protocolInt = KDummyNetworkProtocol; }
+        else if (protocolStr.Compare(KTe_DummyProtocolName)==0)
+            { protocolInt = KDummyProtocol; }
+        else
+            {
+            INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocolStr);
+            return KErrNotFound;
+            }
+        }
+    iParams.iProtocol = protocolInt;
+    
+    // IP Address Local
+    if (GetIpAddressFromConfig(iSection,KTe_SourceAddressName,iParams.iLocalIP)!=1)
+        {
+        INFO_PRINTF2(_L("%S: Local address missing."),&iParams.iSocketName);
+        }    
+    
+    // All ok if we got this far
+    return KErrNone;
+    }
+
+TVerdict CBindRSocketStep::doSingleTestStep()
+    {
+    TInt error = iEsockTest->BindSocket(iParams/*,reqStat*/);
+    if (error!=KErrNone)
+        {
+        INFO_PRINTF2(_L("Could not bind socket (%S)."),&iParams.iSocketName);
+        INFO_PRINTF2(_L("Error: %d."),error);
+        SetTestStepResult(EFail);
+        }
+    return TestStepResult();
+    }
 
 // Connect Socket
 //---------------
@@ -232,10 +327,10 @@
 	    { iParams.iProtocol = KProtocolInetTcp; }
     else if (protocol.Compare(KTe_UDPName)==0)
 	    { iParams.iProtocol = KProtocolInetUdp; }
-	else if (protocol.Compare(KDummyProtocolName)==0)
-		{
-		iParams.iProtocol = KProtocolInetDummy;
-		}
+	else if (protocol.Compare(KTe_DummyNetworkProtocolName)==0)
+		{ iParams.iProtocol = KDummyNetworkProtocol; }
+    else if (protocol.Compare(KTe_DummyProtocolName)==0)
+        { iParams.iProtocol = KDummyProtocol; }    
     else
         {
         INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocol);
@@ -363,10 +458,10 @@
 	    { iParams.iProtocol = KProtocolInetTcp; }
     else if (protocol.Compare(KTe_UDPName)==0)
 	    { iParams.iProtocol = KProtocolInetUdp; }
-	else if (protocol.Compare(KDummyProtocolName)==0)
-		{
-		iParams.iProtocol = KProtocolInetDummy;
-		}
+	else if (protocol.Compare(KTe_DummyNetworkProtocolName)==0)
+		{ iParams.iProtocol = KDummyNetworkProtocol; }
+    else if (protocol.Compare(KTe_DummyProtocolName)==0)
+        { iParams.iProtocol = KDummyProtocol; }    
     else
         {
         INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocol);
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -198,6 +198,8 @@
 				testStep = new CConnectRSocketServStep(iEsockTest);
 	else if(aStepName.CompareF (KConnectRSocketStep) == 0)
 				testStep = new CConnectRSocketStep(iEsockTest);
+    else if(aStepName.CompareF (KBindRSocketStep) == 0)
+                testStep = new CBindRSocketStep(iEsockTest);	
 	else if(aStepName.CompareF (KControlRSubConnectionStep) == 0)
 				testStep = new CControlRSubConnectionStep(iEsockTest);
 	else if(aStepName.CompareF (KCreateRConnectionStep) == 0)
--- a/datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760640.ini	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760640.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -44,6 +44,16 @@
 Expected0NewAP=5
 Expected0OldAP=4
 
+[ProgressNotificationEvent1]
+ConnEventsName=Conn1Events
+ConnName=Conn1
+SelectedProgress=4500
+
+[CheckNegativeProgressNotificationEvent1]
+ConnEventsName=Conn1Events
+SelectedProgress=4500
+TimeoutInMilliSeconds=11000
+
 [MigrateToPreferredCarrier]
 MobilityExtName=MobExt1
 
--- a/datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760640.script	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760640.script	Fri Jun 11 14:52:21 2010 +0300
@@ -24,6 +24,7 @@
 PRINT Receive PreferredCarierAvailable
 PRINT Do not register (no call to RCommsMobilityApiExt::RegisterForMobilityNotification()),
 PRINT RCommsMobilityApiExt::MigrateToPreferredCarrier(),
+PRINT Check to see if the progresses from the abanonded AP don't perculate to the app.
 PRINT RCommsMobilityApiExt::Close()
 
 // Load the test suite
@@ -75,6 +76,11 @@
 //Migrate to preferred carrier
 RUN_TEST_STEP 150 te_esockteststepsSuite migratercommsmobilityapiextStep z:\testdata\configs\BearerMobility\Mobility_760640.ini MigrateToPreferredCarrier
 
+//Check absence of progress from the abandoned IAP4
+RUN_TEST_STEP 100 te_esockteststepsSuite RegisterProgressNotificationStep    z:\testdata\configs\BearerMobility\Mobility_760640.ini ProgressNotificationEvent1
+RUN_TEST_STEP 100 te_esockteststepsSuite CheckNegativeProgressNotificationStep z:\testdata\configs\BearerMobility\Mobility_760640.ini CheckNegativeProgressNotificationEvent1
+
+
 // Clean up what we used
 RUN_TEST_STEP 150 te_esockteststepsSuite CloseRCommsMobilityAPIExtStep z:\testdata\configs\BearerMobility\Mobility_760640.ini CloseMobilityExtension
 RUN_TEST_STEP 150 te_esockteststepsSuite CloseRConnectionStep z:\testdata\configs\BearerMobility\Mobility_760640.ini CloseConn
--- a/datacommsserver/esockserver/test/TE_RSubconnection/configs/te_RSubConnectionCase70.ini	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RSubconnection/configs/te_RSubConnectionCase70.ini	Fri Jun 11 14:52:21 2010 +0300
@@ -113,13 +113,13 @@
 
 [OpenSocket2]
 SocketName=Socket2
-Protocol=Dummy
+Protocol=DummyNetworkProtocol
 SubConnName=SubConn1
 SocketServName=SockSvr1
 
 [ConnectSocket2]
 SocketName=Socket2
-Protocol=Dummy
+Protocol=DummyNetworkProtocol
 SrcAddr=0.0.0.0
 SrcPort=0
 DstAddr=192.168.1.2
@@ -128,7 +128,7 @@
 [SendReceiveOnSocket2]
 SocketName=Socket2
 PacketSize=512
-Protocol=Dummy
+Protocol=DummyNetworkProtocol
 NrOfPackets=1
 ReceiveTimeout=5
 
--- a/datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp	Fri Jun 11 14:52:21 2010 +0300
@@ -35,7 +35,9 @@
 SOURCE			dummypr_mcprpubsubsubscriber.cpp
 SOURCE			dummypr_metaconnprov.cpp
 SOURCE			dummypr_tiermanager.cpp
+SOURCE			dummypr_flow.cpp 
 SOURCE			dummypr_network_flow.cpp
+SOURCE			activityTest.cpp
 
 
 USERINCLUDE     ../inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/activityTest.h	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,142 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+//
+
+/**
+ @file
+ @internalTechnology
+*/
+
+#include <elements/mm_states.h>
+#include <ss_internal_activities.h>
+
+#ifndef SYMBIAN_ACTIVITYTEST
+#define SYMBIAN_ACTIVITYTEST
+
+namespace CancelTestBindToActivity
+    {
+    DECLARE_NODEACTIVITY(CancelBindTo)
+    }
+
+class CActivityCancelTest : public MeshMachine::CNodeRetryActivity
+                                      
+/**
+@internalTechnology
+*/
+    {
+public:
+    //TODO
+    enum {ECancelTestActivity = ESock::ECFActivityBuildStack };
+    static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+        {
+        CActivityCancelTest* self = new (ELeave) CActivityCancelTest(aActivitySig, aNode);
+        return self;
+        }
+
+    class TProgressiveMutex
+        {
+        public:
+        static TBool IsBlocked(MeshMachine::TNodeContextBase& aContext)
+            {
+            return static_cast<CActivityCancelTest&>(*aContext.iNodeActivity).ProgressiveMutex();
+            }
+        };
+    
+    void NextLoop()
+        {
+        iMaxLoopCount++;
+        iCurrentLoopCount = 0;        
+        }
+    
+    TBool ProgressiveMutex()
+        {
+        return ++iCurrentLoopCount <= iMaxLoopCount;
+        }
+    
+protected:
+    CActivityCancelTest(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+    :   CNodeRetryActivity(aActivitySig, aNode)
+        {
+        }
+    
+    void StoreRequestL(const Messages::TSignatureBase& aRequest);
+    const Messages::TSignatureBase& StoredRequest()
+        { 
+        return *reinterpret_cast<const Messages::TSignatureBase*>(iStoredRequest.Ptr()); 
+        }
+    
+    
+private:
+    TBuf8<__Align8(Messages::TSignalBase::KMaxInlineMessageSize + Messages::TSignalBase::KMaxUnstoredOverhead)> iStoredRequest;
+    TInt iMaxLoopCount;
+    TInt iCurrentLoopCount;
+    
+public:
+    typedef MeshMachine::TContext TContext;
+    
+    template<typename TMESSAGE>
+    class TAwaitingMessageState : public MeshMachine::TState<TContext>
+        {
+    public:
+        NETSM_TPL_DECLARE_CTR(TAwaitingMessageState, NetStateMachine::MState, TContext)
+
+        explicit TAwaitingMessageState(TContext& aContext) :
+            MeshMachine::TState<TContext>(aContext) {}
+
+        virtual TBool Accept()
+                {
+    #ifdef __GCCXML__
+                return EFalse;
+    #else
+                if (Messages::address_cast<const Messages::TNodeCtxId>(iContext.iSender).NodeCtx() != CActivityCancelTest::ECancelTestActivity)
+                    {
+                    Messages::TNodeSignal& msg = this->iContext.iMessage; //Arm compiler is getting confused otherwise
+                    return msg.IsMessage<TMESSAGE>();
+                    }
+    #endif
+                return EFalse;                
+                }
+        };  
+
+    DECLARE_SMELEMENT_HEADER( TNoTagForwardOrActiveTagBackward, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, TContext )
+        virtual TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TNoTagForwardOrActiveTagBackward )    
+    
+    DECLARE_SMELEMENT_HEADER( TBeginTest, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+        virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TBeginTest )
+    
+    DECLARE_SMELEMENT_HEADER( TBeginLoop, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+        virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TBeginLoop )    
+
+    DECLARE_SMELEMENT_HEADER( TCancel, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+        virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TCancel )
+
+    DECLARE_SMELEMENT_HEADER( TEndTest, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+        virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TEndTest )
+    
+    DECLARE_SERIALIZABLE_TRANSITION(
+        TProgressiveCancel,
+        TProgressiveMutex,
+        TCancel
+        )      
+    };
+
+
+#endif //SYMBIAN_ACTIVITYTEST
+
+
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h	Fri Jun 11 14:52:21 2010 +0300
@@ -26,7 +26,7 @@
 
 #include <comms-infras/mobilitycpr.h>
 #include <comms-infras/mobilitycprstates.h>
-
+#include <elements/mm_activities_internal.h> 
 
 #ifdef __FLOG_ACTIVE
 // CommsDebugUtility logging tags. Use them to enable tracing for DummyCPR
@@ -34,6 +34,12 @@
 _LIT8(KTestDummyLogTag2,"TestDummyRef");
 #endif
 
+enum TCFNodeActivityId
+    {
+    ECFActivityDummyCprDestroy                 = ESock::ECFActivityCustom +1,
+    };
+
+
 class CDummyConnectionProvider : public CMobilityConnectionProvider, public ESock::MLegacyControlApiExt,
                                  public ITFHIERARCHY_LINK_1(CDummyConnectionProvider, CMobilityConnectionProvider, ESock::MLegacyControlApiExt)
 
@@ -59,11 +65,45 @@
          };
 
     static CDummyConnectionProvider* NewL(ESock::CConnectionProviderFactoryBase& aFactory, TConnType aConnStatus);
-    CDummyConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory, TConnType aConnStatus);
+    static CDummyConnectionProvider* NewVanillaL(ESock::CConnectionProviderFactoryBase& aFactory);
+    
+    CDummyConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap, TConnType aConnStatus);
+    
 public:
 	TConnType iConnStatus;
     };
 
+
+class CDelayTimer: public CTimer
+    {
+public:
+    static CDelayTimer* NewL( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId );
+
+    virtual ~CDelayTimer();
+    void Start( TInt aIntervalInSecs );    
+
+public:
+class TDelayMessage : public Messages::TSignatureBase
+    {
+public:
+    TDelayMessage();
+    TDelayMessage(const TNodeSignal::TMessageId& aMessageId);
+    };
+
+private:
+    CDelayTimer( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId );
+    void ConstructL();
+    
+protected: // From CTimer (CActive)
+    void RunL();
+        
+private:
+    Messages::RNodeInterface* iSender;
+    Messages::TNodeId iRecipient;
+    Messages::TNodeSignal::TMessageId iMessageId;
+    };
+
+
 //-================================================
 //
 // States and Transitions
@@ -85,6 +125,13 @@
 	virtual TBool Accept();
 DECLARE_SMELEMENT_FOOTER( TAwaitingStart )
 
+DECLARE_SMELEMENT_HEADER( TAwaitingDestroy, MeshMachine::TState<TContext>, NetStateMachine::MState, DummyCPRStates::TContext )
+    virtual TBool Accept();
+DECLARE_SMELEMENT_FOOTER( TAwaitingDestroy )
+
+DECLARE_SMELEMENT_HEADER( TThreeSecDelayAndPostToSelf, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, DummyCPRStates::TContext )
+    virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TThreeSecDelayAndPostToSelf )
 
 } // namespace DummyCPRStates
 
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h	Fri Jun 11 14:52:21 2010 +0300
@@ -30,6 +30,12 @@
 #include <comms-infras/ss_connprov.h>
 #include <comms-infras/ss_tiermanager.h>
 #include <comms-infras/ss_nodemessages.h>
+
+using namespace ESock;
+
+_LIT(KDummyProtocolName, "dummy");
+_LIT(KDumberProtocolName, "dumber");
+
 //-=========================================================
 //
 // CDummyTierManagerFactory
@@ -88,6 +94,17 @@
 	CDummyHangingConnectionProviderFactory(TUid aFactoryId, ESock::CConnectionFactoryContainer& aParentContainer);
 	virtual ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
 	};
+
+class CDummyVanillaConnectionProviderFactory : public ESock::CConnectionProviderFactoryBase
+    {
+public:
+    enum { iUid = 0x10283030 };
+    static CDummyVanillaConnectionProviderFactory* NewL(TAny* aParentContainer);
+
+protected:
+    CDummyVanillaConnectionProviderFactory(TUid aFactoryId, ESock::CConnectionFactoryContainer& aParentContainer);
+    virtual ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
+    };
 	
 //-=========================================================
 //
@@ -111,8 +128,6 @@
 // CDummyExtendedSubConnectionProviderFactory
 //
 //-=========================================================
-namespace ESock
-{
 class CDummyExtendedSubConnectionProviderFactory : public ESock::CSubConnectionProviderFactoryBase
 	{
 public:
@@ -123,31 +138,46 @@
 	CDummyExtendedSubConnectionProviderFactory(TUid aFactoryId, ESock::CSubConnectionFactoryContainer& aParentContainer);
 	virtual ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
 	};
-}
+
 
 //-=========================================================
 //
-// CDummyNetworkFlowFactory
+// CDummyVanillaSubConnectionProviderFactory
 //
 //-=========================================================
-namespace ESock
-{
-class CDummyNetworkFlowFactory : public ESock::CSubConnectionFlowFactoryBase
+class CDummyVanillaSubConnectionProviderFactory : public ESock::CSubConnectionProviderFactoryBase
+    {
+public:
+    enum { iUid = 0x10283031 };
+    static CDummyVanillaSubConnectionProviderFactory* NewL(TAny* aParentContainer);
+
+protected:
+    CDummyVanillaSubConnectionProviderFactory(TUid aFactoryId, ESock::CSubConnectionFactoryContainer& aParentContainer);
+    virtual ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
+    };
+
+
+
+//-=========================================================
+//
+// CDummyFlowFactory
+//
+//-=========================================================
+class CDummyFlowFactory : public ESock::CSubConnectionFlowFactoryBase
 	{
 public:
 	enum { iUid = 0x10285D8F };
-	static CDummyNetworkFlowFactory* NewL(TAny* aConstructionParameters);
-	~CDummyNetworkFlowFactory();
+	static CDummyFlowFactory* NewL(TAny* aConstructionParameters);
+	~CDummyFlowFactory();
 
 protected:
-	CDummyNetworkFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer);
+	CDummyFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer);
 
 	// from CSubConnectionFlowFactoryBase
 	virtual ESock::CSubConnectionFlowBase* DoCreateFlowL(CProtocolIntfBase* aProtocolIntf, ESock::TFactoryQueryBase& aQuery);
 	virtual ESock::ACommsFactoryNodeId* DoFindOrCreateObjectL(ESock::TFactoryQueryBase& aQuery);
 	virtual TServerProtocolDesc* DoCreateFlowDescriptionL(TInt aProtocol);
 	};
-}
 
 
 #endif	// __DummyPR_FACTORY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_flow.h	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,153 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Dummy network flow
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#if !defined(__DUMMYPR_FLOW_H__)
+#define __DUMMYPR_FLOW_H__
+
+#include "dummypr_factory.h"
+#include <comms-infras/ss_protflow.h>
+#include <comms-infras/ss_subconnflow.h>
+#include <comms-infras/es_sap.h>
+#include <comms-infras/nifif.h>
+
+#include <comms-infras/ss_nodemessages_dataclient.h>
+#include <comms-infras/ss_nodemessages_flow.h>
+
+
+namespace ESock
+{
+
+
+class CDummyFlow : public CSubConnectionFlowBase,
+	public MSessionData,
+	public MSessionControl,
+	public MFlowBinderControl,
+	public MSessionControlNotify,
+	public MSessionDataNotify
+/**
+@internalComponent
+@released since v9.6
+ */
+	{
+public:
+    enum {EProtocolId = 254};
+    typedef CDummyFlowFactory FactoryType; //for factoryobject_cast to work
+
+	static CDummyFlow* NewL(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
+	void SetSSP(CServProviderBase& aSSP);
+
+	inline CServProviderBase* Provider();
+
+protected:
+	// Lifetime
+	CDummyFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
+	virtual ~CDummyFlow();
+	void SetSockType(TUint aSockType);
+	TInt LockToConnectionInfo();
+
+	// MSessionData
+	virtual TUint Write(const TDesC8& aDesc,TUint aOptions, TSockAddr* anAddr);
+	virtual TInt Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr);
+	virtual void GetData(TDes8& aDesc, TUint aOptions, TSockAddr* anAddr);
+	virtual TInt GetData(RMBufChain& aData, TUint aLength, TUint aOptions, TSockAddr* anAddr);
+
+	// MSessionControl
+	virtual void Start();
+	virtual void LocalName(TSockAddr& anAddr) const;
+	virtual void SetLocalName(TSockAddr& anAddr);
+	virtual void RemName(TSockAddr& anAddr) const;
+	virtual TInt SetRemName(TSockAddr& anAddr);
+	virtual TInt GetOption(TUint aLevel,TUint aName,TDes8& anOption) const;
+	virtual void Ioctl(TUint aLevel,TUint aName,TDes8* anOption);
+	virtual void CancelIoctl(TUint aLevel,TUint aName);
+	virtual TInt SetOption(TUint aLevel, TUint aName,const TDesC8 &anOption);
+	virtual void ActiveOpen();
+	virtual void ActiveOpen(const TDesC8& aConnectionData);
+	virtual TInt PassiveOpen(TUint aQueueSize);
+	virtual TInt PassiveOpen(TUint aQueueSize,const TDesC8& aConnectionData);
+	virtual void Shutdown(MSessionControl::TCloseType aOption);
+	virtual void Shutdown(MSessionControl::TCloseType aOption, const TDesC8& aDisconnectionData);
+	virtual void AutoBind();
+	virtual TInt SecurityCheck(MProvdSecurityChecker* aSecurityChecker);
+
+    // MFlowBinderControl
+    //session binders for CSocket
+    virtual MSessionControl* GetControlL(TInt aSessionType,MSessionControlNotify& aSessionControlNotify);
+    virtual MSessionData* BindL(MSessionDataNotify& aNotify);
+    virtual void Unbind();
+    virtual CSubConnectionFlowBase& CloneFlowL();
+	virtual CSubConnectionFlowBase* Flow();
+
+private:
+	// MSessionControlNotify
+    void ConnectComplete();
+	void ConnectComplete(const TDesC8& aConnectData);
+    void ConnectComplete(CSubConnectionFlowBase& anSSP);
+	void ConnectComplete(CSubConnectionFlowBase& anSSP,const TDesC8& aConnectData);
+	void CanClose(MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete);
+    void CanClose(const TDesC8& aDisconnectData,MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete);
+	TInt Error(TInt anError,TUint anOperationMask);
+	void Disconnect( );
+	void Disconnect(TDesC8& aDisconnectData);
+	void IoctlComplete(TDesC8* aBuf);
+	void DisconnectFromListener(CSubConnectionFlowBase& aSSP);
+	void SetLocalNameComplete();
+
+
+	// MSessionDataNotify
+	void NewData(TUint aCount);
+	void CanSend();
+
+protected:
+	// CSubConnectionFlowBase
+	virtual MFlowBinderControl* DoGetBinderControlL();
+
+	// Messages::ANode
+	virtual void ReceivedL(
+		const Messages::TRuntimeCtxId& aSender,
+		const Messages::TNodeId& aRecipient,
+		Messages::TSignatureBase& aMessage
+		);
+
+	void BindToL(TCFDataClient::TBindTo& aBindTo);
+
+
+private:
+	// Flow binders
+	MFlowBinderControl* iLowerFlowBinderControl;
+
+	// Lower session binding
+	MSessionControl* iLowerFlowControl;
+	MSessionData* iLowerFlowData;
+
+	// Upper session binding
+	MSessionControlNotify* iSessionControlNotify;
+	MSessionDataNotify* iSessionDataNotify;
+
+	RCFParameterFamilyBundleC iParamBundle;
+	};
+
+}
+
+
+#endif	// __DUMMYPR_FLOW_H__
+
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h	Fri Jun 11 14:52:21 2010 +0300
@@ -43,6 +43,7 @@
 		ESCPRHangOnRebind = 1,			  //when lit on CprConfig, the SCPR will hang on rebind
 		ESCPRHangOnStart  = 2,			  //when lit on CprConfig, the SCPR will hang on start
 		ESCPRFailOnRebind = 3,            //when lit on CprConfig, the SCPR will fail on rebind
+		ECPRWaitOnThreeSecDestroy = 4,   //when lit on CprConfig, the CPR will wait for 3 sec on destroy before resuming
 		};
 
 	static TBool Is(TInt aValue, TInt aFlags)
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_network_flow.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_network_flow.h	Fri Jun 11 14:52:21 2010 +0300
@@ -35,9 +35,6 @@
 namespace ESock
 {
 
-_LIT(KDummyProtocolName, "dummy");
-_LIT(KDumberProtocolName, "dumber");
-
 class CDummyNetworkFlow : public CSubConnectionFlowBase,
 	public MSessionData,
 	public MSessionControl,
@@ -51,7 +48,8 @@
 	{
     friend class CSocket;
 public:
-    typedef CDummyNetworkFlowFactory FactoryType; //for factoryobject_cast to work
+    enum {EProtocolId = 253};
+    typedef CDummyFlowFactory FactoryType; //for factoryobject_cast to work
 
 	static CDummyNetworkFlow* NewL(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf);
 	void SetSSP(CServProviderBase& aSSP);
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h	Fri Jun 11 14:52:21 2010 +0300
@@ -30,6 +30,7 @@
 #include <comms-infras/ss_corepractivities.h>
 
 class CDummySubConnectionProviderFactory;
+class CDummyVanillaSubConnectionProviderFactory;
 
 //-================================================
 //
@@ -49,24 +50,22 @@
 }
 
 
-namespace ESock
-{
-	/* We have to have CDummySubConnectionProvider inside the ESock namespace so it can befriend
-	mcfnode_cast - GCC simply doesn't allow befriending something in another template. See
-	http://gcc.gnu.org/ml/gcc-prs/2002-10/msg01010.html for Herb Sutter's GOTW column on exactly
-	this - it contains this discouraging summary:
+
+/* We have to have CDummySubConnectionProvider inside the ESock namespace so it can befriend
+mcfnode_cast - GCC simply doesn't allow befriending something in another template. See
+http://gcc.gnu.org/ml/gcc-prs/2002-10/msg01010.html for Herb Sutter's GOTW column on exactly
+this - it contains this discouraging summary:
 
-	The reason that I'm writing an article about it is because, alas,
-	befriending a template in another namespace is easier said than done:
-
-   	- The Bad News: There are two perfectly good standards-conforming
-     ways to do it, and neither one works on all current compilers.
+The reason that I'm writing an article about it is because, alas,
+befriending a template in another namespace is easier said than done:
 
-   	- The Good News: One of the perfectly good standards-conforming ways
-     does work on every current compiler I tried except for gcc.
+- The Bad News: There are two perfectly good standards-conforming
+ ways to do it, and neither one works on all current compilers.
 
-	So, since it's only test code & we need it building on GCC, I've hacked around it */
+- The Good News: One of the perfectly good standards-conforming ways
+ does work on every current compiler I tried except for gcc.
 
+So, since it's only test code & we need it building on GCC, I've hacked around it */
 class CDummySubConnectionProvider : public CCoreSubConnectionProvider
 /**
 
@@ -85,7 +84,8 @@
     friend CDummySubConnectionProvider* Messages::mnode_cast<CDummySubConnectionProvider>(ANode* aNode);
     friend CDummySubConnectionProvider& Messages::mnode_cast<CDummySubConnectionProvider>(ANode& aNode);
 #endif
-    friend class ::CDummySubConnectionProviderFactory;
+    friend class CDummySubConnectionProviderFactory;
+    friend class CDummyVanillaSubConnectionProviderFactory;
     friend class DummySCPRStates::TRaiseGranted;
 
 public:
@@ -94,11 +94,15 @@
 
 protected:
     static CDummySubConnectionProvider* NewL(ESock::CSubConnectionProviderFactoryBase& aFactory);
-    CDummySubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory);
+    static CDummySubConnectionProvider* NewVanillaL(ESock::CSubConnectionProviderFactoryBase& aFactory);
+    
+    CDummySubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap);
 
 private:
     TBool incomingStatus;
 	};
+
+
 class CDummyExtendedSubConnectionProvider : public CCoreSubConnectionProvider
 /**
 This dummy is intended to create flow shim based layer beneath it during its own creation
@@ -134,13 +138,13 @@
 
 private:
     TBool incomingStatus;
-    TFlowParams iFlowParams;
+    ESock::TFlowParams iFlowParams;
 	};
-}
+
 
 namespace DummySCPRStates
 {
-typedef MeshMachine::TNodeContext<ESock::CDummySubConnectionProvider, SCprStates::TContext> TContext;
+typedef MeshMachine::TNodeContext<CDummySubConnectionProvider, SCprStates::TContext> TContext;
 
 DECLARE_SMELEMENT_HEADER( TRaiseGranted, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, DummySCPRStates::TContext )
 	virtual void DoL();
@@ -154,12 +158,70 @@
 	virtual TBool Accept();
 DECLARE_SMELEMENT_FOOTER( TAwaitingBrokenStart )
 
+DECLARE_SMELEMENT_HEADER( TRebindSelf, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, DummySCPRStates::TContext )
+    virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TRebindSelf )
+
+
+
+
+
+struct TWaitForBindToMutex
+    {
+    static TBool IsBlocked(const MeshMachine::TNodeContextBase& aContext)
+        {
+        return aContext.iNode.CountActivities(ESock::ECFActivityBindTo) == 0;
+        }
+    };
+
+struct TWaitForNoDataClients
+    {
+    static TBool IsBlocked(const MeshMachine::TNodeContextBase& aContext)
+        {
+        return aContext.iNode.GetFirstClient<Messages::TDefaultClientMatchPolicy>(Messages::TClientType(ESock::TCFClientType::EData)) != NULL;
+        }
+    };
+
+DECLARE_SERIALIZABLE_STATE(
+    TNoTagWaitForBindTo,
+    TWaitForBindToMutex,
+    MeshMachine::TNoTag
+    )
+
+DECLARE_SERIALIZABLE_STATE(
+    TNoTagWaitNoDataClients,
+    TWaitForNoDataClients,
+    MeshMachine::TNoTag
+    )
+
+
+
+DECLARE_SMELEMENT_HEADER( TCancelPreviousSelfRequest, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, DummySCPRStates::TContext )
+    virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TCancelPreviousSelfRequest )
+
+class CrazyIdle : public MeshMachine::CNodeRetryActivity
+    {
+public:
+    DECLARE_SMELEMENT_HEADER( TAwaitingCancelled, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext )
+        virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingCancelled )
+
+    static MeshMachine::CNodeActivityBase* CrazyIdle::NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode );
+protected:
+    CrazyIdle( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode )
+    :MeshMachine::CNodeRetryActivity(aActivitySig, aNode) 
+     {};
+private:
+    ~CrazyIdle();
+    };
+
 DECLARE_ACTIVITY_MAP(stateMap)
 } // namespace DummyCPRStates
 
 namespace DummyExtendedSCPRStates
 {
-typedef MeshMachine::TNodeContext<ESock::CDummyExtendedSubConnectionProvider, SCprStates::TContext> TContext;
+typedef MeshMachine::TNodeContext<CDummyExtendedSubConnectionProvider, SCprStates::TContext> TContext;
 
 DECLARE_SMELEMENT_HEADER( TAwaitingBinderResponse, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext )
 	virtual TBool Accept();
@@ -219,7 +281,7 @@
 			}
 		iFlowParameters.Open(aFlowParameters);
 		}
-	typedef MeshMachine::TNodeContext<ESock::CDummyExtendedSubConnectionProvider, SCprStates::TContext> TContext;
+	typedef MeshMachine::TNodeContext<CDummyExtendedSubConnectionProvider, SCprStates::TContext> TContext;
 
 	static MeshMachine::CNodeActivityBase* CDummyBuildStackActivity::NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode );
 
@@ -235,5 +297,6 @@
 	ESock::RCFParameterFamilyBundleC iFlowParameters;
 	};
 
+
 #endif	// __DummySCPR_SUBCONNPROV_H__
 
--- a/datacommsserver/esockserver/test/providers/dummy/src/1028302A.rss	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/1028302A.rss	Fri Jun 11 14:52:21 2010 +0300
@@ -89,6 +89,21 @@
         },
     INTERFACE_INFO
         {
+        interface_uid =  0x102070EE;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x10283030;
+                version_no = 1;
+                display_name = "Dummy Vanilla Connection Provider Factory";
+                default_data = "DummyVanillaConnectionProviderFactory";
+                opaque_data = "";
+                }
+            };
+        },        
+    INTERFACE_INFO
+        {
         interface_uid = 0x10204301;
         implementations = 
             {
@@ -116,7 +131,22 @@
                 opaque_data = "";
                 }
             };
-        },    
+        },   
+    INTERFACE_INFO
+        {
+        interface_uid = 0x10204301;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x10283031;
+                version_no = 1;
+                display_name = "Dummy Vanilla SCPR Factory";
+                default_data = "DummyVanillaSCPRFactory";
+                opaque_data = "";
+                }
+            };
+        },            
     INTERFACE_INFO
         {
         interface_uid = 0x10281C33;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/providers/dummy/src/activityTest.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,121 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// TestDummy implementation file for a TierManager
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <elements/nm_messages_base.h>
+#include <comms-infras/ss_nodemessages_dataclient.h>
+#include <ss_glob.h>
+#include "activityTest.h"
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+
+void CActivityCancelTest::StoreRequestL(const TSignatureBase& aRequest)
+    {
+    TBuf8<__Align8(TSignalBase::KMaxInlineMessageSize + TSignalBase::KMaxUnstoredOverhead)> msgBuf;
+    aRequest.Store(msgBuf);
+    TPtrC8 messageStore(msgBuf);
+    TlsGlobals::Get().VirtualCtor()->New(messageStore, iStoredRequest);
+    }
+
+
+DEFINE_SMELEMENT(CActivityCancelTest::TNoTagForwardOrActiveTagBackward, NetStateMachine::MStateFork, TContext)
+TInt CActivityCancelTest::TNoTagForwardOrActiveTagBackward::TransitionTag()
+    {
+    if (message_cast<TEBase::TError>(&iContext.iMessage))
+        {
+        return KActiveTag | NetStateMachine::EBackward;
+        }
+    return KNoTag | NetStateMachine::EForward;
+    }
+
+DEFINE_SMELEMENT(CActivityCancelTest::TBeginTest, NetStateMachine::MStateTransition, TContext)
+void CActivityCancelTest::TBeginTest::DoL()
+    {
+    ASSERT(iContext.iNodeActivity);
+    CActivityCancelTest& act = static_cast<CActivityCancelTest&>(*iContext.iNodeActivity);
+    act.StoreRequestL(iContext.iMessage);
+    }
+    
+DEFINE_SMELEMENT(CActivityCancelTest::TBeginLoop, NetStateMachine::MStateTransition, TContext)
+void CActivityCancelTest::TBeginLoop::DoL()
+    {
+    ASSERT(iContext.iNodeActivity);
+    CActivityCancelTest& act = static_cast<CActivityCancelTest&>(*iContext.iNodeActivity);    
+    act.PostRequestTo(iContext.Node().Id(), act.StoredRequest());  
+    act.NextLoop();
+    }
+
+
+DEFINE_SMELEMENT(CActivityCancelTest::TCancel, NetStateMachine::MStateTransition, TContext)
+void CActivityCancelTest::TCancel::DoL()
+    {
+    ASSERT(iContext.iNodeActivity);
+    CActivityCancelTest& act = static_cast<CActivityCancelTest&>(*iContext.iNodeActivity);    
+    act.PostRequestTo(iContext.Node().Id(), TEBase::TCancel());
+    }
+
+DEFINE_SMELEMENT(CActivityCancelTest::TEndTest, NetStateMachine::MStateTransition, TContext)
+void CActivityCancelTest::TEndTest::DoL()
+    {
+    ASSERT(iContext.iNodeActivity);
+    CActivityCancelTest& act = static_cast<CActivityCancelTest&>(*iContext.iNodeActivity);   
+    act.PostToOriginators(iContext.iMessage);
+    ASSERT(act.Error() != KErrNone); //if the activity has done its job, the activity have been invariably errored; 
+    act.SetError(KErrNone); //No point reporting this error though.
+    }
+
+
+namespace CancelTestBindToActivity
+{
+/* This is a largely generic activity written to test cancelling behaviour of another (typically 
+ * production code) activity. In this case it is put on top of and to test the TBindTo 
+ * activity, by the virtue of awaiting TCFDataClient::TBindTo. In principle though it can be put on
+ * top of any other activity by awaiting for something else instead. CancelTestBindToActivity hijacks
+ * and stores the original request (in this case TCFDataClient::TBindTo). It then goes to perform a 
+ * loop:
+ * { 
+ * - It forwards the stored request to the overriden activity (in this case the TBindTo activity), 
+ * - then follows it with a TCancel 
+ * - and awaits for TError. 
+ * }
+ * Each loop will send the TCancel slightly later, i.e.: at consecutive ticks triggered by messages 
+ * received by the local node (and subsequently resulting in AMMNodeBase::SignalActivities). 
+ * If you examine CActivityCancelTest::TProgressiveCancel you will see that it is blocked 
+ * (as any other synchronised activity) against gradually increasing number of ticks. It has been
+ * pointed out that the tick resolution may be too small - i.e.: that we may want to tick the
+ * activity with every message sent within the local thread (and thus with every even that can
+ * change the state of the activity peers). This can be done by signalling CActivityCancelTest
+ * from the transport upon every dispatch (or post). This is so far not done. Instead CancelTestBindToActivity
+ * is put against every mm node performing bind to (CPR and SCPR).
+ */
+DEFINE_CUSTOM_NODEACTIVITY(CActivityCancelTest::ECancelTestActivity, CancelBindTo, TCFDataClient::TBindTo, CActivityCancelTest::NewL)
+    FIRST_NODEACTIVITY_ENTRY(CActivityCancelTest::TAwaitingMessageState<TCFDataClient::TBindTo>, MeshMachine::TNoTag)
+    THROUGH_NODEACTIVITY_ENTRY(KNoTag, CActivityCancelTest::TBeginTest, MeshMachine::TTag<KActiveTag>)
+    THROUGH_NODEACTIVITY_ENTRY(KActiveTag, CActivityCancelTest::TBeginLoop, MeshMachine::TNoTag)    
+    NODEACTIVITY_ENTRY(KNoTag, CActivityCancelTest::TProgressiveCancel, MeshMachine::TAcceptErrorState<MeshMachine::TAwaitingMessageState<TCFDataClient::TBindToComplete>  >, CActivityCancelTest::TNoTagForwardOrActiveTagBackward)
+    LAST_NODEACTIVITY_ENTRY(KNoTag, CActivityCancelTest::TEndTest)
+NODEACTIVITY_END()
+}
+
+
+
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -27,6 +27,7 @@
 #include "dummypr_metaconnprov.h"
 #include "dummypr_connprov.h"
 #include "dummypr_subconnprov.h"
+#include "activityTest.h"
 
 #include <elements/sd_mintercept.h>
 
@@ -51,12 +52,63 @@
 static const TUint KDefaultMaxPreallocatedActivityCount = 2;
 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
 static const TUint KDummyCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
+static const TUint KDestroyDelay = 3;
+static const TUint KMillion = 1000000;
 //-================================================
 //
 // States and Transitions
 //
 //-================================================
+CDelayTimer* CDelayTimer::NewL( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId )
+    {
+    CDelayTimer* timer = new(ELeave) CDelayTimer( aSender, aRecipient, aMessageId );
+    CleanupStack::PushL( timer );
+    timer->ConstructL();
+    CleanupStack::Pop();
+    return timer;
+    }
+
+CDelayTimer::~CDelayTimer()
+    { 
+    Cancel();
+    }
+    
+CDelayTimer::CDelayTimer( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ) :
+    CTimer( EPriorityStandard ),
+    iSender(aSender),
+    iRecipient(aRecipient),
+    iMessageId(aMessageId)
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+void CDelayTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+    
+void CDelayTimer::RunL()
+    {
+    CDelayTimer::TDelayMessage msg(iMessageId);
+    Messages::RClientInterface::OpenPostMessageClose(iSender->RecipientId() , iRecipient, msg );
+    delete this;
+    }
+
+void CDelayTimer::Start( TInt aIntervalInSecs )
+    {
+    After( TTimeIntervalMicroSeconds32( aIntervalInSecs * KMillion ) );
+    }
+
+CDelayTimer::TDelayMessage::TDelayMessage()
+    {
+    }
+
+CDelayTimer::TDelayMessage::TDelayMessage(const TNodeSignal::TMessageId& aMessageId)
+:   TSignatureBase(aMessageId)
+    {
+    }
+
+
 namespace DummyCPRStates
 {
 DEFINE_SMELEMENT(TSetClientAsIncoming, NetStateMachine::MStateTransition, DummyCPRStates::TContext)
@@ -86,6 +138,13 @@
 	createSCPR.DoL();
 	}
 
+DEFINE_SMELEMENT(TThreeSecDelayAndPostToSelf, NetStateMachine::MStateTransition, DummyCPRStates::TContext)
+void TThreeSecDelayAndPostToSelf::DoL()
+    {
+    CDelayTimer* delay = CDelayTimer::NewL(iContext.Node().ControlProvider(), iContext.NodeId(), iContext.iMessage.MessageId() );
+    delay->Start(KDestroyDelay);
+    }
+
 DEFINE_SMELEMENT(TAwaitingStart, NetStateMachine::MState, DummyCPRStates::TContext)
 TBool TAwaitingStart::Accept()
 	{
@@ -100,6 +159,24 @@
     	}
     return EFalse;
 	}
+
+DEFINE_SMELEMENT(TAwaitingDestroy, NetStateMachine::MState, DummyCPRStates::TContext)
+TBool TAwaitingDestroy::Accept()
+    {
+    const TLayerSelectionInfo* selectionInfo = static_cast<const TLayerSelectionInfo*>(
+        iContext.Node().AccessPointConfig().FindExtension(TLayerSelectionInfo::TypeId()));
+    ASSERT(selectionInfo); // should always be there
+
+    if (iContext.iMessage.IsMessage<TEChild::TDestroy>() && 
+            TCprConfigModifier::Is(selectionInfo->CprConfig(), TCprConfigModifier::ECPRWaitOnThreeSecDestroy)
+            && iContext.iNode.CountActivities(ECFActivityDummyCprDestroy) == 0 ) // only accept the first destroy which will subsequently be reposted to self after 3 second
+        {
+        static_cast<ESock::CMMCommsProviderBase&>(iContext.iNode).MarkMeForDeletion();
+        return ETrue;
+        }
+    return EFalse;
+    }
+
 }
 
 //-================================================
@@ -136,18 +213,47 @@
 NODEACTIVITY_END()
 }
 
+// Activity Map For test-code ridden cpr
+namespace DummyCprDestroyActivity
+{
+DECLARE_DEFINE_NODEACTIVITY(ECFActivityDummyCprDestroy, DummyCprDestroy, TEChild::TDestroy)
+    FIRST_NODEACTIVITY_ENTRY(DummyCPRStates::TAwaitingDestroy, MeshMachine::TNoTag)
+    NODEACTIVITY_ENTRY(KNoTag, DummyCPRStates::TThreeSecDelayAndPostToSelf, MeshMachine::TAwaitingMessageState<Messages::TEChild::TLeft>, MeshMachine::TTag<PRStates::KContinue>)
+    LAST_NODEACTIVITY_ENTRY(PRStates::KContinue, MeshMachine::TDoNothing)
+NODEACTIVITY_END()
+}
+
 // Activity Map
 namespace DummyCPRStates
 {
 DECLARE_DEFINE_ACTIVITY_MAP(stateMap)
    ACTIVITY_MAP_ENTRY(DummyCprBinderRequestActivity, DummyCprBinderRequest)
    ACTIVITY_MAP_ENTRY(DummyCprStartActivity, DummyCPrStart)
+   ACTIVITY_MAP_ENTRY(DummyCprDestroyActivity, DummyCprDestroy)
+ACTIVITY_MAP_END_BASE(MobilityCprActivities, mobilityCprActivities)
+}
+
+
+// Activity Map For vanilla cpr
+namespace VanillaDummyCPRStates
+{
+DECLARE_DEFINE_ACTIVITY_MAP(stateMap)
+   ACTIVITY_MAP_ENTRY(CancelTestBindToActivity, CancelBindTo)   
 ACTIVITY_MAP_END_BASE(MobilityCprActivities, mobilityCprActivities)
 }
 
 CDummyConnectionProvider* CDummyConnectionProvider::NewL(ESock::CConnectionProviderFactoryBase& aFactory, TConnType aConnStatus)
     {
-    CDummyConnectionProvider* self = new (ELeave) CDummyConnectionProvider(aFactory, aConnStatus);
+    CDummyConnectionProvider* self = new (ELeave) CDummyConnectionProvider(aFactory, DummyCPRStates::stateMap::Self(), aConnStatus);
+    CleanupStack::PushL(self);
+    self->ConstructL(KDummyCPRPreallocatedActivityBufferSize);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CDummyConnectionProvider* CDummyConnectionProvider::NewVanillaL(ESock::CConnectionProviderFactoryBase& aFactory)
+    {
+    CDummyConnectionProvider* self = new (ELeave) CDummyConnectionProvider(aFactory, VanillaDummyCPRStates::stateMap::Self(), CDummyConnectionProvider::EConnNoIncoming);
     CleanupStack::PushL(self);
     self->ConstructL(KDummyCPRPreallocatedActivityBufferSize);
     CleanupStack::Pop(self);
@@ -155,8 +261,8 @@
     }
 
 
-CDummyConnectionProvider::CDummyConnectionProvider(CConnectionProviderFactoryBase& aFactory, TConnType aConnStatus)
-:	CMobilityConnectionProvider(aFactory, DummyCPRStates::stateMap::Self()),
+CDummyConnectionProvider::CDummyConnectionProvider(CConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap, TConnType aConnStatus)
+:	CMobilityConnectionProvider(aFactory, aActivityMap),
 	TIfStaticFetcherNearestInHierarchy(this),
     iConnStatus(aConnStatus)
 	{
@@ -189,3 +295,5 @@
 
 
 
+
+
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -30,6 +30,7 @@
 #include "dummypr_metaconnprov.h"
 #include "dummypr_tiermanager.h"
 #include "dummypr_network_flow.h"
+#include "dummypr_flow.h"
 
 #include <comms-infras/ss_msgintercept.h>
 
@@ -44,8 +45,6 @@
 using namespace ESock;
 
 
-const TInt KProtocolInetDummy = 253;
-
 const TInt KDummyMajorVersionNumber = 0;
 const TInt KDummyMinorVersionNumber = 1;
 const TInt KDummyBuildVersionNumber = 1;
@@ -61,12 +60,14 @@
 	IMPLEMENTATION_PROXY_ENTRY(CDummyTierManagerFactory::iUid, CDummyTierManagerFactory::NewL),
 	IMPLEMENTATION_PROXY_ENTRY(CDummyMetaConnectionProviderFactory::iUid, CDummyMetaConnectionProviderFactory::NewL),
 	IMPLEMENTATION_PROXY_ENTRY(CDummyConnectionProviderFactory::iUid, CDummyConnectionProviderFactory::NewL),
-	IMPLEMENTATION_PROXY_ENTRY(CDummyHangingConnectionProviderFactory::iUid, CDummyHangingConnectionProviderFactory::NewL),	
+	IMPLEMENTATION_PROXY_ENTRY(CDummyHangingConnectionProviderFactory::iUid, CDummyHangingConnectionProviderFactory::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(CDummyVanillaConnectionProviderFactory::iUid, CDummyVanillaConnectionProviderFactory::NewL), 	
 	IMPLEMENTATION_PROXY_ENTRY(CDummySubConnectionProviderFactory::iUid, CDummySubConnectionProviderFactory::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(CDummyVanillaSubConnectionProviderFactory::iUid, CDummyVanillaSubConnectionProviderFactory::NewL),	
 	IMPLEMENTATION_PROXY_ENTRY(CDummyExtendedSubConnectionProviderFactory::iUid, CDummyExtendedSubConnectionProviderFactory::NewL),
 
 	// Flow and flow description
-	IMPLEMENTATION_PROXY_ENTRY(CDummyNetworkFlowFactory::iUid, CDummyNetworkFlowFactory::NewL),
+	IMPLEMENTATION_PROXY_ENTRY(CDummyFlowFactory::iUid, CDummyFlowFactory::NewL),
 	};
 
 /**
@@ -166,6 +167,26 @@
     return provider;
     }
 
+CDummyVanillaConnectionProviderFactory* CDummyVanillaConnectionProviderFactory::NewL(TAny* aParentContainer)
+    {
+    return new (ELeave) CDummyVanillaConnectionProviderFactory(TUid::Uid(CDummyVanillaConnectionProviderFactory::iUid), *reinterpret_cast<ESock::CConnectionFactoryContainer*>(aParentContainer));
+    }
+    
+CDummyVanillaConnectionProviderFactory::CDummyVanillaConnectionProviderFactory(TUid aFactoryId, ESock::CConnectionFactoryContainer& aParentContainer)
+    : ESock::CConnectionProviderFactoryBase(aFactoryId, aParentContainer)
+    {
+    //LOG_NODE_CREATE(KDummyCPRTag, CDummyHangingConnectionProviderFactory);
+    }
+
+ACommsFactoryNodeId* CDummyVanillaConnectionProviderFactory::DoCreateObjectL(TFactoryQueryBase& /* aQuery */)
+    {    
+    CConnectionProviderBase* provider = CDummyConnectionProvider::NewVanillaL(*this );
+    
+    ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider);
+
+    return provider;
+    }
+
 //-=========================================================
 //
 // CDummySubConnectionProviderFactory methods
@@ -209,8 +230,7 @@
 // CDummyExtendedSubConnectionProviderFactory methods
 //
 //-=========================================================	
-namespace ESock
-{
+
 CDummyExtendedSubConnectionProviderFactory* CDummyExtendedSubConnectionProviderFactory::NewL(TAny* aParentContainer)
     {
     return new (ELeave) CDummyExtendedSubConnectionProviderFactory(TUid::Uid(CDummyExtendedSubConnectionProviderFactory::iUid), 
@@ -230,7 +250,7 @@
 
     if ((query.iSCPRType == RSubConnection::EAttachToDefault) || (query.iSCPRType == RSubConnection::ECreateNew))
         {
-        provider = ESock::CDummyExtendedSubConnectionProvider::NewL(*this);
+        provider = CDummyExtendedSubConnectionProvider::NewL(*this);
 		ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider);
         }
     else
@@ -239,41 +259,74 @@
         }
     return provider;
     }
-}
+
+
 
 //-=========================================================
 //
-// CDummyNetworkFlowFactory methods
+// CDummyExtendedSubConnectionProviderFactory methods
+//
+//-=========================================================    
+CDummyVanillaSubConnectionProviderFactory* CDummyVanillaSubConnectionProviderFactory::NewL(TAny* aParentContainer)
+    {
+    return new (ELeave) CDummyVanillaSubConnectionProviderFactory(TUid::Uid(CDummyVanillaSubConnectionProviderFactory::iUid), 
+                                            *reinterpret_cast<ESock::CSubConnectionFactoryContainer*>(aParentContainer));
+    }
+    
+CDummyVanillaSubConnectionProviderFactory::CDummyVanillaSubConnectionProviderFactory(TUid aFactoryId, ESock::CSubConnectionFactoryContainer& aParentContainer)
+    : CSubConnectionProviderFactoryBase(aFactoryId, aParentContainer)
+    {
+    //LOG_NODE_CREATE(KDummyExtendedSCPRTag, CDummyExtendedSubConnectionProviderFactory);
+    }
+
+ACommsFactoryNodeId* CDummyVanillaSubConnectionProviderFactory::DoCreateObjectL(TFactoryQueryBase& aQuery)
+    {
+    const TDefaultSCPRFactoryQuery& query = static_cast<const TDefaultSCPRFactoryQuery&>(aQuery);    
+    CSubConnectionProviderBase* provider = NULL;
+
+    if ((query.iSCPRType == RSubConnection::EAttachToDefault) || (query.iSCPRType == RSubConnection::ECreateNew))
+        {
+        provider = CDummySubConnectionProvider::NewVanillaL(*this);
+        ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider);
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    return provider;
+    }
+
+//-=========================================================
+//
+// CDummyFlowFactory methods
 //
 //-=========================================================	
-namespace ESock
-{
-CDummyNetworkFlowFactory* CDummyNetworkFlowFactory::NewL(TAny* aConstructionParameters)
+CDummyFlowFactory* CDummyFlowFactory::NewL(TAny* aConstructionParameters)
 	{
-	CDummyNetworkFlowFactory* fact = new (ELeave) CDummyNetworkFlowFactory(
+	CDummyFlowFactory* fact = new (ELeave) CDummyFlowFactory(
 			TUid::Uid(iUid),
 			*(reinterpret_cast<CSubConnectionFlowFactoryContainer*>(aConstructionParameters)));
 	return fact;
 	}
 
-CDummyNetworkFlowFactory::CDummyNetworkFlowFactory(TUid aFactoryId, CSubConnectionFlowFactoryContainer& aParentContainer)
+CDummyFlowFactory::CDummyFlowFactory(TUid aFactoryId, CSubConnectionFlowFactoryContainer& aParentContainer)
  : CSubConnectionFlowFactoryBase(aFactoryId, aParentContainer)
  	{
-	//LOG_NODE_CREATE(KESockDataFactTag, CDummyNetworkFlowFactory)
+	//LOG_NODE_CREATE(KESockDataFactTag, CDummyFlowFactory)
  	}
 
-CDummyNetworkFlowFactory::~CDummyNetworkFlowFactory()
+CDummyFlowFactory::~CDummyFlowFactory()
 	{
-	//LOG_NODE_DESTROY(KESockDataFactTag, CDummyNetworkFlowFactory)
+	//LOG_NODE_DESTROY(KESockDataFactTag, CDummyFlowFactory)
  	}
 
-CSubConnectionFlowBase* CDummyNetworkFlowFactory::DoCreateFlowL(CProtocolIntfBase* aProtocolIntf, TFactoryQueryBase& aQuery)
+CSubConnectionFlowBase* CDummyFlowFactory::DoCreateFlowL(CProtocolIntfBase* aProtocolIntf, TFactoryQueryBase& aQuery)
 	{
 	const TDefaultFlowFactoryQuery& query = static_cast<const TDefaultFlowFactoryQuery&>(aQuery);
 	return CDummyNetworkFlow::NewL(*this, query.iSCprId, aProtocolIntf);
 	}
 
-ACommsFactoryNodeId* CDummyNetworkFlowFactory::DoFindOrCreateObjectL(TFactoryQueryBase& aQuery)
+ACommsFactoryNodeId* CDummyFlowFactory::DoFindOrCreateObjectL(TFactoryQueryBase& aQuery)
 	{
 	const TDefaultFlowFactoryQuery& query = static_cast<const TDefaultFlowFactoryQuery&>(aQuery);
 	if(query.iMessageId != TCFServiceProvider::TCommsBinderRequest::Id())
@@ -287,7 +340,7 @@
 	CProtocolIntfBase* protocolInterface = SockManGlobals::Get()->iProtocolIntfFactories->FindOrCreateProtocolIntfL(Uid(), queryProto);
 	if (protocolInterface == NULL)
     	{
-    	LOG( ESockLog::Printf(KESockDataFactTag, _L8("CDummyNetworkFlowFactory %08x:\tCreateFlowL(protocolId '%08x') Cannot find protocol interface, bailing out"), this, Uid()) );
+    	LOG( ESockLog::Printf(KESockDataFactTag, _L8("CDummyFlowFactory %08x:\tCreateFlowL(protocolId '%08x') Cannot find protocol interface, bailing out"), this, Uid()) );
     	User::Leave(KErrNotFound);
     	}
 
@@ -295,10 +348,14 @@
 	CSubConnectionFlowBase* flow = NULL;
 	switch(query.iProtocolType)
 		{
-		case KProtocolInetDummy:
+		case CDummyNetworkFlow::EProtocolId:
 			flow = CDummyNetworkFlow::NewL(*this, query.iSCprId, protocolInterface);
 			break;
 
+        case CDummyFlow::EProtocolId:
+            flow = CDummyFlow::NewL(*this, query.iSCprId, protocolInterface);
+            break;
+            
 		default:
 			User::Leave(KErrNotFound);
 			break;
@@ -306,7 +363,7 @@
 	
 	LOG( ESockLog::Printf(
 		KESockDataFactTag,
-		_L8("CDummyNetworkFlowFactory %08x:\tCreateFlowL(protocolId '%08x'): flow %08x"),
+		_L8("CDummyFlowFactory %08x:\tCreateFlowL(protocolId '%08x'): flow %08x"),
 		this,
 		Uid(),
 		&flow));
@@ -322,32 +379,53 @@
 /**
 Description of the protocol this factory creates
 */
-TServerProtocolDesc* CDummyNetworkFlowFactory::DoCreateFlowDescriptionL(TInt aProtocol)
+TServerProtocolDesc* CDummyFlowFactory::DoCreateFlowDescriptionL(TInt aProtocol)
 	{
 	TServerProtocolDesc* protocolDescription = new(ELeave) TServerProtocolDesc();
 
 	// Poached from udp and modified to represent an rtp like protocol
 	switch(aProtocol)
 		{
-		case KProtocolInetDummy:
-			protocolDescription->iName		  = KDummyProtocolName;
-			protocolDescription->iAddrFamily	  = KAfInet;
-			protocolDescription->iSockType	  = KSockDatagram;
-			protocolDescription->iProtocol	  = KProtocolInetDummy;
-			protocolDescription->iVersion	  = TVersion(KDummyMajorVersionNumber,
-										KDummyMinorVersionNumber,
-										KDummyBuildVersionNumber);
-			protocolDescription->iByteOrder	  = EBigEndian;
-			protocolDescription->iServiceInfo	  = KSIConnectionLess | KSIDatagram |
-									KSIGracefulClose | KSIPeekData |
-									KSIRequiresOwnerInfo;
-			protocolDescription->iNamingServices	  = KNSNameResolution | KNSRequiresConnectionStartup;
-			protocolDescription->iSecurity	  = KSocketNoSecurity;
-			protocolDescription->iMessageSize	  = 65536-128; /*KSocketMessageSizeUndefined;*/
-			protocolDescription->iServiceTypeInfo  = ESocketSupport | ETransport |
-									EPreferMBufChains | ENeedMBufs |
-									EUseCanSend;
-			protocolDescription->iNumSockets	  = KUnlimitedSockets;
+        case CDummyNetworkFlow::EProtocolId:
+            protocolDescription->iName          = KDummyProtocolName;
+            protocolDescription->iAddrFamily    = KAfInet;
+            protocolDescription->iSockType      = KSockDatagram;
+            protocolDescription->iProtocol      = CDummyNetworkFlow::EProtocolId;
+            protocolDescription->iVersion       = TVersion(KDummyMajorVersionNumber,
+                                                         KDummyMinorVersionNumber,
+                                                         KDummyBuildVersionNumber);
+            protocolDescription->iByteOrder     = EBigEndian;
+            protocolDescription->iServiceInfo   = KSIConnectionLess | KSIDatagram |
+                                                  KSIGracefulClose | KSIPeekData |
+                                                  KSIRequiresOwnerInfo;
+            protocolDescription->iNamingServices= KNSNameResolution | KNSRequiresConnectionStartup;
+            protocolDescription->iSecurity      = KSocketNoSecurity;
+            protocolDescription->iMessageSize   = 65536-128; /*KSocketMessageSizeUndefined;*/
+            protocolDescription->iServiceTypeInfo= ESocketSupport | ETransport |
+                                                      EPreferMBufChains | ENeedMBufs |
+                                                      EUseCanSend;
+            protocolDescription->iNumSockets     = KUnlimitedSockets;
+            break;
+	    
+		case CDummyFlow::EProtocolId:
+			protocolDescription->iName		     = KDummyProtocolName;
+			protocolDescription->iAddrFamily     = CDummyTierManagerFactory::iUid;
+			protocolDescription->iSockType	     = KSockDatagram;
+			protocolDescription->iProtocol	     = CDummyFlow::EProtocolId;
+			protocolDescription->iVersion	     = TVersion(KDummyMajorVersionNumber,
+                                                         KDummyMinorVersionNumber,
+                                                         KDummyBuildVersionNumber);
+			protocolDescription->iByteOrder	     = EBigEndian;
+			protocolDescription->iServiceInfo	 = KSIConnectionLess | KSIDatagram |
+                                                   KSIGracefulClose | KSIPeekData |
+                                                   KSIRequiresOwnerInfo;
+			protocolDescription->iNamingServices = KNSNameResolution | KNSRequiresConnectionStartup;
+			protocolDescription->iSecurity	     = KSocketNoSecurity;
+			protocolDescription->iMessageSize	 = 65536-128; /*KSocketMessageSizeUndefined;*/
+			protocolDescription->iServiceTypeInfo= ESocketSupport | ETransport |
+                                                    EPreferMBufChains | ENeedMBufs |
+                                                    EUseCanSend;
+			protocolDescription->iNumSockets	 = KUnlimitedSockets;
 			break;
 		
 		default:
@@ -357,5 +435,4 @@
 
 	return protocolDescription;
 	}
-}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_flow.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,439 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// Dummy implementation file for network tier flow
+//
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+#include <ss_std.h>
+#include <comms-infras/ss_log.h>
+#include <ss_pman.h>
+#include <comms-infras/ss_nodemessages_internal_esock.h>
+#include <comms-infras/ss_protocolparameterset.h>
+#include "dummypr_flow.h"
+
+
+#ifdef _DEBUG
+// Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
+// (if it could happen through user error then you should give it an explicit, documented, category + code)
+_LIT(KSpecAssert_ESockTestdmyprnt, "ESockTestdmyprnt");
+#endif
+
+using namespace ESock;
+using namespace Messages;
+
+
+
+
+// Construction
+//-------------
+CDummyFlow* CDummyFlow::NewL(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf)
+	{
+	CDummyFlow* self = new (ELeave) CDummyFlow(aFactory, aSubConn, aProtocolIntf);
+	return self;
+	}
+
+CDummyFlow::CDummyFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf)
+: CSubConnectionFlowBase(aFactory, aSubConn, aProtocolIntf)
+	{
+    LOG_NODE_CREATE(KESockFlowTag, CDummyFlow)
+	}
+
+CDummyFlow::~CDummyFlow()
+	{
+    LOG_NODE_DESTROY(KESockFlowTag, CDummyFlow)
+	}
+
+MSessionControl* CDummyFlow::GetControlL(
+	TInt /*aSessionType*/,
+	MSessionControlNotify& aSessionControlNotify)
+    {
+	// Apply binding locally
+	__ASSERT_DEBUG(iSessionControlNotify == NULL, User::Panic(KSpecAssert_ESockTestdmyprnt, 1));
+	iSessionControlNotify = &aSessionControlNotify;
+
+	return this;
+    }
+
+MSessionData* CDummyFlow::BindL(MSessionDataNotify& aNotify)
+    {
+	LOG( ESockLog::Printf(_L8("CDummyFlow %08x:\tBindL(aNotify 0x%08x)"), this, &aNotify) );
+
+	// Apply binding locally
+	__ASSERT_DEBUG(iSessionDataNotify == NULL, User::Panic(KSpecAssert_ESockTestdmyprnt, 3));
+	iSessionDataNotify = &aNotify;
+	iSubConnectionProvider.RNodeInterface::PostMessage(
+		Id(),
+		TCFControlProvider::TActive().CRef());
+	return this;
+    }
+
+void CDummyFlow::Unbind()
+    {
+	LOG( ESockLog::Printf(_L8("CDummyFlow %08x:\tUnbind()"), this) );
+	ASSERT(iSessionDataNotify); //who else is it calling then?
+
+    iSessionControlNotify = NULL;
+    iSessionDataNotify = NULL;
+
+    ASSERT(iSubConnectionProvider.IsOpen());
+    iSubConnectionProvider.RNodeInterface::PostMessage(
+        Id(),
+        TCFControlProvider::TIdle().CRef()
+        );
+    }
+
+ESock::CSubConnectionFlowBase& CDummyFlow::CloneFlowL()
+    {
+    TDefaultFlowFactoryQuery query (iProtocolIntf->ControlProviderId(), iSubConnectionProvider.RecipientId());
+
+	ESock::CSubConnectionFlowBase& flow = static_cast<ESock::CSubConnectionFlowBase&>(*(Factory().CreateObjectL(query)));
+
+	// Have the new flow become a data client of our subconnection too
+	__ASSERT_DEBUG(iSubConnectionProvider.IsOpen(), User::Panic(KSpecAssert_ESockTestdmyprnt, 6));
+	TCFPeer::TJoinRequest msg(
+		flow.Id(),
+		TCFClientType(TCFClientType::EData, TCFClientType::EActive)
+		);
+
+	iSubConnectionProvider.PostMessage(Id(), msg);
+
+	return flow;
+    }
+
+CSubConnectionFlowBase* CDummyFlow::Flow()
+	{
+	return this;
+	}
+
+
+// MSessionControl
+//----------------
+void CDummyFlow::Start()
+	{/*__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 7)); return iLowerFlowControl->Start()*/;}
+
+void CDummyFlow::LocalName(TSockAddr& anAddr) const
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 8)); return iLowerFlowControl->LocalName(anAddr);}
+
+void CDummyFlow::SetLocalName(TSockAddr& /*anAddr*/)
+	{
+    // Fetch the current flow parameters (those that were sent to us) and create a new set for the flow we want
+    TFlowParams flowParams;
+    flowParams.iProtocol = CDummyFlow::EProtocolId;
+    flowParams.iSocketType = KSockDatagram;
+
+    // Create and load a parameter set with the flow parameters that form our binder request
+    CFlowRequestParameters* paramSet = CFlowRequestParameters::NewL();
+    CleanupStack::PushL(paramSet);
+    paramSet->SetFlowParams(flowParams);
+    RCFParameterFamilyBundle flowParamsBundle;
+    flowParamsBundle.CreateL();
+    RParameterFamily family = flowParamsBundle.CreateFamilyL(KFlowParametersFamily);
+    family.AddParameterSetL(paramSet, RParameterFamily::ERequested);
+
+    iParamBundle.Open(flowParamsBundle);
+    // Construct and send the message
+    iSubConnectionProvider.RNodeInterface::PostMessage(
+        Id(),
+        TCFControlProvider::TNoBearer(iParamBundle).CRef()
+        );
+
+    CleanupStack::Pop(paramSet);
+ 	}
+
+void CDummyFlow::RemName(TSockAddr& anAddr) const
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 10)); iLowerFlowControl->RemName(anAddr);}
+
+TInt CDummyFlow::SetRemName(TSockAddr& anAddr)
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 11)); return iLowerFlowControl->SetRemName(anAddr);}
+
+const TInt KDummyNetworkFlowOptionLevel = CDummyFlowFactory::iUid;
+const TInt KFlowProtocolName = 1;
+
+TInt CDummyFlow::GetOption(TUint aLevel, TUint aName, TDes8& anOption) const
+	{
+	__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 12));
+
+	if(aLevel == KDummyNetworkFlowOptionLevel && aName == KFlowProtocolName)
+		{
+		anOption.Copy(KDummyProtocolName);
+		return KErrNone;
+		}
+	else
+		{
+		return iLowerFlowControl->GetOption(aLevel, aName, anOption);
+		}
+	}
+
+void CDummyFlow::Ioctl(TUint aLevel, TUint aName, TDes8* anOption)
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 13)); iLowerFlowControl->Ioctl(aLevel, aName, anOption);}
+
+void CDummyFlow::CancelIoctl(TUint aLevel, TUint aName)
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 14)); iLowerFlowControl->CancelIoctl(aLevel, aName);}
+
+TInt CDummyFlow::SetOption(TUint /*aLevel*/, TUint /*aName*/, const TDesC8 &/*anOption*/)
+	{ return KErrNone; }
+
+void CDummyFlow::ActiveOpen()
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 16)); iLowerFlowControl->ActiveOpen();}
+
+void CDummyFlow::ActiveOpen(const TDesC8& aConnectionData)
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 17)); iLowerFlowControl->ActiveOpen(aConnectionData);}
+
+TInt CDummyFlow::PassiveOpen(TUint aQueueSize)
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 18)); return iLowerFlowControl->PassiveOpen(aQueueSize);}
+
+TInt CDummyFlow::PassiveOpen(TUint aQueueSize, const TDesC8& aConnectionData)
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 19)); return iLowerFlowControl->PassiveOpen(aQueueSize, aConnectionData);}
+
+void CDummyFlow::Shutdown(MSessionControl::TCloseType aOption)
+	{ 
+    if (iLowerFlowControl)
+        { 
+        iLowerFlowControl->Shutdown(aOption);
+        }
+    else
+        {
+        iSessionControlNotify->CanClose(MSessionControlNotify::EDelete);
+        }
+	}
+
+void CDummyFlow::Shutdown(MSessionControl::TCloseType aOption, const TDesC8& aDisconnectionData)
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 21)); iLowerFlowControl->Shutdown(aOption, aDisconnectionData);}
+
+void CDummyFlow::AutoBind()
+	{__ASSERT_DEBUG(iLowerFlowControl, User::Panic(KSpecAssert_ESockTestdmyprnt, 22));	iLowerFlowControl->AutoBind();}
+
+TInt CDummyFlow::SecurityCheck(MProvdSecurityChecker* /*aChecker*/)
+	{ return KErrNone;}
+
+
+// MSessionData
+//-------------
+TUint CDummyFlow::Write(const TDesC8& aDesc, TUint aOptions, TSockAddr* anAddr)
+	{__ASSERT_DEBUG(iLowerFlowData, User::Panic(KSpecAssert_ESockTestdmyprnt, 24));	return iLowerFlowData->Write(aDesc, aOptions, anAddr);}
+
+TInt CDummyFlow::Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr)
+	{__ASSERT_DEBUG(iLowerFlowData, User::Panic(KSpecAssert_ESockTestdmyprnt, 25));	return iLowerFlowData->Write(aData, aOptions, anAddr);}
+
+void CDummyFlow::GetData(TDes8& aDesc, TUint aOptions, TSockAddr* anAddr)
+	{__ASSERT_DEBUG(iLowerFlowData, User::Panic(KSpecAssert_ESockTestdmyprnt, 26));	iLowerFlowData->GetData(aDesc, aOptions, anAddr);}
+
+TInt CDummyFlow::GetData(RMBufChain& aData, TUint aLength, TUint aOptions, TSockAddr* anAddr)
+	{__ASSERT_DEBUG(iLowerFlowData, User::Panic(KSpecAssert_ESockTestdmyprnt, 27));	return iLowerFlowData->GetData(aData, aLength, aOptions, anAddr);}
+
+
+// MSessionControlNotify
+//----------------------
+void CDummyFlow::ConnectComplete()
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 28));	iSessionControlNotify->ConnectComplete();}
+
+void CDummyFlow::ConnectComplete(const TDesC8& aConnectData)
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 29));	iSessionControlNotify->ConnectComplete(aConnectData);}
+
+void CDummyFlow::ConnectComplete(CSubConnectionFlowBase& anSSP)
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 30));	iSessionControlNotify->ConnectComplete(anSSP);}
+
+void CDummyFlow::ConnectComplete(CSubConnectionFlowBase& anSSP,const TDesC8& aConnectData)
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 31));	iSessionControlNotify->ConnectComplete(anSSP, aConnectData);}
+
+void CDummyFlow::CanClose(MSessionControlNotify::TDelete aDelete)
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 32));	iSessionControlNotify->CanClose(aDelete);}
+
+void CDummyFlow::CanClose(
+	const TDesC8& aDisconnectData,
+	MSessionControlNotify::TDelete aDelete)
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 33));	iSessionControlNotify->CanClose(aDisconnectData, aDelete);}
+
+TInt CDummyFlow::Error(TInt anError,TUint anOperationMask)
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 34));	return iSessionControlNotify->Error(anError, anOperationMask);}
+
+void CDummyFlow::Disconnect()
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 35));	iSessionControlNotify->Disconnect();}
+
+void CDummyFlow::Disconnect(TDesC8& aDisconnectData)
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 36));	iSessionControlNotify->Disconnect(aDisconnectData);}
+
+void CDummyFlow::IoctlComplete(TDesC8* aBuf)
+	{__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 37));	iSessionControlNotify->IoctlComplete(aBuf);}
+
+void CDummyFlow::DisconnectFromListener(CSubConnectionFlowBase& aSSP)
+	{
+		__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 53));
+        iSessionControlNotify->DisconnectFromListener(aSSP);
+    }
+void CDummyFlow::SetLocalNameComplete()
+	{
+	__ASSERT_DEBUG(iSessionControlNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 52));
+	iSessionControlNotify->SetLocalNameComplete();
+	}
+
+// MSessionDataNotify
+//-------------------
+void CDummyFlow::NewData(TUint aCount)
+	{__ASSERT_DEBUG(iSessionDataNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 39)); iSessionDataNotify->NewData(aCount);}
+
+void CDummyFlow::CanSend()
+	{__ASSERT_DEBUG(iSessionDataNotify, User::Panic(KSpecAssert_ESockTestdmyprnt, 40)); iSessionDataNotify->CanSend();}
+
+MFlowBinderControl* CDummyFlow::DoGetBinderControlL()
+	{
+	return this;
+	}
+
+
+// Node stuff
+//-----------
+void CDummyFlow::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage)
+    {
+    CSubConnectionFlowBase::ReceivedL(aSender, aRecipient, aMessage);
+    TInt err = KErrNone;
+    
+	if ( aMessage.IsMessage<TEBase::TError>() )
+		{
+		ASSERT(EFalse); //To be implemented
+		}
+	else if ( aMessage.IsMessage<TCFControlProvider::TBearer>() )
+        {
+        }
+	else if (aMessage.IsMessage<TCFInternalEsock::TFlowProvision>())
+	    {
+	    }
+	else if (TEChild::ERealmId == aMessage.MessageId().Realm())
+		{
+		switch (aMessage.MessageId().MessageId())
+			{
+		case TEChild::TDestroy::EId :
+		    DeleteThisFlow();
+			break;
+		default:
+			__ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ESockTestdmyprnt, 41)); //For debug configurations
+			User::Leave(KErrNotSupported); //For release configurations
+			}
+		}
+	else if (TCFDataClient::ERealmId == aMessage.MessageId().Realm())
+		{
+		switch (aMessage.MessageId().MessageId())
+			{
+		case TCFDataClient::TStart::EId :
+		    iSubConnectionProvider.PostMessage(Id(), TCFDataClient::TStarted().CRef());
+			break;
+		case TCFDataClient::TStop::EId :
+            iParamBundle.Close(); //[RZ] There is a problem with RCFParameterBundle. Nominally this should be cleared (closed) on TBeaer
+                                  //but that means that this thread (which constructed the bundle) will call Close before the recipient
+                                  //refcounting will mean that it's the recipient that would then dealocate and crash against different heap.
+                                  //Best if RCFParameterBundle were changed. Alternativelly, CNoBearer could get rid of the params 
+                                  //earlier.
+
+		    if (iLowerFlowBinderControl)
+		           {
+		           iLowerFlowBinderControl->Unbind(NULL,NULL);
+		           iLowerFlowBinderControl->Unbind();
+		           iLowerFlowBinderControl = NULL;
+		           iLowerFlowControl = NULL;
+		           iLowerFlowData = NULL;
+		           }
+
+		       iSubConnectionProvider.PostMessage(Id(), TCFDataClient::TStopped(
+                           message_cast<TCFDataClient::TStop>(aMessage).iValue).CRef());
+			break;
+		case TCFDataClient::TProvisionConfig::EId:
+			break;
+		case TCFDataClient::TBindTo::EId:
+		    {
+			TCFDataClient::TBindTo& bindToMsg(static_cast<TCFDataClient::TBindTo&>(aMessage));
+			TRAP(err, BindToL(bindToMsg));
+
+	        if(err == KErrNone)
+	            {
+	            RClientInterface::OpenPostMessageClose(Id(), aSender, TCFDataClient::TBindToComplete().CRef());
+	            }
+	        else
+	            {
+	            RClientInterface::OpenPostMessageClose(Id(), aSender, TEBase::TError(aMessage.MessageId(), err).CRef());
+	            }
+	        
+			if (iSessionControlNotify && !iParamBundle.IsNull())
+			    {
+                iSessionControlNotify->SetLocalNameComplete();
+			    }
+		    }
+			break;
+		default:
+			__ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ESockTestdmyprnt, 42)); //For debug configurations
+			User::Leave(KErrNotSupported); //For release configurations
+			}
+		}
+	else
+		{
+    	__ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ESockTestdmyprnt, 45)); //For debug configurations
+    	User::Leave(KErrNotSupported); //For release configurations
+		}
+    }
+
+void CDummyFlow::BindToL(TCFDataClient::TBindTo& aBindTo)
+/**
+Request from control side (at network layer) to indicate that the SubConnection is
+up and running and that we should bind to a Flow below.
+
+@param aLowerFlow Flow below to bind to.
+*/
+	{
+	//provisioning message must come before bindto in case we didn't get it after we've joined
+	//the sub-connection
+    if (aBindTo.iNodeId == Messages::TNodeId::NullId())
+        {
+        return;
+        }
+	NM_LOG((KESockServerTag, _L8("CDummyFlow %08x:\tSynchronous call: From=%08x To=%08x Func=BindToL"),
+			this, static_cast<Messages::ANode*>(this), &aBindTo.iNodeId.Node()) )
+
+	const TNodeId& commsId = aBindTo.iNodeId;
+
+#if defined(__GCCXML__)
+    CSubConnectionFlowBase* flow = reinterpret_cast<CSubConnectionFlowBase*>(&commsId.Node());
+#else
+	CSubConnectionFlowBase* flow = Messages::mnode_cast<CSubConnectionFlowBase>(&commsId.Node());
+#endif
+
+	// Flows can only be directly bound when running in the same thread
+	__ASSERT_DEBUG(commsId.Thread() == Id().Thread(), User::Panic(KSpecAssert_ESockTestdmyprnt, 47));
+
+	if (iLowerFlowBinderControl && iLowerFlowBinderControl->Flow() != flow )
+		{
+		// Already bound to something else so unbind first
+		iLowerFlowBinderControl->Unbind(NULL,NULL);
+		iLowerFlowBinderControl = NULL;
+
+		iLowerFlowBinderControl->Unbind();
+		iLowerFlowControl = NULL;
+		iLowerFlowData = NULL;
+		}
+
+	if (iLowerFlowBinderControl == NULL)
+		{
+		// Protocol binding
+		iLowerFlowBinderControl = flow->GetBinderControlL();
+		iLowerFlowControl = iLowerFlowBinderControl->GetControlL(KSockDatagram, *this);
+		iLowerFlowData = iLowerFlowBinderControl->BindL(*this);
+		}
+	}
+
+
+
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_network_flow.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_network_flow.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -165,7 +165,7 @@
 TInt CDummyNetworkFlow::SetRemName(TSockAddr& anAddr)
 	{__ASSERT_DEBUG(iFlowShim, User::Panic(KSpecAssert_ESockTestdmyprnt, 11)); return iFlowShim->SetRemName(anAddr);}
 
-const TInt KDummyNetworkFlowOptionLevel = CDummyNetworkFlowFactory::iUid;
+const TInt KDummyNetworkFlowOptionLevel = CDummyFlowFactory::iUid;
 const TInt KFlowProtocolName = 1;
 
 TInt CDummyNetworkFlow::GetOption(TUint aLevel, TUint aName, TDes8& anOption) const
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp	Fri Jun 11 14:52:21 2010 +0300
@@ -27,6 +27,7 @@
 
 #include "dummypr_subconnprov.h"
 #include "dummypr_metaconnprov.h"
+#include "activityTest.h"
 
 #include <elements/sd_mintercept.h>
 
@@ -92,8 +93,46 @@
 	return (iContext.iMessage.IsMessage<TCFDataClient::TStart>() && 
 			TCprConfigModifier::Is(selectionInfo->CprConfig(), TCprConfigModifier::ESCPRHangOnStart));
 	}
+
+DEFINE_SMELEMENT(TCancelPreviousSelfRequest, NetStateMachine::MStateTransition, DummySCPRStates::TContext)
+void TCancelPreviousSelfRequest::DoL()
+    {
+    iContext.iNodeActivity->PostRequestTo(iContext.Node().Id(), Messages::TEBase::TCancel().CRef());
+    }
+
+DEFINE_SMELEMENT(TRebindSelf, NetStateMachine::MStateTransition, DummySCPRStates::TContext)
+void TRebindSelf::DoL()
+    {
+    iContext.iNodeActivity->PostRequestTo(iContext.Node().Id(), TCFDataClient::TBindTo(Messages::TNodeId::NullId()).CRef());
+    }
+
+
+
+
+CrazyIdle::~CrazyIdle()
+    {
+    ASSERT(PostedToNodeId()==Messages::TNodeId::NullId());
+    }
+
+MeshMachine::CNodeActivityBase* CrazyIdle::NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+    {
+    return new(ELeave)CrazyIdle(aActivitySig, aNode);
+    }
+
+DEFINE_SMELEMENT(CrazyIdle::TAwaitingCancelled, NetStateMachine::MState, DummySCPRStates::TContext)
+TBool CrazyIdle::TAwaitingCancelled::Accept()
+    {
+    if (iContext.iMessage.IsMessage<Messages::TEBase::TError>())
+        {
+        ASSERT(iContext.iNodeActivity);
+        iContext.iNodeActivity->SetPostedTo(iContext.iNodeActivity->SoleOriginator().Peer().RecipientId());
+        }
+    return EFalse;
+    }
 }
 
+
+
 namespace DummySCprParamsRequest
 {
 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
@@ -133,20 +172,73 @@
 NODEACTIVITY_END()
 }
 
-// Activity Map
+namespace CrazyIdleActivity
+{
+//CrazyIdleActivity is used to test yet another angle of the meshmachine cancelling behaviour.
+//What it does is:
+//(1) responds to TIdle with an attempt to bind the sender, then, without waiting for the bind to complete
+//(2) responds to TIdle normally (by deleting the sender)
+//(3) cancells the bind request
+//What it tests is:
+//For two related nodes and upon the teardown of their relation there is an obligation to synchronise the activities
+//running on the nodes and awaiting responses from each other. This obligation is put on the requestee, i.e.: a node that perfomes
+//an activity on behalf of a leaving node should gracefully terminate that activity (by having the activity respond to the requestor. 
+//That obligation therefore doesn't rest on the requestor (someone, but not everyone, needs to do something).
+//There's trivial race condition arising from this distribution of responsibility, i.e.: the requestor activity may decide to 
+//cancel when the relation is being terminated and TCancel may hit void. Activities must be resilient to this and not send
+//TCancels to disappearing nodes. CrazyIdleActivity tests precislely this: it initaites an activity (TBindTo), then tears down the
+//relation and cancels the previously initiated activity (TBindTo). CrazyIdleActivity must wrap up gracefully. 
+DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityDataClientIdle, crazyIdle, TCFControlProvider::TIdle, DummySCPRStates::CrazyIdle::NewL)
+    FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientIdle, MeshMachine::TNoTag)
+    //Issue TBindTo to self (this will then bind the data client reporting TIdle). Wait for BindTo activity to start before 
+    //telling the dataclient to go away (TDestroy) as otherwise TBindTo won't make it in sending TBindTo to the dataclient.
+    THROUGH_NODEACTIVITY_ENTRY(KNoTag, DummySCPRStates::TRebindSelf, DummySCPRStates::TNoTagWaitForBindTo)
+    THROUGH_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::THandleDataClientIdle, MeshMachine::TNoTag)
+    //There's an additional test peformed by DummySCPRStates::CrazyIdle::TAwaitingCancelled. The state sets the postedto of CrazyIdle
+    //to point at the dataclient and CrazyIdle::~CrazyIdle asserts that that postedto is cleared. Currently PostedTo isn't cleared automatically - some people
+    //argued that it shouldn't and that activities should clear postedto whenever it's good for them. Unfortunatelly some activities are
+    //a bit lousy doing this and in result they can store a postedto pointing a node that has responded to the request a long time ago
+    //and above all a node that may have a long time ago left. A facility has been added to meshmachine to clear postedto when the node pointed
+    //at it actually leaves. This facility is tested collectivelly by DummySCPRStates::CrazyIdle::TAwaitingCancelled and CrazyIdle::~CrazyIdle
+    NODEACTIVITY_ENTRY(KNoTag, DummySCPRStates::TCancelPreviousSelfRequest, DummySCPRStates::CrazyIdle::TAwaitingCancelled, DummySCPRStates::TNoTagWaitNoDataClients)
+    LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
+NODEACTIVITY_END()
+}
+
+
+
+// Activity Map For test-code ridden scpr
 namespace DummySCPRStates
 {
 DEFINE_ACTIVITY_MAP(stateMap)
    ACTIVITY_MAP_ENTRY(DummySCprParamsRequest, dummySCprParamRequest)
    ACTIVITY_MAP_ENTRY(DummyBindToActivity, dummyBindTo)
    ACTIVITY_MAP_ENTRY(DummyBreakStartActivity, dummyBreakSCPrStart)   
-   ACTIVITY_MAP_ENTRY(DummyStartActivity, dummySCPrStart)   
+   ACTIVITY_MAP_ENTRY(DummyStartActivity, dummySCPrStart)
+   ACTIVITY_MAP_ENTRY(CrazyIdleActivity, crazyIdle)     
+ACTIVITY_MAP_END_BASE(SCprActivities, coreSCprActivities)
+}
+
+// Activity Map For vanilla cpr
+namespace VanillaDummySCPRStates
+{
+DECLARE_DEFINE_ACTIVITY_MAP(stateMap)
+        ACTIVITY_MAP_ENTRY(CancelTestBindToActivity, CancelBindTo)   
 ACTIVITY_MAP_END_BASE(SCprActivities, coreSCprActivities)
 }
 
 CDummySubConnectionProvider* CDummySubConnectionProvider::NewL(ESock::CSubConnectionProviderFactoryBase& aFactory)
     {
-    CDummySubConnectionProvider* self = new (ELeave) CDummySubConnectionProvider(aFactory);
+    CDummySubConnectionProvider* self = new (ELeave) CDummySubConnectionProvider(aFactory, DummySCPRStates::stateMap::Self());
+    CleanupStack::PushL(self);
+    self->ConstructL(KDummySCPRPreallocatedActivityBufferSize);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CDummySubConnectionProvider* CDummySubConnectionProvider::NewVanillaL(ESock::CSubConnectionProviderFactoryBase& aFactory)
+    {
+    CDummySubConnectionProvider* self = new (ELeave) CDummySubConnectionProvider(aFactory, VanillaDummySCPRStates::stateMap::Self());
     CleanupStack::PushL(self);
     self->ConstructL(KDummySCPRPreallocatedActivityBufferSize);
     CleanupStack::Pop(self);
@@ -154,8 +246,8 @@
     }
 
 
-CDummySubConnectionProvider::CDummySubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory)
-:CCoreSubConnectionProvider(aFactory,DummySCPRStates::stateMap::Self())
+CDummySubConnectionProvider::CDummySubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap)
+:CCoreSubConnectionProvider(aFactory, aActivityMap)
 	{
 	LOG_NODE_CREATE(KDummySCPRTag, CDummySubConnectionProvider);
 	}
@@ -210,3 +302,5 @@
 
 
 
+
+
--- a/datacommsserver/networkcontroller/group/networking_netcon.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/networkcontroller/group/networking_netcon.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	networking_netcon
 source	\sf\os\commsfw\datacommsserver\networkcontroller
 binary	\sf\os\commsfw\datacommsserver\networkcontroller\group	all
--- a/datacommsserver/networkingdialogapi/default/networking_dialog_default.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/networkingdialogapi/default/networking_dialog_default.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	networking_dialog_default
 
 source  \sf\os\commsfw\datacommsserver\networkingdialogapi\default
--- a/datacommsserver/networkingdialogapi/group/networking_dialog.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/networkingdialogapi/group/networking_dialog.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	networking_dialog
 
 source  \sf\os\commsfw\datacommsserver\networkingdialogapi\group
--- a/datacommsserver/networkingdialogapi/inc/AgentDialog.h	Thu May 27 14:07:49 2010 +0300
+++ b/datacommsserver/networkingdialogapi/inc/AgentDialog.h	Fri Jun 11 14:52:21 2010 +0300
@@ -1,5 +1,5 @@
 /**
-* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -22,7 +22,7 @@
 /**
  @file
  @publishedAll
- @released
+ @deprecated
 */
 
 #ifndef __AGENTDIALOG_H__
@@ -37,7 +37,7 @@
 /**
 Server name in EKA2 case
 @publishedAll
-@released
+@deprecated
 */
 _LIT(KCommsDialogServerName, "!NetDialDialogServer");
 
@@ -50,7 +50,7 @@
 Specifies the rank and desired direction of the connection and bearer.
 
 @publishedAll
-@released
+@deprecated
 */
 	{
 public:
@@ -64,7 +64,7 @@
 Specifies the Connection Names for ISP.
 
 @publishedAll
-@released
+@deprecated
 */
 	{
 public:
@@ -80,7 +80,7 @@
 Specifies the Authentication for the User Name and Password.
 
 @publishedAll
-@released
+@deprecated
 */
 	{
 public:
@@ -93,7 +93,7 @@
 Allows the user to see the login script running, see what is sent and received, and allows the user to type responses.
 
 @publishedAll
-@released
+@deprecated
 */
 	{
 public:
@@ -105,7 +105,7 @@
 Specifies Connection Preference for the New IAP.
 
 @publishedAll
-@released
+@deprecated
 */
 	{
 public:
@@ -123,7 +123,7 @@
 implementation.
 
 @publishedAll
-@released
+@deprecated
 */
 	{
 public :
@@ -139,7 +139,7 @@
 have to implement the API as a client server mechanism.
 
 @publishedAll
-@released
+@deprecated
 */
 	{
 public:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/bld.inf	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,34 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+//
+
+
+PRJ_EXPORTS
+
+
+//-- CommsFramework Overall IBY File
+./commsframework.iby			/epoc32/rom/include/commsframework.iby
+
+//-- CommsFramework Test OBY/IBY Files
+./commsframeworktest.iby		/epoc32/rom/include/commsframeworktest.iby
+
+PRJ_TESTEXPORTS
+// File run before every hardware test that can be added to pre-ROM build
+./te_initialiseboard.script	z:/testdata/scripts/te_initialiseboard.script
+
+PRJ_MMPFILES
+
+
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/commsframework.iby	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,150 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+// ROM include description for all networking and comms-infras components.
+// 
+//
+
+/**
+ @file
+*/
+
+
+#ifndef __NETWORK_IBY__
+#define __NETWORK_IBY__
+
+#define SYMBIAN_NETWORKING_UPS
+
+//==========================================================
+//================ Networking Components ===================
+//==========================================================
+
+//================ Comms-Infras Subsystem ==================
+#include <commslog.iby>
+
+#include <commdb.iby>	
+#include <commsdat.iby>
+
+#include <esock.iby>
+#include <nifman.iby>
+#include <commsrootserver.iby>
+
+#ifdef SYMBIAN_ZERO_COPY_NETWORKING
+#include <commsbufs.iby>
+#else
+#include <mbufmgr.iby>
+#endif
+
+#include <commsfw.iby>
+
+//Elements
+#include <messageintercept.iby>
+#include <commsfw.iby>
+#include <factories.iby>
+#include <meshmachine.iby>
+#include <NETMSG.iby>
+#include <NetInterfaces.iby>
+#include <NETMessages.iby>
+#include <NetMeta.iby>
+#include <NETSubscribe.iby>
+#include <nodemessages.iby>
+#include <ResponseMsg.iby>
+#include <rootserver.iby>
+#include <serverden.iby>
+#include <NETStSrv.iby>
+#include <NETSM.iby>
+#include <virtualconstructors.iby>
+
+#include <simpleselectorbase.iby>
+#include <coreproviders.iby>
+#include <coreprovidersecom.iby>
+#include <mobilitycoreproviders.iby>
+#ifdef SYMBIAN_NETWORKING_UPS
+#include <netups.iby>
+#include <upscoreproviders.iby>
+#endif
+#include <agentpr.iby>
+#include <agentprcore.iby>
+#include <netcfgext.iby>
+
+//================ Networking Subsystem ====================
+
+// tcpip6 components
+#include <tcpip6.iby>
+#include <dnd.iby>
+#include <inhook6.iby>
+#include <insock.iby>
+
+//Napt
+#include <napt.iby>
+
+// SSL
+#include <tls.iby>
+
+//Netcon, agents and test dialog server
+#include <CSD.IBY>
+#include <psdagt.iby>
+#include <nullagt.iby>
+
+
+#include <agentdialog.iby>
+
+//PPP and compressor modules
+#include <ppp.iby>
+#include <PREDCOMP.IBY>
+
+
+#include <rawipnif.iby>
+
+//Ethernet and DHCP
+// Note, DHCP may exist without ethernet, for example in a GPRS system.
+
+#ifdef HAS_ETHERNET
+#include <ether802.iby>
+#endif // HAS_ETHERNET
+
+#include <DHCPServ.iby>
+#include <ipeventnotifier.iby>
+
+//QoS Components
+#include <umtsif.iby>
+#include <pfqoslib.iby>
+#include <qos.iby>
+#include <guqos.iby>
+#include <qoslib.iby>
+
+#include <qosextnapi.iby>
+// SYMBIAN_NETWORKING_UMTSR5 
+
+
+#include <qos3gpp.iby>
+
+#include <ipproto.iby>
+#include <iptransport.iby>
+#include <pdp.iby>
+#include <QosIPSCPR.iby>
+
+#ifdef SYMBIAN_INCLUDE_PUNYCODE
+#include <punycodeconverter.iby>
+#endif //SYMBIAN_INCLUDE_PUNYCODE
+
+REM --- DNS Proxy 
+
+#ifndef SYMBIAN_EXCLUDE_DNS_Proxy 
+#include <networking_dnsproxy.iby>
+#endif 
+
+REM --- TimzoneLocalization - needed for libc.dll
+#include <timezonelocalization.iby>
+
+#endif // __NETWORK_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/commsframeworktest.iby	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* 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:
+*
+*/
+#ifndef __NETWORKING_TEST_IBY__
+#define __NETWORKING_TEST_IBY__
+
+// *****************************************************************************
+// From 9.5 onwards ROM space is becoming a little tight
+// Rom builds from 9.5 onwards should specify the subset of tests to be
+// included with the -D flag. E.g. -DNW_TEST_ROM1 
+// 
+// If a subset of tests is not specified all will be included - maintaining 
+// compatibility for unaware rom builds
+// *****************************************************************************
+
+#if !(defined(NW_TEST_ROM_1) || defined(NW_TEST_ROM_2) || defined(NW_TEST_ROM_3) \
+	|| defined(CI_TEST_ROM_1) || defined(CI_TEST_ROM_2) || defined(CI_TEST_ROM_3) || defined(CI_TEST_ROM_4) \
+	|| defined(WAPSTACK_TEST_ROM) \
+	|| defined(SERCOMMS_TEST_ROM) \
+	)
+
+// Rom build hasn't explicitly defined a subset of tests to include so to avoid
+// disappointment we'll include the whole shebang
+#define NW_TEST_ROM_1
+#define NW_TEST_ROM_2
+#define NW_TEST_ROM_3
+
+#define CI_TEST_ROM_1
+#define CI_TEST_ROM_2
+#define CI_TEST_ROM_3
+#define CI_TEST_ROM_4
+
+#define WAPSTACK_TEST_ROM
+#define SERCOMMS_TEST_ROM
+
+#endif
+
+#ifdef NW_TEST_ROM_1
+REM "NW_TEST_ROM_1": Generated ROM will include test components for running nw1 test group
+#endif
+#ifdef NW_TEST_ROM_2
+REM "NW_TEST_ROM_2": Generated ROM will include test components for running nw2 test group
+#endif
+#ifdef NW_TEST_ROM_3
+REM "NW_TEST_ROM_3": Generated ROM will include test components for running nw3 test group
+#endif
+
+#ifdef CI_TEST_ROM_1
+REM "CI_TEST_ROM_1": Generated ROM will include test components for running ci1 test group
+#endif
+#ifdef CI_TEST_ROM_2
+REM "CI_TEST_ROM_2": Generated ROM will include test components for running ci2 test group
+#endif
+#ifdef CI_TEST_ROM_3
+REM "CI_TEST_ROM_3": Generated ROM will include test components for running ci3 test group
+#endif
+#ifdef CI_TEST_ROM_4
+REM "CI_TEST_ROM_4": Generated ROM will include test components for running ci4 test group
+#endif
+
+#ifdef WAPSTACK_TEST_ROM
+REM "WAPSTACK_TEST_ROM": Generated ROM will include test components for running ws1 test group
+#endif
+
+#ifdef SERCOMMS_TEST_ROM
+REM "SERCOMMS_TEST_ROM": Generated ROM will include test components for running sc1 test group
+#endif
+
+
+
+// This iby file contains all Networking Test Harnesses.
+
+REM ---------- General ---------------
+
+// Scheduletest Test
+file=ABI_DIR\DEBUG_DIR\ts_selftest.dll		System\Libs\ts_selftest.dll
+
+// Initialisation before any tests are run
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard.script		TestData\scripts\te_initialiseboard.script
+
+#ifdef CI_TEST_ROM_1
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard1.script		TestData\scripts\te_initialiseboard1.script
+#endif
+#ifdef CI_TEST_ROM_2
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard2.script		TestData\scripts\te_initialiseboard2.script
+#endif
+#ifdef CI_TEST_ROM_3
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard3.script		TestData\scripts\te_initialiseboard3.script
+#endif
+#ifdef CI_TEST_ROM_4
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard4.script		TestData\scripts\te_initialiseboard4.script
+#endif
+#ifdef NW_TEST_ROM_1
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard5.script		TestData\scripts\te_initialiseboard5.script
+#endif
+#ifdef NW_TEST_ROM_3
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard6.script		TestData\scripts\te_initialiseboard6.script
+#endif
+#ifdef SERCOMMS_TEST_ROM
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard7.script		TestData\scripts\te_initialiseboard7.script
+#endif
+#ifdef WAPSTACK_TEST_ROM
+data=EPOCROOT##epoc32\data\z\testdata\scripts\te_initialiseboard8.script		TestData\scripts\te_initialiseboard8.script
+#endif
+
+
+REM ---------- Comms-Infras ----------
+
+// ced is not included in release builds by default (in commdb.iby)
+// so we include it explicitly here if _DEBUG is NOT defined
+#ifndef _DEBUG
+#include <XmlFramework.iby>
+#include <ced.iby>
+#include <ceddump.iby>
+#endif
+
+// CommDB Tests
+#if defined(CI_TEST_ROM_1) || defined(CI_TEST_ROM_4)
+#include <tcommdb.iby>
+#endif
+
+#ifdef CI_TEST_ROM_1
+#include <te_commsdat.iby>
+#endif
+
+#ifdef CI_TEST_ROM_1
+// CommsFramework Tests
+#include <tcommsfw.iby>
+#include <te_commsfw_transport.iby>
+#endif
+
+// ESOCK Tests - All test roms
+// (CI_TEST_ROM_1-te_ini,te_ipc,te_socket,etc)
+// (CI_TEST_ROM_2-te_eintsock,te_esock)
+// (NW_TEST_ROM_3-te_rconnectionsuite,te_rsubconnectionsuite)
+// (Anything using esock test steps)
+#include <esock_test.iby>
+
+// Flogger Tests
+// No Exports
+
+
+// MBufMgr Tests
+#if defined(CI_TEST_ROM_1) || defined(CI_TEST_ROM_2) || defined(CI_TEST_ROM_4)
+#include <testmbuf.iby>
+#endif
+
+#ifdef CI_TEST_ROM_2
+#include <te_netmetaunittest.iby>
+#endif
+
+// zerocopy tests
+#ifdef SYMBIAN_FLEXMM_ZERO_COPY_NETWORKING
+#include <zerocopy_loopback_driver.iby>
+#include <legacy_loopback_driver.iby>
+#include <zerocopy_loopback_driver_test.iby>
+#include <legacy_loopback_driver_test.iby>
+#include <zerocopy_loopback_link_protocol.iby>
+#include <legacy_loopback_link_protocol.iby>
+#include <te_loopback.iby>
+#endif
+
+// RootServer Tests
+#ifdef CI_TEST_ROM_3
+#include <ts_rootserver.iby>
+#endif
+
+//COMMSELEMENTSTESTS
+#ifdef CI_TEST_ROM_2
+#include <te_elementserver.iby>
+#endif
+
+REM ---------- Networking ----------
+
+//Ethernet nif - Any roms with ethernet tests (this is ensuring ethernet support, these aren't tests)
+#include <ether802.iby>
+
+
+// TE_DIALOG Tests
+#if defined(CI_TEST_ROM_1) || defined(NW_TEST_ROM_1)
+#include <te_dialogserver.iby>
+#endif
+
+// TE_DHCP Tests
+#if defined(NW_TEST_ROM_1) || defined(WAPSTACK_TEST_ROM)
+#include <te_dhcpTestServer.iby>
+#endif
+
+#if defined(CI_TEST_ROM_1) || defined(NW_TEST_ROM_1)
+//Unit test code to launch DHCP server
+#include <te_dhcpservtest.iby>
+#endif
+
+// IP Event Notifier Tests
+// Can't see this running in 9.5netmnt, not sure what rom its suppossed to be in so put it in all to be safe
+#include <te_ipeventnotifiersuite.iby>
+
+//Napt tests
+// Can't see this running in 9.5netmnt, not sure what rom its suppossed to be in so put it in all to be safe
+// #include <te_napt.iby>
+
+//Unit test code
+// #include <te_napttest.iby>
+
+// FTP Tests
+REM #include <tftp_e.iby>
+
+// IntegrationTest framework
+#ifdef NW_TEST_ROM_1
+#include <integrationtest.iby>
+#endif
+
+
+// NULL AGT Tests
+#ifdef NW_TEST_ROM_1
+#include <nullagttests.iby>
+#endif
+
+// Useful  Internet Utilities for all test roms
+#include <ipconfig.iby>
+#include <route.iby>
+#include <Tftp.iby>
+#include <Tracert.iby>
+#include <ping.iby>
+#if !defined(TEXT_ONLY_ROM)
+#include <pingapp.iby>
+#endif // TEXT_ONLY_ROM
+
+//Some handy tools for all test roms
+#include <ftp_e.iby>
+#include <telnet_e.iby>
+
+
+// PPP Tests
+#if defined(CI_TEST_ROM_1) || defined(NW_TEST_ROM_1)
+#include <te_pppsize.iby>
+#include <ts_dummyppp.iby>
+
+#include <te_pppcomp.iby>
+#include <te_vjcomp.iby>
+#include <te_incoming_ppp.iby>
+#endif
+
+
+// SPUD Tests
+#if defined(CI_TEST_ROM_1) || defined(NW_TEST_ROM_1)
+#include <TE_spudNetworkSide.iby>
+#include <TE_spudrsubconn.iby>
+#endif
+
+
+// UmtsGprsSCPR Tests
+#ifdef NW_TEST_ROM_3
+#include <te_UmtsGprsScpr.iby>
+#endif
+
+
+// QoS Tests
+//////#include <qostesting.iby>
+
+// Sockbench Tests
+#if defined(CI_TEST_ROM_1) || defined(NW_TEST_ROM_2)
+#include <sockbench.iby>
+#endif
+
+// TLS (SSL) Tests
+#ifdef NW_TEST_ROM_1
+#include <ts_tls.iby>
+#endif
+
+//-- DND LLMNR test
+#include <TE_LlmnrServer.iby>
+
+
+
+// agent dummy notifier
+#include <agentdummynotifier.iby>
+
+//Ipsec tests
+#if defined(CI_TEST_ROM_1) || defined(NW_TEST_ROM_1)
+#include <ts_ipsec.iby>
+#endif
+
+//-- additional optional protocols
+#include <probe.iby>
+#include <6to4.iby>
+
+
+// Not test components - maybe shouldn't be in here?? On all roms
+#include <netStSrv.iby>	
+#include <DHCPServ.iby>
+#include <elements.iby>
+#include <ipeventnotifier.iby>
+
+
+#if defined(NW_TEST_ROM_1) || defined(NW_TEST_ROM_3) || defined(CI_TEST_ROM_3) || defined(CI_TEST_ROM_1)
+#include <te_qossuite.iby>
+#endif
+
+#if defined(CI_TEST_ROM_1) || defined(NW_TEST_ROM_1)
+#include <TE_C32Bca.iby>
+#endif
+
+#include <TE_PacketLoopback.iby>
+#include <packetloopback.iby>
+
+// Needed by several tests
+#include <simtsy.iby>
+
+#include <te_AnvlClient.iby>
+
+REM ---------- WAP-Stack ----------
+
+// SWS test
+#if defined(CI_TEST_ROM_1) || defined(WAPSTACK_TEST_ROM)
+// this iby file is removed from the tb92sf code
+// #include <wapstacksuite.iby>
+#endif
+
+REM ---------- SER-COMMS ----------
+#if defined(CI_TEST_ROM_1) || defined(SERCOMMS_TEST_ROM)
+#include <te_c32.iby>
+#endif
+
+#if defined(SERCOMMS_TEST_ROM)
+#include <loopback.iby>
+#endif
+
+REM --- NEEDED FOR THE SECURITY TESTS ---
+#include <swi.iby>
+
+REM --- NETSTEB PERFORMANCE TEST FRAMEWORK ---
+#include <te_STEBTestSuite.iby>
+
+REM --- EAP Tests ---
+REM #include <te_eap.iby>
+
+REM --- MBMS Broadcast Tests ---
+#include <TE_MbmsUnit.iby>
+
+REM --- UPS ---
+#include <upstestnotifier.iby>
+#include <netups_test.iby>
+
+#if defined(CI_TEST_ROM_1) || defined(CI_TEST_ROM_4)
+REM #include <te_ipups.iby>
+#endif
+
+#ifdef NW_TEST_ROM_2
+#ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
+#include <te_tcpip6suite.iby>
+#endif
+#endif
+
+#ifdef NW_TEST_ROM_1
+#ifdef SYMBIAN_INCLUDE_PUNYCODE
+#include <te_punycodeconverter.iby>
+#include <te_unittestidna.iby>
+#endif //SYMBIAN_INCLUDE_PUNYCODE
+#endif //NW_TEST_ROM_1
+
+REM --- DNS Proxy test
+#ifndef SYMBIAN_EXCLUDE_DNS_Proxy 
+#include <t_dnsproxy.iby>
+#endif 
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/te_initialiseboard.script	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,17 @@
+//
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// 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:
+//
+// Place testexecute commands here to perform board initialisation before any automated tests are run
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Fri Jun 11 14:52:21 2010 +0300
@@ -0,0 +1,50 @@
+
+/*
+* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 all project in commsfw subsystem 
+*
+*/
+
+/*
+* %version: 1.1.3 %
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+#include "../commsprocess/commsrootserverconfig/group/bld.inf"
+#include "../commsprocess/commsrootserverconfig/etc/bld.inf"
+#include "../commsconfig/commsdatabaseshim/group/bld.inf"
+#include "../datacommsserver/esockserver/group/bld.inf"
+#include "../datacommsserver/esockserver/etc/bld.inf"
+#include "../datacommsserver/networkingdialogapi/group/bld.inf"
+#include "../datacommsserver/networkingdialogapi/default/bld.inf"
+#include "../datacommsserver/networkcontroller/group/bld.inf"
+#include "../serialserver/serialportcsy/bld.inf"
+#include "../serialserver/packetloopbackcsy/group/bld.inf"
+#include "../serialserver/c32serialserver/group/bld.inf"
+#include "../serialserver/c32serialserverconfig/bld.inf"
+#include "../commsfwutils/commsbufs/group/bld.inf"
+#include "../commsfwsupport/commselements/group/bld.inf"
+#include "../commsfwtools/preparedefaultcommsdatabase/group/bld.inf"
+#include "../commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/bld.inf"
+#include "../commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/bld.inf"
+#include "../commsfwtools/commstools/group/bld.inf"
+#include "../general/bld.inf"
+
+PRJ_TESTMMPFILES
--- a/serialserver/c32serialserver/group/ser-comms_c32.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/serialserver/c32serialserver/group/ser-comms_c32.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	ser-comms_c32
 source	\sf\os\commsfw\serialserver\c32serialserver\bwins
 source	\sf\os\commsfw\serialserver\c32serialserver\CCOMM
--- a/serialserver/c32serialserverconfig/ser-comms_c32-config.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/serialserver/c32serialserverconfig/ser-comms_c32-config.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	ser-comms_c32-config
 
 # configuration files disowned from c32. Now owned by this MRP file.
--- a/serialserver/c32serialserverdocs/ser-comms_documentation.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/serialserver/c32serialserverdocs/ser-comms_documentation.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	ser-comms_documentation
 
 source	\sf\os\commsfw\serialserver\c32serialserverdocs\
--- a/serialserver/packetloopbackcsy/group/PacketLoopbackCSY.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/serialserver/packetloopbackcsy/group/PacketLoopbackCSY.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	PacketLoopbackCSY
 
 source		\sf\os\commsfw\serialserver\packetloopbackcsy
--- a/serialserver/serialportcsy/ser-comms_serialportcsy.mrp	Thu May 27 14:07:49 2010 +0300
+++ b/serialserver/serialportcsy/ser-comms_serialportcsy.mrp	Fri Jun 11 14:52:21 2010 +0300
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# 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: 
-#
-
 component	ser-comms_serialportcsy
 source		\sf\os\commsfw\serialserver\serialportcsy
 source		\sf\os\commsfw\serialserver\c32serialserver\LOOPBACK