--- a/realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h Fri May 14 14:57:35 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h Fri May 28 16:13:10 2010 +0300
@@ -24,10 +24,11 @@
#include <etelpckt.h>
#include <es_enum.h>
#include <es_enum_partner.h>
+#include <centralrepository.h>
#include "sipapnmanager.h"
// CONSTANTS
-const TInt KSecondaryApnMaxRetryCount = 100;
+const TInt KDBMaxRetryCount = 100;
// FORWARD DECLARATIONS
class CCommsDatabase;
@@ -107,7 +108,7 @@
void WatchConnectionStatusChange();
- void WatchDatabaseStatusChangeL( TUint32 aIapId );
+ void WatchDatabaseStatusChangeL();
TBool ApnChangeNeededL( const TDesC8& aApn );
@@ -153,39 +154,39 @@
/// 2nd phase constructor
void ConstructL();
+
+ void BlockCellularDataUsageL();
+
+ void AllowCellularDataUsage();
+
+
+ /**
+ * Rollsback db in case of failure
+ * @param aDb
+ */
+ static void RollBackDBTransaction(TAny* aDb);
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;
+ MSIPApnChangeObserver& iObserver;
+ TSipApnMonitoringState iMonitoringState;
+ RSocketServ iSocketSrv;
+ RConnection iConnection;
+ TPckgBuf<TConnectionInfo> iConnectionInfo;
+ TNifProgressBuf iProgress;
+ HBufC8* iApnProposal;
+ TUint32 iIapId;
+ CCommsDatabase* iCommsDatabase;
+ TInt iDBMonitoringRetryCount;
+ HBufC8* iCurrentApn;
+ TBool iApnUseSecureAuthProposal;
+ TBool iIsFailed;
+ TBool iIsFatalFailure;
+ HBufC8* iPrimaryApn;
+ HBufC8* iSecondaryApn;
+ CRepository* iRepository;
+ TInt iCurrentUsageStatus;
+ TBool iCellularDataBlocked;
#ifdef CPPUNIT_TEST
friend class CSIPApnManagerTest;
--- a/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp Fri May 14 14:57:35 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp Fri May 28 16:13:10 2010 +0300
@@ -19,6 +19,8 @@
#include <commsdattypesv1_1.h>
#include <commdb.h>
#include <commsdat.h>
+#include <cmgenconnsettings.h>
+#include <cmmanagerkeys.h>
#include "sipapnconfigurationhandler.h"
#include "SipProfileLog.h"
@@ -58,17 +60,15 @@
{
PROFILE_DEBUG1(
"CSIPApnConfigurationHandler::~CSIPApnConfigurationHandler()" )
-
+
Cancel();
iConnection.Close();
iSocketSrv.Close();
-
delete iApnProposal;
delete iCurrentApn;
-
delete iPrimaryApn;
delete iSecondaryApn;
-
+ delete iRepository;
delete iCommsDatabase;
PROFILE_DEBUG1(
@@ -105,7 +105,7 @@
return;
}
- iMonitoringRetryCount = 0;
+ iDBMonitoringRetryCount = 0;
ChangeApnIfNotInUseL( aAllowAsync );
@@ -285,6 +285,11 @@
PROFILE_DEBUG3(
"CSIPApnConfigurationHandler::RunError() err", aError );
+ if(iCellularDataBlocked)
+ {
+ AllowCellularDataUsage();
+ }
+
if ( aError != KErrNoMemory && aError != KErrNone )
{
iObserver.ApnChanged( *iApnProposal, iIapId, aError );
@@ -307,7 +312,8 @@
CActiveScheduler::Add( this );
iIapId = aIapId;
iIsFailed = EFalse;
- iIsFatalFailure = EFalse;
+ iIsFatalFailure = EFalse;
+ iCellularDataBlocked = EFalse;
}
// -----------------------------------------------------------------------------
@@ -320,7 +326,7 @@
"CSIPApnConfigurationHandler::ConstructL()" )
User::LeaveIfError( iSocketSrv.Connect() );
-
+ iRepository = CRepository::NewL( KCRUidCmManager );
PROFILE_DEBUG1(
"CSIPApnConfigurationHandler::ConstructL() exit" )
}
@@ -426,7 +432,7 @@
// CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL
// -----------------------------------------------------------------------------
//
-void CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL( TUint32 aIapId )
+void CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL()
{
PROFILE_DEBUG1(
"CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL()" )
@@ -436,22 +442,26 @@
if ( !iCommsDatabase )
{
PROFILE_DEBUG1(
- "CSIPApnConfigurationHandler:: create commsdb" )
+ "CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL create commsdb" )
iCommsDatabase = CCommsDatabase::NewL();
}
PROFILE_DEBUG1(
- "CSIPApnConfigurationHandler:: request notification" )
+ "CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL 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.
+
+ if(iDBMonitoringRetryCount > KDBMaxRetryCount)
+ {
+ PROFILE_DEBUG1("CSIPApnConfigurationHandler::WatchDatabaseStatusChangeL max retries reached!" )
+ User::Leave( KErrAbort );
+ }
+
User::LeaveIfError( iCommsDatabase->RequestNotification( iStatus ) );
-
SetActive();
-
- iIapId = aIapId;
-
+
SetMonitoringState( EMonitoringDatabase );
PROFILE_DEBUG1(
@@ -542,7 +552,7 @@
__ASSERT_ALWAYS( aAllowAsync, User::Leave( KErrInUse ) );
- WatchDatabaseStatusChangeL( iIapId );
+ WatchDatabaseStatusChangeL();
}
else
{
@@ -570,8 +580,12 @@
using namespace CommsDat;
- CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+ CMDBSession* db = CMDBSession::NewL( KCDVersion1_1 );
CleanupStack::PushL( db );
+
+ db->OpenTransactionL();
+ CleanupStack::PushL(TCleanupItem(RollBackDBTransaction, db));
+
// Set attributes so that also protected iaps can be accessed
db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
@@ -647,9 +661,19 @@
db->ClearAttributeMask( ECDHidden | ECDProtectedWrite );
CleanupStack::PopAndDestroy( iapRecord );
+
+ db->CommitTransactionL();
+
+ CleanupStack::Pop(); //cleanup item
+
CleanupStack::PopAndDestroy( db );
- SendApnChangedNotificationL( aApn );
+ if (iCellularDataBlocked)
+ {
+ AllowCellularDataUsage();
+ }
+
+ SendApnChangedNotificationL( aApn );
PROFILE_DEBUG1(
"CSIPApnConfigurationHandler::ChangeApnL(), exit" )
@@ -701,10 +725,10 @@
void CSIPApnConfigurationHandler::ConnectionMonitoringCompletedL( TInt aError )
{
PROFILE_DEBUG3(
- "CSIPApnConfigurationHandler:: progress.err",
+ "CSIPApnConfigurationHandler::ConnectionMonitoringCompletedL progress.err",
iProgress().iError );
PROFILE_DEBUG3(
- "CSIPApnConfigurationHandler:: progress.stage",
+ "CSIPApnConfigurationHandler::ConnectionMonitoringCompletedL progress.stage",
iProgress().iStage );
if ( !aError )
@@ -748,30 +772,19 @@
{
// Changing may be now possible, if not, db notifications or connection
// monitoring is re-enabled inside following method
+ PROFILE_DEBUG1("DatabaseMonitoringCompletedL::DatabaseMonitoringCompletedL BlockCellularDataUsageL" );
+ BlockCellularDataUsageL();
apnChanged = ChangeApnIfNotInUseL();
}
else
{
- WatchDatabaseStatusChangeL( iIapId );
+ iDBMonitoringRetryCount++;
+ WatchDatabaseStatusChangeL();
}
- // Have some safety limit for monitoring as it's not guaranteed that
- // db lock is ever released -> avoid unnecessary battery consumption
- if ( !apnChanged )
+ if(apnChanged)
{
- iMonitoringRetryCount++;
- PROFILE_DEBUG3(
- "DatabaseMonitoringCompletedL:: retrycount",
- iMonitoringRetryCount );
-
- if ( iMonitoringRetryCount > KSecondaryApnMaxRetryCount )
- {
- PROFILE_DEBUG1(
- "CSIPApnConfigurationHandler:: max retries reached!" )
- Cancel();
-
- User::Leave( KErrAbort );
- }
+ iDBMonitoringRetryCount = 0;
}
}
@@ -902,4 +915,40 @@
}
}
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::BlockCellularDataUsageL
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::BlockCellularDataUsageL()
+ {
+ PROFILE_DEBUG1("DatabaseMonitoringCompletedL::BlockCellularDataUsageL Enter" );
+ //Current Usage Status;
+ iRepository->Get( KCurrentCellularDataUsage, iCurrentUsageStatus );
+ iRepository->Set( KCurrentCellularDataUsage, ECmCellularDataUsageDisabled );
+ iCellularDataBlocked = ETrue;
+ PROFILE_DEBUG1("DatabaseMonitoringCompletedL::BlockCellularDataUsageL Exit" );
+ }
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::AllowCellularDataUsage
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::AllowCellularDataUsage()
+ {
+ PROFILE_DEBUG1("DatabaseMonitoringCompletedL::AllowCellularDataUsage Enter" );
+ iRepository->Set( KCurrentCellularDataUsage, iCurrentUsageStatus );
+ iDBMonitoringRetryCount = 0;
+ iCellularDataBlocked = EFalse;
+ PROFILE_DEBUG1("DatabaseMonitoringCompletedL::AllowCellularDataUsage Exit" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSIPApnConfigurationHandler::RollBackDBTransaction
+// -----------------------------------------------------------------------------
+//
+void CSIPApnConfigurationHandler::RollBackDBTransaction(TAny* aDb)
+ {
+ CMDBSession* db = static_cast<CMDBSession*>(aDb);
+ TRAP_IGNORE(db->RollbackTransactionL());
+ }
+
// End of file
--- a/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnmanager.cpp Fri May 14 14:57:35 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnmanager.cpp Fri May 28 16:13:10 2010 +0300
@@ -216,7 +216,7 @@
{
TBool isIapGPRS(EFalse);
using namespace CommsDat;
- CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+ CMDBSession* db = CMDBSession::NewL( KCDVersion1_1 );
CleanupStack::PushL( db );
// Set any attributes if any
db->SetAttributeMask( ECDHidden );
--- a/realtimenetprots/sipfw/ProfileAgent/profile_fsm/inc/sipprflderegisterrequestedstate.h Fri May 14 14:57:35 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/profile_fsm/inc/sipprflderegisterrequestedstate.h Fri May 28 16:13:10 2010 +0300
@@ -14,7 +14,7 @@
* Description:
* Name : sipprflderegisterrequestedstate.h
* Part of : sip profile fsm
-* Version : %version: 2.1.1 %
+* Version : %version: 2.1.2 %
*
*/
@@ -72,6 +72,13 @@
CSIPConcreteProfile::TStatus ConcreteProfileState() const;
+ /* DeRegister requested
+ * update on multiple profile issue, when update on the previous profile is pending.
+ * 07 May 2010
+ * */
+ void DeregisterL(
+ MSIPProfileContext& aContext);
+
/**
* Moves back the profile to "Registered" state
* @param aContext a profile context
--- a/realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflderegisterrequestedstate.cpp Fri May 14 14:57:35 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflderegisterrequestedstate.cpp Fri May 28 16:13:10 2010 +0300
@@ -14,7 +14,7 @@
// Name : sipprflderegisterrequestedstate.cpp
// Part of : sip profile fsm
// implementation
-// Version : %version: 2.1.1 %
+// Version : %version: 2.1.2 %
//
@@ -98,6 +98,41 @@
}
// -----------------------------------------------------------------------------
+// CSIPPrflDeregisterRequestedState::DeregisterL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSIPPrflDeregisterRequestedState::DeregisterL(
+ MSIPProfileContext& aContext)
+ {
+ __ASSERT_DEBUG(aContext.Profile()!=0, User::Invariant());
+ __ASSERT_DEBUG(aContext.Registration()!=0, User::Invariant());
+ if (aContext.Connection().State()==CSIPConnection::EActive)
+ {
+ if (iUser.AddProfileIntoQueue(*aContext.Profile())) //compares the registrar of the present profile with the other profiles existing in the connection context array.
+ {
+ iUser.DeregisterProfileL(*aContext.Profile());
+
+ }
+ else
+ {
+ CSIPMessageElements* elements =
+ aContext.CreateDeRegisterElementsL();
+ CleanupStack::PushL(elements);
+ CSIPClientTransaction* tx =
+ aContext.Registration()->DeregisterL(elements);
+ CleanupStack::Pop(elements);
+ aContext.SetTransaction(tx);
+ aContext.SetNextState(*iDeregistrationInProgressState);
+ }
+ }
+ aContext.AgentObserver().SIPProfileStatusEvent(
+ *aContext.Profile(),
+ aContext.Registration()->ContextId());
+ }
+
+
+// -----------------------------------------------------------------------------
// CSIPPrflDeregisterRequestedState::ErrorOccured()
// This can happen if the de-register was reguested while the connection is
// suspended (registered->de-register requested). SIP stack has removed
--- a/realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransport.cpp Fri May 14 14:57:35 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransport.cpp Fri May 28 16:13:10 2010 +0300
@@ -1459,11 +1459,23 @@
if ( Protocol() == KProtocolTls )
{
RStringF tls = SIPStrings::StringF( SipStrConsts::ETLS );
- // SIP-URI with transport=TLS must not use sips scheme
- uri.SIPURI()->SetSIPS( transportParam != tls );
+ // SIP Scheme in Contact header should be same as From Header
+ CURIContainer& FromUri = (((aMessage->From())->SIPAddress()).URI());
+ if(FromUri.IsSIPURI())
+ {
+ CSIPURI* FromSIPUri =FromUri.SIPURI();
+ if(FromSIPUri->IsSIPSURI())
+ {
+ uri.SIPURI()->SetSIPS( ETrue );
+ }
+ else
+ {
+ uri.SIPURI()->SetSIPS( EFalse );
+ }
+ }
if(transportParam == tls)
{
- uri.SIPURI()->SetSIPS(EFalse);
+ //uri.SIPURI()->SetSIPS(EFalse);
//Delete the param transport=tls from the URI as it is deprecated in RFC 3261
uri.SIPURI()->DeleteParam(SIPStrings::StringF( SipStrConsts::ETransport ));
}