Revision: 201011
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 15:18:54 +0300
changeset 15 8248b03a2669
parent 0 307788aac0a8
child 17 bfe1f539b721
Revision: 201011 Kit: 201015
realtimenetprots/rtp/cfrtp/documentation/rtpflows.eap
realtimenetprots/rtp/documentation/RTP.vsd
realtimenetprots/rtp/documentation/rtp.dox
realtimenetprots/rtp/group/mm-protocols_rtp.history.xml
realtimenetprots/rtp/group/rtptest.xml
realtimenetprots/rtp/rtpcore/test/trtpsocket/src/trtpcoreserver.h
realtimenetprots/sipfw/ClientResolver/Resolver/src/CSIPOptionsHandler.cpp
realtimenetprots/sipfw/Data/backup_registration.xml
realtimenetprots/sipfw/Group/mm-protocols_sip2_com.history.xml
realtimenetprots/sipfw/ProfileAgent/AlrMonitor/src/sipalrsnapmonitor.cpp
realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h
realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnmanager.h
realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp
realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnmanager.cpp
realtimenetprots/sipfw/ProfileAgent/Client/Api/sipprofile.h
realtimenetprots/sipfw/ProfileAgent/Client/Src/sipmanagedprofile.cpp
realtimenetprots/sipfw/ProfileAgent/Client/Src/sipprofile.cpp
realtimenetprots/sipfw/ProfileAgent/Group/sipietfagent.mmp
realtimenetprots/sipfw/ProfileAgent/Group/sipimsagent.mmp
realtimenetprots/sipfw/ProfileAgent/Group/sipprofilefsm.mmp
realtimenetprots/sipfw/ProfileAgent/Group/sipprofileserver.mmp
realtimenetprots/sipfw/ProfileAgent/Group/sipproxyrsv.mmp
realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfconnectioncontext.cpp
realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfprofilecontext.cpp
realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Inc/sipphoneregistrationmonitor.h
realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Inc/sipphoneregistrationobserver.h
realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/sipimsprofileagent.cpp
realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/sipphoneregistrationmonitor.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileCacheItem.h
realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileServerCore.h
realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileState.h
realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileStateRegInProg.h
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCSSession.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileState.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateRegInProg.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateUnregistered.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/sipalrmigrationcontroller.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/sipprofilestatewaitforpermission.cpp
realtimenetprots/sipfw/SIP/NetworkMonitor/Plugins/Packet/Src/CPacketContextMonitor.h
realtimenetprots/sipfw/SIP/NetworkMonitor/src/CNetworkManager.cpp
realtimenetprots/sipfw/SIP/SystemStateMonitor/Api/sipsystemstatemonitor.h
realtimenetprots/sipfw/SIP/sipapi/api/siphttpdigestchallengeobserver.h
realtimenetprots/sipfw/SIP/sipapi/api/siphttpdigestchallengeobserver2.h
rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpAPI.h
rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpComm.h
rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpManager.h
rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSDES.h
rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSession.h
rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSessionSRTP.h
rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpStream.h
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpAPI.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpComm.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpManager.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpPacket.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSDES.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSession.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSessionSRTP.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpStpPacket.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpStream.cpp
rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpTranStream.cpp
rtp/rtpstack/tsrc/ut_rtpstack/stubs/inc/es_sock.h
rtp/srtpstack/inc/srtpaesctrcrypto.h
rtp/srtpstack/inc/srtpauthentication_hmac_sha1.h
rtp/srtpstack/inc/srtpauthentication_rcc.h
rtp/srtpstack/src/srtpaesctrcrypto.cpp
rtp/srtpstack/src/srtpauthentication_hmac_sha1.cpp
rtp/srtpstack/src/srtpauthentication_rcc.cpp
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCipherAESCM128.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoContext.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoHandlerSRTCP.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoHandlerSRTP.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPKeyDerivation_AESCM128.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPSession.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStream.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStreamIn.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStreamOut.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSrtpAuthentication_RCC.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_SRTPAuthentication_HMAC_SHA1.h
rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_SRTPAuthentication_NULL.h
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCipherAESCM128.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoContext.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandler.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandlerSRTCP.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandlerSRTP.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPKeyDerivation_AESCM128.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPMasterKey.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPMasterSalt.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPSession.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStream.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStreamIn.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStreamOut.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSrtpAuthentication_RCC.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_HMAC_SHA1.cpp
rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_NULL.cpp
sipplugins/sippsipadapter/inc/CWPSIPAdapter.h
sipplugins/sippsipadapter/src/CWPSIPAdapter.cpp
sipplugins/sippsipsettingsui/data/gssipsettingspluginrsc.rss
sipplugins/sippsipsettingsui/group/gssipsettingsplugin.mmp
sipplugins/sippsipsettingsui/inc/gssipsettingsplugin.hrh
sipplugins/sippsipsettingsui/inc/gssiptimer.h
sipplugins/sippsipsettingsui/inc/sipsettingscontainer.h
sipplugins/sippsipsettingsui/inc/sipsettingsmodel.h
sipplugins/sippsipsettingsui/inc/sipsettlistsipprofsetcontainer.h
sipplugins/sippsipsettingsui/inc/sipsettlistsipsrvsetcontainer.h
sipplugins/sippsipsettingsui/src/gssipmodel.cpp
sipplugins/sippsipsettingsui/src/gssiptimer.cpp
sipplugins/sippsipsettingsui/src/sipserversettingvalidator.cpp
sipplugins/sippsipsettingsui/src/sipsettingscontainer.cpp
sipplugins/sippsipsettingsui/src/sipsettingsmodel.cpp
sipplugins/sippsipsettingsui/src/sipsettingsplugin.cpp
sipplugins/sippsipsettingsui/src/sipsettlistsipprofsetcontainer.cpp
sipplugins/sippsipsettingsui/src/sipsettlistsipprofsetview.cpp
sipplugins/sippsipsettingsui/src/sipsettlistsipsrvsetcontainer.cpp
sipplugins/sippsipsettingsui/src/sipsettlistsipsrvsetview.cpp
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/group/ut_sipsettingsplugin.mmp
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/inc/ut_gssiptimer.h
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/inc/ut_sipsettingscontainer.h
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/inc/ut_sipsettlistsipprofsetcontainer.h
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/sipmanagedprofilestub.cpp
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_gssipprofileutil.cpp
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_gssiptimer.cpp
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettingscontainer.cpp
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettingsplugindllmain.cpp
sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettlistsipprofsetcontainer.cpp
sipplugins/sippsystemstatemonitor/group/sipsystemstatemonitor.mmp
sipplugins/sippsystemstatemonitor/inc/CSystemStateConnUsagePermissionMonitor.h
sipplugins/sippsystemstatemonitor/inc/MSystemStateConnUsagePermissionObserver.h
sipplugins/sippsystemstatemonitor/inc/sipdevicestateaware.h
sipplugins/sippsystemstatemonitor/inc/siprfsmonitorao.h
sipplugins/sippsystemstatemonitor/inc/sipsnapavailabilitymonitor.h
sipplugins/sippsystemstatemonitor/inc/sipsystemstatemonitorimpl.h
sipplugins/sippsystemstatemonitor/inc/sipvpnmonitorao.h
sipplugins/sippsystemstatemonitor/src/CSystemStateConnUsagePermissionMonitor.cpp
sipplugins/sippsystemstatemonitor/src/siprfsmonitorao.cpp
sipplugins/sippsystemstatemonitor/src/sipsnapavailabilitymonitor.cpp
sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorao.cpp
sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorimpl.cpp
sipplugins/sippsystemstatemonitor/src/sipvpnmonitorao.cpp
sipproviderplugins/sipprovider/group/bld.inf
sipproviderplugins/sipprovider/sipconnectionplugins/Documentation/sipproviders.eap
sipproviderplugins/sipprovider/sipconnectionplugins/group/mm-protocols_sipproviders.history.xml
sipproviderplugins/sipprovider/sipconnectionplugins/inc/sipprovisioninfo.h
sipproviderplugins/sipprovider/sipconnectionplugins/src/sipcpr.cpp
sipproviderplugins/sipprovider/sipconnectionplugins/src/sipmcpr.cpp
sipproviderplugins/sipprovider/sipconnectionplugins/src/sipscpr.cpp
sipproviderplugins/sipprovider/sipdummyprt/group/mm-protocols_sipdummyprt.history.xml
sipproviderplugins/sipprovider/sipstatemachine/group/mm-protocols_sipstatemachine.history.xml
sipproviderplugins/sipprovider/sipstatemachine/inc/transitionengine.h
sipproviderplugins/sipprovider/sipstatemachine/src/SipStateMachine.cpp
sipproviderplugins/sipprovider/sipstatemachine/src/transitionengine.cpp
Binary file realtimenetprots/rtp/cfrtp/documentation/rtpflows.eap has changed
Binary file realtimenetprots/rtp/documentation/RTP.vsd has changed
--- a/realtimenetprots/rtp/documentation/rtp.dox	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +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:
-// This is the extra documentation for the RTP API
-// This is the API for the SymbianOS RTP stack.
-// To use this API, start by creating a RRtpSession
-// A session encapsulates all RTP traffic to/from a particular port, and
-// its associated RTCP traffic. 
-// RTP traffic from this port is modelled via the RRtpSendStream class.
-// RTP traffic from a particular remote host is modelled via RRtpReceiveStream
-// RRtpPacket and its subclasses RRtpSendPacket and RRtpReceivePacket are
-// the encapsulations of the RTP packets.
-// The API uses a R class 'cheshire cat' idiom. All the R classes in
-// the API are handles onto resources, or you may prefer to think of
-// them as wrappers round pointers. As such they have the following
-// properties:
-// - They are very lightweight and can be copied around by value.
-// - 2 copies of the same handle are 'the same thing'; if you do something
-// to one of them it will apply to the other.
-// - They need to be 'opened' before they point to anactual resource,
-// and must be closed when the resource is no longer needed. Note
-// that in some cases, the resource is considered to be owned by
-// another resource, so there is no need to close it. In these
-// cases, there is no close method and this fact is clearly
-// documented. If an R class is closed, any other copies of the
-// same handle will become invalid as they are handles to
-// nonexistent resources.
-// The RTP stack relies heavily on an event model based on callback
-// functions. This has the following advantages over alternative methods, 
-// such as signaling events via TRequestStatus objects or using mixins:
-// - It is more flexible for the client; we can distinguish a large number 
-// of different events and allow the client to chose if they want to
-// receive notifications about them in 1 function or many, and how they
-// want to spread different notifications over their object structure.
-// To give an example, a client might be interested in all SDES messages,
-// only in some types of SDES messages or in no SDES messages, and they
-// might want to handle these messages in different parts of the code or
-// all in the same part. THe callback model can support all these cases.
-// - Many other RTP APIs on other platforms use a similar concept, so
-// creating a simialr API makes it easier to port code that originated 
-// on top of these APIs.
-// There are 4 major concepts in the event model:
-// - An event manager. The session, the send stream and the receive
-// streams each have their own event manager. Callbacks registered
-// on 1 manager don't apply to other managers. The manager is not
-// exposed in the API.
-// - An event. (TRtpEvent class). An event is generated when anything
-// happens that the client might want to know about. The event can
-// be thought of as comprising 2 numbers, the event type taken from
-// TRtpEventType and another parameter whose meaning is event-type
-// specific. For instance, for all the 'Fail' events it is a
-// SymbianOS error code. Additional information might be implicitly
-// associated with the event, but needs to be fetched from another
-// object, for instance when processing a ErtpPacketReceived event,
-// the RRtpReceivePacket object must be obtained from the
-// Rrt-ReceiveStream.  Events are associated with an object; for
-// instance receive stream events are associated with a
-// RRtpReceiveStream. There are functions on the event for
-// obtaining that object.
-// - A callback function. A callback function is a static function
-// with a particular signature.  Static
-// functions are used because callback models using member
-// functions in C++ either involve bending the rules of the
-// language or a lot of code bloat. If a function is registered for
-// a particular event, it will be called when that event
-// occurs. One callback function can be associated with more than 1
-// callback registration. Callback functions take a pointer argument
-// which was supplied as part of the registration; normally a
-// static callback function in a CFoo class would take a pointer to
-// a CFoo* and call a member function on the CFoo object that does
-// the real work.
-// - A callback registration. A callback registration is the thing
-// that glues all this together. The event manager contains a
-// number of callback registrations, each of which binds a function
-// and pointer (normally an object) to a particular kind of
-// event.  Registrations can be bound to all events on a stream
-// (except 'Fail' events), via the ErtpAnyEvent code, or they can
-// be further restricted by a parameter whose meaning is event-type
-// specific. (For instance for the ErtpSDES event, the parameter is
-// used to express interest in only a particular SDES field.) The
-// same callback function and object can be registered for several
-// different registrations, possibly even on different streams.
-// So to use the event model, decide which events you care about, decide
-// which objects care about those events, and register functions in all
-// those objects to be told about all the events. 
-// If an event leaves, an Fail event will be generated with the leave
-// code.  Handlers for error events must not leave, as this would
-// result in an infinite loop if allwed. It is reccomended that error
-// events are handled by a separate callback to other events, to avoid
-// confusion about whether leaves are allowed. (This is why callbacks
-// registered for ErtpAnyEvent don't get called back for Fail events)
-// One-shot event registrations are registrations that are only called
-// back once. For instance, an application might want to display the
-// NAME SDES parameter but might only need to be told what it is when
-// the first one arrives. A one-shot resistration will only be called
-// back for the first NAME received.
-// To register events, use one of the RegisterEventCallbackL
-// functions.  These are template functions that are available in
-// global and member-function versions. The reason for this is
-// limitations in the handling of template member functions in MSVC6;
-// in many situations calls to the member functions won't compile and
-// the global functions should be used instead.
-// Note that there are always a pair of functions; one doesn't take
-// the 'aParameter' parameter, and defaults it to
-// KRtpNoParameter. This is more efficient as the parameter is often
-// not used.
-// The callback function takes a pointer which can be of any type.
-// The RegisterEventCallbackL functions are all templated so that the
-// pointer you supply must be of the same type as the function
-// expects.
-// As RTP/RTCP is removable from ROM using the SYMBIAN_EXCLUDE_RTP_RTCP
-// in the build rom command a stub is used to prevent linking failures.
-// The "#ifdef RTP_Removed" is used to reduce the overhead of having an extra set of cpp files to create the 
-// stub. Using "#ifdef RTP_Removed" the MMP files create an extra set of stubbed 
-// dlls from the one cpp file.  The iby file then exports the complete or stubbed dlls depending on the 
-// SYMBIAN_EXCLUDE macro.
-// The Open session functions leave with KErrNotSuported when the stub is used.  Functions
-// which can not leave ASSERT in debug mode as should not have been called since the Open and similar 
-// functions should have 'left'.
-// 
-//
-
-/**
- @mainpage Symbian RTP API
- The RTP stack's event model is described in the section '@ref Events'
- @page Events The Event Model
- @page Stub of RTP API with #ifdef RTP_Removed
-*/
--- a/realtimenetprots/rtp/group/mm-protocols_rtp.history.xml	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,309 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<relnotes name="RTP">
-  <purpose>
-    Real Time Transport Protocol. 2 dll's implied.
-  </purpose>
-  
-  <defect number="DEF138644" title="RTCP SR packet reports wrong NTP Timestamp value" revision="061">
-    Fix for:
-    DEF138644 RTCP SR packet reports wrong NTP Timestamp value
-  </defect>
-
-  <defect number="DEF138151 " title="[FST]Verification of RTCPRRJitter fails for moderate sized (audio/video) data" revision="060">
-    Fix for:
-    DEF138151[FST]Verification of RTCPRRJitter fails for moderate sized (audio/video) data
-  </defect>
-
-  <defect number="DEF131783 " title="Functionality moved from SCPRStates to PRStates namespace" revision="059">
-    Fix for:
-    DEF131783  Functionality moved from SCPRStates to PRStates namespace
-  </defect>
-
-  <defect number="DEF128260" title="Fix RTP published API to match the original design sketch" revision="058">
-    Fix for:
-    DEF128260 Fix RTP published API to match the original design sketch
-  </defect>
-
-  <defect number="PDEF130573" title="CF-RTP should remove unnecessary memcopies." revision="057">
-    Fix for:
-    PDEF130573 CF-RTP  should remove unnecessary memcopies. 
-  </defect>
-
-  <defect number="PDEF129033" title="CSubConRTPGenericParamSet::AddRtpExtension( ) might be used to load malware DLLs" revision="056">
-    Fix for:
-    PDEF129033 CSubConRTPGenericParamSet::AddRtpExtension( ) might be used to load malware DLLs    
-  </defect>
-  
-  <defect number="DEF129424" title="GT errors due to Converged-comms in M04729 v9.5,Future" revision="055">
-    Fix for:
-    DEF129424 GT errors due to Converged-comms in M04729 v9.5,Future
-  </defect>
-
-  <defect number="DEF128627" title="[Coverity]-FORWARD_NULL-mm-protocols/rtp" revision="054">
-    Fix for:
-    DEF128627 [Coverity]-FORWARD_NULL-mm-protocols/rtp    
-  </defect>
-
-  <defect number="PDEF128596" title="rtpremoved.dll is exporting incorrect ordinal sequence for AMRv5" revision="053">
-    Fix for:
-    PDEF128596 rtpremoved.dll is exporting incorrect ordinal sequence for AMRv5    
-  </defect>
-  
-  <defect number="DEF127519" title="CSubConRTPGenericParamSet  parameter name RTP incorrect" revision="052">
-    Fix for:
-    DEF127519 CSubConRTPGenericParamSet  parameter name RTP incorrect    
-  </defect>
-  
-  <defect number="DEF127581" title="Some dirs in 'mm-protocols_rtp' do not exist" revision="051">
-    Fix for:
-    DEF127581 Some dirs in "mm-protocols_rtp" do not exist   
-  </defect> 
-
-  <ec number="120" title="Mesh Machine Productisation" revision="050">
-   Mesh Machine Productisation
-  </ec>
-  
-  <defect number="DEF127153" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-queue-status-request-underflow" revision="049">
-    Fix for:
-    DEF127153 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-queue-status-request-underflow   
-  </defect>
-  
-  <defect number="DEF127152" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-acknowledgement-underflow" revision="048">
-    Fix for:
-    DEF127152 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-acknowledgement-underflow   
-  </defect>
-  
-  <defect number="DEF127151" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-release-underflow" revision="047">
-    Fix for:
-    DEF127151 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-release-underflow   
-  </defect>
-  
-  <defect number="DEF127150" title="ICC Codenomicon : omapoc-rtcp-app-tbcp-tb-request-underflow" revision="046">
-    Fix for:
-    DEF127150 ICC Codenomicon : omapoc-rtcp-app-tbcp-tb-request-underflow   
-  </defect>
-  
-  <defect number="DEF127148" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-queue-status-response-underflow" revision="045">
-    Fix for:
-    DEF127148 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-queue-status-response-underflow   
-  </defect>
-  
-  <defect number="DEF127145" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-deny-underflow" revision="044">
-    Fix for:
-    DEF127145 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-deny-underflow   
-  </defect>
-  
-  <defect number="DEF127144" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-granted-underflow" revision="043">
-    Fix for:
-    DEF127144 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-granted-underflow   
-  </defect>
-  
-  <defect number="DEF127143" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-revoke-underflow" revision="042">
-    Fix for:
-    DEF127143 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-revoke-underflow   
-  </defect>
-  
-  <defect number="DEF127142" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-taken-underflow" revision="041">
-    Fix for:
-    DEF127142 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-taken-underflow   
-  </defect>
-  
-  <defect number="DEF127141" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-idle-underflow" revision="040">
-    Fix for:
-    DEF127141 ICC Codenomicon :omapoc-rtcp-app-tbcp-tb-idle-underflow   
-  </defect>
-  
-  <defect number="DEF127140" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-disconnect-underflow" revision="039">
-    Fix for:
-    DEF127140 ICC Codenomicon :omapoc-rtcp-app-tbcp-disconnect-underflow   
-  </defect>
-  
-  <defect number="DEF127066" title="ICC Codenomicon :omapoc-rtcp-app-tbcp-connect-underflow" revision="038">
-    Fix for:
-    DEF127066 ICC Codenomicon :omapoc-rtcp-app-tbcp-connect-underflow   
-  </defect>
-  
-  <defect number="DEF127065" title="ICC Codenomicon : rfc3611-rtcp-xr-voip-sdes-underflow" revision="037">
-    Fix for:
-    DEF127065 ICC Codenomicon : rfc3611-rtcp-xr-voip-sdes-underflow   
-  </defect>
-  
-  <defect number="DEF127064" title="ICC Codenomicon : rfc3611-rtcp-xr-stats-sdes-underflow" revision="036">
-    Fix for:
-    DEF127064 ICC Codenomicon : rfc3611-rtcp-xr-stats-sdes-underflow   
-  </defect>
-  
-  <defect number="DEF127063" title="ICC Codenomicon :rfc3611-rtcp-xr-dlrr-sdes-underflow" revision="035">
-    Fix for:
-    DEF127063 ICC Codenomicon :rfc3611-rtcp-xr-dlrr-sdes-underflow   
-  </defect>
-  
-  <defect number="DEF127061" title="ICC Codenomicon :rfc3611-rtcp-xr-rrt-sdes-underflow" revision="034">
-    Fix for:
-    DEF127061 ICC Codenomicon :rfc3611-rtcp-xr-rrt-sdes-underflow   
-  </defect>
-  
-  <defect number="DEF127059" title="ICC Codenomicon : rfc3611-rtcp-xr-prt-sdes-underflow" revision="033">
-    Fix for:
-    DEF127059 ICC Codenomicon : rfc3611-rtcp-xr-prt-sdes-underflow   
-  </defect>
-  
-  <defect number="DEF127058" title="ICC Codenomicon : rfc3611-rtcp-xr-dup-rle-sdes-underflow" revision="032">
-    Fix for:
-    DEF127058 ICC Codenomicon : rfc3611-rtcp-xr-dup-rle-sdes-underflow   
-  </defect>
-  
-  <defect number="DEF127057" title="ICC Codenomicon : rfc3611-rtcp-xr-loss-rle-sdes-underflow" revision="031">
-    Fix for:
-    DEF127057 ICC Codenomicon : rfc3611-rtcp-xr-loss-rle-sdes-underflow   
-  </defect>
-  
-  <defect number="DEF126969" title="ICC Codenomicon : rfc3550-rtcp-rr-sdes-rr-underflow" revision="030">
-    Fix for:
-    DEF126969 ICC Codenomicon : rfc3550-rtcp-rr-sdes-rr-underflow   
-  </defect>
-  
-  <defect number="DEF126967" title="ICC Codenomicon : rfc3550-rtcp-rr-sdes-rr-report-block-repeat" revision="029">
-    Fix for:
-    DEF126967 ICC Codenomicon : rfc3550-rtcp-rr-sdes-rr-report-block-repeat   
-  </defect>
-  
-  <defect number="DEF126965" title="ICC Codenomicon : rfc3550-rtcp-rr-sdes-rr-header-rc" revision="028">
-    Fix for:
-    DEF126965 ICC Codenomicon : rfc3550-rtcp-rr-sdes-rr-header-rc   
-  </defect>
-  
-  <defect number="DEF126899" title="SMP: RTP does not compile on x86gcc platform" revision="027">
-    Fix for:
-    DEF126899 SMP: RTP does not compile on x86gcc platform   
-  </defect>
-  
-  <defect number="DEF126835" title="mmp-rtp: WINSCW UDEB call set CName twice with SetSDESL does not leave -11" revision="026">
-    Fix for:
-    DEF126835 mmp-rtp: WINSCW UDEB call set CName twice with SetSDESL does not leave -11   
-  </defect>
-  
-  <defect number="DEF126833" title="mmp-rtp: newsource event callback did not always be called in emulator" revision="025">
-    Fix for:
-    DEF126833 mmp-rtp: newsource event callback did not always be called in emulator   
-  </defect>
-  
-  <defect number="DEF126446" title="SDL-RTP:RRtpsession::SendRTCPPacketL no parameter explanation" revision="024">
-    Fix for:
-    DEF126446 SDL-RTP:RRtpsession::SendRTCPPacketL no parameter explanation   
-  </defect>
-  
-  <defect number="DEF126448" title="SDL-RTP: see also link of RRtpSession::DontReceive() is itsself" revision="023">
-    Fix for:
-    DEF126448 SDL-RTP: see also link of RRtpSession::DontReceive() is itsself   
-  </defect>
-  
-  <defect number="DEF126659" title="[Coverity] [UNUSED_VALUE][UNINIT]  mm-protocols/rtp " revision="022">
-    Fix for:
-    DEF126659 [Coverity] [UNUSED_VALUE][UNINIT]  mm-protocols/rtp   
-  </defect>
-  
-  <defect number="DEF126366" title="rtcp packet send to rtp port while remote rtcp port is not available" revision="021">
-    Fix for:
-    DEF126366 rtcp packet send to rtp port while remote rtcp port is not available  
-  </defect>
-  
-  <defect number="DEF126028" title="RRtpSendPacket::SetPayloadType doesn't panic specifying PT of 128 under ARMv5" revision="020">
-    Fix for:
-    DEF126028 RRtpSendPacket::SetPayloadType doesn't panic specifying PT of 128 under ARMv5  
-  </defect>
-  
-  <defect number="DEF125436" title="RRtpSendSource::ByeL panic with RTP-SOCKET 400 when aReason.Length%4 != 0" revision="019">
-    Fix for:
-    DEF125436 RRtpSendSource::ByeL panic with RTP-SOCKET 400 when aReason.Length%4 != 0  
-  </defect>
-  
-  <defect number="DEF125953" title="mmp-rtp: rrtpsession::openL should use rtp port in destination address" revision="018">
-    Fix for:
-    DEF125953 mmp-rtp: rrtpsession::openL should use rtp port in destination address  
-  </defect>
-  
-  <defect number="DEF125880" title="ESock Panic when invalid Bandwidth session parameter is given." revision="017">
-    Fix for:
-    DEF125880 ESock Panic when invalid Bandwidth session parameter is given.  
-  </defect>
-  
-  <defect number="DEF125710" title="Panic codes description for RRtpSendPacket::SetPayloadType in SDL is incorrect " revision="016">
-    Fix for:
-    DEF125710 Panic codes description for RRtpSendPacket::SetPayloadType in SDL is incorrect  
-  </defect>
-  
-  <defect number="DEF125425" title="The default value of RRtpSendSource::iAlignment is not the correct value of 1" revision="015">
-    Fix for:
-    DEF125425 The default value of RRtpSendSource::iAlignment is not the correct value of 1 
-  </defect>
-  
-  <defect number="DEF125376" title="CRtcpSessionData::iAverageRtcpSize is always 0 once SendRtcpL is called once." revision="014">
-    Fix for:
-    DEF125376 CRtcpSessionData::iAverageRtcpSize is always 0 once SendRtcpL is called once. 
-  </defect>
-  
-  <preq number="1903" title="Real-time and best effort data flows for RTP" revision="013">
-   Real-time and best effort data flows for RTP
-  </preq>
-  
-  <minor_change title="After OOM enabled,RTP testcases which are using GetBoolFromConfig() function in TEF are failed, cause this function calls a base api which is trying to allocate memory on heap which will fails in OOM on condition." revision="012"> 
-  </minor_change>
-  
-  <defect number=" PDEF119270" title=" SR packets not generated, on receiving RTP packets " revision="011">
-    Fix for:
-    PDEF119270 SR packets not generated, on receiving RTP packets 
-  </defect>
-  
-  <defect number=" PDEF117965" title=" Klocwork issues, NULL pointer can be used in release build mm-protocols_rtp " revision="010">
-    Fix for:
-    PDEF117965 Klocwork issues, NULL pointer can be used in release build mm-protocols_rtp 
-  </defect>
-
-  <defect number="DEF111868" title="Filiename policy warnings in SIP HL APIs and RTP components" revision="009">
-    Fix for:
-    DEF111868 Filiename policy warnings in SIP HL APIs and RTP components
-  </defect>
-  
-  <defect number="DEF107516" title="RTP Tests are failing for 9.5 Winscw Emulator" revision="008">
-    Fix for:
-    DEF107516 RTP Tests are failing for 9.5 Winscw Emulator
-  </defect>
-  
-  <defect number="PDEF106768" title="Symbian rtp stack crashes after a long pause in rtp packet flow" revision="007">
-    Fix for:
-    PDEF108220 If the timeout is short and there is a timeout then your rtp stack will crash.
-    PDEF108221 RTP packets just disappear inside RTP stack and client application doesnt recv
-    PDEF106768 Symbian rtp stack crashes after a long pause in rtp packet flow
-  </defect>
-
-  <defect number="PDEF108220" title="If the timeout is short and there is a timeout then your rtp stack will crash." revision="006">
-    Fix for:
-    PDEF108220 If the timeout is short and there is a timeout then your rtp stack will crash.
-    PDEF108221 RTP packets just disappear inside RTP stack and client application doesnt recv
-    PDEF106768 Symbian rtp stack crashes after a long pause in rtp packet flow
-  </defect>
-
-  <defect number="PDEF108221" title="RTP packets just disappear inside RTP stack and client application doesnt recv" revision="005">
-    Fix for:
-    PDEF108220 If the timeout is short and there is a timeout then your rtp stack will crash.
-    PDEF108221 RTP packets just disappear inside RTP stack and client application doesnt recv
-    PDEF106768 Symbian rtp stack crashes after a long pause in rtp packet flow
-  </defect>
-
-  <defect number="PDEF104584" title="Memory leak in CRtpSession::RunL" revision="004">
-    PDEF104584 - Memory leak in CRtpSession::RunL
-  </defect>
-
-  <preq number="1182" title="GNU Make-based build system" revision="003">
-    GNU Make-based build system
-  </preq>
-
-  <defect number="PDEF103856" title="Check the functionality of RtpUtils::GetNtpTime()." revision="002">
-    Fix for PDEF103856 Check the functionality of RtpUtils::GetNtpTime().
-  </defect>
-
-  <defect number="PDEF101761" title="RRtcpSRPart::NTPTimestamp(TTime&amp; aTime) const severely broken" revision="001">
-    RRtcpSRPart::NTPTimestamp(TTime&amp; aTime) const severely broken.
-  </defect>
-</relnotes>
--- a/realtimenetprots/rtp/group/rtptest.xml	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/rtp/group/rtptest.xml	Fri Apr 16 15:18:54 2010 +0300
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+ Copyright (c) 2006 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"
+ 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".
 
@@ -15,7 +15,6 @@
  Description:
  CommDB Settings File
  All Rights Reserved
-
 -->
 
 
--- a/realtimenetprots/rtp/rtpcore/test/trtpsocket/src/trtpcoreserver.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/rtp/rtpcore/test/trtpsocket/src/trtpcoreserver.h	Fri Apr 16 15:18:54 2010 +0300
@@ -124,7 +124,7 @@
   	iSSRC = 0;					// synchronization source
   	}
 
-class CRtpFixedHeader
+class CRtpFixedHeader : public CBase
    	{
    public:
    	CRtpFixedHeader(TDes8& packet);
@@ -238,7 +238,7 @@
        } specific;
    };
 
-class CRtcpPacketTest
+class CRtcpPacketTest : public CBase
    	{
    public:
    	CRtcpPacketTest(TDes8& aPacket);
--- a/realtimenetprots/sipfw/ClientResolver/Resolver/src/CSIPOptionsHandler.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ClientResolver/Resolver/src/CSIPOptionsHandler.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -216,6 +216,25 @@
         CleanupStack::PopAndDestroy(sdpBuf);
         }
     AddAcceptToResponseL( *response, aUids, aSipClients, aClientResolver2 );
+	
+	
+	//Add ClientSpecificHeaders for OPTIONS here
+	for (TInt i=0; i < aClientResolver2.Clients().Count(); i++)
+        {
+        CSIPResolvedClient2* client = aClientResolver2.Clients()[i];
+        if ( client )
+            {
+			RPointerArray<CSIPHeaderBase> headers ;
+			CSIPHeaderBase::PushLC(&headers);
+            client->AddClientSpecificHeadersForOptionsResponseL(headers);
+			for (TInt i=0; i<headers.Count(); i++)
+				{
+				response->AddHeaderL(headers[i]);
+				}
+			CleanupStack::Pop(1); //headers
+            }
+        }   	
+        
     CleanupStack::Pop(response);
     return response;
     }
--- a/realtimenetprots/sipfw/Data/backup_registration.xml	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/Data/backup_registration.xml	Fri Apr 16 15:18:54 2010 +0300
@@ -1,10 +1,10 @@
 <?xml version="1.0" standalone="yes"?>
 
 <!--
- Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+ Copyright (c) 2006 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"
+ 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".
 
@@ -14,7 +14,6 @@
  Contributors:
 
  Description:
-
 -->
 
 
--- a/realtimenetprots/sipfw/Group/mm-protocols_sip2_com.history.xml	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<relnotes name="SIP Framework">
-  <purpose>
-    Session Initiation Protocol. Main signalling protocol for 3gpp. Used by phone app, multimedia and messaging app. 3 servers implied.
-  </purpose>
-
- <cr number="1242" title="SIP over TLS" revision="13">
-  Added Note for the following cr:
-  Oghma,GT0362,MS3.4,DS.843 SIP enhancements phase 3
- </cr>
- 
- <defect number="INC136948" title="Improvements to CCHServer robustness" revision="96">
-    Defect fixes:
-	INC136948 Improvements to CCHServer robustness
-  </defect>
-
- <defect number="DEF137132" title="Crashes occur if VoIP is registered when MC backup is taken (Observed S60 3.2.3)" revision="95">
-    Defect fixes:
-	DEF137132 Crashes occur if VoIP is registered when MC backup is taken (Observed S60 3.2.3)
-  </defect>
-
- <defect number="PDEF133394" title="SIP : when moving from 3G to 2G , Packet connection goes to CS Only" revision="94">
-    Defect fixes:
-	PDEF133394 SIP : when moving from 3G to 2G , Packet connection goes to CS Only
-  </defect>
-
- <defect number="PDEF133395" title="SIP : Etel IMSAutheticate Message goes out of scope" revision="93">
-    Defect fixes:
-	PDEF133395 SIP : Etel IMSAutheticate Message goes out of scope
-  </defect>
-
- <defect number="DEF133888" title="[System Build]: Elfe32 warning in SIP Framework in M04835 vFuture build" revision="92">
-    Defect fixes:
-	DEF133888 [System Build]: Elfe32 warning in SIP Framework in M04835 vFuture build
-  </defect>
-
- <defect number="PDEF134513" title="Device behaves weirdly after registration fails to VoIP service" revision="91">
-    Defect fixes:
-	PDEF134513 Device behaves weirdly after registration fails to VoIP service
-  </defect>
-
- <defect number="PDEF133393" title="SIP Registration (Refresh) not triggered after a 2G Call" revision="90">
-    Defect fixes:
-	PDEF133393 SIP Registration (Refresh) not triggered after a 2G Call
-  </defect>
-
- <defect number="DEF134108" title="[System Build]: GT errors due to SIP Framework in M04843 v9.5" revision="89">
-    Defect fixes:
-	DEF134108 [System Build]: GT errors due to SIP Framework in M04843 v9.5
-  </defect>
-
- <defect number="PDEF133984" title="SipServer crashes if enabling two service tabs when using allatum settings over" revision="88">
-    Defect fixes:
-	PDEF133984 SipServer crashes if enabling two service tabs when using allatum settings over
-  </defect>
-
- <defect number="DEF133888" title="[System Build]: Elfe32 warning in SIP Framework in M04835 vFuture build" revision="87">
-    Defect fixes:
-	DEF133888 [System Build]: Elfe32 warning in SIP Framework in M04835 vFuture build
-  </defect>
-
- <defect number="DEF133557" title="[Coverity]-CHECKED_RETURN,USE_AFTER_FREE -mm-protocols/sip2" revision="86">
-    Defect fixes:
-	DEF133557 [Coverity]-CHECKED_RETURN,USE_AFTER_FREE -mm-protocols/sip2
-  </defect>
-
- <defect number="DEF133558" title="[Coverity]-FORWARD_NULL,RESOURCE_LEAK -mm-protocols/sip2/sip" revision="85">
-    Defect fixes:
-	DEF133558 [Coverity]-FORWARD_NULL,RESOURCE_LEAK -mm-protocols/sip2/sip
-  </defect>
-
- <defect number="DEF133559" title="[Coverity]-SYMBIAN.CLEANUP_STACK -mm-protocols/sip2" revision="84">
-    Defect fixes:
-	DEF133559 [Coverity]-SYMBIAN.CLEANUP_STACK -mm-protocols/sip2
-  </defect>
-
- <defect number="INC133381" title="Non-deterministic behaviour of Symbian's TInetAddr" revision="83">
-    Defect fixes:
-	INC133381 Non-deterministic behaviour of Symbian's TInetAddr
-  </defect>
-
- <defect number="DEF133138" title="[System Build]: Include statement not case consistent in mm-protocols_SIP2_com" revision="82">
-    Defect fixes:
-	DEF133138 [System Build]: Include statement not case consistent in mm-protocols_SIP2_com
-  </defect>
-
- <defect number="PDEF130653" title="WLAN stays connected if ICMP has been received to voice mail box unsubscribe mes" revision="81">
-    Defect fixes:
-	PDEF130653 WLAN stays connected if ICMP has been received to voice mail box unsubscribe mes
-  </defect>
-
- <defect number="DEF132597" title="ICCCodenomicon: SIP UAS responds on 0000 port and goes infinite loop" revision="80">
-    Defect fixes:
-	DEF132597 ICCCodenomicon: SIP UAS responds on 0000 port and goes infinite loop
-  </defect>
-
- <defect number="DEF132596" title="ICCCodenomicon: SIP UAS responds on 65536 port and goes infinite loop" revision="79">
-    Defect fixes:
-	DEF132596 ICCCodenomicon: SIP UAS responds on 65536 port and goes infinite loop
-  </defect>
- 
- <defect number="DEF132485" title="Keyspace design for bearer specific Registration Expiry settings in cenrep" revision="78">
-    Defect fixes:
-	DEF132485 Keyspace design for bearer specific Registration Expiry settings in cenrep
-  </defect>
-
- <defect number="DEF132486" title="support for data compatibility between sipprofiles.dat and cenrep profile format" revision="77">
-    Defect fixes:
-	DEF132486 support for data compatibility between sipprofiles.dat and cenrep profile format
-  </defect>
-
- <defect number="PDEF130652" title="Digest AKAv1 authentication does not work with VoiP" revision="76">
-    Defect fixes:
-	PDEF130652 Digest AKAv1 authentication does not work with VoiP
-  </defect>
-
- <defect number="DEF130788" title="[Coverity]-MISSING_BREAK,SIZECHECK,USE_AFTER_FREE-mm-protocols/sip2/" revision="75">
-    Defect fixes:
-	DEF130788 [Coverity]-MISSING_BREAK,SIZECHECK,USE_AFTER_FREE-mm-protocols/sip2/
-  </defect>
-
- <defect number="PDEF130654" title="Video Share settings shows deleted profiles in the selection list" revision="74">
-    Defect fixes:
-	PDEF130654 Video Share settings shows deleted profiles in the selection list
-  </defect>
-
-  <defect number="DEF129377" title="[Coverity]-SYMBIAN.CLEANUP_STACK-mm-protocols/sip2" revision="73">
-    Defect fixes:
-	DEF129377 [Coverity]-SYMBIAN.CLEANUP_STACK-mm-protocols/sip2
-  </defect>
-
- <defect number="DEF129461" title="Registration to VoIP service does not work in IPv4 and IPv6 dual network" revision="72">
-    Defect fixes:
-	DEF129461 Registration to VoIP service does not work in IPv4 and IPv6 dual network
-  </defect>
-
-  <defect number="DEF129701" title="494 response not handled correctly if SIP profile does not contain credentials" revision="71">
-    Defect fixes:
-	DEF129701 494 response not handled correctly if SIP profile does not contain credentials
-  </defect>
-
- <defect number="PDEF127679" title="Can not do VoIP registration after plugging back the cable to the WLAN AP" revision="70">
-    Defect fixes:
-	PDEF127679 Can not do VoIP registration after plugging back the cable to the WLAN AP
-  </defect>
-
- <defect number="DEF129655" title="WLAN and GPRS are simultaneous connected after roaming from GPRS to WLAN" revision="69">
-    Defect fixes:
-	DEF129655 WLAN and GPRS are simultaneous connected after roaming from GPRS to WLAN
-  </defect>
-
-  <defect number="PDEF128408" title="Profile registration fails when a deregistration is pending for another profile" revision="68">
-    Defect fixes:
-	PDEF128408 Profile registration fails when a deregistration is pending for another profile
-  </defect>
-
- <defect number="PDEF127676" title="Incorrect inheritance order in CSigCompHandler" revision="67">
-    Defect fixes:
-	PDEF127676 Incorrect inheritance order in CSigCompHandler 
-  </defect>
-  
-  <defect number="DEF127358" title="Receiving INVITE with IPv6 address in Contact and c= line via IPv4 IAP" revision="66">
-    Defect fixes:
-	DEF127358 Receiving INVITE with IPv6 address in Contact and c= line via IPv4 IAP 
-  </defect>
-  
-  <defect number="DEF126882" title="[Coverity]-SYMBIAN.CLEANUP_STACK -mm-protocols/sip2/" revision="65">
-    Defect fixes:
-	DEF126882 [Coverity]-SYMBIAN.CLEANUP_STACK -mm-protocols/sip2/ 
-  </defect>
-
- <defect number="DEF126880" title="[Coverity]-PASS_BY_VALUE -mm-protocols/sip2/ " revision="64">
-    Defect fixes:
-	DEF126880 [Coverity]-PASS_BY_VALUE -mm-protocols/sip2/ 
-  </defect>
-
- <defect number="PDEF128108" title="UDEB version of sipprofilesrv.exe crashes" revision="63">
-    Defect fixes:
-    PDEF128108  UDEB version of sipprofilesrv.exe crashes     
-  </defect>
-
- <defect number="DEF127309" title="Phone does not send Ack response to 494 Security Agreement Required" revision="62">
-    Defect fixes:
-    DEF127309  Phone does not send Ack response to 494 Security Agreement Required     
-  </defect>
-  
-  <defect number="DEF127121" title="Cloning SDP origin field with address 0.0.0.0" revision="61">
-    Defect fixes:
-    DEF127121   Cloning SDP origin field with address 0.0.0.0    
-  </defect>
-  
-  <defect number="DEF127262" title="It shouldn't be possible to change the SNAP id to zero " revision="60">
-    Defect fixes:
-    DEF127262  It shouldn't be possible to change the SNAP id to zero     
-  </defect>
-  
-  <defect number="DEF125920" title="[coverity] - FORWARD_NULL - mm-protocols/sip2/clientresolver" revision="59">
-    Defect fixes:
-    DEF125920  [coverity] - FORWARD_NULL - mm-protocols/sip2/clientresolver    
-  </defect>
-  
-  <defect number="DEF125926" title="[Coverity] - SYMBIAN.CLEANUP - mm-protocols/sip2/sip/connectionmgr" revision="58">
-    Defect fixes:
-    DEF125926  [Coverity] - SYMBIAN.CLEANUP - mm-protocols/sip2/sip/connectionmgr   
-  </defect>
-  
-  <defect number="PDEF124332" title="Terminal can't receive any calls after several header with bytecode tests
-" revision="57">
-    Defect fixes:
-    PDEF124332  Terminal can't receive any calls after several header with bytecode tests   
-  </defect>
-  
-  <defect number="DEF125137" title="[coverity] - REVERSE_INULL - mm-protocols/sip2/sip/serverresolver" revision="56">
-    Defect fixes:
-    DEF125137  [coverity] - REVERSE_INULL - mm-protocols/sip2/sip/serverresolver   
-  </defect>
-  
-  <defect number="DEF125090" title="[coverity] - NULL_RETURNS - mm-protocols/sip2/sip/sipsec/ipsecplugin" revision="55">
-    Defect fixes:
-    DEF125090  [coverity] - NULL_RETURNS - mm-protocols/sip2/sip/sipsec/ipsecplugin   
-  </defect>
-  
-  <defect number="DEF125138" title="[coverity] - REVERSE_INULL - mm-protocols/sip2/sdp" revision="54">
-    Defect fixes:
-    DEF125138  [coverity] - REVERSE_INULL - mm-protocols/sip2/sdp   
-  </defect>
-  
-  <defect number="DEF125139" title="[coverity] - CHECKED_RETURN - mm-protocols/sip2/sigcomp/sigcompengine" revision="53">
-    Defect fixes:
-    DEF125139  [coverity] - CHECKED_RETURN - mm-protocols/sip2/sigcomp/sigcompengine   
-  </defect>
-  
-  <defect number="DEF125140" title="[coverity] - CHECKED_RETURN - mm-protocols/sip2/profileagent" revision="52">
-    Defect fixes:
-    DEF125140  [coverity] - CHECKED_RETURN - mm-protocols/sip2/profileagent    
-  </defect>
-  
-  <defect number="DEF125106" title="[coverity] - NULL_RETURNS - mm-protocols/sip2/sip/connectionmgr " revision="51">
-    Defect fixes:
-    DEF125106  [coverity] - NULL_RETURNS - mm-protocols/sip2/sip/connectionmgr   
-  </defect>
-  
-  <defect number="DEF125111" title="[Coverity] - OVERRUN_STATIC - mm-protocols/sip2/sip/client/" revision="50">
-    Defect fixes:
-    DEF125111  [Coverity] - OVERRUN_STATIC - mm-protocols/sip2/sip/client/  
-  </defect>
-  
-  <defect number="DEF125136" title="[coverity] - USE_AFTER_FREE - mm-protocols/sip2/profileagent" revision="49">
-    Defect fixes:
-    DEF125136  [coverity] - USE_AFTER_FREE - mm-protocols/sip2/profileagent  
-  </defect>
-  
-  <defect number="DEF125110" title="[coverity] - FORWARD_NULL - mm-protocols/sip2/sip/sipapi " revision="48">
-    Defect fixes:
-    DEF125110  [coverity] - FORWARD_NULL - mm-protocols/sip2/sip/sipapi  
-  </defect>
-  
-  <defect number="DEF125094" title="[coverity] - NULL_RETURNS - mm-protocols/sip2/sip/transactionuser" revision="47">
-    Defect fixes:
-    DEF125094  [coverity] - NULL_RETURNS - mm-protocols/sip2/sip/transactionuser 
-  </defect>
-  
-  <defect number="DEF123023" title="Creating of CSIPProfileRegisty instance takes 50ms" revision="46">
-    Defect fixes:
-    DEF123023  Creating of CSIPProfileRegisty instance takes 50ms 
-  </defect>
-  
-  <defect number="PDEF124112" title="Incorrect handling of some SDP attributes with syntax errors" revision="45">
-    Defect fixes:
-    PDEF124112  Incorrect handling of some SDP attributes with syntax errors 
-  </defect>
-  
-  <defect number="PDEF124114" title="Parsing Refer-To header with a semicolon in SIP-URI's user part fails" revision="44">
-    Defect fixes:
-    PDEF124114  Parsing Refer-To header with a semicolon in SIP-URI's user part fails 
-  </defect>
-  
-  <defect number="PDEF124174" title="Incoming INVITE flood" revision="43">
-    Defect fixes:
-    PDEF124174  Incoming INVITE flood 
-  </defect>
-  
-  <defect number="PDEF124334" title="SDP codec: can't clone CSdpConnectionField where IP address is 0.0.0.0" revision="42">
-    Defect fixes:
-    PDEF124334  SDP codec: can't clone CSdpConnectionField where IP address is 0.0.0.0 
-  </defect>
-  
-  <defect number="DEF124240" title="Digest plugin crash after registration clears cache, dialog is challenged" revision="41">
-    Defect fixes:
-    DEF124240  Digest plugin crash after registration clears cache, dialog is challenged 
-  </defect>
-  
-  <defect number="DEF124235" title="SIPit22 Issue: Double hold not working with Cisco Call Manager" revision="40">
-    Defect fixes:
-    DEF124235  SIPit22 Issue: Double hold not working with Cisco Call Manager 
-  </defect>
-  
-  <defect number="PDEF124110" title="SipProfileSrv crashes under IPC fuzzing" revision="39">
-    Defect fixes:
-    PDEF124110  SipProfileSrv crashes under IPC fuzzing
-  </defect>
-  
-  <defect number="DEF124233" title="Creating two CSIPConnections with different IAP IDs but the same physical AP" revision="38">
-    Defect fixes:
-    DEF124233  Creating two CSIPConnections with different IAP IDs but the same physical AP
-  </defect>
-  
- <defect number="DEF122893" title="High severity CodeScanner warnings in SIP stack" revision="37">
-    Defect fixes:
-    DEF122893  High severity CodeScanner warnings in SIP stack
-  </defect>
-
- <defect number="PDEF123267" title="Creating a CSIPConnection with IAP using a static IP fails with EUnavailable" revision="36">
-    Defect fixes:
-    PDEF123267  Creating a CSIPConnection with IAP using a static IP fails with EUnavailable
-  </defect>
-  
- <defect number="PDEF123269" title="SIP server crashes in Codenomicon tests when using TCP" revision="35">
-    Defect fixes:
-    PDEF123269  SIP server crashes in Codenomicon tests when using TCP
-  </defect>
-  
-   <defect number="DEF122933" title="SIP profile registration lost if the profile is disabled during IAP migration" revision="34">
-    Defect fixes:
-    DEF122933  SIP profile registration lost if the profile is disabled during IAP migration
-  </defect>
-  
- <defect number="PDEF122840" title="Error in SIPClient library - Native SIP stack" revision="33">
-    Defect fixes:
-    PDEF122840  Error in SIPClient library - Native SIP stack
-  </defect>
-  
-   <defect number="PDEF123081" title="PTT call doesn't resume if network coverage is lost for long time" revision="32">
-    Defect fixes:
-    PDEF123081  PTT call doesn't resume if network coverage is lost for long time
-  </defect>
-  
- <defect number="DEF121369" title="Registration with SNAP does not work when startup in offline mode" revision="31">
-    Defect fixes:
-    DEF121369  Registration with SNAP does not work when startup in offline mode
-  </defect>
- 
- <defect number="PDEF121899" title="SIPDIGEST.DLL dependency on IMUT.DLL should be broken" revision="30">
-    Defect fixes:
-    PDEF121899  SIPDIGEST.DLL dependency on IMUT.DLL should be broken
-  </defect>
-  
-  <defect number="DEF121209" title="App using SIP gets EProfileDeregistered in network lost case too early" revision="29">
-    Defect fixes:
-    DEF121209  App using SIP gets EProfileDeregistered in network lost case too early
-  </defect>
- 
- <defect number="DEF121455 " title="Miscellaneous(copyright, Cat F) errros in Sample App and example plugins of SIP" revision="28">
-    Defect fixes:
-    DEF121455  Miscellaneous(copyright, Cat F) errros in Sample App and example plugins of SIP
-  </defect>
-  
-  <defect number=" DEF118609" title="SPPR_PERF: SIP Server crashes under IPC attack" revision="27">
-    Defect fixes:
-    DEF118609 SPPR_PERF: SIP Server crashes under IPC attack 
-  </defect>
-
- <defect number=" DEF118927" title=" Connection needed prompt looped when using GPRS access point from Sip Settings  " revision="26">
-    Defect fixes:
-    DEF118927 "Connection needed" prompt looped when using GPRS access point from Sip Settings 
-  </defect>
-  
-  <defect number=" PDEF119150" title=" SIP Server crashes after 423 response to REGISTER  " revision="25">
-    Defect fixes:
-    PDEF119150 SIP Server crashes after 423 response to REGISTER
-  </defect>
-  
- <defect number=" DEF118608" title=" Phone does not answer proxy authentication challenge when making call  " revision="24">
-    Defect fixes:
-    DEF118608 Phone does not answer proxy authentication challenge when making call
-  </defect>
-  
-<defect number=" PDEF117335" title=" SIP Profile parameter KSIPDigestPassword must be write-only  " revision="23">
-    Defect fixes:
-    PDEF117335 SIP Profile parameter KSIPDigestPassword must be write-only
-  </defect>
-  
-  <defect number=" PDEF119071" title=" SipServer crashes with certain sequence of answers to INVITE  " revision="22">
-    Defect fixes:
-    PDEF119071 SipServer crashes with certain sequence of answers to INVITE
-	</defect>
-  
-  <defect number=" DEF117243" title=" Two SIP profiles, registering the second SIP profile fails  " revision="21">
-    Defect fixes:
-    DEF117243  Two SIP profiles, registering the second SIP profile fails
-  </defect>
-  
- <defect number=" PDEF118401" title=" Incorrect state transition in SIP Connection Mgr after system state event  " revision="20">
-    Defect fixes:
-    PDEF118401 Incorrect state transition in SIP Connection Mgr after system state event
-  </defect>
-
-<defect number=" PDEF118452" title=" Klocwork issues, NULL pointer can be used in release build mm-protocols_sip_com  " revision="19">
-    Defect fixes:
-    PDEF118452 Klocwork issues, NULL pointer can be used in release build mm-protocols_sip_com 
-  </defect>
-
-<defect number=" DEF116133" title=" DEF116133  Cloning empty sdp document crashes " revision="18">
-    Defect fixes:
-    DEF116133 Cloning empty sdp document crashes
-  </defect>
-
-<defect number=" PDEF115951" title=" SIP should accept Allow-header even if it ends with a comma (Allow: INVITE,)  " revision="17">
-    Defect fixes:
-    PDEF115951 SIP should accept Allow-header even if it ends with a comma (Allow: INVITE,)  
-  </defect>
-
-<defect number=" DEF115781" title=" GPRS connection not dropped when roaming from WLAN to GPRS to WLAN " revision="16">
-    Defect fixes:
-    DEF115781 GPRS connection not dropped when roaming from WLAN to GPRS to WLAN 
-  </defect>
-
-<defect number=" DEF115806" title=" Phone doesn't register through other APs in SNAP if fails with first AP " revision="15">
-    Defect fixes:
-    DEF115806 Phone doesn't register through other APs in SNAP if fails with first AP 
-  </defect>
-
-<defect number="PDEF115370" title=" Accept-Encoding-header with an empty value is rejected " revision="14">
-    Defect fixes:
-     PDEF115370 Accept-Encoding-header with an empty value is rejected 
-     PDEF115371  Profile gets unregistered, if no answer to PUBLISH or SUBSCRIBE
-     PDEF115372  Handling of 200 Ok for REGISTER from Ericsson IMS failed
-  </defect>
-
-<defect number="PDEF114883" title=" Backup/restore from PC suite not working " revision="13">
-    Defect fixes:
-     PDEF114883 Backup/restore from PC suite not working 
-     DEF113041 WLAN not disconnected when disconnecting from Broadvoice SIP service 
-  </defect>
-
-<defect number="DEF112885" title=" SIP profile registration status not up-to-date after roaming between APs " revision="12">
-    Defect fixes:
-     DEF112885 SIP profile registration status not up-to-date after roaming   
-     between APs 
-     DEF112603 Setting IP Differentiated Services Field changes the source port    
-     of SIP messages 
-  </defect>
-
-<defect number="DEF112830" title=" Enabling SIP profile with a SNAP works only once " revision="11">
-    Defect fixes:
-    DEF112830 Enabling SIP profile with a SNAP works only once 
-  </defect>
-
-  <defect number="DEF112756" title="SIP stack and SIP Client Resolver central repositories are not backed up" revision="10">
-    Defect fixes:
-    DEF112756 SIP stack and SIP Client Resolver central repositories are not backed up
-  </defect>
-
-  <defect number="DEF111902" title="PDP Context is not dropped when switching from 'Always on' to 'When needed'" revision="09">
-    Defect fixes:
-    DEF111902 PDP Context is not dropped when switching from 'Always on' to 'When needed'
-  </defect>
-  
-  <defect number="DEF110809" title="ALR does not work when no IAPs available in SNAP" revision="08">
-    Defect fixes:
-    DEF110809 ALR does not work when no IAPs available in SNAP
-	DEF111014 SIP parameter transport=TLS to some SIPS-URIs
-	DEF111868 Filiename policy warnings in SIP HL APIs and RTP components
-  </defect>
-  
-  <defect number="DEF110636" title="Warnings generated with checksource build" revision="07">
-    Defect fixes:
-    DEF110636 Warnings generated with checksource build
-	DEF110816 Phone places "nat_traversal_required" to From field on MO call
-	DEF110810 SIP stack allows sips uri to be set to Contact header while tls is not being use
-  </defect>
-  
-  <preq number="1737" title="SIP enhancement phase 3" revision="006">
-  Added Note for the following preq:
-  Oghma,GT0362,MS3.3,DS.676 SIP enhancements phase 3
-  </preq>
-  
-  <preq number="1737" title="SIP enhancement phase 3" revision="005">
-  Added Note for the following preq:
-  The Preq is 1737 MS3.2 submission
-  </preq>
-  
-  <defect number="DEF108003" title="Warnings generated with checksource build" revision="004">
-  Added Note for the following defects:
-	DEF108003 Warnings generated with checksource build
-  </defect>
-  
-  <defect number="PDEF106564" title="Missing IM Tags in SIP Component" revision="003">
-    Added Note for the following defects:
-    PDEF106564 Missing IM Tags in SIP Component
-    DEF106980 Upgrade the handling of String Tables
-  </defect>
-
-  <defect number="DEF106980" title="Upgrade the handling of String Tables" revision="002">
-    Added Note for the following defects:
-    PDEF106564 Missing IM Tags in SIP Component
-    DEF106980 Upgrade the handling of String Tables
-  </defect>
-
-  <defect number="DEF106289" title="Reference Doumentation for SIP_COM component missing in SOSlib" revision="001">
-    Reference Doumentation for SIP_COM component missing in SOSlib
-  </defect>
-</relnotes>
--- a/realtimenetprots/sipfw/ProfileAgent/AlrMonitor/src/sipalrsnapmonitor.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/AlrMonitor/src/sipalrsnapmonitor.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -489,8 +489,8 @@
 void CSipAlrSnapMonitor::NotifyInitializedObservers( 
     TUint32 aIapId,
     MSipAlrObserver::TEvent aEvent )
-	{
-	for ( TInt i = 0; i < iObservers.Count(); i++ )
+	{	
+	for (TInt i = iObservers.Count() - 1; i >= 0; --i) 
 		{
 		if ( iObservers[i].iInitialEventDone )
 			{
@@ -508,7 +508,7 @@
 //
 void CSipAlrSnapMonitor::NotifyNewObservers( TUint32 aIapId )
 	{
-	for ( TInt i = 0; i < iObservers.Count(); i++ )
+	for ( TInt i = iObservers.Count() - 1; i >= 0; --i )
 		{
 		if ( !iObservers[i].iInitialEventDone )
 			{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,198 @@
+// Copyright (c) 2007-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:
+// Name        : sipapnconfigurationhandler.h
+// Part of     : SIP Profile Server
+// implementation
+// Version     : 1.0
+//
+
+#ifndef __CSIPAPNCONFIGURATIONHANDLER_H__
+#define __CSIPAPNCONFIGURATIONHANDLER_H__
+
+// INCLUDES
+#include <etelpckt.h>
+#include <es_enum.h>
+#include <es_enum_partner.h>
+#include "sipapnmanager.h"
+
+// CONSTANTS
+const TInt KSecondaryApnMaxRetryCount = 100;
+
+// FORWARD DECLARATIONS
+class CCommsDatabase;
+namespace CommsDat
+    {
+    class CCDRecordBase;
+    }
+
+// CLASS DEFINITION sipapnconfigurationhandler.h
+/**
+ *
+ */
+class CSIPApnConfigurationHandler : public CActive
+	{
+	public:	// Constructors and destructor
+	
+	    enum TSipApnMonitoringState
+	        {
+	        EMonitoringIdle,
+	        EMonitoringConnection,
+	        EMonitoringDatabase
+	        };
+
+		/**
+		 * Static constructor.
+		 *
+		 * @return An initialized instance of this class.
+		 */
+		static CSIPApnConfigurationHandler* NewL( MSIPApnChangeObserver& aObserver,
+                                                        TUint32 aIapId);
+		
+		/**
+		 * Static constructor.
+		 *
+		 * @return An initialized instance of this class.
+		 */
+		static CSIPApnConfigurationHandler* NewLC( MSIPApnChangeObserver& aObserver, 
+                                                        TUint32 aIapId);
+
+		/// Destructor
+		~CSIPApnConfigurationHandler();
+		
+	public:
+	    
+	    /**
+	    * Change APN of specified IAP. If async change is allowed, change
+	    * may be done later if it was not possible at the moment. Once apn
+	    * is changed, observer is notified about change.
+	    */
+	    void SetApnL( const TDesC8& aApn,
+	                  TBool aUseSecureAuthentication,
+	                  TBool aAllowAsync );
+	                   
+	    TBool IsPrimaryApnUsed();
+	    
+		TBool HasPendingTasks() const;
+		
+        TUint32 HandlerIapId() const;
+        
+        TBool IsFailed() const;
+        
+        void SetFailed(TBool aIsFailed, TBool aIsFatalFailure );
+        
+        void UpdateApnL( TBool aIsPrimaryApn, const TDesC8& aApn );
+
+	protected: // From CActive
+
+		void DoCancel();
+		void RunL();
+		TInt RunError( TInt aError );
+		
+    private:
+    
+        TBool IsInUseL( TConnectionInfo& aConnectionInfo );
+
+        void StartMonitoringConnectionL( TConnectionInfo& aConnectionInfo );
+        
+        void WatchConnectionStatusChange();
+        
+        void WatchDatabaseStatusChangeL( TUint32 aIapId );
+        
+        TBool ApnChangeNeededL( const TDesC8& aApn );
+        
+        TBool ChangeApnIfNotInUseL( TBool aAllowAsync = ETrue );
+        
+        TBool IssueApnChangeL( TUint32 aIapId, 
+                               const TDesC8& aApn, 
+                               TBool aUseSecureAuthentication,
+                               TBool aAllowAsync = ETrue );
+        
+        void ChangeApnL( const TDesC8& aApn, 
+                         TBool aUseSecureAuthentication );
+        
+        TBool ClearProtectedRecord( CommsDat::CCDRecordBase& aRecord );
+        
+        void SetMonitoringState( TSipApnMonitoringState aMonitoringState );
+        
+        TSipApnMonitoringState MonitoringState() const;
+        
+        void ConnectionMonitoringCompletedL( TInt aError );
+        
+        void DatabaseMonitoringCompletedL( TInt aError );
+        
+        void SendApnChangedNotificationL( const TDesC8& aApn, TInt aError = KErrNone );
+        
+        TDesC8& PrimaryApn();
+        
+        TDesC8& SecondaryApn();
+        
+        /**
+        * Reads the APN of specified IAP.
+        * @param aIapId IAP id
+        * @return APN or NULL if not found. Ownership is transferred.
+        */
+        HBufC8* ReadCurrentApnL();
+        
+
+	private: // Constructors
+
+		/// Constructor
+		CSIPApnConfigurationHandler( MSIPApnChangeObserver& aObserver,
+                                                            TUint32 aIapId);
+
+		/// 2nd phase constructor
+		void ConstructL();
+
+	private: // Data
+	
+		MSIPApnChangeObserver& iObserver;
+	    
+	    TSipApnMonitoringState iMonitoringState;
+
+		RSocketServ iSocketSrv;
+		
+		RConnection iConnection;
+		
+		TPckgBuf<TConnectionInfo> iConnectionInfo;
+        
+        TNifProgressBuf iProgress;
+        
+        HBufC8* iApnProposal;
+        
+        TUint32 iIapId;
+        
+        CCommsDatabase* iCommsDatabase;
+        
+        TInt iMonitoringRetryCount;
+        
+        HBufC8* iCurrentApn;
+        
+        TBool iApnUseSecureAuthProposal;
+        
+        TBool iIsFailed;
+        
+        TBool iIsFatalFailure;
+        
+        HBufC8* iPrimaryApn;
+        HBufC8* iSecondaryApn;
+        
+#ifdef CPPUNIT_TEST	
+	    friend class CSIPApnManagerTest;
+	    friend class CSIPApnManager;
+#endif
+	
+	};
+
+#endif // __CSIPAPNCONFIGURATIONHANDLER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnmanager.h	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,101 @@
+// Copyright (c) 2007-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:
+// Name        : sipapnmanager.h
+// Part of     : SIP Profile Server
+// implementation
+// Version     : 1.0
+//
+
+
+#ifndef CSIPAPNMANAGER_H
+#define CSIPAPNMANAGER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CSIPApnConfigurationHandler;
+
+// OBSERVER
+class MSIPApnChangeObserver
+    {
+public:
+    /**
+    * Called when apn change completed successfully or failed so fatally
+    * that there's no change expected any further on that IAPId.
+    */
+    virtual void ApnChanged( const TDesC8& aApn, TUint32 aIapId, TInt aError ) = 0;
+    };
+
+// CLASS DEFINITION
+/**
+ * 
+ */
+class CSIPApnManager : public CBase
+	{
+	public: // Constructors and destructor
+
+		static CSIPApnManager* NewL( MSIPApnChangeObserver& aObserver );
+
+		~CSIPApnManager();
+
+    public: // New methods
+
+        // Update the cached primary or secondary APN
+        void UpdateApnL( TUint32 aIapId, TBool aIsPrimaryApn, const TDesC8& aApn );
+        
+        TBool IsFailed( TUint32 aIapId );
+        void SetFailed( TUint32 aIapId ,TBool aIsFailed, TBool aIsFatalFailure );
+
+        TBool IsPrimaryApnInUse( TUint32 aIapId );
+        
+		void WriteApnL( TUint32 aIapId, TBool aIsPrimaryApn, const TDesC8* aApn );
+		
+		TBool HasPendingTasks() const;
+		
+		/*
+		 * Checks whether the IAPId is ModemBearer
+		 */
+		TBool IsIapGPRSL( TUint32 aIapId );
+
+	private: // Constructors
+
+		CSIPApnManager( MSIPApnChangeObserver& aObserver );		
+    
+        void ConstructL();
+    
+    private:
+        
+        CSIPApnConfigurationHandler* FindIapIdHandler( TUint32 aIapId );
+ 
+        void SetApnL( const TDesC8& aApn, 
+                      TBool aUseSecureAuthentication, 
+                      TBool aAllowAsync,
+                      TUint32 aIapId);
+        
+        void CreateHandlerL( TUint32 aIapId );
+
+    private: // Data
+	
+	    MSIPApnChangeObserver&                     iObserver;
+	    RPointerArray<CSIPApnConfigurationHandler> iHandlers;
+	    TBool                                      iInitialApnChangeFailed;
+	    
+#ifdef CPPUNIT_TEST	
+	    friend class CSIPApnManagerTest;
+#endif
+
+	};
+
+#endif // CSIPAPNMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,903 @@
+// Copyright (c) 2007-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:
+// Name        : sipapnconfigurationhandler.cpp
+// Part of     : SIP Profile Server
+// implementation
+// Version     : 1.0
+//
+#include <commsdattypesv1_1.h>
+#include <commdb.h>
+#include <commsdat.h>
+#include "sipapnconfigurationhandler.h"
+#include "SipProfileLog.h"
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CSIPApnConfigurationHandler* CSIPApnConfigurationHandler::NewL( 
+    MSIPApnChangeObserver& aObserver, TUint32 aIapId)
+	{
+	CSIPApnConfigurationHandler* self = 
+	    CSIPApnConfigurationHandler::NewLC( aObserver, aIapId );
+	CleanupStack::Pop( self );
+	return self;
+	}
+	
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::NewLC
+// -----------------------------------------------------------------------------
+//
+CSIPApnConfigurationHandler* CSIPApnConfigurationHandler::NewLC( 
+    MSIPApnChangeObserver& aObserver, TUint32 aIapId)
+	{
+	CSIPApnConfigurationHandler* self = 
+	    new ( ELeave ) CSIPApnConfigurationHandler( aObserver, aIapId );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	return self;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::~CSIPApnConfigurationHandler
+// -----------------------------------------------------------------------------
+//
+CSIPApnConfigurationHandler::~CSIPApnConfigurationHandler()
+	{
+	PROFILE_DEBUG1( 
+	        "CSIPApnConfigurationHandler::~CSIPApnConfigurationHandler()" )
+	
+	Cancel();
+	iConnection.Close();
+	iSocketSrv.Close();
+	
+	delete iApnProposal;
+	delete iCurrentApn;
+	
+    delete iPrimaryApn;
+    delete iSecondaryApn;
+    
+	delete iCommsDatabase;
+	
+	PROFILE_DEBUG1( 
+	        "CSIPApnConfigurationHandler::~CSIPApnConfigurationHandler() exit" )
+	}
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::SetApnL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::SetApnL( 
+    const TDesC8& aApn, 
+    TBool aUseSecureAuthentication,
+    TBool aAllowAsync )
+    {
+    PROFILE_DEBUG6( 
+            "CSIPApnConfigurationHandler::SetApnL() apn", aApn )
+    
+    // Cancel if waiting for connection closure, will be re-issued if needed
+      Cancel();
+    
+    // Store current apn setting
+    HBufC8* apn = aApn.AllocL();
+    delete iApnProposal;
+    iApnProposal = apn;
+    iApnUseSecureAuthProposal = aUseSecureAuthentication;
+    
+    if ( !ApnChangeNeededL( *iApnProposal ) )
+        {
+        PROFILE_DEBUG1( 
+                "CSIPApnConfigurationHandler::SetApnL() apn already correct" )
+        
+        SendApnChangedNotificationL( *iApnProposal );
+        return;
+        }
+    
+    iMonitoringRetryCount = 0;
+    
+    ChangeApnIfNotInUseL( aAllowAsync );
+        
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::SetApnL() exit" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::IsPrimaryApnUsed
+// -----------------------------------------------------------------------------
+//
+TBool CSIPApnConfigurationHandler::IsPrimaryApnUsed()
+    {
+    return ( iCurrentApn && iCurrentApn->Compare( PrimaryApn() ) == 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::ReadCurrentApnL
+// -----------------------------------------------------------------------------
+//
+HBufC8* CSIPApnConfigurationHandler::ReadCurrentApnL()
+	{
+	HBufC8* apn(NULL);
+		
+	using namespace CommsDat;
+	
+	CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CleanupStack::PushL( db );
+    // Set any attributes if any
+    db->SetAttributeMask( ECDHidden ); 
+
+    // Create an iap record
+    CCDIAPRecord* iapRecord = 
+        static_cast<CCDIAPRecord*>( 
+            CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+    CleanupStack::PushL( iapRecord );
+    
+    iapRecord->SetRecordId( iIapId );
+
+    iapRecord->LoadL( *db );
+    
+    // serviceType identifies the servicing table to use
+    CMDBField<TDesC>* serviceType = 
+        ( CMDBField<TDesC>* )iapRecord->GetFieldByIdL( KCDTIdIAPServiceType );
+    
+    __ASSERT_ALWAYS( serviceType && !serviceType->IsNull(), 
+                     User::Leave( KErrNotFound ) );
+	// Only this service type has APN in the service record
+    if ( TPtrC( KCDTypeNameOutgoingWCDMA ).Compare( *serviceType ) == 0 )
+        {
+        PROFILE_DEBUG1(  
+        "CSIPApnConfigurationHandler::ReadCurrentApnL(), wcdma service" )
+        
+        // iapRecord->iService field is a link to the servicing table. It tells
+        // which record to use from the table.
+        iapRecord->iService.LoadL( *db );
+        
+        if ( !iapRecord->iService.iLinkedRecord )
+            {
+            PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::ReadCurrentApnL(), creating linked" )
+        
+            // Ownership of created record is transferred
+            iapRecord->iService.iLinkedRecord = 
+                static_cast<CCDOutgoingGprsRecord*>(
+                    CCDRecordBase::RecordFactoryL( KCDTIdOutgoingGprsRecord ) );
+            iapRecord->iService.iLinkedRecord->SetRecordId( iapRecord->iService );
+            
+            iapRecord->iService.iLinkedRecord->LoadL( *db );
+            }
+            
+        PROFILE_DEBUG1( 
+        "CSIPApnConfigurationHandler::ReadCurrentApnL(), linked service loaded" )
+        
+        CCDOutgoingGprsRecord* serviceRecord = 
+        static_cast<CCDOutgoingGprsRecord*>( iapRecord->iService.iLinkedRecord ); 
+
+        TDesC& currApn = serviceRecord->iGPRSAPN.GetL();
+        PROFILE_DEBUG6( 
+        	"CSIPApnConfigurationHandler::ReadCurrentApnL(), current apn",
+        	currApn );
+
+		apn = HBufC8::NewL( currApn.Length() );
+		apn->Des().Copy( currApn );
+		
+		delete iCurrentApn;
+		iCurrentApn = NULL;
+		iCurrentApn = apn->AllocL();
+        }
+    
+    db->ClearAttributeMask( ECDHidden );
+    
+    CleanupStack::PopAndDestroy( iapRecord );
+    CleanupStack::PopAndDestroy( db );
+    
+    return apn;
+	}
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::HasPendingTasks
+// -----------------------------------------------------------------------------
+//
+TBool CSIPApnConfigurationHandler::HasPendingTasks() const
+    {
+    return MonitoringState() != EMonitoringIdle;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::DoCancel()
+	{	
+	TSipApnMonitoringState currentState = MonitoringState();
+
+	PROFILE_DEBUG3( 
+	        "CSIPApnConfigurationHandler::DoCancel() state", currentState );
+	
+	if ( currentState == EMonitoringConnection )
+	    {
+	    iConnection.CancelProgressNotification();
+	    }
+	else if ( currentState == EMonitoringDatabase )
+	    {
+	    if ( iCommsDatabase )
+	        {
+	        iCommsDatabase->CancelRequestNotification();
+	        }
+	    }
+	else
+	    {
+	    // NOP
+	    }
+	
+	SetMonitoringState( EMonitoringIdle );
+	    
+	PROFILE_DEBUG1( 
+	        "CSIPApnConfigurationHandler::DoCancel() exit" )
+	}
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::RunL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::RunL()
+	{	
+	TInt error = iStatus.Int();
+	
+	TSipApnMonitoringState currentState = MonitoringState();
+	
+	PROFILE_DEBUG3( 
+	        "CSIPApnConfigurationHandler::RunL() err", error );
+	PROFILE_DEBUG3( 
+	        "CSIPApnConfigurationHandler::RunL() state", currentState );
+	
+	SetMonitoringState( EMonitoringIdle ); // Clear current state
+	    	
+	if ( currentState == EMonitoringConnection )
+	    {
+	    ConnectionMonitoringCompletedL( error );
+	    }
+	else if ( currentState == EMonitoringDatabase )
+	    {
+	    DatabaseMonitoringCompletedL( error );
+	    }
+	    
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::RunL() exit" )
+	}
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CSIPApnConfigurationHandler::RunError( TInt aError )
+    {
+    PROFILE_DEBUG3( 
+            "CSIPApnConfigurationHandler::RunError() err", aError );
+    
+    if ( aError != KErrNoMemory && aError != KErrNone )
+        {
+        iObserver.ApnChanged( *iApnProposal, iIapId, aError );
+        aError = KErrNone;
+        }
+        
+    return aError;
+    }
+    
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::CSIPApnConfigurationHandler
+// -----------------------------------------------------------------------------
+//
+CSIPApnConfigurationHandler::CSIPApnConfigurationHandler( 
+    MSIPApnChangeObserver& aObserver, TUint32 aIapId ) : 
+    CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver ),
+    iMonitoringState( EMonitoringIdle )
+	{
+	CActiveScheduler::Add( this );
+	iIapId = aIapId;
+	}
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::ConstructL()
+	{	
+	PROFILE_DEBUG1( 
+	        "CSIPApnConfigurationHandler::ConstructL()" )
+	
+	User::LeaveIfError( iSocketSrv.Connect() );
+	
+	PROFILE_DEBUG1( 
+	        "CSIPApnConfigurationHandler::ConstructL() exit" )
+	}
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::IsInUseL
+// -----------------------------------------------------------------------------
+//
+TBool CSIPApnConfigurationHandler::IsInUseL( TConnectionInfo& aConnectionInfo )
+    {
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::IsInUseL()" )
+    
+    TBool inUse( EFalse );
+    RConnection rcon;
+    User::LeaveIfError( rcon.Open( iSocketSrv ) );
+    CleanupClosePushL( rcon );
+    
+    TUint activeCount( 0 );
+    User::LeaveIfError( rcon.EnumerateConnections( activeCount ) );
+    
+    if ( activeCount > 0  )
+        {
+        // Indexing is unordinary
+        for( TUint i = 1; i <= activeCount && !inUse; i++ )
+            {
+            TPckgBuf<TConnectionInfoV2> connectionInfo;
+            User::LeaveIfError( rcon.GetConnectionInfo( i, connectionInfo ) );
+            
+            if ( connectionInfo().iIapId == iIapId )
+                {
+                inUse = ETrue;
+                aConnectionInfo = connectionInfo();
+                }
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( &rcon );
+    
+    PROFILE_DEBUG3( 
+            "CSIPApnConfigurationHandler::IsInUseL() inuse", inUse )
+    
+    return inUse;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::StartMonitoringConnectionL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::StartMonitoringConnectionL( 
+    TConnectionInfo& aConnectionInfo )
+    {
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::StartMonitoringConnectionL()" )
+    
+    __ASSERT_ALWAYS( !IsActive(), User::Leave( KErrInUse ) );
+    
+    if ( iConnection.SubSessionHandle() )
+        {
+        PROFILE_DEBUG1( 
+        "CSIPApnConfigurationHandler::   close existing connection" )
+        
+        iConnection.Close();
+        }
+     
+    iConnectionInfo = aConnectionInfo;   
+    
+    User::LeaveIfError( iConnection.Open( iSocketSrv ) );    
+    
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::   attaching" )
+    
+    User::LeaveIfError( 
+        iConnection.Attach( iConnectionInfo, RConnection::EAttachTypeMonitor ) );
+    
+    WatchConnectionStatusChange();
+    
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::StartMonitoringConnectionL() exit" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::WatchConnectionStatusChange
+// -----------------------------------------------------------------------------
+//	
+void CSIPApnConfigurationHandler::WatchConnectionStatusChange()
+    {
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::WatchConnectionStatusChange()" )
+    
+    Cancel();
+    
+    iConnection.ProgressNotification( iProgress, iStatus, KConnectionClosed );
+    SetActive();
+        
+    SetMonitoringState( EMonitoringConnection );
+    
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::WatchConnectionStatusChange(), exit" )
+    }
+    
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL
+// -----------------------------------------------------------------------------
+//	
+void CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL( TUint32 aIapId )
+    {
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL()" )
+    
+    Cancel();
+    
+    if ( !iCommsDatabase )
+        {
+        PROFILE_DEBUG1( 
+                "CSIPApnConfigurationHandler::   create commsdb" )
+        iCommsDatabase = CCommsDatabase::NewL();
+        }
+    
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::   request notification" )
+    
+    // Start monitoring for db events, there will be lots of them pouring in
+    // as there's no filtering feature. We are interested only in
+    // unlocked events.    
+    User::LeaveIfError( iCommsDatabase->RequestNotification( iStatus ) );
+    
+    SetActive();
+    
+    iIapId = aIapId;
+        
+    SetMonitoringState( EMonitoringDatabase );
+    
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL(), exit" )
+    }
+        
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::ApnChangeNeededL
+// -----------------------------------------------------------------------------
+//
+TBool CSIPApnConfigurationHandler::ApnChangeNeededL( const TDesC8& aApn )
+    {
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::ApnChangeNeededL()" )
+
+ 	TBool apnChangeNeeded( EFalse );
+ 	HBufC8* currentApn = ReadCurrentApnL();
+
+	if ( currentApn && currentApn->Compare( aApn ) != 0 )
+        {
+        // Apn is not the same as wanted
+        apnChangeNeeded = ETrue;
+        }
+
+	delete currentApn;
+
+	PROFILE_DEBUG3( 
+	        "CSIPApnConfigurationHandler::ApnChangeNeededL(), apnChangeNeeded",
+	        apnChangeNeeded )
+    return apnChangeNeeded;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::ChangeApnIfNotInUseL
+// -----------------------------------------------------------------------------
+//
+TBool CSIPApnConfigurationHandler::ChangeApnIfNotInUseL( TBool aAllowAsync )
+    {
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::ChangeApnIfNotInUseL()" )
+    
+    TBool apnChanged( EFalse );
+    
+    TConnectionInfo connectionInfo;
+    if ( IsInUseL( connectionInfo ) )
+        {
+        // If iap is in use, apn cannot be changed until everyone has stopped
+        // using it
+        __ASSERT_ALWAYS( aAllowAsync, User::Leave( KErrInUse ) );
+        
+        StartMonitoringConnectionL( connectionInfo );
+        }
+    else
+        {
+        apnChanged = IssueApnChangeL(
+                iIapId, *iApnProposal, iApnUseSecureAuthProposal, aAllowAsync );
+        }
+        
+    PROFILE_DEBUG3( 
+            "CSIPApnConfigurationHandler::ChangeApnIfNotInUseL(), apnChanged",
+            apnChanged )
+    return apnChanged;
+    }
+    
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::IssueApnChangeL
+// -----------------------------------------------------------------------------
+//
+TBool CSIPApnConfigurationHandler::IssueApnChangeL( 
+    TUint32 aIapId, 
+    const TDesC8& aApn,
+    TBool aUseSecureAuthentication,
+    TBool aAllowAsync )
+    {
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::IssueApnChangeL()" )
+    
+    TBool apnChanged( EFalse );
+    if(aIapId == iIapId)
+        {
+        TRAPD( err, ChangeApnL( aApn, aUseSecureAuthentication ) );
+        if ( err == KErrLocked || err == KErrAccessDenied )
+            {
+            // Database transaction lock may cause errors if some other client is
+            // accessing the same record at the same time. In such case, start
+            // monitoring for database events and retry apn changing at each
+            // unlock/rollback event.
+        
+            __ASSERT_ALWAYS( aAllowAsync, User::Leave( KErrInUse ) );
+        
+            WatchDatabaseStatusChangeL( iIapId );
+            }
+        else 
+            {
+            User::LeaveIfError( err );
+            apnChanged = ETrue;
+            }
+        }
+       
+    PROFILE_DEBUG3( 
+            "CSIPApnConfigurationHandler::IssueApnChangeL(), apnChanged",
+            apnChanged )
+    return apnChanged;
+    }
+    
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::ChangeApnL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::ChangeApnL( 
+    const TDesC8& aApn,
+    TBool aUseSecureAuthentication )
+    {
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::ChangeApnL()" )
+    
+   	using namespace CommsDat;
+	
+	CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CleanupStack::PushL( db );
+    // Set attributes so that also protected iaps can be accessed
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite ); 
+
+    // Create an iap record
+    CCDIAPRecord* iapRecord = 
+        static_cast<CCDIAPRecord*>( 
+            CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+    CleanupStack::PushL( iapRecord );
+    
+    iapRecord->SetRecordId( iIapId );
+    
+    TBool clearedProtectedIap = ClearProtectedRecord( *iapRecord );
+
+    iapRecord->LoadL( *db );
+    
+    iapRecord->iService.LoadL( *db );
+
+    if ( !iapRecord->iService.iLinkedRecord )
+        {
+        // Ownership of created record is transferred
+        iapRecord->iService.iLinkedRecord = 
+            static_cast<CCDOutgoingGprsRecord*>(
+                CCDRecordBase::RecordFactoryL( KCDTIdOutgoingGprsRecord ) );
+
+        iapRecord->iService.iLinkedRecord->SetRecordId( iapRecord->iService );        
+        iapRecord->iService.iLinkedRecord->LoadL( *db );
+        }
+        
+    PROFILE_DEBUG1( 
+    	"CSIPApnConfigurationHandler::ChangeApnL linked service loaded" )
+
+    CCDOutgoingGprsRecord* serviceRecord = 
+    static_cast<CCDOutgoingGprsRecord*>( iapRecord->iService.iLinkedRecord );  
+    
+    TBool clearedProtectedService = ClearProtectedRecord( *serviceRecord );
+        
+    PROFILE_DEBUG6( 
+            "CSIPApnConfigurationHandler::ChangeApnL() curr apn",
+            serviceRecord->iGPRSAPN.GetL() );
+
+    HBufC* apn = HBufC::NewLC( aApn.Length() );
+    apn->Des().Copy( aApn );
+    serviceRecord->iGPRSAPN.SetL( *apn );
+    CleanupStack::PopAndDestroy( apn );
+    
+    PROFILE_DEBUG3( 
+            "CSIPApnConfigurationHandler::ChangeApnL() curr security",
+            serviceRecord->iGPRSDisablePlainTextAuth );
+    
+    // Set CHAP/PAP (CHAP is enabled if plain text auth is disabled) 
+    serviceRecord->iGPRSDisablePlainTextAuth = aUseSecureAuthentication;
+
+    PROFILE_DEBUG3( 
+            "CSIPApnConfigurationHandler::ChangeApnL() new security",
+            aUseSecureAuthentication )
+	                
+    serviceRecord->ModifyL( *db ); 
+    
+    if ( clearedProtectedIap )
+        {
+        // Set protection back
+        iapRecord->SetAttributes( ECDProtectedWrite );
+        iapRecord->ModifyL( *db );
+        }
+    
+    if ( clearedProtectedService )
+        {
+        // Set protection back
+        serviceRecord->SetAttributes( ECDProtectedWrite );
+        serviceRecord->ModifyL( *db );
+        }
+        
+    db->ClearAttributeMask( ECDHidden | ECDProtectedWrite );
+    
+    CleanupStack::PopAndDestroy( iapRecord );
+    CleanupStack::PopAndDestroy( db );
+    
+    SendApnChangedNotificationL( aApn );
+    
+    PROFILE_DEBUG1( 
+            "CSIPApnConfigurationHandler::ChangeApnL(), exit" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::ClearProtectedRecord
+// -----------------------------------------------------------------------------
+//
+TBool CSIPApnConfigurationHandler::ClearProtectedRecord( 
+    CommsDat::CCDRecordBase& aRecord )
+    {
+    TBool cleared( EFalse );
+    if ( aRecord.IsSetAttribute( CommsDat::ECDProtectedWrite ) )
+        {
+        aRecord.ClearAttributes( CommsDat::ECDProtectedWrite );
+        cleared = ETrue;
+        }
+    return cleared;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::SetMonitoringState
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::SetMonitoringState( 
+    TSipApnMonitoringState aMonitoringState )
+    {
+   	PROFILE_DEBUG3( 
+   	        "CSIPApnConfigurationHandler::SetMonitoringState, state",
+   	        aMonitoringState );
+    iMonitoringState = aMonitoringState;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::MonitoringState
+// -----------------------------------------------------------------------------
+//
+CSIPApnConfigurationHandler::TSipApnMonitoringState 
+    CSIPApnConfigurationHandler::MonitoringState() const
+    {
+    return iMonitoringState;
+    }
+    
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::ConnectionMonitoringCompletedL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::ConnectionMonitoringCompletedL( TInt aError )
+    {
+	PROFILE_DEBUG3( 
+	        "CSIPApnConfigurationHandler::   progress.err",
+	        iProgress().iError );
+	PROFILE_DEBUG3( 
+	        "CSIPApnConfigurationHandler::   progress.stage",
+	        iProgress().iStage );
+	                
+    if ( !aError )
+        {
+    	if ( iProgress().iStage == KConnectionClosed ||
+    	     iProgress().iStage == KLinkLayerClosed ||
+    	     iProgress().iStage == KConnectionFailure )
+            {
+            // Changing is now possible
+            IssueApnChangeL( 
+                iConnectionInfo().iIapId, *iApnProposal, iApnUseSecureAuthProposal );
+            }
+        else if ( !iProgress().iError )
+            {
+            // Changing not yet possible. Request further notifications
+            // from RConnection only if possible
+            WatchConnectionStatusChange();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::DatabaseMonitoringCompletedL
+// Only interested about unlock and rollback events. When such occur, it might
+// be possible that other client has released transaction lock and we can
+// finally modify apn. Note: cancelling notifications may complete with
+// KErrCancel, in that case we don't want to reissue notifications.
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::DatabaseMonitoringCompletedL( TInt aError )
+    {
+    TBool apnChanged( EFalse ); 
+    if ( aError == KErrCancel )
+        {
+        return;
+        }
+        
+    if ( aError == RDbNotifier::EUnlock || 
+         aError == RDbNotifier::ERollback || 
+         aError == RDbNotifier::EClose )
+        {
+        // Changing may be now possible, if not, db notifications or connection
+        // monitoring is re-enabled inside following method
+        apnChanged = ChangeApnIfNotInUseL();
+        }
+    else
+        {
+        WatchDatabaseStatusChangeL( iIapId );
+        }
+    
+    // Have some safety limit for monitoring as it's not guaranteed that
+    // db lock is ever released -> avoid unnecessary battery consumption    
+    if ( !apnChanged )
+        {
+        iMonitoringRetryCount++;
+        PROFILE_DEBUG3( 
+                "DatabaseMonitoringCompletedL::   retrycount",
+                iMonitoringRetryCount );
+        
+        if ( iMonitoringRetryCount > KSecondaryApnMaxRetryCount )
+            {
+            PROFILE_DEBUG1( 
+                "CSIPApnConfigurationHandler::   max retries reached!" )
+            Cancel();
+            
+            User::Leave( KErrAbort );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::SendApnChangedNotificationL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::SendApnChangedNotificationL( 
+    const TDesC8& aNewApn, 
+    TInt aError )
+    {
+    if ( !IsPrimaryApnUsed() )
+        {
+        HBufC8* currentApn = aNewApn.AllocL();
+        delete iCurrentApn;
+        iCurrentApn = NULL;
+        iCurrentApn = currentApn;
+        
+        iObserver.ApnChanged( *iCurrentApn, iIapId, aError );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::IsFailed
+// -----------------------------------------------------------------------------
+//
+TBool CSIPApnConfigurationHandler::IsFailed() const
+    {
+    return iIsFailed;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::IsFailed
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::SetFailed( TBool aIsFailed, TBool aIsFatalFailure )
+    {
+    PROFILE_DEBUG4( 
+                "CSIPApnConfigurationHandler::SetFailed() (failed, fatal)",
+                aIsFailed, aIsFatalFailure )
+        PROFILE_DEBUG4( 
+                "CSIPApnConfigurationHandler::SetFailed() (curr failed, curr fatal)",
+                iIsFailed, iIsFatalFailure )
+                        
+        if ( iIsFailed != aIsFailed )
+            {
+            TInt err( KErrNone );
+            if ( aIsFailed )
+                {
+                TRAP( err, SetApnL( 
+                    SecondaryApn(), ETrue, ETrue) );
+                }
+            else if ( !iIsFatalFailure )
+                {
+                TRAP( err, SetApnL( 
+                    PrimaryApn(), EFalse, ETrue) );
+                }
+            else
+                {
+                PROFILE_DEBUG1( 
+                        "CSIPApnConfigurationHandler::SetFailed(), ignored" )
+                
+                // State change is ignored as state change to "not-failed" was
+                // attempted while fatal error had occured earlier
+                aIsFailed = iIsFailed;
+                aIsFatalFailure = iIsFatalFailure;
+                }
+                
+            if ( err )
+                {
+                PROFILE_DEBUG3(  
+                "CSIPApnConfigurationHandler::SetFailed(), Setting apn failed, err", err )
+                }
+            }   
+        
+        iIsFailed = aIsFailed;
+        iIsFatalFailure = aIsFatalFailure;
+        }
+
+// ----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::PrimaryApn
+// ----------------------------------------------------------------------------
+//
+TDesC8& CSIPApnConfigurationHandler::PrimaryApn()
+    {
+    return *iPrimaryApn;
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::SecondaryApn
+// ----------------------------------------------------------------------------
+//
+TDesC8& CSIPApnConfigurationHandler::SecondaryApn()
+    {
+    return *iSecondaryApn;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::HandlerIapId
+// -----------------------------------------------------------------------------
+//
+TUint32 CSIPApnConfigurationHandler::HandlerIapId() const
+    {
+    return iIapId;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::UpdateApnL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::UpdateApnL( TBool aIsPrimaryApn, const TDesC8& aApn )
+    {
+PROFILE_DEBUG3( 
+            "CSIPApnConfigurationHandler::UpdateApnL isPrimary", aIsPrimaryApn )
+    PROFILE_DEBUG6( 
+            "CSIPApnConfigurationHandler::UpdateApnL apn", aApn )
+
+    HBufC8* newApn = aApn.AllocL();
+    if ( aIsPrimaryApn )
+        {
+        delete iPrimaryApn;
+        iPrimaryApn = newApn;
+        }
+    else
+        {
+        delete iSecondaryApn;
+        iSecondaryApn = newApn;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnmanager.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,244 @@
+// Copyright (c) 2007-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:
+// Name        : sipapnmanager.cpp
+// Part of     : SIP Profile Server
+// implementation
+// Version     : 1.0
+//
+
+#include <commsdattypesv1_1.h>
+#include <commsdat.h>
+#include <commdb.h>
+#include <f32file.h>
+#include "sipapnmanager.h"
+#include "SipProfileLog.h"
+#include "sipapnconfigurationhandler.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::NewL
+// ----------------------------------------------------------------------------
+//
+CSIPApnManager* CSIPApnManager::NewL( 
+    MSIPApnChangeObserver& aObserver )
+    {
+    CSIPApnManager* self = new (ELeave) CSIPApnManager( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::~CSIPApnManager
+// ----------------------------------------------------------------------------
+//
+CSIPApnManager::~CSIPApnManager()
+    {
+    iHandlers.ResetAndDestroy();
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::UpdateApnL
+// ----------------------------------------------------------------------------
+//	
+void CSIPApnManager::UpdateApnL( TUint32 aIapId, TBool aIsPrimaryApn, const TDesC8& aApn )
+	{
+    CSIPApnConfigurationHandler* handler = FindIapIdHandler( aIapId );
+    if (!handler)
+        {
+        CreateHandlerL(aIapId);
+        handler = FindIapIdHandler(aIapId);
+        }
+    
+        PROFILE_DEBUG1("CSIPApnManager::UpdateApnL(), handler exists")
+        handler->UpdateApnL( aIsPrimaryApn, aApn);
+	}
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::IsFailed
+// ----------------------------------------------------------------------------
+//    
+TBool CSIPApnManager::IsFailed( TUint32 aIapId )
+    {
+    CSIPApnConfigurationHandler* handler = FindIapIdHandler( aIapId );
+    return (handler && handler->IsFailed());
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::SetFailed
+// Setting back to "not-failed" state is allowed only if fatal failure has not
+// occured.
+// ----------------------------------------------------------------------------
+// 
+void CSIPApnManager::SetFailed( TUint32 aIapId ,TBool aIsFailed, TBool aIsFatalFailure )
+    {
+    CSIPApnConfigurationHandler* handler = FindIapIdHandler( aIapId );
+    if(handler)
+        {
+        handler->SetFailed( aIsFailed, aIsFatalFailure );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::IsPrimaryApnInUse
+// ----------------------------------------------------------------------------
+//
+TBool CSIPApnManager::IsPrimaryApnInUse( TUint32 aIapId )
+    {
+    CSIPApnConfigurationHandler* handler = FindIapIdHandler( aIapId );
+    return ( handler && handler->IsPrimaryApnUsed() );
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::WriteApnL
+// ----------------------------------------------------------------------------
+//
+void CSIPApnManager::WriteApnL( TUint32 aIapId, TBool aIsPrimaryApn, const TDesC8* aApn )
+	{
+	PROFILE_DEBUG3( "CSIPApnManager::WriteApnL isPrimary", aIsPrimaryApn )
+	TBool useSecureAuth = aIsPrimaryApn ? EFalse : ETrue;
+
+	CSIPApnConfigurationHandler* handler = FindIapIdHandler( aIapId );
+	    if (!handler)
+	        {
+	        CreateHandlerL(aIapId);
+	        handler = FindIapIdHandler(aIapId);
+	        }
+	    
+	    handler->SetApnL( *aApn, useSecureAuth, ETrue);
+	}
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::HasPendingTasks
+// ----------------------------------------------------------------------------
+//
+TBool CSIPApnManager::HasPendingTasks() const
+    {    
+    TInt count = iHandlers.Count();
+    PROFILE_DEBUG3( 
+            "CSIPApnManager::HasPendingTasks handler count", count )
+
+    for ( TInt i = 0; i < count; ++i )
+        {
+        if ( iHandlers[ i ]->HasPendingTasks() )
+            {
+            PROFILE_DEBUG1( 
+                    "CSIPApnManager::HasPendingTasks return ETrue" )
+            return ETrue;
+            }
+        }
+    PROFILE_DEBUG1( 
+            "CSIPApnManager::HasPendingTasks return EFalse" )
+    return EFalse;
+    }
+// ----------------------------------------------------------------------------
+// CSIPApnManager::CSIPApnManager
+// ----------------------------------------------------------------------------
+//
+CSIPApnManager::CSIPApnManager( MSIPApnChangeObserver& aObserver ) :
+    iObserver( aObserver )
+    {
+    }
+    
+// ----------------------------------------------------------------------------
+// CSIPApnManager::ConstructL
+// Read APNs from settings file but don't write to CommsDat yet. If IMS profile
+// has APNs, use them instead. APN is written to CommsDat when the operation
+// (register, deregister, update..) that caused IMS agent to be loaded, starts
+// (CSIPIMSProfileAgent::SelectInitialApnL).
+// ----------------------------------------------------------------------------
+//    
+void CSIPApnManager::ConstructL()
+    {
+    PROFILE_DEBUG1("CSIPApnManager::ConstructL()" )  
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::FindIapIdHandler
+// ----------------------------------------------------------------------------
+//
+CSIPApnConfigurationHandler* CSIPApnManager::FindIapIdHandler( TUint32 aIapId )
+    {
+    CSIPApnConfigurationHandler* handler = NULL;
+    TBool found(EFalse);
+    
+    for(TInt i =0; i<iHandlers.Count() && !found ; i++)
+        {
+        if (iHandlers[i]->HandlerIapId()== aIapId)
+            {
+            PROFILE_DEBUG3("CSIPApnManager::FindIapIdHandler, found handler for aIapId", aIapId )
+            found = ETrue;
+            handler = iHandlers[ i ];
+            }
+        }
+    
+    return handler;
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::CreateHandlerL
+// ----------------------------------------------------------------------------
+//
+void CSIPApnManager::CreateHandlerL( TUint32 aIapId )
+	{
+    PROFILE_DEBUG1( 
+            "CSIPApnManager::CreateHandlerL , enter" )
+    PROFILE_DEBUG3( 
+        "CSIPApnManager::CreateHandlerL for IapId", aIapId )
+
+    CSIPApnConfigurationHandler* Handler = 
+        CSIPApnConfigurationHandler::NewL( iObserver, aIapId);
+    CleanupStack::PushL( Handler );
+    iHandlers.AppendL( Handler );
+    CleanupStack::Pop( Handler );
+    PROFILE_DEBUG1( 
+              "CSIPApnManager::CreateHandlerL, exit" )
+	}
+
+// ----------------------------------------------------------------------------
+// CSIPApnManager::IsIapGPRSL
+// ----------------------------------------------------------------------------
+//
+TBool CSIPApnManager::IsIapGPRSL( TUint32 aIapId )
+    {
+    TBool isIapGPRS(EFalse);          
+    using namespace CommsDat;        
+    CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CleanupStack::PushL( db );
+    // Set any attributes if any
+    db->SetAttributeMask( ECDHidden );    
+    // Create an iap record
+    CCDIAPRecord* iapRecord = 
+            static_cast<CCDIAPRecord*>(
+                    CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+    CleanupStack::PushL( iapRecord );        
+    iapRecord->SetRecordId( aIapId );
+    iapRecord->LoadL( *db );  
+    TPtrC bearerType(iapRecord->iBearerType);
+    if(bearerType.CompareF(TPtrC(KCDTypeNameModemBearer)) == 0)
+        {
+        isIapGPRS = ETrue;
+        }
+    
+    db->ClearAttributeMask( ECDHidden );
+    
+    CleanupStack::PopAndDestroy( iapRecord );
+    CleanupStack::PopAndDestroy( db );
+    PROFILE_DEBUG3(
+                    "CSIPApnConfigurationHandler::IsIapGPRSL(),isIapGPRS", isIapGPRS )
+    return isIapGPRS;
+    }
+// End of File
--- a/realtimenetprots/sipfw/ProfileAgent/Client/Api/sipprofile.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Client/Api/sipprofile.h	Fri Apr 16 15:18:54 2010 +0300
@@ -185,6 +185,17 @@
 */
 const TUint32 KSIPServerAddress = 152;
 
+/** 
+* PrimaryAPN is of type TDesC8
+*/
+const TUint32 KPrimaryAPN = 20;
+
+/** 
+* SecondaryAPN is of type TDesC8
+*/
+const TUint32 KSecondaryAPN = 21;
+
+
 // CLASS DECLARATION
 /**
 * @publishedAll
--- a/realtimenetprots/sipfw/ProfileAgent/Client/Src/sipmanagedprofile.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Client/Src/sipmanagedprofile.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -224,6 +224,8 @@
 		case KSIPDigestPassword:
 		case KSIPHeaders:
 		case KSIPContactHeaderUser:
+        case KPrimaryAPN:
+        case KSecondaryAPN:
 			User::Leave(KErrNotFound);
 		case KSIPSnapId:
 			__ASSERT_ALWAYS((aVal>0),User::Leave(KErrArgument));
@@ -272,6 +274,8 @@
 		case KSIPContactHeaderUser:
 		case KSIPSoIpTOS:
 		case KSIPSnapId:
+        case KPrimaryAPN:
+        case KSecondaryAPN:
 			User::Leave(KErrNotFound);			
 		default:
 			iSIPProfile->SetExtensionParameterL(aParam, aVal);
@@ -313,6 +317,8 @@
 		case KSIPContactHeaderUser:
 		case KSIPSoIpTOS:	
 		case KSIPSnapId:
+        case KPrimaryAPN:
+        case KSecondaryAPN:
 		User::Leave(KErrNotFound);
 		default:
 			TBuf8<KParameterbufLength> buf;
@@ -358,6 +364,8 @@
 		case KSIPContactHeaderUser:
 		case KSIPSoIpTOS: 	
 		case KSIPSnapId:
+        case KPrimaryAPN:
+        case KSecondaryAPN:
 		User::Leave(KErrNotFound);
 		default:
 			iSIPProfile->SetExtensionParameterL(aParam, aVal);
--- a/realtimenetprots/sipfw/ProfileAgent/Client/Src/sipprofile.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Client/Src/sipprofile.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -313,6 +313,8 @@
 		case KSIPOutboundProxy:
 		case KSIPPrivateIdentity:
 		case KSIPSoIpTOS:
+		case KPrimaryAPN:
+		case KSecondaryAPN:
 			{
 			return KErrNotFound;
 			}
--- a/realtimenetprots/sipfw/ProfileAgent/Group/sipietfagent.mmp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Group/sipietfagent.mmp	Fri Apr 16 15:18:54 2010 +0300
@@ -60,6 +60,6 @@
 
 VENDORID 0x70000001
 
-CAPABILITY ProtServ NetworkServices ReadDeviceData
+CAPABILITY ProtServ NetworkServices ReadDeviceData WriteDeviceData
 
 SMPSAFE
--- a/realtimenetprots/sipfw/ProfileAgent/Group/sipimsagent.mmp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Group/sipimsagent.mmp	Fri Apr 16 15:18:54 2010 +0300
@@ -86,6 +86,6 @@
 
 VENDORID 0x70000001
 
-CAPABILITY ProtServ NetworkServices ReadDeviceData
+CAPABILITY ProtServ NetworkServices ReadDeviceData WriteDeviceData
 
 SMPSAFE
--- a/realtimenetprots/sipfw/ProfileAgent/Group/sipprofilefsm.mmp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Group/sipprofilefsm.mmp	Fri Apr 16 15:18:54 2010 +0300
@@ -58,6 +58,6 @@
 
 VENDORID 0x70000001
 
-CAPABILITY ProtServ NetworkServices ReadDeviceData
+CAPABILITY ProtServ NetworkServices ReadDeviceData WriteDeviceData
 
 SMPSAFE
--- a/realtimenetprots/sipfw/ProfileAgent/Group/sipprofileserver.mmp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Group/sipprofileserver.mmp	Fri Apr 16 15:18:54 2010 +0300
@@ -46,6 +46,10 @@
 SOURCE            sipalrmigrationcontroller.cpp
 SOURCE            sipalrmigrationobserverinfo.cpp
 
+SOURCEPATH        ../ApnManager/src
+SOURCE            sipapnmanager.cpp
+SOURCE            sipapnconfigurationhandler.cpp
+
 SOURCEPATH        ../Store/Src
 SOURCE            SIPProfileStorageBase.cpp
 SOURCE            SIPProfileStorageIndex.cpp
@@ -69,6 +73,7 @@
 USERINCLUDE       ../PluginMgr/Inc
 USERINCLUDE       ../Store/Inc
 USERINCLUDE       ../AlrMonitor/inc
+USERINCLUDE       ../ApnManager/inc
 
 MW_LAYER_SYSTEMINCLUDE
 
@@ -86,10 +91,13 @@
 LIBRARY           netmeta.lib
 LIBRARY           centralrepository.lib
 LIBRARY 	  cmmanager.lib
+LIBRARY           commsdat.lib 
+LIBRARY           featmgr.lib
+LIBRARY 	  commdb.lib
 
 VENDORID 0x70000001
 
-CAPABILITY ProtServ NetworkServices ReadDeviceData
+CAPABILITY ProtServ NetworkServices ReadDeviceData WriteDeviceData
 
 // MACRO 	PLAT_SEC_TEST
 
--- a/realtimenetprots/sipfw/ProfileAgent/Group/sipproxyrsv.mmp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Group/sipproxyrsv.mmp	Fri Apr 16 15:18:54 2010 +0300
@@ -43,6 +43,6 @@
 
 VENDORID 0x70000001
 
-CAPABILITY ProtServ NetworkServices ReadDeviceData
+CAPABILITY ProtServ NetworkServices ReadDeviceData WriteDeviceData
 
 SMPSAFE
--- a/realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfconnectioncontext.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfconnectioncontext.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -366,32 +366,38 @@
 // -----------------------------------------------------------------------------
 //
 void CSIPIetfConnectionContext::IncomingResponse(
-	CSIPClientTransaction& aTransaction,
-	CSIPRegistrationBinding& aRegistration)
-	{
-	PROFILE_DEBUG1("CSIPIetfConnectionContext::IncomingResponse")
-	TBool handled = EFalse;
+    CSIPClientTransaction& aTransaction,
+    CSIPRegistrationBinding& aRegistration)
+    {
+    PROFILE_DEBUG1("CSIPIetfConnectionContext::IncomingResponse")
+    TBool handled = EFalse;
 
-	CleanIdleContexts();
+    CleanIdleContexts();
 
-	for (TInt i=0; i<iContexts.Count() && !handled; i++)
-		{
-		const CSIPResponseElements* response = aTransaction.ResponseElements();
-		if (response)
-		    {
-    		TBool isErrorResponse = (response->StatusCode() >= 300);
-    		TInt contextCountBefore = iContexts.Count();
-    		
-    		iContexts[i]->IncomingResponse(aTransaction, aRegistration, handled);
-    		
-    		TBool contextRemoved = (iContexts.Count() != contextCountBefore);	
-    		if (handled && !contextRemoved && isErrorResponse)
-    			{
-                iContexts[i]->RetryRegistration();
-    			}
-		    }
-		}
-	}
+    for (TInt i=0; i<iContexts.Count() && !handled; i++)
+        {
+        const CSIPResponseElements* response = aTransaction.ResponseElements();
+        if (response)
+            {
+            TInt contextCountBefore = iContexts.Count();
+            TBool isErrorResponse = (response->StatusCode() >= 300);
+            TInt statusCode = response->StatusCode();
+            iContexts[i]->IncomingResponse(aTransaction, aRegistration, handled);
+            TBool contextRemoved = (iContexts.Count() != contextCountBefore);
+            if (handled && !contextRemoved && isErrorResponse)
+                {
+                if ( iContexts[i]->RetryTimerInUse() )
+                    {
+                    iContexts[i]->RetryDeltaTimer(iContexts[i]->DelayTime(), statusCode );
+                    }
+                else
+                    {
+                    iContexts[i]->RetryRegistration();
+                    }
+               }    
+            }
+        }
+    }
 
 // -----------------------------------------------------------------------------
 // CSIPIetfConnectionContext::ErrorOccured
--- a/realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfprofilecontext.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/IETF_Agent/src/Sipietfprofilecontext.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -440,7 +440,9 @@
 	    AgentObserver().ProceedRegistration(*iProfile, aError) &&
 	    (CurrentState() == MSIPProfileContext::ERegistrationInProgress ||
 	     CurrentState() == MSIPProfileContext::ERegistered) &&
-		(aError == KErrSIPOutboundProxyNotResponding || 
+		(aError == K408TimeOut ||
+		 aError == K500ServerInternalError ||
+		 aError == KErrSIPOutboundProxyNotResponding || 
 		 aError == KErrSIPResolvingFailure || 
 		 aError == KErrTimedOut || 
 		 aError == KErrSIPTransportFailure ||
@@ -490,6 +492,8 @@
 TBool CSIPIetfProfileContext::ShouldRetryRegistration( TInt aError )
 	{
 	return (aError == K503ServiceUnavailable || 
+	        aError == K408TimeOut ||
+	        aError == K500ServerInternalError ||
 		    aError == KErrSIPOutboundProxyNotResponding || 
 		    aError == KErrTimedOut ||
 		    ((aError == KErrSIPResolvingFailure || 
@@ -548,38 +552,55 @@
 // -----------------------------------------------------------------------------
 //
 void CSIPIetfProfileContext::IncomingResponse(
-	CSIPClientTransaction& aTransaction,
-	CSIPRegistrationBinding& aRegistration,
-	TBool& aHandled)
-	{
-	if (iClientTx && iRegistration && 
-		aTransaction==*iClientTx && aRegistration==*iRegistration)
-		{
-		PROFILE_DEBUG3("SIPIetfProfileContext::IncomingResponse", ProfileId())
-		aHandled = ETrue;
-		const CSIPResponseElements* response = aTransaction.ResponseElements();
-		if (response)
-		    {
-		    TUint responseCode = response->StatusCode();
-		    if (responseCode >= K300MultipleChoices)
-		        {
-		        PROFILE_DEBUG1("IETFProfileContext: registration failed")
-                RetryPossible(responseCode);
-		        }
-		    else
-		        {
-			    if (responseCode >= K200Ok)
-				    {
-				    PROFILE_DEBUG1("IETFProfileContext: registration complete")
-				    iRetryCounter = 0;
-				    iRetryCounterSum = 0;
-				    Received2XXRegisterResponse();
-		            }
-		        }
-		    }
-        iCurrentState->ResponseReceived(*this, aTransaction);
-		}
-	}
+    CSIPClientTransaction& aTransaction,
+    CSIPRegistrationBinding& aRegistration,
+    TBool& aHandled)
+    {
+    if (iClientTx && iRegistration && 
+        aTransaction==*iClientTx && aRegistration==*iRegistration)
+        {
+        PROFILE_DEBUG3("SIPIetfProfileContext::IncomingResponse", ProfileId())
+        aHandled = ETrue;
+        const CSIPResponseElements* response = aTransaction.ResponseElements();
+        TUint responseCode = response->StatusCode();
+        TBool retry = EFalse;
+        if (response)
+            {
+                retry = RetryRegister( &aTransaction,  responseCode);
+                if( retry )
+                {
+                iCurrentState->ErrorOccured(*this, responseCode);
+                }
+                else
+                {
+                    if (responseCode >= K300MultipleChoices)
+                    {
+                    PROFILE_DEBUG1("IETFProfileContext: registration failed")
+                    RetryPossible(responseCode);
+                    }
+                    else
+                    {
+                        if (responseCode >= K200Ok)
+                        {
+                        PROFILE_DEBUG1("IETFProfileContext: registration complete")
+                        iRetryCounter = 0;
+                        iRetryCounterSum = 0;
+                        Received2XXRegisterResponse();
+                        }
+                    }
+                }
+            }
+        
+            if( retry )
+            {
+            iCurrentState->ErrorOccured(*this, responseCode);
+            }
+            else
+            {
+            iCurrentState->ResponseReceived(*this, aTransaction);
+            }
+        }
+    }
 
 // -----------------------------------------------------------------------------
 // CSIPIetfProfileContext::RandomPercent()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Inc/sipphoneregistrationmonitor.h	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Name        : sipphoneregistrationmonitor.h
+* Part of     : SIP Profile Agent / SIP IMS Agent
+* Version     : %version: 2 %
+*
+*/
+
+
+
+
+/**
+ @internalComponent
+*/
+
+#ifndef CSIPPHONEREGISTRATIONMONITOR_H
+#define CSIPPHONEREGISTRATIONMONITOR_H
+
+// INCLUDES
+#include <etelmm.h>
+
+// FORWARD DECLARATIONS
+class MSipPhoneRegistrationObserver;
+
+// CLASS DEFINITION
+/**
+ * Monitors the status of the phone's network registration.
+ * Notifies when the status changes. 
+ */
+class CSipPhoneRegistrationMonitor : public CActive
+	{
+	public:
+
+        /** Phone registration status */
+        enum TStatus
+            {
+            ENotRegistered,
+            ERegisteredOnHomeNetwork,
+		    ERegisteredRoaming  
+            };
+
+		static CSipPhoneRegistrationMonitor* NewL( 
+		    RTelServer& aTelServer,
+		    const RTelServer::TPhoneInfo& aPhoneInfo,
+		    MSipPhoneRegistrationObserver& aObserver );
+
+		~CSipPhoneRegistrationMonitor();
+
+	public: // New methods
+
+		TStatus Status() const;
+
+	protected: // From CActive
+	
+		void DoCancel();
+		void RunL();
+		TInt RunError(TInt aError);
+
+	private: // Constructors
+
+		/// Constructor
+		CSipPhoneRegistrationMonitor(		 
+		    MSipPhoneRegistrationObserver& aObserver );
+		
+		/// Default constructor, not implemented.
+		CSipPhoneRegistrationMonitor();
+
+		/// 2nd phase constructor
+		void ConstructL( 
+		    RTelServer& aTelServer,
+		    const RTelServer::TPhoneInfo& aPhoneInfo );
+		
+		void MonitorStatus();
+
+	private: // Data
+
+		MSipPhoneRegistrationObserver& iObserver;
+		RMobilePhone iPhone;
+		RMobilePhone::TMobilePhoneRegistrationStatus iRegistrationStatus;
+
+
+#ifdef CPPUNIT_TEST	
+	    friend class CSIPIMSProfileAgentTest;
+#endif				
+	};
+
+#endif // CSIPPHONEREGISTRATIONMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Inc/sipphoneregistrationobserver.h	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Name        : sipphoneregistrationobserver.h
+* Part of     : SIP Profile Agent / SIP IMS Agent
+* Version     : %version: 2 %
+*
+*/
+
+
+
+
+/**
+ @internalComponent
+*/
+
+#ifndef MSIPPHONEREGISTRATIONOBSERVER_H
+#define MSIPPHONEREGISTRATIONOBSERVER_H
+
+// INCLUDES
+#include <e32def.h>
+
+// CLASS DECLARATION
+/**
+* MSipPhoneRegistrationObserver defines an internal interface for observing 
+* phone's network registration status.
+*/
+class MSipPhoneRegistrationObserver
+    {
+    public: // Abstract methods
+
+        /**
+         * Called when the phone's network registration status changes.
+         */
+        virtual void PhoneRegistrationStatusChangedL() = 0;
+
+        /**
+         * Called when there is a fatal failure when monitoring
+         * the phone's network registration status.
+         * The user should delete the monitor.
+         * @param aError the failure reason
+         */
+        virtual void PhoneRegistrationStatusError( TInt aError ) = 0;
+    };
+
+#endif // MSIPPHONEREGISTRATIONOBSERVER_H
--- a/realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/sipimsprofileagent.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/sipimsprofileagent.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -886,7 +886,7 @@
 	PROFILE_DEBUG1("CSIPIMSProfileAgent::DeleteAllProfilesInWaitingQue")
 	
 	CSIPConcreteProfile* profile = NULL;
-	for (TInt i=0; i< iWaitForRegisteringArray.Count();i++)
+	for (TInt i = iWaitForRegisteringArray.Count() -1; i >= 0; --i)
 		{
 		profile = iWaitForRegisteringArray[i];
 		if (profile)
@@ -1345,7 +1345,7 @@
 	{
 	TBool found = EFalse;
     CSIPConcreteProfile* profile = NULL;
-	for (TInt i=0; i< aProfileArray.Count() && !found; i++)
+	for (TInt i= aProfileArray.Count() -1; i >= 0 && !found; --i)
 		{
 		CSIPConcreteProfile* tmp = aProfileArray[ i ];
 		found = ( tmp->Id() == aSIPConcreteProfile.Id() );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/sipphoneregistrationmonitor.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,172 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Name        : sipphoneregistrationmonitor.cpp
+// Part of     : SIP Profile Agent / IMS Agent
+// Version     : %version: 2 %
+//
+
+
+#include "sipphoneregistrationmonitor.h"
+#include "sipphoneregistrationobserver.h"
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::NewL
+// -----------------------------------------------------------------------------
+//
+CSipPhoneRegistrationMonitor* CSipPhoneRegistrationMonitor::NewL(
+    RTelServer& aTelServer,
+    const RTelServer::TPhoneInfo& aPhoneInfo, 
+    MSipPhoneRegistrationObserver& aObserver )
+	{
+	CSipPhoneRegistrationMonitor* self 
+	    = new( ELeave ) CSipPhoneRegistrationMonitor( aObserver );
+	CleanupStack::PushL( self );
+	self->ConstructL( aTelServer, aPhoneInfo );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::CSipPhoneRegistrationMonitor
+// -----------------------------------------------------------------------------
+//
+CSipPhoneRegistrationMonitor::CSipPhoneRegistrationMonitor( 
+    MSipPhoneRegistrationObserver& aObserver )
+	: CActive( CActive::EPriorityStandard ),
+	  iObserver( aObserver ),
+	  iRegistrationStatus( RMobilePhone::ERegistrationUnknown )
+	{
+	CActiveScheduler::Add( this );
+	}
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::ConstructL
+// -----------------------------------------------------------------------------
+//
+#ifdef __WINSCW__
+
+void CSipPhoneRegistrationMonitor::ConstructL( 
+    RTelServer& /*aTelServer*/,
+    const RTelServer::TPhoneInfo& /*aPhoneInfo*/ )
+	{
+    iRegistrationStatus = RMobilePhone::ERegisteredOnHomeNetwork;
+	}
+
+#else
+
+void CSipPhoneRegistrationMonitor::ConstructL( 
+    RTelServer& aTelServer,
+    const RTelServer::TPhoneInfo& aPhoneInfo )
+	{
+	
+	User::LeaveIfError( iPhone.Open( aTelServer, aPhoneInfo.iName ) );
+
+    // Get current status
+    TRequestStatus status;
+    iPhone.GetNetworkRegistrationStatus( status, iRegistrationStatus );	
+    User::WaitForRequest( status );
+    User::LeaveIfError( status.Int() );
+		
+    // Start to monitor the status
+    MonitorStatus();
+	}
+    
+#endif
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::~CSipPhoneRegistrationMonitor
+// -----------------------------------------------------------------------------
+//
+CSipPhoneRegistrationMonitor::~CSipPhoneRegistrationMonitor()
+	{
+	Cancel();
+	iPhone.Close();
+	}
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::Status
+// -----------------------------------------------------------------------------
+//
+CSipPhoneRegistrationMonitor::TStatus 
+CSipPhoneRegistrationMonitor::Status() const
+	{
+	TStatus status = ENotRegistered;
+	switch ( iRegistrationStatus )
+	    {
+	    case RMobilePhone::ERegisteredOnHomeNetwork:
+	        status = ERegisteredOnHomeNetwork;
+	        break;
+	    case RMobilePhone::ERegisteredRoaming:
+	        status = ERegisteredRoaming;
+	        break;
+	    default:
+	        break;
+	    }
+	return status;
+	}
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSipPhoneRegistrationMonitor::DoCancel()
+	{
+	iPhone.CancelAsyncRequest( 
+	    EMobilePhoneNotifyNetworkRegistrationStatusChange );
+	}
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::RunL
+// -----------------------------------------------------------------------------
+//
+void CSipPhoneRegistrationMonitor::RunL()
+	{
+	TInt err = iStatus.Int();
+	
+	if ( err )
+	    {
+	    iObserver.PhoneRegistrationStatusError( err );
+	    }
+	else
+	    {
+	    MonitorStatus();
+	    iObserver.PhoneRegistrationStatusChangedL();	
+	    }
+	}
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CSipPhoneRegistrationMonitor::RunError(TInt aError)
+    {
+    iObserver.PhoneRegistrationStatusError( aError );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSipPhoneRegistrationMonitor::MonitorStatus
+// -----------------------------------------------------------------------------
+//	
+void CSipPhoneRegistrationMonitor::MonitorStatus()
+	{
+#ifndef __WINSCW__
+
+	// Request further notification from ETel
+	iPhone.NotifyNetworkRegistrationStatusChange( iStatus,
+												  iRegistrationStatus );
+	SetActive();
+	
+#endif	
+	}
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileCacheItem.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileCacheItem.h	Fri Apr 16 15:18:54 2010 +0300
@@ -301,7 +301,43 @@
 		*         EFalse otherwise
 		*/
 		TBool IsRfsInprogress() const;
+		
+		/**
+		 * VPN session is about to start.
+		 */
+		void VpnInUse(TBool aStatus);
 
+		/**
+		 * Tells if VPN is in use.
+		 * @return ETrue if VPN is in use.
+		 *         EFalse otherwise
+		 */
+		TBool IsVpnInUse() const;
+		
+		/**
+		 * Sets the initial APN for the profile
+		 */
+		void SetApnSelected(TBool aStatus);
+		
+		/**
+		 * Tells if initial Apn is selected or not
+		 * @return ETrue if Initial APN settings are done
+         *         EFalse otherwise
+		 */
+		TBool IsInitialApnSelected() const;
+		
+	    /**
+	     * Tells if Apn can be switched for a given IAP
+	     * @return ETrue if Profile all the switchable parameters
+         *         EFalse otherwise
+	     */
+		TBool IsApnSwitchEnabled() const;
+		
+		/**
+		 * Sets the switch value for the profile
+		 */
+		 void SetApnSwitchStatus(TBool aStatus);
+		        
         /**
         * Checks if profile can be permanently removed
 		* @return ETrue if not used and can be removed
@@ -613,6 +649,9 @@
 		
 		// ETrue if Rfs has been initiated
 		TBool                       iIsRfsInprogress;
+
+		// ETrue if VPN is in use
+		TBool                       iIsVpnInUse;
 		
 		// Tells if at least one client disallowed migration to a new IAP
 		TBool 						iMigrationDisallowed;
@@ -620,6 +659,12 @@
 		// ETrue if a new IAP came available, but it was disallowed by the
 		// profile, because new IAP couldn't be handled.
 		TBool						iMustRefreshIAPs;
+		
+		// ETrue when if the initial APN is selcted.
+		TBool                       iInitialApnSelected;
+		
+		// ETrue when APN can be switched for the profile. 
+		TBool                       iApnSwitchEnabled;
 
 		// Not owned. NULL if SNAP is not configured.
 		CSipAlrMigrationController* iMigrationController;
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileServerCore.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileServerCore.h	Fri Apr 16 15:18:54 2010 +0300
@@ -35,6 +35,7 @@
 #include "sipprofileagentobserver.h"
 #include "sipprofileerrorhandler.h"
 #include <sipsystemstateobserver.h>
+#include "sipapnmanager.h"
 #include <e32base.h>
 
 // FORWARD DECLARATIONS
@@ -67,8 +68,29 @@
 class CSIPProfileServerCore : public CBase, 
                               public MSIPProfileAgentObserver,
                               public MSipProfileErrorHandler,
-                              public MSipSystemStateObserver
+                              public MSipSystemStateObserver,
+                              public MSIPApnChangeObserver
 	{
+    
+    public:
+    /*
+     * struct to store ApnSwitchEnabled profiles in the event 
+     * when IAPSettings are not same as required.
+     */
+    struct TStoreSwitchEnabledProfile
+        {
+    public:
+        enum TOperation
+            {
+            Update =1,
+            Enable,
+            Register
+            };
+        CSIPConcreteProfile*                          iProfile;
+        const MSIPExtendedConcreteProfileObserver*    iObserver;
+        TOperation                                    operation;
+        };
+    
 	public: // Constructors and destructor
     
 	    /**
@@ -116,6 +138,10 @@
             CSipSystemStateMonitor::TSystemVariable aVariable,
     		TInt aObjectId,
     		TInt aValue );
+        
+	public: // MSIPApnChangeObserver
+	    
+        void ApnChanged( const TDesC8& aApn, TUint32 aIapId, TInt aError );
 
     public: // New functions
 
@@ -441,18 +467,41 @@
 		TUint32 GenerateProfileIdL();
 
 		/**
-		 * Sends forcibly disable profile added event to all clients
-		 * @param aProfileId: Id of the profile being disabled forcibly 
-		 */
+		* Sends forcibly disable profile added event to all clients
+		* @param aProfileId: Id of the profile being disabled forcibly 
+		*/
 		void SendProfileForciblyDisabledEvent(const CSIPProfileCacheItem& aItem) const;
 		
-      /**
-        * Gets cached profile, leave if not found
-        * ownership is not transfered
-        * @param aProfileId id of profile. 
-        * @return profile cache item 
-        */
-        CSIPProfileCacheItem* ProfileCacheItemL(TUint32 aProfileId) const;
+    /**
+    * Gets cached profile, leave if not found
+    * ownership is not transfered
+    * @param aProfileId id of profile. 
+    * @return profile cache item 
+    */
+    CSIPProfileCacheItem* ProfileCacheItemL(TUint32 aProfileId) const;
+
+		/**
+		*Starts timer of type CDeltaTimer, 
+		*which callback is ConnectionCloseTimerExpired function
+		*/
+		void StartConnectionCloseTimer();
+		
+		/**
+		* A callback for CDeltaTimer
+		*/
+		static TInt ConnectionCloseTimerExpired(TAny* aPtr);
+		
+		/**
+		* Notify system state monitor about event processing completion
+		*/
+		void ConfirmSystemstateMonitor(
+			CSipSystemStateMonitor::TSystemVariable aVariable);
+			
+		/*
+         * Checks whether the Update can be performed when the profile
+         * has IAP as modem bearer.
+         */
+        TBool IsUpdateAllowed( CSIPConcreteProfile *aProfile );
 
 	private:
 
@@ -468,9 +517,9 @@
 		void ConstructL();
 
 		/**
-        * Sends status event to observers of the profile
+    * Sends status event to observers of the profile
 		* @param aItem holds profile and observers
-        */
+    */
 		void SendStatusEventL(CSIPProfileCacheItem& aItem, 
 							  CSIPConcreteProfile::TStatus aStatus) const;
 
@@ -613,32 +662,32 @@
 		*/
 		void ReserveStorageL(TBool aRestoreOngoing);
 
-	    /**
-        * Cleans up array in case of failure
-        * ownership of aArray is transferred
+	  /**
+    * Cleans up array in case of failure
+    * ownership of aArray is transferred
 		* @param aArray array to be cleaned up
-        */
+    */
 		static void ResetAndDestroy(TAny* aArray);
 
-	    /**
-        * Cleans up array in case of failure
-        * ownership of aArray is transferred
+	  /**
+    * Cleans up array in case of failure
+    * ownership of aArray is transferred
 		* @param aArray array to be cleaned up
-        */
+    */
 		static void ResetAndDestroyInfo(TAny* aArray);
 
-	    /**
-        * Reverts back cache in case of failure      
+	  /**
+    * Reverts back cache in case of failure      
 		* @param aItem cache cleanup item
-        */
+    */
 		static void CrashRevert(TAny* aItem);
 		
 		/**
-        * Handles the errors occured during the profile restore     
+    * Handles the errors occured during the profile restore     
 		* @param aErr
 		* @param fileStore specifies the kind of the file on which 
 		* the storage error has occured
-        */
+    */
 		void HandleProfileStorageErrorL(TInt aErr, TBool fileStore=EFalse);
 
 		/**
@@ -648,10 +697,10 @@
 		void RemoveProfileItem(TUint32 aProfileId);
 
 		/**
-        * Removes unused migration controllers, except if it uses the specified
-        * SNAP id.
+    * Removes unused migration controllers, except if it uses the specified
+    * SNAP id.
 		* @param aSnapId SNAP id
-        */
+    */
 		void RemoveUnusedMigrationControllers(TUint32 aSnapId);
 
 		void LoadSystemStateMonitorL();
@@ -662,19 +711,60 @@
 		*/
 		CSIPConcreteProfile* FindDefaultProfile() const;
 
-        TBool ShouldChangeIap(CSIPConcreteProfile& aProfile, TInt aError) const;
+    TBool ShouldChangeIap(CSIPConcreteProfile& aProfile, TInt aError) const;
 
-        /**
-        * @return ETrue if any registered profile is using aIap
-        */
-        TBool AnyRegisteredProfileUsesIap(TUint aIap) const;
+    /**
+    * @return ETrue if any registered profile is using aIap
+    */
+    TBool AnyRegisteredProfileUsesIap(TUint aIap) const;
+        
+    /**
+    * Add profiles in Profile Cache
+    * @param aProfiles Array of the profiles to be added
+    * @param aNotifyProfileCreation specifies whether the notification
+    * to be sent to the profile clients
+    */
+    void AddProfilesInCacheL(RPointerArray<CSIPConcreteProfile>& aProfiles,
+    	TBool aNotifyProfileCreation);
+        
+		/**
+		* Gets the IAP Count in the Snap
+    * @return number of aIaps in the Snap
+    */
+    TInt IAPCountL(TUint32 aSnapId) const;
+	
+	 /*
+         * Checks whether the current seetings are same as 
+         * required seetings for Registeration.
+         * @ returns ETrue when the seetings are correct
+         *      EFalse otherwise
+         */
+        
+        TBool IsRegistrationAllowedWithCurrentApnSettings( TUint32 aIapId );
         
         /**
-        * Add profiles in Profile Cache
-        * @param aProfiles Array of the profiles to be added
-        * @param aNotifyProfileCreation specifies whether the notification to be sent to the profile clients
-        */
-        void AddProfilesInCacheL(RPointerArray<CSIPConcreteProfile>& aProfiles,TBool aNotifyProfileCreation);
+         ** Selecting Initial Apn for the profile
+         **/
+        void SelectInitialApnL( const CSIPConcreteProfile& aProfile );
+        
+        /**
+         * Checks whether the profile's IAP is switch enabled 
+         * @ returns ETrue when the profile is APN switch enabled
+         *      EFalse otherwise
+         */
+        TBool CheckApnSwitchEnabledL( const CSIPConcreteProfile& aProfile );
+               
+        /**
+         * Checks the IAP settings 
+         * @ returns ETrue when all the settings are correct
+         *      EFalse otherwise 
+         */
+        TBool CheckIapSettings(TUint32 aProfileId);
+        
+        void UsePrimaryApn(TUint32 aIapId);
+
+        void UseBackupApn( TUint32 aIapId, TBool aFatalFailure = ETrue );
+		
         
 	private: // Data
 	
@@ -719,8 +809,17 @@
 
 		// Owned
 		CSipSystemStateMonitor*				iSystemStateMonitor;
+		//ApnManager
+		CSIPApnManager*                     iApnManager; // iBackupApnSettings;
+		RArray<TStoreSwitchEnabledProfile>                iWaitForApnSettings;
 
 		TBool 								iOfflineEventReceived;
+		
+		TBool									iFeatMgrInitialized;
+		
+		CDeltaTimer* 						iDeltaTimer;
+		TCallBack 							iDeltaTimerCallBack;
+		TDeltaTimerEntry 					iDeltaTimerEntry;
 
 	private: // For testing purposes
 #ifdef CPPUNIT_TEST
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileState.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileState.h	Fri Apr 16 15:18:54 2010 +0300
@@ -333,6 +333,14 @@
 			CSIPProfileState& aUnregInProg,
 			CSIPProfileState& aUnregistered) const;
 
+        /**
+        * Deregister profiles while registration is is progress
+        * @param aItem profile cache item
+        * @param aItem aUnregistered "Unregister" state
+        */
+        void DeregisterWhileRegInProgressL(CSIPProfileCacheItem& aItem,
+            CSIPProfileState& aUnregistered);
+
 	protected: // Data
 
 		CSIPPluginDirector& iPluginDirector;
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileStateRegInProg.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileStateRegInProg.h	Fri Apr 16 15:18:54 2010 +0300
@@ -89,6 +89,10 @@
 		void IapAvailableL(CSIPProfileCacheItem& aItem,
 					       TUint32 aSnapId,
 						   TUint32 aNewIapId);
+						   
+		// Newly added to handle unregistration request in
+		// RegInProg state.
+		void ShutdownInitiated( CSIPProfileCacheItem& aItem );
 
 	public: // New functions
 
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCSSession.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCSSession.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -249,13 +249,21 @@
     {
 	HBufC8* profileBuf = iHelper.ReadLC(ESipProfileItcArgProfile,aMessage);
 	CSIPConcreteProfile* profile = InternalizeProfileLC(*profileBuf);
-    TBool canProceed = iCore.UpdateProfileToStoreL(profile, *this);
-    CleanupStack::Pop(profile);
-    CleanupStack::PopAndDestroy(profileBuf);
-    if (canProceed)
-    	{
-    	iCore.UpdateRegistrationL(profile->Id(), *this);
-    	}
+	TBool updateAllowed = iCore.IsUpdateAllowed(profile);
+	if(updateAllowed)
+	    {
+        TBool canProceed = iCore.UpdateProfileToStoreL(profile, *this);
+        CleanupStack::Pop(profile);
+        CleanupStack::PopAndDestroy(profileBuf);
+        if (canProceed)
+            {
+            iCore.UpdateRegistrationL(profile->Id(), *this);
+            }
+	    }
+	else
+	    {
+	    User::Leave(KErrNotSupported);
+	    }
     }
 
 // -----------------------------------------------------------------------------
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileCacheItem.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -84,6 +84,9 @@
 #endif
 	{
 	iIsRfsInprogress = EFalse;
+	iIsVpnInUse = EFalse;
+	iInitialApnSelected = EFalse;
+	iApnSwitchEnabled = EFalse;
 	iDeltaTimerEntry.Set(iDeltaTimerCallBack);
 	}
 
@@ -560,6 +563,61 @@
     return iIsRfsInprogress;
     }
 
+// -----------------------------------------------------------------------------
+// CSIPProfileCacheItem::VpnInUse
+// -----------------------------------------------------------------------------
+//
+void CSIPProfileCacheItem::VpnInUse(TBool aStatus)
+    {
+    iIsVpnInUse = aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileCacheItem::IsVpnInUse
+// -----------------------------------------------------------------------------
+//
+TBool CSIPProfileCacheItem::IsVpnInUse() const
+    {
+    return iIsVpnInUse;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileCacheItem::SetApnSelected
+// -----------------------------------------------------------------------------
+//
+void CSIPProfileCacheItem::SetApnSelected(TBool aStatus)
+    {
+    iInitialApnSelected = aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileCacheItem::IsInitialApnSelected
+// -----------------------------------------------------------------------------
+//
+TBool CSIPProfileCacheItem::IsInitialApnSelected() const
+    {
+    return iInitialApnSelected;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileCacheItem::SetApnSwitchStatus
+// -----------------------------------------------------------------------------
+//
+void CSIPProfileCacheItem::SetApnSwitchStatus(TBool aStatus)
+    {
+    iApnSwitchEnabled = aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileCacheItem::IsApnSwitchEnabled
+// -----------------------------------------------------------------------------
+//
+TBool CSIPProfileCacheItem::IsApnSwitchEnabled() const
+    {
+    return iApnSwitchEnabled;
+    }
+    
+// -----------------------------------------------------------------------------
 // CSIPProfileCacheItem::CanBePermanentlyRemoved
 // -----------------------------------------------------------------------------
 //
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -48,8 +48,16 @@
 #include <siperr.h>
 #include <sipsystemstatemonitor.h>
 #include <random.h>
+#include <featmgr.h>         // for Feature Manager
+#include <commsdattypesv1_1.h>
+#include <metadatabase.h> 
+#include <commsdattypeinfov1_1_internal.h>
+using namespace CommsDat;
 
 
+const TInt KMicroSecInSec = 1000000;
+const TInt KIdleTimer = 2;
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -82,7 +90,8 @@
 // -----------------------------------------------------------------------------
 //
 CSIPProfileServerCore::CSIPProfileServerCore() :
-	iBackupInProgress(EFalse)
+	iBackupInProgress(EFalse),
+	iDeltaTimerCallBack(ConnectionCloseTimerExpired, this)
 #ifdef CPPUNIT_TEST
     // Set the array granularity to 1, so they allocate memory for every append    
     , iProfileCache(1),
@@ -90,6 +99,8 @@
     iMigrationControllers(1)
 #endif
     {
+		iFeatMgrInitialized = EFalse;
+		iDeltaTimerEntry.Set(iDeltaTimerCallBack);
     }
 
 // -----------------------------------------------------------------------------
@@ -99,6 +110,11 @@
 void CSIPProfileServerCore::ConstructL()
     {
     User::LeaveIfError(iFs.Connect());
+    
+    FeatureManager::InitializeLibL();
+    iFeatMgrInitialized = ETrue;
+	
+	iDeltaTimer = CDeltaTimer::NewL(CActive::EPriorityStandard);
 
     iFindEntry = CSIPProfileCacheItem::NewL(*this, iUnregistered);
 
@@ -144,6 +160,8 @@
     									   *iUnregistered);
 	iUnregisteringOldIAP->SetNeighbourStates(*iRegistered, *iUnregInProg);
 	
+	iApnManager = CSIPApnManager::NewL( *this );
+	
 	LoadSystemStateMonitorL();
 	
 	iAlrHandler = CSipAlrHandler::NewL(*this,iSystemStateMonitor);
@@ -197,9 +215,16 @@
     delete iWaitForPermission;
     delete iMigratingToNewIAP;
     delete iUnregisteringOldIAP;
-
+	delete iApnManager;
     delete iNotify;
-
+    iWaitForApnSettings.Reset();
+    if(iFeatMgrInitialized)
+        {
+        FeatureManager::UnInitializeLib();
+        }
+	
+	delete iDeltaTimer;
+	
     iFs.Close();
 
     PROFILE_DEBUG1("ProfileServer stopped")
@@ -266,40 +291,39 @@
             	}
         		
         	}
-        if (item && item->IsRfsInprogress())
+        TBool eventCompleted = EFalse;
+        if(item && (item->IsRfsInprogress() || iOfflineEventReceived ||
+                (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )&& 
+                        item->IsVpnInUse())))
             {
             CSIPConcreteProfile::TStatus status;
             TInt count = iProfileCache.Count();
-            for (TInt i = 0; i < iProfileCache.Count(); i++)
+            for ( TInt i = 0; i < iProfileCache.Count(); i++ )
                 {
-                iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
-                if (status == CSIPConcreteProfile::EUnregistered)
+                iPluginDirector->State( status, iProfileCache[i]->UsedProfile() );
+                if ( status == CSIPConcreteProfile::EUnregistered )
+                    {
                     count--;
+                    }
+                else if (status == CSIPConcreteProfile::ERegistered )
+                    {
+                    iProfileCache[i]->ShutdownInitiated();
+                    }
                 }
-            if (!count)
-                {
-                iSystemStateMonitor->EventProcessingCompleted(
-								CSipSystemStateMonitor::ERfsState, 0, *this);
-                }
+            if ( !count )
+                eventCompleted = ETrue;
             }
-        }
-		
-		if (iOfflineEventReceived)
-        {
-        CSIPConcreteProfile::TStatus status;
-        TInt count = iProfileCache.Count();
-        for (TInt i = 0; i < iProfileCache.Count(); i++)
+        if(eventCompleted)
             {
-            iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
-            if (status == CSIPConcreteProfile::EUnregistered)
-                count--;
-            }
-        if (!count)
-            {
-            iSystemStateMonitor->EventProcessingCompleted(CSipSystemStateMonitor::ESystemState, 0, *this);
-            }
-        }
-		
+            if (item->IsRfsInprogress())
+                StartConnectionCloseTimer();
+            else if(iOfflineEventReceived)
+                ConfirmSystemstateMonitor(CSipSystemStateMonitor::ESystemState);
+            else if((FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )&& 
+                        item->IsVpnInUse()))
+                ConfirmSystemstateMonitor(CSipSystemStateMonitor::EVpnState);                
+            }       
+        }		
     CheckServerStatus();
     }
 
@@ -430,11 +454,20 @@
 	     (aValue == CSipSystemStateMonitor::ESystemShuttingDown || 
 	     aValue == CSipSystemStateMonitor::ESystemOffline
 			 ))
-	    {    
+	    {   
+	    TBool waitForDeregistration = EFalse;
         for (TInt i = 0; i < iProfileCache.Count(); i++)
             {
             iProfileCache[i]->ShutdownInitiated();
-            }	    
+            CSIPConcreteProfile::TStatus status;
+            iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
+            if(status != CSIPConcreteProfile::EUnregistered)
+                waitForDeregistration = ETrue;            
+            }
+        if(!waitForDeregistration)
+            {
+            ConfirmSystemstateMonitor(CSipSystemStateMonitor::ESystemState);
+            }
 	    }
 	//If the System State is Online, register all the profiles in always on mode
 	else if(aVariable == CSipSystemStateMonitor::ESystemState && 
@@ -445,7 +478,7 @@
 		    {
 		    iProfileCache[i]->ResetShutdownvariable();
 		    CSIPProfileCacheItem* item = iProfileCache[i];
-		    if (item->Profile().IsAutoRegistrationEnabled())
+		    if (iProfileCache[i]->IsReferred())
 		        {
                 TRAPD(err, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
 		        if (err != KErrNone)
@@ -460,9 +493,18 @@
 	    if(aValue == CSipSystemStateMonitor::ERfsStarted)
 	        {
 	        PROFILE_DEBUG1("RFS Started, de-registering the profiles")
-	        for (TInt i = 0; i < iProfileCache.Count(); i++)
+	        TBool waitForDeregistration = EFalse;
+	        for (TInt i = 0; i < iProfileCache.Count(); i++)         
 	            {
 	            iProfileCache[i]->RfsInprogress(ETrue);
+	            CSIPConcreteProfile::TStatus status;
+	            iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
+	            if (status != CSIPConcreteProfile::EUnregistered)
+	                waitForDeregistration = ETrue;
+	            }      
+	        if(!waitForDeregistration)
+	            {
+	            ConfirmSystemstateMonitor(CSipSystemStateMonitor::ERfsState);
 	            }
 	        }
 	    else if(aValue == CSipSystemStateMonitor::ERfsFailed)
@@ -492,7 +534,50 @@
 	            }
 	        }
 	    }
-    }
+    // Perform de/re-registration for VPN.
+    else if( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+          && ( aVariable == CSipSystemStateMonitor::EVpnState ) )
+        {
+        // If VPN session is about to start, SIP should be deregistered.
+        if( aValue == CSipSystemStateMonitor::EVpnInitiating )
+            {
+            PROFILE_DEBUG1("VPN Initiated , de-registering the profiles")
+            TBool waitForDeregistration = EFalse;
+            for (TInt i = 0; i < iProfileCache.Count(); i++)
+                {
+                iProfileCache[i]->VpnInUse( ETrue );
+                iProfileCache[i]->ShutdownInitiated();
+                CSIPConcreteProfile::TStatus status;
+                iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
+                if (status != CSIPConcreteProfile::EUnregistered)
+                    waitForDeregistration = ETrue;
+                }
+            if (!waitForDeregistration)
+                {
+                ConfirmSystemstateMonitor(CSipSystemStateMonitor::EVpnState);
+                }
+            }
+        // If VPN session ended, SIP should be re-registered.    
+        else if( aValue == CSipSystemStateMonitor::EVpnTerminated )
+            {
+            PROFILE_DEBUG1("VPN Terminated , re-registering the profiles")
+            for (TInt i = 0; i < iProfileCache.Count(); i++)
+                {
+                iProfileCache[i]->VpnInUse(EFalse);
+                if ( iProfileCache[i]->IsReferred() )
+                    {
+                    TRAPD(err, iProfileCache[i]->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
+                    if (err != KErrNone)
+                        {
+                        HandleAsyncError( *iProfileCache[i],
+                                          CSIPConcreteProfile::ERegistrationInProgress,
+                                          err);                            
+                        }
+                    }
+                }
+            }
+        }
+	}
 
 // -----------------------------------------------------------------------------
 // CSIPProfileServerCore::SessionRegisterL
@@ -820,6 +905,11 @@
             return EFalse;
             }
         }
+    if (iApnManager->HasPendingTasks())
+        {
+        PROFILE_DEBUG1("ApnManager has pending tasks, do not stop server yet")
+        return EFalse;
+        }
     return ETrue;
     }
 
@@ -900,14 +990,73 @@
     const MSIPExtendedConcreteProfileObserver& aObserver)
     {
     CSIPProfileCacheItem* item = ProfileCacheItemL(aProfileId);
+    TInt err(KErrNone);
     CSIPConcreteProfile::TStatus
     	status(CSIPConcreteProfile::ERegistrationInProgress);
+    
     if (item->Profile().Status() == CSIPConcreteProfile::ERegistered)
         {
         status = CSIPConcreteProfile::EUnregistrationInProgress;
         }
+    if(FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching))
+        {
+        if(item->LatestProfile().IapId()!= item->UsedProfile().IapId())
+            {
+            item->SetApnSelected(EFalse);
+            }
+        
+        item->SetApnSwitchStatus(EFalse);
+        if(CheckApnSwitchEnabledL(item->LatestProfile()))
+            {
+            const TDesC8* primaryApn( NULL );
+            const TDesC8* secondaryApn( NULL );
+            const TDesC8* latestprimaryApn( NULL );
+            const TDesC8* latestsecondaryApn( NULL );            
+                
+            TInt err1 = item->LatestProfile().ExtensionParameter(KPrimaryAPN,latestprimaryApn);
+            TInt err2 = item->UsedProfile().ExtensionParameter(KPrimaryAPN,primaryApn);            
+                
+            TInt err3 = item->LatestProfile().ExtensionParameter(KSecondaryAPN,latestsecondaryApn);
+            TInt err4 = item->UsedProfile().ExtensionParameter(KSecondaryAPN,secondaryApn);                          
+            if((err1 == KErrNone && err2 == KErrNone && latestprimaryApn->Compare(*primaryApn)!= 0)||
+                 (err3 == KErrNone && err4 == KErrNone &&
+                       latestsecondaryApn->Compare(*secondaryApn)!= 0))
+                {
+                item->SetApnSelected(EFalse);
+                }
+            }
+        }
 
-    TRAPD(err, item->UpdateRegistrationL(aObserver));
+        
+    if(FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching) 
+            && item->IsApnSwitchEnabled())
+        {
+        PROFILE_DEBUG1("CSIPProfileServerCore::UpdateRegistrationL, SwichEnabled")
+        if(CheckIapSettings( item->LatestProfile().Id()))
+            {   
+            PROFILE_DEBUG1("CSIPProfileServerCore::UpdateRegistrationL, Settings are correct")
+            if(IsRegistrationAllowedWithCurrentApnSettings(item->LatestProfile().IapId()))
+                {
+                PROFILE_DEBUG1("CSIPProfileServerCore::UpdateRegistrationL, Registration is allowed")
+                TRAP(err, item->UpdateRegistrationL(aObserver));
+                }
+            else
+                {
+                PROFILE_DEBUG1("CSIPProfileServerCore::UpdateRegistrationL, Appending into Array")
+                TStoreSwitchEnabledProfile updateProfile;
+                updateProfile.iObserver = &aObserver;
+                updateProfile.iProfile = &item->LatestProfile();
+                updateProfile.operation = TStoreSwitchEnabledProfile::Update;
+                iWaitForApnSettings.AppendL(updateProfile);
+                }
+            }
+        else
+            User::LeaveIfError(KErrNotSupported);
+        }
+    else
+        {
+        TRAP(err, item->UpdateRegistrationL(aObserver));
+        }
     if (err != KErrNone)
         {
         HandleAsyncError(*item, status, err);
@@ -923,7 +1072,42 @@
     const MSIPExtendedConcreteProfileObserver& aObserver)
     {
 	CSIPProfileCacheItem* item = ProfileCacheItemL(aProfileId);
-    iAlrHandler->EnableProfileL(*item, aObserver);
+    TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+                             && item->IsVpnInUse());
+    
+    const CSIPConcreteProfile* profile = Profile(aProfileId);
+    if(FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching ) 
+        && CheckApnSwitchEnabledL( *profile ) && !item->IsRfsInprogress() && !isVpnInUse )
+        {
+        PROFILE_DEBUG1("CSIPProfileServerCore::EnableProfileL, SwichEnabled")
+        if(CheckIapSettings( aProfileId ))
+            {
+            PROFILE_DEBUG1("CSIPProfileServerCore::EnableProfileL, Settings are correct")
+            if(IsRegistrationAllowedWithCurrentApnSettings(item->Profile().IapId()))
+                {
+                PROFILE_DEBUG1("CSIPProfileServerCore::EnableProfileL, Registration is allowed")
+                iAlrHandler->EnableProfileL(*item, aObserver);
+                }
+            else
+                {
+                PROFILE_DEBUG1("CSIPProfileServerCore::EnableProfileL, Appending into Array")
+                TStoreSwitchEnabledProfile enableProfile;
+                enableProfile.iProfile = &item->Profile();
+                enableProfile.iObserver = &aObserver;
+                enableProfile.operation = TStoreSwitchEnabledProfile::Enable;
+                iWaitForApnSettings.AppendL(enableProfile);
+                }
+            }
+        else
+            {
+            User::LeaveIfError(KErrNotSupported);
+            }           
+        }
+    else
+        if (!item->IsRfsInprogress() && !isVpnInUse )
+        {
+        iAlrHandler->EnableProfileL(*item, aObserver);
+        }
     return item->Profile().Status();
     }
 
@@ -946,10 +1130,10 @@
 //
 CSIPConcreteProfile::TStatus CSIPProfileServerCore::ForceDisableProfileL(
     TUint32 aProfileId,
-    const MSIPExtendedConcreteProfileObserver& aObserver)
+    const MSIPExtendedConcreteProfileObserver& /* aObserver */)
     {
     CSIPProfileCacheItem* item = ProfileCacheItemL(aProfileId);
-    (void)aObserver;
+    
     //When profile state is not unregistered, 
     //perform cleanup and send event notification
     
@@ -984,10 +1168,40 @@
     {
     for (TInt i = 0; i < iProfileCache.Count(); i++)
         {
+        TInt err(KErrNone);
         CSIPProfileCacheItem* item = iProfileCache[i];
         if (item->Profile().IsAutoRegistrationEnabled())
             {
-			TRAPD(err, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
+            TBool enabled(EFalse);
+            TRAPD(error, enabled = CheckApnSwitchEnabledL(item->Profile()))
+            if(FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching ) 
+                        &&enabled && !error)
+                {
+                PROFILE_DEBUG1("CSIPProfileServerCore::RegisterProfiles, SwichEnabled")
+                if(CheckIapSettings( item->Profile().Id()))
+                    {
+                     PROFILE_DEBUG1("CSIPProfileServerCore::RegisterProfiles, Settings are correct")
+                     if(IsRegistrationAllowedWithCurrentApnSettings(item->Profile().IapId()))
+                         {
+                         PROFILE_DEBUG1("CSIPProfileServerCore::RegisterProfiles, Registration is allowed")
+                         TRAP(err, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
+                         }
+                     else
+                         {
+                         PROFILE_DEBUG1("CSIPProfileServerCore::RegisterProfiles, Appending into Array")
+                         TStoreSwitchEnabledProfile registerProfile;
+                         registerProfile.iProfile = &item->Profile();
+                         registerProfile.iObserver = NULL;   
+                         registerProfile.operation = TStoreSwitchEnabledProfile::Register;
+                         TRAP_IGNORE(iWaitForApnSettings.AppendL(registerProfile))
+                         }
+                    }
+                }
+            else                
+                {
+                TRAP(err, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
+                }
+            
             if (err != KErrNone)
                 {
                 HandleAsyncError(*item,
@@ -1401,6 +1615,10 @@
 	        SendErrorEvent(aItem, aStatus, aError);
 	        }
     	}
+    if(aItem.IsApnSwitchEnabled())
+        {
+        UseBackupApn(aItem.Profile().IapId(), ETrue);
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -1736,6 +1954,13 @@
   		    CSipSystemStateMonitor::ESystemState, 0, *this);
 		iSystemStateMonitor->StartMonitoringL(
 			CSipSystemStateMonitor::ERfsState, 0, *this);
+
+        if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
+            {
+	        // Start P&S key monitoring for communication between SIP and VPN.
+            iSystemStateMonitor->StartMonitoringL(
+                    CSipSystemStateMonitor::EVpnState, 0, *this);
+	        }
 	    }
 	CleanupStack::Pop(); // TCleanupItem
 	infoArray.ResetAndDestroy();
@@ -1771,26 +1996,37 @@
 TBool CSIPProfileServerCore::ShouldChangeIap(CSIPConcreteProfile& aProfile, TInt aError) const
 	{
 	PROFILE_DEBUG3("CSIPProfileServerCore::ShouldChangeIap, error", aError)
-	TUint32 dummySnapId(0);	
-	if ( aProfile.ExtensionParameter(KSIPSnapId, dummySnapId) == KErrNone &&
-	     !AnyRegisteredProfileUsesIap(aProfile.IapId()) )
+	TUint32 snapId(0);	
+	if ( aProfile.ExtensionParameter(KSIPSnapId, snapId) == KErrNone 
+	        && !AnyRegisteredProfileUsesIap(aProfile.IapId()) )
 	    {
 		PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap, snap is in use")
 
 	    // This profile uses a SNAP.
 	    // There are no registered profiles using the same IAP as this profile.
-	    
-        if ( aError == KErrTimedOut ||
-	         aError == KErrSIPResolvingFailure )
-	        {
-			PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap returns True")
-	        return ETrue;
-	        }
-	    }
+		
+		TUint iapCount(0);
+		TRAPD(err, iapCount = IAPCountL(snapId));
+		if(KErrNone == err)
+			{			
+			if ( (aError == KErrTimedOut ||
+				 aError == KErrSIPResolvingFailure) 
+				 && iapCount > 1)
+				{
+				PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap returns True")
+				return ETrue;
+				}
+			}
+			
+		}
 	PROFILE_DEBUG1("CSIPProfileServerCore::ShouldChangeIap returns false")
     return EFalse;
 	}
- 
+
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::AnyRegisteredProfileUsesIap
+// -----------------------------------------------------------------------------
+// 
 TBool CSIPProfileServerCore::AnyRegisteredProfileUsesIap(TUint aIap) const
     {
     
@@ -1839,3 +2075,270 @@
 						aItem.Profile().Status(), ESipProfileItcOpProfileForciblyDisabled));
             }
     }
+	
+	
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::IAPCount
+// -----------------------------------------------------------------------------
+//
+TInt CSIPProfileServerCore::IAPCountL(TUint32 aSnapId) const
+    {
+    const TUint KRecordId = aSnapId;
+	TUint32 count(0);
+	CMDBSession* db = CMDBSession::NewLC( KCDVersion1_2);
+	db->SetAttributeMask( ECDHidden );	
+	
+    //Load the Selection Policy record
+	CCDIAPPrioritySelectionPolicyRecord *selPolRecord = (CCDIAPPrioritySelectionPolicyRecord *)CCDRecordBase::RecordFactoryL(KCDTIdIapPrioritySelectionPolicyRecord);
+	
+	CleanupStack::PushL(selPolRecord);    
+    selPolRecord->SetRecordId(KRecordId);
+	
+    selPolRecord->LoadL( *db ); 
+	count = selPolRecord->iIapCount;
+	PROFILE_DEBUG3("CSIPProfileServerCore::IAPCount, IAP Count", count)
+	      
+    CleanupStack::PopAndDestroy(selPolRecord);
+	CleanupStack::PopAndDestroy( db );
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::StartConnectionCloseTimer
+// -----------------------------------------------------------------------------
+//
+void CSIPProfileServerCore::StartConnectionCloseTimer()
+	{
+	PROFILE_DEBUG1("CSIPProfileServerCore::StartConnectionCloseTimer")
+	iDeltaTimer->Remove(iDeltaTimerEntry);
+	TTimeIntervalMicroSeconds32 interval(KMicroSecInSec * KIdleTimer);
+	iDeltaTimer->Queue(interval, iDeltaTimerEntry);
+	}
+
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::ConnectionCloseTimerExpired
+// -----------------------------------------------------------------------------
+//
+TInt CSIPProfileServerCore::ConnectionCloseTimerExpired(TAny* aPtr)
+	{
+	PROFILE_DEBUG1("CSIPProfileServerCore::ConnectionCloseTimerExpired")
+	CSIPProfileServerCore* self = reinterpret_cast<CSIPProfileServerCore*>(aPtr);
+  	self->ConfirmSystemstateMonitor(CSipSystemStateMonitor::ERfsState);
+  	return ETrue;
+	}
+
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::ConfirmSystemstateMonitor
+// -----------------------------------------------------------------------------
+//
+void CSIPProfileServerCore::ConfirmSystemstateMonitor(
+	CSipSystemStateMonitor::TSystemVariable aVariable)
+	{
+		iSystemStateMonitor->EventProcessingCompleted(
+		        aVariable, 0, *this);
+	}
+	
+// ----------------------------------------------------------------------------
+//CSIPProfileServerCore::ApnChanged
+// ----------------------------------------------------------------------------
+void CSIPProfileServerCore::ApnChanged( const TDesC8& /*aApn*/, TUint32 aIapId, TInt aError )
+    {
+    PROFILE_DEBUG3( "CSIPProfileServerCore::ApnChanged, err:", aError )        
+    // Check if there is any profile waiting for correct Apn settings for IapId aIapId
+            
+    if ( IsRegistrationAllowedWithCurrentApnSettings( aIapId ) || aError != KErrNone )
+        {
+        PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, settings are correct")                
+        CSIPConcreteProfile* profile = NULL;
+        TInt count = iWaitForApnSettings.Count();
+        for (TInt i =0; i < count; i++)
+            {
+            TStoreSwitchEnabledProfile switchEnabledProfile = iWaitForApnSettings[i];       
+            if(switchEnabledProfile.iProfile->IapId()==aIapId)
+                {               
+                profile = switchEnabledProfile.iProfile;              
+                iWaitForApnSettings.Remove(i);
+                iWaitForApnSettings.Compress();
+                i--;
+                count = iWaitForApnSettings.Count();
+                PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, Profile IapId matches")  
+                
+                TInt err( aError );
+                TInt error(KErrNone);
+                PROFILE_DEBUG3("CSIPProfileServerCore::ApnChanged, Profile Id", profile->Id())
+                CSIPProfileCacheItem* item = ProfileCacheItem(profile->Id());
+                TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+                                             && item->IsVpnInUse());
+                if ( err == KErrNone && CheckIapSettings(profile->Id()))
+                    {
+                    if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Update)
+                        {
+                        TRAP(error, item->UpdateRegistrationL(*(switchEnabledProfile.iObserver)));
+                        }
+                    else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Enable && !item->IsRfsInprogress() && !isVpnInUse)                    
+                        {
+                        TRAP(error, iAlrHandler->EnableProfileL(*item, *(switchEnabledProfile.iObserver)));
+                        }
+                    else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Register)
+                        {
+                        TRAP(error, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
+                        }
+                    }
+                if ( err != KErrNone || error)
+                    {
+                     PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, error handling")
+                     HandleAsyncError(*item, profile->Status(), err);
+                    }
+                }
+            }
+        }
+    PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, exit")    
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::IsRegistrationAllowedWithCurrentApnSettings
+// -----------------------------------------------------------------------------
+//
+TBool CSIPProfileServerCore::IsRegistrationAllowedWithCurrentApnSettings( TUint32 aIapId )
+    {
+    return ( iApnManager && iApnManager->IsPrimaryApnInUse( aIapId ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::SelectInitialApnL
+// -----------------------------------------------------------------------------
+//
+void CSIPProfileServerCore::SelectInitialApnL( const CSIPConcreteProfile& aProfile )
+    {
+    PROFILE_DEBUG1("CSIPProfileServerCore::SelectInitialApnL" )
+    CSIPProfileCacheItem* item = ProfileCacheItem(aProfile.Id());
+    
+    if ( item && !item->IsInitialApnSelected())
+        {        
+        // If profile has stored APNs, use them
+        const TDesC8* primaryApn( NULL );
+        if ( aProfile.ExtensionParameter( KPrimaryAPN, primaryApn ) == KErrNone )
+            {
+            PROFILE_DEBUG1("UpdateApnL ETrue" )
+            iApnManager->UpdateApnL( aProfile.IapId(), ETrue, *primaryApn );
+            }
+        const TDesC8* secondaryApn( NULL );
+        if ( aProfile.ExtensionParameter( KSecondaryAPN, secondaryApn ) == KErrNone )
+            {
+            PROFILE_DEBUG1("UpdateApnL EFalse" )
+            iApnManager->UpdateApnL( aProfile.IapId(), EFalse, *secondaryApn );
+            }
+        
+        PROFILE_DEBUG1("SelectInitialApnL - WriteApnL, Primary APN" )
+        iApnManager->WriteApnL( aProfile.IapId(), ETrue, primaryApn);
+        item->SetApnSelected(ETrue);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::CheckApnSwitchEnabledL
+// -----------------------------------------------------------------------------
+//
+TBool CSIPProfileServerCore::CheckApnSwitchEnabledL( const CSIPConcreteProfile& aProfile )
+    {
+    PROFILE_DEBUG1("CSIPProfileServerCore::CheckApnSwitchEnabledL" )
+    TUint32 profileId = aProfile.Id();
+    
+    PROFILE_DEBUG3("CSIPProfileServerCore::CheckApnSwitchEnabledL, IapId", profileId )
+    
+    CSIPProfileCacheItem* item = ProfileCacheItem(profileId); 
+    TUint32 snapId;
+    if(item && !item->IsSNAPConfigured( snapId )&& !item->IsApnSwitchEnabled())
+        {
+        // If profile has stored APNs, use them
+        const TDesC8* primaryApn( NULL );
+        const TDesC8* secondaryApn( NULL );
+        TInt err = aProfile.ExtensionParameter( KPrimaryAPN, primaryApn );
+        TInt error = aProfile.ExtensionParameter( KSecondaryAPN, secondaryApn );
+        
+        if(err == KErrNone && error == KErrNone && primaryApn && secondaryApn)
+            {
+            TBool isIapGPRS = iApnManager->IsIapGPRSL( aProfile.IapId() );
+            if (isIapGPRS)
+            item->SetApnSwitchStatus(ETrue); //  Set Switch APN Enabled
+            }
+        } 
+    PROFILE_DEBUG3("CSIPProfileServerCore::CheckApnSwitchEnabledL returns"
+                                                ,item->IsApnSwitchEnabled())
+    return item->IsApnSwitchEnabled(); 
+    }
+
+// -----------------------------------------------------------------------------
+// CSIPProfileServerCore::CheckIapSettings
+// -----------------------------------------------------------------------------
+//
+TBool CSIPProfileServerCore::CheckIapSettings(TUint32 aProfileId)
+    {
+    PROFILE_DEBUG1("CSIPProfileServerCore::CheckIapSettings")
+            
+    const CSIPConcreteProfile* profile = Profile( aProfileId );
+    CSIPProfileCacheItem* item = ProfileCacheItem( aProfileId );
+    TInt err(KErrNone);
+    if(profile && item)
+        {        
+        if(!iApnManager->IsFailed(profile->IapId()))
+            {   
+            TRAP(err, SelectInitialApnL( *profile ));
+            UsePrimaryApn(profile->IapId());
+            PROFILE_DEBUG1("CSIPProfileServerCore::CheckIapSettings returns ETrue")
+            return ETrue;
+            }
+        else 
+            if(err || iApnManager->IsFailed(profile->IapId()) )
+                {
+                PROFILE_DEBUG1("CSIPProfileServerCore::CheckIapSettings returns EFalse")
+                    
+                item->SetApnSelected(ETrue);
+                return EFalse;
+            }
+        }
+    PROFILE_DEBUG1("CSIPProfileServerCore::CheckIapSettings, profile or item is NULL")
+    return EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPProfileServerCore::UsePrimaryApn
+// ----------------------------------------------------------------------------
+//
+void CSIPProfileServerCore::UsePrimaryApn(TUint32 aIapId)
+    {
+    PROFILE_DEBUG1("CSIPProfileServerCore::UsePrimaryApn")
+    
+    if (!iApnManager->IsPrimaryApnInUse( aIapId ))
+        {
+        iApnManager->SetFailed( aIapId, EFalse, EFalse );
+        }
+    
+    PROFILE_DEBUG1("CSIPProfileServerCore::UsePrimaryApn, exit")
+    }
+    
+// ----------------------------------------------------------------------------
+// CSIPProfileServerCore::UseBackupApn
+// ----------------------------------------------------------------------------
+//
+void CSIPProfileServerCore::UseBackupApn( TUint32 aIapId, TBool aFatalFailure )
+    {
+    PROFILE_DEBUG1("CSIPProfileServerCore::UseBackupApn")
+    
+    if ( iApnManager->IsFailed( aIapId ) || aFatalFailure )
+        {
+        iApnManager->SetFailed( aIapId, ETrue, aFatalFailure );
+        }
+    
+    PROFILE_DEBUG1("CSIPIMSProfileAgent::UseBackupApn, exit")
+    }
+
+// ----------------------------------------------------------------------------
+// CSIPProfileServerCore::IsUpdateAllowed
+// ----------------------------------------------------------------------------
+//
+TBool CSIPProfileServerCore::IsUpdateAllowed( CSIPConcreteProfile *aProfile )
+    {
+    PROFILE_DEBUG1("CSIPIMSProfileAgent::IsUpdateAllowed, enter")
+    return !(iApnManager->IsFailed(aProfile->IapId()));
+    }
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileState.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileState.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -407,3 +407,22 @@
 	{
 	PROFILE_DEBUG1("CSIPProfileState::NoNewIapAvailable")
 	}
+
+// -----------------------------------------------------------------------------
+// CSIPProfileState::DeregisterWhileRegInProgressL
+// -----------------------------------------------------------------------------
+//
+void CSIPProfileState::DeregisterWhileRegInProgressL(CSIPProfileCacheItem& aItem,
+    CSIPProfileState& aUnregistered)
+    {
+    if ( !iPluginDirector.IsRegisterPending( aItem.UsedProfile() ) )
+        {
+        CSIPConcreteProfile::TStatus status;
+        iPluginDirector.State( status, aItem.UsedProfile() );
+        iPluginDirector.DeregisterL( aItem.UsedProfile() );
+        if ( status == CSIPConcreteProfile::ERegistrationInProgress )
+            {
+            aItem.ChangeStateL( &aUnregistered );
+            }
+        }
+    }
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateRegInProg.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateRegInProg.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -228,3 +228,14 @@
 	iPluginDirector.TerminateHandling(aItem.Profile());
 	aItem.HandleNewIapL(aSnapId, aNewIapId, EFalse, *iWaitForPermission);
 	}
+
+// -----------------------------------------------------------------------------
+// CSIPProfileStateRegInProg::ShutdownInitiated
+// Initiate de-registration. PluginDirector never has a pending register in
+// registered state.
+// -----------------------------------------------------------------------------
+//
+void CSIPProfileStateRegInProg::ShutdownInitiated( CSIPProfileCacheItem& aItem )
+	{
+      TRAP_IGNORE( DeregisterWhileRegInProgressL( aItem, *iUnregistered) )
+	}
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateUnregistered.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileStateUnregistered.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -27,6 +27,7 @@
 #include "sipplugindirector.h"
 #include "sipalrmonitor.h"
 #include "SipProfileLog.h"
+#include <featmgr.h>
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -110,16 +111,19 @@
 	if (aItem.IsActiveState())
 		{
 		aItem.SendUnregisteredStatusEventL();
-
-		if (aItem.IsReferred() && !aItem.IsShutdownInitiated() && !aItem.IsRfsInprogress())
-			{
-			aItem.ClearOldProfile();
-			aItem.StartRegisterL(*iWaitForIAP, *iRegInProg, getIap);
-			// CSIPProfileCacheItem::MonitorSnapL stops ALR monitor later if
-			// updating SNAP.			
-			return;
-			}
-		}
+		TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+                                && aItem.IsVpnInUse());
+		
+        if ( aItem.IsReferred() && !aItem.IsShutdownInitiated() &&
+                !aItem.IsRfsInprogress() && !isVpnInUse)
+            {
+            aItem.ClearOldProfile();
+            aItem.StartRegisterL(*iWaitForIAP, *iRegInProg, getIap);
+            // CSIPProfileCacheItem::MonitorSnapL stops ALR monitor later if
+            // updating SNAP.           
+            return;
+            }
+        }
 	// Stay unregistered, no need to monitor SNAP
 	aItem.StopSnapMonitoring();
 	iPluginDirector.TerminateHandling(aItem.UsedProfile());
@@ -228,12 +232,15 @@
 	__ASSERT_ALWAYS(
 		iPluginDirector.State(state, aItem.Profile()) == KErrNotFound ||
 		state == CSIPConcreteProfile::EUnregistered, User::Leave(KErrArgument));
-
-	if (aItem.IsReferred() && !aItem.IsShutdownInitiated())
-		{
-		aItem.StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue);
-		}
-	}
+        TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+                             && aItem.IsVpnInUse());
+        
+        if (aItem.IsReferred() && !aItem.IsShutdownInitiated() 
+                      && !aItem.IsRfsInprogress() && !isVpnInUse)
+            {
+            aItem.StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue);
+            }	
+        }
 
 // -----------------------------------------------------------------------------
 // CSIPProfileStateUnregistered::ErrorOccurred
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/sipalrmigrationcontroller.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/sipalrmigrationcontroller.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -329,9 +329,14 @@
 	PROFILE_DEBUG5("CSipAlrMigrCtrl::SendMigrationResult iap,allow,obsCount",
 				   aIapId,
 				   aAllowed,
-				   iObservers.Count())	
-
-	for (TInt i = 0; i < iObservers.Count(); ++i)
+				   iObservers.Count())
+	    
+		// It may be possible that Profile Could not be registered (if migration is allowed). In such cases error handling
+        // for profile will be done, which will move Profile into Un-registered State
+        // As the profile moves into Un-registered state, profile is detached from
+        // the list of Observer which AlrMigrationController maintains. This dynamically
+        // changes the Observer count.
+	    for (TInt i = iObservers.Count() -1; i >= 0; --i)
 		{
 		MSipAlrMigrationObserver& obs = iObservers[i].iObserver;
 		TRAPD(err, if (aAllowed)
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/sipprofilestatewaitforpermission.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/sipprofilestatewaitforpermission.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -255,7 +255,6 @@
 			{
 			aItem.HandleProfileError(err, aItem.Profile());
 			}
-		User::Leave(err);
 		}
 	}
 
--- a/realtimenetprots/sipfw/SIP/NetworkMonitor/Plugins/Packet/Src/CPacketContextMonitor.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/SIP/NetworkMonitor/Plugins/Packet/Src/CPacketContextMonitor.h	Fri Apr 16 15:18:54 2010 +0300
@@ -132,6 +132,10 @@
 		TUint32 iRetryAfter;
 		
 		TInt iOtherMonitoringRetryCount;
+		
+#ifdef CPPUNIT_TEST 
+        friend class CPacketContextMonitorTest;
+#endif
 
 	};
 	
--- a/realtimenetprots/sipfw/SIP/NetworkMonitor/src/CNetworkManager.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/SIP/NetworkMonitor/src/CNetworkManager.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -410,7 +410,8 @@
         aObjectName.AppendNum( static_cast<TInt64>( realIapId ) );
         }        
 #endif
-
+	__SIP_INT_LOG1( "CNetworkManager::GetServiceTypeAndObjectNameL end realIapID =", realIapId )	
+	
     return realIapId;
 	}
 
@@ -436,37 +437,39 @@
     
     CCDVPNServiceRecord* serviceRecord = 
         static_cast<CCDVPNServiceRecord*>( aIapRecord.iService.iLinkedRecord );
-    
-    serviceRecord->iServiceIAP.LoadL( aCommsDat );
-    
-    // It is valid to have 0 for iServiceIAP when the SNAP is configured for VPN IAP. 
-    // So treat this is a valid configuaration and fill the aServiceType to NULL which usually contains the IAP service type(like LAN Service, Outgoing GPRS etc )     
-    if (serviceRecord->iServiceIAP == 0)
-    	{    	
-   		aServiceType.Copy(_L8("")); 
-    	return (serviceRecord->iServiceIAP);
-    	}
-    
-    if ( !serviceRecord->iServiceIAP.iLinkedRecord )
-        {
-        // Ownership of created record is transferred
-        serviceRecord->iServiceIAP.iLinkedRecord = 
-            static_cast<CCDIAPRecord*>(
-                CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
-        serviceRecord->iServiceIAP.iLinkedRecord->SetRecordId( 
-            serviceRecord->iServiceIAP );
-            
-        serviceRecord->iServiceIAP.iLinkedRecord->LoadL( aCommsDat );
-        }
 
-    CCDIAPRecord* iapRecord = 
-        static_cast<CCDIAPRecord*>( serviceRecord->iServiceIAP.iLinkedRecord );
-    
-    // We need service type info of the "real" iap
-    GetServiceTypeL( *iapRecord, aServiceType );
-       
-    return iapRecord->RecordId();
-    }
+	TRAPD(err,serviceRecord->iServiceIAP.LoadL( aCommsDat ));
+	if(KErrNone != err )
+		{
+		//Its valid to not have iServiceIAP record, due to introduction of ServiceSNAP for the VPN with Snap
+		__SIP_INT_LOG1( "CNetworkManager::HandleVPNServiceL CCDVPNServiceRecord->iServiceIAP LoadL failed with error=", err)
+		aServiceType.Copy(_L8("")); 
+		return 0;
+		
+		}
+	else
+		{
+	    	if ( !serviceRecord->iServiceIAP.iLinkedRecord )
+	        {
+			// Ownership of created record is transferred
+	        serviceRecord->iServiceIAP.iLinkedRecord = 
+	            static_cast<CCDIAPRecord*>(
+	                CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+	        serviceRecord->iServiceIAP.iLinkedRecord->SetRecordId( 
+	            serviceRecord->iServiceIAP );
+	            
+	        serviceRecord->iServiceIAP.iLinkedRecord->LoadL( aCommsDat );
+			}
+		
+
+	    	CCDIAPRecord* iapRecord = 
+	        	static_cast<CCDIAPRecord*>( serviceRecord->iServiceIAP.iLinkedRecord );
+	    
+	    	// We need service type info of the "real" iap
+	    	GetServiceTypeL( *iapRecord, aServiceType );
+	       	return iapRecord->RecordId();
+		}
+	}
 
 // -----------------------------------------------------------------------------
 // CNetworkManager::GetServiceTypeL
--- a/realtimenetprots/sipfw/SIP/SystemStateMonitor/Api/sipsystemstatemonitor.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/SIP/SystemStateMonitor/Api/sipsystemstatemonitor.h	Fri Apr 16 15:18:54 2010 +0300
@@ -53,7 +53,9 @@
             /** SNAP availability event */
             ESnapAvailability,
             /** RFS State */
-            ERfsState
+            ERfsState,
+            /** VPN State */
+            EVpnState
             };    
     
         /** System states */
@@ -91,6 +93,14 @@
             ERfsCompleted
             };
 
+        enum TVpnState
+            {
+            /** Vpn is about to be started */
+            EVpnInitiating = 0,                
+            /** Vpn ended */
+            EVpnTerminated
+            };
+        
     public: // Constructors and destructor
     
         /**
--- a/realtimenetprots/sipfw/SIP/sipapi/api/siphttpdigestchallengeobserver.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/SIP/sipapi/api/siphttpdigestchallengeobserver.h	Fri Apr 16 15:18:54 2010 +0300
@@ -38,6 +38,12 @@
 * The user should provide credentials or ignore the challenge
 * using functions defined in TSIPHttpDigest class.
 *
+* MSIPHttpDigestChallengeObserver class is compliant with RFC 2543
+* where Proxy use to forward only one challenge when it receives 
+* multiple challenges on forking the request. Applications are 
+* encouraged to use MSIPHttpDigestChallengeObserver2 class which
+* provides interface to extract multiple challenges.
+* MSIPHttpDigestChallengeObserver2 class is compliant to RFC 3261
 *  @lib n/a
 */
 class MSIPHttpDigestChallengeObserver
--- a/realtimenetprots/sipfw/SIP/sipapi/api/siphttpdigestchallengeobserver2.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/SIP/sipapi/api/siphttpdigestchallengeobserver2.h	Fri Apr 16 15:18:54 2010 +0300
@@ -42,6 +42,10 @@
 * The user should provide credentials or ignore the challenge
 * using functions defined in CSIPHttpDigest class.
 *
+* Applications are encouraged to use implement below interface which
+* provides functions to extract multiple challenges.
+* MSIPHttpDigestChallengeObserver2 class is compliant to RFC 3261
+*
 *  @lib n/a
 */
 class MSIPHttpDigestChallengeObserver2
--- a/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpAPI.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpAPI.h	Fri Apr 16 15:18:54 2010 +0300
@@ -119,7 +119,7 @@
          void UT_CRtpAPI_StartConnectionL();
         
         
-         void UT_CRtpAPI_StartConnection_1L();
+         void UT_CRtpAPI_StartConnection_OneL();
         
         
          void UT_CRtpAPI_CancelStartL();
@@ -180,7 +180,7 @@
         
          void UT_CRtpAPI_SendRtpPacket_2L();
         
-         void UT_CRtpAPI_SendRtpPacket_3L();	
+         void UT_CRtpAPI_SendRtpPacket_ThreeL();	
         
          void UT_CRtpAPI_SendDataLL();
         
--- a/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpComm.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpComm.h	Fri Apr 16 15:18:54 2010 +0300
@@ -124,7 +124,7 @@
          
          void UT_CRtpComm_CommReceiveL(  );
          
-         void UT_CRtpComm_MaxSocketSize();
+         void UT_CRtpComm_MaxSocketSizeL();
          
     private:
     	static TInt StopScheduler( TAny* aThis );
--- a/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpManager.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpManager.h	Fri Apr 16 15:18:54 2010 +0300
@@ -98,9 +98,9 @@
          void UT_CRtpManager_StartConnectionL();
         
         
-         void UT_CRtpManager_StartConnection_1L();
+         void UT_CRtpManager_StartConnection_OneL();
         
-         void UT_CRtpManager_StartConnection_2L();
+         void UT_CRtpManager_StartConnection_TwoL();
         
          void UT_CRtpManager_CancelStartL();
         
--- a/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSDES.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSDES.h	Fri Apr 16 15:18:54 2010 +0300
@@ -74,7 +74,7 @@
          void UT_CRtpSDES_NewLL();
         
         
-         void UT_CRtpSDES_NewL_1L();
+         void UT_CRtpSDES_NewL_OneL();
         
         
          void UT_CRtpSDES_GetSDESL();
--- a/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSession.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSession.h	Fri Apr 16 15:18:54 2010 +0300
@@ -158,10 +158,10 @@
          void UT_CRtpSession_SendRtpPacketL();
         
         
-         void UT_CRtpSession_SendRtpPacket_1L();
+         void UT_CRtpSession_SendRtpPacket_OneL();
         
         
-         void UT_CRtpSession_SendRtpPacket_2L();
+         void UT_CRtpSession_SendRtpPacket_TwoL();
         
         
          void UT_CRtpSession_SendRtpPacket_3L();
@@ -243,7 +243,7 @@
         
          void UT_CRtpSession_OnExpiredL();
         
-         void UT_CRtpSession_ScheduleRtcpSend();
+         void UT_CRtpSession_ScheduleRtcpSendL();
         
          void UT_CRtpSession_OnRtpReceivedLL();
         
--- a/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSessionSRTP.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpSessionSRTP.h	Fri Apr 16 15:18:54 2010 +0300
@@ -158,19 +158,19 @@
         
          void UT_CRtpSessionSrtp_SendRtpPacket1L(  );
         
-         void UT_CRtpSessionSrtp_SendRtpPacket_1L();
-         void UT_CRtpSessionSrtp_SendRtpPacket_1AL(  );
+         void UT_CRtpSessionSrtp_SendRtpPacket_OneL();
+         void UT_CRtpSessionSrtp_SendRtpPacket_OneAL(  );
         
          void UT_CRtpSessionSrtp_SendRtpPacket_2L();
-         void UT_CRtpSessionSrtp_SendRtpPacket_2AL();
+         void UT_CRtpSessionSrtp_SendRtpPacket_TwoAL();
         
         
          void UT_CRtpSessionSrtp_OnRtpReceivedL();
          
-         void UT_CRtpSessionSrtp_OnRtpReceived_1L(  );
-         void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendSRTCPReport();
+         void UT_CRtpSessionSrtp_OnRtpReceived_OneL(  );
+         void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendSRTCPReportL();
 	
-		void UT_CRtpSessionSrtp_OnRtcpReceived();
+		void UT_CRtpSessionSrtp_OnRtcpReceivedL();
 	
         
 
--- a/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpStream.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/inc/UT_CRtpStream.h	Fri Apr 16 15:18:54 2010 +0300
@@ -129,16 +129,16 @@
         
          void UT_CRtpStream_RtpStreamCreateRtcpReportSectionL();
         
-         void UT_CRtpStream_UpdateParam();
+         void UT_CRtpStream_UpdateParamL();
          	
-         void UT_CRtpStream_RtpByeAppMethods();
+         void UT_CRtpStream_RtpByeAppMethodsL();
          
-         void UT_CRtpStream_TestRtpSRMethods();
+         void UT_CRtpStream_TestRtpSRMethodsL();
          
-         void UT_CRtpStream_TestRtpRRMethods();
+         void UT_CRtpStream_TestRtpRRMethodsL();
          
          void UT_CRtpStream_TestStreamStatAndSdesMethods();
-         void UT_CRtpStream_RtpStreamProcessRtpPacket();
+         void UT_CRtpStream_RtpStreamProcessRtpPacketL();
          
          void Hex(HBufC8& aString);
 
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpAPI.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpAPI.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -140,10 +140,12 @@
     {
     iRtpAPI->Close();
     delete iRtpAPI;
+	iRtpAPI = NULL;
 
     iStpAPI->Close();
     delete iStpAPI;
-    }
+    iStpAPI = NULL;
+	}
 
 void UT_CRtpAPI::UT_CRtpAPI_NewLL(  )
     {
@@ -194,7 +196,7 @@
 	iRtpAPI->CancelStart();
     }
 
-void UT_CRtpAPI::UT_CRtpAPI_StartConnection_1L(  )
+void UT_CRtpAPI::UT_CRtpAPI_StartConnection_OneL(  )
     {
     //Synchronize
     TInt result(KErrNone);
@@ -980,7 +982,7 @@
     EUNIT_ASSERT( KErrNone == status.Int() );
 	}
 
-void UT_CRtpAPI::UT_CRtpAPI_SendRtpPacket_3L()
+void UT_CRtpAPI::UT_CRtpAPI_SendRtpPacket_ThreeL()
     {
     TInt result(KErrNone);
     TRtpSdesParams params;
@@ -1502,7 +1504,7 @@
     "CRtpAPI",
     "StartConnection",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpAPI_StartConnection_1L, Teardown)
+    SetupL, UT_CRtpAPI_StartConnection_OneL, Teardown)
 
 EUNIT_TEST(
     "CancelStart - test ",
@@ -1656,7 +1658,7 @@
     "CRtpAPI",
     "SendRtpPacket",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpAPI_SendRtpPacket_3L, Teardown)
+    SetupL, UT_CRtpAPI_SendRtpPacket_ThreeL, Teardown)
 
 EUNIT_TEST(
     "SendDataL - test ",
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpComm.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpComm.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -604,7 +604,7 @@
     delete iRtpComm; iRtpComm=NULL;
     }
 
-void UT_CRtpComm::UT_CRtpComm_MaxSocketSize()
+void UT_CRtpComm::UT_CRtpComm_MaxSocketSizeL()
     {
     TCreateSessionParams params;
     params.iSocketBufSize = 10000;
@@ -804,7 +804,7 @@
     "CRtpComm",
     "MaxSocketSize",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpComm_MaxSocketSize, Teardown)
+    SetupL, UT_CRtpComm_MaxSocketSizeL, Teardown)
     
 EUNIT_END_TEST_TABLE
 
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpManager.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpManager.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -174,7 +174,7 @@
     iRtpManager->Close();
     }
 
-void UT_CRtpManager::UT_CRtpManager_StartConnection_1L(  )
+void UT_CRtpManager::UT_CRtpManager_StartConnection_OneL(  )
     {
     TInt result(KErrNone);
     TRtpSdesParams params;
@@ -186,7 +186,7 @@
     iRtpManager->Close();
     }
 
-void UT_CRtpManager::UT_CRtpManager_StartConnection_2L(  )
+void UT_CRtpManager::UT_CRtpManager_StartConnection_TwoL(  )
     {
     TInt result(KErrNone);
     TRtpSdesParams params;
@@ -937,7 +937,7 @@
     "CRtpManager",
     "StartConnection 1",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpManager_StartConnection_1L, Teardown)
+    SetupL, UT_CRtpManager_StartConnection_OneL, Teardown)
 
 
 EUNIT_TEST(
@@ -945,7 +945,7 @@
     "CRtpManager",
     "StartConnection2",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpManager_StartConnection_2L, Teardown)
+    SetupL, UT_CRtpManager_StartConnection_TwoL, Teardown)
 
 EUNIT_TEST(
     "CancelStart - test ",
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpPacket.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpPacket.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -172,7 +172,12 @@
 	delete iPktSnd;
     delete iPktRtcpSnd;
     delete iTooLongData;
-    }
+    
+	iPktSnd = NULL;
+	iPktRtcpSnd = NULL;
+	iTooLongData = NULL;
+	
+	}
 
 void UT_CRtpPacket::UT_CRtpPacket_NewLL(  )
     {
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSDES.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSDES.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -121,7 +121,7 @@
     
     }
 
-void UT_CRtpSDES::UT_CRtpSDES_NewL_1L(  )
+void UT_CRtpSDES::UT_CRtpSDES_NewL_OneL(  )
     {
     TInt result( KErrNone );
     TBuf8<16> cName;
@@ -419,7 +419,7 @@
     "CRtpSDES",
     "NewL",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSDES_NewL_1L, Teardown)
+    SetupL, UT_CRtpSDES_NewL_OneL, Teardown)
 
 EUNIT_TEST(
     "GetSDES - test ",
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSession.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSession.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -1012,7 +1012,7 @@
     iSession->iCommNet->iSender[ERTPPort]->iStatus = TRequestStatus();
     }
 
-void UT_CRtpSession::UT_CRtpSession_SendRtpPacket_1L(  )
+void UT_CRtpSession::UT_CRtpSession_SendRtpPacket_OneL(  )
     {
     TCreateSessionParams sessionParams;
     TRtcpParams rtcpParams;
@@ -1082,7 +1082,7 @@
   
     }
 
-void UT_CRtpSession::UT_CRtpSession_SendRtpPacket_2L(  )
+void UT_CRtpSession::UT_CRtpSession_SendRtpPacket_TwoL(  )
     {
     TInt error( KErrNone );
 
@@ -2275,7 +2275,7 @@
     
     // "CRtpSession::OnExpired() - passed" ) );
     }
-void UT_CRtpSession::UT_CRtpSession_ScheduleRtcpSend()
+void UT_CRtpSession::UT_CRtpSession_ScheduleRtcpSendL()
     {
     //"") );
     // "Test description: Test scheduling RTCP transmission" ) );
@@ -3287,7 +3287,7 @@
     "CRtpSession",
     "SendRtpPacket",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSession_SendRtpPacket_1L, Teardown)
+    SetupL, UT_CRtpSession_SendRtpPacket_OneL, Teardown)
 */
 
 EUNIT_TEST(
@@ -3295,7 +3295,7 @@
     "CRtpSession",
     "SendRtpPacket",
     "FUNCTIONALITY",
-    Setup2L, UT_CRtpSession_SendRtpPacket_2L, Teardown)
+    Setup2L, UT_CRtpSession_SendRtpPacket_TwoL, Teardown)
 
 EUNIT_TEST(
     "SendRtpPacket3 - test ",
@@ -3448,7 +3448,7 @@
     "CRtpSession",
     "ScheduleRtcpSend",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSession_ScheduleRtcpSend, Teardown)
+    SetupL, UT_CRtpSession_ScheduleRtcpSendL, Teardown)
     
 
 EUNIT_TEST(
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSessionSRTP.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpSessionSRTP.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -521,14 +521,29 @@
     delete iTestMKI128Bits;
     delete iTestAuthTag80Bits;
 
+	iDecryptedPayload = NULL;
+    iTestPayload160Bits = NULL;
+    iTestMKI128Bits = NULL;
+    iTestAuthTag80Bits = NULL;
+	
     delete iStreamIn;
     delete iStreamOut;
     delete iSRTPSession;    
-
+    
+	iStreamIn = NULL;
+    iStreamOut = NULL;
+    iSRTPSession = NULL;
+	
     delete iRFC3711_SessionEncrKey128bits;
     delete iRFC3711_SessionSaltKey128bits;
     delete iRFC3711_SessionAuthKey128bits;    
-    iRFC3711_TestMasterKey128bits.Zero();
+    
+	iRFC3711_SessionEncrKey128bits = NULL;
+    iRFC3711_SessionSaltKey128bits = NULL;
+    iRFC3711_SessionAuthKey128bits = NULL;   
+	
+	
+	iRFC3711_TestMasterKey128bits.Zero();
     iRFC3711_TestMasterSalt112bits.Zero();
     iMKI.Zero();
 
@@ -647,7 +662,7 @@
  	RTP_EUNIT_ASSERT_EQUALS(status, KErrNone)
     }
 
-void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_1L(  )
+void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_OneL(  )
     {
     //Test more branch
        TInt error( KErrNone );
@@ -683,7 +698,7 @@
  	RTP_EUNIT_ASSERT_EQUALS(status, KErrNone)
     }
  
-void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_1AL(  )
+void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_OneAL(  )
     {
        TInt error( KErrNone );
 
@@ -757,7 +772,7 @@
  	
     }
   
-  void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_2AL(  )
+  void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendRtpPacket_TwoAL(  )
     {
        TInt error( KErrNone );
 
@@ -871,7 +886,7 @@
     
     }
     
-void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_OnRtpReceived_1L(  )
+void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_OnRtpReceived_OneL(  )
     {
     
     //cover more branch
@@ -922,7 +937,7 @@
     
     }    
 
-void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendSRTCPReport()
+void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_SendSRTCPReportL()
 	{
 	TInt error( KErrNone );
 	TRtpSSRC ssrcOut( 1234 );
@@ -990,7 +1005,7 @@
 	
 	}
 	
-void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_OnRtcpReceived()
+void UT_CRtpSessionSrtp::UT_CRtpSessionSrtp_OnRtcpReceivedL()
 	{
 	HBufC8* encSrtcpPacket =HBufC8::NewLC(KRTCPPacket().Length());
 	*encSrtcpPacket=KRTCPPacket;
@@ -1104,14 +1119,14 @@
     "CRtpSessionSrtp",
     "SendRtpPacket",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSessionSrtp_SendRtpPacket_1L, Teardown)
+    SetupL, UT_CRtpSessionSrtp_SendRtpPacket_OneL, Teardown)
 
 EUNIT_TEST(
     "SendRtpPacket4 - test ",
     "CRtpSessionSrtp",
     "SendRtpPacket",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSessionSrtp_SendRtpPacket_1AL, Teardown)
+    SetupL, UT_CRtpSessionSrtp_SendRtpPacket_OneAL, Teardown)
 
 EUNIT_TEST(
     "SendRtpPacket5 - test ",
@@ -1125,7 +1140,7 @@
     "CRtpSessionSrtp",
     "SendRtpPacket",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSessionSrtp_SendRtpPacket_2AL, Teardown)
+    SetupL, UT_CRtpSessionSrtp_SendRtpPacket_TwoAL, Teardown)
 
 EUNIT_TEST(
     "OnRtpReceived1 - test ",
@@ -1139,20 +1154,20 @@
     "CRtpSessionSrtp",
     "OnRtpReceived",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSessionSrtp_OnRtpReceived_1L, Teardown)
+    SetupL, UT_CRtpSessionSrtp_OnRtpReceived_OneL, Teardown)
 
 EUNIT_TEST(
     "SendSRTCPReport ",
     "CRtpSessionSrtp",
     "SendSRTCPReport",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSessionSrtp_SendSRTCPReport, Teardown)
+    SetupL, UT_CRtpSessionSrtp_SendSRTCPReportL, Teardown)
 EUNIT_TEST(
     "OnRtcpReceived ",
     "CRtpSessionSrtp",
     "OnRtcpReceived",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpSessionSrtp_OnRtcpReceived, Teardown)
+    SetupL, UT_CRtpSessionSrtp_OnRtcpReceivedL, Teardown)
 
   
 EUNIT_END_TEST_TABLE
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpStpPacket.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpStpPacket.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -75,10 +75,8 @@
 void UT_CRtpStpPacket::SetupL(  )
     {
  	iRtpStpPacket = new(ELeave) CRtpStpPacket();
-        
-    CleanupStack::PushL(iRtpStpPacket);
     iRtpStpPacket->ConstructL( KMaxRtpPacketSize, 1 );
-    CleanupStack::Pop();
+
     }
 
 void UT_CRtpStpPacket::Teardown(  )
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpStream.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpStream.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -123,6 +123,9 @@
     {
     delete iRecvStream;
     delete iTranStream;
+	
+	iRecvStream = NULL;
+    iTranStream = NULL;
     }
 
 void UT_CRtpStream::UT_CRtpStream_ResetStreamStatL(  )
@@ -885,7 +888,7 @@
     CleanupStack::PopAndDestroy( packet );
     }
     
-void UT_CRtpStream::UT_CRtpStream_UpdateParam()
+void UT_CRtpStream::UT_CRtpStream_UpdateParamL()
     {
   
     // "Test description: Test update of statistics" ) );
@@ -964,7 +967,7 @@
     EUNIT_ASSERT(ETrue);
     }    
 
-void UT_CRtpStream::UT_CRtpStream_RtpByeAppMethods()
+void UT_CRtpStream::UT_CRtpStream_RtpByeAppMethodsL()
     {
     //"") );
     // "Test description: Test creating a BYE packet" ) );
@@ -1023,7 +1026,7 @@
   	EUNIT_ASSERT(ETrue);
     }
  
-void UT_CRtpStream::UT_CRtpStream_TestRtpSRMethods()
+void UT_CRtpStream::UT_CRtpStream_TestRtpSRMethodsL()
     {
     //"") );
     // "Test description: Test creating and parsing an SR packet" ) );
@@ -1106,7 +1109,7 @@
     EUNIT_ASSERT(ETrue);
     }  
     
-void UT_CRtpStream::UT_CRtpStream_TestRtpRRMethods()
+void UT_CRtpStream::UT_CRtpStream_TestRtpRRMethodsL()
     {
     //"") );
     // "Test description: Test creating and parsing an RR packet" ) );
@@ -1314,7 +1317,7 @@
     EUNIT_ASSERT(ETrue);
     }
 
-void UT_CRtpStream::UT_CRtpStream_RtpStreamProcessRtpPacket()
+void UT_CRtpStream::UT_CRtpStream_RtpStreamProcessRtpPacketL()
 	{
 	TInt result(KErrNone);
 	TInt error(KErrNone);
@@ -1542,27 +1545,27 @@
     "CRtpStream",
     "UT_CRtpStream_UpdateParam",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpStream_UpdateParam, Teardown)    
+    SetupL, UT_CRtpStream_UpdateParamL, Teardown)    
 EUNIT_TEST(
     "RtpByeAppMethods",
     "CRtpStream",
     "RtpByeAppMethods",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpStream_RtpByeAppMethods, Teardown)     
+    SetupL, UT_CRtpStream_RtpByeAppMethodsL, Teardown)     
 
 EUNIT_TEST(
     "TestRtpSRMethods",
     "CRtpStream",
     "TestRtpSRMethods",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpStream_TestRtpSRMethods, Teardown)    
+    SetupL, UT_CRtpStream_TestRtpSRMethodsL, Teardown)    
 
 EUNIT_TEST(
     "TestRtpRRMethods",
     "CRtpStream",
     "TestRtpRRMethods",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpStream_TestRtpRRMethods, Teardown)   
+    SetupL, UT_CRtpStream_TestRtpRRMethodsL, Teardown)   
 
 EUNIT_TEST(
     "TestRtpRRMethods",
@@ -1575,7 +1578,7 @@
     "CRtpStream",
     "RtpStreamProcessRtpPacket",
     "FUNCTIONALITY",
-    SetupL, UT_CRtpStream_RtpStreamProcessRtpPacket, Teardown)      
+    SetupL, UT_CRtpStream_RtpStreamProcessRtpPacketL, Teardown)      
     
 
 
--- a/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpTranStream.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/src/UT_CRtpTranStream.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -139,6 +139,7 @@
 void UT_CRtpTranStream::Teardown(  )
     {
  	delete iTranStream;
+    iTranStream = NULL;
     }
 
 void UT_CRtpTranStream::UT_CRtpTranStream_NewLL(  )
--- a/rtp/rtpstack/tsrc/ut_rtpstack/stubs/inc/es_sock.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/rtpstack/tsrc/ut_rtpstack/stubs/inc/es_sock.h	Fri Apr 16 15:18:54 2010 +0300
@@ -1216,7 +1216,7 @@
 	TUint32 iReserved[4];
 	};
 
-class CSubConParameterSet : public SMetaDataECom
+class CSubConParameterSet : public CBase, public SMetaDataECom
 /** Base class for all RSubConnection parameter sets.
 
 @publishedAll
@@ -1408,7 +1408,7 @@
 	IMPORT_C TUint32 Id() const;
 	};
 
-class CSubConNotificationEvent : public SMetaDataECom
+class CSubConNotificationEvent : public CBase, public SMetaDataECom
 	{
 public:
 	IMPORT_C static CSubConNotificationEvent* NewL(const STypeId& aTypeId);
--- a/rtp/srtpstack/inc/srtpaesctrcrypto.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/inc/srtpaesctrcrypto.h	Fri Apr 16 15:18:54 2010 +0300
@@ -23,6 +23,7 @@
 
 #include <e32base.h>
 
+class CAESEncryptor;
 
 class CSrtpAESCTRCrypto : public CBase
   	{
@@ -68,9 +69,16 @@
 	*/
 	void IncreaseIV(TDes8& iv);
 	
+	void CreateEncryptorL(const TDesC8& aKey);
+	
+private:
+    
+    HBufC8* iKey;
+    CAESEncryptor* iEncryptor;
+	
 	#ifdef EUNIT_TESTING
         friend class UT_CSrtpAESCTRCrypto;
     #endif     
 	};
 
-#endif // __SrtpAESCTRCrypto_H__
\ No newline at end of file
+#endif // __SrtpAESCTRCrypto_H__
--- a/rtp/srtpstack/inc/srtpauthentication_hmac_sha1.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/inc/srtpauthentication_hmac_sha1.h	Fri Apr 16 15:18:54 2010 +0300
@@ -23,6 +23,8 @@
 
 #include "msrtpauthentication.h"
 
+class CHMAC;
+
 class CSRTPAuthentication_HMAC_SHA1 : public CBase, public MSRTPAuthentication
     {
     public:
@@ -64,7 +66,13 @@
         */
         CSRTPAuthentication_HMAC_SHA1();  
                 
-        void ConstructL();          
+        void ConstructL();  
+        
+        void CreateHmacL(const TDesC8& aKey);
+        
+    private: // data
+        HBufC8* iKey;
+        CHMAC* iHmac;
     };
 
 #endif // __SRTP_AUTHENTICATION_HMAC_SHA1_H__
--- a/rtp/srtpstack/inc/srtpauthentication_rcc.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/inc/srtpauthentication_rcc.h	Fri Apr 16 15:18:54 2010 +0300
@@ -23,6 +23,8 @@
 
 #include "msrtpauthentication.h"
 
+class CHMAC;
+
 class CSrtpAuthentication_RCC : public CBase, public MSRTPAuthentication
     {
     public:
@@ -65,7 +67,13 @@
         */
         CSrtpAuthentication_RCC();  
                 
-        void ConstructL();          
+        void ConstructL();   
+        
+        void CreateHmacL(const TDesC8& aKey);
+        
+    private: // data
+        HBufC8* iKey;
+        CHMAC* iHmac;
     };
 
 #endif //__SRTP_AUTHENTICATION_RCC_H__
--- a/rtp/srtpstack/src/srtpaesctrcrypto.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/src/srtpaesctrcrypto.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -41,6 +41,8 @@
 //
 CSrtpAESCTRCrypto::~CSrtpAESCTRCrypto()
 	{
+	delete iEncryptor;
+	delete iKey;
 	}
 
 
@@ -162,7 +164,6 @@
 	    TBuf8<16> msg; //for a 128-bit piece of a message
 	    TInt count=0; // how many full 128-bit pieces can be made of a source
 	    
-	    CAESEncryptor* encryptor = NULL;
 	    SRTP_DEBUG_TINT_VALUE( "EncryptL, Check aBitLengh ==16 and the length is", 
 	                aKey.Length()  );
 	      
@@ -214,7 +215,10 @@
 	    	User::Leave(KErrArgument);
 	    	}
 
-	    encryptor = CAESEncryptor::NewLC(aKey);
+	    if ( !iEncryptor || !iKey || (*iKey != aKey) )
+	        {
+	        CreateEncryptorL(aKey);
+            }
 	                   
 	    for(int x = 0; x < count; x++)
 	    	{
@@ -222,7 +226,7 @@
 	    	
 	    	data.Copy(iv);
 	    	   	
-	    	encryptor->Transform(data);
+	    	iEncryptor->Transform(data);
 
 	    	IncreaseIV(iv);
 	    	    	
@@ -244,7 +248,7 @@
 	    	
 	    	msg.Copy(aSrc.Mid(count*16, bytesleft));
 	    	data.Copy(iv);
-	    	encryptor->Transform(data);
+	    	iEncryptor->Transform(data);
 	    		
 		    // XOR last piece of message with encrypted IV
 		    for(int i = 0; i < bytesleft; i++)
@@ -256,7 +260,6 @@
 			    		
 	    	}
 		
-		CleanupStack::PopAndDestroy(encryptor);
 	    CleanupStack::Pop(outputBuff);    	    
 	    
 	    return outputBuff;
@@ -302,4 +305,16 @@
 
 	} 
 
-
+// ---------------------------------------------------------------------------
+// CSrtpAESCTRCrypto::CreateEncryptorL
+// ---------------------------------------------------------------------------
+//
+void CSrtpAESCTRCrypto::CreateEncryptorL(const TDesC8& aKey)
+    {
+    delete iEncryptor;
+    iEncryptor = 0;
+    delete iKey;
+    iKey = 0;
+    iKey = aKey.AllocL();
+    iEncryptor = CAESEncryptor::NewL(*iKey);
+    }
--- a/rtp/srtpstack/src/srtpauthentication_hmac_sha1.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/src/srtpauthentication_hmac_sha1.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -77,11 +77,11 @@
 	
     CleanupStack::PushL(result);
 
-    CSHA1* sha1 = CSHA1::NewL(); 
-    CleanupStack::PushL(sha1);
+    if ( !iHmac || !iKey || (*iKey != aKey) )
+        {
+        CreateHmacL(aKey);
+        }
     
-    CHMAC *hmac = CHMAC::NewL(aKey, sha1);        
-    CleanupStack::Pop(sha1);
     CleanupStack::Pop(result);
     
     SRTP_DEBUG_TINT_VALUE( "HMAC INPUT and INPUT Length is ", aAuthPortion.Length() );
@@ -90,18 +90,16 @@
     
     if(aRoc.Length())
     	{
-  		hmac->Update(DES_AS_8_BIT(aAuthPortion));
-    	buf.Copy(hmac->Final(DES_AS_8_BIT(aRoc))); 	
+  		iHmac->Update(DES_AS_8_BIT(aAuthPortion));
+    	buf.Copy(iHmac->Final(DES_AS_8_BIT(aRoc))); 	
     	}
     else
     	{
-    	buf.Copy(hmac->Final(DES_AS_8_BIT(aAuthPortion)));
+    	buf.Copy(iHmac->Final(DES_AS_8_BIT(aAuthPortion)));
     	}
     *result = buf;    
     ptrOutputBuff.SetLength(aBitLength/8);
     
-    delete hmac;
-    
    	SRTP_DEBUG_DETAIL( "HMAC caculated Authentication tag");
     SRTP_DEBUG_PACKET( *result );    
     SRTP_DEBUG_DETAIL( "CSRTPAuthentication_HMAC_SHA1::AuthenticateL Exit" );
@@ -124,7 +122,9 @@
 // ---------------------------------------------------------------------------
 //
 CSRTPAuthentication_HMAC_SHA1::~CSRTPAuthentication_HMAC_SHA1()
-    {    
+    {   
+    delete iHmac;
+    delete iKey;
     }
 
 // ---------------------------------------------------------------------------
@@ -136,3 +136,19 @@
         
     }
 
+// ---------------------------------------------------------------------------
+// CSRTPAuthentication_HMAC_SHA1::CreateHmacL
+// ---------------------------------------------------------------------------
+//
+void CSRTPAuthentication_HMAC_SHA1::CreateHmacL(const TDesC8& aKey)
+    {
+    delete iHmac;
+    iHmac = 0;
+    delete iKey;
+    iKey = 0;
+    iKey = aKey.AllocL();
+    CSHA1* sha1 = CSHA1::NewL(); 
+    CleanupStack::PushL(sha1);
+    iHmac = CHMAC::NewL(*iKey, sha1);        
+    CleanupStack::Pop(sha1);
+    }
--- a/rtp/srtpstack/src/srtpauthentication_rcc.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/src/srtpauthentication_rcc.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -77,11 +77,11 @@
 	
     CleanupStack::PushL(result);
 
-    CSHA1* sha1 = CSHA1::NewL(); 
-    CleanupStack::PushL(sha1);
-    
-    CHMAC *hmac = CHMAC::NewL(aKey, sha1);        
-    CleanupStack::Pop(sha1);
+    if ( !iHmac || !iKey || (*iKey != aKey) )
+        {
+        CreateHmacL(aKey);
+        }
+   
     CleanupStack::Pop(result);
     SRTP_DEBUG_TINT_VALUE( "HMAC INPUT and INPUT Length is ", aAuthPortion.Length());
     SRTP_DEBUG_TINT_VALUE( "HMAC INPUT and INPUT Size is ", aAuthPortion.Size());     
@@ -89,17 +89,16 @@
               
     if(aRoc.Length())
     	{
-  		hmac->Update(DES_AS_8_BIT(aAuthPortion));
-    	buf.Copy(hmac->Final(DES_AS_8_BIT(aRoc))); 	
+  		iHmac->Update(DES_AS_8_BIT(aAuthPortion));
+    	buf.Copy(iHmac->Final(DES_AS_8_BIT(aRoc))); 	
     	}
     else
     	{
-    	buf.Copy(hmac->Final(DES_AS_8_BIT(aAuthPortion)));
+    	buf.Copy(iHmac->Final(DES_AS_8_BIT(aAuthPortion)));
     	}
     *result = buf;    
     ptrOutputBuff.SetLength(aBitLength/8);
     
-    delete hmac;
    	SRTP_DEBUG_DETAIL( "HMAC caculated Authentication tag" );
    	SRTP_DEBUG_PACKET( *result );    
     
@@ -124,6 +123,8 @@
 //
 CSrtpAuthentication_RCC::~CSrtpAuthentication_RCC()
     {    
+    delete iHmac;
+    delete iKey;
     }
 
 // ---------------------------------------------------------------------------
@@ -135,3 +136,20 @@
         
     }
 
+// ---------------------------------------------------------------------------
+// CSrtpAuthentication_RCC::CreateHmacL
+// ---------------------------------------------------------------------------
+//
+void CSrtpAuthentication_RCC::CreateHmacL(const TDesC8& aKey)
+    {
+    delete iHmac;
+    iHmac = 0;
+    delete iKey;
+    iKey = 0;
+    iKey = aKey.AllocL();
+    CSHA1* sha1 = CSHA1::NewL(); 
+    CleanupStack::PushL(sha1);
+    iHmac = CHMAC::NewL(*iKey, sha1);        
+    CleanupStack::Pop(sha1);
+    }
+
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCipherAESCM128.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCipherAESCM128.h	Fri Apr 16 15:18:54 2010 +0300
@@ -71,6 +71,8 @@
          void UT_EncryptL_EncryptData3L();
 
          void UT_EncryptL_EncryptData4L();
+         
+         void UT_EncryptL_EncryptDataKeyChangesL();
 
          void UT_EncryptL_DecryptDataL();
          
@@ -79,6 +81,8 @@
          void UT_EncryptL_DecryptData3L();
          
          void UT_EncryptL_DecryptData4L();
+         
+         void UT_EncryptL_DecryptDataKeyChangesL();
 
          void UT_EncryptL_ErrorTest1L();
                   
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoContext.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoContext.h	Fri Apr 16 15:18:54 2010 +0300
@@ -111,7 +111,7 @@
          
          void TestSetRCCm3SyncL();
          
-         void TestIsValid();
+         void TestIsValidL();
 
     private:    // Data
         //TBuf8<32>       iSalt;
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoHandlerSRTCP.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoHandlerSRTCP.h	Fri Apr 16 15:18:54 2010 +0300
@@ -81,7 +81,7 @@
          void UT_CSRTPCryptoHandlerSRTCP_NewLCL();
         
         
-         void UT_DeriveSessionKeysL_1L();
+         void UT_DeriveSessionKeysL_OneL();
          
          
          void UT_PerformAuthenticationLL();         
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoHandlerSRTP.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPCryptoHandlerSRTP.h	Fri Apr 16 15:18:54 2010 +0300
@@ -109,7 +109,7 @@
          HBufC8* BuildPacketL(TBool aSrtp, TPayloadDetails& details);
                   
                   
-         void UT_DeriveSessionKeysL_1L();
+         void UT_DeriveSessionKeysL_OneL();
          
 
          void UT_UpdateROCL();         
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPKeyDerivation_AESCM128.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPKeyDerivation_AESCM128.h	Fri Apr 16 15:18:54 2010 +0300
@@ -75,7 +75,7 @@
 
          void UT_RFC3711_Session_Auth_Key_TestL();
 
-        void UT_ErronousInput_1L();
+        void UT_ErronousInput_OneL();
          
         void UT_ErronousInput_2L();
          
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPSession.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPSession.h	Fri Apr 16 15:18:54 2010 +0300
@@ -79,10 +79,10 @@
         
          void Teardown();
         
-         void UT_CSRTPSession_NewL_1L();
+         void UT_CSRTPSession_NewL_OneL();
         
         
-         void UT_CSRTPSession_NewL_2L();
+         void UT_CSRTPSession_NewL_TwoL();
         
         
          void UT_CSRTPSession_RemoveStreamL();
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStream.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStream.h	Fri Apr 16 15:18:54 2010 +0300
@@ -101,8 +101,8 @@
          void UT_CSRTPStream_GetCryptoContextL();
          void UT_CSRTPStream_SetSSRCL(  );
          void Hex(HBufC8& aString);    
-         void UT_CSRTPStream_ReKeyNeeded_1L(  );
-         void UT_CSRTPStream_ReKeyNeeded_2L(  );
+         void UT_CSRTPStream_ReKeyNeeded_OneL(  );
+         void UT_CSRTPStream_ReKeyNeeded_TwoL(  );
          void UT_CSRTPStream_TestNewL(  );
          void UT_CSRTPStream_IsContextSetL();
 
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStreamIn.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStreamIn.h	Fri Apr 16 15:18:54 2010 +0300
@@ -100,10 +100,10 @@
         
          void Teardown();
         
-         void UT_CSRTPStreamIn_NewL_1L();
-         void UT_CSRTPStreamIn_NewL_2L();
-         void UT_CSRTPStreamIn_NewL_3L();
-         void UT_CSRTPStreamIn_NewL_4L();
+         void UT_CSRTPStreamIn_NewL_OneL();
+         void UT_CSRTPStreamIn_NewL_TwoL();
+         void UT_CSRTPStreamIn_NewL_ThreeL();
+         void UT_CSRTPStreamIn_NewL_FourL();
         
         
          void UT_CSRTPStreamIn_UnprotectSrtpLL();
@@ -115,7 +115,7 @@
          void UT_CSRTPStreamIn_StateTestsL();
 	 	 void UT_CSRTPStreamIn_StateTests2L();
          HBufC8* BuildPacketL(TBool aSrtp, TPayloadDetails& details);    
-         void UT_CSRTPStreamIn_NewL_5L(  );
+         void UT_CSRTPStreamIn_NewL_FiveL(  );
          void UT_CSRTPStreamIn_SetCryptoInL(  );
 
          void Hex(HBufC8& aString);             
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStreamOut.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSRTPStreamOut.h	Fri Apr 16 15:18:54 2010 +0300
@@ -96,12 +96,12 @@
         
          void Teardown();
         
-         void UT_CSRTPStreamOut_NewL_1L();
+         void UT_CSRTPStreamOut_NewL_OneL();
         
         
-         void UT_CSRTPStreamOut_NewL_2L();
+         void UT_CSRTPStreamOut_NewL_TwoL();
         
-         void UT_CSRTPStreamOut_NewL_3L(  );
+         void UT_CSRTPStreamOut_NewL_ThreeL(  );
          
          void UT_CSRTPStreamOut_SetCryptoOutLL(  );
          
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSrtpAuthentication_RCC.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_CSrtpAuthentication_RCC.h	Fri Apr 16 15:18:54 2010 +0300
@@ -79,21 +79,23 @@
         
          void UT_CSrtpAuthentication_RCC_AuthenticateLL();
          void Hex(HBufC8& aString);
-         void UT_AuthenticateL_RFC2202_Test1_80L();
-         void UT_AuthenticateL_RFC2202_Test1_32L();
-         void UT_AuthenticateL_RFC2202_Test2_80L();
-         void UT_AuthenticateL_RFC2202_Test2_32L();
-         void UT_AuthenticateL_RFC2202_Test3_80L();
-         void UT_AuthenticateL_RFC2202_Test3_32L();
-         void UT_AuthenticateL_RFC2202_Test4_80L();
-         void UT_AuthenticateL_RFC2202_Test4_32L();
-         void UT_AuthenticateL_RFC2202_Test5_80L();
-         void UT_AuthenticateL_RFC2202_Test5_32L();
-         void UT_AuthenticateL_RFC2202_Test6_80L();
-         void UT_AuthenticateL_RFC2202_Test6_32L();
-         void UT_AuthenticateL_RFC2202_Test7_80L();
-         void UT_AuthenticateL_RFC2202_Test7_32L();
-         void UT_AuthenticateL_Test8_32L(  );
+         void UT_AuthenticateL_RFC2202_Test1_EightyL();
+         void UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test2_EightyL();
+         void UT_AuthenticateL_RFC2202_Test2_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test3_EightyL();
+         void UT_AuthenticateL_RFC2202_Test3_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test4_EightyL();
+         void UT_AuthenticateL_RFC2202_Test4_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test5_EightyL();
+         void UT_AuthenticateL_RFC2202_Test5_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test6_EightyL();
+         void UT_AuthenticateL_RFC2202_Test6_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test7_EightyL();
+         void UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL();
+         void UT_AuthenticateL_Test8_ThirtyTwoL(  );
+         void UT_AuthenticateL_Test_KeyChangedL();
+         
     private:    // Data
 
         CSrtpAuthentication_RCC* iAuthenticator;    
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_SRTPAuthentication_HMAC_SHA1.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_SRTPAuthentication_HMAC_SHA1.h	Fri Apr 16 15:18:54 2010 +0300
@@ -67,21 +67,22 @@
         
          void Teardown();
         
-         void UT_AuthenticateL_RFC2202_Test1_80L();
-         void UT_AuthenticateL_RFC2202_Test1_32L();
-         void UT_AuthenticateL_RFC2202_Test2_80L();
-         void UT_AuthenticateL_RFC2202_Test2_32L();
-         void UT_AuthenticateL_RFC2202_Test3_80L();
-         void UT_AuthenticateL_RFC2202_Test3_32L();
-         void UT_AuthenticateL_RFC2202_Test4_80L();
-         void UT_AuthenticateL_RFC2202_Test4_32L();
-         void UT_AuthenticateL_RFC2202_Test5_80L();
-         void UT_AuthenticateL_RFC2202_Test5_32L();
-         void UT_AuthenticateL_RFC2202_Test6_80L();
-         void UT_AuthenticateL_RFC2202_Test6_32L();
-         void UT_AuthenticateL_RFC2202_Test7_80L();
-         void UT_AuthenticateL_RFC2202_Test7_32L();
-         void UT_AuthenticateL_Test8_32L(  );
+         void UT_AuthenticateL_RFC2202_Test1_EightyL();
+         void UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test2_EightyL();
+         void UT_AuthenticateL_RFC2202_Test2_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test3_EightyL();
+         void UT_AuthenticateL_RFC2202_Test3_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test4_EightyL();
+         void UT_AuthenticateL_RFC2202_Test4_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test5_EightyL();
+         void UT_AuthenticateL_RFC2202_Test5_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test6_EightyL();
+         void UT_AuthenticateL_RFC2202_Test6_ThirtyTwoL();
+         void UT_AuthenticateL_RFC2202_Test7_EightyL();
+         void UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL();
+         void UT_AuthenticateL_Test8_ThirtyTwoL(  );
+         void UT_AuthenticateL_Test_KeyChangedL();
          
          void Hex(HBufC8& aString);                                  
 
--- a/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_SRTPAuthentication_NULL.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/inc/UT_SRTPAuthentication_NULL.h	Fri Apr 16 15:18:54 2010 +0300
@@ -67,7 +67,7 @@
         
          void Teardown();
         
-         void UT_AuthenticateL_RFC2202_Test1_80L();
+         void UT_AuthenticateL_RFC2202_Test1_EightyL();
          
          void Hex(HBufC8& aString);                                  
 
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCipherAESCM128.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCipherAESCM128.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -23,6 +23,7 @@
 
 //  EXTERNAL INCLUDES
 #include <digia/eunit/eunitmacros.h>
+#include <e32debug.h>
 
 //  INTERNAL INCLUDES
 #include "srtpcipher_aescm128.h"
@@ -212,7 +213,7 @@
     EUNIT_ASSERT( result->Compare(*iRFC3686_TestCipherT256bits) == 0);
 
  	CleanupStack::Pop(result); 	
- 	delete result;    
+ 	delete result;
     }
 
 void UT_CSRTPCipherAESCM128::UT_EncryptL_EncryptData3L(  )
@@ -243,6 +244,12 @@
  	delete result;    
     }
 
+void UT_CSRTPCipherAESCM128::UT_EncryptL_EncryptDataKeyChangesL(  )
+    {
+    UT_EncryptL_EncryptDataL();
+    UT_EncryptL_EncryptData2L();
+    }
+
 void UT_CSRTPCipherAESCM128::UT_EncryptL_DecryptDataL(  )
     {
  	HBufC8* result = iEncryptor->TransformL(*iRFC3686_TestKey128bits, 
@@ -254,7 +261,7 @@
     EUNIT_ASSERT( result->Compare(*iRFC3686_TestPlainT128bits) == 0);
 
  	CleanupStack::Pop(result); 	
- 	delete result;    
+ 	delete result; 
     }
 
 void UT_CSRTPCipherAESCM128::UT_EncryptL_DecryptData2L(  )
@@ -299,6 +306,12 @@
  	delete result;    
     }
 
+void UT_CSRTPCipherAESCM128::UT_EncryptL_DecryptDataKeyChangesL(  )
+    {
+    UT_EncryptL_DecryptDataL();
+    UT_EncryptL_DecryptData2L();
+    }
+
 void UT_CSRTPCipherAESCM128::UT_EncryptL_ErrorTest1L(  )
     {	
     TInt err = KErrNone;
@@ -417,6 +430,13 @@
     SetupL, UT_EncryptL_EncryptData4L, Teardown)
 
 EUNIT_TEST(
+    "EncryptL encrypt data, key changes",
+    "CSRTPCipherAESCM128",
+    "EncryptL",
+    "FUNCTIONALITY",
+    SetupL, UT_EncryptL_EncryptDataKeyChangesL, Teardown)
+    
+EUNIT_TEST(
     "EncryptL decrypt data",
     "CSRTPCipherAESCM128",
     "EncryptL",
@@ -443,6 +463,13 @@
     "EncryptL",
     "FUNCTIONALITY",
     SetupL, UT_EncryptL_DecryptData4L, Teardown)
+    
+EUNIT_TEST(
+    "EncryptL decrypt data, key changes",
+    "CSRTPCipherAESCM128",
+    "EncryptL",
+    "FUNCTIONALITY",
+    SetupL, UT_EncryptL_DecryptDataKeyChangesL, Teardown)
 
 EUNIT_TEST(
     "EncryptL error 1",
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoContext.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoContext.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -228,6 +228,12 @@
     delete iSRTPSession; 
 	
     delete iContext2;
+	
+	iStreamIn = NULL;
+    iStreamOut = NULL; 
+    iSRTPSession = NULL; 
+	
+    iContext2 = NULL;
     			
     }
 
@@ -250,22 +256,22 @@
 
     TSrtpCryptoParams params;
     //test constructL  
-    iMasterKey3 = CSRTPMasterKey::NewLC( *masterKey3, *mki3,
+    iMasterKey3 = CSRTPMasterKey::NewL( *masterKey3, *mki3,
     							    KSRTPDefSessionEncryptionKeyLength, 
     							    KSRTPDefSessionAuthenticationKeyLength );
     iMasterSalt3 = CSRTPMasterSalt::NewL( *masterSalt3, 1100 );
-    CleanupStack::Pop( iMasterKey3 );
+   
     CleanupStack::PopAndDestroy( mki3 );
 	
     CleanupStack::PopAndDestroy( masterSalt3 );
     CleanupStack::PopAndDestroy( masterKey3 ); 
-    CleanupStack::PushL( iMasterKey3 );
-    CleanupStack::PushL( iMasterSalt3 );
+    
+  
     params.iSrtcpAuthTagLen=80;
    	RTP_EUNIT_ASSERT_SPECIFIC_LEAVE( iContext3= CSRTPCryptoContext::NewL(iMasterKey3,iMasterSalt3, params ),
    		 KErrArgument );
-   	CleanupStack::Pop( iMasterSalt3 );
-    CleanupStack::Pop( iMasterKey3 );
+   	
+  
    	delete iContext3;	 
    	
     }
@@ -288,25 +294,20 @@
  
 
     TSrtpCryptoParams params;
-   	iMasterKey3 = CSRTPMasterKey::NewLC( *masterKey3, *mki3,
+   	iMasterKey3 = CSRTPMasterKey::NewL( *masterKey3, *mki3,
     							    KSRTPDefSessionEncryptionKeyLength, 
     							    KSRTPDefSessionAuthenticationKeyLength );
     iMasterSalt3 = CSRTPMasterSalt::NewL( *masterSalt3, 1100 );
-    CleanupStack::Pop( iMasterKey3 );
+   
     CleanupStack::PopAndDestroy( mki3 );
 	CleanupStack::PopAndDestroy( masterSalt3 );
     CleanupStack::PopAndDestroy( masterKey3 ); 
     
     params.iSrtcpAuthTagLen=80;
-    
-    CleanupStack::PushL( iMasterKey3 );
-    CleanupStack::PushL( iMasterSalt3 );
-   	RTP_EUNIT_ASSERT_SPECIFIC_LEAVE( iContext3= CSRTPCryptoContext::NewL(iMasterKey3,iMasterSalt3, params ),
+    RTP_EUNIT_ASSERT_SPECIFIC_LEAVE( iContext3= CSRTPCryptoContext::NewL(iMasterKey3,iMasterSalt3, params ),
    		 KErrArgument );
    	
-   	CleanupStack::Pop( iMasterSalt3 );
-    CleanupStack::Pop( iMasterKey3 );	 
-   	delete iContext3;	 
+    delete iContext3;	 
    
 	}
 	
@@ -324,18 +325,18 @@
 	*mki = K128bitMKITest1;
 	Hex(*mki);
 	
-	iMasterKey4 = CSRTPMasterKey::NewLC( *masterKey, *mki,
+	iMasterKey4 = CSRTPMasterKey::NewL( *masterKey, *mki,
 									KSRTPDefSessionEncryptionKeyLength, 
         							KSRTPDefSessionAuthenticationKeyLength );
     iMasterSalt4 = CSRTPMasterSalt::NewL( *masterSalt,KSRTPDefSessionSaltingKeyLength );
-    CleanupStack::Pop( iMasterKey4 );
+   
     CleanupStack::PopAndDestroy( mki );
 	
     CleanupStack::PopAndDestroy( masterSalt );
     CleanupStack::PopAndDestroy( masterKey );  
     
-    CleanupStack::PushL( iMasterKey4 );
-    CleanupStack::PushL( iMasterSalt4 );
+    
+   
      
 	 //invalid authalg
 	 TSrtpCryptoParams params;
@@ -343,8 +344,8 @@
     RTP_EUNIT_ASSERT_SPECIFIC_LEAVE(iContext4=CSRTPCryptoContext::NewL(iMasterKey4,iMasterSalt4, params),
      KErrArgument );
      
-    CleanupStack::Pop( iMasterSalt4 );
-    CleanupStack::Pop( iMasterKey4 );
+    
+  
     }
 
 void UT_CSRTPCryptoContext::UT_CSRTPCryptoContext_Test4L(  )
@@ -361,17 +362,17 @@
 	*mki = K128bitMKITest1;
 	Hex(*mki);
 	
-	iMasterKey5 = CSRTPMasterKey::NewLC( *masterKey, *mki,
+	iMasterKey5 = CSRTPMasterKey::NewL( *masterKey, *mki,
 									KSRTPDefSessionEncryptionKeyLength, 
         							KSRTPDefSessionAuthenticationKeyLength);
     iMasterSalt5 = CSRTPMasterSalt::NewL( *masterSalt,KSRTPDefSessionSaltingKeyLength ); 
-    CleanupStack::Pop( iMasterKey5 );
+    
    	CleanupStack::PopAndDestroy( mki );
 	CleanupStack::PopAndDestroy( masterSalt );
     CleanupStack::PopAndDestroy( masterKey );   
 	
-	CleanupStack::PushL( iMasterKey5 );
-    CleanupStack::PushL( iMasterSalt5 );
+	
+    
     
 	TSrtpCryptoParams params;
 	 //invalid auth tag length in context5
@@ -379,8 +380,7 @@
 	 RTP_EUNIT_ASSERT_SPECIFIC_LEAVE( iContext5=CSRTPCryptoContext::NewL(iMasterKey5,iMasterSalt5,params ),
      KErrArgument );
      
-     CleanupStack::Pop( iMasterSalt5 );
-     CleanupStack::Pop( iMasterKey5 );
+ 
 	 }
 
 void UT_CSRTPCryptoContext::UT_CSRTPCryptoContext_Test5L(  )
@@ -396,26 +396,24 @@
     CleanupStack::PushL( mki);
 	*mki = K128bitMKITest1;
 	Hex(*mki);
-	iMasterKey6 = CSRTPMasterKey::NewLC( *masterKey, *mki,
+	iMasterKey6 = CSRTPMasterKey::NewL( *masterKey, *mki,
 									KSRTPDefSessionEncryptionKeyLength, 
         							KSRTPDefSessionAuthenticationKeyLength );
     iMasterSalt6 = CSRTPMasterSalt::NewL( *masterSalt,KSRTPDefSessionSaltingKeyLength );
-    CleanupStack::Pop( iMasterKey6 );
+  
 	TSrtpCryptoParams params;
 	CleanupStack::PopAndDestroy( mki );
 	CleanupStack::PopAndDestroy( masterSalt );
     CleanupStack::PopAndDestroy( masterKey );   
 	
-	CleanupStack::PushL( iMasterKey6 );
-    CleanupStack::PushL( iMasterSalt6 );
+	
     
 	//invalid prefix length in context6
 	params.iPrefixLen=10;
 	RTP_EUNIT_ASSERT_SPECIFIC_LEAVE( iContext6=CSRTPCryptoContext::NewL(iMasterKey6,iMasterSalt6, params )  ,
      KErrArgument ); 
      
-	CleanupStack::Pop( iMasterSalt6 );
-    CleanupStack::Pop( iMasterKey6 );
+	
      
 	}
 void UT_CSRTPCryptoContext::UT_MasterKey_Test1L(  )
@@ -536,26 +534,26 @@
 
     TSrtpCryptoParams params;
     //test constructL  
-    iMasterKey3 = CSRTPMasterKey::NewLC( *masterKey3, *mki3 );
+    iMasterKey3 = CSRTPMasterKey::NewL( *masterKey3, *mki3 );
     iMasterSalt3 = CSRTPMasterSalt::NewL( *masterSalt3);
-    CleanupStack::Pop( iMasterKey3 );
+    
     CleanupStack::PopAndDestroy( mki3 );
 	
     CleanupStack::PopAndDestroy( masterSalt3 );
     CleanupStack::PopAndDestroy( masterKey3 ); 
     
-    CleanupStack::PushL( iMasterKey3 );
-    CleanupStack::PushL( iMasterSalt3 );
+ 
     
    	iContext3= CSRTPCryptoContext::NewL(iMasterKey3,iMasterSalt3, params );
-   	CleanupStack::Pop( iMasterSalt3 );
-    CleanupStack::Pop( iMasterKey3 );
+ 
+ 
      
    	params.iSrtpAuthTagLen=112;
    	iContext3->UpdateCryptoParams(params );
    	EUNIT_ASSERT(iContext->IsEqual(*iContext3)==EFalse);
    
-   	delete iContext3;	 
+   	delete iContext3;
+	iContext3 = NULL;
    	//test only param is different
    	HBufC8* masterKey1 = HBufC8::NewL(K128bitMasterKey1().Length());
     CleanupStack::PushL( masterKey1 );
@@ -571,22 +569,22 @@
 	*mki = K128bitMKITest1;
 	Hex(*mki);
 
-	iMasterKey = CSRTPMasterKey::NewLC( *masterKey1, *mki,
+	iMasterKey = CSRTPMasterKey::NewL( *masterKey1, *mki,
 									KSRTPDefSessionEncryptionKeyLength, 
         							KSRTPDefSessionAuthenticationKeyLength );
     iMasterSalt = CSRTPMasterSalt::NewL( *masterSalt1,KSRTPDefSessionSaltingKeyLength );
-    CleanupStack::Pop( iMasterKey );
+  
     CleanupStack::PopAndDestroy( mki );
     CleanupStack::PopAndDestroy( masterSalt1 );
     CleanupStack::PopAndDestroy( masterKey1 );
     TSrtpCryptoParams params2;
     params2.iSrtpAuthTagLen=32;
-    CleanupStack::PushL( iMasterKey );
-    CleanupStack::PushL( iMasterSalt );
+  
+ 
     CSRTPCryptoContext* context = CSRTPCryptoContext::NewL(iMasterKey, iMasterSalt,params2   );
     EUNIT_ASSERT(!iContext->IsEqual(*context));
-    CleanupStack::Pop( iMasterSalt );
-    CleanupStack::Pop( iMasterKey );
+    
+ 
     params2.iSrtpAuthTagLen=80;
     params2.iMasterKeysLifeTime = 0;
     context->UpdateCryptoParams(params2 );
@@ -602,7 +600,7 @@
 	EUNIT_ASSERT(iContext->CryptoParams().iIsRCCm3Sync);
 	}
 	
-void UT_CSRTPCryptoContext::TestIsValid()
+void UT_CSRTPCryptoContext::TestIsValidL()
 	{
 	TSrtpCryptoParams params;
 	//TEst cases 1 about Encryption method
@@ -665,23 +663,20 @@
 	*mki3 = K128bitMKITest3;
 	Hex(*mki3);
  
-    iMasterKey3 = CSRTPMasterKey::NewLC( *masterKey3, *mki3,
+    iMasterKey3 = CSRTPMasterKey::NewL( *masterKey3, *mki3,
     								KSRTPDefSessionAuthenticationKeyLength, 
     							    KSRTPDefSessionEncryptionKeyLength
     							    );
     iMasterSalt3 = CSRTPMasterSalt::NewL( *masterSalt3, 1100 );
-    CleanupStack::Pop( iMasterKey3 );
+   
     CleanupStack::PopAndDestroy( mki3 );
 	
     CleanupStack::PopAndDestroy( masterSalt3 );
     CleanupStack::PopAndDestroy( masterKey3 ); 
-    CleanupStack::PushL( iMasterKey3 );
-    CleanupStack::PushL( iMasterSalt3 );
+  
    	RTP_EUNIT_ASSERT_SPECIFIC_LEAVE( iContext3= CSRTPCryptoContext::NewL(iMasterKey3,iMasterSalt3, params ),
    		 KErrArgument );
    
-	CleanupStack::Pop( iMasterSalt3 );
-    CleanupStack::Pop( iMasterKey3 );
 	}
 	
 void UT_CSRTPCryptoContext::SRTPMasterKeyStaleEvent(const CSRTPStream& /*aStream*/)
@@ -828,7 +823,7 @@
     "CSRTPCryptoContext",
     "TestIsValid",
     "FUNCTIONALITY",
-    SetupL, TestIsValid, Teardown)  
+    SetupL, TestIsValidL, Teardown)  
     
 EUNIT_END_TEST_TABLE
 
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandler.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandler.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -193,6 +193,12 @@
 
     delete iStreamOut;
     delete iSRTPSession; 
+	
+	iTestAuthTag80Bits = NULL;
+    iStreamIn = NULL;
+
+    iStreamOut = NULL;
+    iSRTPSession = NULL; 
     
     iResult.Zero();        
     iRFCTestSalt112bits.Zero();
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandlerSRTCP.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandlerSRTCP.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -228,14 +228,26 @@
     delete iTestPayload160Bits;
     delete iTestMKI128Bits;
     delete iTestAuthTag80Bits;
+	
+	iDecryptedPayload = NULL;
+    iTestPayload160Bits = NULL;
+    iTestMKI128Bits = NULL;
+    iTestAuthTag80Bits = NULL;
 
     delete iStreamIn;
-    delete iSRTPSession;    
+    delete iSRTPSession;   
+
+    iStreamIn = NULL;
+    iSRTPSession = NULL;	
 
     
     delete iRFC3711_SessionEncrKey128bits;
     delete iRFC3711_SessionSaltKey128bits;
-    delete iRFC3711_SessionAuthKey128bits;    
+    delete iRFC3711_SessionAuthKey128bits;   
+
+    iRFC3711_SessionEncrKey128bits = NULL;
+    iRFC3711_SessionSaltKey128bits = NULL;
+    iRFC3711_SessionAuthKey128bits = NULL; 	
 
     }
 
@@ -251,7 +263,7 @@
 
 
 
-void UT_CSRTPCryptoHandlerSRTCP::UT_DeriveSessionKeysL_1L()
+void UT_CSRTPCryptoHandlerSRTCP::UT_DeriveSessionKeysL_OneL()
 	{
 	HBufC8* encSrtcpPacket =HBufC8::NewLC(KSRTCPPacket().Length());
 	*encSrtcpPacket=KSRTCPPacket;
@@ -644,7 +656,7 @@
     "CSRTPCryptoHandlerSRTCP",
     "DeriveSessionKeys",
     "FUNCTIONALITY",
-    SetupL, UT_DeriveSessionKeysL_1L, Teardown)
+    SetupL, UT_DeriveSessionKeysL_OneL, Teardown)
     
 EUNIT_TEST(
     "Authentication1",
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandlerSRTP.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPCryptoHandlerSRTP.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -221,14 +221,26 @@
     delete iTestPayload160Bits;
     delete iTestMKI128Bits;
     delete iTestAuthTag80Bits;
+	
+    iDecryptedPayload = NULL;
+    iTestPayload160Bits = NULL;
+    iTestMKI128Bits = NULL;
+    iTestAuthTag80Bits = NULL;
 
     delete iStreamIn;
     delete iSRTPSession;    
+	
+	iStreamIn = NULL;
+    iSRTPSession = NULL; 
 
     
     delete iRFC3711_SessionEncrKey128bits;
     delete iRFC3711_SessionSaltKey128bits;
     delete iRFC3711_SessionAuthKey128bits;    
+	
+	iRFC3711_SessionEncrKey128bits = NULL;
+    iRFC3711_SessionSaltKey128bits = NULL;
+    iRFC3711_SessionAuthKey128bits = NULL;  
 
     }
 
@@ -428,7 +440,7 @@
 
 
 
-void UT_CSRTPCryptoHandlerSRTP::UT_DeriveSessionKeysL_1L(  )
+void UT_CSRTPCryptoHandlerSRTP::UT_DeriveSessionKeysL_OneL(  )
     {
     //Create the packet firest 
      TInt authTagLenInBytes = iContext->CryptoParams().iSrtpAuthTagLen/8;
@@ -1628,7 +1640,7 @@
     "CSRTPCryptoHandlerSRTP",
     "DeriveSessionKeysL",
     "FUNCTIONALITY",
-    SetupL, UT_DeriveSessionKeysL_1L, Teardown)
+    SetupL, UT_DeriveSessionKeysL_OneL, Teardown)
 
 EUNIT_TEST(
     "UpdateROC - 1 ",
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPKeyDerivation_AESCM128.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPKeyDerivation_AESCM128.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -228,7 +228,7 @@
     }
 
 
-void UT_CSRTPKeyDerivation_AESCM128::UT_ErronousInput_1L()
+void UT_CSRTPKeyDerivation_AESCM128::UT_ErronousInput_OneL()
     {    
         
     TInt err = KErrNone;
@@ -332,14 +332,14 @@
     "CSRTPKeyDerivation_AESCM128",
     "PRF_128L",
     "FUNCTIONALITY",
-    SetupL, UT_ErronousInput_1L, Teardown)
+    SetupL, UT_ErronousInput_OneL, Teardown)
 
 EUNIT_END_TEST_TABLE
 
 //  END OF FILE
 
 /*
-void UT_CSRTPKeyDerivation_AESCM128::UT_ErronousInput_1L()
+void UT_CSRTPKeyDerivation_AESCM128::UT_ErronousInput_OneL()
     {
     TInt err = KErrNone;
     HBufC8* result = NULL;
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPMasterKey.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPMasterKey.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -144,6 +144,12 @@
 	delete iMasterKey4;
 	delete iMasterKey5;
 	
+    iMasterKey = NULL;
+	iMasterKey2 = NULL;
+	iMasterKey3 = NULL;
+	iMasterKey4 = NULL;
+	iMasterKey5 = NULL;
+	
 	iTestKey128bits.Zero();
     iTestKey128bits_dehexed.Zero();    
     }
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPMasterSalt.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPMasterSalt.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -100,6 +100,12 @@
 	delete iMasterSalt2;
 	delete iMasterSalt3;
 	delete iMasterSalt4;
+	
+    iMasterSalt = NULL;
+	iMasterSalt2 = NULL;
+	iMasterSalt3 = NULL;
+	iMasterSalt4 = NULL;
+	
 	iRFCTestSalt112bits.Zero();
     iRFCTestSalt112bits_dehexed.Zero();      
     }
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPSession.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPSession.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -151,14 +151,14 @@
     iContext=NULL;
     }
 
-void UT_CSRTPSession::UT_CSRTPSession_NewL_1L(  )
+void UT_CSRTPSession::UT_CSRTPSession_NewL_OneL(  )
     {
     CSRTPSession* srtpSession = CSRTPSession::NewL( iDestination); 
     EUNIT_ASSERT(srtpSession);
     delete srtpSession;
     }
 
-void UT_CSRTPSession::UT_CSRTPSession_NewL_2L(  )
+void UT_CSRTPSession::UT_CSRTPSession_NewL_TwoL(  )
     {
                             
     CSRTPSession* srtpSession = CSRTPSession::NewL(iDestination,
@@ -630,14 +630,14 @@
     "CSRTPSession",
     "NewL",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPSession_NewL_1L, Teardown)
+    SetupL, UT_CSRTPSession_NewL_OneL, Teardown)
 
 EUNIT_TEST(
     "NewL - test ",
     "CSRTPSession",
     "NewL",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPSession_NewL_2L, Teardown)
+    SetupL, UT_CSRTPSession_NewL_TwoL, Teardown)
 EUNIT_TEST(
     "ConstructL ",
     "CSRTPSession",
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStream.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStream.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -230,13 +230,25 @@
     delete iTestPayload160Bits;
     delete iTestMKI128Bits;
     delete iTestAuthTag80Bits;
+	
+	iDecryptedPayload = NULL;
+    iTestPayload160Bits = NULL;
+    iTestMKI128Bits = NULL;
+    iTestAuthTag80Bits = NULL;
 
     delete iStreamIn;
-    delete iSRTPSession;    
+    delete iSRTPSession;  
+
+    iStreamIn = NULL;
+    iSRTPSession = NULL;	
 
     delete iRFC3711_SessionEncrKey128bits;
     delete iRFC3711_SessionSaltKey128bits;
     delete iRFC3711_SessionAuthKey128bits;    
+	
+	iRFC3711_SessionEncrKey128bits = NULL;
+    iRFC3711_SessionSaltKey128bits = NULL;
+    iRFC3711_SessionAuthKey128bits = NULL;    
 
     }
     
@@ -348,7 +360,7 @@
     delete streamIn;
     }
  
- void UT_CSRTPStream::UT_CSRTPStream_ReKeyNeeded_1L(  )
+ void UT_CSRTPStream::UT_CSRTPStream_ReKeyNeeded_OneL(  )
     {
     iReKeyCalled= EFalse;
     CSRTPStreamIn* streamIn = CSRTPStreamIn::NewL(*iSRTPSession, (TUint)0);
@@ -357,7 +369,7 @@
     delete streamIn;
     }   
 
-void UT_CSRTPStream::UT_CSRTPStream_ReKeyNeeded_2L(  )
+void UT_CSRTPStream::UT_CSRTPStream_ReKeyNeeded_TwoL(  )
     {
     iReKeyCalled= EFalse;
     HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
@@ -432,13 +444,13 @@
     "CSRTPStream",
     "ReKey",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStream_ReKeyNeeded_1L, Teardown)    
+    SetupL, UT_CSRTPStream_ReKeyNeeded_OneL, Teardown)    
 EUNIT_TEST(
     "ReKey2 ",
     "CSRTPStream",
     "ReKey",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStream_ReKeyNeeded_2L, Teardown)    
+    SetupL, UT_CSRTPStream_ReKeyNeeded_TwoL, Teardown)    
 
 EUNIT_TEST(
     "TestNewL",
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStreamIn.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStreamIn.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -347,11 +347,19 @@
     {
     delete iDecryptedPayload;
     delete iTestPayload160Bits;
+	
+	iDecryptedPayload = NULL;
+    iTestPayload160Bits = NULL;
+
 
 
     delete iStreamIn;
     delete iStreamInLateBD;
     delete iSRTPSession;    
+	
+	iStreamIn = NULL;
+    iStreamInLateBD = NULL;
+    iSRTPSession = NULL; 
 
    
     delete iRFC3711_SessionEncrKey128bits;
@@ -360,16 +368,23 @@
     delete iRFC3711_RtcpEncrKey128bits;
 	delete iRFC3711_RtcpSaltKey128bits;
 	delete iRFC3711_RtcpAuthKey128bits;
+	
+	iRFC3711_SessionEncrKey128bits = NULL;
+    iRFC3711_SessionSaltKey128bits = NULL;
+    iRFC3711_SessionAuthKey128bits = NULL;    
+    iRFC3711_RtcpEncrKey128bits = NULL;
+	iRFC3711_RtcpSaltKey128bits = NULL;
+	iRFC3711_RtcpAuthKey128bits = NULL;
     }
 
-void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_1L(  )
+void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_OneL(  )
     {        
     CSRTPStreamIn* tempStreamIn = CSRTPStreamIn::NewL(*iSRTPSession, (TUint)1);
     EUNIT_ASSERT(tempStreamIn->SSRC()== 1);
     delete tempStreamIn;
     }
 
-void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_2L(  )
+void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_TwoL(  )
     {
     HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
     CleanupStack::PushL( masterKey );
@@ -406,7 +421,7 @@
      CleanupStack::PopAndDestroy( srtpSession );                   
     }
 
-void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_3L(  )
+void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_ThreeL(  )
     {
     HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
     CleanupStack::PushL( masterKey );
@@ -442,7 +457,7 @@
     delete tempStreamIn;   
     CleanupStack::PopAndDestroy( srtpSession );                   
     }
-void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_4L(  )
+void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_FourL(  )
     {
      HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
     CleanupStack::PushL( masterKey );
@@ -479,7 +494,7 @@
     CleanupStack::PopAndDestroy( srtpSession );
     }
     
-void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_5L(  )
+void UT_CSRTPStreamIn::UT_CSRTPStreamIn_NewL_FiveL(  )
     {
      HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
     CleanupStack::PushL( masterKey );
@@ -1036,35 +1051,35 @@
     "CSRTPStreamIn",
     "NewL1",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStreamIn_NewL_1L, Teardown)
+    SetupL, UT_CSRTPStreamIn_NewL_OneL, Teardown)
 
 EUNIT_TEST(
     "NewL2 - test ",
     "CSRTPStreamIn",
     "NewL2",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStreamIn_NewL_2L, Teardown)
+    SetupL, UT_CSRTPStreamIn_NewL_TwoL, Teardown)
 
 EUNIT_TEST(
     "NewL3 - test ",
     "CSRTPStreamIn",
     "NewL3",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStreamIn_NewL_3L, Teardown)
+    SetupL, UT_CSRTPStreamIn_NewL_ThreeL, Teardown)
     
 EUNIT_TEST(
     "NewL4 - test ",
     "CSRTPStreamIn",
     "NewL4",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStreamIn_NewL_4L, Teardown)    
+    SetupL, UT_CSRTPStreamIn_NewL_FourL, Teardown)    
 
 EUNIT_TEST(
     "NewL5 - test ",
     "CSRTPStreamIn",
     "NewL5",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStreamIn_NewL_5L, Teardown)    
+    SetupL, UT_CSRTPStreamIn_NewL_FiveL, Teardown)    
 EUNIT_TEST(
     "UnprotectSrtpL - test ",
     "CSRTPStreamIn",
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStreamOut.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSRTPStreamOut.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -334,10 +334,16 @@
     {
     delete iDecryptedPayload;
     delete iTestPayload160Bits;
+	
+	iDecryptedPayload = NULL;
+    iTestPayload160Bits = NULL;
     //delete iTestMKI128Bits;
 
     delete iStreamOut;
     delete iSRTPSession;    
+	
+	iStreamOut = NULL;
+    iSRTPSession = NULL; 
 
     
     delete iRFC3711_SessionEncrKey128bits;
@@ -346,17 +352,23 @@
     delete iRFC3711_RtcpEncrKey128bits;
 	delete iRFC3711_RtcpSaltKey128bits;
 	delete iRFC3711_RtcpAuthKey128bits;    
-
+    
+	iRFC3711_SessionEncrKey128bits = NULL;
+    iRFC3711_SessionSaltKey128bits = NULL;
+    iRFC3711_SessionAuthKey128bits = NULL;    
+    iRFC3711_RtcpEncrKey128bits = NULL;
+	iRFC3711_RtcpSaltKey128bits = NULL;
+	iRFC3711_RtcpAuthKey128bits = NULL;
     }
 
-void UT_CSRTPStreamOut::UT_CSRTPStreamOut_NewL_1L(  )
+void UT_CSRTPStreamOut::UT_CSRTPStreamOut_NewL_OneL(  )
     {
     CSRTPStreamOut* tempStreamOut = CSRTPStreamOut::NewL(*iSRTPSession, (TUint)1);
     EUNIT_ASSERT(tempStreamOut->SSRC()== 1);
     delete tempStreamOut;
     }
 
-void UT_CSRTPStreamOut::UT_CSRTPStreamOut_NewL_2L(  )
+void UT_CSRTPStreamOut::UT_CSRTPStreamOut_NewL_TwoL(  )
     {
         HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
     CleanupStack::PushL( masterKey );
@@ -399,7 +411,7 @@
     delete srtpSession;                     
     }
 
-void UT_CSRTPStreamOut::UT_CSRTPStreamOut_NewL_3L(  )
+void UT_CSRTPStreamOut::UT_CSRTPStreamOut_NewL_ThreeL(  )
     {
         HBufC8* masterKey = HBufC8::NewL(KRFC3711_TestMasterKey128bits().Length());
     CleanupStack::PushL( masterKey );
@@ -764,20 +776,20 @@
     "CSRTPStreamOut",
     "NewL",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStreamOut_NewL_1L, Teardown)
+    SetupL, UT_CSRTPStreamOut_NewL_OneL, Teardown)
 
 EUNIT_TEST(
     "NewL2 - test ",
     "CSRTPStreamOut",
     "NewL2",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStreamOut_NewL_2L, Teardown)
+    SetupL, UT_CSRTPStreamOut_NewL_TwoL, Teardown)
 EUNIT_TEST(
     "NewL3 - test ",
     "CSRTPStreamOut",
     "NewL3",
     "FUNCTIONALITY",
-    SetupL, UT_CSRTPStreamOut_NewL_3L, Teardown)
+    SetupL, UT_CSRTPStreamOut_NewL_ThreeL, Teardown)
 
 EUNIT_TEST(
     "ProtectRtpL - test ",
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSrtpAuthentication_RCC.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_CSrtpAuthentication_RCC.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -315,49 +315,91 @@
 void UT_CSrtpAuthentication_RCC::Teardown(  )
     {
     delete iAuthenticator;
+	iAuthenticator = NULL;
     
 	delete iRFC2202_Test1_Key_160bits;
 	delete iRFC2202_Test1_Data_16bits;
 	delete iRFC2202_Test1_Tag_80bits;
 	delete iRFC2202_Test1_Tag_32bits;
+	
+	iRFC2202_Test1_Key_160bits = NULL;
+	iRFC2202_Test1_Data_16bits = NULL;
+	iRFC2202_Test1_Tag_80bits = NULL;
+	iRFC2202_Test1_Tag_32bits = NULL;
 
 	delete iRFC2202_Test2_Key;
 	delete iRFC2202_Test2_Data_28bits;
 	delete iRFC2202_Test2_Tag_80bits;
 	delete iRFC2202_Test2_Tag_32bits;
+	
+	iRFC2202_Test2_Key = NULL;
+	iRFC2202_Test2_Data_28bits = NULL;
+	iRFC2202_Test2_Tag_80bits = NULL;
+	iRFC2202_Test2_Tag_32bits = NULL;
 
 	delete iRFC2202_Test3_Key_160bits;
 	delete iRFC2202_Test3_Data_400bits;
 	delete iRFC2202_Test3_Tag_80bits;
 	delete iRFC2202_Test3_Tag_32bits;
+	
+	iRFC2202_Test3_Key_160bits = NULL;
+	iRFC2202_Test3_Data_400bits = NULL;
+	iRFC2202_Test3_Tag_80bits = NULL;
+	iRFC2202_Test3_Tag_32bits = NULL;
 
     delete iRFC2202_Test4_Key_200bits;
     delete iRFC2202_Test4_Data_400bits;
     delete iRFC2202_Test4_Tag_80bits;
     delete iRFC2202_Test4_Tag_32bits;
+	
+	iRFC2202_Test4_Key_200bits = NULL;
+    iRFC2202_Test4_Data_400bits = NULL;
+    iRFC2202_Test4_Tag_80bits = NULL;
+    iRFC2202_Test4_Tag_32bits = NULL;
 
     delete iRFC2202_Test5_Key_160bits;
     delete iRFC2202_Test5_Data;
     delete iRFC2202_Test5_Tag_80bits;
     delete iRFC2202_Test5_Tag_32bits;
+	
+	iRFC2202_Test5_Key_160bits = NULL;
+    iRFC2202_Test5_Data = NULL;
+    iRFC2202_Test5_Tag_80bits = NULL;
+    iRFC2202_Test5_Tag_32bits = NULL;
 
 	delete iRFC2202_Test6_Key_640bits;
 	delete iRFC2202_Test6_Data_54bits;
 	delete iRFC2202_Test6_Tag_80bits;
 	delete iRFC2202_Test6_Tag_32bits;
+	
+	iRFC2202_Test6_Key_640bits = NULL;
+	iRFC2202_Test6_Data_54bits = NULL;
+	iRFC2202_Test6_Tag_80bits = NULL;
+	iRFC2202_Test6_Tag_32bits = NULL;
 
 	delete iRFC2202_Test7_Key_640bits;
 	delete iRFC2202_Test7_Data_73bits;
 	delete iRFC2202_Test7_Tag_80bits;
 	delete iRFC2202_Test7_Tag_32bits;
+	
+	iRFC2202_Test7_Key_640bits = NULL;
+	iRFC2202_Test7_Data_73bits = NULL;
+	iRFC2202_Test7_Tag_80bits = NULL;
+	iRFC2202_Test7_Tag_32bits = NULL;
+	
 	delete iTest8_Key_160bits;
 	delete iTest8_Data_168bits;
 	delete iTest8_Data2_32bits;
 	delete iTest8_Tag_80bits;
+	
+	iTest8_Key_160bits = NULL;
+	iTest8_Data_168bits = NULL;
+	iTest8_Data2_32bits = NULL;
+	iTest8_Tag_80bits = NULL;
     }
 
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test1_80L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test1_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test1_Key_160bits, 
  	                                         *iRFC2202_Test1_Data_16bits,
@@ -371,7 +413,7 @@
  	delete result;     	 	 	
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test1_32L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL(  )
     {
  	EUNIT_ASSERT_SPECIFIC_LEAVE( iAuthenticator->AuthenticateL(32, *iRFC2202_Test1_Key_160bits, 
  	                                         *iRFC2202_Test1_Data_16bits,
@@ -380,7 +422,7 @@
     }
 
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test2_80L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test2_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test2_Key, 
  	                                         *iRFC2202_Test2_Data_28bits,
@@ -394,7 +436,7 @@
  	delete result;    
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test2_32L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test2_ThirtyTwoL(  )
     {
  	EUNIT_ASSERT_SPECIFIC_LEAVE( iAuthenticator->AuthenticateL(32, *iRFC2202_Test2_Key, 
  	                                         *iRFC2202_Test2_Data_28bits,
@@ -403,7 +445,7 @@
     }
 
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test3_80L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test3_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test3_Key_160bits, 
  	                                         *iRFC2202_Test3_Data_400bits,
@@ -417,7 +459,7 @@
  	delete result;    
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test3_32L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test3_ThirtyTwoL(  )
     {
  	EUNIT_ASSERT_SPECIFIC_LEAVE( iAuthenticator->AuthenticateL(32, *iRFC2202_Test3_Key_160bits, 
  	                                         *iRFC2202_Test3_Data_400bits,
@@ -425,7 +467,7 @@
 
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test4_80L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test4_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test4_Key_200bits, 
  	                                         *iRFC2202_Test4_Data_400bits,
@@ -439,7 +481,7 @@
  	delete result;    
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test4_32L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test4_ThirtyTwoL(  )
     {
  	EUNIT_ASSERT_SPECIFIC_LEAVE(  iAuthenticator->AuthenticateL(32, *iRFC2202_Test4_Key_200bits, 
  	                                         *iRFC2202_Test4_Data_400bits,
@@ -447,7 +489,7 @@
 
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test5_80L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test5_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test5_Key_160bits, 
  	                                         *iRFC2202_Test5_Data,
@@ -461,7 +503,7 @@
  	delete result;    
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test5_32L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test5_ThirtyTwoL(  )
     {
  	EUNIT_ASSERT_SPECIFIC_LEAVE( iAuthenticator->AuthenticateL(32, *iRFC2202_Test5_Key_160bits, 
  	                                         *iRFC2202_Test5_Data,
@@ -469,7 +511,7 @@
 
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test6_80L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test6_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test6_Key_640bits, 
  	                                         *iRFC2202_Test6_Data_54bits,
@@ -483,7 +525,7 @@
  	delete result;    
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test6_32L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test6_ThirtyTwoL(  )
     {
  	EUNIT_ASSERT_SPECIFIC_LEAVE(  iAuthenticator->AuthenticateL(32, *iRFC2202_Test6_Key_640bits, 
  	                                         *iRFC2202_Test6_Data_54bits,
@@ -491,7 +533,7 @@
 
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test7_80L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test7_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test7_Key_640bits, 
  	                                         *iRFC2202_Test7_Data_73bits,
@@ -505,7 +547,7 @@
  	delete result;    
     }
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test7_32L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL(  )
     {
  	EUNIT_ASSERT_SPECIFIC_LEAVE(  iAuthenticator->AuthenticateL(32, *iRFC2202_Test7_Key_640bits, 
  	                                         *iRFC2202_Test7_Data_73bits,
@@ -514,7 +556,7 @@
     }
 
 
-void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_Test8_32L(  )
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_Test8_ThirtyTwoL(  )
     {
     TBuf8<20> buf; 
     TBuf8<19> buf2;
@@ -591,6 +633,12 @@
  	CleanupStack::PopAndDestroy(result); 	
  	}
 
+void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_Test_KeyChangedL()
+{
+    UT_AuthenticateL_RFC2202_Test2_EightyL();
+    UT_AuthenticateL_RFC2202_Test3_EightyL();
+}
+
 void UT_CSrtpAuthentication_RCC::Hex(HBufC8& aString)
 {
     TPtr8 ptr=aString.Des();
@@ -624,105 +672,111 @@
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test1_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test1_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 1 32 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test1_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 2 80 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test2_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test2_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 2 32 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test2_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test2_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 3 80 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test3_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test3_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 3 32 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test3_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test3_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 4 80 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test4_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test4_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 4 32 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test4_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test4_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 5 80 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test5_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test5_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 5 32 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test5_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test5_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 6 80 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test6_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test6_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 6 32 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test6_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test6_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 7 80 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test7_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test7_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 7 32 bits",
     "CSrtpAuthentication_RCC",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test7_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL, Teardown)
 EUNIT_TEST(
     "AuthenticateL - RealPacket",
     "CSrtpAuthentication_RCC",
     "AuthenticateL with Real Packet",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_Test8_32L, Teardown)
-    
+    SetupL, UT_AuthenticateL_Test8_ThirtyTwoL, Teardown)
+  
+EUNIT_TEST(
+    "AuthenticateL - KeyChanged",
+    "CSrtpAuthentication_RCC",
+    "AuthenticateL",
+    "FUNCTIONALITY",
+    SetupL, UT_AuthenticateL_Test_KeyChangedL, Teardown)
 
 EUNIT_END_TEST_TABLE
 
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_HMAC_SHA1.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_HMAC_SHA1.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -312,36 +312,67 @@
 void UT_SRTPAuthentication_HMAC_SHA1::Teardown(  )
     {
     delete iAuthenticator;
-    
+    iAuthenticator = NULL;
+	
 	delete iRFC2202_Test1_Key_160bits;
 	delete iRFC2202_Test1_Data_16bits;
 	delete iRFC2202_Test1_Tag_80bits;
 	delete iRFC2202_Test1_Tag_32bits;
+	
+	iRFC2202_Test1_Key_160bits = NULL;
+	iRFC2202_Test1_Data_16bits = NULL;
+	iRFC2202_Test1_Tag_80bits = NULL;
+	iRFC2202_Test1_Tag_32bits = NULL;
 
 	delete iRFC2202_Test2_Key;
 	delete iRFC2202_Test2_Data_28bits;
 	delete iRFC2202_Test2_Tag_80bits;
 	delete iRFC2202_Test2_Tag_32bits;
+	
+    iRFC2202_Test2_Key = NULL;
+	iRFC2202_Test2_Data_28bits = NULL;
+	iRFC2202_Test2_Tag_80bits = NULL;
+	iRFC2202_Test2_Tag_32bits = NULL;
 
 	delete iRFC2202_Test3_Key_160bits;
 	delete iRFC2202_Test3_Data_400bits;
 	delete iRFC2202_Test3_Tag_80bits;
 	delete iRFC2202_Test3_Tag_32bits;
+	
+    iRFC2202_Test3_Key_160bits = NULL;
+	iRFC2202_Test3_Data_400bits = NULL;
+	iRFC2202_Test3_Tag_80bits = NULL;
+	iRFC2202_Test3_Tag_32bits = NULL;
 
     delete iRFC2202_Test4_Key_200bits;
     delete iRFC2202_Test4_Data_400bits;
     delete iRFC2202_Test4_Tag_80bits;
     delete iRFC2202_Test4_Tag_32bits;
+	
+	iRFC2202_Test4_Key_200bits = NULL;
+    iRFC2202_Test4_Data_400bits = NULL;
+    iRFC2202_Test4_Tag_80bits = NULL;
+    iRFC2202_Test4_Tag_32bits = NULL;
 
     delete iRFC2202_Test5_Key_160bits;
     delete iRFC2202_Test5_Data;
     delete iRFC2202_Test5_Tag_80bits;
     delete iRFC2202_Test5_Tag_32bits;
 
+	iRFC2202_Test5_Key_160bits = NULL;
+    iRFC2202_Test5_Data = NULL;
+    iRFC2202_Test5_Tag_80bits = NULL;
+    iRFC2202_Test5_Tag_32bits = NULL;
+	
 	delete iRFC2202_Test6_Key_640bits;
 	delete iRFC2202_Test6_Data_54bits;
 	delete iRFC2202_Test6_Tag_80bits;
 	delete iRFC2202_Test6_Tag_32bits;
+	
+    iRFC2202_Test6_Key_640bits = NULL;
+	iRFC2202_Test6_Data_54bits = NULL;
+	iRFC2202_Test6_Tag_80bits = NULL;
+	iRFC2202_Test6_Tag_32bits = NULL;
 
 	delete iRFC2202_Test7_Key_640bits;
 	delete iRFC2202_Test7_Data_73bits;
@@ -351,10 +382,19 @@
 	delete iTest8_Data_168bits;
 	delete iTest8_Data2_32bits;
 	delete iTest8_Tag_80bits;
+	
+    iRFC2202_Test7_Key_640bits = NULL;
+	iRFC2202_Test7_Data_73bits = NULL;
+	iRFC2202_Test7_Tag_80bits = NULL;
+	iRFC2202_Test7_Tag_32bits = NULL;
+	iTest8_Key_160bits = NULL;
+	iTest8_Data_168bits = NULL;
+	iTest8_Data2_32bits = NULL;
+	iTest8_Tag_80bits = NULL;
     }
 
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test1_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test1_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test1_Key_160bits, 
  	                                         *iRFC2202_Test1_Data_16bits,
@@ -368,7 +408,7 @@
  	delete result;     	 	 	
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test1_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test1_Key_160bits, 
  	                                         *iRFC2202_Test1_Data_16bits,
@@ -383,7 +423,7 @@
     }
 
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test2_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test2_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test2_Key, 
  	                                         *iRFC2202_Test2_Data_28bits,
@@ -397,7 +437,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test2_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test2_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test2_Key, 
  	                                         *iRFC2202_Test2_Data_28bits,
@@ -412,7 +452,7 @@
     }
 
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test3_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test3_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test3_Key_160bits, 
  	                                         *iRFC2202_Test3_Data_400bits,
@@ -426,7 +466,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test3_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test3_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test3_Key_160bits, 
  	                                         *iRFC2202_Test3_Data_400bits,
@@ -440,7 +480,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test4_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test4_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test4_Key_200bits, 
  	                                         *iRFC2202_Test4_Data_400bits,
@@ -454,7 +494,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test4_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test4_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test4_Key_200bits, 
  	                                         *iRFC2202_Test4_Data_400bits,
@@ -468,7 +508,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test5_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test5_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test5_Key_160bits, 
  	                                         *iRFC2202_Test5_Data,
@@ -482,7 +522,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test5_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test5_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test5_Key_160bits, 
  	                                         *iRFC2202_Test5_Data,
@@ -496,7 +536,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test6_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test6_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test6_Key_640bits, 
  	                                         *iRFC2202_Test6_Data_54bits,
@@ -510,7 +550,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test6_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test6_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test6_Key_640bits, 
  	                                         *iRFC2202_Test6_Data_54bits,
@@ -524,7 +564,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test7_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test7_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test7_Key_640bits, 
  	                                         *iRFC2202_Test7_Data_73bits,
@@ -538,7 +578,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test7_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test7_Key_640bits, 
  	                                         *iRFC2202_Test7_Data_73bits,
@@ -553,7 +593,7 @@
     }
 
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_Test8_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_Test8_ThirtyTwoL(  )
     {
     TBuf8<20> buf; 
     TBuf8<19> buf2;
@@ -630,6 +670,12 @@
  	CleanupStack::PopAndDestroy(result); 	
  	}
 
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_Test_KeyChangedL(  )
+    {
+    UT_AuthenticateL_RFC2202_Test1_EightyL();
+    UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL();
+    }
+
 void UT_SRTPAuthentication_HMAC_SHA1::Hex(HBufC8& aString)
 {
     TPtr8 ptr=aString.Des();
@@ -663,106 +709,112 @@
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test1_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test1_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 1 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test1_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 2 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test2_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test2_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 2 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test2_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test2_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 3 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test3_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test3_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 3 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test3_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test3_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 4 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test4_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test4_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 4 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test4_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test4_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 5 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test5_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test5_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 5 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test5_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test5_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 6 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test6_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test6_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 6 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test6_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test6_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 7 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test7_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test7_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 7 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test7_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL, Teardown)
 EUNIT_TEST(
     "AuthenticateL - RealPacket",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL with Real Packet",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_Test8_32L, Teardown)
+    SetupL, UT_AuthenticateL_Test8_ThirtyTwoL, Teardown)
     
-
+EUNIT_TEST(
+    "AuthenticateL - KeyChanged",
+    "SRTPAuthentication_HMAC_SHA1",
+    "AuthenticateL",
+    "FUNCTIONALITY",
+    SetupL, UT_AuthenticateL_Test_KeyChangedL, Teardown)
+    
 EUNIT_END_TEST_TABLE
 
 //  END OF FILE
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_NULL.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_NULL.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -98,13 +98,18 @@
 void UT_SRTPAuthentication_NULL::Teardown(  )
     {
     delete iAuthenticator;
-    
+    iAuthenticator = NULL;
+	
 	delete iRFC2202_Test1_Key_160bits;
 	delete iRFC2202_Test1_Data_16bits;
 	delete iRFC2202_Test1_Tag_80bits;
+	
+    iRFC2202_Test1_Key_160bits = NULL;
+	iRFC2202_Test1_Data_16bits = NULL;
+	iRFC2202_Test1_Tag_80bits = NULL;
     }
 
-void UT_SRTPAuthentication_NULL::UT_AuthenticateL_RFC2202_Test1_80L(  )
+void UT_SRTPAuthentication_NULL::UT_AuthenticateL_RFC2202_Test1_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test1_Key_160bits, 
  	                                         *iRFC2202_Test1_Data_16bits,
@@ -150,7 +155,7 @@
     "SRTPAuthentication_NULL",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test1_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test1_EightyL, Teardown)
 
 
 EUNIT_END_TEST_TABLE
--- a/sipplugins/sippsipadapter/inc/CWPSIPAdapter.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipadapter/inc/CWPSIPAdapter.h	Fri Apr 16 15:18:54 2010 +0300
@@ -21,7 +21,7 @@
 
 // INCLUDES
 #include <CWPAdapter.h>
-#include <mwpcontextextension.h>
+#include <MWPContextExtension.h>
 
 // FORWARD DECLARATIONS
 class CWPCharacteristic;
--- a/sipplugins/sippsipadapter/src/CWPSIPAdapter.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipadapter/src/CWPSIPAdapter.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -19,11 +19,11 @@
 // INCLUDE FILES
 #include <e32base.h>
 #include <CWPAdapter.h>
-#include <cwpcharacteristic.h>
-#include <cwpparameter.h>
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
 #include <wpsipadapter.rsg>
 #include <utf.h>           // Unicode conversion
-#include <wpadapterutil.h>
+#include <WPAdapterUtil.h>
 #include <sipmanagedprofileregistry.h>
 #include <sipmanagedprofile.h>
 #include <mmf/common/mmfcontrollerpluginresolver.h>
--- a/sipplugins/sippsipsettingsui/data/gssipsettingspluginrsc.rss	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/data/gssipsettingspluginrsc.rss	Fri Apr 16 15:18:54 2010 +0300
@@ -127,16 +127,19 @@
             {
             command = EGSCmdAppEdit;
             txt = qtn_sip_edit;
+            flags = EEikMenuItemAction;
             },
 		MENU_ITEM
             {
             command = EGSCmdAppDelete;
             txt = qtn_sip_delete;
+            flags = EEikMenuItemSpecific;
             },
         MENU_ITEM
             {
             command = EGSCmdAppDefault;
             txt = qtn_sip_set_def_profile;
+            flags = EEikMenuItemSpecific;
             },
 #ifdef __SERIES60_HELP
         MENU_ITEM
--- a/sipplugins/sippsipsettingsui/group/gssipsettingsplugin.mmp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/group/gssipsettingsplugin.mmp	Fri Apr 16 15:18:54 2010 +0300
@@ -55,7 +55,6 @@
 SOURCE				SIPSettListSIPSrvTakeOverCBAKeyPress.cpp
 SOURCE                          SIPSettIntegerSetPage.cpp 
 SOURCE                          SipSettIntegerEditItem.cpp
-SOURCE                          gssiptimer.cpp
 
 USERINCLUDE    		../inc
 USERINCLUDE         ../data
--- a/sipplugins/sippsipsettingsui/inc/gssipsettingsplugin.hrh	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/inc/gssipsettingsplugin.hrh	Fri Apr 16 15:18:54 2010 +0300
@@ -34,7 +34,8 @@
 enum TGSRegistrationMode
     {
     EGSWhenNeeded = 0,
-    EGSAlwaysOn
+    EGSAlwaysOn,
+    EGSAlwaysOnHome
     };
 
 // Security negotiation choices
--- a/sipplugins/sippsipsettingsui/inc/gssiptimer.h	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:  Timer for Hight light listbox item Container
-//
-//
-
-
-#ifndef GSSIP_TIMER_H
-#define GSSIP_TIMER_H
-
-//  INCLUDES
-
-#include <coecntrl.h>
-#include <eiklbi.h>
-#include <aknlists.h>
-
-/**
-*  CGSSIPTimer class
-*/
-class  CGSSIPTimer: public CBase,
-                    public MBeating
-    {
-    public:  // Constructors and destructor
-        
-       /**
-        * Two-phased constructor.
-        * @return Pointer to created instance
-        */
-        static CGSSIPTimer* NewL( const CCoeControl& aContainer, 
-                CListItemDrawer& aListItemDrawer );
-        
-         /**
-         * Destructor.
-         */
-         virtual ~CGSSIPTimer();
-                
-         /**
-         * By default Symbian 2nd phase constructor is private.
-         */
-         void ConstructL();    
-                       
-      
-        /**
-        * Record beat count
-        */
-         void Beat();
-         
-        /**
-        * Synchronize
-        */
-         void Synchronize();
-         
-        /**
-        * Start timer
-        */
-         void StartTimer();
-         
-        /**
-        * Stop timer
-        */
-         void StopTimer();
-         
-        /**
-        * IsStarted()
-        */      
-         TBool IsStarted() const;
-              
-       
-    private:        
-        
-        /**
-         * C++ default constructor.        
-         */
-        CGSSIPTimer( const CCoeControl& aContainer, 
-                     CListItemDrawer& aListItemDrawer );                
-
-    public:
-        // Timer count 
-        TInt iTotal;
-
-    private: 
-    
-        // Timer
-        CHeartbeat* iHeart;
-        
-        //parameter iContainer
-        const CCoeControl& iContainer;
-        
-        //parameter iListItemDrawer
-        CListItemDrawer& iListItemDrawer;
-        
-        
-        // Check if timer is started
-        TBool iIfStart;
-        /**
-         * For testing purposes
-         */        
-        friend class UT_GSSIPTimer;
-    };
-
-#endif      // GSSIP_TIMER_H
-            
-// End of File
--- a/sipplugins/sippsipsettingsui/inc/sipsettingscontainer.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/inc/sipsettingscontainer.h	Fri Apr 16 15:18:54 2010 +0300
@@ -28,7 +28,6 @@
 #include <aknlongtapdetector.h>
 #include <aknstyluspopupmenu.h>
 #include <eikmobs.h>
-#include "gssiptimer.h"
 // FORWARD DECLARATIONS
 
 class CSIPSettingsModel;
@@ -43,7 +42,6 @@
 *  container class for SIP Profiles view
 */
 class CSIPSettingsContainer : public CCoeControl,
-                              public MAknLongTapDetectorCallBack, 
                               public MEikMenuObserver
     {
     public:  // Constructors and destructor
@@ -58,26 +56,6 @@
          */
          void ProcessCommandL( TInt aCommandId );
          
-         /**
-         * Handle long type event
-         */ 
-         virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
-         
-         /**
-         * Handle pointer event
-         */
-         virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
-         
-        /**
-        * Judge whether it is a pointer event
-        */
-         TBool IfPointerEvent();
-         
-        /**
-        * Get PenEventLocation
-        */
-         TPoint PenEventLocation();
-         
         /**
         * C++ default constructor.        
         */
@@ -186,15 +164,6 @@
         // The list box for showing the profiles and the status of each profile
         CListBox* iListBox;
         
-        //Get long press status
-        TBool LongPressStatus();
-        
-        // set long press
-        void SetLongPress( TBool aLongPress = ETrue );
-        
-        CAknLongTapDetector* LongTapDetector();
-        
-        TPointerEvent PointerEvent();
 
     protected: // Data
         TBool iLongPress;
@@ -206,19 +175,6 @@
         */
         MGsFWMSKObserver* iMSKObserver;  
         
-        // Long tap detector object for deciding whether showing stylus pop up menu.
-        CAknLongTapDetector* iLongTapDetector;    
-        
-        // stylus popup menu object for showing popup menu
-        CAknStylusPopUpMenu* iStylusPopupMenu;   
-        
-        //Timer 
-        CGSSIPTimer* iTimer;
-        
-        //Get pen event location
-        TPoint iPoint;
-
-        TPointerEvent iPointerEvent;
     };
 
 #endif      // SIP_SETTINGS_CONTAINER_H
--- a/sipplugins/sippsipsettingsui/inc/sipsettingsmodel.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/inc/sipsettingsmodel.h	Fri Apr 16 15:18:54 2010 +0300
@@ -23,7 +23,7 @@
 
 #include <e32base.h>
 #include <bamdesca.h>       // MDesCArray
-#include <aknutils.h>       // KMaxColumnDataLength
+#include <AknUtils.h>       // KMaxColumnDataLength
 #include "tsipsettingsdata.h"
 
 // FORWARD DECLARATIONS
--- a/sipplugins/sippsipsettingsui/inc/sipsettlistsipprofsetcontainer.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/inc/sipsettlistsipprofsetcontainer.h	Fri Apr 16 15:18:54 2010 +0300
@@ -26,7 +26,6 @@
 #include <aknlongtapdetector.h>
 #include <aknstyluspopupmenu.h>
 #include <eikmobs.h>
-#include "gssiptimer.h"
 // FORWARD DECLARATIONS
 
 class CSIPSettListSIPProfSetItemList;
@@ -70,10 +69,6 @@
         */
          virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
          
-        /**
-        * Judge whether it is a pointer event
-        */
-         TBool IfPointerEvent( );
     
     public: // New functions
         
@@ -153,8 +148,6 @@
         // The item list for changing the attributes of a profile
         CSIPSettListSIPProfSetItemList* iItemList;
 
-        CGSSIPTimer* iTimer;
-
     /**
     * For testing purposes
     */        
--- a/sipplugins/sippsipsettingsui/inc/sipsettlistsipsrvsetcontainer.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/inc/sipsettlistsipsrvsetcontainer.h	Fri Apr 16 15:18:54 2010 +0300
@@ -25,7 +25,6 @@
 #include <aknlongtapdetector.h>
 #include <aknstyluspopupmenu.h>
 #include <eikmobs.h>
-#include "gssiptimer.h"
 // FORWARD DECLARATIONS
 
 class CSIPSettListSIPSrvSetItemList;
@@ -69,11 +68,6 @@
         virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
         
         /**
-        * Judge whether it is a pointer event
-        */
-        TBool IfPointerEvent();
-       
-        /**
         * Opens the pop-up list to modify the selected list items
         * @param aCommand ID of the command to respond to
         */
@@ -150,9 +144,7 @@
         
         // Type of server view.
         TBool iProxyServerView;     
-
-        CGSSIPTimer* iTimer;
-          
+         
     };
 
 #endif      // SIP_SETT_LIST_SIP_SRV_SET_CONTAINER_H
--- a/sipplugins/sippsipsettingsui/src/gssipmodel.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/gssipmodel.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -195,6 +195,10 @@
 TBool CGSSIPModel::SaveProfileL()
     {
     __GSLOGSTRING("CGSSIPModel::SaveProfileL" )
+    if( iNewProfile )
+    	{
+    	return EFalse;
+    	}
     TBool modifications = ETrue;
     TInt err( KErrNone );
 
@@ -1199,9 +1203,9 @@
     
     if ( profile )
         {
-        profile->GetParameter( KSIPProfileRegistered, aIsUse );
         profile->GetParameter( KSIPDefaultProfile, aDefault );
         profile->GetParameter( KSIPProfileLocked, aLocked );
+        aIsUse = iEngine->IsInUseL( *profile );
         } 
     __GSLOGSTRING("CGSSIPModel::CheckProfileForDeleteL End" )
     }
--- a/sipplugins/sippsipsettingsui/src/gssiptimer.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:  Timer for Hight light listbox item Container
-//
-//
-
-
-// INCLUDE FILES
-
-#include "gssiptimer.h"
-#include  "gssippluginlogger.h"
-
-// LOCAL CONSTANTS AND MACROS
-const TInt KTimerPeriod = 6;
-
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::NewL()
-// -----------------------------------------------------------------------------
-//
-CGSSIPTimer* CGSSIPTimer::NewL( const CCoeControl& aContainer, 
-                                CListItemDrawer& aListItemDrawer )
-    {
-    __GSLOGSTRING("CGSSIPTimer::NewL" )
-    CGSSIPTimer* self = new( ELeave ) CGSSIPTimer( aContainer, aListItemDrawer );
-        
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::CGSSIPTimer()
-// -----------------------------------------------------------------------------
-//
-CGSSIPTimer::CGSSIPTimer( const CCoeControl& aContainer, 
-                          CListItemDrawer& aListItemDrawer )
-    : iTotal( 0 ),
-      iContainer ( aContainer ),
-      iListItemDrawer ( aListItemDrawer ),
-      iIfStart ( EFalse )
-    {
-    __GSLOGSTRING("CGSSIPTimer::CGSSIPTimer" )
-    }
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::~CGSSIPTimer()
-// DestructL.
-// -----------------------------------------------------------------------------
-//
-CGSSIPTimer::~CGSSIPTimer()
-    {
-    __GSLOGSTRING("CGSSIPTimer::~CGSSIPTimer" )
-    delete iHeart;
-    iHeart = NULL;
-    }
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::ConstructL()
-// ConstructL.
-// -----------------------------------------------------------------------------
-//
-void CGSSIPTimer::ConstructL()
-    {
-    iHeart = CHeartbeat::NewL( CActive::EPriorityStandard );
-    }
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::StartTimer()
-// Start a Heart beat.
-// -----------------------------------------------------------------------------
-//
-void CGSSIPTimer::StartTimer()
-    {
-    __GSLOGSTRING("CGSSIPTimer::StartTimer" )
-    iTotal = 0;
-    
-    if ( !iIfStart )
-        {
-        iIfStart = ETrue;
-        iHeart->Start( ETwelveOClock, this );
-        }
-    
-    }
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::StopTimer()
-// Stop a Heart beat.
-// -----------------------------------------------------------------------------
-//
-void CGSSIPTimer::StopTimer()
-    {
-    __GSLOGSTRING("CGSSIPTimer::StopTimer" )
-    if (iIfStart )
-        {
-         iHeart->Cancel();
-        iIfStart = EFalse;
-        iTotal = 0;
-        }
-    else
-        {
-        iListItemDrawer.SetFlags( CTextListItemDrawer::EDisableHighlight );
-        iContainer.DrawNow();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::Beat()
-// Count and stop stop.
-// -----------------------------------------------------------------------------
-//
-void CGSSIPTimer::Beat()
-    {
-    iTotal++;
-     if( iTotal >= KTimerPeriod )
-         {
-          StopTimer();
-          iListItemDrawer.SetFlags( CTextListItemDrawer::EDisableHighlight );
-          iContainer.DrawNow();
-         }
-    }
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::Synchronize()
-// Synchronize.
-// -----------------------------------------------------------------------------
-//
-void CGSSIPTimer::Synchronize()
-    {
-    return;
-    }
-
-// -----------------------------------------------------------------------------
-// CGSSIPTimer::IsStarted()
-// IsStarted.
-// -----------------------------------------------------------------------------
-//
-TBool CGSSIPTimer::IsStarted() const
-    {
-    return iIfStart;
-    }
-
-//  End of File  
--- a/sipplugins/sippsipsettingsui/src/sipserversettingvalidator.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/sipserversettingvalidator.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 #include    <StringLoader.h>
 #include    <escapeutils.h>
-#include    <aknutils.h>
+#include    <AknUtils.h>
 #include    <sipstrings.h>
 #include    <sipaddress.h>
 #include    <gssipsettingspluginrsc.rsg> //GUI Resource
--- a/sipplugins/sippsipsettingsui/src/sipsettingscontainer.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/sipsettingscontainer.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -18,16 +18,16 @@
 
 // INCLUDE FILES
 #include    <aknlists.h>
-#include    <csxhelp/cp.hlp.hrh>
+#include    <cshelp/conset.hlp.hrh>
 #include    <gsfwviewuids.h>
 #include    <gssipsettingspluginrsc.rsg>
 #include    <gssipsettingsplugin.mbg>
 #include    <AknIconArray.h>
-#include    <aknsutils.h>     //for loading icons
+#include    <AknsUtils.h>     //for loading icons
 #include    <akntitle.h>
 #include    <eikspane.h>
 #include     <aknnavi.h>
-#include    <stringloader.h>
+#include    <StringLoader.h>
 #include    "sipsettingscontainer.h"
 #include    "sipsettingsmodel.h"
 #include    "sipsettingsplugin.h"
@@ -243,10 +243,6 @@
     naviContainer->PushDefaultL();
 
     CreateWindowL();
-    iLongTapDetector = CAknLongTapDetector::NewL( this );
-    
-    SetLongPress( EFalse );
-
     // Initialize list box outlook    
     iListBox = new ( ELeave ) CListBox;
     iListBox->SetContainerWindowL( *this );
@@ -311,9 +307,6 @@
         iListBox->SetCurrentItemIndex( aActiveIndex );
         }
 
-    iTimer = CGSSIPTimer::NewL( *this, *(iListBox->View()->ItemDrawer()) );
-    
-    iStylusPopupMenu = NULL;
     
     DrawNow();
     __GSLOGSTRING("CSIPSettingsContainer::ConstructL End" )
@@ -328,12 +321,6 @@
     {
     __GSLOGSTRING("CSIPSettingsContainer::~CSIPSettingsContainer" )
     delete iListBox;    
-    delete iLongTapDetector;
-    iLongTapDetector = NULL;
-    delete iStylusPopupMenu;
-    iStylusPopupMenu = NULL;
-    delete iTimer;
-    iTimer = NULL;
     }
 
 // -----------------------------------------------------------------------------
@@ -463,14 +450,6 @@
     TEventCode aType )
     {   
     __GSLOGSTRING("CSIPSettingsContainer::OfferKeyEventL" )
-    if ( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow )
-        {
-        iListBox->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
-
-        iTimer->StartTimer();
-
-        }
-
     if ( aType == EEventKey && aKeyEvent.iCode == EKeyBackspace )
         {
          iObs->HandleCommandL( EGSCmdAppDelete );
@@ -494,8 +473,6 @@
         {
         iListBox->SetFocus( IsFocused(), aDrawNow );
         }
-       iTimer -> StopTimer();
-          
     }
 
 // ---------------------------------------------------------------------------
@@ -532,41 +509,6 @@
     }  
 
 // -----------------------------------------------------------------------------
-// CSIPSettingsContainer::HandleLongTapEventL()
-// Responds to Long Tap Event
-// -----------------------------------------------------------------------------
-//
-void CSIPSettingsContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /*aPenEventScreenLocation*/ )
-    {
-     __GSLOGSTRING("CSIPSettingsContainer::HandleLongTapEventL" )
-   
-    iPoint = aPenEventLocation;
-        
-    delete iStylusPopupMenu;
-    iStylusPopupMenu = NULL;
-         
-    iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , PenEventLocation() ); 
-    TResourceReader reader;  
-    iCoeEnv->CreateResourceReaderLC( reader, R_STYLUS_POPUP_MENU ); 
-    iStylusPopupMenu->ConstructFromResourceL( reader );  
-    CleanupStack::PopAndDestroy(); 
- 
-    iStylusPopupMenu->ShowMenu();  
-    iStylusPopupMenu->SetPosition( PenEventLocation() );
-    SetLongPress( ETrue );
-    }
-
-// -----------------------------------------------------------------------------
-// CSIPSettingsContainer::HandleLongTapEventL()
-// Responds to Long Tap Event
-// -----------------------------------------------------------------------------
-//
-TPoint CSIPSettingsContainer::PenEventLocation()
-    {
-     return iPoint;
-    }
-
-// -----------------------------------------------------------------------------
 // CSIPSettingsContainer::ProcessCommandL()
 // Handle ProcessCommandL
 // -----------------------------------------------------------------------------
@@ -576,10 +518,6 @@
     __GSLOGSTRING1("CSIPSettingsContainer::ProcessCommandL aCommand: %d", aCommand)
     switch( aCommand )    
         {
-        case EGSCmdAppEdit:
-            iObs->EditProfileL();
-        break;
-        
         case EGSCmdAppDelete:
             iObs->DeleteProfileL();
         break;
@@ -590,70 +528,9 @@
         break;
         }
     }
-
-// -----------------------------------------------------------------------------
-// CSIPSettingsContainer::HandlePointerEventL()
-// Responds to a Pointer Event.
-// -----------------------------------------------------------------------------
-//
-void CSIPSettingsContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
-    {
-    __GSLOGSTRING("CSIPSettingsContainer::HandlePointerEventL" )
-      iListBox->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
-      DrawNow();   
-      iPointerEvent = aPointerEvent;
-      CCoeControl::HandlePointerEventL( aPointerEvent );
-    }
-
-// -----------------------------------------------------------------------------
-// CSIPSettingsContainer::IfPointerEvent()
-// Check if it is Pointer Event.
-// -----------------------------------------------------------------------------
-//
-TBool CSIPSettingsContainer::IfPointerEvent()
-    {
-    __GSLOGSTRING("CSIPSettingsContainer::IfPointerEvent" )
-     return !( iTimer->IsStarted() );
-    }
-
 void CSIPSettingsContainer::SetEmphasis( CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ )
     {
      
     }
 
-
-// -----------------------------------------------------------------------------
-// CSIPSettingsContainer::LongPressStatus()
-// Check if Long Press happen.
-// -----------------------------------------------------------------------------
-//
-TBool CSIPSettingsContainer::LongPressStatus()
-    {
-    return iLongPress;
-    }
-
-// -----------------------------------------------------------------------------
-// CSIPSettingsContainer::SetLongPress()
-// Set Long Press.
-// -----------------------------------------------------------------------------
-//
-void CSIPSettingsContainer::SetLongPress(TBool aLongPress )
-    {
-    __GSLOGSTRING("CSIPSettingsContainer::SetLongPress" )
-    this->iLongPress = aLongPress;
-    }
-
-
-CAknLongTapDetector* CSIPSettingsContainer::LongTapDetector()
-	{
-	return iLongTapDetector;
-	}
-
-
-TPointerEvent CSIPSettingsContainer::PointerEvent()
-	{
-	return iPointerEvent;
-	}
-
-
 //  End of File  
--- a/sipplugins/sippsipsettingsui/src/sipsettingsmodel.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/sipsettingsmodel.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-
+#include    <aknnotewrappers.h>
 #include    <e32std.h>
 #include    <escapeutils.h>
 #include    <StringLoader.h>
@@ -111,7 +111,18 @@
     TInt aIndex )
     {
     __GSLOGSTRING1("CSIPSettingsModel::SetDefaultProfileL index: %d", aIndex)
-	iHandler->SetDefaultProfileL( aIndex );
+    TRAPD(err, iHandler->SetDefaultProfileL( aIndex ));		
+      if ( err == KErrInUse )
+    	  {
+          HBufC* txtErr = StringLoader::LoadLC( R_QTN_SIP_ERROR_PROFILE_USED );
+          CAknErrorNote* note = new ( ELeave ) CAknErrorNote( ETrue );
+          note->ExecuteLD( txtErr->Des() );
+          CleanupStack::PopAndDestroy( txtErr );
+    	  }
+      else
+    	  {
+          User::Leave( err );
+    	  }
     }
 
 // -----------------------------------------------------------------------------
--- a/sipplugins/sippsipsettingsui/src/sipsettingsplugin.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/sipsettingsplugin.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -79,7 +79,7 @@
     iResourceLoader.Close();
     
     delete iModel;
-       delete iHandler;
+    delete iHandler;
     }
 
 // -----------------------------------------------------------------------------
@@ -481,21 +481,11 @@
     {
     __GSLOGSTRING("CSIPSettingsPlugin::HandleListBoxEventL " )
     __GSLOGSTRING1("CSIPSettingsPlugin::HandleListBoxEventL aEventType: %d", aEventType)
-     
-    if( EEventPenDownOnItem == aEventType )
-        {
-        iContainer->LongTapDetector()->PointerEventL( iContainer->PointerEvent() );
-        return;
-        }
     if( EEventItemSingleClicked == aEventType ||
     		  EEventEnterKeyPressed == aEventType )
 	    {
-    	if ( !iContainer->LongPressStatus() )
-    	    {
     	    EditProfileL();
-    	    }
 	    }
-	    iContainer ->SetLongPress( EFalse );
     }
 
 // -----------------------------------------------------------------------------
@@ -718,18 +708,11 @@
     {    
     __GSLOGSTRING("CSIPSettingsPlugin::DynInitMenuPaneL" )
     // Delete Help item if feature is not supported
-    if( aResourceId == R_GS_SIP_PROFILE_LIST_VIEW_MENU ) 
+    if( aResourceId == R_GS_SIP_PROFILE_LIST_VIEW_MENU && 
+		!FeatureManager::FeatureSupported( KFeatureIdHelp ) ) 
         {
-        if ( iContainer->IfPointerEvent() )
-            {
-            aMenuPane->SetItemDimmed( EGSCmdAppEdit, ETrue );
-            aMenuPane->SetItemDimmed( EGSCmdAppDelete, ETrue );
-            aMenuPane->SetItemDimmed( EGSCmdAppDefault, ETrue );
-            }
-        if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
-            {
+
             aMenuPane->DeleteMenuItem( EAknCmdHelp );
-            }
         }    
         
     if ( aResourceId == R_GS_SIP_PROFILE_LIST_VIEW_MENU && 
--- a/sipplugins/sippsipsettingsui/src/sipsettlistsipprofsetcontainer.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/sipsettlistsipprofsetcontainer.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 #include    <eikappui.h>
 #include    <eikenv.h>
-#include    <csxhelp/cp.hlp.hrh>
+#include    <cshelp/conset.hlp.hrh>
 #include    <gsfwviewuids.h>
 #include    <aknsettingitemlist.h>
 #include    "sipsettlistsipprofsetcontainer.h"
@@ -80,8 +80,6 @@
     
     iItemList->ListBox()->SetCurrentItemIndex( Uiindex );    
     DrawNow();
-    
-    iTimer = CGSSIPTimer::NewL( *this, *(iItemList->ListBox()->View()->ItemDrawer()) );
     }
 
 // -----------------------------------------------------------------------------
@@ -113,8 +111,6 @@
     {
     __GSLOGSTRING("CSIPSettListSIPProfSetContainer::~CSIPSettListSIPProfSetContainer" )  
     delete iItemList;
-    delete iTimer;
-    iTimer = NULL;
     }
 
 // -----------------------------------------------------------------------------
@@ -205,15 +201,7 @@
     TEventCode aType )
     {
     __GSLOGSTRING("CSIPSettListSIPProfSetContainer::OfferKeyEventL" ) 
-    // Pass the key event to list box
-    if ( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow )
-        {
-        iItemList->ListBox()->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
-
-        iTimer->StartTimer();
-
-        }
-    
+   
     return iItemList->OfferKeyEventL( aKeyEvent, aType );
     }
     
@@ -230,8 +218,6 @@
         {
       iItemList->SetFocus( IsFocused(), aDrawNow );
         }
-        iTimer->StopTimer();
-
     }
 
 // ---------------------------------------------------------------------------
@@ -273,20 +259,6 @@
 void CSIPSettListSIPProfSetContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
     {
     __GSLOGSTRING("CSIPSettListSIPProfSetContainer::HandlePointerEventL" )
-     iItemList->ListBox()->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
-     DrawNow();    
      CCoeControl::HandlePointerEventL( aPointerEvent );
     }
-
-// -----------------------------------------------------------------------------
-// CSIPSettListSIPProfSetContainer::IfPointerEvent()
-// Check if it is Pointer Event.
-// -----------------------------------------------------------------------------
-//
-TBool CSIPSettListSIPProfSetContainer::IfPointerEvent()
-    {
-     return !( iTimer->IsStarted() );
-    }
-
-//Second
 //  End of File  
--- a/sipplugins/sippsipsettingsui/src/sipsettlistsipprofsetview.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/sipsettlistsipprofsetview.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -24,7 +24,7 @@
 #include    <akntitle.h>
 #include    <hlplch.h>
 #include    <featmgr.h>
-#include    <stringloader.h>
+#include    <StringLoader.h>
 #include    "sipsettlistsipprofsetview.h"
 #include    "sipsettlistsipprofsetcontainer.h"
 #include    "sipsettlistsipprofsetmodel.h"
@@ -292,7 +292,7 @@
     if( aResourceId == R_GS_SIP_PROFILE_SETTING_VIEW_MENU ) 
         {
         // iView might be NULL
-        if( iView && iView->IfPointerEvent() )
+        if( iView )
             {
             aMenuPane->SetItemDimmed( EGSCmdAppChange, ETrue );
             }
--- a/sipplugins/sippsipsettingsui/src/sipsettlistsipsrvsetcontainer.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/sipsettlistsipsrvsetcontainer.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -20,7 +20,7 @@
 // INCLUDE FILES
 
 #include    <aknview.h>
-#include    <csxhelp/cp.hlp.hrh>
+#include    <cshelp/conset.hlp.hrh>
 #include    <gsfwviewuids.h>
 #include    <gssipsettingspluginrsc.rsg> //GUI Resource
 #include    "sipsettlistsipsrvsetcontainer.h"
@@ -75,7 +75,6 @@
     // Set limits to the view & activate it
     SetRect( aRect );    
     ActivateL();
-    iTimer = CGSSIPTimer::NewL( *this, *(iItemList->ListBox()->View()->ItemDrawer()) );
     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::ConstructL End" )  
     }
 
@@ -108,8 +107,6 @@
     {    
     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::~CSIPSettListSIPSrvSetContainer" )
     delete iItemList;
-    delete iTimer;
-    iTimer = NULL;
     }
 
 // -----------------------------------------------------------------------------
@@ -192,13 +189,7 @@
     {
     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::OfferKeyEventL" )
     // Pass the key event to list box
-    if ( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow )
-        {
-        iItemList->ListBox()->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
-        DrawNow();
-        iTimer->StartTimer();
 
-        }
     return iItemList->OfferKeyEventL( aKeyEvent, aType );    
     }
 
@@ -215,7 +206,6 @@
         iItemList->SetFocus( IsFocused(), aDrawNow );
         }
     
-            iTimer->StopTimer();
      
         CCoeControl::FocusChanged( aDrawNow );
     
@@ -267,8 +257,6 @@
 void CSIPSettListSIPSrvSetContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
     {
     __GSLOGSTRING("CSIPSettListSIPSrvSetContainer::HandlePointerEventL" ) 
-     iItemList->ListBox()->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
-     DrawNow();
      CCoeControl::HandlePointerEventL( aPointerEvent );
     }
 
@@ -277,10 +265,7 @@
 // Check if it is Pointer Event.
 // -----------------------------------------------------------------------------
 //
-TBool CSIPSettListSIPSrvSetContainer::IfPointerEvent()
-    {
-    return !( iTimer->IsStarted() );
-    }
+
 
 //Third
 //  End of File  
--- a/sipplugins/sippsipsettingsui/src/sipsettlistsipsrvsetview.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/src/sipsettlistsipsrvsetview.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -20,7 +20,7 @@
 // INCLUDE FILES
 #include    <aknViewAppUi.h>
 #include    <akntitle.h>
-#include    <stringloader.h>
+#include    <StringLoader.h>
 #include    <hlplch.h>
 #include    <featmgr.h>
 #include    <gssipsettingspluginrsc.rsg> //GUI Resource
@@ -217,7 +217,7 @@
     if( aResourceId == R_GS_SIP_SERVER_SETTING_VIEW_MENU ) 
         {
         // iView might be NULL
-        if( iView && iView->IfPointerEvent() )
+        if( iView )
         	{
         	aMenuPane->SetItemDimmed( EGSCmdAppChange, ETrue );
         	}
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/group/ut_sipsettingsplugin.mmp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/group/ut_sipsettingsplugin.mmp	Fri Apr 16 15:18:54 2010 +0300
@@ -30,7 +30,6 @@
 SOURCEPATH              ../src
 SOURCE                  ut_sipsettingsplugindllmain.cpp
 SOURCE                  ut_gssipprofileutil.cpp
-SOURCE                  ut_gssiptimer.cpp
 SOURCE                  ut_sipsettlistsipsrvsetview.cpp
 SOURCE                  ut_sipsettListsipprofsetview.cpp
 SOURCE                  ut_sipsettingscontainer.cpp
@@ -51,7 +50,6 @@
 // Tested classes
 SOURCEPATH              ../../../src
 SOURCE					gssipprofileutil.cpp
-SOURCE					gssiptimer.cpp
 SOURCE                                  sipsettlistsipsrvsetview.cpp
 SOURCE                                  sipsettlistsipregsetview.cpp
 SOURCE                                  gssipmodel.cpp
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/inc/ut_gssiptimer.h	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-
-#ifndef __UT_GSSIPTIMER_H__
-#define __UT_GSSIPTIMER_H__
-
-
-//  EXTERNAL INCLUDES
-#include <ceunittestsuiteclass.h>
-#include <eunitmacros.h>
-
-#include "gssiptimer.h"
-
-//  FORWARD DECLARATIONS
-class CGSSIPTimer;
-
-
-//  CLASS DEFINITION
-/**
- * Tester class for UT_GSSIPTimer. 
- * 
- */
-class UT_GSSIPTimer : public CEUnitTestSuiteClass
-    {
-    public:     // Constructors and destructors
-
-        /**
-         * Two phase construction
-         */
-        static UT_GSSIPTimer* NewL();
-        static UT_GSSIPTimer* NewLC();
-        
-        /**
-         * Destructor
-         */
-        ~UT_GSSIPTimer();
-
-    private: // Constructors and destructors
-
-        UT_GSSIPTimer();
-        void ConstructL();
-        
-    private: // Test case setup and teardown
-
-        void SetupL();
-
-        void Teardown();
-
-    private: // Test methods
-        void UT_GSSIPTimer_Beat();
-        void UT_GSSIPTimer_Synchronize();
-        void UT_GSSIPTimer_StartTimer();
-        void UT_GSSIPTimer_StopTimer();
-        void UT_GSSIPTimer_IsStarted();
-        
-    private:    // Data
-        EUNIT_DECLARE_TEST_TABLE;
-        CGSSIPTimer* iTimer;
-        CCoeControl* iCoeControl;
-        CTextListItemDrawer* iItemDraw;
-
-    };
-
-#endif  // __UT_GSSIPTIMER_H__
-
-// End of file
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/inc/ut_sipsettingscontainer.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/inc/ut_sipsettingscontainer.h	Fri Apr 16 15:18:54 2010 +0300
@@ -64,16 +64,9 @@
     private: // Test methods
 		void UT_CSIPSettingsContainer_OfferKeyEventLL();
         void UT_CSIPSettingsContainer_FocusChangedL();
-        void UT_CSIPSettingsContainer_HandleLongTapEventLL();
         void UT_CSIPSettingsContainer_ProcessCommandLL();
-        void UT_CSIPSettingsContainer_HandlePointerEventLL();
-        void UT_CSIPSettingsContainer_IfPointerEventL();
         void UT_CSIPSettingsContainer_SetEmphasisL();
-        void UT_CSIPSettingsContainer_LongPressStatusL();
-        void UT_CSIPSettingsContainer_SetLongPressL();
-        void UT_CSIPSettingsContainer_StylusPopupMenuL();
-        void UT_CSIPSettingsContainer_SetStylusPopupMenuL();
-        void UT_CSIPSettingsContainer_PenEventLocationL();
+
         
     private:    // Data
 
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/inc/ut_sipsettlistsipprofsetcontainer.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/inc/ut_sipsettlistsipprofsetcontainer.h	Fri Apr 16 15:18:54 2010 +0300
@@ -74,8 +74,6 @@
         void TestOfferKeyEventL();
         void TestHandleResourceChange();
         void TestGetHelpContext();
-        void TestHandlePointerEventL();
-        void TestIfPointerEvent();
         void TestFocusChanged();
         
     private:    // Data
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/sipmanagedprofilestub.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/sipmanagedprofilestub.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -117,8 +117,7 @@
 // -----------------------------------------------------------------------------
 //	
 CSIPManagedProfile::CSIPManagedProfile(CSIPManagedProfileRegistry* aRegistry) 
-    :  CSIPProfile( aRegistry ),
-       iProfileReg( aRegistry )
+    :  CSIPProfile( aRegistry )
 	{
 	}
 
@@ -306,8 +305,6 @@
     //const CSIPManagedProfile* temp = this;
     //return new (ELeave) CSIPManagedProfile(*this);
     //return this;
-    CSIPManagedProfile* rValue = 
-                    CSIPManagedProfile::NewLC( iProfileReg );
+    return NULL;
 
-    return rValue;
     }
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_gssipprofileutil.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_gssipprofileutil.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -150,7 +150,6 @@
 		settingsData.iSNAPIndex = KDefaultSNAP;
 		settingsData.iAPIndex = KAccessPointIdValue;
 		settingsData.iCompression = KSigCompValue;
-		settingsData.iRegistrationMode = EGSAlwaysOnHome;
 		settingsData.iSecurity = KSecurityNegotiationValue;
 		settingsData.iServiceProfile.iSIPProfileName = KProviderNameValue;
 		settingsData.iServiceProfile.iSIPProfileClass = 
@@ -182,7 +181,6 @@
 		settingsData.iSNAPIndex = KSnapIdValue;
 		settingsData.iAPIndex = KAccessPointIdValue + 1;
 		settingsData.iCompression = KSigCompValue;
-		settingsData.iRegistrationMode = EGSAlwaysOnHome;
 		settingsData.iSecurity = KSecurityNegotiationValue;
 		settingsData.iServiceProfile.iSIPProfileName = KProviderNameValue;
 		settingsData.iServiceProfile.iSIPProfileClass = 
@@ -212,7 +210,6 @@
 		settingsData.iSNAPIndex = KDefaultSNAP;
 		settingsData.iAPIndex = KAccessPointIdValue + 1;
 		settingsData.iCompression = KSigCompValue;
-		settingsData.iRegistrationMode = EGSAlwaysOnHome;
 		settingsData.iSecurity = KSecurityNegotiationValue;
 		settingsData.iServiceProfile.iSIPProfileName = KProviderNameValue;
 		settingsData.iServiceProfile.iSIPProfileClass = TSIPProfileTypeInfo::EInternet;
@@ -241,7 +238,6 @@
 		settingsData.iSNAPIndex = KSnapIdValue + 1;
 		settingsData.iAPIndex = KAccessPointIdValue + 1;
 		settingsData.iCompression = KSigCompValue;
-		settingsData.iRegistrationMode = EGSAlwaysOnHome;
 		settingsData.iSecurity = KSecurityNegotiationValue;
 		settingsData.iServiceProfile.iSIPProfileName = KProviderNameValue;
 		settingsData.iServiceProfile.iSIPProfileClass = TSIPProfileTypeInfo::EInternet;
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_gssiptimer.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-
-//  INTERNAL INCLUDES
-
-#include "ut_gssiptimer.h"
-
-//  SYSTEM INCLUDES
-#include <eunitmacros.h>
-
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-UT_GSSIPTimer* UT_GSSIPTimer::NewL()
-    {
-    UT_GSSIPTimer* self = UT_GSSIPTimer::NewLC();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-UT_GSSIPTimer* UT_GSSIPTimer::NewLC()
-    {
-    UT_GSSIPTimer* self = new( ELeave ) UT_GSSIPTimer();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-UT_GSSIPTimer::~UT_GSSIPTimer()
-    {
-    // NOP
-    }
-
-
-// -----------------------------------------------------------------------------
-// Default constructor
-// -----------------------------------------------------------------------------
-//
-UT_GSSIPTimer::UT_GSSIPTimer()
-    {
-    // NOP
-    }
-
-
-// -----------------------------------------------------------------------------
-// Second phase construct
-// -----------------------------------------------------------------------------
-//
-void UT_GSSIPTimer::ConstructL()
-    {
-    // The ConstructL from the base class CEUnitTestSuiteClass must be called.
-    // It generates the test case table.
-    CEUnitTestSuiteClass::ConstructL();
-    }
-    
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void UT_GSSIPTimer::SetupL()
-    {
-    CCoeControl* coeControl = new ( ELeave ) CCoeControl;
-    CTextListItemDrawer* itemDraw = new ( ELeave ) CTextListItemDrawer;
-    iTimer = CGSSIPTimer::NewL( *coeControl, *itemDraw );
-    }
-
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void UT_GSSIPTimer::Teardown()
-    {
-    delete iItemDraw;
-    iItemDraw = NULL;
-    
-    delete iCoeControl;
-    iCoeControl = NULL;
-    
-    delete iTimer;
-    iTimer = NULL;
-    }
-
-
-
-// TEST CASES
-
-// -----------------------------------------------------------------------------
-// UT_GSSIPTimer_Beat()
-// -----------------------------------------------------------------------------
-//
-void UT_GSSIPTimer::UT_GSSIPTimer_Beat()
-    {
-    const TInt KTimerPeriod = 6;
-    
-    iTimer->iIfStart = EFalse;
-    iTimer->iTotal = KTimerPeriod - 1;
-    iTimer->Beat();
-    EUNIT_ASSERT_EQUALS( iTimer->iTotal, KTimerPeriod );
-    EUNIT_ASSERT_EQUALS( iTimer->iIfStart, EFalse );   
-    
-    iTimer->iIfStart = ETrue;
-    iTimer->iTotal = KTimerPeriod - 1;
-    iTimer->Beat();
-    EUNIT_ASSERT_EQUALS( iTimer->iTotal, 0 );
-    EUNIT_ASSERT_EQUALS( iTimer->iIfStart, EFalse );   
-    
-    iTimer->Beat();
-    EUNIT_ASSERT_EQUALS( iTimer->iTotal, 1 );
-    }
-
-
-// -----------------------------------------------------------------------------
-// UT_GSSIPTimer_Synchronize()
-// -----------------------------------------------------------------------------
-//
-void UT_GSSIPTimer::UT_GSSIPTimer_Synchronize()
-    {
-    iTimer->Synchronize();
-    EUNIT_ASSERT( ETrue );
-    }
-
-
-// -----------------------------------------------------------------------------
-// UT_GSSIPTimer_StartTimer()
-// -----------------------------------------------------------------------------
-//
-void UT_GSSIPTimer::UT_GSSIPTimer_StartTimer()
-    {
-    iTimer->iTotal = 2;
-    iTimer->iIfStart = EFalse;
-    iTimer->StartTimer();
-    EUNIT_ASSERT_EQUALS( iTimer->iIfStart, ETrue );
-    EUNIT_ASSERT_EQUALS( iTimer->iTotal, 0 )  
-    
-    iTimer->iTotal = 2;
-    iTimer->iIfStart = ETrue;
-    iTimer->StartTimer();
-    EUNIT_ASSERT_EQUALS( iTimer->iIfStart, ETrue );
-    EUNIT_ASSERT_EQUALS( iTimer->iTotal, 0 )
-    }
-
-
-// -----------------------------------------------------------------------------
-// UT_GSSIPTimer_StopTimer()
-// -----------------------------------------------------------------------------
-//
-void UT_GSSIPTimer::UT_GSSIPTimer_StopTimer()
-    {
-    iTimer->iIfStart = EFalse;
-    iTimer->StopTimer();
-    EUNIT_ASSERT_EQUALS( iTimer->iIfStart, EFalse );
-          
-    iTimer->iIfStart = ETrue;
-    iTimer->StopTimer();
-    EUNIT_ASSERT_EQUALS( iTimer->iIfStart, EFalse );   
-    }
-
-
-// -----------------------------------------------------------------------------
-// UT_GSSIPTimer_IsStarted()
-// -----------------------------------------------------------------------------
-//
-void UT_GSSIPTimer::UT_GSSIPTimer_IsStarted()
-    {
-    iTimer->iIfStart = EFalse;
-    EUNIT_ASSERT_EQUALS( iTimer->IsStarted(), EFalse );
-    
-    iTimer->iIfStart = ETrue;
-    EUNIT_ASSERT_EQUALS( iTimer->IsStarted(), ETrue );   
-    }
-
-
-//  TEST TABLE
-
-EUNIT_BEGIN_TEST_TABLE(
-    UT_GSSIPTimer,
-    "UT_GSSIPTimer",
-    "UNIT" )
-    
-EUNIT_TEST(
-    "Beat - test ",
-    "UT_GSSIPTimer",
-    "Beat",
-    "FUNCTIONALITY",
-    SetupL, UT_GSSIPTimer_Beat, Teardown)    
-
-EUNIT_TEST(
-    "Synchronize - test ",
-    "UT_GSSIPTimer",
-    "Synchronize",
-    "FUNCTIONALITY",
-    SetupL, UT_GSSIPTimer_Synchronize, Teardown)    
-
-EUNIT_TEST(
-    "StartTimer - test ",
-    "UT_GSSIPTimer",
-    "StartTimer",
-    "FUNCTIONALITY",
-    SetupL, UT_GSSIPTimer_StartTimer, Teardown)    
-
-EUNIT_TEST(
-    "StopTimer - test ",
-    "UT_GSSIPTimer",
-    "StopTimer",
-    "FUNCTIONALITY",
-    SetupL, UT_GSSIPTimer_StopTimer, Teardown)    
-    
-EUNIT_TEST(
-    "IsStarted - test ",
-    "UT_GSSIPTimer",
-    "IsStarted",
-    "FUNCTIONALITY",
-    SetupL, UT_GSSIPTimer_IsStarted, Teardown)        
-        
-EUNIT_END_TEST_TABLE
-
-//  END OF FILE
-
-
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettingscontainer.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettingscontainer.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -157,15 +157,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// UT_CSIPSettingsContainer_HandleLongTapEventLL()
-// -----------------------------------------------------------------------------
-//
-void UT_CSIPSettingsContainer::UT_CSIPSettingsContainer_HandleLongTapEventLL()
-	{
-    //Yes
-    }
-
-// -----------------------------------------------------------------------------
 // UT_CSIPSettingsContainer_ProcessCommandLL()
 // -----------------------------------------------------------------------------
 //
@@ -190,24 +181,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// UT_CSIPSettingsContainer_HandlePointerEventLL()
-// -----------------------------------------------------------------------------
-//
-void UT_CSIPSettingsContainer::UT_CSIPSettingsContainer_HandlePointerEventLL()
-	{
-	//Yes
-    }
-
-// -----------------------------------------------------------------------------
-// UT_CSIPSettingsContainer_IfPointerEventL()
-// -----------------------------------------------------------------------------
-//
-void UT_CSIPSettingsContainer::UT_CSIPSettingsContainer_IfPointerEventL()
-	{
-	//Yes
-    }
-
-// -----------------------------------------------------------------------------
 // UT_CSIPSettingsContainer_SetEmphasisL()
 // -----------------------------------------------------------------------------
 //
@@ -216,86 +189,6 @@
 	iSipSettingsContainer->SetEmphasis(NULL,NULL);
     }
 
-// -----------------------------------------------------------------------------
-// UT_CSIPSettingsContainer_LongPressStatusL()
-// -----------------------------------------------------------------------------
-//
-void UT_CSIPSettingsContainer::UT_CSIPSettingsContainer_LongPressStatusL()
-	{
-	TBool result = EFalse;
-
-	iSipSettingsContainer->iLongPress = ETrue;
-	result = iSipSettingsContainer->LongPressStatus();
-	EUNIT_ASSERT_EQUALS( result, ETrue ); 
-	
-	iSipSettingsContainer->iLongPress = EFalse;
-	result = iSipSettingsContainer->LongPressStatus();
-	EUNIT_ASSERT_EQUALS( result, EFalse ); 
-    }
-
-// -----------------------------------------------------------------------------
-// UT_CSIPSettingsContainer_SetLongPress()
-// -----------------------------------------------------------------------------
-//
-void UT_CSIPSettingsContainer::UT_CSIPSettingsContainer_SetLongPressL()
-	{
-	iSipSettingsContainer->SetLongPress(ETrue);
-	EUNIT_ASSERT_EQUALS( iSipSettingsContainer->iLongPress, ETrue ); 
-	
-	iSipSettingsContainer->SetLongPress(EFalse);
-	EUNIT_ASSERT_EQUALS( iSipSettingsContainer->iLongPress, EFalse ); 
-    }
-
-// -----------------------------------------------------------------------------
-// UT_CSIPSettingsContainer_StylusPopupMenuL()
-// -----------------------------------------------------------------------------
-//
-void UT_CSIPSettingsContainer::UT_CSIPSettingsContainer_StylusPopupMenuL()
-	{
-	CAknStylusPopUpMenu *result = NULL;
-	result = iSipSettingsContainer->StylusPopupMenu();
-	}
-
-// -----------------------------------------------------------------------------
-// UT_CSIPSettingsContainer_SetStylusPopupMenuL()
-// -----------------------------------------------------------------------------
-//
-void UT_CSIPSettingsContainer::UT_CSIPSettingsContainer_SetStylusPopupMenuL()
-	{
-	CAknStylusPopUpMenu *styluspopupmenu = NULL;
-	styluspopupmenu = iSipSettingsContainer->iStylusPopupMenu;
-	
-	iSipSettingsContainer->SetStylusPopupMenu(NULL);
-	EUNIT_ASSERT(iSipSettingsContainer->iStylusPopupMenu == NULL);
-	
-	iSipSettingsContainer->iStylusPopupMenu = styluspopupmenu;
-	
-	}
-
-// -----------------------------------------------------------------------------
-// UT_CSIPSettingsContainer_PenEventLocationL()
-// -----------------------------------------------------------------------------
-//
-void UT_CSIPSettingsContainer::UT_CSIPSettingsContainer_PenEventLocationL()
-	{
-	TPoint oldpoint;
-	
-	TPoint point;
-	point.iX = 10;
-	point.iY = 10;
-	
-	TPoint pointresult;
-	
-	oldpoint = iSipSettingsContainer->iPoint;
-	iSipSettingsContainer->iPoint = point;
-	pointresult = iSipSettingsContainer->PenEventLocation();
-	EUNIT_ASSERT_EQUALS( pointresult.iX, 10 );
-	EUNIT_ASSERT_EQUALS( pointresult.iY, 10 );
-	
-	iSipSettingsContainer->iPoint = oldpoint;
-	}
-
-
 //  TEST TABLE
 
 EUNIT_BEGIN_TEST_TABLE(
@@ -318,13 +211,6 @@
     SetupL, UT_CSIPSettingsContainer_FocusChangedL, Teardown)
     
 EUNIT_TEST(
-    "HandleLongTapEventL - test ",
-    "CSIPSettingsContainer",
-    "HandleLongTapEventL",
-    "FUNCTIONALITY",
-    SetupL, UT_CSIPSettingsContainer_HandleLongTapEventLL, Teardown)
-    
-EUNIT_TEST(
     "ProcessCommandL - test ",
     "CSIPSettingsContainer",
     "ProcessCommandL",
@@ -332,61 +218,12 @@
     SetupL, UT_CSIPSettingsContainer_ProcessCommandLL, Teardown)
     
 EUNIT_TEST(
-    "HandlePointerEventL - test ",
-    "CSIPSettingsContainer",
-    "HandlePointerEventL",
-    "FUNCTIONALITY",
-    SetupL, UT_CSIPSettingsContainer_HandlePointerEventLL, Teardown)
-    
-EUNIT_TEST(
-    "IfPointerEvent - test ",
-    "CSIPSettingsContainer",
-    "IfPointerEvent",
-    "FUNCTIONALITY",
-    SetupL, UT_CSIPSettingsContainer_IfPointerEventL, Teardown)
-    
-EUNIT_TEST(
     "SetEmphasis - test ",
     "CSIPSettingsContainer",
     "SetEmphasis",
     "FUNCTIONALITY",
     SetupL, UT_CSIPSettingsContainer_SetEmphasisL, Teardown)
     
-EUNIT_TEST(
-    "LongPressStatus - test ",
-    "CSIPSettingsContainer",
-    "LongPressStatus",
-    "FUNCTIONALITY",
-    SetupL, UT_CSIPSettingsContainer_LongPressStatusL, Teardown)    
-    
-EUNIT_TEST(
-    "SetLongPressL - test ",
-    "CSIPSettingsContainer",
-    "SetLongPressL",
-    "FUNCTIONALITY",
-    SetupL, UT_CSIPSettingsContainer_SetLongPressL, Teardown)  
-//yes    
-EUNIT_TEST(
-    "StylusPopupMenuL - test ",
-    "CSIPSettingsContainer",
-    "StylusPopupMenuL",
-    "FUNCTIONALITY",
-    SetupL, UT_CSIPSettingsContainer_StylusPopupMenuL, Teardown)  
-    
-EUNIT_TEST(
-    "SetStylusPopupMenuL - test ",
-    "CSIPSettingsContainer",
-    "SetStylusPopupMenuL",
-    "FUNCTIONALITY",
-    SetupL, UT_CSIPSettingsContainer_SetStylusPopupMenuL, Teardown)      
-    
-EUNIT_TEST(
-    "PenEventLocationL - test ",
-    "CSIPSettingsContainer",
-    "PenEventLocationL",
-    "FUNCTIONALITY",
-    SetupL, UT_CSIPSettingsContainer_PenEventLocationL, Teardown)         
-    
 EUNIT_END_TEST_TABLE
 
 //  END OF FILE
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettingsplugindllmain.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettingsplugindllmain.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -19,7 +19,6 @@
 //  USER INCLUDES
 #include "ut_gssipprofileutil.h"
 #include "ut_sipsettingscontainer.h"
-#include "ut_gssiptimer.h"
 #include "ut_sipsettlistsipprofsetcontainer.h"
 #include "ut_sipsettlistsipsrvsetview.h"
 #include "ut_sipSettlistsipprofsetview.h"
@@ -45,9 +44,6 @@
     rootSuite->AddL( UT_SIPSettListSIPProfSetContainer::NewLC() );
     CleanupStack::Pop();    
     
-    rootSuite->AddL( UT_GSSIPTimer::NewLC() );
-    CleanupStack::Pop();
-    
     rootSuite->AddL( UT_SIPSettListSIPRegSetView::NewLC() );
     CleanupStack::Pop();
     
--- a/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettlistsipprofsetcontainer.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsipsettingsui/tsrc/UT_sipsettingsui/src/ut_sipsettlistsipprofsetcontainer.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -31,7 +31,6 @@
 #include "SIPSettListSIPProfSetModel.h"
 #include "SIPSettListSIPProfSetView.h"
 #include "gssipmodel.h"
-#include "gssiptimer.h"
 
 // -----------------------------------------------------------------------------
 //
@@ -231,30 +230,6 @@
     
     }
 
-// -----------------------------------------------------------------------------
-// TestHandlePointerEventL()
-// -----------------------------------------------------------------------------
-//
-void UT_SIPSettListSIPProfSetContainer::TestHandlePointerEventL()
-    {
-//    TPointerEvent event;
-//    event.iType = TPointerEvent::EButton1Down;
-//    iSipProfContainer->HandlePointerEventL( event );
-    }
-
-// -----------------------------------------------------------------------------
-// TestIfPointerEvent()
-// -----------------------------------------------------------------------------
-//
-void UT_SIPSettListSIPProfSetContainer::TestIfPointerEvent()
-    {
-//    iSipProfContainer->iTimer->iIfStart = ETrue;
-//	EUNIT_ASSERT_EQUALS( iSipProfContainer->IfPointerEvent(), EFalse ); 
-//
-//	iSipProfContainer->iTimer->iIfStart = EFalse;
-//	EUNIT_ASSERT_EQUALS( iSipProfContainer->IfPointerEvent(), ETrue ); 
-    }
-
 
 //  TEST TABLE
 
@@ -327,20 +302,6 @@
     SetupL, TestGetHelpContext, Teardown)
     
 EUNIT_TEST(
-    "HandlePointerEventL - test ",
-    "SIPSettListSIPProfSetContainer",
-    "HandlePointerEventL",
-    "FUNCTIONALITY",
-    SetupL, TestHandlePointerEventL, Teardown)
-    
-EUNIT_TEST(
-    "IfPointerEvent - test ",
-    "SIPSettListSIPProfSetContainer",
-    "IfPointerEvent",
-    "FUNCTIONALITY",
-    SetupL, TestIfPointerEvent, Teardown)
-    
-EUNIT_TEST(
     "FocusChanged - test ",
     "SIPSettListSIPProfSetContainer",
     "FocusChanged",
--- a/sipplugins/sippsystemstatemonitor/group/sipsystemstatemonitor.mmp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/group/sipsystemstatemonitor.mmp	Fri Apr 16 15:18:54 2010 +0300
@@ -26,9 +26,9 @@
 SOURCE	        sipsystemstatemonitorimpl.cpp
 SOURCE          sipsystemstatemonitorao.cpp
 SOURCE          sipsnapavailabilitymonitor.cpp
-SOURCE          CSystemStateConnUsagePermissionMonitor.cpp
 SOURCE 		siprfsmonitorao.cpp
 SOURCE		sipdevicestateaware.cpp
+SOURCE          sipvpnmonitorao.cpp
 
 SOURCEPATH      ../data
 START RESOURCE 10283311.rss 
@@ -46,6 +46,7 @@
 LIBRARY     connmon.lib
 LIBRARY     centralrepository.lib
 LIBRARY	    ssmcmn.lib
+LIBRARY     featmgr.lib
 
 VENDORID VID_DEFAULT
 
--- a/sipplugins/sippsystemstatemonitor/inc/CSystemStateConnUsagePermissionMonitor.h	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-
-#ifndef CSYSTEMSTATECONNUSAGEPERMISSIONMONITOR_H
-#define CSYSTEMSTATECONNUSAGEPERMISSIONMONITOR_H
-
-//  INCLUDES
-
-#include <e32std.h>
-
-// FORWARD DECLARATIONS
-class MSystemStateConnUsagePermissionObserver;
-class CRepository;
-
-// CLASS DECLARATION
-
-/**
- * Class for subscribing events from secure backup server.
- */
-class CSystemStateConnUsagePermissionMonitor : public CActive
-    {
-	public:
-
-	    /**
-        * Two-phased constructor.
-		* @return new instance
-        */
-		static CSystemStateConnUsagePermissionMonitor* NewL();
-
-		/**
-		* Destructor
-		*/
-		~CSystemStateConnUsagePermissionMonitor();
-		
-	    /**
-        * Add obsever
-        */
-	    void AddObserverL( MSystemStateConnUsagePermissionObserver& aObserver );
-		
-	    /**
-        * Remove observer
-        */
-		void RemoveObserver( MSystemStateConnUsagePermissionObserver& aObserver );
-
-	public: // From CActive
-	
-	    void RunL();
-	    
-	    void DoCancel();
-	    
-	    TInt RunError( TInt aError );
-
-    public: // new functions
-    
-        TInt CurrentUsagePermission();
-        
-	private:
-
-		CSystemStateConnUsagePermissionMonitor();
-		void ConstructL ();
-		
-    private: 
-    
-        void IssueMonitoringL();
-        TBool TranslateConnectionAllowedValue( TInt aValue );
-
-	private:
-
-        TInt iCurrentUsagePermission;
-        RPointerArray<MSystemStateConnUsagePermissionObserver> iObservers;  
-        CRepository* iRepository;
-		
-#ifdef CPPUNIT_TEST
-    friend class CSipSystemStateMonitorImplTest;
-#endif
-
-    };
-
-#endif
--- a/sipplugins/sippsystemstatemonitor/inc/MSystemStateConnUsagePermissionObserver.h	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-#ifndef MSYSTEMSTATECONNUSAGEPERMISSIONOBSERVER_H
-#define MSYSTEMSTATECONNUSAGEPERMISSIONOBSERVER_H
-
-// INCLUDES
-#include <e32base.h>
-
-// FORWARD DECLARATIONS
-
-// CLASS DEFINITION
-/**
- * Callback interface for receiving connection usage permission change events.
- *
- */
-class MSystemStateConnUsagePermissionObserver
-	{
-	public: // Abstract methods
-
-		virtual void UsagePermissionChanged( TBool aPermissionToUse, 
-		                                     TInt aError ) = 0;
-
-	};
-	
-#endif // MSYSTEMSTATECONNUSAGEPERMISSIONOBSERVER_H
-
--- a/sipplugins/sippsystemstatemonitor/inc/sipdevicestateaware.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/inc/sipdevicestateaware.h	Fri Apr 16 15:18:54 2010 +0300
@@ -49,14 +49,6 @@
          * to stop themselves getting notified for system state changes 
 		 */
         void RemoveObserver( MSipSystemStateObserver& aObserver );
-        
-        /**
-         * In case if profile de-registration could not be completed by
-         * observers, TimerExpiredL will call this function to indicate 
-         * that event processing is complete and further notification will
-         * be given to the System State Manager. 
-         */
-		void EventProcessingCompleted();
 		
 		/**
 		 * In case if the profiles de-registration is completed within the 
@@ -75,6 +67,7 @@
         
         //Destructor
         ~CSipDeviceStateAware();
+        
     private:
         //Default Construtor
         CSipDeviceStateAware();
@@ -90,6 +83,15 @@
          * state of the phone changes
          */
         void NotifyObservers(CSipSystemStateMonitor::TSystemState aState) const;
+        
+        /**
+         * In case if profile de-registration could not be completed by
+         * observers, TimerExpiredL will call this function to indicate 
+         * that event processing is complete and further notification will
+         * be given to the System State Manager. 
+         */
+        void EventProcessingCompleted();
+        
     private:
         
         //List of observers who have opted for system state changes
--- a/sipplugins/sippsystemstatemonitor/inc/siprfsmonitorao.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/inc/siprfsmonitorao.h	Fri Apr 16 15:18:54 2010 +0300
@@ -41,8 +41,6 @@
         void RemoveObserver( MSipSystemStateObserver& aObserver );
         void EventProcessingCompleted(MSipSystemStateObserver& aObserver);
         TBool MappedState(TInt aState);
-		void EventProcessingCompleted();
-        static TInt TimerExpired(TAny* aSelf);
         
     private:
         void NotifyObservers();
@@ -58,7 +56,6 @@
         RPointerArray<MSipSystemStateObserver>      iObservers;
         RProperty                                   iProperty;
         CSipSystemStateMonitor::TRfsState           iState;
-        CPeriodic*                                  iGuardTimer;
         
     private: // For testing purposes  
         friend class CSipRfsMonitorAoTestApp;
--- a/sipplugins/sippsystemstatemonitor/inc/sipsnapavailabilitymonitor.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/inc/sipsnapavailabilitymonitor.h	Fri Apr 16 15:18:54 2010 +0300
@@ -19,7 +19,6 @@
 #define CSIPSNAPAVAILABILITYMONITOR_H
 
 // INCLUDES
-#include "MSystemStateConnUsagePermissionObserver.h"
 #include <sipsystemstatemonitor.h>
 #include <rconnmon.h>
 #include <e32base.h>
@@ -33,8 +32,7 @@
 */
 class CSipSnapAvailabilityMonitor : 
     public CActive, 
-    public MConnectionMonitorObserver,
-    public MSystemStateConnUsagePermissionObserver
+    public MConnectionMonitorObserver
     {
     public:    // Constructors and destructor
 
@@ -47,7 +45,6 @@
         */
         static CSipSnapAvailabilityMonitor* NewL( 
             TUint32 aSnapId,
-            TBool aPermissionToUseNetwork,
             MSipSystemStateObserver& aObserver );
 
         /**
@@ -58,8 +55,7 @@
         * @return An initialized instance of this class.
         */
         static CSipSnapAvailabilityMonitor* NewLC( 
-            TUint32 aSnapId,
-            TBool aPermissionToUseNetwork,
+            TUint32 aSnapId,           
             MSipSystemStateObserver& aObserver );
 
         /// Destructor
@@ -73,12 +69,8 @@
 
     public: // From MConnectionMonitorObserver
 
-        void EventL( const CConnMonEventBase &aConnMonEvent );
-
-    public: // from MSystemStateConnUsagePermissionObserver
-    
-        void UsagePermissionChanged( TBool aPermissionToUse, TInt aError );
-        
+        void EventL( const CConnMonEventBase &aConnMonEvent ); 
+         
     public: // New functions
     
         TUint32 SnapId() const;
@@ -93,9 +85,7 @@
 
     private: // Constructors
 
-        CSipSnapAvailabilityMonitor( 
-            TUint32 aSnapId,
-            TBool aPermissionToUseNetwork );
+        CSipSnapAvailabilityMonitor( TUint32 aSnapId );
             
         void ConstructL( MSipSystemStateObserver& aObserver );
         
@@ -107,16 +97,13 @@
             
         void NotifyObservers() const;
         
-        TBool SetCurrentState( 
-            TBool aPermissionToUseNetwork,
-            TBool aSnapAvailable );        
+        TBool SetCurrentState( TBool aSnapAvailable );        
 
         TBool CanSnapBeUsed() const;
 
     private: // Data
 
         TUint32 iSnapId;
-        TBool iPermissionToUseNetwork;
         TBool iSnapAvailable;
         // Observers not owned
         RPointerArray<MSipSystemStateObserver> iObservers; 
--- a/sipplugins/sippsystemstatemonitor/inc/sipsystemstatemonitorimpl.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/inc/sipsystemstatemonitorimpl.h	Fri Apr 16 15:18:54 2010 +0300
@@ -21,14 +21,14 @@
 // INCLUDES
 #include "sipsystemstatemonitorao.h"
 #include "sipsnapavailabilitymonitor.h"
-#include "MSystemStateConnUsagePermissionObserver.h"
 #include <sipsystemstateobserver.h>
 #include <sipsystemstatemonitor.h>
 
 // FORWARD DECLARATIONS
-class CSystemStateConnUsagePermissionMonitor;
 class CSipDeviceStateAware;
 class CSipRfsMonitorAo;
+class CSipVpnMonitorAo;
+
 // CLASS DECLARATION
 /**
 * The default implementation for Sip System State Monitor.
@@ -75,9 +75,11 @@
     
         CSipSystemStateMonitorAo* iMonitorAo;
         RPointerArray<CSipSnapAvailabilityMonitor> iSnapMonitors;
-        CSystemStateConnUsagePermissionMonitor* iUsagePermissionMonitor;
         CSipRfsMonitorAo* iRfsMonitor;
 		CSipDeviceStateAware* iSipDeviceAwareObject;
+		
+        // P&S monitor for SIP / VPN communication
+        CSipVpnMonitorAo* iVpnMonitor;
 		    
     private: // For testing purposes
     
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipplugins/sippsystemstatemonitor/inc/sipvpnmonitorao.h	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description : P&S key monitor for communication between SIP Profile 
+*               server and VPN client
+* Name        : sipvpnmonitorao.cpp
+* Part of     : Sip System State Monitor
+* Version     : 1.0
+*
+*/
+
+#ifndef SIPVPNMONITORAO_H
+#define SIPVPNMONITORAO_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <e32property.h>
+#include <e32cmn.h>
+#include <sipsystemstatemonitor.h>
+
+class CSipVpnMonitorAo : public CActive
+    {
+    public: // Constructors and destructor
+        static CSipVpnMonitorAo* NewL();    
+        ~CSipVpnMonitorAo();
+        
+    private: // Constructors
+        CSipVpnMonitorAo();
+        void ConstructL();
+        
+    public: // New Functions
+        CSipSystemStateMonitor::TVpnState State() const;
+        void AddObserverL( MSipSystemStateObserver& aObserver );
+        void RemoveObserver( MSipSystemStateObserver& aObserver );
+        void EventProcessingCompleted(MSipSystemStateObserver& aObserver);
+        TBool MappedState(TInt aState);
+        static TInt TimerExpired(TAny* aSelf);
+        
+    private:
+        void NotifyObservers();
+        void EventProcessingCompleted();
+    private: // From CActive
+        void RunL();
+        TInt RunError( TInt aError );
+        void DoCancel();
+
+    private: // Data
+        TInt                                        iCount;
+        // Observers not owned
+        RPointerArray<MSipSystemStateObserver> iObservers;
+        RProperty iProperty;
+        CSipSystemStateMonitor::TVpnState iState;
+        CPeriodic* iGuardTimer;
+		        
+    private: // For testing purposes  
+        friend class CSipVpnMonitorAoTestApp;
+    };
+#endif /* SIPVPNMONITORAO_H */
--- a/sipplugins/sippsystemstatemonitor/src/CSystemStateConnUsagePermissionMonitor.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-
-#include <CoreApplicationUIsSDKCRKeys.h>
-#include <centralrepository.h>
-#include "CSystemStateConnUsagePermissionMonitor.h"
-#include "MSystemStateConnUsagePermissionObserver.h"
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::NewL
-// -----------------------------------------------------------------------------
-//
-CSystemStateConnUsagePermissionMonitor* 
-CSystemStateConnUsagePermissionMonitor::NewL()
-    {
-    CSystemStateConnUsagePermissionMonitor* self =
-		new ( ELeave ) CSystemStateConnUsagePermissionMonitor();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::CSystemStateConnUsagePermissionMonitor
-// -----------------------------------------------------------------------------
-//
-CSystemStateConnUsagePermissionMonitor::CSystemStateConnUsagePermissionMonitor() 
-    : CActive( EPriorityStandard ),
-	iCurrentUsagePermission( EFalse )
-	{   
-	CActiveScheduler::Add( this );
-    }
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::ConstructL
-// -----------------------------------------------------------------------------
-//
-void CSystemStateConnUsagePermissionMonitor::ConstructL()
-    {
-    iRepository = CRepository::NewL( KCRUidCoreApplicationUIs );
-	IssueMonitoringL();
-	}
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::~CSystemStateConnUsagePermissionMonitor
-// -----------------------------------------------------------------------------
-//
-CSystemStateConnUsagePermissionMonitor::~CSystemStateConnUsagePermissionMonitor()
-    {
-    iObservers.Close();
-    Cancel();
-	delete iRepository;
-    }
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::RunL
-// -----------------------------------------------------------------------------
-//  
-void CSystemStateConnUsagePermissionMonitor::RunL()
-    {
-    TInt status( iStatus.Int() );
-    
-    TInt previousPermission = iCurrentUsagePermission;
-    
-    CurrentUsagePermission(); 
-    
-    // Strangely cenrep may complete the request with positive value,
-    // do not interpret it as an error.
-    if ( status >= KErrNone )
-        {
-        status = KErrNone;
-        IssueMonitoringL();
-        }
-    
-    if ( previousPermission != iCurrentUsagePermission )
-        {
-        for ( TInt i = iObservers.Count()-1; i >= 0; i-- )
-            {
-            iObservers[i]->UsagePermissionChanged( iCurrentUsagePermission,
-                                                   status );
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::DoCancel
-// -----------------------------------------------------------------------------
-//  	    
-void CSystemStateConnUsagePermissionMonitor::DoCancel()
-    {
-    iRepository->NotifyCancelAll();
-    }
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::RunError
-// -----------------------------------------------------------------------------
-//  
-TInt CSystemStateConnUsagePermissionMonitor::RunError( TInt aError )
-    {
-    for ( TInt i = iObservers.Count()-1; i >= 0; i-- )
-        {
-        iObservers[i]->UsagePermissionChanged( iCurrentUsagePermission,
-                                               aError );
-        }
-    if ( aError != KErrNoMemory )
-        {
-        return KErrNone;
-        }
-    return aError;
-    }
-    
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::CurrentUsagePermission
-// -----------------------------------------------------------------------------
-//
-TInt CSystemStateConnUsagePermissionMonitor::CurrentUsagePermission()
-    {
-    TInt value( KErrNotFound );
-    TInt err = iRepository->Get( KCoreAppUIsNetworkConnectionAllowed, value );
-    if ( err == KErrNone)
-        {
-        iCurrentUsagePermission = TranslateConnectionAllowedValue( value );
-        }
-    else
-        {
-        iCurrentUsagePermission = err;
-        }
-    return iCurrentUsagePermission;
-    }
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::IssueMonitoringL
-// -----------------------------------------------------------------------------
-//
-void CSystemStateConnUsagePermissionMonitor::IssueMonitoringL()
-    {
-    if ( !IsActive() )
-        {
-        User::LeaveIfError( 
-            iRepository->NotifyRequest( KCoreAppUIsNetworkConnectionAllowed, 
-                                        iStatus ) );
-        SetActive();
-        }
-    }
-    
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::TranslateConnectionAllowedValue
-// -----------------------------------------------------------------------------
-//
-TBool CSystemStateConnUsagePermissionMonitor::TranslateConnectionAllowedValue( 
-    TInt aValue )
-    {
-    TBool retVal( EFalse );
-    switch ( aValue )
-        {
-        case ECoreAppUIsNetworkConnectionNotAllowed:
-            {
-            retVal = EFalse;
-            break;
-            }
-        case ECoreAppUIsNetworkConnectionAllowed:
-            {
-            retVal = ETrue;
-            break;
-            }
-        default:
-            {
-            break;
-            }
-        }
-    return retVal;
-    }
-    
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::AddObserverL
-// -----------------------------------------------------------------------------
-//
-void CSystemStateConnUsagePermissionMonitor::AddObserverL( 
-    MSystemStateConnUsagePermissionObserver& aObserver )
-    {
-    iObservers.InsertInAddressOrderL( &aObserver );
-    }
-
-// -----------------------------------------------------------------------------
-// CSystemStateConnUsagePermissionMonitor::RemoveObserver
-// -----------------------------------------------------------------------------
-//
-void CSystemStateConnUsagePermissionMonitor::RemoveObserver( 
-    MSystemStateConnUsagePermissionObserver& aObserver )
-    {
-    TInt index = iObservers.Find( &aObserver );
-    if ( index >= 0 )
-        {
-        iObservers.Remove( index ); 
-        }
-    }
-
-// End of file
--- a/sipplugins/sippsystemstatemonitor/src/siprfsmonitorao.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/src/siprfsmonitorao.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -23,9 +23,6 @@
 
 _LIT_SECURITY_POLICY_PASS( KSIPRfsAlwaysPass );
 
-static const TInt KMicroSecondsInSecond = 1000000;
-static const TInt KGuardTimerSeconds = 20;
-
 // -----------------------------------------------------------------------------
 // CSipRfsMonitorAo::NewL
 // -----------------------------------------------------------------------------
@@ -45,7 +42,6 @@
 //
 void CSipRfsMonitorAo::ConstructL ()
     {
-    iGuardTimer = CPeriodic::NewL( EPriorityNormal );
     TInt err = iProperty.Define( KPSSipRfsUid, KSipRfsState, RProperty::EInt,
 				   KSIPRfsAlwaysPass, KSIPRfsAlwaysPass);
     if ( KErrNone != err && KErrAlreadyExists != err && 
@@ -76,12 +72,6 @@
 //
 CSipRfsMonitorAo::~CSipRfsMonitorAo()
     {
-	if(iGuardTimer)
-		{
-    	iGuardTimer->Cancel();
-    	delete iGuardTimer;
-		iGuardTimer = NULL;
-		}
     CActive::Cancel();
     iProperty.Close();
 	iProperty.Delete(KPSSipRfsUid,KSipRfsState);
@@ -124,16 +114,7 @@
             CSipSystemStateMonitor::ERfsState, 
             0,
             iState);
-        }
-    if(iObservers.Count() && iState == CSipSystemStateMonitor::ERfsStarted)
-        {
-        iGuardTimer->Cancel();
-        iGuardTimer->Start(
-			TTimeIntervalMicroSeconds32( KGuardTimerSeconds * KMicroSecondsInSecond ),
-            TTimeIntervalMicroSeconds32( KGuardTimerSeconds * KMicroSecondsInSecond ),
-            TCallBack( TimerExpired, this ) );
-        }
-            
+        }           
     }
 
 // -----------------------------------------------------------------------------
@@ -150,30 +131,21 @@
 // -----------------------------------------------------------------------------
 //
 void CSipRfsMonitorAo::EventProcessingCompleted(
-        MSipSystemStateObserver& /*aObserver*/ )
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// CSipRfsMonitorAo::EventProcessingCompleted
-// -----------------------------------------------------------------------------
-//
-void CSipRfsMonitorAo::EventProcessingCompleted()
+        MSipSystemStateObserver& aObserver )
     {
-    iGuardTimer->Cancel();
-    iProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsEventProcessingCompleted );
-    iCount = 0;
-    }
-
-// -----------------------------------------------------------------------------
-// CSipRfsMonitorAo::TimerExpired
-// -----------------------------------------------------------------------------
-//
-TInt CSipRfsMonitorAo::TimerExpired(TAny* aSelf)
-    {
-    CSipRfsMonitorAo* self = reinterpret_cast<CSipRfsMonitorAo*>(aSelf);
-    self->EventProcessingCompleted();
-    return ETrue;
+    if (iState == CSipSystemStateMonitor::ERfsStarted)
+        {
+            TInt index = iObservers.Find( &aObserver );
+            if ( index >= 0 )
+            {
+                iCount++;
+                if( iObservers.Count() == iCount)
+                {
+                    iProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsEventProcessingCompleted );
+                    iCount = 0;
+                }
+            }
+        }
     }
 
 // -----------------------------------------------------------------------------
--- a/sipplugins/sippsystemstatemonitor/src/sipsnapavailabilitymonitor.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/src/sipsnapavailabilitymonitor.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -25,12 +25,11 @@
 //
 CSipSnapAvailabilityMonitor* CSipSnapAvailabilityMonitor::NewL( 
     TUint32 aSnapId,
-    TBool aPermissionToUseNetwork,
     MSipSystemStateObserver& aObserver )
 	{
 	CSipSnapAvailabilityMonitor* self = 
 	    CSipSnapAvailabilityMonitor::NewLC( 
-	        aSnapId, aPermissionToUseNetwork, aObserver );
+	        aSnapId, aObserver );
 	CleanupStack::Pop( self );
 	return self;
 	}
@@ -41,12 +40,10 @@
 //
 CSipSnapAvailabilityMonitor* CSipSnapAvailabilityMonitor::NewLC( 
     TUint32 aSnapId,
-    TBool aPermissionToUseNetwork,
     MSipSystemStateObserver& aObserver )
 	{
 	CSipSnapAvailabilityMonitor* self = 
-	    new( ELeave ) CSipSnapAvailabilityMonitor( 
-	        aSnapId, aPermissionToUseNetwork );
+	    new( ELeave ) CSipSnapAvailabilityMonitor( aSnapId );
 	CleanupStack::PushL( self );
 	self->ConstructL( aObserver );
 	return self;
@@ -57,11 +54,9 @@
 // -----------------------------------------------------------------------------
 //
 CSipSnapAvailabilityMonitor::CSipSnapAvailabilityMonitor( 
-    TUint32 aSnapId,
-    TBool aPermissionToUseNetwork )
+    TUint32 aSnapId)
  : CActive( EPriorityStandard ),
    iSnapId( aSnapId ),
-   iPermissionToUseNetwork( aPermissionToUseNetwork ),
    iIsConnected( EFalse )
     {
 	CActiveScheduler::Add( this );
@@ -144,7 +139,7 @@
         TBool snapAvailable = 
             IsSnapAvailable( event.SNAPAvailability(), iSnapId );
 
-        if ( SetCurrentState( iPermissionToUseNetwork, snapAvailable ) )
+        if ( SetCurrentState( snapAvailable ) )
             {
             NotifyObservers();
             }
@@ -212,20 +207,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CSipSnapAvailabilityMonitor::UsagePermissionChanged
-// -----------------------------------------------------------------------------
-//	
-void CSipSnapAvailabilityMonitor::UsagePermissionChanged( 
-    TBool aPermissionToUse, 
-    TInt /*aError*/ )
-    {
-    if ( SetCurrentState( aPermissionToUse, iSnapAvailable ) )
-        {
-        NotifyObservers();
-        }
-    }
-
-// -----------------------------------------------------------------------------
 // CSipSnapAvailabilityMonitor::NotifyObservers
 // -----------------------------------------------------------------------------
 //
@@ -270,16 +251,10 @@
 // CSipSnapAvailabilityMonitor::SetCurrentState
 // -----------------------------------------------------------------------------
 //
-TBool CSipSnapAvailabilityMonitor::SetCurrentState(
-    TBool aPermissionToUseNetwork,
+TBool CSipSnapAvailabilityMonitor::SetCurrentState(    
     TBool aSnapAvailable )
     {
     TBool updated( EFalse );
-    if ( aPermissionToUseNetwork != iPermissionToUseNetwork )
-        {
-        iPermissionToUseNetwork = aPermissionToUseNetwork;
-        updated = ETrue;
-        }
     if ( aSnapAvailable != iSnapAvailable )
         {
         iSnapAvailable = aSnapAvailable;
@@ -294,7 +269,7 @@
 //
 TBool CSipSnapAvailabilityMonitor::CanSnapBeUsed() const
     {
-    return ( iSnapAvailable && iPermissionToUseNetwork ); 
+    return ( iSnapAvailable ); 
     }
    
 // End of File
--- a/sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorao.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorao.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -180,5 +180,7 @@
     {
     return ( aSystemState == ESwStateNormalRfOn ||
              aSystemState == ESwStateNormalRfOff ||
-             aSystemState == ESwStateNormalBTSap );
+             aSystemState == ESwStateNormalBTSap ||
+	         aSystemState == ESwStateEmergencyCallsOnly ||
+             aSystemState == ESwStateSecurityCheck);
     }
--- a/sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorimpl.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorimpl.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -18,9 +18,10 @@
 
 //  INCLUDE FILES
 #include "sipsystemstatemonitorimpl.h"
-#include "CSystemStateConnUsagePermissionMonitor.h"
 #include "sipdevicestateaware.h"
 #include "siprfsmonitorao.h"
+#include "sipvpnmonitorao.h"
+#include <featmgr.h>          // for Feature Manager
 
 // -----------------------------------------------------------------------------
 // CSipSystemStateMonitorImpl::NewL
@@ -43,8 +44,6 @@
 void CSipSystemStateMonitorImpl::ConstructL()
     {
     iMonitorAo = CSipSystemStateMonitorAo::NewL();
-    iUsagePermissionMonitor = 
-        CSystemStateConnUsagePermissionMonitor::NewL();
     iSipDeviceAwareObject = CSipDeviceStateAware::NewL();
     }
 
@@ -62,9 +61,15 @@
 //
 CSipSystemStateMonitorImpl::~CSipSystemStateMonitorImpl()
     {
+    // iVpnMonitor is created in StartMonitoringL().
+    if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
+        {
+        delete iVpnMonitor;
+        iVpnMonitor = NULL;
+        }
+		
     delete iMonitorAo;
     iSnapMonitors.ResetAndDestroy();
-    delete iUsagePermissionMonitor;
     delete iRfsMonitor;
 	delete iSipDeviceAwareObject;
     }
@@ -97,12 +102,8 @@
         CSipSnapAvailabilityMonitor* monitor = FindSnapMonitorById( aObjectId );
         if ( !monitor )
             {
-            TInt permissionToUseNetwork = 
-                iUsagePermissionMonitor->CurrentUsagePermission();
-            User::LeaveIfError( permissionToUseNetwork ); 
             monitor = CSipSnapAvailabilityMonitor::NewLC( 
-                aObjectId, permissionToUseNetwork, aObserver );
-            iUsagePermissionMonitor->AddObserverL( *monitor );
+                aObjectId, aObserver );
             iSnapMonitors.AppendL( monitor );
             CleanupStack::Pop( monitor );
             }
@@ -116,6 +117,16 @@
         iRfsMonitor = iRfsMonitor?iRfsMonitor:CSipRfsMonitorAo::NewL();
         iRfsMonitor->AddObserverL( aObserver );
         }
+    // CSipVpnMonitorAo is created for P&S key change monitoring.
+    else if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+         && ( aVariable == EVpnState ) )
+        {
+        if ( !iVpnMonitor )
+            {
+            iVpnMonitor = CSipVpnMonitorAo::NewL();
+            }
+        iVpnMonitor->AddObserverL( aObserver );
+        }
     else
         {
         User::Leave( KErrNotSupported );
@@ -140,8 +151,7 @@
         {
         CSipSnapAvailabilityMonitor* monitor = FindSnapMonitorById( aObjectId );
         if ( monitor )
-            {
-            iUsagePermissionMonitor->RemoveObserver( *monitor );
+            {            
             monitor->RemoveObserver( aObserver );
             if ( !monitor->HasObservers() )
                 {
@@ -155,6 +165,15 @@
         if(iRfsMonitor)
             iRfsMonitor->RemoveObserver( aObserver );
         }
+    // Remove the client as an observer when stops VPN P&S key monitoring.
+    else if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+         && ( aVariable == EVpnState ) )
+        {
+        if ( iVpnMonitor )
+            {
+            iVpnMonitor->RemoveObserver( aObserver );
+            }
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -172,22 +191,23 @@
     else if ( aVariable == ESnapAvailability )
         {
         CSipSnapAvailabilityMonitor* monitor = FindSnapMonitorById( aObjectId );
-        if ( monitor )
-            {
-            TInt permissionToUseNetwork = 
-                iUsagePermissionMonitor->CurrentUsagePermission();
-            if ( permissionToUseNetwork < 0 )
-                {
-                return permissionToUseNetwork;
-                }        
-            return permissionToUseNetwork && monitor->SnapAvailability();
-            }
+        if ( monitor )        
+            return monitor->SnapAvailability();
         }
     else if ( aVariable == ERfsState )
         {
         if(iRfsMonitor)
             iRfsMonitor->State();
         }
+    else if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+         && ( aVariable == EVpnState ) )
+        {
+        if( iVpnMonitor )
+            {
+            return iVpnMonitor->State();
+            }
+        }
+		
     return KErrNotFound;
     }
 
@@ -208,6 +228,13 @@
         {
         iSipDeviceAwareObject->EventProcessingCompleted(aObserver);
         }
+    // SIP deregistration for VPN session has been completed. 
+    else if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+         && ( aVariable == EVpnState ) 
+         && iVpnMonitor )
+        {
+        iVpnMonitor->EventProcessingCompleted(aObserver);
+        }
     }
 
 // -----------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipplugins/sippsystemstatemonitor/src/sipvpnmonitorao.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description : P&S key monitor for communication between SIP Profile 
+*               server and VPN client
+* Name        : sipvpnmonitorao.cpp
+* Part of     : Sip System State Monitor
+* Version     : 1.0
+*
+*/
+
+//  INCLUDE FILES
+#include "sipvpnmonitorao.h"
+#include <vpnsipobserverpskeys.h>
+#include <sipsystemstateobserver.h>
+
+_LIT_SECURITY_POLICY_PASS( KSIPVpnAlwaysPass );
+
+static const TInt KMicroSecondsInSecond = 1000000;
+static const TInt KGuardTimerSeconds = 10; 
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::NewL
+// -----------------------------------------------------------------------------
+//
+CSipVpnMonitorAo* CSipVpnMonitorAo::NewL()
+    {
+    CSipVpnMonitorAo* self = new( ELeave )CSipVpnMonitorAo();
+    
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSipVpnMonitorAo::ConstructL()
+    {
+    iGuardTimer = CPeriodic::NewL( EPriorityNormal );
+    
+    // Define a P&S key for communication between SIP Profile Server and VPN client.
+    TInt err = iProperty.Define( KPSVpnSipUid, KVpnSipState, RProperty::EInt, 
+                                 KSIPVpnAlwaysPass, KSIPVpnAlwaysPass );
+    if ( KErrNone != err && KErrAlreadyExists != err && 
+            KErrPermissionDenied != err )
+        {
+        User::Leave( err );
+        }
+
+    User::LeaveIfError( iProperty.Attach( KPSVpnSipUid, KVpnSipState ) );
+
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::CSipVpnMonitorAo
+// -----------------------------------------------------------------------------
+//
+CSipVpnMonitorAo::CSipVpnMonitorAo():
+    CActive(EPriorityStandard)
+    {
+    CActiveScheduler::Add( this );
+    iCount = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::~CSipVpnMonitorAo
+// -----------------------------------------------------------------------------
+//
+CSipVpnMonitorAo::~CSipVpnMonitorAo()
+    {
+    if ( iGuardTimer )
+        {
+        iGuardTimer->Cancel();
+        delete iGuardTimer;
+		iGuardTimer = NULL;
+        }
+        
+    CActive::Cancel();
+    
+    iProperty.Close();
+    iProperty.Delete( KPSVpnSipUid, KVpnSipState );
+    
+    iObservers.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::AddObserverL
+// -----------------------------------------------------------------------------
+//
+void CSipVpnMonitorAo::AddObserverL( 
+    MSipSystemStateObserver& aObserver )
+    {
+    iObservers.InsertInAddressOrderL( &aObserver );
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::RemoveObserver
+// -----------------------------------------------------------------------------
+//    
+void CSipVpnMonitorAo::RemoveObserver(
+    MSipSystemStateObserver& aObserver )
+    {
+    TInt index = iObservers.Find( &aObserver );
+    if ( index >= 0 )
+        {
+        iObservers.Remove( index ); 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::NotifyObservers
+// -----------------------------------------------------------------------------
+//
+void CSipVpnMonitorAo::NotifyObservers()
+    {
+    // Notify observers (SIP Profile Server) about the P&S key change.
+    for ( TInt i = iObservers.Count()-1; i >= 0; i-- )
+        {
+        iObservers[i]->SystemVariableUpdated( 
+            CSipSystemStateMonitor::EVpnState, 
+            0,
+            iState);
+        }
+
+    // Start a guard timer so that VPN client don't wait forever for completion
+    // of deregistration.
+    if ( iObservers.Count() && iState == CSipSystemStateMonitor::EVpnInitiating )
+        {
+        iGuardTimer->Cancel();
+        iGuardTimer->Start( 
+            TTimeIntervalMicroSeconds32( KGuardTimerSeconds * KMicroSecondsInSecond ),
+            TTimeIntervalMicroSeconds32( KGuardTimerSeconds * KMicroSecondsInSecond ),
+            TCallBack( TimerExpired, this ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::State
+// -----------------------------------------------------------------------------
+//
+CSipSystemStateMonitor::TVpnState CSipVpnMonitorAo::State() const
+    {
+    return iState;
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::EventProcessingCompleted
+// -----------------------------------------------------------------------------
+//
+void CSipVpnMonitorAo::EventProcessingCompleted(
+        MSipSystemStateObserver& aObserver )
+    {
+    if (iState == CSipSystemStateMonitor::EVpnInitiating)
+        {
+            TInt index = iObservers.Find( &aObserver );
+            if ( index >= 0 )
+            {
+                iCount++;
+                if( iObservers.Count() == iCount)
+                {
+                    iGuardTimer->Cancel();
+                    iProperty.Set(KPSVpnSipUid, KVpnSipState, ESipDeregisterCompleted );
+                    iCount = 0;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::EventProcessingCompleted
+// -----------------------------------------------------------------------------
+//
+void CSipVpnMonitorAo::EventProcessingCompleted()
+    {
+    // SIP deregistration has been completed. Stop the guard timer and tell
+    // the VPN client about it.
+    iGuardTimer->Cancel();
+
+    iProperty.Set( KPSVpnSipUid, KVpnSipState, ESipDeregisterCompleted );
+    iCount = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::TimerExpired
+// -----------------------------------------------------------------------------
+//
+TInt CSipVpnMonitorAo::TimerExpired(TAny* aSelf)
+    {
+    // Guard timer expired. Tell VPN client to proceed its work without
+    // further waiting.
+    CSipVpnMonitorAo* self = reinterpret_cast<CSipVpnMonitorAo*>(aSelf);
+    self->EventProcessingCompleted();
+    
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::RunL
+// -----------------------------------------------------------------------------
+//
+void CSipVpnMonitorAo::RunL()
+    {
+    TInt state( 0 );  
+    
+    // VPN client notifies that it has started a VPN session.
+    if ( KErrNone == iProperty.Get( state ) )
+        {
+        if ( MappedState( state ) )
+            {
+            NotifyObservers();
+            }
+        }
+        
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::RunError
+// -----------------------------------------------------------------------------
+//     
+TInt CSipVpnMonitorAo::RunError( TInt /*aError*/ )
+    {
+    return KErrNone; // RunL cannot leave at the moment
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::DoCancel
+// -----------------------------------------------------------------------------
+//  
+void CSipVpnMonitorAo::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CSipVpnMonitorAo::MappedState
+// -----------------------------------------------------------------------------
+//
+TBool CSipVpnMonitorAo::MappedState( TInt aState )
+    {
+    TBool ret = ETrue;
+    // Maps P&S key value to VPN state.
+    switch( aState )
+        {
+        case EVpnInitiating:
+            iState = CSipSystemStateMonitor::EVpnInitiating;
+            break;
+        case EVpnTerminated:
+            iState = CSipSystemStateMonitor::EVpnTerminated;
+            break;
+        // Other P&S key values are not mapped to VPN state.
+        // Not an error situation.
+        default:
+            ret = EFalse;
+        }
+        
+    return ret;
+    }
--- a/sipproviderplugins/sipprovider/group/bld.inf	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipproviderplugins/sipprovider/group/bld.inf	Fri Apr 16 15:18:54 2010 +0300
@@ -20,10 +20,4 @@
 PRJ_MMPFILES
 #include "../sipconnectionplugins/group/bld.inf"
 #include "../sipdummyprt/group/bld.inf"
-#include "../sipstatemachine/group/bld.inf"
-
-
-PRJ_TESTMMPFILES
-#include "../Test/ResolverPlugin/Group/bld.inf"
-#include "../Test/tsip/bld.inf"
-#include "../Test/profilegenerator/bld.inf"
+#include "../sipstatemachine/group/bld.inf"
\ No newline at end of file
Binary file sipproviderplugins/sipprovider/sipconnectionplugins/Documentation/sipproviders.eap has changed
--- a/sipproviderplugins/sipprovider/sipconnectionplugins/group/mm-protocols_sipproviders.history.xml	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<relnotes name="SIP Connection Provider Plugins V2">
-  <purpose>
-    Provides connection provision at the network layer.
-  </purpose>
-  
-  <defect number="DEF133288" title="[SystemBuild]: Elf2e32 Warning SIPConnectionPlugins in M04816vFuture with ARMV7" revision="04">
-    Defect fixes:
-	DEF133288 [SystemBuild]: Elf2e32 Warning SIPConnectionPlugins in M04816vFuture with ARMV7
-  </defect>
-
-  <defect number="DEF131783" title="Functionality moved from SCPRStates to PRStates namespace" revision="03">
-    Defect fixes:
-	DEF131783 Functionality moved from SCPRStates to PRStates namespace
-  </defect>
-
-  <defect number="PDEF129789" title="SMP: sipproviders doesn't compile for the x86gcc platform" revision="02">
-    Defect fixes:
-	PDEF129789 SMP: sipproviders doesn't compile for the x86gcc platform
-  </defect>
-
-  <defect number="DEF130036" title="SIP Providers possible problem activity..." revision="01">
-    Defect fixes:
-	DEF130036 SIP Providers possible problem activity...
-  </defect>
-  
-  <ec number="120" title="Mesh Machine Productisation" revision="050">
-   Mesh Machine Productisation
-  </ec>
-</relnotes>
--- a/sipproviderplugins/sipprovider/sipconnectionplugins/inc/sipprovisioninfo.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipproviderplugins/sipprovider/sipconnectionplugins/inc/sipprovisioninfo.h	Fri Apr 16 15:18:54 2010 +0300
@@ -29,7 +29,7 @@
 #include <es_enum.h>
 #include "TransitionEngineMgr.h"
 
-class TSipMcprProvisionInfo : public CBase, public Meta::SMetaData 
+class TSipMcprProvisionInfo : public Meta::SMetaData 
 /** 
 @internalTechnology
 */
@@ -56,7 +56,7 @@
 	};
 	
 	
-class TSipCprProvisionInfo : public CBase, public Meta::SMetaData
+class TSipCprProvisionInfo : public Meta::SMetaData
 /** 
 @internalTechnology
 */
--- a/sipproviderplugins/sipprovider/sipconnectionplugins/src/sipcpr.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipproviderplugins/sipprovider/sipconnectionplugins/src/sipcpr.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -152,11 +152,11 @@
 CSipConnectionProvider::~CSipConnectionProvider()
     {
     __CFLOG_VAR((KSipCprTag, KSipCprSubTag, _L8("CSipConnectionProvider:\t ~CSipConnectionProvider()")));
-    LOG_NODE_DESTROY(KSipCprTag, CSipConnectionProvider); 
-	if(iTransitionEngine)
-    iTransitionEngineMgr->Detach(iTransitionEngine);    
-	//delete 	iProvisionInfo;	
-	iProvisionInfo = NULL;	
+    LOG_NODE_DESTROY(KSipCprTag, CSipConnectionProvider);
+	if(iTransitionEngine != NULL && iTransitionEngineMgr != NULL)
+    iTransitionEngineMgr->Detach(iTransitionEngine);
+	//delete 	iProvisionInfo;
+	iProvisionInfo = NULL;
     }
 
 CSipConnectionProvider::CSipConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory)
--- a/sipproviderplugins/sipprovider/sipconnectionplugins/src/sipmcpr.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipproviderplugins/sipprovider/sipconnectionplugins/src/sipmcpr.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -148,19 +148,19 @@
 
 void CSipMetaConnectionProvider::SetConfigL()
 	{
-	TSipMcprProvisionInfo*	iProvisionInfo = new (ELeave) TSipMcprProvisionInfo();	
-	iProvisionInfo->iAppUid = iAppUid;
-	iProvisionInfo->iProfileId = iProfileId;		
-	iProvisionInfo->iTransitionEngineMgr = iTransitionEngineMgr;
+	TSipMcprProvisionInfo*	ProvisionInfo = new (ELeave) TSipMcprProvisionInfo();
+	ProvisionInfo->iAppUid = iAppUid;
+	ProvisionInfo->iProfileId = iProfileId;
+	ProvisionInfo->iTransitionEngineMgr = iTransitionEngineMgr;
 
 	// Append the above three to the accesspointconfig and send to CPR in ProvisionConfig message
-	
+
 	RMetaExtensionContainer mec;
 	mec.Open(AccessPointConfig());
 	CleanupClosePushL(mec);
-	CleanupStack::PushL(iProvisionInfo);
-	mec.AppendExtensionL(iProvisionInfo);
-	CleanupStack::Pop(iProvisionInfo);
+	CleanupStack::PushL(ProvisionInfo);
+	mec.AppendExtensionL(ProvisionInfo);
+	CleanupStack::Pop(ProvisionInfo);
 	AccessPointConfig().Close();
 	AccessPointConfig().Open(mec);
 	CleanupStack::PopAndDestroy(&mec);
--- a/sipproviderplugins/sipprovider/sipconnectionplugins/src/sipscpr.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipproviderplugins/sipprovider/sipconnectionplugins/src/sipscpr.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -127,6 +127,7 @@
 CSipSubConnectionProvider::~CSipSubConnectionProvider()
     {
     LOG_NODE_DESTROY(KSipSCprTag, CSipSubConnectionProvider);
+    if(iSipSm != NULL)
     iSipSm->DeleteWhenReady();
     }
 
@@ -348,8 +349,13 @@
     	  	return;
         	}
     	sipevent->SetResponse(aSipCode);
-    	NotifyClientsL(*sipevent);    		        	    	
-    	}    
+    	TRAP(error, NotifyClientsL(*sipevent));    		        	    	
+    	if (error != KErrNone)
+		    {
+		    __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("NotifyClientsL left with the error: [%d]"), error));
+		    return;
+        	}
+		}
     }
 
 /**
@@ -417,7 +423,12 @@
     	__CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSubConSIPAuthenticationRequiredEvent::SetRealmL()  left with error [%d]"), error));    	      	
 	    return;
     	}
-     NotifyClientsL(*event); 
+     TRAP(error, NotifyClientsL(*event)); 
+	if (error != KErrNone)
+	{
+	__CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("NotifyClientsL left with the error: [%d]"), error));
+	return;
+	}
      #endif   
 	}
 
@@ -430,11 +441,21 @@
 	
 	__CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::ReceiveNotification")));
 	CSubConSIPNotificationEvent* event = CSubConSIPNotificationEvent::NewL();
-	event->SetNotificationL(aNotification);
+	TRAPD(error, event->SetNotificationL(aNotification));
+	if (error != KErrNone)
+	{
+	__CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("event->SetNotificationL left with the error: [%d]"), error));
+	return;
+	}
 	
 	TInt32 gId = event->GroupId();
 		
-	NotifyClientsL(*event);      
+	TRAP(error, NotifyClientsL(*event));      
+	if (error != KErrNone)
+	{
+	__CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("NotifyClientsL left with the error: [%d]"), error));
+	return;
+	}
 	}
 	
 /**
--- a/sipproviderplugins/sipprovider/sipdummyprt/group/mm-protocols_sipdummyprt.history.xml	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<relnotes schema="1.0.0" name="SIP Connection Provider Plugins" purpose="" type="component">
-  <revision major="1" functional="0" minor="0" date="20070808">
-    <ref name="DEF109829" type="defect"/>
-    <description>Added note for:
-DEF109829 	GTC Sip iby errors</description>
-  </revision>
-  <purpose>
-    Provides connection provision at the network layer.
-  </purpose>
-</relnotes>
--- a/sipproviderplugins/sipprovider/sipstatemachine/group/mm-protocols_sipstatemachine.history.xml	Tue Feb 02 01:03:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<relnotes name="SIP Connection Provider Plugins">
-  <purpose>
-    Provides connection provision at the network layer.
-  </purpose>
-  
-    <defect number="DEF126882" title="[Coverity]-SYMBIAN.CLEANUP_STACK -mm-protocols/sip2/" revision="008">
-    Defect fixes:
-	DEF126882 [Coverity]-SYMBIAN.CLEANUP_STACK -mm-protocols/sip2/ 
-  </defect>
-  
-  <defect number="DEF126880" title="[Coverity]-PASS_BY_VALUE -mm-protocols/sip2/ " revision="007">
-    Defect fixes:
-	DEF126880 [Coverity]-PASS_BY_VALUE -mm-protocols/sip2/ 
-  </defect>
-  
-  <defect number="DEF125315" title="[sip]RSubconnection::Start() doesn't return error when 400 or 404 is received." revision="006">
-    Defect fixes:
-	DEF125315 [sip]RSubconnection::Start() doesn't return error when 400 or 404 is received.
-  </defect>
-  
-  <defect number="DEF125120" title="[coverity] - REVERSE_INULL - mm-protocols/sipprovengine/sipstatemachine" revision="005">
-    Defect fixes:
-	DEF125120 [coverity] - REVERSE_INULL - mm-protocols/sipprovengine/sipstatemachine
-  </defect>
-  
-  <defect number="DEF125121" title="[coverity] - UNINIT - mm-protocols/sipprovengine/sipstatemachine" revision="004">
-    Defect fixes:
-	DEF125121 [coverity] - UNINIT - mm-protocols/sipprovengine/sipstatemachine
-  </defect>
-  
-  <defect number="DEF124879" title="Cannot send INVITE with SDP parameter using SIP high level API." revision="003">
-    Defect fixes:
-	DEF124879 Cannot send INVITE with SDP parameter using SIP high level API.
-  </defect>
-  
-  <defect number="DEF108003" title="Warnings generated with checksource build" revision="002">
-    Added Note for the following defects:
-	DEF108003 Warnings generated with checksource build
-  </defect>
-  
-  <preq number="1182" title="GNU Make-based build system" revision="001">
-    GNU Make-based build system
-  </preq>
-</relnotes>
--- a/sipproviderplugins/sipprovider/sipstatemachine/inc/transitionengine.h	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipproviderplugins/sipprovider/sipstatemachine/inc/transitionengine.h	Fri Apr 16 15:18:54 2010 +0300
@@ -511,6 +511,8 @@
 	@param aRealm - Realm of the issuer of the challenge
 	*/
 	TBool FindAndSetCredentials(const TDesC8& aRealm);
+
+	void IncomingRequestHandlerL(CSIPServerTransaction* aTransaction);
 	
 private:
 	// For Logging
--- a/sipproviderplugins/sipprovider/sipstatemachine/src/SipStateMachine.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipproviderplugins/sipprovider/sipstatemachine/src/SipStateMachine.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -45,51 +45,44 @@
 /**
  This Function will startup the state machine with a default
  state
-*/
-	{
-	// Tell the TE there's another StateMachine wishing to speak to it.
-	// Remek: Where do you remove it??? Cos i couldn't find !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-	iTe->AddStateMachineL(this);
-	
-	// Initialize booleans
-	iClientStimulus = EFalse;
-	iServerStimulus = EFalse;
-	iServerErrorStimulus = EFalse;
-	iCallTerminateCallback = ETrue;
-	iDeleteMeNow = EFalse;
-	isInviteSM = EFalse;
-	isSubscribeSM = EFalse;
-	
-	iCallTerminateCode.iErrorCode = KErrNone;
-	iCallTerminateCode.iSipCode = KErrNone;
-	
-	// Construct States
-	iStateIdle = CStateIdle::NewL(this);
-	CleanupStack::PushL (iStateIdle);
+ */
+    {
+    // Tell the TE there's another StateMachine wishing to speak to it.
+    // Remek: Where do you remove it??? Cos i couldn't find !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    iTe->AddStateMachineL(this);
+
+    // Initialize booleans
+    iClientStimulus = EFalse;
+    iServerStimulus = EFalse;
+    iServerErrorStimulus = EFalse;
+    iCallTerminateCallback = ETrue;
+    iDeleteMeNow = EFalse;
+    isInviteSM = EFalse;
+    isSubscribeSM = EFalse;
+
+    iCallTerminateCode.iErrorCode = KErrNone;
+    iCallTerminateCode.iSipCode = KErrNone;
+
+    // Construct States
+    iStateIdle = CStateIdle::NewL(this);
+
+    iCommandCntx.iCommandState = iStateIdle;
+    iCommandCntx.iClientTx = NULL;
+    iCommandCntx.iCancelClientTx = NULL;
+    iCommandCntx.iServerTx = NULL;
+    iCommandCntx.iRegBinding = NULL;
+    iCommandCntx.iDialogAssoc = NULL;
+
+    iStateSessionInit = CStateSessionInitiation::NewL(this);
+    iStateSessionEstablished = CStateSessionEstablished::NewL(this);
+    iStateSessionTerminate = CStateSessionTerminate::NewL(this);
+
+    iActiveState = iStateIdle;
 	
-	iCommandCntx.iCommandState 		= iStateIdle;
-	iCommandCntx.iClientTx	 		= NULL;
-	iCommandCntx.iCancelClientTx	= NULL;
-	iCommandCntx.iServerTx			= NULL;
-	iCommandCntx.iRegBinding	 	= NULL;
-	iCommandCntx.iDialogAssoc	 	= NULL;
-
-	
-	iStateSessionInit = CStateSessionInitiation::NewL(this);
-	CleanupStack::PushL(iStateSessionInit);
-	iStateSessionEstablished = CStateSessionEstablished::NewL(this);
-	CleanupStack::PushL(iStateSessionEstablished);
-	iStateSessionTerminate = CStateSessionTerminate::NewL(this);
-	CleanupStack::PushL(iStateSessionTerminate);
-	
-	iActiveState = iStateIdle;
-	
-	this->Start(&iStatus, NULL) ;
-	// Maithra's fix : For stray signal
- 	MakeActive();
-	// Pop From Cleanup Stack
-	CleanupStack::Pop(4, iStateIdle);
-	}
+    this->Start(&iStatus, NULL);
+    // Maithra's fix : For stray signal
+    MakeActive();
+    }
 	
 CSipStateMachine::CSipStateMachine(CSIPTransitionEngine * aTe, MSIPStateMachineClient* aClient,TBool aSMDirection) 
 :CActive(EPriorityStandard), 
@@ -801,9 +794,8 @@
     iCommandCntx.iRegBinding 	= CSIPRegistrationBinding::NewL(
     							  *sipConn, to, contact,
     							  refresh,0, remoteUri, from);
-    CleanupStack::PushL(iCommandCntx.iRegBinding);
 	iCommandCntx.iClientTx		= iCommandCntx.iRegBinding->RegisterL();
-	CleanupStack::Pop(6, refresh);
+	CleanupStack::Pop(5, refresh);
 	}
 	
 void CSipStateMachine::SendUnRegisterMessageL()	
--- a/sipproviderplugins/sipprovider/sipstatemachine/src/transitionengine.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/sipproviderplugins/sipprovider/sipstatemachine/src/transitionengine.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -52,10 +52,8 @@
 
 	__FLOG_1(_L("CSIPTransitionEngine %08x:\tInstantiating CSIPProfileRegistry - may leave"), this);
 	iProfileRegistry = CSIPProfileRegistry::NewL(iSIP, *this);
-	CleanupStack::PushL(iProfileRegistry);
 	__FLOG_1(_L("CSIPTransitionEngine %08x:\tInstantiating CSIPHttpDigest - may leave"), this);
 	iDigest = CSIPHttpDigest::NewL(iSIP, *this );
-	CleanupStack::PushL(iDigest);
 	__FLOG_1(_L("CSIPTransitionEngine %08x:\tInstantiating CSIPConnection - may leave"), this);
     iConnection = CSIPConnection::NewL(iSIP, iIapId, *this );
 
@@ -66,7 +64,6 @@
 		}
 		
 	__FLOG_1(_L("CSIPTransitionEngine %08x:\tConstructL successful"), this);		
-    CleanupStack::Pop(2);
 	}
 	
 CSIPTransitionEngine::CSIPTransitionEngine(CSIP& aSip, TInt aIapId)
@@ -148,51 +145,11 @@
 */	
 	{
 	__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequest() <<Recieved Outside of a Dialog>>"),this);
-	CleanupStack::PushL(aTransaction); //we're take over the ownership.
-	
-	RStringF method = aTransaction->RequestElements()->Method();
-	if(method == SIPStrings::StringF(SipStrConsts::EInvite))
+	TRAPD(err,IncomingRequestHandlerL(aTransaction));	
+	if(err != KErrNone)
 		{
-		__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequest() <<Received Request Invite>>"),this);
-		TSipMsgBundle	msgBundle;
-		// Create a dialog Association and set server transaction
-		CSIPInviteDialogAssoc*	dialogassoc = CSIPInviteDialogAssoc::NewL(*aTransaction);
-		CleanupStack::PushL(dialogassoc);
-		msgBundle.iRequest = TSipHLConsts::ERequestInvite;
-		msgBundle.iDialog = dialogassoc;
-		msgBundle.iServTransaction = aTransaction;
-		// Look For the state machine which is responsible for handling 
-	 	// this particular request
-	 	CSipStateMachine*	smPtr = FindSMForIncomingCall();
-	 	if(smPtr)
-	 		{
-	 		__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequest() <<Found State Machine to Handle the Request>>"),this);
-	 		smPtr->IncomingRequestOutsideDialog(msgBundle);	
-	 		CleanupStack::Pop(dialogassoc);
-	 		CleanupStack::Pop(aTransaction);
-	 		}
-	 	else
-	 		{// return NotFound
-	 		__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequest() <<No State Machine found to Handle the Request>>"),this);
-	 		__FLOG_0(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequest() <<sending 404>>"));
-	 		CSIPResponseElements *ResElem = CSIPResponseElements::NewLC(
-							404, SIPStrings::StringF(SipStrConsts::EPhraseNotFound));
-			aTransaction->SendResponseL(ResElem);
-			CleanupStack::Pop(ResElem);		
-			CleanupStack::PopAndDestroy(aTransaction);
-			CleanupStack::PopAndDestroy(dialogassoc);
-	 		}
+		return;
 		}
-	 else
-	 	{ // bad request , not supported here
-	 	__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequest() <<Received Request other than Invite>>"),this);
-	 	__FLOG_0(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequest() <<sending 404>>"));
-	 	CSIPResponseElements *ResElem = CSIPResponseElements::NewLC(
-							400, SIPStrings::StringF(SipStrConsts::EPhraseBadRequest));
-		aTransaction->SendResponseL(ResElem);
-		CleanupStack::Pop(ResElem);		
-		CleanupStack::PopAndDestroy(aTransaction);
-	 	}		
 	}
 	
 void CSIPTransitionEngine::IncomingRequest( CSIPServerTransaction* aTransaction, CSIPDialog& aDialog )
@@ -1090,3 +1047,53 @@
 		}
 	return EFalse;
 	}
+
+void CSIPTransitionEngine::IncomingRequestHandlerL(CSIPServerTransaction* aTransaction)
+{
+	__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequestL() <<Recieved Outside of a Dialog>>"),this);
+	CleanupStack::PushL(aTransaction); //we're take over the ownership.
+	
+	RStringF method = aTransaction->RequestElements()->Method();
+	if(method == SIPStrings::StringF(SipStrConsts::EInvite))
+		{
+		__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequestL() <<Received Request Invite>>"),this);
+		TSipMsgBundle	msgBundle;
+		// Create a dialog Association and set server transaction
+		CSIPInviteDialogAssoc*	dialogassoc = CSIPInviteDialogAssoc::NewL(*aTransaction);
+		CleanupStack::PushL(dialogassoc);
+		msgBundle.iRequest = TSipHLConsts::ERequestInvite;
+		msgBundle.iDialog = dialogassoc;
+		msgBundle.iServTransaction = aTransaction;
+		// Look For the state machine which is responsible for handling 
+	 	// this particular request
+	 	CSipStateMachine*	smPtr = FindSMForIncomingCall();
+	 	if(smPtr)
+	 		{
+	 		__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequestL() <<Found State Machine to Handle the Request>>"),this);
+	 		smPtr->IncomingRequestOutsideDialog(msgBundle);	
+	 		CleanupStack::Pop(dialogassoc);
+	 		CleanupStack::Pop(aTransaction);
+	 		}
+	 	else
+	 		{// return NotFound
+	 		__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequestL() <<No State Machine found to Handle the Request>>"),this);
+	 		__FLOG_0(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequestL() <<sending 404>>"));
+	 		CSIPResponseElements *ResElem = CSIPResponseElements::NewLC(
+							404, SIPStrings::StringF(SipStrConsts::EPhraseNotFound));
+			aTransaction->SendResponseL(ResElem);
+			CleanupStack::Pop(ResElem);		
+			CleanupStack::PopAndDestroy(aTransaction);
+			CleanupStack::PopAndDestroy(dialogassoc);
+	 		}
+		}
+	 else
+	 	{ // bad request , not supported here
+	 	__FLOG_1(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequestL() <<Received Request other than Invite>>"),this);
+	 	__FLOG_0(_L("[TransitionEngine]: CSIPTransitionEngine[%x]::IncomingRequestL() <<sending 404>>"));
+	 	CSIPResponseElements *ResElem = CSIPResponseElements::NewLC(
+							400, SIPStrings::StringF(SipStrConsts::EPhraseBadRequest));
+		aTransaction->SendResponseL(ResElem);
+		CleanupStack::Pop(ResElem);		
+		CleanupStack::PopAndDestroy(aTransaction);
+	 	}
+}