Implemented CTelObject::SetSessionOwnerByTsyHandleAndIpc() and CPhoneBase::FindByIpcAndSecureId() opencode
authorivan.fildichev@opencode.com
Tue, 19 Oct 2010 18:11:09 +0300
branchopencode
changeset 81 7f379d8ed02d
parent 78 d4cfc65049ba
child 85 96b4f933d69a
Implemented CTelObject::SetSessionOwnerByTsyHandleAndIpc() and CPhoneBase::FindByIpcAndSecureId()
telephonyserver/etelserverandcore/INC/ET_PHONE.H
telephonyserver/etelserverandcore/SETEL/ET_CORE.CPP
telephonyserver/etelserverandcore/SETEL/ET_PHONE.CPP
telephonyserver/etelserverandcore/bwins/ETELU.DEF
telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmussdtsy.cpp
--- a/telephonyserver/etelserverandcore/INC/ET_PHONE.H	Fri Oct 15 11:27:58 2010 +0300
+++ b/telephonyserver/etelserverandcore/INC/ET_PHONE.H	Tue Oct 19 18:11:09 2010 +0300
@@ -180,7 +180,8 @@
 	IMPORT_C virtual TInt ServerVersion() const;
 	IMPORT_C virtual TSecurityPolicy GetRequiredPlatSecCaps(const TInt aIpc);
 
-    IMPORT_C void SetSessionOwnerByTsyHandle(const TTsyReqHandle aTsyReqHandle);
+	IMPORT_C void SetSessionOwnerByTsyHandle(const TTsyReqHandle aTsyReqHandle);	
+    IMPORT_C void SetSessionOwnerByTsyHandleAndIpc(const TTsyReqHandle aTsyReqHandle, TInt aIpc);
     IMPORT_C TInt ReserveSession();
     IMPORT_C TBool IsSessionReserved() const;
     IMPORT_C void CancelReserveSession();
@@ -470,6 +471,7 @@
 	CReqEntry* FindClientInActive(CTelSession* aSession,const TInt aSubSessionHandle,const TInt aIpc);
 	CReqEntry* FindByIpcAndTelObject(const TInt aIpc, const CTelObject* aTelObject, const TUint aBufSize);
 	CReqEntry* FindByIpcAndTelObjectInWaiting(const TInt aIpc, const CTelObject* aTelObject, const TUint aBufSize);
+	CReqEntry* FindByIpcAndSecureId(const TInt aIpc, const TSecureId aSid);
 	void AddReqToActive(CReqEntry* aReqEntry);
 	void AddReqToWaiting(CReqEntry* aReqEntry);
 
--- a/telephonyserver/etelserverandcore/SETEL/ET_CORE.CPP	Fri Oct 15 11:27:58 2010 +0300
+++ b/telephonyserver/etelserverandcore/SETEL/ET_CORE.CPP	Tue Oct 19 18:11:09 2010 +0300
@@ -1054,6 +1054,21 @@
 	return NULL;
 	}
 
+CReqEntry* CPhoneBase::FindByIpcAndSecureId(const TInt aIpc, const TSecureId aSid)
+//
+//	Finds an active request by both IPC and by the TSecureId it was placed on
+//
+	{
+	CReqEntry* reqEntry;
+	TDblQueIter<CReqEntry> iter(iReqActiveList);
+	while(reqEntry = iter++, reqEntry!=NULL)
+		{
+		if(reqEntry->iFunction==aIpc && reqEntry->iMessage.SecureId()==aSid
+			&& EFalse != reqEntry->iPlacedRequest)	
+			return reqEntry;
+		}
+	return NULL;
+	}
 CReqEntry* CPhoneBase::FindByIpcAndTelObjectInWaiting(const TInt aIpc, const CTelObject* aTelObject, const TUint aBufSize)
 //
 //	Finds a waiting request by both IPC and by the TelObject it was placed on
--- a/telephonyserver/etelserverandcore/SETEL/ET_PHONE.CPP	Fri Oct 15 11:27:58 2010 +0300
+++ b/telephonyserver/etelserverandcore/SETEL/ET_PHONE.CPP	Tue Oct 19 18:11:09 2010 +0300
@@ -1392,28 +1392,42 @@
     }
 
 // Can be used by the TSY to set the session owner to the current request.
+// For each request the CTSY is given a TsyReqHandle and and IPC so this is a sensible thing
+// for it to be dealing with.
+// Note that once a session has an owner the reserved state is irrelevant.
+EXPORT_C void CTelObject::SetSessionOwnerByTsyHandleAndIpc(const TTsyReqHandle aTsyReqHandle, TInt aIpc)
+    {
+	
+    TInt owningsession = PhoneOwner()->FindSessionByTsyHandle( aTsyReqHandle );
+    TInt owningsubsession = PhoneOwner()->FindSubSessionByTsyHandle( aTsyReqHandle );
+    
+        
+    if((NULL != aIpc) && 
+    (iDeliveryObject->GetReqMode() == (KReqModeSessionBased | KReqModeTransferToDefaultHandler)))
+    // transfer to default handler
+    	{
+    	CReqEntry* reqEntry = PhoneOwner()->FindByIpcAndSecureId(aIpc, KUssdDefaultClientSid);
+    	if(NULL != reqEntry)
+    		{
+    		owningsession = reinterpret_cast<TInt>(reqEntry->iSession);
+    		owningsubsession = reqEntry->iMessage.Int3();    		
+    		}
+    	}
+    iDeliveryObject->iSessionOwner = TPhoneClientId(owningsession, owningsubsession);
+    }
+
+// Can be used by the TSY to set the session owner to the current request.
 // For each request the CTSY is given a TsyReqHandle so this is a sensible thing
 // for it to be dealing with.
 // Note that once a session has an owner the reserved state is irrelevant.
-
 EXPORT_C void CTelObject::SetSessionOwnerByTsyHandle(const TTsyReqHandle aTsyReqHandle)
     {
 	
     const TInt owningsession = PhoneOwner()->FindSessionByTsyHandle( aTsyReqHandle );
     const TInt owningsubsession = PhoneOwner()->FindSubSessionByTsyHandle( aTsyReqHandle );
-    
-        
-    if(iDeliveryObject->GetReqMode() == (KReqModeSessionBased | KReqModeTransferToDefaultHandler)) // transfer to default handler
-    	{
-    	iDeliveryObject->iSessionOwner = TPhoneClientId(KUssdDefaultClientSid, owningsubsession);
-    	}
-    else //not default handler
-    	{
-    	iDeliveryObject->iSessionOwner = TPhoneClientId(owningsession, owningsubsession);
-    	}
+    iDeliveryObject->iSessionOwner = TPhoneClientId(owningsession, owningsubsession);
     }
 
-
 TBool CTelObject::IsSessionOwner(CReqEntry* aReqEntry) const
     {
     TPhoneClientId clientId(reinterpret_cast<TInt>(aReqEntry->iSession),aReqEntry->iMessage.Int3());
--- a/telephonyserver/etelserverandcore/bwins/ETELU.DEF	Fri Oct 15 11:27:58 2010 +0300
+++ b/telephonyserver/etelserverandcore/bwins/ETELU.DEF	Tue Oct 19 18:11:09 2010 +0300
@@ -264,4 +264,7 @@
 	?SetSessionOwnerByTsyHandle@CTelObject@@QAEXK@Z @ 263 NONAME ; void CTelObject::SetSessionOwnerByTsyHandle(unsigned long)
 	?EndSession@CTelObject@@QAEXXZ @ 264 NONAME ; void CTelObject::EndSession(void)
 	?IsSessionInProgress@CTelObject@@QBEHXZ @ 265 NONAME ; int CTelObject::IsSessionInProgress(void) const
+	?FindSessionByTsyHandle@CPhoneBase@@QAEHK@Z @ 266 NONAME ; int CPhoneBase::FindSessionByTsyHandle(unsigned long)
+	?FindSubSessionByTsyHandle@CPhoneBase@@QAEHK@Z @ 267 NONAME ; int CPhoneBase::FindSubSessionByTsyHandle(unsigned long)
+	?SetSessionOwnerByTsyHandleAndIpc@CTelObject@@QAEXKH@Z @ 268 NONAME ; void CTelObject::SetSessionOwnerByTsyHandleAndIpc(unsigned long, int)
 
--- a/telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmussdtsy.cpp	Fri Oct 15 11:27:58 2010 +0300
+++ b/telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmussdtsy.cpp	Tue Oct 19 18:11:09 2010 +0300
@@ -771,7 +771,14 @@
             {
             if ( KErrNone == aError )
                 {
-                SetSessionOwnerByTsyHandle( reqHandle );
+            	if(EFalse == iSendToDefaultHandler)
+            		{
+            		SetSessionOwnerByTsyHandle( reqHandle );
+            		}
+            	else // default handler
+            		{            		
+            		SetSessionOwnerByTsyHandleAndIpc( reqHandle, EMultimodeUssdSendMessageDefaultHandler );
+            		}
                 }
             else
                 {