telephonyprotocols/pdplayer/src/PDPSCPRStates.cpp
branchRCL_3
changeset 21 2492a6e4aed7
parent 15 fc69e1e37771
child 27 4284d6390a82
equal deleted inserted replaced
17:3f227a47ad75 21:2492a6e4aed7
    38 #include <comms-infras/ss_api_ext.h>
    38 #include <comms-infras/ss_api_ext.h>
    39 #include <elements/nm_messages_errorrecovery.h>
    39 #include <elements/nm_messages_errorrecovery.h>
    40 #include <comms-infras/sockmes.h> // for ioctl ipc
    40 #include <comms-infras/sockmes.h> // for ioctl ipc
    41 #include <nifvar_internal.h>
    41 #include <nifvar_internal.h>
    42 #include <elements/mm_activities.h>
    42 #include <elements/mm_activities.h>
       
    43 #include <comms-infras/ss_tiermanagerutils.h>
       
    44 #include <comms-infras/connectionsettings.h>
       
    45 #include <hash.h>
       
    46 #include <e32math.h>
    43 
    47 
    44 using namespace Messages;
    48 using namespace Messages;
    45 using namespace MeshMachine;
    49 using namespace MeshMachine;
    46 using namespace ESock;
    50 using namespace ESock;
    47 using namespace NetStateMachine;
    51 using namespace NetStateMachine;
    50 using namespace ConnectionServ;
    54 using namespace ConnectionServ;
    51 
    55 
    52 #ifdef _DEBUG
    56 #ifdef _DEBUG
    53 _LIT (KPdpSCprPanic,"PpdScprPanic");
    57 _LIT (KPdpSCprPanic,"PpdScprPanic");
    54 #endif
    58 #endif
       
    59 
       
    60 const TUint8 KGenericNifChallengeSize = 8;
       
    61 const TUint KGenericNifIdLength = 1;
    55 
    62 
    56 //-=========================================================
    63 //-=========================================================
    57 //
    64 //
    58 // States
    65 // States
    59 //
    66 //
    64 //Util
    71 //Util
    65 //-=========================================================
    72 //-=========================================================
    66 DEFINE_SMELEMENT(TAwaitingPDPFSMMessage, NetStateMachine::MState, PDPSCprStates::TContext)
    73 DEFINE_SMELEMENT(TAwaitingPDPFSMMessage, NetStateMachine::MState, PDPSCprStates::TContext)
    67 TBool TAwaitingPDPFSMMessage::Accept()
    74 TBool TAwaitingPDPFSMMessage::Accept()
    68     {
    75     {
    69     return iContext.iMessage.IsMessage<TPDPFSMMessages::TPDPFSMMessage>();
    76     return iContext.iMessage.IsMessage<TPDPMessages::TPDPFSMMessage>();
    70     }
    77     }
    71 
    78 
    72 DEFINE_SMELEMENT(TNoTagOrError, NetStateMachine::MStateFork, PDPSCprStates::TContext)
    79 DEFINE_SMELEMENT(TNoTagOrError, NetStateMachine::MStateFork, PDPSCprStates::TContext)
    73 TInt TNoTagOrError::TransitionTag()
    80 TInt TNoTagOrError::TransitionTag()
    74     {
    81     {
    75     ASSERT(iContext.iNodeActivity);
    82     ASSERT(iContext.iNodeActivity);
    76     TPDPFSMMessages::TPDPFSMMessage& msg = message_cast<TPDPFSMMessages::TPDPFSMMessage>(iContext.iMessage);
    83     TPDPMessages::TPDPFSMMessage& msg = message_cast<TPDPMessages::TPDPFSMMessage>(iContext.iMessage);
    77     if (msg.iValue2 != KErrNone)
    84     if (msg.iValue2 != KErrNone)
    78         {
    85         {
    79         iContext.iNodeActivity->SetError(msg.iValue2);
    86         iContext.iNodeActivity->SetError(msg.iValue2);
    80         return KErrorTag;
    87         return KErrorTag;
    81         }
    88         }
    82     return KNoTag;
    89     return KNoTag;
    83     }
    90     }
    84 
    91 
    85 DEFINE_SMELEMENT(TNoTagOrAlreadyStarted, NetStateMachine::MStateFork, PDPSCprStates::TContext)
    92 DEFINE_SMELEMENT(TNoTagOrUserAuthenticateOrAlreadyStarted, NetStateMachine::MStateFork, PDPSCprStates::TDefContext)
    86 TInt TNoTagOrAlreadyStarted::TransitionTag()
    93 TInt TNoTagOrUserAuthenticateOrAlreadyStarted::TransitionTag()
    87     {
    94     {
    88     ASSERT(iContext.iMessage.IsMessage<TCFDataClient::TStart>());
    95     ASSERT(iContext.iMessage.IsMessage<TCFDataClient::TStart>());
    89     ASSERT(iContext.iNodeActivity);
    96     ASSERT(iContext.iNodeActivity);
    90     if (iContext.Node().iPDPFsmContextId != CPDPSubConnectionProvider::EInvalidContextId)
    97     if (iContext.Node().iPDPFsmContextId != CPDPSubConnectionProvider::EInvalidContextId)
    91         {
    98         {
    92         return CoreNetStates::KAlreadyStarted;
    99         return CoreNetStates::KAlreadyStarted;
    93         }
   100         }
       
   101 
       
   102     if (iContext.Node().PromptForAuth())
       
   103         {
       
   104         return PDPSCprStates::KUserAuthenticate;
       
   105         }
       
   106 
    94     return KNoTag;
   107     return KNoTag;
    95     }
   108     }
    96 
   109 
    97 
       
    98 TBool TAwaitingPDPFSMMessage::Accept(TInt aExtensionId)
   110 TBool TAwaitingPDPFSMMessage::Accept(TInt aExtensionId)
    99     {
   111     {
   100     TPDPFSMMessages::TPDPFSMMessage* pdpmsg = message_cast<TPDPFSMMessages::TPDPFSMMessage>(&iContext.iMessage);
   112     TPDPMessages::TPDPFSMMessage* pdpmsg = message_cast<TPDPMessages::TPDPFSMMessage>(&iContext.iMessage);
   101     if ( pdpmsg )
   113     if ( pdpmsg )
   102         {
   114         {
   103         if (pdpmsg->iValue1 == aExtensionId)
   115         if (pdpmsg->iValue1 == aExtensionId)
   104             {
   116             {
   105             return ETrue;
   117             return ETrue;
   116 
   128 
   117 DEFINE_SMELEMENT(TNoTagOrSendErrorRecoveryRequestOrError, NetStateMachine::MStateFork, PDPSCprStates::TContext)
   129 DEFINE_SMELEMENT(TNoTagOrSendErrorRecoveryRequestOrError, NetStateMachine::MStateFork, PDPSCprStates::TContext)
   118 TInt TNoTagOrSendErrorRecoveryRequestOrError::TransitionTag()
   130 TInt TNoTagOrSendErrorRecoveryRequestOrError::TransitionTag()
   119 	{
   131 	{
   120 	ASSERT(iContext.iNodeActivity);
   132 	ASSERT(iContext.iNodeActivity);
   121 	TPDPFSMMessages::TPDPFSMMessage& msg = message_cast<TPDPFSMMessages::TPDPFSMMessage>(iContext.iMessage);
   133 	TPDPMessages::TPDPFSMMessage& msg = message_cast<TPDPMessages::TPDPFSMMessage>(iContext.iMessage);
   122 	if (msg.iValue2 == KErrUmtsMaxNumOfContextExceededByNetwork ||
   134 	if (msg.iValue2 == KErrUmtsMaxNumOfContextExceededByNetwork ||
   123 	    msg.iValue2 == KErrUmtsMaxNumOfContextExceededByPhone)
   135 	    msg.iValue2 == KErrUmtsMaxNumOfContextExceededByPhone)
   124 		{
   136 		{
   125 		return KSendErrorRecoveryRequest;
   137 		return KSendErrorRecoveryRequest;
   126 		}
   138 		}
   189 // with information that comes out of etel/modem.  This also has the added benefit of
   201 // with information that comes out of etel/modem.  This also has the added benefit of
   190 // freeing up memory in cases where the connection is torn down but the MCPR lies 
   202 // freeing up memory in cases where the connection is torn down but the MCPR lies 
   191 // around for availability purposes.  In the future, this code (or something like it)
   203 // around for availability purposes.  In the future, this code (or something like it)
   192 // should be moved into the PDP.CPR when it exists.
   204 // should be moved into the PDP.CPR when it exists.
   193 
   205 
   194 void TSelfInit::SetupProvisionCfgL()
   206 void TSelfInit::SetupProvisionCfgL(ESock::CCommsDatIapView* aIapView)
   195     {
   207     {
   196     CPDPSubConnectionProvider &tNode = static_cast<CPDPSubConnectionProvider&>(iContext.Node());
   208     CPDPSubConnectionProvider &tNode = static_cast<CPDPSubConnectionProvider&>(iContext.Node());
   197     
       
   198     const TProviderInfoExt* providerInfoExt = static_cast<const TProviderInfoExt*>(tNode.AccessPointConfig().FindExtension(
       
   199             STypeId::CreateSTypeId(TProviderInfoExt::EUid, TProviderInfoExt::ETypeId)));
       
   200     
       
   201     // this should always be here, however, a bit of defensive programming
       
   202     // never hurt..
       
   203     if (providerInfoExt == NULL)
       
   204         {
       
   205         User::Leave(KErrCorrupt);
       
   206         }
       
   207     
   209     
   208     RMetaExtensionContainer mec;
   210     RMetaExtensionContainer mec;
   209     mec.Open(tNode.AccessPointConfig());
   211     mec.Open(tNode.AccessPointConfig());
   210     CleanupClosePushL(mec);
   212     CleanupClosePushL(mec);
   211 
       
   212     CCommsDatIapView* iapView = CCommsDatIapView::NewLC(providerInfoExt->iProviderInfo.APId());
       
   213   
   213   
   214     mec.AppendExtensionL(CIPConfig::NewFromGPRSOutLC(iapView));
   214     mec.AppendExtensionL(CIPConfig::NewFromGPRSOutLC(aIapView));
   215     CleanupStack::Pop();
   215     CleanupStack::Pop();
   216 
   216 
   217     mec.AppendExtensionL(CBCAProvision::NewLC(iapView));
   217     mec.AppendExtensionL(CBCAProvision::NewLC(aIapView));
   218     CleanupStack::Pop();
   218     CleanupStack::Pop();
   219 
   219 
   220     mec.AppendExtensionL(CImsExtProvision::NewLC(iapView));
   220     mec.AppendExtensionL(CImsExtProvision::NewLC(aIapView));
   221     CleanupStack::Pop();
   221     CleanupStack::Pop();
   222     
   222 
   223     CGPRSProvision* gprsProvision = CGPRSProvision::NewLC(iapView);
   223     CGPRSProvision* gprsProvision = CGPRSProvision::NewLC(aIapView);
   224     mec.AppendExtensionL(gprsProvision);
   224     mec.AppendExtensionL(gprsProvision);
   225     CleanupStack::Pop(gprsProvision);
   225     CleanupStack::Pop(gprsProvision);
   226     
   226     
   227     //It's not legal for the qos defaults to be absent.
   227     //It's not legal for the qos defaults to be absent.
   228     CDefaultPacketQoSProvision* defaultQoS = NULL;
   228     CDefaultPacketQoSProvision* defaultQoS = NULL;
   229     TRAPD(ret, defaultQoS = CDefaultPacketQoSProvision::NewL(iapView));   
   229     TRAPD(ret, defaultQoS = CDefaultPacketQoSProvision::NewL(aIapView));   
   230     if ((KErrNone == ret) && defaultQoS)           
   230     if ((KErrNone == ret) && defaultQoS)           
   231         {
   231         {
   232         CleanupStack::PushL(defaultQoS);
   232         CleanupStack::PushL(defaultQoS);
   233         mec.AppendExtensionL(defaultQoS);
   233         mec.AppendExtensionL(defaultQoS);
   234         CleanupStack::Pop(defaultQoS);
   234         CleanupStack::Pop(defaultQoS);
   243             {
   243             {
   244             User::Leave(KErrCorrupt);
   244             User::Leave(KErrCorrupt);
   245             }          
   245             }          
   246         }    
   246         }    
   247     
   247     
   248     CRawIpAgentConfig* rawIpAgentConfig = CRawIpAgentConfig::NewLC(iapView, &gprsProvision->GetScratchContextAs<TPacketDataConfigBase>());
   248     CRawIpAgentConfig* rawIpAgentConfig = CRawIpAgentConfig::NewLC(aIapView, &gprsProvision->GetScratchContextAs<TPacketDataConfigBase>());
   249     mec.AppendExtensionL(rawIpAgentConfig);
   249     mec.AppendExtensionL(rawIpAgentConfig);
   250     CleanupStack::Pop();
   250     CleanupStack::Pop();
   251     
   251 
   252     CleanupStack::PopAndDestroy();          // CloseIapView();  
       
   253     tNode.AccessPointConfig().Close();
   252     tNode.AccessPointConfig().Close();
   254     tNode.AccessPointConfig().Open(mec);
   253     tNode.AccessPointConfig().Open(mec);
   255     CleanupStack::PopAndDestroy(&mec); 
   254     CleanupStack::PopAndDestroy(&mec); 
   256     }
   255     }
   257 
   256 
   258 void TSelfInit::DoL()
   257 void TSelfInit::DoL()
   259     {
   258     {
   260     CPDPSubConnectionProvider &tNode = static_cast<CPDPSubConnectionProvider&>(iContext.Node());
   259     CPDPSubConnectionProvider &tNode = static_cast<CPDPSubConnectionProvider&>(iContext.Node());
   261 
   260 
   262     TRAP(tNode.iProvisionFailure,SetupProvisionCfgL());
   261     const TProviderInfoExt* providerInfoExt = static_cast<const TProviderInfoExt*>(tNode.AccessPointConfig().FindExtension(
       
   262             STypeId::CreateSTypeId(TProviderInfoExt::EUid, TProviderInfoExt::ETypeId)));
       
   263 
       
   264     // this should always be here, however, a bit of defensive programming
       
   265     // never hurt..
       
   266     if (providerInfoExt == NULL)
       
   267         {
       
   268         User::Leave(KErrCorrupt);
       
   269         }
       
   270 
       
   271     CCommsDatIapView* iapView = CCommsDatIapView::NewLC(providerInfoExt->iProviderInfo.APId());
       
   272 
       
   273     TRAP(tNode.iProvisionFailure,SetupProvisionCfgL(iapView));
   263 
   274 
   264     // Don't want any failure here to be masked by successful configuration later on.
   275     // Don't want any failure here to be masked by successful configuration later on.
   265     // A leave here will not cause a roll back of the connection but it will show an
   276     // A leave here will not cause a roll back of the connection but it will show an
   266     // Error -> message in the SVG diagram.  The provision failure error code will 
   277     // Error -> message in the SVG diagram.  The provision failure error code will 
   267     // cause the connection rollback.
   278     // cause the connection rollback.
   335         // expecting a response. if there is a failure then it will be errored in 
   346         // expecting a response. if there is a failure then it will be errored in 
   336         // the next activity in the sequence, i.e. DataClientStart
   347         // the next activity in the sequence, i.e. DataClientStart
   337         TRAP(tNode.iProvisionFailure,tNode.iPdpFsmInterface->NewL(tsyProvision->iTsyName,configType));
   348         TRAP(tNode.iProvisionFailure,tNode.iPdpFsmInterface->NewL(tsyProvision->iTsyName,configType));
   338         
   349         
   339         tNode.iDefaultSCPR = static_cast<CPDPDefaultSubConnectionProvider*>(&tNode);
   350         tNode.iDefaultSCPR = static_cast<CPDPDefaultSubConnectionProvider*>(&tNode);
   340         }
   351 
       
   352         TBool promptForAuth = EFalse;
       
   353         iapView->GetBool(KCDTIdWCDMAIfPromptForAuth | KCDTIdOutgoingGprsRecord, promptForAuth);
       
   354 
       
   355         //Default SCPR executing this code, so safe to cast.
       
   356         CPDPDefaultSubConnectionProvider &tempNode = static_cast<CPDPDefaultSubConnectionProvider&>(iContext.Node());
       
   357         tempNode.SetPromptForAuth(promptForAuth);        
       
   358         }
       
   359     CleanupStack::PopAndDestroy();          // CloseIapView();
   341     }
   360     }
   342 
   361 
   343 
   362 
   344 //-=========================================================
   363 //-=========================================================
   345 //Creating context
   364 //Creating context
   534 	User::LeaveIfError(phone.GetCurrentMode(networkMode));
   553 	User::LeaveIfError(phone.GetCurrentMode(networkMode));
   535 	CleanupStack::PopAndDestroy(2); // phone, telServer
   554 	CleanupStack::PopAndDestroy(2); // phone, telServer
   536 	return (networkMode == RMobilePhone::ENetworkModeGsm);
   555 	return (networkMode == RMobilePhone::ENetworkModeGsm);
   537 	}
   556 	}
   538 
   557 
       
   558 void TCreatePrimaryPDPCtx::SetChapInformationL(RPacketContext::TProtocolConfigOptionV2& aPco)
       
   559 /*
       
   560  * This function basically checks if secure authentication is required or not.
       
   561  * If it is needed then it sets all secure authentication related information.
       
   562  */
       
   563     {
       
   564     const TProviderInfoExt* providerInfoExt = static_cast<const TProviderInfoExt*>(iContext.Node().AccessPointConfig().FindExtension(
       
   565             STypeId::CreateSTypeId(TProviderInfoExt::EUid, TProviderInfoExt::ETypeId)));
       
   566 
       
   567     if (providerInfoExt == NULL)
       
   568         {
       
   569         User::Leave(KErrCorrupt);
       
   570         }
       
   571 
       
   572     CCommsDatIapView* iapView = CCommsDatIapView::NewLC(providerInfoExt->iProviderInfo.APId());
       
   573 
       
   574     TBool isDisablePlainTextAuth = EFalse;
       
   575     iapView->GetBool(KCDTIdWCDMADisablePlainTextAuth | KCDTIdOutgoingGprsRecord, isDisablePlainTextAuth);
       
   576 
       
   577     //If user name is not available then no authentication Required.
       
   578     if (aPco.iAuthInfo.iUsername.Length() == 0)
       
   579         {
       
   580         aPco.iAuthInfo.iProtocol = RPacketContext::EProtocolNone;
       
   581         }
       
   582     else if (isDisablePlainTextAuth)  //If Disable, CHAP will be used.
       
   583         {
       
   584         if (aPco.iAuthInfo.iPassword.Length() == 0)
       
   585             {
       
   586             User::Leave(KErrArgument);      //CHAP without password?
       
   587             }
       
   588         else
       
   589             {
       
   590             aPco.iAuthInfo.iProtocol = RPacketContext::EProtocolCHAP;
       
   591             CreateChallengeAndResponseForChapL(aPco);
       
   592             }
       
   593         }
       
   594     else
       
   595         {
       
   596         aPco.iAuthInfo.iProtocol = RPacketContext::EProtocolPAP;
       
   597         }
       
   598 
       
   599     CleanupStack::PopAndDestroy();          // CloseIapView();
       
   600     }
       
   601 
       
   602 void TCreatePrimaryPDPCtx::CreateChallengeAndResponseForChapL(RPacketContext::TProtocolConfigOptionV2& aProtocolConfigOption)
       
   603 /*
       
   604  * This function basically sets the CHAP protocol authentication such as (challenge) and (response) 
       
   605  */
       
   606     {
       
   607     //Challenge
       
   608     TTime currentTime;
       
   609     currentTime.UniversalTime();
       
   610     
       
   611     TInt64 seedValue = currentTime.Int64();
       
   612 
       
   613     TUint8 challenge[KGenericNifChallengeSize] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
       
   614     
       
   615     TUint8 i=0;
       
   616     while(i < KGenericNifChallengeSize)
       
   617         {
       
   618         challenge[i] = (TUint8)(Math::Rand(seedValue)%256);
       
   619         aProtocolConfigOption.iChallenge.Append(challenge[i++]);
       
   620         }
       
   621 
       
   622     //Response
       
   623     TBuf8<KGenericNifIdLength+KCommsDbSvrMaxColumnNameLength+KGenericNifChallengeSize> message;
       
   624     message.Append(aProtocolConfigOption.iId);
       
   625     message.Append(aProtocolConfigOption.iAuthInfo.iPassword);
       
   626     message.Append(aProtocolConfigOption.iChallenge);
       
   627     
       
   628     TInt length = 1 /*iId length */ + aProtocolConfigOption.iAuthInfo.iPassword.Length() + KGenericNifChallengeSize;
       
   629 
       
   630     HBufC8* buf = HBufC8::NewL(length);
       
   631     
       
   632     CleanupStack::PushL(buf);
       
   633      
       
   634     TPtr8 ptr((TUint8*)buf->Des().Ptr(),length);
       
   635     
       
   636     ptr.Copy(message);
       
   637     
       
   638     CMD5* md5=0;
       
   639     md5 = CMD5::NewL();
       
   640     
       
   641     CleanupStack::PushL(md5);
       
   642     
       
   643     TPtrC8 Response = md5->Hash(ptr);
       
   644     
       
   645     aProtocolConfigOption.iResponse.Copy(Response);
       
   646     
       
   647     CleanupStack::PopAndDestroy(2);		//buf, md5
       
   648     }
       
   649 
   539 void TCreatePrimaryPDPCtx::DoL()
   650 void TCreatePrimaryPDPCtx::DoL()
   540     {
   651     {
   541     // if the provisionconfig failed, there is no way to inform the CPR of the failure
   652     // if the provisionconfig failed, there is no way to inform the CPR of the failure
   542     // as the framework doesn't expect a response from provisionconfig, so error here
   653     // as the framework doesn't expect a response from provisionconfig, so error here
   543     // if there was a problem so that the appropriate clean up can happen.
   654     // if there was a problem so that the appropriate clean up can happen.
   591     	}
   702     	}
   592 
   703 
   593 	const CImsExtProvision* imsprov = static_cast<const CImsExtProvision*>(
   704 	const CImsExtProvision* imsprov = static_cast<const CImsExtProvision*>(
   594 		iContext.Node().AccessPointConfig().FindExtension(STypeId::CreateSTypeId(CImsExtProvision::EUid, CImsExtProvision::ETypeId)));
   705 		iContext.Node().AccessPointConfig().FindExtension(STypeId::CreateSTypeId(CImsExtProvision::EUid, CImsExtProvision::ETypeId)));
   595 
   706 
       
   707 	TRAP_IGNORE(iContext.Node().iIsModeGsm = IsModeGsmL());
   596 
   708 
   597 	switch (gprsProvision->UmtsGprsRelease())
   709 	switch (gprsProvision->UmtsGprsRelease())
   598 			{
   710 			{
   599 	    	case TPacketDataConfigBase::KConfigGPRS:
   711 	    	case TPacketDataConfigBase::KConfigGPRS:
   600 				{
   712 				{
   601 				SetImsSignallingFlagL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigGPRS>().iProtocolConfigOption, imsprov->iImsSignalIndicator);
   713 				SetImsSignallingFlagL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigGPRS>().iProtocolConfigOption, imsprov->iImsSignalIndicator);
       
   714 
       
   715 				// Only request SIP server address retrieval when network not in GSM/GPRS mode
       
   716 			    // e.g. UMTS/WCDMA
       
   717 				if (!iContext.Node().iIsModeGsm)
       
   718 				    {
       
   719 				    SetupSipServerAddrRetrievalL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigGPRS>().iProtocolConfigOption);
       
   720 				    }
       
   721 				
       
   722 				SetChapInformationL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigGPRS>().iProtocolConfigOption);
       
   723 
   602 				}
   724 				}
   603 				break;
   725 				break;
       
   726 
   604 	    	case TPacketDataConfigBase::KConfigRel5:
   727 	    	case TPacketDataConfigBase::KConfigRel5:
   605 		    case TPacketDataConfigBase::KConfigRel99Rel4:
   728 		    case TPacketDataConfigBase::KConfigRel99Rel4:
   606 				{
   729 				{
   607 				SetImsSignallingFlagL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigR99_R4>().iProtocolConfigOption, imsprov->iImsSignalIndicator);
   730 				SetImsSignallingFlagL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigR99_R4>().iProtocolConfigOption, imsprov->iImsSignalIndicator);
       
   731 
       
   732 			    // Only request SIP server address retrieval when network not in GSM/GPRS mode
       
   733 			    // e.g. UMTS/WCDMA
       
   734 				if (!iContext.Node().iIsModeGsm)
       
   735                     {
       
   736                     SetupSipServerAddrRetrievalL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigR99_R4>().iProtocolConfigOption);
       
   737                     }
       
   738 				
       
   739 				SetChapInformationL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigR99_R4>().iProtocolConfigOption);
       
   740 				
   608 				}
   741 				}
   609 				break;
   742 				break;				
   610 			}
   743 			}
   611 
       
   612 	TRAP_IGNORE(iContext.Node().iIsModeGsm = IsModeGsmL());
       
   613 
       
   614 	// Only request SIP server address retrieval when network not in GSM/GPRS mode
       
   615 	// e.g. UMTS/WCDMA
       
   616 	if (!iContext.Node().iIsModeGsm)
       
   617 		{
       
   618 		switch (gprsProvision->UmtsGprsRelease())
       
   619 			{
       
   620 	    	case TPacketDataConfigBase::KConfigGPRS:
       
   621 				{
       
   622 				SetupSipServerAddrRetrievalL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigGPRS>().iProtocolConfigOption);
       
   623 				}
       
   624 				break;
       
   625 	    	case TPacketDataConfigBase::KConfigRel5:
       
   626 		    case TPacketDataConfigBase::KConfigRel99Rel4:
       
   627 				{
       
   628 				SetupSipServerAddrRetrievalL(gprsProvision->GetScratchContextAs<RPacketContext::TContextConfigR99_R4>().iProtocolConfigOption);
       
   629 				}
       
   630 				break;
       
   631 			}
       
   632 		}
       
   633 	
   744 	
   634 	iContext.Node().iPDPFsmContextId = iContext.Node().iPdpFsmInterface->NewFsmContextL(iContext.Node(),SpudMan::EPrimary);
   745 	iContext.Node().iPDPFsmContextId = iContext.Node().iPdpFsmInterface->NewFsmContextL(iContext.Node(),SpudMan::EPrimary);
   635 
   746 
   636     iContext.Node().PostToClients<TDefaultClientMatchPolicy>(
   747     iContext.Node().PostToClients<TDefaultClientMatchPolicy>(
   637             iContext.NodeId(),
   748             iContext.NodeId(),
   704     }
   815     }
   705 
   816 
   706 DEFINE_SMELEMENT(TSendErrorRecoveryRequest, NetStateMachine::MStateTransition, PDPSCprStates::TContext)
   817 DEFINE_SMELEMENT(TSendErrorRecoveryRequest, NetStateMachine::MStateTransition, PDPSCprStates::TContext)
   707 void TSendErrorRecoveryRequest::DoL()
   818 void TSendErrorRecoveryRequest::DoL()
   708 	{
   819 	{
   709 	TPDPFSMMessages::TPDPFSMMessage* msg = message_cast<TPDPFSMMessages::TPDPFSMMessage>(&iContext.iMessage);
   820 	TPDPMessages::TPDPFSMMessage* msg = message_cast<TPDPMessages::TPDPFSMMessage>(&iContext.iMessage);
   710 
   821 
   711 	__ASSERT_DEBUG(msg, User::Panic(KPdpSCprPanic,  CorePanics::KPanicIncorrectMessage));
   822 	__ASSERT_DEBUG(msg, User::Panic(KPdpSCprPanic,  CorePanics::KPanicIncorrectMessage));
   712 	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KPdpSCprPanic, CorePanics::KPanicNoActivity));
   823 	__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KPdpSCprPanic, CorePanics::KPanicNoActivity));
   713 
   824 
   714 	const RNodeInterface* controlProvider = iContext.Node().ControlProvider();
   825 	const RNodeInterface* controlProvider = iContext.Node().ControlProvider();
   771         User::LeaveIfError(iContext.Node().iPdpFsmInterface->Input(iContext.Node().iPDPFsmContextId, SpudMan::EContextModifyActive));
   882         User::LeaveIfError(iContext.Node().iPdpFsmInterface->Input(iContext.Node().iPDPFsmContextId, SpudMan::EContextModifyActive));
   772    	    }
   883    	    }
   773    	else
   884    	else
   774    	    {
   885    	    {
   775         RClientInterface::OpenPostMessageClose(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.NodeId(),
   886         RClientInterface::OpenPostMessageClose(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.NodeId(),
   776             TPDPFSMMessages::TPDPFSMMessage(KContextModifyActiveEvent, KErrNone).CRef());
   887                 TPDPMessages::TPDPFSMMessage(KContextModifyActiveEvent, KErrNone).CRef());
   777    	    }
   888    	    }
   778 
   889 
   779     //Expect Response
   890     //Expect Response
   780     iContext.iNodeActivity->ClearPostedTo();
   891     iContext.iNodeActivity->ClearPostedTo();
   781     iContext.Node().iActivityAwaitingResponse = iContext.iNodeActivity->ActivityId();
   892     iContext.Node().iActivityAwaitingResponse = iContext.iNodeActivity->ActivityId();
   801     	{
   912     	{
   802     	//just move to next step
   913     	//just move to next step
   803     	RClientInterface::OpenPostMessageClose(
   914     	RClientInterface::OpenPostMessageClose(
   804     			TNodeCtxId(iContext.ActivityId(), iContext.NodeId()),
   915     			TNodeCtxId(iContext.ActivityId(), iContext.NodeId()),
   805     			iContext.NodeId(),
   916     			iContext.NodeId(),
   806     			TPDPFSMMessages::TPDPFSMMessage(KGetNegQoSEvent, KErrNone).CRef()
   917     			TPDPMessages::TPDPFSMMessage(KGetNegQoSEvent, KErrNone).CRef()
   807     			);
   918     			);
   808     	}
   919     	}
   809     else
   920     else
   810     	{
   921     	{
   811     	ASSERT(iContext.Node().iPdpFsmInterface);
   922     	ASSERT(iContext.Node().iPdpFsmInterface);
   853         }
   964         }
   854     else
   965     else
   855         {
   966         {
   856         //No QoS Requested. Complete this message locally to push yourself forward
   967         //No QoS Requested. Complete this message locally to push yourself forward
   857         RClientInterface::OpenPostMessageClose(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.NodeId(),
   968         RClientInterface::OpenPostMessageClose(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.NodeId(),
   858         	TPDPFSMMessages::TPDPFSMMessage(KContextQoSSetEvent, KErrNone).CRef());
   969                 TPDPMessages::TPDPFSMMessage(KContextQoSSetEvent, KErrNone).CRef());
   859         }
   970         }
   860 
   971 
   861     //Expect Response
   972     //Expect Response
   862     iContext.iNodeActivity->ClearPostedTo();
   973     iContext.iNodeActivity->ClearPostedTo();
   863     iContext.Node().iActivityAwaitingResponse = iContext.iNodeActivity->ActivityId();
   974     iContext.Node().iActivityAwaitingResponse = iContext.iNodeActivity->ActivityId();
   894         }
  1005         }
   895     else
  1006     else
   896         {
  1007         {
   897         //No QoS Requested. Complete this message locally to push yourself forward
  1008         //No QoS Requested. Complete this message locally to push yourself forward
   898         RClientInterface::OpenPostMessageClose(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.NodeId(),
  1009         RClientInterface::OpenPostMessageClose(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.NodeId(),
   899         	TPDPFSMMessages::TPDPFSMMessage(KContextTFTModifiedEvent, KErrNone).CRef());
  1010                 TPDPMessages::TPDPFSMMessage(KContextTFTModifiedEvent, KErrNone).CRef());
   900         }
  1011         }
   901 
  1012 
   902     //Expect Response
  1013     //Expect Response
   903     iContext.iNodeActivity->ClearPostedTo();
  1014     iContext.iNodeActivity->ClearPostedTo();
   904     iContext.Node().iActivityAwaitingResponse = iContext.iNodeActivity->ActivityId();
  1015     iContext.Node().iActivityAwaitingResponse = iContext.iNodeActivity->ActivityId();
   946 //Events
  1057 //Events
   947 //-=========================================================
  1058 //-=========================================================
   948 DEFINE_SMELEMENT(TBlockedOrUnblocked, NetStateMachine::MStateFork, PDPSCprStates::TContext)
  1059 DEFINE_SMELEMENT(TBlockedOrUnblocked, NetStateMachine::MStateFork, PDPSCprStates::TContext)
   949 TInt TBlockedOrUnblocked::TransitionTag()
  1060 TInt TBlockedOrUnblocked::TransitionTag()
   950 	{
  1061 	{
   951 	TPDPFSMMessages::TPDPFSMMessage& pdpmsg = message_cast<TPDPFSMMessages::TPDPFSMMessage>(iContext.iMessage);
  1062 	TPDPMessages::TPDPFSMMessage& pdpmsg = message_cast<TPDPMessages::TPDPFSMMessage>(iContext.iMessage);
   952 	if (pdpmsg.iValue1 == KContextBlockedEvent)
  1063 	if (pdpmsg.iValue1 == KContextBlockedEvent)
   953 		return KBlocked;
  1064 		return KBlocked;
   954 	else
  1065 	else
   955 		return KUnblocked;
  1066 		return KUnblocked;
   956 	}
  1067 	}
   970     }
  1081     }
   971 
  1082 
   972 DEFINE_SMELEMENT(TForwardContextBlockedOrUnblockedToDC, NetStateMachine::MStateTransition, PDPSCprStates::TContext)
  1083 DEFINE_SMELEMENT(TForwardContextBlockedOrUnblockedToDC, NetStateMachine::MStateTransition, PDPSCprStates::TContext)
   973 void TForwardContextBlockedOrUnblockedToDC::DoL()
  1084 void TForwardContextBlockedOrUnblockedToDC::DoL()
   974     {
  1085     {
   975     TPDPFSMMessages::TPDPFSMMessage& pdpmsg = message_cast<TPDPFSMMessages::TPDPFSMMessage>(iContext.iMessage);
  1086     TPDPMessages::TPDPFSMMessage& pdpmsg = message_cast<TPDPMessages::TPDPFSMMessage>(iContext.iMessage);
   976 
  1087 
   977 	RNodeInterface* theOnlyDataClient = iContext.iNode.GetFirstClient<TDefaultClientMatchPolicy>(TCFClientType::EData);
  1088 	RNodeInterface* theOnlyDataClient = iContext.iNode.GetFirstClient<TDefaultClientMatchPolicy>(TCFClientType::EData);
   978 	ASSERT(iContext.iNode.GetClientIter<TDefaultClientMatchPolicy>(TCFClientType::EData)[1] == NULL);
  1089 	ASSERT(iContext.iNode.GetClientIter<TDefaultClientMatchPolicy>(TCFClientType::EData)[1] == NULL);
   979     ASSERT(theOnlyDataClient);
  1090     ASSERT(theOnlyDataClient);
   980 
  1091 
  1215     CSubConGenEventParamsRejected* event= CSubConGenEventParamsRejected::NewL();
  1326     CSubConGenEventParamsRejected* event= CSubConGenEventParamsRejected::NewL();
  1216     CleanupStack::PushL(event);
  1327     CleanupStack::PushL(event);
  1217 
  1328 
  1218 	if (iContext.Node().iContextType == SpudMan::EMbms)
  1329 	if (iContext.Node().iContextType == SpudMan::EMbms)
  1219 		{
  1330 		{
  1220 		TPDPFSMMessages::TPDPFSMMessage& message = message_cast<TPDPFSMMessages::TPDPFSMMessage>(iContext.iMessage);
  1331 		TPDPMessages::TPDPFSMMessage& message = message_cast<TPDPMessages::TPDPFSMMessage>(iContext.iMessage);
  1221 		TInt prevOperationValue = message.iValue2;
  1332 		TInt prevOperationValue = message.iValue2;
  1222 		if ((prevOperationValue == KErrNotFound) || (prevOperationValue == KErrNotSupported ) ||
  1333 		if ((prevOperationValue == KErrNotFound) || (prevOperationValue == KErrNotSupported ) ||
  1223 			 (prevOperationValue == KErrMbmsImpreciseServiceEntries ) ||(prevOperationValue == KErrMbmsServicePreempted) )
  1334 			 (prevOperationValue == KErrMbmsImpreciseServiceEntries ) ||(prevOperationValue == KErrMbmsServicePreempted) )
  1224 			{
  1335 			{
  1225     		event->SetFamilyId (KSubConChannelParamsType);
  1336     		event->SetFamilyId (KSubConChannelParamsType);
  1239 	}
  1350 	}
  1240 
  1351 
  1241 DEFINE_SMELEMENT(TRaiseParamsChanged, NetStateMachine::MStateTransition, PDPSCprStates::TContext)
  1352 DEFINE_SMELEMENT(TRaiseParamsChanged, NetStateMachine::MStateTransition, PDPSCprStates::TContext)
  1242 void TRaiseParamsChanged::DoL()
  1353 void TRaiseParamsChanged::DoL()
  1243     {
  1354     {
  1244     TPDPFSMMessages::TPDPFSMMessage& message = message_cast<TPDPFSMMessages::TPDPFSMMessage>(iContext.iMessage);
  1355     TPDPMessages::TPDPFSMMessage& message = message_cast<TPDPMessages::TPDPFSMMessage>(iContext.iMessage);
  1245 	TInt err=KErrNone;
  1356 	TInt err=KErrNone;
  1246     ASSERT(message.iValue2 == KErrNone);
  1357     ASSERT(message.iValue2 == KErrNone);
  1247     CSubConGenEventParamsChanged* event = NULL;
  1358     CSubConGenEventParamsChanged* event = NULL;
  1248     TRAP_IGNORE(event = CSubConGenEventParamsChanged::NewL());
  1359     TRAP_IGNORE(event = CSubConGenEventParamsChanged::NewL());
  1249     if (event)
  1360     if (event)
  1707         {
  1818         {
  1708         RClientInterface::OpenPostMessageClose(TNodeCtxId(ECFActivityStart, iContext.NodeId()), iContext.NodeId(), TEBase::TCancel().CRef());
  1819         RClientInterface::OpenPostMessageClose(TNodeCtxId(ECFActivityStart, iContext.NodeId()), iContext.NodeId(), TEBase::TCancel().CRef());
  1709         }
  1820         }
  1710     }
  1821     }
  1711 
  1822 
       
  1823 //===========================================================
       
  1824 //   User Authentication
       
  1825 //===========================================================
       
  1826 
       
  1827 DEFINE_SMELEMENT(TSendAuthenticate, NetStateMachine::MStateTransition, PDPSCprStates::TDefContext)
       
  1828 void TSendAuthenticate::DoL()
       
  1829     {
       
  1830     iContext.Node().AuthenticateL();
       
  1831     }
       
  1832 
       
  1833 DEFINE_SMELEMENT(TAwaitingAuthenticateComplete, NetStateMachine::MState, PDPSCprStates::TDefContext)
       
  1834 TBool TAwaitingAuthenticateComplete::Accept()
       
  1835     {
       
  1836     if (iContext.iMessage.IsMessage<TPDPMessages::TAuthenticateComplete>())
       
  1837         {
       
  1838         TPDPMessages::TAuthenticateComplete& msg = message_cast<TPDPMessages::TAuthenticateComplete>(iContext.iMessage);
       
  1839         if (msg.iValue != KErrNone)
       
  1840             {
       
  1841             iContext.iNodeActivity->SetError(msg.iValue);
       
  1842             }
       
  1843         return ETrue;
       
  1844         }
       
  1845     return EFalse;
       
  1846     }
       
  1847 
  1712 } //namespace end
  1848 } //namespace end