Revision: 201033 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 11:05:47 +0300
branchRCL_3
changeset 24 00c6709d25aa
parent 23 cbb19216b74d
child 25 9d7ce34704c8
Revision: 201033 Kit: 201033
commsfwsupport/commselements/commsfw/src/cflog.cpp
commsfwsupport/commselements/factories/bwins/factoriesu.def
commsfwsupport/commselements/factories/eabi/factoriesu.def
commsfwsupport/commselements/factories/inc/factory.h
commsfwsupport/commselements/factories/inc/factorynotify.h
commsfwsupport/commselements/factories/src/factory.cpp
commsfwsupport/commselements/meshmachine/inc/mm_nodepeer.h
commsfwsupport/commselements/meshmachine/src/mm_node.cpp
commsfwsupport/commselements/nodemessages/inc/nm_common.h
commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h
commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp
commsfwsupport/commselements/serverden/src/sd_workersession.cpp
datacommsserver/esockserver/CoreProviders/src/coretiernotificationactivity.cpp
datacommsserver/esockserver/UpsCoreProviders/inc/upscpractivities.h
datacommsserver/esockserver/UpsCoreProviders/src/upscpractivities.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/core_states/ss_coreprstates.h
datacommsserver/esockserver/eabi/esocksvrU.DEF
datacommsserver/esockserver/inc/SS_conn.H
datacommsserver/esockserver/inc/SS_rslv.H
datacommsserver/esockserver/inc/es_enum_internal.h
datacommsserver/esockserver/inc/es_prot_internal.h
datacommsserver/esockserver/inc/ss_connLegacy.h
datacommsserver/esockserver/inc/ss_connstates.h
datacommsserver/esockserver/inc/ss_sapshim.h
datacommsserver/esockserver/ssock/SS_RSLV.CPP
datacommsserver/esockserver/ssock/ss_connLegacy.cpp
datacommsserver/esockserver/ssock/ss_connstates.cpp
datacommsserver/esockserver/ssock/ss_roles.cpp
datacommsserver/esockserver/ssock/ss_sapshim.cpp
--- a/commsfwsupport/commselements/commsfw/src/cflog.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/commsfw/src/cflog.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -393,7 +393,7 @@
 
 void CCFLog::ConstructL()
 	{
-	iCsLock.CreateLocal();
+	User::LeaveIfError(iCsLock.CreateLocal());
 
 	// construct initial cflogger will be first in session arrays
 	RFileLogger* defaultflogger;
--- a/commsfwsupport/commselements/factories/bwins/factoriesu.def	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/factories/bwins/factoriesu.def	Thu Aug 19 11:05:47 2010 +0300
@@ -28,4 +28,5 @@
 	?SignalCreation@CFactoryBase@Factories@@AAEHAAVAFactoryObject@2@@Z @ 27 NONAME ; int Factories::CFactoryBase::SignalCreation(class Factories::AFactoryObject &)
 	?SignalDeletion@CFactoryBase@Factories@@AAEXAAVAFactoryObject@2@@Z @ 28 NONAME ; void Factories::CFactoryBase::SignalDeletion(class Factories::AFactoryObject &)
 	?Uid@CFactoryBase@Factories@@QBE?AVTUid@@XZ @ 29 NONAME ; class TUid Factories::CFactoryBase::Uid(void) const
+	?InterfaceStateChange@CFactoryBase@Factories@@QAEXABVTDesC8@@@Z @ 30 NONAME ; void Factories::CFactoryBase::InterfaceStateChange(class TDesC8 const &)
 
--- a/commsfwsupport/commselements/factories/eabi/factoriesu.def	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/factories/eabi/factoriesu.def	Thu Aug 19 11:05:47 2010 +0300
@@ -47,4 +47,5 @@
 	_ZTVN9Factories14AFactoryObjectE @ 46 NONAME
 	_ZTVN9Factories17CFactoryContainerE @ 47 NONAME
 	_ZTVN9Factories21CFactoryContainerNodeE @ 48 NONAME
+	_ZN9Factories12CFactoryBase20InterfaceStateChangeERK6TDesC8 @ 49 NONAME
 
--- a/commsfwsupport/commselements/factories/inc/factory.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/factories/inc/factory.h	Thu Aug 19 11:05:47 2010 +0300
@@ -100,6 +100,9 @@
 
 	IMPORT_C void RegisterNotifierL(const IFactoryNotify& aFactoryNotify);
 	IMPORT_C void DeRegisterNotifier(const IFactoryNotify& aFactoryNotify);
+	// Called by a node to indicate that an interface state change has taken place.  The factory then propagates
+	// this to all observers that have registered to be notified.
+    IMPORT_C void InterfaceStateChange(const TDesC8& aInfo);
 
 protected:
 	IMPORT_C explicit CFactoryBase(TUid aFactoryUid, CFactoryContainer& aParentContainer);
--- a/commsfwsupport/commselements/factories/inc/factorynotify.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/factories/inc/factorynotify.h	Thu Aug 19 11:05:47 2010 +0300
@@ -28,7 +28,7 @@
 namespace Factories
 {
 
-typedef void (*TInterfaceStateChangeFn)( TAny*, TDesC8& aInfo );
+typedef void (*TInterfaceStateChangeFn)( TAny*, const TDesC8& aInfo );
 typedef TInt (*TFactoryNotifyFn)( TAny*, AFactoryObject& aObject, CFactoryBase& aFactory );
 typedef void (*TAnyFn)(TAny*);
 
@@ -50,7 +50,7 @@
 		{
 		}
 
-	void InterfaceStateChange(TDesC8& aInfo)
+	void InterfaceStateChange(const TDesC8& aInfo)
 		{
 		if ( Check(1) )
 			{
@@ -89,14 +89,14 @@
  */
 	{
 public:
-	static void Notification(TAny* aThis, TDesC8& aInfo);
+	static void Notification(TAny* aThis, const TDesC8& aInfo);
 	static void NotifyDeletion(TAny* aThis, AFactoryObject& aObject, CFactoryBase& aFactory);
 	static TInt NotifyCreation(TAny* aThis, AFactoryObject& aObject, CFactoryBase& aFactory);
 
 	};
 
 template <class TCLIENT>
-void TFactoryNotify<TCLIENT>::Notification(TAny* aThis, TDesC8& aInfo)
+void TFactoryNotify<TCLIENT>::Notification(TAny* aThis, const TDesC8& aInfo)
 	{
 	TCLIENT* me = (TCLIENT*)aThis;
 	me->InterfaceStateChangeNotification(aInfo);
--- a/commsfwsupport/commselements/factories/src/factory.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/factories/src/factory.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -432,6 +432,14 @@
 	return obj;
 	}
 
+EXPORT_C void CFactoryBase::InterfaceStateChange(const TDesC8& aInfo)
+    {
+    for (TInt i = iFactoryNotify.Count() - 1; i >= 0; --i)
+        {
+        iFactoryNotify[i].InterfaceStateChange(aInfo);
+        }
+    }
+
 EXPORT_C AFactoryObject::AFactoryObject(CFactoryBase& aFactory)
 :	iFactory(aFactory)
 	{
--- a/commsfwsupport/commselements/meshmachine/inc/mm_nodepeer.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/inc/mm_nodepeer.h	Thu Aug 19 11:05:47 2010 +0300
@@ -65,20 +65,35 @@
 		return Peer().Type();
 		}
 
-	TUint32 Flags() const
-		{
-		return Peer().Flags();
-		}
+    TUint32 Flags() const
+        {
+        // Non-client peers lack flags (a state early in relationship)
+        if(PeerPtr())
+            {
+            return PeerPtr()->Flags();
+            }
+        return 0;
+        }
 
-	TUint32 SetFlags(TUint32 aFlags)
-		{
-		return Peer().SetFlags(aFlags);
-		}
+    TUint32 SetFlags(TUint32 aFlags)
+        {
+        // We only require peer info to be present if an actual state change is occurring (as opposed to default handling)
+        if(aFlags)
+            {
+            return Peer().SetFlags(aFlags);
+            }
+        return Flags();
+        }
 
-	TUint32 ClearFlags(TUint32 aFlags)
-		{
-		return Peer().ClearFlags(aFlags);
-		}
+    TUint32 ClearFlags(TUint32 aFlags)
+        {
+        // We only require peer info to be present if an actual state change is occurring (as opposed to default handling)
+        if(aFlags)
+            {
+            return Peer().ClearFlags(aFlags);
+            }
+        return Flags();
+        }
 
 	const RNodeInterface& Peer() const
 		{
--- a/commsfwsupport/commselements/meshmachine/src/mm_node.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/src/mm_node.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -735,7 +735,10 @@
 	if(!freeCellFound)
 		{
 		MESH_LOG((KMeshMachineSubTag, _L8("ERROR AMMNodeBase %08x:\tBorrowPreallocatedSpace - All %d preallocation cells have been allocated!"), this, maxPreallocatedActivities));
-		__ASSERT_ALWAYS(freeCellFound, User::Panic(KMMNodePanic, EPanicPreallocatedSpaceAlreadyTaken));
+		__ASSERT_DEBUG(freeCellFound, User::Panic(KMMNodePanic, EPanicPreallocatedSpaceAlreadyTaken));
+		// Attempt to allocate some space from the heap now in a last attempt to continue processing.
+		TRAPD(err,ptr =  User::AllocL(aSize));
+		__ASSERT_ALWAYS(err, User::Panic(KMessagesPanic, EPreAllocationFailedPanic));
 		}
 
 	return ptr;
@@ -766,6 +769,8 @@
 		{
 		MESH_LOG((KMeshMachineSubTag, _L8("ERROR AMMNodeBase %08x:\tReturnPreallocatedSpace - the returned pointer 0x%08X is invalid!"), this, aSpace));
 		__ASSERT_DEBUG(allocatedCellFound, User::Panic(KMMNodePanic, EPanicPreallocatedSpaceReturnedOther));
+		// May be returning a cell which was created in error recovery section of the Borrow in which case if must be "free"d.
+		User::Free(aSpace);
 		}
 	}
 
--- a/commsfwsupport/commselements/nodemessages/inc/nm_common.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/inc/nm_common.h	Thu Aug 19 11:05:47 2010 +0300
@@ -51,6 +51,7 @@
 	EAddressNotValidPanic,
 	EClientNotValidPanic,
 	EDeceasedNodePanic,
+	EPreAllocationFailedPanic
 	};
 
 
--- a/commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h	Thu Aug 19 11:05:47 2010 +0300
@@ -416,6 +416,13 @@
 			iPreAllocSize=0;
 			iPreAllocatedActivityChunk=NULL;
 			}
+		~TPreAllocStore()
+			{
+			if(iPreAllocatedActivityChunk != NULL)
+				{
+				User::Free(iPreAllocatedActivityChunk);
+				}
+			}
 		TUint iPreAllocSize;
 		TAny* iPreAllocatedActivityChunk;
 		};
--- a/commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -23,7 +23,6 @@
 #include <elements/nm_address_internal.h>
 #include "nm_signals.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)
@@ -140,10 +139,9 @@
 	iClientType = TClientType::NullType();
 	if(iPreAlloc!=NULL)
 		{
-		delete iPreAlloc->iPreAllocatedActivityChunk;
+		delete iPreAlloc;
+		iPreAlloc = NULL;
 		}
-	delete iPreAlloc;
-	iPreAlloc = NULL;
 	}
 
 EXPORT_C void RNodeInterface::PostMessage(const TRuntimeCtxId& aPostFrom, const TNodeId::TRemainder& aPostTo, const TSignalBase& aMessage) const
@@ -171,11 +169,28 @@
 	if(iPreAlloc!=NULL)
 		// Memory already allocated for this client
 		{
-		__ASSERT_DEBUG(iPreAlloc->iPreAllocatedActivityChunk != NULL, User::Panic(KSpecAssert_ElemNodeMessIntC, 5));
-		return;
+		// If iPreAlloc is not NULL then it should be usable. Ensure that the memory chunk has been suitable allocated
+		__ASSERT_DEBUG(iPreAlloc->iPreAllocatedActivityChunk != NULL, User::Panic(KSpecAssert_ElemNodeMessIntC, 2));
+		if(iPreAlloc->iPreAllocSize >= aAllocSize)
+			// Memory already preallocated of a sufficient size - this could happen if clients are re-added
+			{
+			return;
+			}
+		else
+			// Memory preallocated is too small. Free up the space and then attempt to reallocate
+			{
+			// Code path should never enter here as PreAllocL should not be called once the iPreAlloc memory space is allocated.
+			// However on the chance of production device entering here attempt to clear the preallocated space and reallocate a more suitable amount.
+            __ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ElemNodeMessIntC, 3)); 
+			delete iPreAlloc;
+			iPreAlloc = NULL;
+			}
 		}
-	iPreAlloc = new (ELeave) TPreAllocStore();
-	iPreAlloc->iPreAllocatedActivityChunk = User::AllocL(aAllocSize);
+	TPreAllocStore* preAlloc = new (ELeave) TPreAllocStore();
+	CleanupStack::PushL(preAlloc);
+	preAlloc->iPreAllocatedActivityChunk = User::AllocL(aAllocSize);
+	CleanupStack::Pop(preAlloc);
+	iPreAlloc = preAlloc;
 	iPreAlloc->iPreAllocSize = aAllocSize;
 	}
 
@@ -188,12 +203,15 @@
 	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);
+		__ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ElemNodeMessIntC, 4));
+		TRAPD(err,PreAllocL(aSize));
+		__ASSERT_ALWAYS(err, User::Panic(KMessagesPanic, EPreAllocationFailedPanic));
 		}
 	TAny* preallocatedSpace = (RNodeInterface*)iPreAlloc->iPreAllocatedActivityChunk;
-	iPreAlloc->iPreAllocatedActivityChunk=NULL;
+	// Release ownership of the memory area
+	iPreAlloc->iPreAllocatedActivityChunk = NULL;
+	delete iPreAlloc;
+	iPreAlloc = NULL;
 	return preallocatedSpace;
 	}
 
@@ -252,7 +270,7 @@
 
 EXPORT_C void RRequestOriginator::Open(RRequestOriginator& aOriginalRequest)
 	{
-	__ASSERT_DEBUG(aOriginalRequest.IsOpen(), User::Panic(KSpecAssert_ElemNodeMessIntC, 4));
+	__ASSERT_DEBUG(aOriginalRequest.IsOpen(), User::Panic(KSpecAssert_ElemNodeMessIntC, 1));
 	iNode = aOriginalRequest.iNode;
 	iRemainder = aOriginalRequest.iRemainder;
 	aOriginalRequest.Close();
--- a/commsfwsupport/commselements/serverden/src/sd_workersession.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/commsfwsupport/commselements/serverden/src/sd_workersession.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -62,6 +62,7 @@
 
 EXPORT_C CSubSessionIx::~CSubSessionIx()
 	{
+    iLock.Close();
 	User::Free(iIx);
 	}
 
--- a/datacommsserver/esockserver/CoreProviders/src/coretiernotificationactivity.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/src/coretiernotificationactivity.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -168,16 +168,16 @@
 	// set up a session with each collector
 	for (TInt sessionId=0 ; sessionId<aCollectors.Count() ; ++sessionId)
 		{
-		CDataCollectorSession* newCollector = CDataCollectorSession::NewL(aCollectors[sessionId], *this, sessionId );
-		CleanupStack::PushL(newCollector);
-		iCollectorSessions.AppendL(newCollector);
-		CleanupStack::Pop(newCollector);
-		
-		// now owned by the CDataCollectorSession in iCollectorSessions so don't want it to be in the cleanup path twice!
-		aCollectors[sessionId] = 0;
+		MDataCollector* collector = aCollectors[sessionId];
+		aCollectors[sessionId] = NULL;
+		CleanupStack::PushL(collector);
+		CDataCollectorSession* newCollectorSession = CDataCollectorSession::NewL(collector, *this, sessionId);
+		CleanupStack::Pop(collector);
+		CleanupStack::PushL(newCollectorSession);
+		iCollectorSessions.AppendL(newCollectorSession);
+		CleanupStack::Pop(newCollectorSession);
 		}
 
-
 	// Must run session creation and start loops separately in case the initial data fetch is synchronous.
 	// Reasoning:
 	//  when a full set of data for each collector is received, notification is only allowed if all
--- a/datacommsserver/esockserver/UpsCoreProviders/inc/upscpractivities.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/UpsCoreProviders/inc/upscpractivities.h	Thu Aug 19 11:05:47 2010 +0300
@@ -49,7 +49,7 @@
 	const Messages::TNodeId& Client();
 
 	void SetFlags(TInt aFlags);
-//	TInt Flags();
+	TInt Flags();
 
 	EXPORT_DECLARE_SMELEMENT_HEADER( TStoreControlClient, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
 		IMPORT_C virtual void DoL();
--- a/datacommsserver/esockserver/UpsCoreProviders/src/upscpractivities.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/UpsCoreProviders/src/upscpractivities.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -92,12 +92,12 @@
 	{
 	iFlags = aFlags;
 	}
-/*
+
 TInt CDeferredCtrlClientJoinActivity::Flags()
 	{
 	return iFlags;
 	}
-*/
+
 EXPORT_DEFINE_SMELEMENT(CDeferredCtrlClientJoinActivity::TStoreControlClient, NetStateMachine::MStateTransition, CDeferredCtrlClientJoinActivity::TContext)
 
 EXPORT_C void CDeferredCtrlClientJoinActivity::TStoreControlClient::DoL()
@@ -109,6 +109,7 @@
 	__ASSERT_DEBUG(act->Client() == TNodeId::NullId(), User::Panic(KSpecAssert_ESockUpsCoreProv, 2));
 	const TCFControlClient::TJoinRequest& msg = message_cast<TCFControlClient::TJoinRequest>(iContext.iMessage);
 	act->SetClient(msg.iNodeId);
+    act->SetFlags(msg.iClientType.Flags());
 	}
 
 EXPORT_DEFINE_SMELEMENT(CDeferredCtrlClientJoinActivity::TAddControlClientAndSendJoinComplete, NetStateMachine::MStateTransition, CDeferredCtrlClientJoinActivity::TContext)
@@ -121,7 +122,7 @@
 	__ASSERT_DEBUG(act->Client() != TNodeId::NullId(), User::Panic(KSpecAssert_ESockUpsCoreProv, 3));
 	
 	// Add control client
-	iContext.Node().AddClientL(act->Client(), TCFClientType(TCFClientType::ECtrl));
+	iContext.Node().AddClientL(act->Client(), TCFClientType(TCFClientType::ECtrl, act->Flags()));
 
 	// Send TJoinComplete
 	RClientInterface::OpenPostMessageClose(iContext.NodeId(), act->Client(), TCFControlClient::TJoinComplete().CRef());
--- a/datacommsserver/esockserver/bwins/esocksvrU.DEF	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/bwins/esocksvrU.DEF	Thu Aug 19 11:05:47 2010 +0300
@@ -1055,4 +1055,9 @@
 	?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 *)
 	?ConstructL@ACFMMNodeBase@ESock@@IAEXH@Z @ 1056 NONAME ; void ESock::ACFMMNodeBase::ConstructL(int)
+	?GetVTablePtr@TSendErrorRecoveryReq@CGoneDownActivity@PRActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 1057 NONAME ; class NetStateMachine::MStateTransition * PRActivities::CGoneDownActivity::TSendErrorRecoveryReq::GetVTablePtr(class TDesC8 &, void *)
+	?GetVTablePtr@TCancelAndCloseZone0ClientExtIfaces@CoreNetStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 1058 NONAME ; class NetStateMachine::MStateTransition * CoreNetStates::TCancelAndCloseZone0ClientExtIfaces::GetVTablePtr(class TDesC8 &, void *)
+	?GetVTablePtr@TIgnoreOrPropagate@CGoneDownActivity@PRActivities@@SAPAVMStateFork@NetStateMachine@@AAVTDesC8@@PAX@Z @ 1059 NONAME ; class NetStateMachine::MStateFork * PRActivities::CGoneDownActivity::TIgnoreOrPropagate::GetVTablePtr(class TDesC8 &, void *)
+	?DoL@TCancelStart@CoreNetStates@@UAEXXZ @ 1060 NONAME ; void CoreNetStates::TCancelStart::DoL(void)
+	?New@CGoneDownActivity@PRActivities@@SAPAVCNodeActivityBase@MeshMachine@@ABUTNodeActivity@4@AAVAMMNodeBase@4@@Z @ 1061 NONAME ; class MeshMachine::CNodeActivityBase * PRActivities::CGoneDownActivity::New(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase &)
 
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -2118,7 +2118,7 @@
 //
 //-=========================================================
 
-MeshMachine::CNodeActivityBase* CGoneDownActivity::New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+EXPORT_C MeshMachine::CNodeActivityBase* CGoneDownActivity::New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
     	{
    		TAny* space = BorrowPreallocatedSpace(aNode, sizeof(CGoneDownActivity));
 		CGoneDownActivity* self = new (space) CGoneDownActivity(aActivitySig, aNode);
@@ -2180,7 +2180,7 @@
 	return NetStateMachine::ACore::IsIdle();
 	}
 
-DEFINE_SMELEMENT(CGoneDownActivity::TSendErrorRecoveryReq, NetStateMachine::MStateTransition, CGoneDownActivity::TContext)
+EXPORT_DEFINE_SMELEMENT(CGoneDownActivity::TSendErrorRecoveryReq, NetStateMachine::MStateTransition, CGoneDownActivity::TContext)
 void CGoneDownActivity::TSendErrorRecoveryReq::DoL()
     {
 	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCorePrPanic, KPanicNoActivity));
@@ -2203,7 +2203,7 @@
     activity.ClearPostedTo();
     }
 
-DEFINE_SMELEMENT(CGoneDownActivity::TIgnoreOrPropagate, NetStateMachine::MStateFork, CGoneDownActivity::TContext)
+EXPORT_DEFINE_SMELEMENT(CGoneDownActivity::TIgnoreOrPropagate, NetStateMachine::MStateFork, CGoneDownActivity::TContext)
 TInt CGoneDownActivity::TIgnoreOrPropagate::TransitionTag()
     {
     __ASSERT_DEBUG(iContext.iMessage.IsMessage<TEErrorRecovery::TErrorRecoveryResponse>(), User::Panic(KSpecAssert_ESockCrStaCPRAC, 38));
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.h	Thu Aug 19 11:05:47 2010 +0300
@@ -891,7 +891,7 @@
 class CGoneDownActivity : public MeshMachine::CNodeRetryActivity, protected MeshMachine::APreallocatedOriginators<2>
     {
 public:
-    static MeshMachine::CNodeActivityBase* New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+    IMPORT_C static MeshMachine::CNodeActivityBase* New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
 
 protected:
 	CGoneDownActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
@@ -913,11 +913,11 @@
     typedef MeshMachine::TNodeContext<ESock::CMMCommsProviderBase, CoreNetStates::TContext> TContext;
 
 public:
-	DECLARE_SMELEMENT_HEADER( TIgnoreOrPropagate, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, TContext )
+    EXPORT_DECLARE_SMELEMENT_HEADER( TIgnoreOrPropagate, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, TContext )
 		virtual TInt TransitionTag();
 	DECLARE_SMELEMENT_FOOTER( TIgnoreOrPropagate )
 
-	DECLARE_SMELEMENT_HEADER( TSendErrorRecoveryReq, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+    EXPORT_DECLARE_SMELEMENT_HEADER( TSendErrorRecoveryReq, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
 		virtual void DoL();
 	DECLARE_SMELEMENT_FOOTER( TSendErrorRecoveryReq )
 	};
--- a/datacommsserver/esockserver/core_states/ss_coreprstates.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_coreprstates.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -232,8 +232,8 @@
         // which is handled by another activity
         __ASSERT_DEBUG(msg.iClientType.Type() != (TUint32)TCFClientType::EData, User::Panic(KSpecAssert_ESockCrStaCPRSC, 3));
 
-//		iContext.Node().AddClientL(msg.iNodeId, TClientType(TCFClientType::ECtrl,msg.iValue));
-		iContext.Node().AddClientL(msg.iNodeId, TClientType(TCFClientType::ECtrl));
+		iContext.Node().AddClientL(msg.iNodeId, TClientType(TCFClientType::ECtrl,msg.iClientType.Flags()));
+
 		//Send confirmation
 		RClientInterface::OpenPostMessageClose(iContext.NodeId(), iContext.iSender, TCFPeer::TJoinComplete().CRef());
 		}
@@ -2127,7 +2127,7 @@
 	iContext.iNodeActivity->SetError(static_cast<TSigNumber&>(iContext.iMessage).iValue);
 	}
 
-DEFINE_SMELEMENT(TCancelAndCloseZone0ClientExtIfaces, NetStateMachine::MStateTransition, CoreNetStates::TContext)
+EXPORT_DEFINE_SMELEMENT(TCancelAndCloseZone0ClientExtIfaces, NetStateMachine::MStateTransition, CoreNetStates::TContext)
 void TCancelAndCloseZone0ClientExtIfaces::DoL()
 	{
 	//0 means we will cancel and close all open extensions!
@@ -2182,7 +2182,7 @@
 	}
 
 EXPORT_DEFINE_SMELEMENT(TCancelStart, NetStateMachine::MStateTransition, CoreNetStates::TContext)
-void TCancelStart::DoL()
+EXPORT_C void TCancelStart::DoL()
 	{
 	CNodeActivityBase* startActivity = iContext.Node().FindActivityById(ECFActivityStart);
 	if (startActivity)
--- a/datacommsserver/esockserver/core_states/ss_coreprstates.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_coreprstates.h	Thu Aug 19 11:05:47 2010 +0300
@@ -11,7 +11,7 @@
 // Contributors:
 //
 // Description:
-// Core PR States
+// Core PR State
 //
 //
 
@@ -759,19 +759,19 @@
 	IMPORT_C virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TCancelDataClientStart )
 
-DECLARE_SMELEMENT_HEADER( TCancelAndCloseZone0ClientExtIfaces, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+EXPORT_DECLARE_SMELEMENT_HEADER( TCancelAndCloseZone0ClientExtIfaces, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
 	virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TCancelAndCloseZone0ClientExtIfaces )
 
 EXPORT_DECLARE_SMELEMENT_HEADER( TProcessOrForwardRMessage2Ext, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
-	virtual void DoL();
+    IMPORT_C virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TProcessOrForwardRMessage2Ext )
 
 /**
  * Check if ECFActivityStart is running, and if so cancel it
  */
 EXPORT_DECLARE_SMELEMENT_HEADER( TCancelStart, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
-	virtual void DoL();
+	IMPORT_C virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TCancelStart )
 
 DECLARE_AGGREGATED_TRANSITION2(
--- a/datacommsserver/esockserver/eabi/esocksvrU.DEF	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/eabi/esocksvrU.DEF	Thu Aug 19 11:05:47 2010 +0300
@@ -1962,4 +1962,15 @@
 	_ZN5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1961 NONAME
 	_ZThn36_N5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1962 NONAME
 	_ZN5ESock13ACFMMNodeBase10ConstructLEi @ 1963 NONAME
+	_ZN12PRActivities17CGoneDownActivity18TIgnoreOrPropagate12GetVTablePtrER6TDesC8Pv @ 1964 NONAME
+	_ZN12PRActivities17CGoneDownActivity21TSendErrorRecoveryReq12GetVTablePtrER6TDesC8Pv @ 1965 NONAME
+	_ZN12PRActivities17CGoneDownActivity3NewERKN11MeshMachine13TNodeActivityERNS1_11AMMNodeBaseE @ 1966 NONAME
+	_ZN13CoreNetStates12TCancelStart3DoLEv @ 1967 NONAME
+	_ZN13CoreNetStates35TCancelAndCloseZone0ClientExtIfaces12GetVTablePtrER6TDesC8Pv @ 1968 NONAME
+	_ZTIN12PRActivities17CGoneDownActivity18TIgnoreOrPropagateE @ 1969 NONAME
+	_ZTIN12PRActivities17CGoneDownActivity21TSendErrorRecoveryReqE @ 1970 NONAME
+	_ZTIN13CoreNetStates35TCancelAndCloseZone0ClientExtIfacesE @ 1971 NONAME
+	_ZTVN12PRActivities17CGoneDownActivity18TIgnoreOrPropagateE @ 1972 NONAME
+	_ZTVN12PRActivities17CGoneDownActivity21TSendErrorRecoveryReqE @ 1973 NONAME
+	_ZTVN13CoreNetStates35TCancelAndCloseZone0ClientExtIfacesE @ 1974 NONAME
 
--- a/datacommsserver/esockserver/inc/SS_conn.H	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/inc/SS_conn.H	Thu Aug 19 11:05:47 2010 +0300
@@ -40,7 +40,6 @@
 	class TProcessIncomingConnection;
 	class TProcessProgressRequest;
 	class TParseECNAttach;
-	class TJoinReceivedCpr;
 	class TProcessBinderResponseForCpr;
 	class TCompleteLegacyAttach;
 	class TProcessEnumResponse;
@@ -144,7 +143,6 @@
 	friend class ConnStates::TProcessIncomingConnection;
 	friend class ConnStates::TProcessProgressRequest;
 	friend class ConnStates::TParseECNAttach;
-	friend class ConnStates::TJoinReceivedCpr;
 	friend class ConnStates::TProcessBinderResponseForCpr;
 	friend class ConnStates::TCompleteLegacyAttach;
 	friend class ConnStates::TProcessEnumResponse;
@@ -155,6 +153,7 @@
 	friend class EnumerateConnectionsActivity::TCompleteClient;
 	friend class AllInterfaceNotificationActivity::TEnqueueNotification;
 	friend class AllInterfaceNotificationActivity::TSendErrorToConnection;
+	friend class ConnActivities::CAllInterfaceNotificationActivity;
 	friend class ConnSubConnEventsActivity::TProcessSubConnEvent;
 
 	friend class ConnStates::TGenerateConnectionUpProgress;
@@ -294,6 +293,7 @@
 friend class AllInterfaceNotificationActivity::TStartLinkNotification;
 friend class AllInterfaceNotificationActivity::TEnqueueNotification;
 friend class AllInterfaceNotificationActivity::TSendErrorToConnection;
+friend class ConnActivities::CAllInterfaceNotificationActivity;
 
 public:
     CAllInterfaceNotificationWorker(ESock::CConnection& aConnection);
--- a/datacommsserver/esockserver/inc/SS_rslv.H	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/inc/SS_rslv.H	Thu Aug 19 11:05:47 2010 +0300
@@ -85,10 +85,13 @@
 	virtual void ProcessMessageL();
 
 	void InitiateDestruction();
-
+	inline void SetFlowRequestType(TFlowParams::TFlowRequestType aFlowRequestType)
+	    { iFlowRequestType = aFlowRequestType; }
+	
 protected:
 	void LockToConnectionInfo();
 	void LockToConnectionInfo(const TDesC8& aConnectionInfo);
+	void UpdateFlowRequestType();
     void SetBlockedReq(const RMessage2& aMsg)
         {
         iBlockedReq = aMsg;
@@ -152,7 +155,7 @@
 
     TPtr8   iPtrQryBuf;     //< Pointer descriptor, associated with ipQryBuf
     TPtr8   iPtrQryResBuf;  //< Pointer descriptor, associated with ipQryRespBuf
-
+    TFlowParams::TFlowRequestType iFlowRequestType; //< Flow request type used while opening the HR
     };
 
 inline void CHostResolver::SetResolver(CHostResolvProvdBase* aResolver)
--- a/datacommsserver/esockserver/inc/es_enum_internal.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/inc/es_enum_internal.h	Thu Aug 19 11:05:47 2010 +0300
@@ -88,6 +88,15 @@
 */
 typedef TPckgBuf<TConnectionGetSocketInfoArg> TConnGetSocketInfoArgBuf;
 
+/**
+This enum is used as an internal extension to TConnInterfaceState
+
+@internalComponent
+*/
+enum TConnInterfaceStateInternal
+    {
+    EInterfaceRestarting = 0x100
+    };
 
 
 #include <es_enum_internal.inl>
--- a/datacommsserver/esockserver/inc/es_prot_internal.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/inc/es_prot_internal.h	Thu Aug 19 11:05:47 2010 +0300
@@ -198,6 +198,9 @@
 @internalTechnology
 */
 const TUint KSoSetPlatSecApi = 4 | KSocketInternalOptionBit;
+
+const TUint KSoFlowRequestType = 5 |  KSocketInternalOptionBit;
+        
 #endif //SYMBIAN_NETWORKING_UPS
 
 /**
--- a/datacommsserver/esockserver/inc/ss_connLegacy.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_connLegacy.h	Thu Aug 19 11:05:47 2010 +0300
@@ -49,6 +49,11 @@
 class TSendErrorToConnection;
 }
 
+namespace ConnActivities
+{
+class CAllInterfaceNotificationActivity;
+}
+
 namespace EnumerateConnectionsActivity
 {
 class TQueryTierStatus;
@@ -84,9 +89,12 @@
 	friend class EnumerateConnectionsActivity::TCompleteClient;
 	friend class AllInterfaceNotificationActivity::TEnqueueNotification;
 	friend class AllInterfaceNotificationActivity::TSendErrorToConnection;
+	friend class ConnActivities::CAllInterfaceNotificationActivity;
 	friend class ConnStates::TNoTagOrCancelAllInterfaceWorker;
 	friend class ConnStates::TCancelAllInterfaceNotificationWorker;
 
+public:
+	enum { KIPProtoConnectionProviderFactoryUid = 0x10281DD3 };
 public: //So that friends of CConnection (transitions) can access it
 	void CompleteAttachL(TSelectionPrefs& aPrefs);
 	void CancelServiceChangeNotification(const Den::RSafeMessage& aMessage);
@@ -155,7 +163,6 @@
 	ADataMonitoringProvider* FetchSubConnDataMonitoringProvider() const;
 
 	//global notifications
-	void InterfaceStateChangeNotification(TDesC8& aInfo);
 	void RequestServiceChangeNotificationL(const Den::RSafeMessage& aMessage);
     void ControlL(TUint aOptionName, TUint aMessageId);
 
@@ -212,9 +219,6 @@
 	RMessage2 iAllInterfaceNotificationMessage;
 	TInterfaceChangeQueue iNotificationQueue;
   	Messages::TNodeId iAllInterfaceNotificationWorker;
-  	
-protected:
-	static const TAnyFn iInterfaceVTableF[];
 	};
 
 
--- a/datacommsserver/esockserver/inc/ss_connstates.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_connstates.h	Thu Aug 19 11:05:47 2010 +0300
@@ -84,10 +84,6 @@
 	virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TSelectMetaPlane )
 
-DECLARE_SMELEMENT_HEADER( TJoinReceivedCpr, SubSessStates::TECABStateTransitionBase<TContext>, NetStateMachine::MStateTransition, TContext )
-	virtual void DoL();
-DECLARE_SMELEMENT_FOOTER( TJoinReceivedCpr )
-
 DECLARE_SMELEMENT_HEADER( TSendFinishedSelectionStateChange, SubSessStates::TECABStateTransitionBase<TContext>, NetStateMachine::MStateTransition, TContext )
 	virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TSendFinishedSelectionStateChange )
@@ -118,12 +114,6 @@
 	virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TStartConnection )
 
-DECLARE_AGGREGATED_TRANSITION2(
-    TSendFinishedSelectionAndJoinReceivedCpr,
-	ConnStates::TSendFinishedSelectionStateChange,
-	ConnStates::TJoinReceivedCpr
-	)
-
 DECLARE_SMELEMENT_HEADER( TErrorOrCancel, MeshMachine::TStateFork<ConnStates::TContext>, NetStateMachine::MStateFork, ConnStates::TContext )
 	virtual TInt TransitionTag();
 DECLARE_SMELEMENT_FOOTER( TErrorOrCancel )
@@ -525,6 +515,8 @@
 
 public:
 	static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+    void InterfaceStateChangeNotification(const TDesC8& aInfo);
+    ESock::CCommsFactoryBase* IpProtoCprFactory() const;
 
 private:
 	CAllInterfaceNotificationActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode) :
@@ -535,11 +527,16 @@
 		}
 
 	virtual ~CAllInterfaceNotificationActivity();
+    const Factories::TAnyFn& GetVTable() { return iInterfaceVTableF[0]; };
 
 private:
 	TUid iTierUid;
 	Messages::TNodeId iTierManager;
 	const CAllInterfaceNotificationWorker* iAllInterfaceNotificationWorker;
+	TBool iRegisteredForInterfaceStateChanges:1;       // Registered with IpProtoCpr factory
+
+private:
+	static const ESock::TAnyFn iInterfaceVTableF[];
 	};
 
 /**
--- a/datacommsserver/esockserver/inc/ss_sapshim.h	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_sapshim.h	Thu Aug 19 11:05:47 2010 +0300
@@ -230,6 +230,8 @@
 	SAP_FLAG_FUNCTIONS(DeleteUponBearerReception, EDeleteUponBearerReception)
 	SAP_FLAG_FUNCTIONS(UseBearerErrors, EUseBearerErrors)
 
+	void HostResolverSpecificUnbind();
+
 private:
 	CServProviderBase* iProvider;
 	//CHostResolver specific workaround for now
--- a/datacommsserver/esockserver/ssock/SS_RSLV.CPP	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/ssock/SS_RSLV.CPP	Thu Aug 19 11:05:47 2010 +0300
@@ -741,6 +741,7 @@
     {
 	LOG(ESockLog::Printf(KESockConnectionTag, _L8("CHostResolver %08x:\tStartSending() iBusy %d, iAwaitingConnection %d"), this,iBusy,iAwaitingConnection) );
 	LockToConnectionInfo();
+	UpdateFlowRequestType();
 	if (iBusy && iAwaitingConnection)
 		{
 		switch (iCurrentOp)
@@ -893,6 +894,12 @@
 		}
 	}
 
+void CHostResolver::UpdateFlowRequestType()
+    {
+    TPckgBuf<TInt> flowRequestTypePckg = iFlowRequestType;
+     
+    iRSP->SetOption(KSOLProvider, KSoFlowRequestType, flowRequestTypePckg);
+    }
 
 void CHostResolver::ProcessMessageL()
 	{
--- a/datacommsserver/esockserver/ssock/ss_connLegacy.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_connLegacy.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -62,12 +62,6 @@
 
 //const TInt KNumberOfEmulatedSubConnections = 2;
 
-const Factories::TAnyFn AConnectionLegacy::iInterfaceVTableF[] =
-	{
-	(Factories::TAnyFn)1,
-	(Factories::TAnyFn)(TFactoryNotify<AConnectionLegacy>::Notification)
-	};
-
 AConnectionLegacy::~AConnectionLegacy()
     {
    	TSubConnectionEvent* subConnectionEvent;
@@ -130,7 +124,7 @@
 	}
 
 
-static const TUid K_CIPProtoConnectionProviderFactory_iUid = {0x10281DD3};
+//static const TUid K_CIPProtoConnectionProviderFactory_iUid = {0x10281DD3};
 
 void AConnectionLegacy::CompleteAttachL(ESock::TSelectionPrefs& aPrefs)
 	{
@@ -146,7 +140,7 @@
     __ASSERT_DEBUG(cpr->GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider))==NULL, User::Panic(KSpecAssert_ESockSSockscnLgc, 3)); //This is why we are "legacy"
 
 	CConnectionFactoryContainer& container = *static_cast<CPlayer&>(iConnection.Player()).SockManGlobals()->iConnectionFactories;
-	CCommsFactoryBase* factory = static_cast<CCommsFactoryBase*>(container.FindFactory(K_CIPProtoConnectionProviderFactory_iUid));
+	CCommsFactoryBase* factory = static_cast<CCommsFactoryBase*>(container.FindFactory(TUid::Uid(KIPProtoConnectionProviderFactoryUid)));
     User::LeaveIfError(factory? KErrNone : KErrArgument);
 
     XConnectionFactoryAPQuery query(static_cast<const TCommDbConnPref&>(cp).IapId());
@@ -900,40 +894,6 @@
 	iConnection.DontCompleteCurrentRequest();
 	}
 
-
-
-void AConnectionLegacy::InterfaceStateChangeNotification(TDesC8& /*aInfo*/)
-	{
-	//[399TODO] implement InterfaceStateChangeNotification
-	LOG(ESockLog::Printf(KESockConnectionTag, _L8("TODO: implement InterfaceStateChangeNotification - KErrNotSupported")));
-#if TODO_IMPLEMENT_THIS
-	TInterfaceNotification& interfaceNotification = ((TInterfaceNotificationBuf&)aInfo)();
-
-	if(iAllInterfaceNotificationMessage.IsNull())
-		{
-		iInterfaceChangeQueue.Enque(interfaceNotification);
-		return;
-		}
-	else // request is outstanding
-		{
-		if(!iInterfaceChangeQueue.IsEmpty())
-			{
-			// can this situation ever happen?
-			// - new requests fullfilled from queue before becoming outstanding
-			// - no queued items when request outstanding
-
-			// But in case we do...
-			// should we get oldest change first in case this new one overwrites it
-			iInterfaceChangeQueue.Enque(interfaceNotification);
-			iInterfaceChangeQueue.Deque(interfaceNotification);
-			}
-
-		TInt ret = iAllInterfaceNotificationMessage.Write(0, aInfo);
-		CompleteMessage(iAllInterfaceNotificationMessage, ret);
-		}
-#endif
-	}
-
 void AConnectionLegacy::SubConnectionEvent(const TSubConnectionEvent& aSubConnectionEvent)
 	{
 	// Pass the message onto the client if possible, or buffer if necessary
--- a/datacommsserver/esockserver/ssock/ss_connstates.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -56,7 +56,7 @@
 #include <comms-infras/ss_upsaccesspointconfigext.h>
 #include <comms-infras/upsmessages.h>
 #endif
-
+#include <comms-infras/ss_roles.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)
@@ -252,35 +252,6 @@
 		TCFMessage::TStateChange(TStateChange(KFinishedSelection,KErrNone)).CRef());
 	}
 
-DEFINE_SMELEMENT(ConnStates::TJoinReceivedCpr, NetStateMachine::MStateTransition, ConnStates::TContext)
-void ConnStates::TJoinReceivedCpr::DoL()
-	{
-	__ASSERT_DEBUG(iContext.iNodeActivity, ConnPanic(KPanicNoActivity));
-	__ASSERT_DEBUG(iContext.Node().ServiceProvider()==NULL, ConnPanic(KPanicExpectedNoServiceProvider));
-
-	TCFDataClient::TBindTo& bt = message_cast<TCFDataClient::TBindTo>(iContext.iMessage);
-    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);
-
-    TUint selPrefs = static_cast<ConnActivities::CStartAttachActivity&>(*iContext.iNodeActivity).SelectionPrefs().Flags();
-    if (selPrefs & TSelectionPrefs::EMonitor)
-    	{
-		clientType.SetFlags(TCFClientType::EMonitor);
-    	iContext.Node().iIsMonitor = ETrue;
-    	}
-
-	// If it is an attach set the flag cause it is used by NetUPS to check if a JoinRequest comes from an RConnection::Attach
-	if (selPrefs & TSelectionPrefs::EAttach)
-    	{
-		clientType.SetFlags(TCFClientType::EAttach);
-    	}
-    iContext.iNodeActivity->PostRequestTo(*newSP,
-    	TCFServiceProvider::TJoinRequest(iContext.NodeId(), clientType).CRef());
-	}
-
 DEFINE_SMELEMENT(ConnStates::TJoinReceivedSCpr, NetStateMachine::MStateTransition, ConnStates::TContext)
 void ConnStates::TJoinReceivedSCpr::DoL()
 	{
@@ -1303,9 +1274,61 @@
 		{
 		iNode.RemoveClient(aux->RecipientId());
 		}
+
+    if (iRegisteredForInterfaceStateChanges)
+        {
+        CCommsFactoryBase* ipProtoCprFactory = IpProtoCprFactory();
+        if (ipProtoCprFactory)
+            {
+            Factories::IFactoryNotify itf(this, GetVTable());
+            ipProtoCprFactory->DeRegisterNotifier(itf);
+            }
+        }
+
 	delete iAllInterfaceNotificationWorker; //delete this node (why via iAllInterfaceNotificationWorker??)
 	}
 
+/**
+Called by the IpProtoCpr factory to propagate an interface state change from IpProtoCpr to registered
+observers (suc as ourself).  If the interface is restarting, then we need to insert an EInterfaceDown,
+EInterfaceUp "toggle" sequence into the AllInterfaceNotification queue.  This is because, ordinarily,
+EInterfaceUp and EInterfaceDown are generated when the IpProtoCpr itself is created and destroyed,
+but not if it is restarted before being destroyed. 
+*/
+void CAllInterfaceNotificationActivity::InterfaceStateChangeNotification(const TDesC8& aInfo)
+    {
+    if (aInfo.Length() == sizeof(TInterfaceNotification))
+        {
+        const TInterfaceNotification* const info = reinterpret_cast<const TInterfaceNotification*>(aInfo.Ptr());
+        if (info && info->iState == EInterfaceRestarting)
+            {
+            LOG( ESockLog::Printf(KESockConnectionTag, _L("CAllInterfaceNotificationActivity %08x:\tInterfaceStateChangeNotification(): CConnection %08x, IapId %d, NetId %d"),
+                this, &iAllInterfaceNotificationWorker->iConnection, info->iConnectionInfo.iIapId, info->iConnectionInfo.iNetId  ));
+
+            AConnectionLegacy& legacy = iAllInterfaceNotificationWorker->iConnection.iLegacyConnection;
+            TInterfaceNotification notification(*info);
+            notification.iState = EInterfaceDown;
+            legacy.iNotificationQueue.Enque(notification);
+            notification.iState = EInterfaceUp;
+            legacy.iNotificationQueue.Enque(notification);
+            legacy.CompleteAllInterfaceNotificationL(KErrNone);
+            }
+        }
+    }
+
+CCommsFactoryBase* CAllInterfaceNotificationActivity::IpProtoCprFactory() const
+    {
+    CConnectionFactoryContainer& container = *static_cast<CPlayer&>(iAllInterfaceNotificationWorker->iConnection.Player()).SockManGlobals()->iConnectionFactories;
+    return static_cast<CCommsFactoryBase*>(container.FindFactory(TUid::Uid(AConnectionLegacy::KIPProtoConnectionProviderFactoryUid)));
+    }
+
+// Registration table for receiving InterfaceStateChangeNotification() events.
+const Factories::TAnyFn CAllInterfaceNotificationActivity::iInterfaceVTableF[] =
+    {
+    (Factories::TAnyFn)1, // number of methods. the following entries must be in this order!
+    (Factories::TAnyFn)(Factories::TFactoryNotify<CAllInterfaceNotificationActivity>::Notification)
+    };
+
 // States
 
 DEFINE_SMELEMENT(AllInterfaceNotificationActivity::TAwaitingStart, NetStateMachine::MState, TContext)
@@ -1461,6 +1484,23 @@
 	TCFTierStatusProvider::TTierNotification& msg = message_cast<TCFTierStatusProvider::TTierNotification>(iContext.iMessage);
 
 	__ASSERT_DEBUG(msg.iBundle, User::Panic(KSpecAssert_ESockSSockscnsts, 14));
+	
+    CAllInterfaceNotificationActivity& act = *iContext.Activity();
+    
+    // Register with the IpProtoCpr factory for interface state changes if we haven't already done so.
+    // We can only do this if the IpProtoCpr is active, and the assumption here is that it must be active
+    // if an interface event has been generated.
+    if (!act.iRegisteredForInterfaceStateChanges)
+        {
+        CCommsFactoryBase* ipProtoCprFactory = act.IpProtoCprFactory();
+        if (ipProtoCprFactory)
+            {
+            Factories::IFactoryNotify itf(&act, act.GetVTable());
+            ipProtoCprFactory->RegisterNotifierL(itf);
+            act.iRegisteredForInterfaceStateChanges = ETrue;
+            }
+        }
+
 	if(msg.iBundle->PtrL()->CountParamSetContainers() > 0)
 		{
 		TInt i = 0;
--- a/datacommsserver/esockserver/ssock/ss_roles.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_roles.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -812,6 +812,7 @@
 
 	h->SetFlowRequestPending(ETrue);
 	h->AdoptFlowRequestMessage(SafeMessage());
+	h->SetFlowRequestType(TFlowParams::EImplicit);
 
 	DontCompleteCurrentRequest();
 	}
@@ -842,7 +843,7 @@
 
 	h->SetFlowRequestPending(ETrue);
 	h->AdoptFlowRequestMessage(SafeMessage());
-
+	h->SetFlowRequestType(TFlowParams::EExplicitConnection);
 	DontCompleteCurrentRequest();
 	}
 
--- a/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Thu Jul 15 20:01:43 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Thu Aug 19 11:05:47 2010 +0300
@@ -268,6 +268,28 @@
 	return this;
     }
 
+void CTransportFlowShim::HostResolverSpecificUnbind()
+	{
+	// Can't have both HR & SAP
+	__ASSERT_DEBUG(!iProvider, User::Panic(KSpecAssert_ESockSSocksspshm, 9));
+
+	if(iSubConnectionProvider.IsOpen())
+		{
+		iSessionControlNotify = NULL;
+		iSessionDataNotify = NULL;
+		iHostResolverNotify = NULL;
+		if (!Idle())
+			{
+			SetIdle();
+			ProcessDCIdleState();
+			}
+		}
+	else
+		{
+		DeleteThisFlow();
+		}
+	}
+
 void CTransportFlowShim::Unbind()
     {
 	LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tUnbind()"), this) );
@@ -279,41 +301,30 @@
 		return;
 		}
 
-	// Legacy support for host resolvers
+	// Legacy support for host resolvers involves a separate north bound MUpperControl interface
 	if(iHostResolverNotify)
 		{
-		__ASSERT_DEBUG(!iProvider, User::Panic(KSpecAssert_ESockSSocksspshm, 9));	// can't have both HR & SAP
-
-		LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tUnbind(): iBearerExpected %d"), this, BearerExpected()) );
-		if (!BearerExpected())
+		HostResolverSpecificUnbind();
+		}
+	else
+		{
+		if (iProvider)
 			{
-			delete this;
-			}
-		else
-			{
-			SetDeleteUponBearerReception();
-			iHostResolverNotify = NULL;
+			iProvider->SetNotify(NULL);
+
+			if (!Detaching())
+				{
+				delete iProvider;
+				iProvider = NULL;
+				}
 			}
-		return;
-		}
-
-	if (iProvider)
-		{
-		iProvider->SetNotify(NULL);
-
-		if (!Detaching())
-			{
-			delete iProvider;
-			iProvider = NULL;
-			}
-		}
 
 #ifdef SYMBIAN_NETWORKING_UPS
-	// Hook for derived classes to do cleanup before unbind occurs
-	PreUnbind();
+		// Hook for derived classes to do cleanup before unbind occurs
+		PreUnbind();
 #endif
-
-	CNetworkFlow::Unbind();
+		CNetworkFlow::Unbind();
+		}
     }
 
 ESock::CSubConnectionFlowBase& CTransportFlowShim::CloneFlowL()