--- a/vpnc_plat/vpnapi/group/bld.inf Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnc_plat/vpnapi/group/bld.inf Fri Feb 19 23:50:52 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -22,7 +22,8 @@
DEFAULT
PRJ_EXPORTS
- ../inc/vpnapidefs.h /epoc32/include/vpnapidefs.h
- ../inc/vpnapidefs.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnapidefs.h)
- ../inc/vpnnotifierdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnnotifierdefs.h)
- ../inc/vpnapi.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnapi.h)
+ ../inc/vpnapidefs.h /epoc32/include/vpnapidefs.h
+ ../inc/vpnapidefs.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnapidefs.h)
+ ../inc/vpnnotifierdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnnotifierdefs.h)
+ ../inc/vpnapi.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnapi.h)
+ ../inc/vpnsipobserverpskeys.h MW_LAYER_PLATFORM_EXPORT_PATH(vpnsipobserverpskeys.h)
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnc_plat/vpnapi/inc/vpnsipobserverpskeys.h Fri Feb 19 23:50:52 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* 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 definition for communication between VPN client
+* and SIP Profile server
+*
+*/
+
+#ifndef VPNSIPOBSERVERPSKEYS_H
+#define VPNSIPOBSERVERPSKEYS_H
+
+
+/**
+* PubSub keys
+*/
+
+const TUid KPSVpnSipUid = {0x101FD285}; // UID of vpnapi
+
+const TUint KVpnSipState = 0x00000001;
+
+enum TVpnSipState
+{
+ /** Initial value */
+ EVpnUndefined = 0,
+ /** Vpn is about to be started */
+ EVpnInitiating, // VPN -> SIP
+ /** Vpn ended */
+ EVpnTerminated, // VPN -> SIP
+ /** Deregister complete */
+ ESipDeregisterCompleted // SIP -> VPN
+};
+
+
+#endif // VPNSIPOBSERVERPSKEYS_H
--- a/vpnengine/ikesocket/group/ikesocket.mmp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/ikesocket/group/ikesocket.mmp Fri Feb 19 23:50:52 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -47,6 +47,5 @@
LIBRARY euser.lib
LIBRARY esock.lib
LIBRARY insock.lib
-LIBRARY commdb.lib
LIBRARY extendedconnpref.lib
LIBRARY netmeta.lib
--- a/vpnengine/ikesocket/group/ikesocket_test.mmp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/ikesocket/group/ikesocket_test.mmp Fri Feb 19 23:50:52 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -48,6 +48,5 @@
LIBRARY euser.lib
LIBRARY esock.lib
LIBRARY insock.lib
-LIBRARY commdb.lib
LIBRARY extendedconnpref.lib
LIBRARY netmeta.lib
--- a/vpnengine/ikesocket/inc/ikeconnection.h Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/ikesocket/inc/ikeconnection.h Fri Feb 19 23:50:52 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -21,7 +21,6 @@
#include <e32base.h>
#include <in_sock.h>
-#include <commdbconnpref.h>
#include <extendedconnpref.h>
#include "connobserver.h"
#include "datatransfer.h"
@@ -128,18 +127,20 @@
void ConstructL();
/**
- * Creates connection preferences for SNAP usage.
+ * Creates connection preferences.
+ * @param aIapId IAP id
* @param aSnapId SNAP id
* @param aForcedRoaming Indicates whether forced roaming is enabled or
* disabled for SNAP
*/
- void CreateSnapPreferencesL( const TUint32 aSnapId,
- const TBool aForcedRoaming );
+ void CreatePreferencesL( const TUint32 aIapId,
+ const TUint32 aSnapId,
+ const TBool aForcedRoaming );
/**
- * Cleans connection preferences created for SNAP usage.
+ * Cleans connection preferences.
*/
- void CleanSnapPreferences();
+ void CleanPreferences();
/**
* Updates IAP id and NET id.
@@ -166,7 +167,7 @@
*/
void DoCancelResolveFQDNAddress();
- // from base class CActive
+// from base class CActive
/**
* From CActive.
@@ -231,12 +232,6 @@
TUint32 iSnapId;
/**
- * Connection preferences.
- * Own.
- */
- TCommDbConnPref iPrefs;
-
- /**
* Extended connection preferences.
* Own.
*/
--- a/vpnengine/ikesocket/src/ikeconnection.cpp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/ikesocket/src/ikeconnection.cpp Fri Feb 19 23:50:52 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-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"
@@ -161,22 +161,13 @@
if ( err == KErrNone )
{
// Start connection.
- if ( iSnapId ) // SNAP
+ TRAP( err, CreatePreferencesL( iIapId,
+ iSnapId,
+ aForcedRoaming ) );
+ if ( err == KErrNone )
{
- TRAP( err, CreateSnapPreferencesL( iSnapId,
- aForcedRoaming ) );
- if ( err == KErrNone )
- {
- iConnection.Start( iConnPrefList, iStatus );
- }
- }
- else // IAP
- {
- // Create preference overrides.
- iPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
- iPrefs.SetIapId( iIapId );
- iConnection.Start( iPrefs, iStatus );
- }
+ iConnection.Start( iConnPrefList, iStatus );
+ }
}
if ( err != KErrNone )
@@ -336,17 +327,26 @@
}
// ---------------------------------------------------------------------------
-// Creates connection preferences for SNAP usage. Connection preferences
-// list is constructed.
+// Creates connection preferences. Connection preferences list is constructed.
// ---------------------------------------------------------------------------
//
-void CIkeConnection::CreateSnapPreferencesL( const TUint32 aSnapId,
- const TBool aForcedRoaming )
+void CIkeConnection::CreatePreferencesL( const TUint32 aIapId,
+ const TUint32 aSnapId,
+ const TBool aForcedRoaming )
{
- CleanSnapPreferences();
+ CleanPreferences();
- iExtendedPrefs.SetSnapId( aSnapId );
- iExtendedPrefs.SetForcedRoaming( aForcedRoaming );
+ if ( aIapId != 0 )
+ {
+ iExtendedPrefs.SetIapId( aIapId );
+ }
+ else
+ {
+ iExtendedPrefs.SetSnapId( aSnapId );
+ iExtendedPrefs.SetForcedRoaming( aForcedRoaming );
+ }
+
+ iExtendedPrefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnDisableNotes );
iConnPrefList.AppendL( &iExtendedPrefs );
}
@@ -355,7 +355,7 @@
// Cleans connection preferences created for SNAP usage.
// ---------------------------------------------------------------------------
//
-void CIkeConnection::CleanSnapPreferences()
+void CIkeConnection::CleanPreferences()
{
while( iConnPrefList.Count() > 0 )
{
@@ -388,7 +388,7 @@
IKESOCKET_ASSERT( iLinkObserver );
IKESOCKET_ASSERT( iState == EConnecting );
- CleanSnapPreferences();
+ CleanPreferences();
TInt err( iStatus.Int() );
@@ -443,7 +443,7 @@
iState = EIdle;
iConnection.Close();
- CleanSnapPreferences();
+ CleanPreferences();
User::RequestComplete( iClientStatus, KErrCancel );
iClientStatus = NULL;
--- a/vpnengine/ikev2lib/inc/ikev2Negotiation.h Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/ikev2lib/inc/ikev2Negotiation.h Fri Feb 19 23:50:52 2010 +0200
@@ -67,11 +67,9 @@
const TInt KStateIkeSARekeyResponse = 24;
const TInt KStateIkeInfoRequest = 31;
-const TInt KStateIkeInfoResponse = 32;
const TInt KStateIkeDeleteRequest = 33;
const TInt KStateIkeDeleteResponse = 34;
const TInt KStateChildDeleteRequest = 35;
-const TInt KStateChildDeleteResponse = 36;
class CIkev2PluginSession;
class CPFKeySocketIf;
--- a/vpnengine/ikev2lib/src/ikecrypto.cpp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/ikev2lib/src/ikecrypto.cpp Fri Feb 19 23:50:52 2010 +0200
@@ -22,9 +22,11 @@
CDHKeys* CDHKeys::NewL(const TDesC8& aN, const TDesC8& aG)
{
- CDHKeys *keys = new (ELeave) CDHKeys();
+ CDHKeys* keys = new (ELeave) CDHKeys();
+ CleanupStack::PushL(keys);
keys->iDHKey = TUtlCrypto::MakeDiffieHellmanL(aN, aG);
- keys->iModuluslength = aN.Length();
+ keys->iModuluslength = aN.Length();
+ CleanupStack::Pop(keys);
return keys;
}
--- a/vpnengine/ikev2lib/src/ikev2mobike.cpp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/ikev2lib/src/ikev2mobike.cpp Fri Feb 19 23:50:52 2010 +0200
@@ -192,7 +192,7 @@
aNegotiation->SendIkeMsgL(ikeMsg);
aNegotiation->iIkeV2PlugInSession.UpdateIkev2SAL(&aNegotiation->iHdr, NULL);
if ( (aNegotiation->iState != KStateIkeInfoRequest) && (aNegotiation->iState != KStateIkeDeleteRequest) && (aNegotiation->iState != KStateIkeDeleteResponse) )
- aNegotiation->iState = KStateIkeInfoResponse;
+ aNegotiation->iState = KStateIkeSaCompleted;
}
//
// else
--- a/vpnengine/ikev2lib/src/ikev2negotiation.cpp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/ikev2lib/src/ikev2negotiation.cpp Fri Feb 19 23:50:52 2010 +0200
@@ -2942,8 +2942,7 @@
SendIkeMsgL(ikeMsg);
if ( (iState != KStateIkeInfoRequest) && (iState != KStateIkeDeleteRequest) && (iState != KStateIkeDeleteResponse) )
{
- iState = KStateIkeInfoResponse;
- iIkeV2PlugInSession.UpdateIkev2SAL(&iHdr, NULL);
+ iState = KStateIkeSaCompleted;
}
}
}
@@ -3187,8 +3186,7 @@
CleanupStack::Pop(ikeMsg);
SendIkeMsgL(ikeMsg);
CleanupStack::PopAndDestroy(SpiList);
- iState = KStateIkeInfoResponse;
- iIkeV2PlugInSession.UpdateIkev2SAL(&iHdr, NULL);
+ iState = KStateIkeSaCompleted;
aRequest = EFalse;
}
--- a/vpnengine/vpnconnagt/group/vpnconnagt.mmp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/vpnconnagt/group/vpnconnagt.mmp Fri Feb 19 23:50:52 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2003-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"
@@ -15,8 +15,6 @@
*
*/
-
-
#include <platform_paths.hrh>
TARGET vpnconnagt.agt
@@ -32,6 +30,7 @@
SOURCEPATH ../src
SOURCE vpnconnagt.cpp
+SOURCE vpnsipobserver.cpp
USERINCLUDE ../inc
USERINCLUDE ../../vpncommon/inc
@@ -46,6 +45,7 @@
LIBRARY insock.lib
LIBRARY eventmedapi.lib
LIBRARY cmmanager.lib
+LIBRARY featmgr.lib
DEBUGLIBRARY flogger.lib
--- a/vpnengine/vpnconnagt/group/vpnconnagt_test.mmp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/vpnconnagt/group/vpnconnagt_test.mmp Fri Feb 19 23:50:52 2010 +0200
@@ -32,6 +32,7 @@
SOURCEPATH ../src
SOURCE vpnconnagt.cpp
+SOURCE vpnsipobserver.cpp
USERINCLUDE ../inc
USERINCLUDE ../../vpncommon/inc
@@ -46,6 +47,7 @@
LIBRARY insock.lib
LIBRARY eventmedapi.lib
LIBRARY cmmanager.lib
+LIBRARY featmgr.lib
DEBUGLIBRARY flogger.lib
--- a/vpnengine/vpnconnagt/inc/vpnconnagt.h Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/vpnconnagt/inc/vpnconnagt.h Fri Feb 19 23:50:52 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2000-2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2000-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"
@@ -40,6 +40,11 @@
_LIT(KVPNConnAgtName,"vpnconnagt");
+
+// P&S key observer for communication between VPN client and SIP Profile server.
+class CVpnSipObserver;
+
+
/**
* A Factory for creating a VPNConnAgent.
*/
@@ -197,6 +202,12 @@
* the status of the real interface.
*/
void EventOccured(TInt aStatus, TEventType aType, TDesC8* aData);
+
+ /**
+ * Is called when SIP deregistration is completed. In here a VPN session
+ * is actually started.
+ */
+ void ProceedServiceStart();
protected: // Methods
@@ -337,7 +348,7 @@
force it to shutdown without trying to send any packets anymore */
TDeactivateType iDisconnectType;
- /* State of the agent object */
+ /** State of the agent object */
TRequestState iState;
/** Boolean to define wether disconnecting operation is ongoing */
@@ -348,7 +359,13 @@
TPckgBuf<TStartVpnConnEventSpec> iStartVpnConnDes;
TPckgBuf<TCloseVpnConnEventSpec> iCloseVpnConnDes;
TPckgBuf<TObserveRealIapConnEventSpec> iObserveRealIapConnDes;
+
+ /** Own: P&S key observer */
+ CVpnSipObserver* iSipObserver;
+
+ /** Feature Manager initialzation flag */
+ TBool iFeatureManagerInitialized;
};
+
#endif // VPN_CONN_AGT_H
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnconnagt/inc/vpnsipobserver.h Fri Feb 19 23:50:52 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* 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 VPN client
+* and SIP Profile server
+* Name : vpnsipobserver.h
+* Part of : VPN client / VPN Connection Agent
+* Version : 1.0
+*
+*/
+
+#ifndef VPNSIPOBSERVER_H
+#define VPNSIPOBSERVER_H
+
+#include <e32base.h>
+#include "vpnconnagt.h" // Reference to CVPNConnAgt is needed for call back
+
+class CVPNConnAgt;
+
+NONSHARABLE_CLASS( CVpnSipObserver ): public CActive
+ {
+public: // Constructor & destructor
+
+ /**
+ * Two-phased constructor
+ */
+ static CVpnSipObserver* NewL( CVPNConnAgt& aAgent );
+
+ /**
+ * Destructor
+ */
+ virtual ~CVpnSipObserver();
+
+
+public: // New methods
+
+ /**
+ * Closes the sip connections
+ * @return ETrue if connections are succesfully closed
+ */
+ TInt RequestDeregister();
+
+ /**
+ * Re-opens connection in case vpn session ends
+ */
+ TInt RequestRegister();
+
+
+private: // From CActive
+
+ /**
+ * From CActive
+ */
+ void RunL();
+
+ /**
+ * From CActive
+ */
+ void DoCancel();
+
+
+private: // New methods
+
+ /**
+ * Subscribes to the property
+ */
+ void Subscribe();
+
+ /**
+ * 2nd phase constructor
+ */
+ void ConstructL();
+
+ /**
+ * C++ constructor
+ */
+ CVpnSipObserver( CVPNConnAgt& aAgent );
+
+
+private: // Data
+
+ /**
+ * Own: P&S for communication between SIP Profile Server and VPN client
+ */
+ RProperty iSIPProperty;
+
+ /**
+ * Own: Owner of this observer
+ */
+ CVPNConnAgt& iAgent;
+ };
+
+#endif // VPNSIPOBSERVER_H
--- a/vpnengine/vpnconnagt/src/vpnconnagt.cpp Tue Feb 02 00:53:00 2010 +0200
+++ b/vpnengine/vpnconnagt/src/vpnconnagt.cpp Fri Feb 19 23:50:52 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2000-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"
@@ -24,8 +24,10 @@
#include <in_iface.h>
#include <tunnelnifvar.h>
#include <d32dbmsconstants.h>
+#include <featmgr.h>
#include "vpnconnagt.h"
+#include "vpnsipobserver.h"
/***************CVPNConnAgtFactory********************/
@@ -76,6 +78,8 @@
iEventActivatedClose = EFalse;
iDisconnectType = (TDeactivateType)NORMAL_DISCONNECT_MODE; // means the normal way to shutdown
+
+ iFeatureManagerInitialized = EFalse;
}
// ---------------------------------------------------------------------------
@@ -88,6 +92,18 @@
name.AppendFormat(_L("[0x%08x]"), this);
Log::Printf(_L("%s Destructing VPN Connection Agent\n"),name.PtrZ()));
+ if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
+ {
+ delete iSipObserver;
+ iSipObserver = NULL;
+ }
+
+ if ( iFeatureManagerInitialized )
+ {
+ // We can safely call UnInitializeLib as we have really intialized it.
+ FeatureManager::UnInitializeLib(); // Decreases ref.count
+ }
+
iEventMediator.Close();
iServiceStartedCallback.Cancel();
@@ -121,6 +137,17 @@
iDisconnecting = EFalse;
LOG_("CVPNConnAgt::ReadConfigurationL EventMediator");
User::LeaveIfError(iEventMediator.Connect());
+
+ // Initialize Feature Manager.
+ FeatureManager::InitializeLibL(); // Successfull call increases reference count
+ iFeatureManagerInitialized = ETrue;
+
+ // Create CVpnSipObserver for communicating with SIP profile server via
+ // P&S keys for SIP de/re-registration. this pointer is passed to have call back.
+ if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
+ {
+ iSipObserver = CVpnSipObserver::NewL( *this );
+ }
}
// ---------------------------------------------------------------------------
@@ -293,6 +320,38 @@
return;
}
+ // SIP is deregistered before starting a VPN session. First tell SIP profile server to
+ // perform deregistration. And when it's completed, continue VPN session start.
+ // Note: A wait note is not used here for holding VPN session starting process because
+ // CInternetConnectionManager is showing one.
+ // Tell SIP Profile Server to perform deregistration before proceeding VPN start.
+ // Multiple VPN connection use cases are handled in SIP side. VPN just notifies SIP
+ // a VPN session is about to start.
+ if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
+ {
+ // For some reason, if the request fails, just proceeds.
+ if ( iSipObserver->RequestDeregister() != KErrNone )
+ {
+ ProceedServiceStart();
+ }
+ // Return for now. ProceedServiceStart() will be called later by iSipObserver when
+ // deregistration process has been completed. Then VPN start process will be actually
+ // initiated.
+ return;
+ }
+ // If KFeatureIdFfImsDeregistrationInVpn is disabled, no SIP deregisration is performed.
+ else
+ {
+ ProceedServiceStart();
+ }
+ }
+
+/****************************************************************************/
+/* ProceedServiceStart() */
+/* Proceed VPN session start process */
+/****************************************************************************/
+void CVPNConnAgt::ProceedServiceStart()
+ {
LOG_1("[0x%08x] Get protocol version\n", this);
iProtocolVersionDes().iId = iEventMediator.NewEventSpecId();
iProtocolVersionDes().iPolicyId = *(iVPNParameters.GetVPNPolicy());
@@ -408,6 +467,13 @@
return;
}
+ if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
+ {
+ // SIP is re-registered when a VPN session ends.
+ // Note: return value ignored. Nothing to do here for error cases.
+ iSipObserver->RequestRegister();
+ }
+
iNotify->AgentProgress(EVPNConnAgtDisconnected, KErrNone);
iNotify->DisconnectComplete();
iDisconnecting = EFalse;
@@ -499,6 +565,14 @@
break;
case ECloseVpnConnEvent:
LOG(Log::Printf(_L("%s ECloseVpnConnEvent\n"),name.PtrZ()));
+
+ if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
+ {
+ // SIP is re-registered when a VPN session ends.
+ // Note: return value ignored. Nothing to do here for error cases.
+ iSipObserver->RequestRegister();
+ }
+
closeData = (TCloseVpnConnEventData*)(aData->Ptr());
if ( closeData->iTaskStatus )
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vpnengine/vpnconnagt/src/vpnsipobserver.cpp Fri Feb 19 23:50:52 2010 +0200
@@ -0,0 +1,161 @@
+/*
+* 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 VPN client
+* and SIP Profile server
+* Name : vpnsipobserver.cpp
+* Part of : VPN client / VPN Connection Agent
+* Version : 1.0
+*
+*/
+
+// SYSTEM INCLUDES
+#include <e32property.h> // For P&S key
+#include <vpnsipobserverpskeys.h> // For P&S key definition
+
+// USER INCLUDES
+#include "vpnsipobserver.h"
+
+// ---------------------------------------------------------------------------
+// two phased constructor
+// ---------------------------------------------------------------------------
+//
+CVpnSipObserver* CVpnSipObserver::NewL( CVPNConnAgt& aAgent )
+ {// dkangchecked
+ CVpnSipObserver* self = new( ELeave ) CVpnSipObserver( aAgent );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// second phased constructor
+// ---------------------------------------------------------------------------
+//
+void CVpnSipObserver::ConstructL()
+ {
+ // KVpnSipState P&S key is used for communication between VPN client
+ // and SIP Profile Server regarding SIP de/re-registration.
+ // KPSVpnSipUid is defined in a SIP System State Monitor plugin
+ // (CSipVpnMonitorAo).
+ User::LeaveIfError( iSIPProperty.Attach( KPSVpnSipUid, KVpnSipState ) );
+
+ // Start monitoring the P&S key.
+ Subscribe();
+ }
+
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CVpnSipObserver::CVpnSipObserver( CVPNConnAgt& aAgent )
+ : CActive( EPriorityStandard ),
+ iAgent( aAgent )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// C++ destructor
+// ---------------------------------------------------------------------------
+//
+CVpnSipObserver::~CVpnSipObserver()
+ {
+ Cancel();
+ iSIPProperty.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CVpnSipObserver::RequestDeregister
+// ---------------------------------------------------------------------------
+//
+TInt CVpnSipObserver::RequestDeregister()
+ {
+ // Tells SIP Profile Server that a VPN session is about to be started.
+ // This will trigger SIP deregistration process by SIP Profile Server.
+ // Should not leave if failed. This will be handled by VPN Conn Agt.
+ return iSIPProperty.Set( KPSVpnSipUid, KVpnSipState, EVpnInitiating );
+ }
+
+// ---------------------------------------------------------------------------
+// CVpnSipObserver::RequestRegister
+// ---------------------------------------------------------------------------
+//
+TInt CVpnSipObserver::RequestRegister()
+ {
+ // Tells SIP Profile Server that a VPN session ended.
+ // This will trigger SIP re-registration process by SIP Profile Server.
+ // Should not leave if failed. This will be handled by VPN Conn Agt.
+ return iSIPProperty.Set( KPSVpnSipUid, KVpnSipState, EVpnTerminated );
+ }
+
+// ---------------------------------------------------------------------------
+// CVpnSipObserver::RunL
+// ---------------------------------------------------------------------------
+//
+void CVpnSipObserver::RunL()
+ {
+ if ( iStatus == KErrNone )
+ {
+ TInt val = 0;
+ // SIP Profile Server notified completion of SIP deregistration.
+ TInt err = iSIPProperty.Get( KPSVpnSipUid, KVpnSipState, val );
+
+ if ( err == KErrNone )
+ {
+ // If SIP is deregistered, let the VPN Connection Agent to
+ // proceed VPN session start.
+ if ( val == ESipDeregisterCompleted )
+ {
+ iAgent.ProceedServiceStart();
+ }
+ }
+ // Keep monitoring.
+ Subscribe();
+ }
+ // Check if observer can be restarted.
+ else if ( iStatus != KErrCancel
+ && iStatus != KErrServerTerminated
+ && iStatus != KErrNotSupported )
+ {
+ // Keep monitoring.
+ Subscribe();
+ }
+ else
+ {
+ // Error.
+ LOG_1( "CVpnSipObserver::RunL Unknown error situation, iStatus = %d", iStatus.Int() );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CVpnSipObserver::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CVpnSipObserver::DoCancel()
+ {
+ iSIPProperty.Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+// CVpnSipObserver::Subscribe
+// ---------------------------------------------------------------------------
+//
+void CVpnSipObserver::Subscribe()
+ {
+ iSIPProperty.Subscribe( iStatus );
+ SetActive();
+ }