Revision: 201013 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 23:27:09 +0300
branchRCL_3
changeset 13 0b0e9fce0b58
parent 12 8b5d60ce1e94
child 14 4ccf8e394726
Revision: 201013 Kit: 201013
commsfw_info/commsinfrastructuredocs/NetworkingPortingGuide.dox
commsfwsupport/commselements/commsfw/src/cftransport.cpp
commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/createcommdbs.pl
commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/installdefaultcommdb.pl
datacommsserver/esockserver/CoreProviders/src/coremcpractivities.cpp
datacommsserver/esockserver/MobilityCoreProviders/inc/mobilitymcpractivities.h
datacommsserver/esockserver/MobilityCoreProviders/inc/mobilitymcprstates.h
datacommsserver/esockserver/MobilityCoreProviders/src/mobilitymcpractivities.cpp
datacommsserver/esockserver/bwins/esocksvrU.DEF
datacommsserver/esockserver/core_states/ss_corepractivities.cpp
datacommsserver/esockserver/core_states/ss_coreprstates.cpp
datacommsserver/esockserver/core_states/ss_coreprstates.h
datacommsserver/esockserver/eabi/esocksvrU.DEF
datacommsserver/esockserver/eintsock/ss_eintsock_msgs.inl
datacommsserver/esockserver/inc/SS_conn.H
datacommsserver/esockserver/ssock/ss_common.cpp
datacommsserver/esockserver/ssock/ss_sapshim.cpp
datacommsserver/esockserver/ssock/ss_secpol.cpp
datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_004.ini
datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_005.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_004.script
datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_005.script
datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp
datacommsserver/esockserver/test/TestConfig/EIntSock_OneThread/proxy_v1.cmi
datacommsserver/esockserver/test/TestConfig/ProviderConfig1/ipc_v1.cmi
datacommsserver/esockserver/test/TestConfig/ProviderConfig1/pdummy1_v1.cmi
datacommsserver/esockserver/test/TestConfig/ProviderConfig1/pdummy2_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig1/ipc_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig1/pdummy1_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig1/pdummy2_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig2/esock_dealer2_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig2/ipc_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig2/pdummy1_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig2/pdummy2_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig3/esock_dealer2_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig3/ipc_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig3/pdummy1_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig3/pdummy2_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig4/esock_codealer1_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig4/esock_codealer2_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig5/esock_codealer1_v1.cmi
datacommsserver/esockserver/test/TestConfig/TestConfig5/esock_codealer2_v1.cmi
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_mcprpubsubsubscriber.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h
datacommsserver/esockserver/test/providers/dummy/src/dummypr_mcprpubsubsubscriber.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_metaconnprov.cpp
datacommsserver/esockserver/test/util/src/te_esockutilsteps.cpp
datacommsserver/esockserver/test/util/src/ts_esockutilsteps.cpp
--- a/commsfw_info/commsinfrastructuredocs/NetworkingPortingGuide.dox	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,326 +0,0 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of 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:
-// Product documentation
-// Issued
-// Networking
-// Networking team
-// Comms-infras technical architect
-// This document refers to the Symbian OS v9.1 networking subsystem,although sections refer to previous versions of the OS.
-// Network adaptor is the Symbian OS term for the adaptation layer that takes WAN protocols such as IP, and packages them for transport over a specific bearer, for example. CSD, Ethernet, or GPRS.  In 3GPP terms, a network adaptor operates on the TE side of the R interface.
-// A network adaptor consists of two elements, an agent (agt) and a networking interface (nif).
-// Agents are resposible for managing the control plane of a connection.  They provide an interface to the appropriate control component, for example, ETel in the case of CSD and GPRS, or the Bluetooth stack in the case of Bluetooth PAN profile, to perform connection setup and management functions.  They are normally implemented as a state machine, which progresses through a series of states during the lifetime of the connection.
-// The following are the main components of the Symbian OS communications subsystem, as relates to network adaptors.  For an overview of the Symbian OS networking architecture itself, please read the Comms-Infras and Networking Architectural Descriptions.
-// <ul>
-// <li> Commsdat - the communications database.  A DBMS database containing all the settings used by the networking subsystem.  The connection settings in the database are divided into two main types:
-// <ul>
-// <li> "Bearer" tables - Bearers describe basic attributes at the physical layer, such as serial port speeds, and modem init strings.
-// <li> "Service" tables - Services describe details of a service that runs over a bearer, such as a connection to a dial-up ISP.  In this example, the dial-up ISP service table would contain such settings as a phone number, username, password, and the protocols supported by that ISP eg. IPv4, IPv6.
-// </ul>
-// </ul>
-// The "network reference model" refers to the standard components that are delivered in Symbian OS, which are used by Symbian on their reference platforms.  It may be necessary for licensees to customise the subsystem by providing extra components, depending on the feature set of their product.
-// The Symbian OS networking reference model currently has a choice of two NIFs available for communication with the baseband - a PPP NIF, for basebands that require link layer framing; and an IP NIF for basebands that use a communications channel that already provides framing.  CSD and PSD agents are provided for circuit switched connection and primary-context-only packet switched connections.  In cases where primary and secondary contexts are in use, the SPUD NIf should be used with the null agent.
-// Both the PPP NIF and the IP NIF are layered and use plugins conforming to the BCA interface.  This allows plugins to be created to interface to the licensees baseband interconnect solution.  Symbian provides a BCA plugin to interface to the serial server.
-// As a result, licensees wishing to include any of these features will have to customise elements of the networking subsystem.
-// Obviously it is desirable to reuse as much Symbian code as possible, unless there is a pressing reason not to.  In this section, solutions for maximising code reuse are discussed.  In the next section there is a brief discussion of why this might not be desirible, and the other options available.
-// Depending on the support required for various bearers, varying degrees of customisation of the networking subsystem are required.
-// To support CSD connections, some modification of the supplied components might be necessary.  Symbian OS is supplied with a ppp.nif and a csd.agt, so no new NIF or AGT needs to be written.  However, depending upon the method used to interface between Symbian OS and the phone stack, a new CSY may be necessary.  The current PPP implementation expects to talk to C32BCA which is a wrapper around a serial port (ie. a CSY using the RComm interface), so if the TSY also wishes to use a serial port then multiple physical serial ports, or some form of multiplexing CSY will be necessary.  Multiplexing CSYs based around 3GPP 027.010 are available for licensing for Symbian OS.
-// The requirements for supporting a single primary PDP context are the same as those for supporting CSD, but there is an additional requirement on the phone side - that it must contain a PPP server to terminate the PPP connection from Symbian OS.  The phone side server then transfers packets between the PPP link and the GPRS network.  It is possible to use a solution that does not use PPP, however, this would require creating a nif from scratch.
-// To support multiple primary PDP contexts it is necessary to support multiple serial ports between each instance of PPP (representing a context), and the phone side PPP server.  This either requires multiple physical serial ports between Symbian OS and the phone side OS, which limits the number of contexts available to the number of serial ports assigned for this purpose, or use of a multiplexing CSY, such as the 027.010 multiplexing CSY discussed earlier. Note that these details should be hidden behind a BCA.
-// The QoS framework can be configured using the qos ini file. The QoS policies can be loaded from a policy file which is specified in the ini file. The Policy file can be used to add flowspec policies, modulespec policies and extension policies. As the policy configuration tool is not yet implemented, the policy file is the only way to add QoS modules to the framework. 
-// W-CDMA appears similar to GPRS at this level, and therefore all the statements contained within this document that refer to GPRS are applicable to W-CDMA.
-// CDMA2000 support is currently under development within Symbian.  Further details will be added as they become available.
-// In some cases, for example, where a single processor is used to run both Symbian OS and the phone stack, it is more efficient not to use a protocol such as PPP, and instead just pass the data in a very simple framing protocol without error checking.  In this case, it would be necessary to implement a custom nif to perform the appropriate framing.  However, it should still be possible to reuse the Symbian PSD agent, providing that it is not a requirement to support secondary contexts.
-// Nifs and agents are packaged in individual polymorphic DLLs, with a .nif or .agt extension respectively.  The dll should contain a factory class, either CNifIfFactory or CNifAgentFactory, which implements a NewInterfaceL() call to create new instances of the nif or agent.  The DLL exports a single function at ordinal 1, which creates an instance of the appropriate factory object.
-// There should be one instance of a nif/agent pair for each logical interface on the device.  This means that for an interface that carries multiple protocols, such as a PPP link carrying IPv4 and IPv6, there would be a single instance of the nif/agent.  However, if there were a situation where there were multiple link layers running over the same physical bearer; for example, a GPRS network with connections to multiple APNs; there would be multiple instances of the nif/agent combination.  This distintion can be quite a subtle one in some cases - this is a list of the rules for nif/agent creation that Symbian have drawn up so far:
-// In their very basic form, an agent has the following responsibilities:
-// There are three possible Symbian-provided agent base classes.  Depending upon the needs of the agent being created, it should derive from exactly one of these base classes, whichever is most appropriate for the required functionality.
-// There are two main classes in the agx state machine framework - CAgentSMBase and CAgentStateBase.
-// CAgentSMBase is the base class for the state machine - it holds pointers to commsdat, and the Agent Dialog.
-// CAgentStateBase is the base class for individual agent states.
-// The interface from the agent to nifman is the MNifAgentNotify class.  A pointer to the class implementation in nifman is held in the CNifAgentBase class, and is initialised by the base class during agent startup.
-// If an agent implements the extended management interface, it should return a pointer to the appropriate class using the TPckg argument when the following method is called:
-// CNifAgentBase::Control(KCOLAgent, KCOGetAgentEMIPtr, TPckg<MNifAgentExtendedManagementInterface*>);
-// When a network adaptor is started, the agent is the first component to be brought up.  The sequence diagram below shows the actions that are performed by the framework when the connection is started.  As far as the agent is concerned the only method that needs implementing is Connect().
-// The Symbian OS framework for a network interface (nif) mandates two types of object - a link layer object for global management of the nif, and one or more binder layer objects which provide an endpoint for a layer 3 protocol.  The link layer is treated as the nif's global management object, as there is only one per nif instance - this acts as the interface to the nif's control plane.  Each binder layer will be responsible for a single protocol type, which will be demultiplexed by the link layer of the nif.
-// If a nif is a very simple implementation which is only going to handle a single layer 3 protocol type, and the implementator wishes to perform all operations in a single class, it is possible to derive solely from the link layer base class, and return a pointer to this when asked for the binder layer object.  This is possible because the link layer base class is derived from the binder layer base class to allow simple implementations using the minimum number of classes.
-// When designing a nif, it may be useful to consider whether the framing employed by the protocol can be reused over several transport layers - for example, Ethernet framing is used over both Ethernet networks, IR-LAN networks, and Bluetooth PAN networks.  Thus the nif is split into two parts - a 802.3 module, which performs the framing; and a packet driver layer, which provides an interface between the framing layer and the bearer layer, which will either be an Ethernet device driver, IrDA socket, or Ethernet bridge and series of Bluetooth sockets.
-// The main classes that should be implemented by a nif are:
-// The functions below are the ones that a nif should implement.  For BC reasons, there are some methods which are virtual, rather than pure virtual, that a nif must implement.  These are detailed below.
-// CNifIfBase
-// CNifIfLink
-// The interface from the nif to nifman is the MNifIfNotify class.  A pointer to this interface is held in the CNifIfBase and CNifIfLink classes, and is initialised by the base classes during nif startup.
-// BCA hides the R-Interface realization - specific interface from the NIF. Therefore, the same NIF binary can be used with different physical realizations of R-Interface, provided that a suitable implementation of BCA exists.
-// If a nif implements the extended management interface, it should return a pointer to it when the following method is called:
-// CNifIfLink::Control(KCOLInterface, KCOGetNifEMIPtr, TPckg<MNifIfExtendedManagementInterface*>);
-// After the agent has signalled the initial stage of connection startup (ServiceStarted), the nif is loaded by nifman.
-// Once the agent has completed the connection, the nif is then started.
-// Once the nif has brought the link up, it signals the attached layer 3 protocols to indicate the link is ready.  It also sends a signal to nifman to inidicate that the link layer is up, and nifman uses this information to perform a series of actions (eg. starting the idle timers).  Finally, the nif sends a progress notification which is delivered via nifman and esock to any applications that have subscribed to progress notifications for this link.
-// The applications that require secondary PDP context will be making use of the SPUD module. However, this interaction is indirect and through the use of the QoS Framework API. The diagram below shows the interaction between the networking modules and SPUD for using multiple PDP contexts.	
-// The interface between the agent or nif (depending on implementation) and ETel is through the RPacketContext API.  Details of this API, along with a description of how to use it, can be found in the Symbian OS SDK documentation.
-// The interface from GUQoS to the nif is through the Control() call on the CNifIfBase-derived object in the nif.  The interface from the nif back to GUQoS is through the MEventNotify class.  To allow access to the MEventNotify class, the nif should include umtsnifcontrolif.h from /epoc32/include.  It should also link against umtsif.lib.
-// To allow easy migration to the future QoS framework, nif designers would be advised to encapsulate all the functionality that interfaces to ETel (to perform context activation and control) in a seperate module within the nif.  Doing this will make migration to the new scheme much easier.  It is also recommended that nif designers implement a simple tunnelling scheme to route requests received by their CNifIfBase class from GUQoS to their context control class(es), and that they store the MEventNotify pointer within the context control class(es).  Alternately, this tunnelling scheme could be used to pass the commands to the agent, which would then perform the appropriate action.
-// On nif startup, the QoS framework will query the nif's Control() method to find out the name of the QoS plugin that the nif requires.
-// CNifIfBase::Control(KSOLInterface, KSoIfControllerPlugIn , TSoIfControllerInfo);
-// The TSoIfControllerInfo structure should be filled in as follows
-// _LIT(KUmtsPlugInName, "guqos");
-// TSoIfControllerInfo controllerInfo;
-// controllerInfo.iPlugIn = KUmtsPlugInName;
-// controllerInfo.iProtocolId = 360;
-// The GUQoS module will then attempt to register its event handler class with the nif.  This class is used by the nif to report events asynchronously to GUQoS.
-// CNifIfBase::Control(KSOLInterface, KRegisterEventHandler, TNifEvent);
-// The TNifEvent class contains the pointer to the MEventNotify pointer, and should be extracted and stored:
-// TNifEvent& opt = *static_cast<TNifEvent*>(aOption.Ptr());
-// iEvent  = static_cast<MNifEvent*>(opt.iEvent);
-// When GUQoS gets a request for a QoS channel that it cannot already satisfy, it requests that the nif create a new context.
-// CNifIfBase:: Control(KSOLInterface, KContextCreate, aOpt)
-// is called to create secondary PDP context.  The nif should then call:
-// TContextParameters iParameters;
-// iParameters.iReasonCode = KErrNone;
-// iParameters.iContextInfo.iStatus = RPacketContext::EStatusUnknown;   
-// TPckg<TContextParameters> paraPckg(iParameter);
-// MNifEvent::RaiseEvent(reinterpret_cast<CProtocolBase*>(CNifIfBase*), KSecondaryContextCreated, TPckg<TContextParameters>);
-// when the context has been created (note: creation is an action distinct from activation).
-// To set the required TFT on a context, GUQoS will call:
-// Control(KSOLInterface, KContextTFTModify, TPckg<TContextParameters>);
-// When the nif has completed the operation, it should update the TContextParameters structure appropriately, then call:
-// MNifEvent::RaiseEvent(reinterpret_cast<CProtocolBase*>(CNifIfBase*), KContextTFTModifiedEvent, TPckg<TContextParameters>);
-// To alter the QoS settings on a context, GUQoS will call:
-// Control(KSOLInterface, KContextQoSSet, TPckg<TContextParameters>);
-// When the nif has completed the operation, it should update the TContextParameters structure appropriately, then call:
-// MNifEvent::RaiseEvent(reinterpret_cast<CProtocolBase*>(CNifIfBase*), KContextQoSSetEvent, TPckg<TContextParameters>);
-// To trigger the activation of the secondary context, GUQoS will call:
-// Control(KSOLInterface, KContextActivate, TPckg<TContextParameters>);
-// When the nif has completed the operation, it should update the TContextParameters structure appropriately, then call:
-// MNifEvent::Event(reinterpret_cast<CProtocolBase*>(CNifIfBase*), KContextActivateEvent, TPckg<TContextParameters>);
-// Packets are assigned to a context by a QoS module that operates as a hook into the TCP/IP stack.  Each packet has a context identifier inserted in the port field of the destination address entry in the RMBufPktInfo header that is at the start of the RMBufChain containing the packet.  This can be read by the nif, and the packet associated with the appropriate context.  Similarly, on receiving a packet, the nif should insert the context ID into the port field of the source address field of the RMBufPacketInfo header.
-// Obviously this means that the nif must share the context ID numbering with the GUQoS module.  Context IDs are assigned by the nif when it activates the context, and are passed back to the GUQoS module as part of the KSecondaryContextCreated event.
-// Lucy Carroll
-// Drew Reed, Patrik Bannura, Nadeem Wahid, Lucy Carroll, Steve Larkin
-// GUQoS design doc, Nokia Research Centre; v0.05
-// Timescale for delivery of new QoS solution, and Symbian-supplied nif and agent to support it.
-// Agt - AGenT, the component that implements that layer 2 control plane in Symbian OS
-// BCA - Baseband Channel Adaptor, provides an abstract interface for a bearer service
-// Nif - Network InterFace, the component that implements the layer 2 data plane in Symbian OS
-// Network adaptor - the collective term for a nif and agent
-// 0.1,	Draft,	Iain Campbell,	Initial version
-// 0.2,	Draft,	Iain Campbell,	Extended QoS section to include additional info
-// 0.3,	Draft,	Iain Campbell,	Updated after review comments from Nadeem and Lucy; added sequence diagrams
-// 1.0,	Issued,	Iain campbell,	First version issued
-// 1.1,	Issued, Iain Campbell,	Minor typographical updates
-// 1.2,	Draft,	Dino Livanos,	Updated for OS v9.1
-// Any time changes are made to the nif and agent architecture and/or APIs
-// 
-//
-
-/**
- @mainpage Networking porting guide
- @par Classification
- @publishedPartner
- @par Document reference 
- @par Status
- @version 1.2
- @par Team
- @author Iain Campbell
- @par Owner
- @par Approver
- Networking technical architect @n
- @date 04th May 2005
- @section npg_intro Introduction
- @subsection npg_pas Purpose and scope
- @par
- This guide is intended for anyone seeking to customise the Symbian OS networking subsystem for a specific platform or device.  It is typically necessary to modify or replace elements of the networking subsystem in devices to adapt the networking subsystem for the licensees device, depending on the mechanism used to connect the Symbian OS networking subsystem to the cellular modem.  Exact details of the components that need replacing/customising are found in @ref npg_customisingcommssubsys.
- @par
- @subsection npg_networkadaptors Network adaptors
- @par
- @par
- @par
- @par
- Network interfaces are resposible for managing the data plane of a connection, and perform the framing for all data packets that are transferred.  Some nifs are split into two parts, which roughly correspond to the MAC and LLC sublayers in the OSI 7 layer model.  This is usually done where a nif supports multiple bearers, but uses the same framing in each case. In the case of the PPP and IP nifs, the lower layer is licensee replaceable, with the inter-layer interface conforming to the baseband channel adaptor (BCA) interface. More details can be found in the section @ref npg_nif_interface_to_the_bearer.
- @image html nif_and_agt_model.gif
- @section npg_overview An overview of the Symbian OS networking subsystem
- @par
- @image html 3GPP_Release97_NetworkingRefModel.gif "3GPP Release 97 Symbian OS Networking reference model for the cellular modem "
- @image html 3GPP_Release4_NetworkingRefModel.gif "3GPP Release 4 Symbian OS Networking reference model"
- @li %Nifman - the Symbian OS network interface manager.  %Nifman is the controlling entity for the network adapter, it is responsible for loading the agent, and/or NIF. It manages the overall link layer connection state.
- @li Netcon - the Symbian OS network controller.  Netcon is responsible for selecting an appropriate network link layer connection for a client, based on the supplied preferences.  Upon completing the selection of an appropriate connection, it provides this information to nifman, which then either starts a connection (if the client's request requires a new one), or attaches the client to an existing connection.
- @li Agent Dialog - which is not shown in the diagrams above is the component that provides UI-level interaction from the networking subsystem, and the implementation of which is provided by each UI (eg. S60, UIQ).  The code in the networking directory provides this facility for textshell and TechView.  Information for which this component will prompt include IAP and/or SNAP, usernames and passwords, and requests to reconnect.
- @li QoS framework/GUQoS - the Symbian OS IP QoS modules.  The QoS framework provides a framework for handling link-layer QoS for IP related protocols in Symbian OS.  GUQoS, the GPRS/UMTS Quality of Service module, provides a plugin to the QoS framework. It handles link layer QoS control over a GPRS/UMTS network by negotiating the creation and control of secondary PDP contexts via SPUD.
- @li TCPIP6 - the Symbian OS TCP/IP stack.  Supports both IPv4 and IPv6.
- @li SPUD - the Symbian OS secondary PDP context UMTS driver. SPUD is a NIF which provides support for both primary and secondary contexts.  It communicates with the baseband by loading NIFs beneath it - one NIF for the primary context, and one NIF per secondary context.  It interfaces with GUQos and ETel to perform the management of the secondary contexts.
- @section npg_customisingcommssubsys Customising the Symbian OS network subsystem
- @subsection npg_refmodel The Symbian OS network reference model
- @par
- @par
- @par
- @par
- @subsection npg_customisingrefmodel Customising the reference model for a product
- @par
- @par
- @li <b>CSD connections</b> @n
- @li <b>GPRS - single primary PDP context</b> @n
- @li <b>GPRS - multiple primary PDP contexts</b> @n
- @li <b>GPRS - multiple primary and secondary PDP contexts</b> @n
- In the case where secondary PDP contexts are required, the user can configure the system to use the SPUD module which supports primary and multiple secondary PDP contexts. The details of this module and using secondary PDP contexts is described in section @ref npg_qos.
- @li <b>QOS policies</b> @n
- @li @b 3GSM (aka UMTS, W-CDMA) @n
- @li @b CDMA2000 @n
- @subsection npg_customisingotherapproaches Other approaches to customising the Symbian OS networking subsystem
- @par
- @section npg_implementation Implementing a Symbian OS network adaptor
- @subsection npg_nifcreation Nif and agent overview
- @par Nif and agent factories
- @par
- @li GPRS - One nif/agent per primary context
- @li W-CDMA - as GPRS
- @li CDMA2000 - one nif/agent per PPP link layer; and CDMA2000 specs state that only one PPP link layer can be present on the air interface
- @li Ethernet - one nif/agent per Ethernet link layer
- @li Bluetooth PAN profile - one nif/agent per PAN profile network
- @subsection npg_agents Writing an agent
- @par Types of agent
- @li Interface with some connection provider (eg. ETel for CSD and GPRS connections, Bluetooth stack for BT PAN connections) for the purpose of controlling the connection.
- @li Store, and provide access to, connection settings.  Agents may use a variety of methods for storing settings, including a .ini file for simple agents, or using commsdat for more complicated ones.
- @subsubsection npg_agentbaseclasses Agent base classes
- @par
- @li CNifAgentBase The most basic base class.  Agents should derive from CNifAgentBase if they will only ever connect to a single access point (eg. one ISP) which cannot be altered by the user.  In this case they can use a simple .ini file to store the settings for this access point.
- @li CAgentBase The base class for a more advanced agent.  Agents should derive from CAgentBase if they required access to settings in commsdat, and (optionally) allow user programs to override the settings on a per-connection basis.  CAgentBase handles all the details of accessing commsdat, as well as handling overrides and interaction with netcon, meaning that the agent implementation just needs to handle the creation and control of the connection.
- @li CStateMachineAgentBase The base class for porting agent extensions from Symbian OS v6.1.  However, as there is currently no other base class that provides a state machine framework, this is also the de facto base class for implementing agents that require a state machine.  Alternately, an agent is free to implement its own state machine in whichever way it wishes - use of this class is not required.  For details of implementing agents using the agx state machine framework, see @ref npg_implementing_an_agx.
- @subsubsection npg_implementing_an_agx The v6.1 agent extension (.agx) base classes
- @par
- @par
- @par
- @subsubsection npg_nifman_agt_interface Agent interface to nifman
- @par
- @subsubsection npg_agt_add_apis Additional agent APIs to implement
- @par
- There is an additional API that an agent may choose to support - MNifAgentExtendedManagementInterface.  This has two main areas - it allows agents to report detailed information about the connection, such as the bearer type and bearer specific information; and it extends the concept of a connection to include subconnections.  For more details on the concept of connections and subconnections as implemented in Symbian OS, see @ref networking_concepts.
- @par
- @code
- @endcode
- @par
- In order to override the compatibility layer that is provided for nifs and agents that do not implement the extended management interface, both the nif and agent involved in a connection must support the extended management interfaces.  The API that nifs must implement is described in @ref npg_nif_add_apis.
- @subsubsection npg_nifman_agt_seqdigs Sequence diagrams for agent startup
- @par
- @image html seqdig-agentstart.gif
- @par
- The next stage in connection startup can be seen in @ref npg_nifman_nif_seqdigs.
- @subsection npg_nifs Writing a nif
- @par		
- @par
- @par
- @subsubsection npg_nif_base_classes Nif base classes
- @par
- @li CNifIfBase This is the base class for each binder layer.
- @li CNifIfLink This is the base class for the link layer
- @par Functions to implement 
- @par
- @li CNifIfBase::BindL
- @li CNifIfBase::Open
- @li CNifIfBase::Close
- @li CNifIfBase::Send
- @li CNifIfBase::Control - if the nif is to support any functionality that cannot be accessed through the existing API eg. fetching interface configuration.
- @li CNifIfBase::Info
- @li CNifIfBase::Notification
- @li CNifIfBase::State
- @par
- @li CNifIfLink::Start
- @li CNifIfLink::Stop
- @li CNifIfLink::AuthenticateComplete
- @li CNifIfLink::GetBinderL
- @li CNifIfLink::Restart - if the nif supports binder layer restart without link layer restart, eg. PPP
- @subsubsection npg_nifman_nif_interface Nif interface to nifman
- @par 
- @subsubsection npg_nif_interface_to_the_bearer Nif interface to the bearer
- @par 
- @image html nif-bearer-interface.gif
- @par
- @subsubsection npg_nif_add_apis Additional nif APIs to implement
- @par
- There is an additional API that a nif may choose to support - MNifIfExtendedManagementInterface.  This has two main areas - it allows nifs to report statistical information, such as the number of bytes sent and received; and it extends the concept of a connection to include subconnections.  For more details on the concept of connections and subconnections as implemented in Symbian OS, see @ref networking_concepts.
- @par
- @code
- @endcode
- @par
- In order to override the compatibility layer that is provided for nifs and agents that do not implement the extended management interface, both the nif and agent involved in a connection must support the extended management interfaces.  The API that agents must implement is described in @ref npg_agt_add_apis.
- @subsubsection npg_nifman_nif_seqdigs Sequence diagrams for nif startup
- @par 
- @image html seqdig-nifload.gif
- @par
- @image html seqdig-nifstart.gif
- @par
- @image html seqdig-niflinkup.gif
- @subsection npg_qos Using secondary PDP context UMTS driver
- @par
- @image html spud_interaction.gif
- @subsubsection npg_etel_interface Implementing the interface to ETel
- @par
- @subsubsection npg_guqos_interface Implementing the interface to GUQoS
- @par
- @par
- @par Declaring which QoS module to use
- @code
- @endcode
- @code
- @endcode
- @par GUQoS event handler registration
- @code
- @endcode
- @code
- @endcode
- @par Setting up a new secondary context
- @code
- @endcode
- @code
- @endcode
- @par Setting the Traffic Flow Template (TFT) on a context
- @code
- @endcode
- @code
- @endcode
- @par Altering the QoS on a context
- @code
- @endcode
- @code
- @endcode
- @par Activating a secondary context
- @code
- @endcode
- @code
- @endcode
- @subsubsection npg_tcpip_interface Assigning packets to contexts
- @par
- @par Assigning context IDs
- @section npg_furtherinfo Further information
- @subsection npg_people People
- @subsubsection npg_people_contributors Contributors
- @verbatim
- @endverbatim
- @subsubsection npg_people_reviewers Reviewers
- @verbatim
- @endverbatim
- @subsubsection npg_people_distribution Distribution
- @verbatim
- @endverbatim
- @subsection npg_ref References
- @verbatim
- @endverbatim
- @subsection npg_openissues Open Issues
- @subsection npg_glossary Glossary
- @verbatim
- @endverbatim	
- @subsection npg_dochistory Document history
- @verbatim
- @endverbatim
- @subsection npg_docreview Document review date
- @par
-*/
--- a/commsfwsupport/commselements/commsfw/src/cftransport.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/commsfwsupport/commselements/commsfw/src/cftransport.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -1108,7 +1108,7 @@
 	TRuntimeCtxIdOp op(nodeId);
 	op.Set(iPointerSalt, iThreadRegister.SelfWorkerId());
 //TODO - it would be better to print the whole address (aCookie.Size() bytes starting from &aCookie == aCookie.Printable();)
-	__CFLOG_VAR(( KLogCommsFw, KLogFwTransport, _L8("RegisterItf(%08x) => %08x:%08x"), nodeId.Ptr(), *reinterpret_cast<TUint*>(&aCookie), *(reinterpret_cast<TUint*>(&aCookie) + 1)));
+	__CFLOG_VAR(( KLogCommsFw, KLogFwTransport, _L8("RegisterItf(%08x) => %08x %08x"), nodeId.Ptr(), *reinterpret_cast<TUint*>(&aCookie), *(reinterpret_cast<TUint*>(&aCookie) + 1)));
 
 #ifdef SYMBIAN_TRACE_ENABLE
 	__ASSERT_ALWAYS(!iIntfRegister.Find(TIntPtr(nodeId.Ptr())), Panic(ECFTransBadRegistration));
@@ -1135,7 +1135,7 @@
 	{
 	//This transport implementation currently only registers TNodeId
 //TODO - it would be better to print the whole address (aCookie.Size() bytes starting from &aCookie == aCookie.Printable();)
-	__CFLOG_VAR(( KLogCommsFw, KLogFwTransport, _L8("DeregisterItf(%08x => %08x:%08x"), address_cast<TNodeId>(aCookie).Ptr(), *reinterpret_cast<const TUint*>(&aCookie), *(reinterpret_cast<const TUint*>(&aCookie) + 1)));
+	__CFLOG_VAR(( KLogCommsFw, KLogFwTransport, _L8("DeregisterItf(%08x) => %08x %08x"), address_cast<TNodeId>(aCookie).Ptr(), *reinterpret_cast<const TUint*>(&aCookie), *(reinterpret_cast<const TUint*>(&aCookie) + 1)));
 	--iRegisteredCount;
 	__ASSERT_ALWAYS(iRegisteredCount >= 0, Panic(ECFExcessInterfaceDeregistration));
 	aCookie.SetNull();
--- a/commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/createcommdbs.pl	Mon Mar 15 12:45:15 2010 +0200
+++ b/commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/createcommdbs.pl	Wed Mar 31 23:27:09 2010 +0300
@@ -212,13 +212,13 @@
 $zDrive = $release . $cedPlatfrom . '/' . $cedVariant . '/z';
 $zDriveCre = $zDrive . $cccccc00Root . $cccccc00NameCre;
 $CdbEmpty = $zDrive . $cccccc00Root . $cccccc00Nametxt;
+$romCdb = $epocRoot . 'epoc32/' . 'data/z' . $cccccc00Root . $cccccc00NameCre; 
 
 if ($::command eq 'build') 
 {
 	$ced = $release . $cedPlatfrom . '/' . $cedVariant . '/ced.exe';
 	$emulatorstore = $epocRoot . 'epoc32/' . $cedPlatfrom . $cdbIn;
 	$winsCdb = $epocRoot . 'epoc32/' . $cedPlatfrom . '/c' . $cccccc00Root . "persists/" . $cccccc00NameCre;
-	$romCdb = $epocRoot . 'epoc32/' . 'data/z' . $cccccc00Root . $cccccc00NameCre; 
 	
 	if ($platType =~ 'emulator')
 	{
@@ -317,7 +317,10 @@
 		else 
 		{
 			print("$data->{$platType}->{sourceCfg} older than $data->{$platType}->{destinationCdb}\n");
-			print("Construction aborted.\n");
+			print("Construction aborted. Copy-younger of resource CRE only\n");
+			#copy to z drive
+			print("CopyIfYounger $winsCdb to $zDriveCre\n");
+			CopyIfYounger($winsCdb, $zDriveCre);
 		}
 	}
 	else 
@@ -347,6 +350,14 @@
 {
 	print("$data->{$platType}->{destinationCdb}\n");
 	print("$CdbEmpty\n");
+	if($::platform =~ /wins/i)
+	{
+		print("$zDriveCre \n");
+	}
+	else
+	{
+		print("$romCdb\n");
+	}
 }
 
 sub RunCed 
--- a/commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/installdefaultcommdb.pl	Mon Mar 15 12:45:15 2010 +0200
+++ b/commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/installdefaultcommdb.pl	Wed Mar 31 23:27:09 2010 +0300
@@ -94,19 +94,22 @@
 
 $CdbDest = $data->{$platType}->{destinationCdb};
 
+##
+## NOTE: all copying and releasing is now done from defaultcommdb - this installdefaultcommdb should be entirely deleted, system model updated, etc
+##
 
-if ($::command eq 'build') 
-{
-	PreBuild();
-}
-elsif ($::command eq 'clean')
-{
-	Clean();
-}
-elsif ($::command eq 'releasables') 
-{
-	Releasables();
-}
+#if ($::command eq 'build') 
+#{
+#	PreBuild();
+#}
+#elsif ($::command eq 'clean')
+#{
+#	Clean();
+#}
+#elsif ($::command eq 'releasables') 
+#{
+#	Releasables();
+#}
 
 #
 # Subs.
--- a/datacommsserver/esockserver/CoreProviders/src/coremcpractivities.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/CoreProviders/src/coremcpractivities.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -146,7 +146,7 @@
 	NODEACTIVITY_ENTRY(KNoTag, MCprStates::TSelectNextLayer, MCprStates::TAwaitingSelectNextLayerCompleted, CoreNetStates::TNoTagOrBearerPresent)
 
 	//Special for the Meta Plane (don't just copy & paste)
-	NODEACTIVITY_ENTRY(CoreNetStates::KBearerPresent, CoreNetStates::TStartServiceProvider, CoreNetStates::TAwaitingStarted, TTag<CoreNetStates::KBearerPresent>)
+//	NODEACTIVITY_ENTRY(CoreNetStates::KBearerPresent, CoreNetStates::TStartServiceProvider, CoreNetStates::TAwaitingStarted, TTag<CoreNetStates::KBearerPresent>)
 	NODEACTIVITY_ENTRY(CoreNetStates::KBearerPresent, CoreNetStates::TRequestCommsBinderRetry, CoreNetStates::TAwaitingBinderResponse, TTag<CoreNetStates::KBearerPresent>)
 	NODEACTIVITY_ENTRY(CoreNetStates::KBearerPresent, CoreNetStates::TSendBindTo, CoreNetStates::TAwaitingBindToComplete, TTag<CoreNetStates::KBearerPresent>)
 	THROUGH_NODEACTIVITY_ENTRY(CoreNetStates::KBearerPresent, CoreActivities::ABindingActivity::TSendBindToComplete, MeshMachine::TNoTag)
@@ -163,10 +163,6 @@
 	FIRST_NODEACTIVITY_ENTRY(MCprStates::TAwaitingReConnectRequest, MeshMachine::TNoTag)
 	THROUGH_NODEACTIVITY_ENTRY(KNoTag, CReConnectActivity::TProcessReConnectRequest, MeshMachine::TNoTag)
 
-	//Start reconnection by stopping the old MCpr
-	NODEACTIVITY_ENTRY(KNoTag, CReConnectActivity::TStopStartedServiceProvider, CoreNetStates::TAwaitingStopped, MeshMachine::TNoTag)
-	NODEACTIVITY_ENTRY(KNoTag, CReConnectActivity::TStartNextServiceProvider, CoreNetStates::TAwaitingStarted, MeshMachine::TNoTag)
-
 	//Build lower layer
 	NODEACTIVITY_ENTRY(KNoTag, CReConnectActivity::TBuildLowerLayer, CoreNetStates::TAwaitingBindToComplete, MeshMachine::TNoTag)
 
@@ -203,28 +199,6 @@
 NODEACTIVITY_END()
 }
 
-namespace MCprStartActivity
-{
-//Semantics of start on the meta plane differ from the one on connection plane.
-//Meta provider is started with the first requesting client and stopped with the last one.
-//Since in our reference MCprs we do not do anything on start or stop (except keeping the
-//sequences right for other activities) we are just responding back with the proper message.
-DECLARE_DEFINE_NODEACTIVITY(ECFActivityStart, MCprStart, TCFServiceProvider::TStart)
-	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendStarted, CoreNetStates::TAwaitingStart, MeshMachine::TNoTag)
-NODEACTIVITY_END()
-}
-
-namespace MCprStopActivity
-{
-//Semantics of start on the meta plane differ from the one on connection plane.
-//Meta provider is started with the first requesting client and stopped with the last one.
-//Since in our reference MCprs we do not do anything on start or stop (except keeping the
-//sequences right for other activities) we are just responding back with the proper message.
-DECLARE_DEFINE_NODEACTIVITY(ECFActivityStop, MCprStop, TCFServiceProvider::TStop)
-	NODEACTIVITY_ENTRY(KNoTag, PRStates::TSendStopped, CoreNetStates::TAwaitingStop, MeshMachine::TNoTag)
-NODEACTIVITY_END()
-}
-
 namespace MCprReportProviderStatusActivity
 {
 DECLARE_DEFINE_NODEACTIVITY(ECFActivityReportProviderStatus, MCprReportProviderStatus, TCFMcpr::TProviderStatusChangeRegistration)
@@ -272,14 +246,36 @@
 NODEACTIVITY_END()
 }
 
-namespace MCprDataClientStopActivity
+namespace MCprStartActivity
 {
-DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStopDataClient, MCprDataClientStop, TCFDataClient::TStop, MeshMachine::CNodeRetryActivity::NewL)
-	FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientStop, MeshMachine::TNoTag)
-	THROUGH_NODEACTIVITY_ENTRY(KNoTag, PRStates::TProcessDataClientStop, CoreNetStates::TNoTagOrDataClientsToStopBlockedByStarting)
+DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStart, MCprStart, TCFServiceProvider::TStart, PRActivities::CStartActivity::NewL)
+    FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStart, CoreNetStates::TNoTagOrBearerPresentBlockedByStop)
+	NODEACTIVITY_ENTRY(KNoTag, MCprStates::TSelectNextLayer, MCprStates::TAwaitingSelectNextLayerCompleted, CoreNetStates::TNoTagOrBearerPresent)
+	NODEACTIVITY_ENTRY(CoreNetStates::KBearerPresent, CoreNetStates::TBindSelfToPresentBearer, CoreNetStates::TAwaitingBindToComplete, TTag<CoreNetStates::KBearerPresent>)
 
-	NODEACTIVITY_ENTRY(CoreNetStates::KDataClientsToStop, CoreNetStates::TStopDataClients, CoreNetStates::TAwaitingDataClientsStopped, MeshMachine::TNoTag)
-	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TClearError)
+	//Start the service provider, use the default cancellation.
+	//Forward TCancel to the service provider, wait for TStarted or TError (via the Error Activity)
+	//When TStarted arrives after TCancel the activity will move to the nearest KErrorTag
+	NODEACTIVITY_ENTRY(CoreNetStates::KBearerPresent, CoreNetStates::TStartServiceProviderRetry, CoreNetStates::TAwaitingStarted, MeshMachine::TNoTagOrErrorTag)
+	LAST_NODEACTIVITY_ENTRY(KErrorTag, MeshMachine::TDoNothing)
+	//Start data clients, use the default cancellation.
+	//Forward TCancel to the self, wait for TCFDataClient::TStarted or TError (via the Error Activity)
+	//When TCFDataClient::TStarted arrives after TCancel the activity will move to the nearest KErrorTag
+	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TStartSelf, CoreNetStates::TAwaitingDataClientStarted, MeshMachine::TNoTagOrErrorTag)
+	NODEACTIVITY_ENTRY(KErrorTag, CoreNetStates::TStopSelf, CoreNetStates::TAwaitingDataClientStopped, MeshMachine::TErrorTag)
+	LAST_NODEACTIVITY_ENTRY(KErrorTag, MeshMachine::TDoNothing)
+	LAST_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendStarted)
+NODEACTIVITY_END()
+}
+
+namespace MCprStopActivity
+{
+DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStop, MCprStop, TCFServiceProvider::TStop, MeshMachine::CNodeRetryActivity::NewL)
+	FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStop, CoreNetStates::TActiveOrNoTagBlockedByBindTo)
+	THROUGH_NODEACTIVITY_ENTRY(KActiveTag, CoreNetStates::TCancelDataClientStart, MeshMachine::TNoTag)
+	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TStopSelf, CoreNetStates::TAwaitingDataClientStopped, CoreNetStates::TNoTagOrNoBearer)
+	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendStop, CoreNetStates::TAwaitingStopped, TTag<CoreNetStates::KNoBearer>)
+	LAST_NODEACTIVITY_ENTRY(CoreNetStates::KNoBearer, PRStates::TSendStoppedAndGoneDown)
 NODEACTIVITY_END()
 }
 
@@ -293,16 +289,15 @@
 	ACTIVITY_MAP_ENTRY(MCprSimpleSelectActivitySuper, MCprSimpleSelect)
 	ACTIVITY_MAP_ENTRY(MCprNoBearerActivity, MCprNoBearer)
 	ACTIVITY_MAP_ENTRY(MCprReConnectActivity, MCprReConnect)
-	ACTIVITY_MAP_ENTRY(MCprStopActivity, MCprStop)
 	ACTIVITY_MAP_ENTRY(MCprAvailabilityNotificationActivity, MCprAvailability)
 	ACTIVITY_MAP_ENTRY(MCprBinderRequestActivity, MCprBinderRequest)
-	ACTIVITY_MAP_ENTRY(MCprStartActivity, MCprStart)
 	ACTIVITY_MAP_ENTRY(MCprReportProviderStatusActivity, MCprReportProviderStatus)
 	ACTIVITY_MAP_ENTRY(MCprDataClientJoinActivity, MCprDataClientJoin)
 	ACTIVITY_MAP_ENTRY(MCprControlClientJoinActivity, MCprControlClientJoin)
 	ACTIVITY_MAP_ENTRY(MCprErrorRecoveryDefaultActivity, DefaultErrorRecovery)
 	ACTIVITY_MAP_ENTRY(MCprDataClientGoneDownActivity, MCprDataClientGoneDown)
-	ACTIVITY_MAP_ENTRY(MCprDataClientStopActivity, MCprDataClientStop)
+	ACTIVITY_MAP_ENTRY(MCprStopActivity, MCprStop)
+	ACTIVITY_MAP_ENTRY(MCprStartActivity, MCprStart)
 ACTIVITY_MAP_END_BASE(PRActivities, coreActivitiesMCpr)
 
 //This activiy map supports legacy selection and the additional activity
@@ -796,27 +791,6 @@
 	__ASSERT_DEBUG(activity.iStartingSP->Type()&TCFClientType::EServProvider, User::Panic(KSpecAssert_ESockCoreProvcprac, 22));
 	}
 
-DEFINE_SMELEMENT(CReConnectActivity::TStopStartedServiceProvider, NetStateMachine::MStateTransition, CReConnectActivity::TContext)
-void CReConnectActivity::TStopStartedServiceProvider::DoL()
-	{
-	__ASSERT_DEBUG(iContext.iNodeActivity, CoreMCprPanic(KPanicNoActivity));
-	CReConnectActivity& activity = static_cast<CReConnectActivity&>(*iContext.iNodeActivity);
-
-	__ASSERT_DEBUG(activity.iStoppingSP, User::Panic(KSpecAssert_ESockCoreProvcprac, 23));
-	activity.PostRequestTo(*activity.iStoppingSP, TCFServiceProvider::TStop(0).CRef());
-	}
-
-DEFINE_SMELEMENT(CReConnectActivity::TStartNextServiceProvider, NetStateMachine::MStateTransition, CReConnectActivity::TContext)
-void CReConnectActivity::TStartNextServiceProvider::DoL()
-	{
-	__ASSERT_DEBUG(iContext.iNodeActivity, CoreMCprPanic(KPanicNoActivity));
-	CReConnectActivity& activity = static_cast<CReConnectActivity&>(*iContext.iNodeActivity);
-	__ASSERT_DEBUG(activity.iStartingSP, User::Panic(KSpecAssert_ESockCoreProvcprac, 24));
-
-	//Start the service provider
-	activity.PostRequestTo(*activity.iStartingSP, TCFServiceProvider::TStart().CRef());
-	}
-
 DEFINE_SMELEMENT(CReConnectActivity::TBuildLowerLayer, NetStateMachine::MStateTransition, CReConnectActivity::TContext)
 void CReConnectActivity::TBuildLowerLayer::DoL()
 	{
--- a/datacommsserver/esockserver/MobilityCoreProviders/inc/mobilitymcpractivities.h	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/MobilityCoreProviders/inc/mobilitymcpractivities.h	Wed Mar 31 23:27:09 2010 +0300
@@ -49,7 +49,7 @@
 	CMobilityActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
 	virtual ~CMobilityActivity();
 	typedef MeshMachine::TNodeContext<CMobilityMetaConnectionProvider, MCprStates::TContext> TContext;
-	
+
 private:
 	TBool EvaluatePreference(TContext& aContext);
 
@@ -58,24 +58,29 @@
 
 private:
 	ESock::RMetaServiceProviderInterface* iCurrent;
-	ESock::RMetaServiceProviderInterface* iPreferred;
+	ESock::RMetaServiceProviderInterface* iAvailable;
+	ESock::RMetaServiceProviderInterface* iCandidate;
 	const TUint iAvailabilityScoreTreshold;
 
 
 public:
-		
+
 	DECLARE_SMELEMENT_HEADER(TAwaitingCurrentCarrierRejectedOrAvailabilityChange, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext)
 		virtual TBool Accept();
 	DECLARE_SMELEMENT_FOOTER(TAwaitingCurrentCarrierRejectedOrAvailabilityChange)
-	
+
 	DECLARE_SMELEMENT_HEADER(TNoTagOrAwaitMobility, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, CMobilityActivity::TContext)
 		virtual TInt TransitionTag();
-	DECLARE_SMELEMENT_FOOTER(TNoTagOrAwaitMobility)	
+	DECLARE_SMELEMENT_FOOTER(TNoTagOrAwaitMobility)
+
+	DECLARE_SMELEMENT_HEADER(TNoTagOrReConnectOrStartMobilityHandshakeBackwards, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, CMobilityActivity::TContext)
+		virtual TInt TransitionTag();
+	DECLARE_SMELEMENT_FOOTER(TNoTagOrReConnectOrStartMobilityHandshakeBackwards)
 
 	DECLARE_SMELEMENT_HEADER(TNoTagOrStartMobilityHandshakeBackwards, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, CMobilityActivity::TContext)
 		virtual TInt TransitionTag();
 	DECLARE_SMELEMENT_FOOTER(TNoTagOrStartMobilityHandshakeBackwards)
-	
+
 	DECLARE_SMELEMENT_HEADER(TNoTagOrAwaitMobilityBackwardsOnMobilityTrigger, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, CMobilityActivity::TContext)
 		virtual TInt TransitionTag();
 	DECLARE_SMELEMENT_FOOTER(TNoTagOrAwaitMobilityBackwardsOnMobilityTrigger)
@@ -83,7 +88,7 @@
 	DECLARE_SMELEMENT_HEADER(TRejectedOrStartMobilityHandshakeBackwards, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, TContext)
         virtual TInt TransitionTag();
     DECLARE_SMELEMENT_FOOTER(TRejectedOrStartMobilityHandshakeBackwards)
-	
+
 	DECLARE_SMELEMENT_HEADER(TClearHandshakingFlag, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, CMobilityActivity::TContext)
 		virtual void DoL();
 	DECLARE_SMELEMENT_FOOTER(TClearHandshakingFlag)
@@ -105,20 +110,20 @@
 	DECLARE_SMELEMENT_HEADER(TInformMigrationCompleted, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, CMobilityActivity::TContext)
 		virtual void DoL();
 	DECLARE_SMELEMENT_FOOTER(TInformMigrationCompleted)
-	
-	typedef MeshMachine::TActivitiesIdMutex<ESock::ECFActivityConnectionStartRecovery, 
+
+	typedef MeshMachine::TActivitiesIdMutex<ESock::ECFActivityConnectionStartRecovery,
 											ESock::ECFActivityConnectionGoneDownRecovery> TActivityErrorRecoveryMutex;
 	DECLARE_SERIALIZABLE_STATE(
 	    TNoTagOrAwaitMobilityBackwardsOnMobilityTriggerBlockedByErrorRecovery,
 		TActivityErrorRecoveryMutex,
 		TNoTagOrAwaitMobilityBackwardsOnMobilityTrigger
-		)	
-	
+		)
+
 	DECLARE_SERIALIZABLE_STATE(
 		TNoTagOrAwaitMobilityBlockedByErrorRecovery,
 		TActivityErrorRecoveryMutex,
 		TNoTagOrAwaitMobility
-		)		
+		)
 	};
 
 ///////////////////////////////////////////////////////////////////////////////
--- a/datacommsserver/esockserver/MobilityCoreProviders/inc/mobilitymcprstates.h	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/MobilityCoreProviders/inc/mobilitymcprstates.h	Wed Mar 31 23:27:09 2010 +0300
@@ -42,6 +42,7 @@
 const TInt KStartMobilityHandshake	= 10000;
 const TInt KAwaitMobility        	= 10001;
 const TInt KRejected                = 10002;
+const TInt KReConnect               = 10003;
 
 //-=========================================================
 //
--- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitymcpractivities.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitymcpractivities.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -15,7 +15,7 @@
 
 #include <elements/nm_messages_errorrecovery.h>
 #include <comms-infras/ss_coreprstates.h>
-#include "mobilitymcpractivities.h"
+#include <comms-infras/mobilitymcpractivities.h>
 #include <comms-infras/mobilitymcprstates.h>
 #include <comms-infras/ss_nodemessages_selector.h>
 #include <comms-infras/ss_nodemessages_mobility.h>
@@ -87,7 +87,7 @@
 	//if it sees that the availability notification has influcenced what the currently preffered bearer should be.
 	THROUGH_NODEACTIVITY_ENTRY(KNoTag, CMobilityActivity::TSendAvailabilityRequest, MeshMachine::TTag<MobilityMCprStates::KStartMobilityHandshake>)
 
-	//<BEGIN> MAIN LOOP ****************	
+	//<BEGIN> MAIN LOOP ****************
 	//The main mobility handshake loop. The loop is executed when performing migration from one service provider to another.
 	//The entry condition for the loop is that:
 	//- upgrade: a better then current access point is now available (a better access point reported available)
@@ -97,23 +97,25 @@
 	//      NOTE: if the current bearer ceases to be available completely (goes down), then this will be assisted by an error recovery request;
 	//      NOTE: This tuple doesn't actually do (b), i.e.: assumes the threshold of '1' (in 0..100 availability score range)
 	//Before awaitng for availability change or rejection by the client (TAwaitingCurrentCarrierRejectedOrAvailabilityChange), the activity
-	//first checks (TNoTagOrAwaitMobilityBlockedByErrorRecovery) if the availability has changed since it last checked 
-	//(availability could have been reported amidst the previous handshake loop) 
+	//first checks (TNoTagOrAwaitMobilityBlockedByErrorRecovery) if the availability has changed since it last checked
+	//(availability could have been reported amidst the previous handshake loop)
 	THROUGH_NODEACTIVITY_ENTRY(MobilityMCprStates::KStartMobilityHandshake, CMobilityActivity::TClearHandshakingFlag, CMobilityActivity::TNoTagOrAwaitMobilityBlockedByErrorRecovery)
 	    NODEACTIVITY_ENTRY(MobilityMCprStates::KAwaitMobility, MeshMachine::TDoNothing, CMobilityActivity::TAwaitingCurrentCarrierRejectedOrAvailabilityChange, CMobilityActivity::TNoTagOrAwaitMobilityBackwardsOnMobilityTriggerBlockedByErrorRecovery)
 
-		//Mobility has been triggered ((a) or (b)). Start mobility handshake (set handshaking flag and inform the client about the preferred bearer) 
-		NODEACTIVITY_ENTRY(KNoTag, CMobilityActivity::TInformMigrationAvailableAndSetHandshakingFlag, MobilityMCprStates::TAwaitingMigrationRequestedOrRejected, CMobilityActivity::TNoTagOrStartMobilityHandshakeBackwards)
+		//Mobility has been triggered ((a) or (b)). Start mobility handshake (set handshaking flag and inform the client about the preferred bearer)
+		//ReConnect only needs to be done if the bearer is different from the curret bearer.
+		NODEACTIVITY_ENTRY(KNoTag, CMobilityActivity::TInformMigrationAvailableAndSetHandshakingFlag, MobilityMCprStates::TAwaitingMigrationRequestedOrRejected, CMobilityActivity::TNoTagOrReConnectOrStartMobilityHandshakeBackwards)
+		//The client accepts the new access point.
 		//The client accepts the new access point. 
 		//For the moment it is sufficient to use the re-connect activity, in the future we may want to
 		//customise the behavior, for example start the new layer before rebinding it, etc.
 		//Should rebinding fail, the mobility activity will be set to an error mode. The error mode will be cleared if
 		//there are other bearers this activity can offer. If there aren't the data client will be errored.
-		NODEACTIVITY_ENTRY(KNoTag, CMobilityActivity::TRequestReConnect, MCprStates::TAwaitingReConnectCompleteOrError, CMobilityActivity::TNoTagOrStartMobilityHandshakeBackwards)
+		NODEACTIVITY_ENTRY(MobilityMCprStates::KReConnect, CMobilityActivity::TRequestReConnect, MCprStates::TAwaitingReConnectCompleteOrError, CMobilityActivity::TNoTagOrStartMobilityHandshakeBackwards)
 		//Rebinding has been successful. As far as MCPR is concerned, the mobility is finished, but the MCPR must await
-		//for the handshake (accept|reject) before it can offer another bearer. 
-        NODEACTIVITY_ENTRY(KNoTag, CMobilityActivity::TInformMigrationCompleted, MobilityMCprStates::TAwaitingMigrationAcceptedOrRejected, CMobilityActivity::TRejectedOrStartMobilityHandshakeBackwards)
-        NODEACTIVITY_ENTRY(MobilityMCprStates::KRejected, CoreNetStates::TStopDataClients, CoreNetStates::TAwaitingDataClientsStopped, MeshMachine::TTag<MobilityMCprStates::KStartMobilityHandshake|NetStateMachine::EBackward>)
+		//for the handshake (accept|reject) before it can offer another bearer.
+	NODEACTIVITY_ENTRY(KNoTag, CMobilityActivity::TInformMigrationCompleted, MobilityMCprStates::TAwaitingMigrationAcceptedOrRejected, CMobilityActivity::TRejectedOrStartMobilityHandshakeBackwards)
+	NODEACTIVITY_ENTRY(MobilityMCprStates::KRejected, CoreNetStates::TStopDataClients, CoreNetStates::TAwaitingDataClientsStopped, MeshMachine::TTag<MobilityMCprStates::KStartMobilityHandshake|NetStateMachine::EBackward>)
 NODEACTIVITY_END()
 }
 
@@ -211,11 +213,12 @@
 	    //  - current bearer rejected;
 	    //  - proposed bearer rejected;
 	    //  - failure to migrate to the proposed bearer;
-        lastRejected = iPreferred ? iPreferred : 
-                                    static_cast<RMetaServiceProviderInterface*>(aContext.Node().ServiceProvider()); 
+        lastRejected = iAvailable ? iAvailable :
+                                    static_cast<RMetaServiceProviderInterface*>(aContext.Node().ServiceProvider());
 	    }
-	
-	iPreferred = NULL; //Do not remember rejected candidate any longer
+
+	iCandidate = iAvailable;
+	iAvailable = NULL; //Do not remember rejected candidate any longer
 	while ((candidate = static_cast<RMetaServiceProviderInterface*>(iter++)) != NULL)
 		{
 		const TAvailabilityStatus& status = candidate->AvailabilityStatus();
@@ -230,7 +233,8 @@
 		if (status.Score() > iAvailabilityScoreTreshold
 			&& candidate!=lastRejected)
 			{
-			if (candidate->Flags() & TCFClientType::EStarted)
+			if (candidate==aContext.Node().ServiceProvider()
+			    && Error() == KErrNone )
 				{
 				//The preferred one is the current one, is still available and was not just rejected.
 				//No need to do anything more.
@@ -238,7 +242,7 @@
 				}
 
 			//A new match found
-			iPreferred = candidate;
+			iAvailable = candidate;
 			return ETrue;
 			}
 		}
@@ -257,6 +261,22 @@
 	static_cast<CMobilityMetaConnectionProvider&>(iNode).iIsHandshakingNow = EFalse;
 	}
 
+DEFINE_SMELEMENT(CMobilityActivity::TNoTagOrReConnectOrStartMobilityHandshakeBackwards, NetStateMachine::MStateFork, CMobilityActivity::TContext)
+TInt CMobilityActivity::TNoTagOrReConnectOrStartMobilityHandshakeBackwards::TransitionTag()
+	{
+	if (iContext.Activity()->Error() == KErrNone &&
+	    (message_cast<TCFMobilityProvider::TMigrationRequested>(&iContext.iMessage) ||
+	     message_cast<TCFMcpr::TReConnectComplete>(&iContext.iMessage)))
+		{
+	        CMobilityActivity& activity = static_cast<CMobilityActivity&>(*iContext.iNodeActivity);
+			if( activity.iCurrent!=activity.iAvailable )
+			    return MobilityMCprStates::KReConnect | NetStateMachine::EForward;
+			else
+		        return MeshMachine::KNoTag | NetStateMachine::EForward;
+		}
+	return MobilityMCprStates::KStartMobilityHandshake | NetStateMachine::EBackward;
+	}
+
 DEFINE_SMELEMENT(CMobilityActivity::TNoTagOrStartMobilityHandshakeBackwards, NetStateMachine::MStateFork, CMobilityActivity::TContext)
 TInt CMobilityActivity::TNoTagOrStartMobilityHandshakeBackwards::TransitionTag()
 	{
@@ -273,13 +293,13 @@
 TInt CMobilityActivity::TNoTagOrAwaitMobilityBackwardsOnMobilityTrigger::TransitionTag()
 	{
 	//This is where the judgement is made on whether to trigger mobility (offer the client another bearer)
-	//or ignore and come back waiting. 
+	//or ignore and come back waiting.
 	__ASSERT_DEBUG(iContext.iMessage.IsMessage<TCFMobilityProvider::TMigrationRejected>() ||
-			iContext.iMessage.IsMessage<TCFAvailabilityControlClient::TAvailabilityNotification>(), 
+			iContext.iMessage.IsMessage<TCFAvailabilityControlClient::TAvailabilityNotification>(),
 			User::Panic(KCoreMobileMCprPanic, KPanicIncorrectMessage));
-	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCoreMobileMCprPanic, KPanicNoActivity));	
+	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCoreMobileMCprPanic, KPanicNoActivity));
 	CMobilityActivity& activity = static_cast<CMobilityActivity&>(*iContext.iNodeActivity);
-	
+
 	if (activity.EvaluatePreference(iContext))
 		{
         activity.SetError(KErrNone);
@@ -296,9 +316,9 @@
 DEFINE_SMELEMENT(CMobilityActivity::TNoTagOrAwaitMobility, NetStateMachine::MStateFork, CMobilityActivity::TContext)
 TInt CMobilityActivity::TNoTagOrAwaitMobility::TransitionTag()
 	{
-	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCoreMobileMCprPanic, KPanicNoActivity));	
+	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCoreMobileMCprPanic, KPanicNoActivity));
 	CMobilityActivity& activity = static_cast<CMobilityActivity&>(*iContext.iNodeActivity);
-	
+
 	if (activity.EvaluatePreference(iContext))
 		{
 		activity.SetError(KErrNone);
@@ -323,20 +343,20 @@
 	if (iContext.iMessage.IsMessage<TCFMobilityProvider::TMigrationRejected>())
 		{
 		TBool otherSP = EFalse;
-		
+
 		// Find if there anymore available non rejected service providers
 		TClientIter<TDefaultClientMatchPolicy> iter = iContext.Node().GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider));
 		__ASSERT_DEBUG(iter[0], User::Panic(KCoreMobileMCprPanic, KPanicNoServiceProvider)); //A Service Provider must exist!
 		RMetaServiceProviderInterface* rejected = static_cast<RMetaServiceProviderInterface*>(iContext.Node().ServiceProvider());
 		RMetaServiceProviderInterface* candidate = NULL;
-		
+
 		while ((candidate = static_cast<RMetaServiceProviderInterface*>(iter++)) != NULL)
 			{
 			if (candidate == rejected)
 				{
 				continue;
 				}
-			
+
 			const TAvailabilityStatus& status = candidate->AvailabilityStatus();
 			if (!status.IsKnown())
 				{
@@ -380,31 +400,45 @@
 
 	//Inform the CPR that a potential migration is available. We only support a single data client
 	//in this implementation.
-	__ASSERT_DEBUG(activity.iPreferred, User::Panic(KCoreMobileMCprPanic, KPanicNoServiceProvider));
+	__ASSERT_DEBUG(activity.iAvailable, User::Panic(KCoreMobileMCprPanic, KPanicNoServiceProvider));
 
 	//Compute all this here to keep EvaluatePreference() as fast as possible
-	activity.iCurrent = static_cast<RMetaServiceProviderInterface*>(iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider, TCFClientType::EStarted)));
+	activity.iCurrent = static_cast<RMetaServiceProviderInterface*>(iContext.Node().ServiceProvider());
 	__ASSERT_DEBUG(activity.iCurrent, User::Panic(KCoreMobileMCprPanic, KPanicNoServiceProvider));
 
 	//Perform a simple check if this is an upgrade or not
 	TClientIter<TDefaultClientMatchPolicy> iter = iContext.Node().GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider));
 	RNodeInterface* sp = iter++;
-	while (sp && sp!=activity.iCurrent && sp!=activity.iPreferred)
+	while (sp && sp!=activity.iCurrent && sp!=activity.iAvailable)
 		{
 		sp = iter++;
 		}
 
 	TBool isUpgrade = (sp != activity.iCurrent); //If current was found first -> this is not an upgrade
-	TCFMobilityControlClient::TMigrationNotification msg(activity.iCurrent->ProviderInfo().APId(),
-	                                       activity.iPreferred->ProviderInfo().APId(),
-	                                       isUpgrade, EFalse);
+	if( activity.iCurrent == activity.iAvailable && activity.iCandidate )
+	    {
+		// The available client is the same as the current and a candidate exists, this indicates that
+		// an error has occured when trying to start the candidate bearer and the control as reverted to
+		// the current bearer. In this situation the notification needs to look as if the bearer has
+		// migrated from the failed candidate to the current bearer.
+		TCFMobilityControlClient::TMigrationNotification msg(activity.iCandidate->ProviderInfo().APId(),
+											   activity.iAvailable->ProviderInfo().APId(),
+											   isUpgrade, EFalse);
+		activity.PostToOriginators(msg);
+	    }
+	else
+	    {
+		// Standard case where migration is going from current to available.
+		TCFMobilityControlClient::TMigrationNotification msg(activity.iCurrent->ProviderInfo().APId(),
+											   activity.iAvailable->ProviderInfo().APId(),
+											   isUpgrade, EFalse);
+		activity.PostToOriginators(msg);
+	    }
 
-	activity.PostToOriginators(msg);
 	activity.ClearPostedTo();
 	activity.SetHandshakingFlag();
 	}
 
-
 DEFINE_SMELEMENT(CMobilityActivity::TAwaitingCurrentCarrierRejectedOrAvailabilityChange, NetStateMachine::MState, CMobilityActivity::TContext)
 TBool CMobilityActivity::TAwaitingCurrentCarrierRejectedOrAvailabilityChange::Accept()
 	{
@@ -423,13 +457,13 @@
 	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCoreMobileMCprPanic, KPanicNoActivity));
 	CMobilityActivity& activity = static_cast<CMobilityActivity&>(*iContext.iNodeActivity);
 
-	__ASSERT_DEBUG(activity.iPreferred, User::Panic(KCoreMobileMCprPanic, KPanicNoServiceProvider));
+	__ASSERT_DEBUG(activity.iAvailable, User::Panic(KCoreMobileMCprPanic, KPanicNoServiceProvider));
 	__ASSERT_DEBUG(activity.iCurrent, User::Panic(KCoreMobileMCprPanic, KPanicNoServiceProvider));
-	__ASSERT_DEBUG(activity.iCurrent!=activity.iPreferred, User::Panic(KSpecAssert_ESockMbCrMCPRAct, 1));
+	__ASSERT_DEBUG(activity.iCurrent!=activity.iAvailable, User::Panic(KSpecAssert_ESockMbCrMCPRAct, 1));
 
 	// For the moment it is sufficient to use the re-connect activity, in the future we may want to
 	// customise the behavior, for example start the new layer before rebinding it, etc.
-	TCFMcpr::TReConnect msg(activity.iCurrent->RecipientId(), activity.iPreferred->RecipientId());
+	TCFMcpr::TReConnect msg(activity.iCurrent->RecipientId(), activity.iAvailable->RecipientId());
 	activity.PostRequestTo(iContext.NodeId(), msg);
 	}
 
@@ -516,27 +550,26 @@
 void CConnectionRecoveryActivity::TProcessConnectionStartRecoveryRequest::DoL()
 	{
 	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCoreMobileMCprPanic, KPanicNoActivity));
-	RNodeInterface* startingSP = NULL;
-	RNodeInterface* stoppingSP = NULL;
+	RNodeInterface* newSP = NULL;
+	RNodeInterface* curSP = iContext.Node().ServiceProvider(); //Our current started Service Provider.
 
 	//Choose Service Providers to work on
 	TClientIter<TDefaultClientMatchPolicy> iter = iContext.Node().GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider));
 	RNodeInterface* itf = NULL;
-	for (itf = iter++; itf!=NULL && stoppingSP==NULL; itf = iter++)
+	for (itf = iter++; itf!=NULL && newSP==NULL; itf = iter++)
 		{
-		if (itf->Flags() & TCFClientType::EStarted)
+		if (itf==curSP)
 			{
-			stoppingSP = itf; //Our current started Service Provider.
-			startingSP = iter++; //And the new one to try next
+			newSP = iter++; //And the new one to try next
 			}
 		}
 
 	//Sanity check.
 	//The new provider must not be started, there can be only one started at a time.
-	__ASSERT_DEBUG(startingSP==NULL || (startingSP->Flags() & TCFClientType::EStarted)==0, User::Panic(KSpecAssert_ESockMbCrMCPRAct, 3));
+	__ASSERT_DEBUG(newSP==NULL || (newSP->Flags() & TCFClientType::EStarted)==0, User::Panic(KSpecAssert_ESockMbCrMCPRAct, 3));
 
 	//If there is no other Service Provider to try, return KErrNotFound
-	if (startingSP==NULL || stoppingSP == NULL)
+	if (newSP==NULL || curSP == NULL)
 		{
 #ifdef __CFLOG_ACTIVE
 		__CFLOG_VAR((KCoreMCprStatesTag, KCoreMCprStatesSubTag, _L8("WARNING: CConnectionRecoveryActivity::TProcessConnectionStartRecoveryRequest::DoL() - no more choices, abandoning recovery.")));
@@ -547,7 +580,7 @@
 	//Diagnostinc - there must be a data client or we cannot be here
 	__ASSERT_DEBUG(iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EData)), User::Panic(KCoreMobileMCprPanic, KPanicNoDataClient));
 	iContext.iNodeActivity->PostRequestTo(iContext.NodeId(),
-			TCFMcpr::TReConnect(stoppingSP->RecipientId(), startingSP->RecipientId()).CRef());
+			TCFMcpr::TReConnect(curSP->RecipientId(), newSP->RecipientId()).CRef());
 	}
 
 DEFINE_SMELEMENT(CConnectionRecoveryActivity::TProcessConnectionGoneDownRecoveryRequest, NetStateMachine::MStateTransition, CConnectionRecoveryActivity::TContext)
@@ -556,7 +589,7 @@
 	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCoreMobileMCprPanic, KPanicNoActivity));
 	CConnectionRecoveryActivity& activity = static_cast<CConnectionRecoveryActivity&>(*iContext.iNodeActivity);
 
-	RNodeInterface* started = iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider, TCFClientType::EStarted));
+	RNodeInterface* started = iContext.Node().ServiceProvider();
 	TUint apId = (TUint)activity.iOriginalErrContext.iInfo;
 	RNodeInterface* gonedownsp = iContext.Node().FindServiceProvider(apId);
 	if (started && started != gonedownsp)
--- a/datacommsserver/esockserver/bwins/esocksvrU.DEF	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/bwins/esocksvrU.DEF	Wed Mar 31 23:27:09 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 *)
@@ -1046,4 +1046,5 @@
 	?CountParameterSets@RCFParameterFamilyBundleC@ESock@@QBEIXZ @ 1045 NONAME ; unsigned int ESock::RCFParameterFamilyBundleC::CountParameterSets(void) const
 	?Self@PRClientLeft@PRClientLeftActivity@@SAABUTNodeActivity@MeshMachine@@XZ @ 1046 NONAME ; struct MeshMachine::TNodeActivity const & PRClientLeftActivity::PRClientLeft::Self(void)
 	?FirstTriple@PRClientLeft@PRClientLeftActivity@@SAABUTStateTriple@NetStateMachine@@XZ @ 1047 NONAME ; struct NetStateMachine::TStateTriple const & PRClientLeftActivity::PRClientLeft::FirstTriple(void)
+	?Accept@TAwaitingStop@CoreNetStates@@UAEHXZ @ 1048 NONAME ; int CoreNetStates::TAwaitingStop::Accept(void)
 
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -583,6 +583,15 @@
     	return;
         }
 
+    //Determine who TErrorRecoveryRequest should be sent to.
+    //If there is no ControlProvider we send a RecoveryRequest to ourselves to recover from the error,
+    //otherwise we sned the RecoveryRequest up to our ControlProvider.
+    //MCPrs typically put all of the error recovery function in a single error recovery activity therefore
+    //it makes sense even for MCPrs to send TErrorRecoveryRequest to their error recovery function. By
+    //posting a TErrorRecoveryRequest sub-classes of the MCPrs get a chance to override the default error
+    //recovery.
+    RNodeInterface*  errorRecoverer = iContext.Node().ControlProvider() ? iContext.Node().ControlProvider() : &iContext.Node().SelfInterface();
+
 	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCorePrPanic, KPanicNoActivity));
     CoreActivities::CErrorActivity& activity = static_cast<CoreActivities::CErrorActivity&>(*iContext.iNodeActivity);
     __ASSERT_DEBUG(activity.iErroredActivityId==MeshMachine::KActivityNull, User::Panic(KSpecAssert_ESockCrStaCPRAC, 4));
@@ -597,7 +606,7 @@
 	TEErrorRecovery::TErrorRecoveryRequest msg(ctx);
 
     activity.PostRequestTo(
-    	*iContext.Node().ControlProvider(),//ControlProvider() verified above
+    	*errorRecoverer,//ControlProvider() verified above
     	TCFSafeMessage::TRequestCarrierEast<TEErrorRecovery::TErrorRecoveryRequest>(msg).CRef()
     	);
 
@@ -978,6 +987,8 @@
     ACTIVITY_MAP_ENTRY(PRClientLeaveActivity, PRClientLeave)
 	ACTIVITY_MAP_ENTRY(PRForwardStateChangeActivity, PRForwardStateChange)
 	ACTIVITY_MAP_ENTRY(PRBindToActivity, PRBindTo)
+	ACTIVITY_MAP_ENTRY(PRDataClientStartActivity, PRDataClientStart)
+	ACTIVITY_MAP_ENTRY(PRDataClientStopActivity, PRDataClientStop)
 	ACTIVITY_MAP_ENTRY(PRDestroyOrphansActivity, PRDestroyOrphans)
 ACTIVITY_MAP_END_BASE(CoreActivities,coreActivitiesAll)
 
@@ -987,8 +998,6 @@
 	ACTIVITY_MAP_ENTRY(PRProvisionActivity, PrProvision)
     ACTIVITY_MAP_ENTRY(PRStartActivity, PRStart)
     ACTIVITY_MAP_ENTRY(PRStopActivity, PRStop)
-	ACTIVITY_MAP_ENTRY(PRDataClientStartActivity, PRDataClientStart)
-	ACTIVITY_MAP_ENTRY(PRDataClientStopActivity, PRDataClientStop)
 	ACTIVITY_MAP_ENTRY(PRDataClientIdleActivity, PRDataClientIdle)
 	ACTIVITY_MAP_ENTRY(PRDataClientActiveActivity, PRDataClientActive)
 	ACTIVITY_MAP_ENTRY(PRDestroyActivity, PRDestroy)
@@ -1007,8 +1016,6 @@
 	ACTIVITY_MAP_ENTRY(PRProvisionActivity, PrProvision)
     ACTIVITY_MAP_ENTRY(PRStartActivity, PRStart)
     ACTIVITY_MAP_ENTRY(PRStopActivity, PRStop)
-	ACTIVITY_MAP_ENTRY(PRDataClientStartActivity, PRDataClientStart)
-	ACTIVITY_MAP_ENTRY(PRDataClientStopActivity, PRDataClientStop)
 	ACTIVITY_MAP_ENTRY(PRDataClientIdleActivity, PRDataClientIdle)
 	ACTIVITY_MAP_ENTRY(PRDataClientActiveActivity, PRDataClientActive)
 	ACTIVITY_MAP_ENTRY(PRDestroyActivity, PRDestroy)
@@ -2036,7 +2043,7 @@
     CMMCommsProviderBase& node(static_cast<CMMCommsProviderBase&>(iNode));
     const TProviderInfoExt* providerInfoExt = static_cast<const TProviderInfoExt*>(node.AccessPointConfig().FindExtension(
             STypeId::CreateSTypeId(TProviderInfoExt::EUid, TProviderInfoExt::ETypeId)));
-    
+
     __ASSERT_DEBUG(providerInfoExt, User::Panic(KSpecAssert_ESockCrStaCPRAC, 40));
 
     if (Error() != KErrNone)
@@ -2044,11 +2051,11 @@
 		CNodeActivityBase* stopActivity = iNode.FindActivityById(ECFActivityStop);
 
 		// If the Stop activity is running we skip sending the GoneDown message. This is because the Stop
-		// activity will send GoneDown too. 
+		// activity will send GoneDown too.
 		if (!stopActivity)
 		    {
             TCFControlClient::TGoneDown goneDown(Error(), providerInfoExt->iProviderInfo.APId());
-        
+
             TClientIter<TDefaultClientMatchPolicy> iter = iNode.GetClientIter<TDefaultClientMatchPolicy>(
                     TClientType(TCFClientType::ECtrl), TClientType(0, TCFClientType::ELeaving));
             RNodeInterface* ctrlClient = NULL;
@@ -2060,7 +2067,7 @@
                     {
                     continue; // ControlClient is a Start originator
                     }
-                    
+
                 TNodeCtxId ctxId(ActivityId(), iNode.Id());
                 ctrlClient->PostMessage(ctxId, goneDown.CRef());
                 }
@@ -2204,6 +2211,3 @@
 		}
 	return CoreNetStates::KProviderStopped;
     }
-
-
-
--- a/datacommsserver/esockserver/core_states/ss_coreprstates.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/core_states/ss_coreprstates.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -1061,7 +1061,7 @@
 	}
 
 EXPORT_DEFINE_SMELEMENT(TAwaitingStop, NetStateMachine::MState, CoreNetStates::TContext)
-TBool TAwaitingStop::Accept()
+EXPORT_C TBool TAwaitingStop::Accept()
 	{
 	if (!iContext.iMessage.IsMessage<TCFServiceProvider::TStop>())
     	{
--- a/datacommsserver/esockserver/core_states/ss_coreprstates.h	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/core_states/ss_coreprstates.h	Wed Mar 31 23:27:09 2010 +0300
@@ -402,7 +402,7 @@
 DECLARE_SMELEMENT_FOOTER( TAwaitingBinderRequest )
 
 EXPORT_DECLARE_SMELEMENT_HEADER( TAwaitingStop, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext )
-	virtual TBool Accept();
+    IMPORT_C virtual TBool Accept();
 DECLARE_SMELEMENT_FOOTER( TAwaitingStop )
 
 EXPORT_DECLARE_SMELEMENT_HEADER( TAwaitingProviderStatusChangeOrDataClientStatusChange, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext )
--- a/datacommsserver/esockserver/eabi/esocksvrU.DEF	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/eabi/esocksvrU.DEF	Wed Mar 31 23:27:09 2010 +0300
@@ -1947,4 +1947,5 @@
 	_ZNK5ESock25RCFParameterFamilyBundleC18CountParameterSetsEv @ 1946 NONAME
 	_ZN20PRClientLeftActivity12PRClientLeft11FirstTripleEv @ 1947 NONAME
 	_ZN20PRClientLeftActivity12PRClientLeft4SelfEv @ 1948 NONAME
+	_ZN13CoreNetStates13TAwaitingStop6AcceptEv @ 1949 NONAME
 
--- a/datacommsserver/esockserver/eintsock/ss_eintsock_msgs.inl	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/eintsock/ss_eintsock_msgs.inl	Wed Mar 31 23:27:09 2010 +0300
@@ -195,6 +195,10 @@
 	{
 	TParams* params = reinterpret_cast<TParams*>(ParamBlock());
 	params->iSender = aSender;
+    
+	// caution - TRuntimeCtxId assignment operator overloaded - it assumes a properly constructed destination, which it isn't here
+	// so we in-place construct it
+	new (&params->iImplCookie)Messages::TNodeId();
 	params->iImplCookie = aImplCookie;
 	}
 
--- a/datacommsserver/esockserver/inc/SS_conn.H	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/inc/SS_conn.H	Wed Mar 31 23:27:09 2010 +0300
@@ -42,7 +42,7 @@
 	class TProcessBinderResponseForCpr;
 	class TCompleteLegacyAttach;
 	class TProcessEnumResponse;
-	
+
 	class TGenerateConnectionUpProgress;
 	class TGenerateConnectionDownProgress;
 
@@ -160,7 +160,7 @@
 
 	friend class ConnStates::TNoTagOrCancelAllInterfaceWorker;
 	friend class ConnStates::TCancelAllInterfaceNotificationWorker;
-	
+
 
 public:
 	typedef ITFHIERARCHY_LINK_1(CConnection, MeshMachine::AMMNodeBase, MPlatsecApiExt) TIfStaticFetcherNearestInHierarchy;
@@ -231,7 +231,7 @@
     TBool iIsMonitor          :1;
 	XCommsDataObject* iCommsDataObject;
 	TUint iCommsDataObjectLength;	// output query length
-	
+
 protected:
 
 	//-=============================================
--- a/datacommsserver/esockserver/ssock/ss_common.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-// 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:
-// SS_COMMSPROV.CPP
-// 
-//
-
-/**
- @file @internalTechnology
-*/
-
-
-#include "ss_common.h"
-#include <comms-infras/ss_log.h>
-#include <es_panic.h>
-#include <ss_std.h>
-using namespace ESock;
-
-#ifdef _DEBUG
-/** Because we strive to maintain a single owner for a message and to pass by reference when ownership
-it's generally an error for the handle to be set upon destruction.
-*/
-RSafeMessage::~RSafeMessage()
-	{
-	if(Handle() != KNullHandle)
-		{
-		LOG(ESockLog::Printf(KESockServerTag, _L8("RSafeMessage(%08x) - WARNING! handle still set in destructor, may be a leak, session %08x"), Handle(), Session()) );
-		}
-	}
-#endif
-
-/** Complete the message with the given reason code, with detailed logging
-*/
-void RSafeMessage::Complete(TInt aReason) const
-	{
-	LOG(ESockLog::Printf(KESockServerTag, _L8("RSafeMessage(%08x)::Complete(%d) - session %08x"), Handle(), aReason, Session()) );
-	RMessage2::Complete(aReason);
-	}
-
-/** Panic the client with the given category & reason code, with detailed logging
-*/
-void RSafeMessage::Panic(const TDesC& aCategory, TInt aReason) const
-	{
-	LOG(ESockLog::Printf(KESockServerTag, _L("RSafeMessage(%08x)::Panic(\"%S\", %d) - session %08x"), Handle(), &aCategory, aReason, Session()) );
-	RMessage2::Panic(aCategory, aReason);
-	}
-
-/** Take over a message. Beyond being a simple copy this resets the source's handle so that double-ownership is avoided
-*/
-void RSafeMessage::Adopt(RSafeMessage& aSrc)
-	{
-	*this = aSrc;
-	aSrc.ResetHandle();
-	}
-
-/** Duplicate a message, including aliasing the handle & so raising the risk of a double-complete
-*/
-void RSafeMessage::Duplicate(const RSafeMessage& aSrc)
-	{
-	*this = aSrc;
-	}
-
-/** Null the handle, so this safe message no longer references a client request. This is normally done automatically
-by completing or panicking the client or transferring message ownership, so this will seldom need to be called
-explicitly
-*/
-void RSafeMessage::ResetHandle()
-	{
-	iHandle = KNullHandle;
-	}
-
-RSafeMessage& RSafeMessage::operator=(const RSafeMessage& aSrc)
-	{
-	RMessage2::operator=(aSrc);
-	return *this;
-	}
-
-void RSafeMessage::PanicClient(TInt aReason) const
-	{
-	RThread t;
-	RMessage2::Client(t);
-	TUint tid = t.Id();
-	TExitType exittype=t.ExitType();
-	t.Close();
-	if(exittype == EExitPending) // is client alive?
-		{
-		LOG(
-			TBuf8<sizeof(KESockClientPanic) / sizeof(TUint16)> clientPanic8;
-			clientPanic8.Copy(KESockClientPanic);
-			TBuf8<64> messBuf;
-			ESockLog::IPCMessName((TSockMess) RMessage2::Function(), messBuf);
-			ESockLog::Printf(KESockErrorTag, _L8("RSafeMessage:\tPanicClient, Category %S, Reason %d, Tid %d, RMessage2 %08x [%S], Args %08x %08x %08x %08x, ClientStatus %08x"),
-							 &clientPanic8, aReason, tid, RMessage2::Handle(), &messBuf, RMessage2::Int0(), RMessage2::Int1(), RMessage2::Int2(), RMessage2::Int3(), RMessage2::ClientStatus())
-		);
-		Panic(KESockClientPanic, aReason);
-		}		
-	}
-
-TInt RSafeMessage::Read(TInt aSrcParamIndex,TDes8 &aDes,TInt anOffset) const
-	{
-	TInt res= RMessage2::Read(aSrcParamIndex,aDes,anOffset);
-	__ASSERT_DEBUG(res!=KErrArgument,Fault(EBadState));
-	if (res!=KErrNone)
-		{
-		PanicClient(EBadDescriptorRead);
-		res = KErrBadDescriptor;
-		}
-	return res;
-	}
-
-void RSafeMessage::ReadL(TInt aSrcParamIndex,TDes8& aDes,TInt anOffset) const
-	{
-	User::LeaveIfError(Read(aSrcParamIndex, aDes, anOffset));		
-	}
-
-TInt RSafeMessage::Write(TInt aDstParamIndex,const TDesC8& aDes,TInt anOffset) const
-	{
-	TInt res = RMessage2::Write(aDstParamIndex,aDes,anOffset);
-	__ASSERT_DEBUG(res!=KErrArgument,Fault(EBadState));
-	if (res!=KErrNone)
-		{
-		PanicClient(EBadDescriptorWrite);
-		res = KErrBadDescriptor;
-		}
-	return res;		
-	}
-
-void RSafeMessage::WriteL(TInt aDstParamIndex,const TDesC8& aDes,TInt anOffset) const
-	{
-	User::LeaveIfError(Write(aDstParamIndex, aDes, anOffset));
-	}
-
-TInt RSafeMessage::Read(TInt aSrcParamIndex,TDes16 &aDes,TInt anOffset) const
-	{
-	TInt res= RMessage2::Read(aSrcParamIndex,aDes,anOffset);
-	__ASSERT_DEBUG(res!=KErrArgument,Fault(EBadState));
-	if (res!=KErrNone)
-		{
-		PanicClient(EBadDescriptorRead);
-		res = KErrBadDescriptor;
-		}
-	return res;		
-	}
-
-void RSafeMessage::ReadL(TInt aSrcParamIndex,TDes16& aDes,TInt anOffset) const
-	{
-	User::LeaveIfError(Read(aSrcParamIndex, aDes, anOffset));	
-	}
-
-TInt RSafeMessage::Write(TInt aDstParamIndex,const TDesC16 &aDes,TInt anOffset) const
-	{
-	TInt res = RMessage2::Write(aDstParamIndex,aDes,anOffset);
-	__ASSERT_DEBUG(res!=KErrArgument,Fault(EBadState));
-	if (res!=KErrNone)
-		{
-		PanicClient(EBadDescriptorWrite);
-		res = KErrBadDescriptor;
-		}
-	return res;		
-	}
-
-void RSafeMessage::WriteL(TInt aDstParamIndex,const TDesC16& aDes,TInt anOffset) const
-	{
-	User::LeaveIfError(Write(aDstParamIndex,aDes,anOffset));
-	}
-
-TInt RSafeMessage::Write(TInt aDstParamIndex,const TPckg<TUint32>& aDes,TInt anOffset) const
-	{
-	TInt res = RMessage2::Write(aDstParamIndex,aDes,anOffset);
-	__ASSERT_DEBUG(res!=KErrArgument,Fault(EBadState));
-	if (res!=KErrNone)
-		{
-		PanicClient(EBadDescriptorWrite);
-		res = KErrBadDescriptor;
-		}
-	return res;		
-	}
-
-void RSafeMessage::WriteL(TInt aDstParamIndex,const TPckg<TUint32>& aDes,TInt anOffset) const
-	{
-	User::LeaveIfError(Write(aDstParamIndex, aDes, anOffset));		
-	}
-
-TInt RSafeMessage::GetDesLengthL(TInt aParam) const
-	{
-	TInt res = RMessage2::GetDesLength(aParam);
-	__ASSERT_DEBUG(res!=KErrArgument,Fault(EBadState));
-	if (res<0)
-		{
-		PanicClient(EBadDescriptorLength);
-		User::Leave(KErrBadDescriptor);
-		}
-	return res;		
-	}
-
-
-TInt RSafeMessage::GetDesMaxLengthL(TInt aParam) const
-	{
-	TInt res = RMessage2::GetDesMaxLength(aParam);
-	__ASSERT_DEBUG(res!=KErrArgument, Fault(EBadState));
-	if (res < 0)
-		{
-		PanicClient(EBadDescriptorLength);
-		User::Leave(KErrBadDescriptor);
-		}
-	return res;		
-	}
-
--- a/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -1365,18 +1365,11 @@
 		}
 	else if (iHostResolverNotify)
 	    {//workaroud to indicate to CHostResolver we've got connection info
-	    if (aBindTo.iNodeId.Ptr())
-	        {
-    	    iHostResolverNotify->StartSending();
-	        }
-	    else
+	    if (!aBindTo.iNodeId.Ptr())
 	        {
             iHostResolverNotify->Error(KErrDisconnected);
 	        }
 	    }
-
-
-
 	}
 
 
@@ -1415,6 +1408,13 @@
 		iStartRequest.Close();
 		SetStarted();
 		ClearStopped();
+
+        // A held-over resolution request will now work (if it ever will)
+        if (iHostResolverNotify)
+	        {
+    	    iHostResolverNotify->StartSending();
+	        }
+
 		return;
 		}
 
--- a/datacommsserver/esockserver/ssock/ss_secpol.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/ssock/ss_secpol.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -166,7 +166,11 @@
 
 */
 	{
-	__ASSERT_ALWAYS(aMsg.Function() == ECNControl, Fault(ENotImplementedYet));
+	// ECNControl is all we are expecting
+	if(aMsg.Function() != ECNControl)
+		{
+		return EFail;
+		}
 
    TInt optionLevel = aMsg.Int0();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_004.ini	Wed Mar 31 23:27:09 2010 +0300
@@ -0,0 +1,97 @@
+[CreateConnectionServ1]
+ConnServName=ConnServ1
+
+[ConnectConnectionServ1]
+ConnServName=ConnServ1
+TierName=DummyTier
+
+[CreateSockSvr1]
+SocketServName=SockSvr1
+
+[CreateConn1]
+ConnName=Conn1
+
+[ConnectSockSvr1]
+SocketServName=SockSvr1
+
+[OpenConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+ConnType=271069227
+
+[StartConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+SNAP=10
+
+[APNotificationRequest1]
+ConnServName=ConnServ1
+NotificationName=Notif1
+QueryAPStatusFilter=C-R-A-ST
+
+[CreatePublishSubscribeVarBlockingStop]
+CreatePublishSubscribeVarUid=270548957
+CreatePublishSubscribeVarValue=2
+CreatePublishSubscribeVarKey=1
+
+[CheckPublishSubscribeVarBlockingStop]
+CheckPublishSubscribeVarUid=270548957
+CheckPublishSubscribeVarValue=2
+CheckPublishSubscribeVarKey=1
+
+[ReceiveNotificationBlockingStop1]
+NotificationName=Notif1
+ExpectedNumberOfAPs=1
+ExpectedAP1=10
+ExpectedAP1Status=C-R-A-SF
+
+[ReceiveNotificationBlockingStop2]
+NotificationName=Notif1
+ExpectedNumberOfAPs=1
+ExpectedAP1=11
+ExpectedAP1Status=C-R-A-SF
+
+[CreatePublishSubscribeVarStart]
+CreatePublishSubscribeVarUid=270548957
+CreatePublishSubscribeVarValue=1
+CreatePublishSubscribeVarKey=1
+
+[CheckPublishSubscribeVarStart]
+CheckPublishSubscribeVarUid=270548957
+CheckPublishSubscribeVarValue=1
+CheckPublishSubscribeVarKey=1
+
+[ReceiveNotificationStart1]
+NotificationName=Notif1
+ExpectedNumberOfAPs=1
+ExpectedAP1=11
+ExpectedAP1Status=C-R-A-ST
+
+[ReceiveNotificationStart2]
+NotificationName=Notif1
+ExpectedNumberOfAPs=1
+ExpectedAP1=10
+ExpectedAP1Status=C-R-A-ST
+
+[CreatePublishSubscribeVarStop]
+CreatePublishSubscribeVarUid=270548957
+CreatePublishSubscribeVarValue=3
+CreatePublishSubscribeVarKey=1
+
+[CheckPublishSubscribeVarStop]
+CheckPublishSubscribeVarUid=270548957
+CheckPublishSubscribeVarValue=3
+CheckPublishSubscribeVarKey=1
+
+[CancelAPNotifRequest1]
+NotificationName=Notif1
+
+[CloseConn1]
+ConnName=Conn1
+
+[CloseSockSvr1]
+SocketServName=SockSvr1
+
+[CloseConnectionServ1]
+ConnServName=ConnServ1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_005.ini	Wed Mar 31 23:27:09 2010 +0300
@@ -0,0 +1,97 @@
+[CreateConnectionServ1]
+ConnServName=ConnServ1
+
+[ConnectConnectionServ1]
+ConnServName=ConnServ1
+TierName=DummyTier
+
+[CreateSockSvr1]
+SocketServName=SockSvr1
+
+[CreateConn1]
+ConnName=Conn1
+
+[ConnectSockSvr1]
+SocketServName=SockSvr1
+
+[OpenConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+ConnType=271069227
+
+[StartConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+SNAP=50
+
+[APNotificationRequest1]
+ConnServName=ConnServ1
+NotificationName=Notif1
+QueryAPStatusFilter=C-R-A-ST
+
+[CreatePublishSubscribeVarBlockingStop]
+CreatePublishSubscribeVarUid=270548957
+CreatePublishSubscribeVarValue=2
+CreatePublishSubscribeVarKey=1
+
+[CheckPublishSubscribeVarBlockingStop]
+CheckPublishSubscribeVarUid=270548957
+CheckPublishSubscribeVarValue=2
+CheckPublishSubscribeVarKey=1
+
+[ReceiveNotificationBlockingStop1]
+NotificationName=Notif1
+ExpectedNumberOfAPs=1
+ExpectedAP1=50
+ExpectedAP1Status=C-R-A-SF
+
+[ReceiveNotificationBlockingStop2]
+NotificationName=Notif1
+ExpectedNumberOfAPs=1
+ExpectedAP1=11
+ExpectedAP1Status=C-R-A-SF
+
+[CreatePublishSubscribeVarStart]
+CreatePublishSubscribeVarUid=270548957
+CreatePublishSubscribeVarValue=1
+CreatePublishSubscribeVarKey=1
+
+[CheckPublishSubscribeVarStart]
+CheckPublishSubscribeVarUid=270548957
+CheckPublishSubscribeVarValue=1
+CheckPublishSubscribeVarKey=1
+
+[ReceiveNotificationStart1]
+NotificationName=Notif1
+ExpectedNumberOfAPs=1
+ExpectedAP1=11
+ExpectedAP1Status=C-R-A-ST
+
+[ReceiveNotificationStart2]
+NotificationName=Notif1
+ExpectedNumberOfAPs=1
+ExpectedAP1=50
+ExpectedAP1Status=C-R-A-ST
+
+[CreatePublishSubscribeVarStop]
+CreatePublishSubscribeVarUid=270548957
+CreatePublishSubscribeVarValue=3
+CreatePublishSubscribeVarKey=1
+
+[CheckPublishSubscribeVarStop]
+CheckPublishSubscribeVarUid=270548957
+CheckPublishSubscribeVarValue=3
+CheckPublishSubscribeVarKey=1
+
+[CancelAPNotifRequest1]
+NotificationName=Notif1
+
+[CloseConn1]
+ConnName=Conn1
+
+[CloseSockSvr1]
+SocketServName=SockSvr1
+
+[CloseConnectionServ1]
+ConnServName=ConnServ1
+
--- a/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg	Wed Mar 31 23:27:09 2010 +0300
@@ -23,7 +23,7 @@
 ## AccessPointTable
 ## 
 [AccessPointTable]
-## CASE001 BEGIN ##
+## CASE004 BEGIN ##
 ADD_SECTION
 # COMMDB_ID = 1
 	Id=10
@@ -92,6 +92,22 @@
 	Protocol=ProtocolTable.1
 	FIELD_COUNT=9
 END_ADD
+## CASE003 END ##
+#############################################################
+## CASE005 BEGIN ##
+ADD_SECTION
+# COMMDB_ID = 6
+	Id=50
+	Name=DummyAPHasNextLayer
+	Tier=Link.TierTable.0x1028302B
+	MCpr=MCprTable.1
+	AccessPointSelectionPolicy=Link.APPrioritySelectionPolicyTable.3
+	Cpr=CprTable.1
+	SCpr=SCprTable.1
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=8
+END_ADD
+## CASE005 END ##
 
 ############################################################
 ## APPrioritySelectionPolicyTable
--- a/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby	Wed Mar 31 23:27:09 2010 +0300
@@ -24,12 +24,16 @@
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_001.script TestData\scripts\te_dummyprovider_001.script
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_002.script TestData\scripts\te_dummyprovider_002.script
 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_incomingSCPR.script TestData\scripts\te_dummyprovider_incomingSCPR.script
 
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyproviders.cfg TestData\configs\te_dummyproviders.cfg
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_001.ini TestData\configs\te_dummyprovider_001.ini
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_002.ini TestData\configs\te_dummyprovider_002.ini
 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
 
 #endif // __TE_DummyProviders_IBY__
 
--- a/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf	Wed Mar 31 23:27:09 2010 +0300
@@ -25,11 +25,14 @@
 ../scripts/te_dummyprovider_001.script	z:/testdata/scripts/te_dummyprovider_001.script
 ../scripts/te_dummyprovider_002.script	z:/testdata/scripts/te_dummyprovider_002.script
 ../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_incomingSCPR.script	z:/testdata/scripts/te_dummyprovider_incomingSCPR.script
 ../configs/te_dummyproviders.cfg	z:/testdata/configs/te_dummyproviders.cfg
 ../configs/te_dummyprovider_001.ini	z:/testdata/configs/te_dummyprovider_001.ini
 ../configs/te_dummyprovider_002.ini	z:/testdata/configs/te_dummyprovider_002.ini
 ../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
 
-
--- a/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script	Wed Mar 31 23:27:09 2010 +0300
@@ -29,6 +29,8 @@
 RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_001.script
 RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_002.script
 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_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_004.script	Wed Mar 31 23:27:09 2010 +0300
@@ -0,0 +1,70 @@
+//
+// 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 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:
+//
+
+PRINT Running CASE004
+PRINT Gets the MCPR to stop the control and data planes, whilst keeping itself alive.
+PRINT Gets the MCPR to restart the control and data planes, 
+PRINT Uses RConnectionServ to monitor that connections are being stopped and started.
+PRINT Gets the MCPR to stop the control and data planes and let itself be removed.
+PRINT 
+
+//
+LOAD_SUITE te_esockteststepsSuite -SharedData
+RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script
+
+START_TESTCASE			COMINF-ESOCK-DummyProviders-004
+//! @SYMTestCaseID		COMINF-ESOCK-DummyProviders-004
+
+RUN_TEST_STEP 100 te_esockteststepsSuite CreateRConnectionServStep z:\testdata\configs\te_dummyprovider_004.ini CreateConnectionServ1
+RUN_TEST_STEP 100 te_esockteststepsSuite ConnectRConnectionServStep z:\testdata\configs\te_dummyprovider_004.ini ConnectConnectionServ1
+
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_004.ini CreateSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_004.ini ConnectSockSvr1
+
+RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_004.ini CreateConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_004.ini OpenConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_004.ini StartConn1
+
+// TStop
+RUN_TEST_STEP 100 te_esockteststepsSuite RequestAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_004.ini APNotificationRequest1
+RUN_TEST_STEP 100 te_esockteststepsSuite CreatePublishSubscribeVar z:\testdata\configs\te_dummyprovider_004.ini CreatePublishSubscribeVarBlockingStop
+RUN_TEST_STEP 100 te_esockteststepsSuite checkpublishsubscribevar z:\testdata\configs\te_dummyprovider_004.ini CheckPublishSubscribeVarBlockingStop
+RUN_TEST_STEP 100 te_esockteststepsSuite ReceiveAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_004.ini ReceiveNotificationBlockingStop1
+RUN_TEST_STEP 100 te_esockteststepsSuite ReceiveAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_004.ini ReceiveNotificationBlockingStop2
+
+// TStart
+RUN_TEST_STEP 100 te_esockteststepsSuite CreatePublishSubscribeVar z:\testdata\configs\te_dummyprovider_004.ini CreatePublishSubscribeVarStart
+RUN_TEST_STEP 100 te_esockteststepsSuite checkpublishsubscribevar z:\testdata\configs\te_dummyprovider_004.ini CheckPublishSubscribeVarStart
+RUN_TEST_STEP 100 te_esockteststepsSuite ReceiveAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_004.ini ReceiveNotificationStart1
+RUN_TEST_STEP 100 te_esockteststepsSuite ReceiveAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_004.ini ReceiveNotificationStart2
+
+// Cancel the notification request
+RUN_TEST_STEP 100 te_esockteststepsSuite CancelAccessPointNotificationStep z:\testdata\configs\RConnectionServ\RConnectionServ_11_000.ini CancelAPNotifRequest1
+
+// TStop again to destroy the mesh completely.
+RUN_TEST_STEP 100 te_esockteststepsSuite CreatePublishSubscribeVar z:\testdata\configs\te_dummyprovider_004.ini CreatePublishSubscribeVarStop
+RUN_TEST_STEP 100 te_esockteststepsSuite checkpublishsubscribevar z:\testdata\configs\te_dummyprovider_004.ini CheckPublishSubscribeVarStop
+
+
+RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_004.ini CloseConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_004.ini CloseSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite CloseRConnectionServStep z:\testdata\configs\te_dummyprovider_004.ini CloseConnectionServ1
+RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep
+END_TESTCASE COMINF-ESOCK-DummyProviders-004
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+
+PRINT Completed CASE003
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_005.script	Wed Mar 31 23:27:09 2010 +0300
@@ -0,0 +1,71 @@
+//
+// 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 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:
+//
+
+PRINT Running CASE005
+PRINT Gets the MCPR to stop the control and data planes, whilst keeping itself alive.
+PRINT Gets the MCPR to restart the control and data planes, 
+PRINT first AP will fail to start, error handling will start the second AP.
+PRINT Uses RConnectionServ to monitor that connections are being stopped and started.
+PRINT Gets the MCPR to stop the control and data planes and let itself be removed.
+PRINT 
+
+//
+LOAD_SUITE te_esockteststepsSuite -SharedData
+RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script
+
+START_TESTCASE			COMINF-ESOCK-DummyProviders-005
+//! @SYMTestCaseID		COMINF-ESOCK-DummyProviders-005
+
+RUN_TEST_STEP 100 te_esockteststepsSuite CreateRConnectionServStep z:\testdata\configs\te_dummyprovider_005.ini CreateConnectionServ1
+RUN_TEST_STEP 100 te_esockteststepsSuite ConnectRConnectionServStep z:\testdata\configs\te_dummyprovider_005.ini ConnectConnectionServ1
+
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_005.ini CreateSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_005.ini ConnectSockSvr1
+
+RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_005.ini CreateConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_005.ini OpenConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_005.ini StartConn1
+
+// TStop
+RUN_TEST_STEP 100 te_esockteststepsSuite RequestAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_005.ini APNotificationRequest1
+RUN_TEST_STEP 100 te_esockteststepsSuite CreatePublishSubscribeVar z:\testdata\configs\te_dummyprovider_005.ini CreatePublishSubscribeVarBlockingStop
+RUN_TEST_STEP 100 te_esockteststepsSuite checkpublishsubscribevar z:\testdata\configs\te_dummyprovider_005.ini CheckPublishSubscribeVarBlockingStop
+RUN_TEST_STEP 100 te_esockteststepsSuite ReceiveAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_005.ini ReceiveNotificationBlockingStop1
+RUN_TEST_STEP 100 te_esockteststepsSuite ReceiveAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_005.ini ReceiveNotificationBlockingStop2
+
+// TStart
+RUN_TEST_STEP 100 te_esockteststepsSuite CreatePublishSubscribeVar z:\testdata\configs\te_dummyprovider_005.ini CreatePublishSubscribeVarStart
+RUN_TEST_STEP 100 te_esockteststepsSuite checkpublishsubscribevar z:\testdata\configs\te_dummyprovider_005.ini CheckPublishSubscribeVarStart
+RUN_TEST_STEP 100 te_esockteststepsSuite ReceiveAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_005.ini ReceiveNotificationStart1
+RUN_TEST_STEP 100 te_esockteststepsSuite ReceiveAccessPointNotificationStep z:\testdata\configs\te_dummyprovider_005.ini ReceiveNotificationStart2
+
+// Cancel the notification request
+RUN_TEST_STEP 100 te_esockteststepsSuite CancelAccessPointNotificationStep z:\testdata\configs\RConnectionServ\RConnectionServ_11_000.ini CancelAPNotifRequest1
+
+// TStop again to destroy the mesh completely.
+RUN_TEST_STEP 100 te_esockteststepsSuite CreatePublishSubscribeVar z:\testdata\configs\te_dummyprovider_005.ini CreatePublishSubscribeVarStop
+RUN_TEST_STEP 100 te_esockteststepsSuite checkpublishsubscribevar z:\testdata\configs\te_dummyprovider_005.ini CheckPublishSubscribeVarStop
+
+
+RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_005.ini CloseConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_005.ini CloseSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite CloseRConnectionServStep z:\testdata\configs\te_dummyprovider_005.ini CloseConnectionServ1
+RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep
+END_TESTCASE COMINF-ESOCK-DummyProviders-005
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+
+PRINT Completed CASE003
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h	Wed Mar 31 23:27:09 2010 +0300
@@ -83,10 +83,12 @@
 _LIT(KTe_CreatePublishSubscribeVar, "createpublishsubscribevar");
 _LIT(KTe_CreatePublishSubscribeVarUid, "CreatePublishSubscribeVarUid");
 _LIT(KTe_CreatePublishSubscribeVarValue, "CreatePublishSubscribeVarValue");
+_LIT(KTe_CreatePublishSubscribeVarKey, "CreatePublishSubscribeVarKey");
 
 _LIT(KTe_CheckPublishSubscribeVar, "checkpublishsubscribevar");
 _LIT(KTe_CheckPublishSubscribeVarUid, "CheckPublishSubscribeVarUid");
 _LIT(KTe_CheckPublishSubscribeVarValue, "CheckPublishSubscribeVarValue");
+_LIT(KTe_CheckPublishSubscribeVarKey, "CheckPublishSubscribeVarKey");
 
 //progress notification events
 _LIT(KTe_ConnEventsName,"ConnEventsName");
@@ -350,6 +352,7 @@
 private:
 	TInt iUid;
 	TInt iValue;
+	TInt iKey;
 	};
 
 _LIT(KCreatePublishSubscribeVar,"CreatePublishSubscribeVar");
@@ -371,6 +374,7 @@
 private:
 	TInt iUid;
 	TInt iValue;
+	TInt iKey;
 	};
 
 _LIT(KCheckPublishSubscribeVar,"CheckPublishSubscribeVar");
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -168,7 +168,7 @@
 	iParams.iStartWithConPrefList = ConnPrefPresent;
 	iParams.iStartWithDummy = DummyPresent;
 	iParams.iAsynch = AsynchPresent;
-	
+
 	GetBoolFromConfig(iSection, KTe_AutoStartPrefName, iParams.iStartAuto);
 
 	if (iParams.iStartWithOldPreferences && iParams.iStartWithSnapPreferences)
@@ -644,13 +644,13 @@
 TVerdict CAwaitRConnectionStartComplete::doSingleTestStep()
 	{
     INFO_PRINTF2(_L("Awaiting Connection (%S) to start."),&iParams.iConnectionName);
-    TInt error = iEsockTest->AwaitRequestStatus(iParams.iConnectionName); 
+    TInt error = iEsockTest->AwaitRequestStatus(iParams.iConnectionName);
 	if ( error == iExpectedError)
 		{
-        INFO_PRINTF3(_L("Connection (%S) start completed as expected (%d)"),&iParams.iConnectionName, error);		
+        INFO_PRINTF3(_L("Connection (%S) start completed as expected (%d)"),&iParams.iConnectionName, error);
 		return EPass;
 		}
-    INFO_PRINTF4(_L("Connection (%S) start completed with (%d), which is different to expected (%d)"),&iParams.iConnectionName, error, iExpectedError);	
+    INFO_PRINTF4(_L("Connection (%S) start completed with (%d), which is different to expected (%d)"),&iParams.iConnectionName, error, iExpectedError);
 	return EFail;
     }
 
@@ -836,10 +836,16 @@
 
 	if (!GetIntFromConfig(iSection,KTe_CreatePublishSubscribeVarValue,iValue))
 			{
-			INFO_PRINTF1(_L("Couldn't find appropriate UID field in config file"));
+			INFO_PRINTF1(_L("Couldn't find appropriate Value field in config file"));
 			return KErrNotFound;
 			}
 
+	if (!GetIntFromConfig(iSection,KTe_CreatePublishSubscribeVarKey,iKey))
+			{
+			// The key field was added at a later date, report but don't error.
+			INFO_PRINTF1(_L("Couldn't find appropriate Key field in config file, defaulting to 0"));
+			}
+
     return KErrNone;
 	}
 
@@ -851,8 +857,8 @@
 TVerdict CCreatePublishSubscribeVar::doSingleTestStep()
 	{
 	RProperty property;
-	TInt result = property.Define(TUid::Uid(iUid),0,RProperty::EInt);
-	result = property.Attach(TUid::Uid(iUid), 0);
+	TInt result = property.Define(TUid::Uid(iUid),iKey,RProperty::EInt);
+	result = property.Attach(TUid::Uid(iUid), iKey);
 	if(result == KErrNone)
 		{
 		result = property.Set(iValue);
@@ -889,6 +895,12 @@
 		return KErrNotFound;
 		}
 
+	if (!GetIntFromConfig(iSection,KTe_CheckPublishSubscribeVarKey,iKey))
+		{
+		// The key field was added at a later date, report but don't error.
+		INFO_PRINTF1(_L("Couldn't find appropriate Key field in config file, defaulting to 0"));
+		}
+
 	return KErrNone;
 	}
 
@@ -900,11 +912,11 @@
 TVerdict CCheckPublishSubscribeVar::doSingleTestStep()
 	{
 	RProperty property;
-	TInt result = property.Attach(TUid::Uid(iUid), 0);
+	TInt result = property.Attach(TUid::Uid(iUid), iKey);
 	if(result == KErrNone)
 		{
 		TInt existingValue;
-		result = property.Get(TUid::Uid(iUid), 0, existingValue);
+		result = property.Get(TUid::Uid(iUid), iKey, existingValue);
 		if(result == KErrNone && iValue == existingValue)
 			return EPass;
 		}
@@ -1119,12 +1131,12 @@
 		{
 		iExpectedError = KExpectedErrorNotUsed;
 		}
-	
+
     // Get any timeout value and if we have one then we are not expecting any notification
     if(!GetIntFromConfig(iSection, KTimeoutInMilliSeconds, iParams.iTimeoutMiliSecs))
         {
         // Default to 5 second timeout
-        iParams.iTimeoutMiliSecs = 5000; 
+        iParams.iTimeoutMiliSecs = 5000;
         }
 
 	if (iExpectedError != KExpectedErrorNotUsed)
@@ -1145,7 +1157,7 @@
 	if (event == NULL || err == KErrNone)
 		{
 		INFO_PRINTF2(_L("%S: Did not receive any event."),&iParams.iEventName);
-		
+
 		return EPass;
 		}
 		else if (event == NULL || err != KErrNone)
--- a/datacommsserver/esockserver/test/TestConfig/EIntSock_OneThread/proxy_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-# Comms Configurator config file for the ESock PDummy Module
-
-[Loader]
-Name=ESock_Proxy
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_Proxy:5,ESock_Main:0,ECustom,42,42 
-[IniData]
-Role=Player
-WorkerId=5
-EskMask=proxy.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/ProviderConfig1/ipc_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-# Comms Configurator config file for the ESock ipc module
-
-[Loader]
-Name=ESock_IPC
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-Binding0=ESock_IPC:7,ESock_Main:0,ECustom,42,42
-[IniData]
-Role=Player
-WorkerId=7
-EskMask=ipc.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/ProviderConfig1/pdummy1_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-# Comms Configurator config file for the ESock PDummy Module
-
-[Loader]
-Name=ESock_PDummy1
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-ScaledStartupState=0x30C1
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_PDummy1:5,ESock_Main:0,ECustom,42,42
-[IniData]
-Role=Player
-WorkerId=5
-EskMask=pdummy1.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/ProviderConfig1/pdummy2_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-# Comms Configurator config file for the ESock SmsWap module
-
-[Loader]
-Name=ESock_PDummy2
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_PDummy2:6,ESock_Main:0,ECustom,42,42
-[IniData]
-Role=Player
-WorkerId=6
-EskMask=pdummy2.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig1/ipc_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-# Comms Configurator config file for the ESock ipc module
-
-[Loader]
-Name=ESock_IPC
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-Binding0=ESock_IPC:7,ESock_Main:0,ECustom,42,42
-[IniData]
-Role=Player
-WorkerId=7
-EskMask=ipc.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig1/pdummy1_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-# Comms Configurator config file for the ESock PDummy Module
-
-[Loader]
-Name=ESock_PDummy1
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-ScaledStartupState=0x30C1
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_PDummy1:5,ESock_Main:0,ECustom,42,42
-[IniData]
-Role=Player
-WorkerId=5
-EskMask=pdummy1.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig1/pdummy2_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-# Comms Configurator config file for the ESock SmsWap module
-
-[Loader]
-Name=ESock_PDummy2
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_PDummy2:6,ESock_Main:0,ECustom,42,42
-[IniData]
-Role=Player
-WorkerId=6
-EskMask=pdummy2.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig2/esock_dealer2_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-# Comms Configurator config file for the ESock server
-
-[Loader]
-Name=ESock_Dealer2
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-
-Binding0=ESock_Dealer2:8,ESock_Main:0,ECustom,42,42
-
-[IniData]
-Role=DealerPlayer
-EskMask=pdummy3.*.esk
-WorkerId=8
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig2/ipc_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-# Comms Configurator config file for the ESock ipc module
-
-[Loader]
-Name=ESock_IPC
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-Binding0=ESock_IPC:7,ESock_Main:0,ECustom,42,42
-Binding1=ESock_IPC:7,ESock_Dealer2:8,ECustom,42,42
-
-[IniData]
-Role=Player
-WorkerId=7
-EskMask=ipc.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig2/pdummy1_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-# Comms Configurator config file for the ESock PDummy Module
-
-[Loader]
-Name=ESock_PDummy1
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_PDummy1:5,ESock_Main:0,ECustom,42,42
-Binding1=ESock_PDummy1:5,ESock_Dealer2:8,ECustom,42,42
-
-[IniData]
-Role=Player
-WorkerId=5
-EskMask=pdummy1.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig2/pdummy2_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-# Comms Configurator config file for the ESock SmsWap module
-
-[Loader]
-Name=ESock_PDummy2
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_PDummy2:6,ESock_Main:0,ECustom,42,42
-Binding1=ESock_PDummy2:6,ESock_Dealer2:8,ECustom,42,42
-
-[IniData]
-Role=Player
-WorkerId=6
-EskMask=pdummy2.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig3/esock_dealer2_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-# Comms Configurator config file for the ESock server
-
-[Loader]
-Name=ESock_Dealer2
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=ENewHeap
-MinHeapSize=256
-MaxHeapSize=524288
-SystemCritical=1
-ControlFlags=2
-
-Binding0=ESock_Dealer2:8,ESock_Main:0,ECustom,42,42
-
-[IniData]
-Role=DealerPlayer
-EskMask=pdummy3.*.esk
-WorkerId=8
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig3/ipc_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-# Comms Configurator config file for the ESock ipc module
-
-[Loader]
-Name=ESock_IPC
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=ENewHeap
-MinHeapSize=256
-MaxHeapSize=524288
-SystemCritical=1
-Binding0=ESock_IPC:7,ESock_Main:0,ECustom,42,42
-Binding1=ESock_IPC:7,ESock_Dealer2:8,ECustom,42,42
-
-[IniData]
-Role=Player
-WorkerId=7
-EskMask=ipc.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig3/pdummy1_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-# Comms Configurator config file for the ESock PDummy Module
-
-[Loader]
-Name=ESock_PDummy1
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=ENewHeap
-MinHeapSize=256
-MaxHeapSize=524288
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_PDummy1:5,ESock_Main:0,ECustom,42,42
-Binding1=ESock_PDummy1:5,ESock_Dealer2:8,ECustom,42,42
-
-[IniData]
-Role=Player
-WorkerId=5
-EskMask=pdummy1.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig3/pdummy2_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-# Comms Configurator config file for the ESock SmsWap module
-
-[Loader]
-Name=ESock_PDummy2
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-
-# Should be NewHeap, but we dont have enough heaps in the process yet.
-#HeapOption=ENewHeap
-#MinHeapSize=256
-#MaxHeapSize=524288
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-
-SystemCritical=1
-ControlFlags=2
-Binding0=ESock_PDummy2:6,ESock_Main:0,ECustom,42,42
-Binding1=ESock_PDummy2:6,ESock_Dealer2:8,ECustom,42,42
-
-[IniData]
-Role=Player
-WorkerId=6
-EskMask=pdummy2.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig4/esock_codealer1_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-# Comms Configurator config file for the ESock server
-
-[Loader]
-Name=ESock_Codealer1
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-
-Binding0=ESock_Codealer1:5,ESock_Main:0,ECustom,42,42
-
-[IniData]
-Role=DealerPlayer
-WorkerId=5
-EskMask=codealer1.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig4/esock_codealer2_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-# Comms Configurator config file for the ESock server
-
-[Loader]
-Name=ESock_Codealer2
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=EShareHeap
-SharedHeapName=ESock_Main
-SystemCritical=1
-ControlFlags=2
-
-Binding0=ESock_Codealer2:6,ESock_Main:0,ECustom,42,42
-Binding1=ESock_Codealer2:6,ESock_Codealer1:5,ECustom,42,42
-
-[IniData]
-Role=DealerPlayer
-WorkerId=6
-EskMask=codealer2.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig5/esock_codealer1_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-# Comms Configurator config file for the ESock server
-
-[Loader]
-Name=ESock_Codealer1
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=ENewHeap
-MinHeapSize=256
-MaxHeapSize=524288
-SystemCritical=1
-ControlFlags=2
-
-Binding0=ESock_Codealer1:5,ESock_Main:0,ECustom,42,42
-
-[IniData]
-Role=DealerPlayer
-WorkerId=5
-EskMask=codealer1.*.esk
-
--- a/datacommsserver/esockserver/test/TestConfig/TestConfig5/esock_codealer2_v1.cmi	Mon Mar 15 12:45:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-# Comms Configurator config file for the ESock server
-
-[Loader]
-Name=ESock_Codealer2
-FileName=esocksvr.dll
-ThreadFunctionOrdinal=1
-IsSticky=0
-IsServer=1
-Priority=EPriorityMore
-StackSize=16384
-StartSequence=6
-HeapOption=ENewHeap
-MinHeapSize=256
-MaxHeapSize=524288
-SystemCritical=1
-ControlFlags=2
-
-Binding0=ESock_Codealer2:6,ESock_Main:0,ECustom,42,42
-Binding1=ESock_Codealer2:6,ESock_Codealer1:5,ECustom,42,42
-
-[IniData]
-Role=DealerPlayer
-WorkerId=6
-EskMask=codealer2.*.esk
-
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_mcprpubsubsubscriber.h	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_mcprpubsubsubscriber.h	Wed Mar 31 23:27:09 2010 +0300
@@ -31,22 +31,16 @@
 #include <comms-infras/ss_metaconnprov.h>
 
 
-NONSHARABLE_CLASS(CMCPrPubSubSubscriber) : public CActive, public Messages::ASimpleNodeIdBase
+class CMCPrPubSubSubscriber : public CActive, public Messages::ASimpleNodeIdBase
 	{
 public:
-	static CMCPrPubSubSubscriber* NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
-	void StartAvailabilityMonitoringL(const Messages::TNodeCtxId& aAvailabilityActivity);
-	void CancelAvailabilityMonitoring();
 	virtual ~CMCPrPubSubSubscriber();
 
     enum
     {
-		KStart			= 1, // Causes a TStart message to be issued
-		KBlockingStop   = 2, // Causes a TStop to be issued and increments the blocking count to stop the node from being cleaned up.
-		KStop	        = 3  // Causes a TStop to be issued;
+		EAvailabilityTestingPubSubUid = 0x10272F42,
+		EStopTriggeringPubSubUid = 0x10203FDD
 	};
-    
-    enum { EAvailabilityTestingPubSubUid = 0x10272F42 };  
     virtual void ReceivedL(const Messages::TRuntimeCtxId& /*aSender*/, const Messages::TNodeId& /*aRecipient*/, Messages::TSignatureBase& aMessage)
         {
         //This object is only a node because its host needs an TCFClientType::EAvailabilityProvider, which
@@ -60,21 +54,56 @@
         }
 
 
-private:
+protected:
 	CMCPrPubSubSubscriber(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
-	void StartL();
-	void RunL();
+	virtual void StartL();
+
+private:
 	TInt RunError(TInt aError);
 	void DoCancel();
 
-private:
+protected:
     const ESock::CMetaConnectionProviderBase& iNode;
 	TInt iStopCode;
 	RProperty iProperty;
 	TBool iBlocking;
-	
+	};
+
+NONSHARABLE_CLASS(CMCPrPubSubAvailability) : public CMCPrPubSubSubscriber
+    {
+public:
+	static CMCPrPubSubAvailability* NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
+
+	void StartAvailabilityMonitoringL(const Messages::TNodeCtxId& aAvailabilityActivity);
+	void CancelAvailabilityMonitoring();
+
+private:
+	CMCPrPubSubAvailability(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
+	void RunL();
+
 	//the availablity activity subscribing for pubsub availablity changes.
 	Messages::TNodeCtxId iAvailabilityActivity;
+    };
+
+NONSHARABLE_CLASS(CMCPrPubSubStopTrigger) : public CMCPrPubSubSubscriber
+    {
+public:
+    static CMCPrPubSubStopTrigger* NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
+
+    enum
+    {
+		KStart			= 1, // Causes a TStart message to be issued
+		KBlockingStop   = 2, // Causes a TStop to be issued and increments the blocking count to stop the node from being cleaned up.
+		KStop	        = 3  // Causes a TStop to be issued;
 	};
 
+protected:
+    void StartL();
+private:
+	CMCPrPubSubStopTrigger(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
+	void RunL();
+
+	Messages::TNodeId iNodeId;
+    };
+
 #endif // _DUMMYPR_MCPrPUBSUBSUBSCRIBER_H_
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h	Wed Mar 31 23:27:09 2010 +0300
@@ -26,11 +26,12 @@
 #include <comms-infras/ss_coreprstates.h>
 #include <comms-infras/mobilitymcpr.h>
 
-class CMCPrPubSubSubscriber;
+class CMCPrPubSubAvailability;
+class CMCPrPubSubStopTrigger;
 
 struct TCprConfigModifier
 	{
-	enum 
+	enum
 	/*
 	Bits on the CprConfig.
 	This is a very naive way of instructing the dummy providers to respond to
@@ -43,11 +44,11 @@
 		ESCPRHangOnStart  = 2,			  //when lit on CprConfig, the SCPR will hang on start
 		ESCPRFailOnRebind = 3,            //when lit on CprConfig, the SCPR will fail on rebind
 		};
-	
-	static TBool Is(TInt aValue, TInt aFlags) 
+
+	static TBool Is(TInt aValue, TInt aFlags)
 	    {
 	    aFlags = (1 << aFlags);
-	    return aValue & aFlags; 
+	    return aValue & aFlags;
 	    }
 	};
 
@@ -65,11 +66,12 @@
 	virtual ~CDummyMetaConnectionProvider();
 	virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage);
 	virtual void ConstructL();
-	
+
 	virtual void StartAvailabilityMonitoringL(const Messages::TNodeCtxId& aAvailabilityActivity); //Default implementation, usually empty on the mid-tier MCprs
     virtual void CancelAvailabilityMonitoring(); //Default implementation, usually empty on the mid-tier MCprs
-    
-    CMCPrPubSubSubscriber* iPubSubSubscriber;    
+
+    CMCPrPubSubAvailability* iPubSubAvailability;
+    CMCPrPubSubStopTrigger* iPubSubStopTrigger;
     };
 
 namespace DummyMCPRStates
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_mcprpubsubsubscriber.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_mcprpubsubsubscriber.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -38,15 +38,6 @@
 using namespace Messages;
 using namespace ESock;
 
-CMCPrPubSubSubscriber* CMCPrPubSubSubscriber::NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode)
-	{
-	CMCPrPubSubSubscriber* self = new (ELeave) CMCPrPubSubSubscriber(aProvBase,aStopCode);
-	CleanupStack::PushL(self);
-	self->StartL();
-	CleanupStack::Pop(self);
-	return self;
-	}
-
 CMCPrPubSubSubscriber::CMCPrPubSubSubscriber(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode)
 :	CActive(EPriorityNormal),
 	iNode(aProvBase),
@@ -54,35 +45,6 @@
 	{
 	}
 
-void CMCPrPubSubSubscriber::StartAvailabilityMonitoringL(const Messages::TNodeCtxId& aAvailabilityActivity)
-    {
-    iAvailabilityActivity = aAvailabilityActivity;
-    TInt score = TAvailabilityStatus::EUnknownAvailabilityScore;
-    
-    TInt result = iProperty.Attach(TUid::Uid(EAvailabilityTestingPubSubUid), iNode.ProviderInfo().APId());
-    if(result != KErrNone)
-        {
-        User::LeaveIfError(iProperty.Define(TUid::Uid(EAvailabilityTestingPubSubUid), iNode.ProviderInfo().APId(), RProperty::EInt));
-        User::LeaveIfError(iProperty.Attach(TUid::Uid(EAvailabilityTestingPubSubUid), iNode.ProviderInfo().APId()));
-        }
-
-    iProperty.Subscribe(iStatus);
-    SetActive();
-    iProperty.Get(score); //If Get() is unsuccessful score must not be modified!
-    
-    if (score != TAvailabilityStatus::EUnknownAvailabilityScore)
-        {
-        //Send the intial availability status.
-        TAvailabilityStatus status(score);
-        RClientInterface::OpenPostMessageClose(NodeId(), iAvailabilityActivity,
-                TCFAvailabilityControlClient::TAvailabilityNotification(status).CRef());
-        }
-    }
-
-void CMCPrPubSubSubscriber::CancelAvailabilityMonitoring()
-    {
-    iAvailabilityActivity = Messages::TNodeCtxId::NullId();
-    }
 
 void CMCPrPubSubSubscriber::StartL()
 	{
@@ -90,25 +52,6 @@
 	CActiveScheduler::Add(this);
 	}
 
-void CMCPrPubSubSubscriber::RunL()
-	{
-	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubSubscriber::RunL")));
-	User::LeaveIfError(iStatus.Int());
-
-	// resubscribe immediately
-	iProperty.Subscribe(iStatus);
-	SetActive();
-
-    // then process
-	TInt value;
-	User::LeaveIfError(iProperty.Get(value));
-	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubSubscriber subscribed value now %d"),value));
-
-    ASSERT(!iAvailabilityActivity.IsNull()); //maybe a bit defensive, but this is test code after all. The test changes availability when nobody is listenning; Surely test is wrong?
-    RClientInterface::OpenPostMessageClose(Id(), iAvailabilityActivity,
-        TCFAvailabilityControlClient::TAvailabilityNotification(value).CRef());
-	}
-
 TInt CMCPrPubSubSubscriber::RunError(TInt /*aError*/)
 	{
 	//path uncovered.
@@ -126,3 +69,150 @@
 	this->Cancel(); // object must be stoppable by destcruction due to cleanup restrictions
 	iProperty.Close();
 	}
+
+//
+
+CMCPrPubSubAvailability* CMCPrPubSubAvailability::NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode)
+	{
+	CMCPrPubSubAvailability* self = new (ELeave) CMCPrPubSubAvailability(aProvBase,aStopCode);
+	CleanupStack::PushL(self);
+	self->StartL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CMCPrPubSubAvailability::CMCPrPubSubAvailability(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode)
+:   CMCPrPubSubSubscriber(aProvBase,aStopCode)
+    {
+	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubAvailability ctor")));
+	}
+
+void CMCPrPubSubAvailability::StartAvailabilityMonitoringL(const Messages::TNodeCtxId& aAvailabilityActivity)
+    {
+	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubSubscriber::StartAvailabilityMonitoringL")));
+
+    iAvailabilityActivity = aAvailabilityActivity;
+    TInt score = TAvailabilityStatus::EUnknownAvailabilityScore;
+
+    TInt result = iProperty.Attach(TUid::Uid(EAvailabilityTestingPubSubUid), iNode.ProviderInfo().APId());
+    if(result != KErrNone)
+        {
+        User::LeaveIfError(iProperty.Define(TUid::Uid(EAvailabilityTestingPubSubUid), iNode.ProviderInfo().APId(), RProperty::EInt));
+        User::LeaveIfError(iProperty.Attach(TUid::Uid(EAvailabilityTestingPubSubUid), iNode.ProviderInfo().APId()));
+        }
+
+    iProperty.Subscribe(iStatus);
+    SetActive();
+    iProperty.Get(score); //If Get() is unsuccessful score must not be modified!
+
+    if (score != TAvailabilityStatus::EUnknownAvailabilityScore)
+        {
+        //Send the intial availability status.
+        TAvailabilityStatus status(score);
+        RClientInterface::OpenPostMessageClose(NodeId(), iAvailabilityActivity,
+                TCFAvailabilityControlClient::TAvailabilityNotification(status).CRef());
+        }
+    }
+
+void CMCPrPubSubAvailability::CancelAvailabilityMonitoring()
+    {
+    iAvailabilityActivity = Messages::TNodeCtxId::NullId();
+    }
+
+void CMCPrPubSubAvailability::RunL()
+	{
+	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubAvailability::RunL")));
+	User::LeaveIfError(iStatus.Int());
+
+	// resubscribe immediately
+	iProperty.Subscribe(iStatus);
+	SetActive();
+
+    // then process
+	TInt value;
+	User::LeaveIfError(iProperty.Get(value));
+	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubAvailability subscribed value now %d"),value));
+
+    __ASSERT_DEBUG(!iAvailabilityActivity.IsNull(), User::Panic(KSpecAssert_DummyPrStopSubsc, 1)); //maybe a bit defensive, but this is test code after all. The test changes availability when nobody is listenning; Surely test is wrong?
+    RClientInterface::OpenPostMessageClose(Id(), iAvailabilityActivity,
+        TCFAvailabilityControlClient::TAvailabilityNotification(value).CRef());
+	}
+
+//
+
+CMCPrPubSubStopTrigger* CMCPrPubSubStopTrigger::NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode)
+	{
+	CMCPrPubSubStopTrigger* self = new (ELeave) CMCPrPubSubStopTrigger(aProvBase,aStopCode);
+	CleanupStack::PushL(self);
+	self->StartL();
+	CleanupStack::Pop(self);
+	return self;
+	__ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_DummyPrStopSubsc, 2));
+
+	}
+
+CMCPrPubSubStopTrigger::CMCPrPubSubStopTrigger(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode)
+:   CMCPrPubSubSubscriber(aProvBase,aStopCode),
+	iNodeId(aProvBase.Id())
+    {
+	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubStopTrigger ctor")));
+	}
+
+void
+CMCPrPubSubStopTrigger::StartL()
+    {
+	CMCPrPubSubSubscriber::StartL();
+	TInt result = iProperty.Attach(TUid::Uid(EStopTriggeringPubSubUid), 1);
+	if(result != KErrNone)
+		{
+		User::LeaveIfError(iProperty.Define(TUid::Uid(EStopTriggeringPubSubUid), 1, RProperty::EInt));
+		User::LeaveIfError(iProperty.Attach(TUid::Uid(EStopTriggeringPubSubUid), 1));
+		}
+	iProperty.Subscribe(iStatus);
+    SetActive();
+    }
+
+void CMCPrPubSubStopTrigger::RunL()
+	{
+	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubStopTrigger::RunL")));
+	User::LeaveIfError(iStatus.Int());
+
+	// resubscribe immediately
+	iProperty.Subscribe(iStatus);
+	SetActive();
+
+    // then process
+	TInt value;
+	User::LeaveIfError(iProperty.Get(value));
+	__CFLOG_VAR((KDummyMCprTag, KDummyMCprSubTag, _L8("CMCPrPubSubStopTrigger subscribed value now %d"),value));
+
+	CMetaConnectionProviderBase* provider = const_cast<CMetaConnectionProviderBase*>(static_cast<const CMetaConnectionProviderBase*>(&iNode));
+	__ASSERT_DEBUG(provider, User::Panic(KSpecAssert_DummyPrStopSubsc, 3));
+
+	if(value==KStart)
+		{
+		if(iBlocking)
+			{
+			// Decrement semaphore to stop the provider from being destroyed once all of it's children have been stopped.
+			provider->DecrementBlockingDestroy();
+			iBlocking = false;
+			}
+
+		TCFServiceProvider::TStart msg;
+		RClientInterface::OpenPostMessageClose(iNodeId, iNodeId, msg);
+		}
+	else
+	if((value==KBlockingStop || value==KStop) && iNode.ServiceProvider() != NULL)
+		{
+		if(!iBlocking && value==KBlockingStop)
+			{
+			// Increment semaphore to stop the provider from being destroyed once all of it's children have been stopped.
+			provider->IncrementBlockingDestroy();
+			iBlocking = true;
+			}
+
+		TCFServiceProvider::TStop msg(iStopCode);
+		RClientInterface::OpenPostMessageClose(iNodeId, iNodeId, msg);
+		}
+	}
+
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_metaconnprov.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_metaconnprov.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -20,6 +20,7 @@
  @internalComponent
 */
 
+
 #include <comms-infras/ss_log.h>
 #include <comms-infras/coremcprstates.h>
 #include <comms-infras/coremcpractivities.h>
@@ -39,6 +40,8 @@
 using namespace Messages;
 using namespace MeshMachine;
 
+
+
 CDummyMetaConnectionProvider* CDummyMetaConnectionProvider::NewL(CMetaConnectionProviderFactoryBase& aFactory,
                                                                      const TProviderInfo& aProviderInfo)
 	{
@@ -59,14 +62,16 @@
 
 CDummyMetaConnectionProvider::~CDummyMetaConnectionProvider()
 	{
-	delete iPubSubSubscriber;
+	delete iPubSubAvailability;
+	delete iPubSubStopTrigger;
 	LOG_NODE_DESTROY(KDummyMCprTag, CDummyMetaConnectionProvider);
 	}
 
 void CDummyMetaConnectionProvider::ConstructL()
     {
     CMobilityMetaConnectionProvider::ConstructL();
-    iPubSubSubscriber = CMCPrPubSubSubscriber::NewL(*this, ProviderInfo().APId());
+    iPubSubAvailability = CMCPrPubSubAvailability::NewL(*this, ProviderInfo().APId());
+    iPubSubStopTrigger  = CMCPrPubSubStopTrigger::NewL(*this, 0);
     }
 
 void CDummyMetaConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage)
@@ -84,18 +89,19 @@
     {
     if (!GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider)))
         {
-        ASSERT(iPubSubSubscriber!=NULL);
-        RNodeInterface* peer = AddClientL(iPubSubSubscriber->Id(), TClientType(TClientType::ERegistrar, TCFClientType::EAvailabilityProvider));
-        iPubSubSubscriber->StartAvailabilityMonitoringL(aAvailabilityActivity);
+        ASSERT(iPubSubAvailability!=NULL);
+        RNodeInterface* peer = AddClientL(iPubSubAvailability->Id(), TClientType(TClientType::ERegistrar, TCFClientType::EAvailabilityProvider));
+        iPubSubAvailability->StartAvailabilityMonitoringL(aAvailabilityActivity);
         }
     }
 
 void CDummyMetaConnectionProvider::CancelAvailabilityMonitoring()
     {
     if (!GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider)))
-        {    
-        ASSERT(iPubSubSubscriber!=NULL);    
-        RemoveClient(iPubSubSubscriber->Id());
-        iPubSubSubscriber->CancelAvailabilityMonitoring();
+        {
+        ASSERT(iPubSubAvailability!=NULL);
+        RemoveClient(iPubSubAvailability->Id());
+        iPubSubAvailability->CancelAvailabilityMonitoring();
         }
     }
+
--- a/datacommsserver/esockserver/test/util/src/te_esockutilsteps.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/util/src/te_esockutilsteps.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -17,6 +17,7 @@
 #include <test/testexecutelog.h>
 #include "esocktestutils.h"
 #include <es_sock.h>
+#include <comms-infras/es_availability.h>
 
 #include <e32base.h>
 #include <cinidata.h>
@@ -149,6 +150,16 @@
 		}
 #endif
 		
+	// Explicitly reset pubsub keys used for controlling bearer availability during testing
+	const TInt KMaxLikelyAvailabilityAccessPoints = 32;
+	const TInt KDummyNifTestingPubSubUid = 0x10272F42;
+	INFO_PRINTF1(_L("Resetting availability pubsub keys"));
+	for(TInt i = 0; i < KMaxLikelyAvailabilityAccessPoints; i++)
+		{
+		// Harmless if the key doesn't exist - so we can ignore the return code
+		RProperty::Set(TUid::Uid(KDummyNifTestingPubSubUid), i, ESock::TAvailabilityStatus::EMaxAvailabilityScore);
+		}
+	
 	return TestStepResult();
 	}
 
--- a/datacommsserver/esockserver/test/util/src/ts_esockutilsteps.cpp	Mon Mar 15 12:45:15 2010 +0200
+++ b/datacommsserver/esockserver/test/util/src/ts_esockutilsteps.cpp	Wed Mar 31 23:27:09 2010 +0300
@@ -14,6 +14,7 @@
 //
 
 // EPOC includes
+#include <e32property.h>
 #include <e32base.h>
 
 // Test system includes
@@ -24,6 +25,7 @@
 #include "ts_esockutilsteps.h"
 #include "esockloader.h"
 #include "esocktestutils.h"
+#include <comms-infras/es_availability.h>
 
 class TTruncateOverflow16 : public TDes16Overflow
 	{
@@ -155,6 +157,17 @@
 			INFO_PRINTF2(_L("UnloadESock returned error %d"), err);
 			}
 		}
+
+	// Explicitly reset pubsub keys used for controlling bearer availability during testing
+	const TInt KMaxLikelyAvailabilityAccessPoints = 32;
+	const TInt KDummyNifTestingPubSubUid = 0x10272F42;
+	INFO_PRINTF1(_L("Resetting availability pubsub keys"));
+	for(TInt i = 0; i < KMaxLikelyAvailabilityAccessPoints; i++)
+		{
+		// Harmless if the key doesn't exist - so we can ignore the return code
+		RProperty::Set(TUid::Uid(KDummyNifTestingPubSubUid), i, ESock::TAvailabilityStatus::EMaxAvailabilityScore);
+		}
+	
 	return verdict;
 	}