diff -r 6295dc2169f3 -r 8486d82aef45 connectivitylayer/isce/isicommunicationmanager_dll/src/isicommunicationmanager.cpp --- a/connectivitylayer/isce/isicommunicationmanager_dll/src/isicommunicationmanager.cpp Wed Apr 21 14:29:55 2010 +0300 +++ b/connectivitylayer/isce/isicommunicationmanager_dll/src/isicommunicationmanager.cpp Tue Oct 19 13:16:20 2010 +0300 @@ -17,28 +17,28 @@ #include // For Kern +#include // For ISI_HEADER_SIZE +#include // For PN_OBJ_ROUTING_REQ... +#include // For Common messages +#include // PN_COMMG, PNS_SUBSCRIBED_RESOURCES_... #include "isicommunicationmanager.h" // For DISICommunicationManager #include "misiobjectrouterif.h" // For MISIObjectRouterIf #include "isicommunicationmanagertrace.h" // For C_TRACE, ASSERT_RESET.. and fault codes #include "memapi.h" // For MemApi -#include // For ISI_HEADER_SIZE -#include // For PN_OBJ_ROUTING_REQ... -#include "nsisi.h" // For PN_NAMESERVICE -#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE + +// HOX! nsisi.h is this also exported by isimsg +#include "nsisi.h" // For PN_NAMESERVICE.. + #include "isihelpers.h" // For SET_RECEIVER_OBJ... + #include "isirouter.h" // For GetDFCThread -#else -//#include "misiobjectrouterif.h" // For MISIObjectRouterIf -#include "isaaccessextension.h" // For DIsaAccessExtension -#include "iadhelpers.h" // For SET_RECEIVER_OBJ... -#endif -#include // For THIS_DEVICE #include "isiindicationhandler.h" // For DISIIndicationHandler #include "ape_commgrisi.h" // For APE_COMMGR.. #include "misicommunicationmanagerif.h" // For MISICommunicationManagerIf -#include // For Common messages + +//#define ISCE_NO_NEED_TO_VALIDATE_RESOURCE // to skip resource validity check // Faults enum TISICommunicationManagerFaults @@ -46,66 +46,51 @@ EISICommunicationManagerMemAllocFailure = 0x01, EISICommunicationManagerMemAllocFailure1, EISICommunicationManagerNullPointer, + EISICommunicationManagerNullPointer1, + EISICommunicationManagerNullPointer2, + EISICommunicationManagerNullPointer3, + EISICommunicationManagerNullPointer4, + EISICommunicationManagerNullPointer5, + EISICommunicationManagerNullPointer6, + EISICommunicationManagerNullPointer7, + EISICommunicationManagerNullPointer8, + EISICommunicationManagerNullPointer9, + EISICommunicationManagerNullPointer10, + EISICommunicationManagerNullPointer11, + EISICommunicationManagerNullPointer12, + EISICommunicationManagerNullPointer13, + EISICommunicationManagerNullPointer14, + EISICommunicationManagerNullPointer15, + EISICommunicationManagerNullPointer16, EISICommunicationManagerUnknownMessage, EISICommunicationManagerMutexCreateFailed, EISICommunicationManagerMutexWaitFailed, EISICommunicationManagerWrongMessageOrder, + EISICommunicationManagerWrongMessageOrder2, + EISICommunicationManagerWrongMessage, + EISICommunicationManagerFatalError, + EISICommunicationInvalidLength, + EISICommunicationInvalidLength1, + EISICommunicationInvalidLength2, + EISICommunicationInvalidLength3, + EISICommunicationInvalidLength4, + EISICommunicationInvalidLength5, + EISICommunicationInvalidLength6, + EISICommunicationInvalidLength7, + EISICommunicationInvalidLength8, + EISICommunicationInvalidLength9, + EISICommunicationInvalidLength10, + EISICommunicationInvalidLength11, + EISICommunicationInvalidLength12, + EISICommunicationInvalidLength13, + EISICommunicationInvalidLength14, + EISICommunicationManagerSendFailed, + EISICommunicationManagerSendFailed1, + EISICommunicationManagerSendFailed2, + EISICommunicationManagerSendFailed3, + EISICommunicationManagerSendFailed4, }; - -/* PUTB8 macro writes byte value to given address. - * This macro is used mainly by other PUTBXX macros. - */ -#define PUTB8(p,v) \ - {(*(TUint8 *)(p)) = ((TUint8)(v));} - - -/* PUTB16 macro writes 16-bit value in Big Endian format - * to given address. 16-bit value is written as two separate - * bytes, and so this macro can write 16-bit value to whatever - * address, regardless of the processor alignment restrictions - */ -#define PUTB16(p,v) \ - {PUTB8((p),(TUint16)(v)>>8); PUTB8((TUint8*)(p)+1,v);} - - -/* PUTB32 macro writes 32-bit value in Big Endian format - * to given address. 32-bit value is written as four separate - * bytes, and so this macro can write 32-bit value to whatever - * address, regardless of the processor alignment restrictions - */ -#define PUTB32(p,v) \ - {PUTB16((p),(TUint32)(v)>>16); PUTB16((TUint8*)(p)+2,(TUint32)(v));} - - -/** - * Big Endian to local endian type - */ - /* GETB8 macro returns byte value from given address. - * This macro is used mainly by other GETBXX macros. - */ -#define GETB8(p) \ - (*(TUint8 *)(p)) - - -/* GETB16 macro reads 16-bit value in Big Endian format - * from given address. 16-bit value is read as two separate - * bytes, and so this macro can read 16-bit value from whatever - * address, regardless of the processor alignment restrictions - */ -#define GETB16(p) \ - (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1)) - - -/* GETB32 macro reads 32-bit value in Big Endian format - * from given address. 32-bit value is read as four separate - * bytes, and so this macro can read 32-bit value from whatever - * address, regardless of the processor alignment restrictions - */ -#define GETB32(p) \ - (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2)) - - DMutex* DISICommunicationManager::iCommunicationManagerMutex = NULL; _LIT8( KCommunicationManagerMutex, "KCommunicationManagerMutex" ); @@ -113,29 +98,30 @@ const TUint8 KFiller( 0 ); const TInt KInitDfcPriority( 7 ); const TUint8 KDone( 0 ); +const TUint8 KDefaultTransactionIdentifier( 0x00 ); +const TUint8 KUnitializedObjectIdentifier( 0xff ); +const TUint8 KNumberOfBootMessage( 0x04 ); DISICommunicationManager::DISICommunicationManager( // None ) - : iObjId( 0x00 ), - iBootMsgCount( 0x04 ) // 2xRESP, 2xIND + : iObjectIdentifier( KUnitializedObjectIdentifier ), + iBootMsgCount( KNumberOfBootMessage ) { - C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x>" ), iObjId, iRouter ) ); - iRouter = MISIObjectRouterIf::Connect( KCommunicationManagerUID, iObjId, this ); + C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x>" ), iObjectIdentifier, iRouter ) ); + iRouter = MISIObjectRouterIf::GetIf(); ASSERT_RESET_ALWAYS( iRouter, ( EISICommunicationManagerNullPointer | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); - // Must be > KMutexOrdGeneral1 for nesting purposes because trx shared memory uses KMutexOrdGeneral1 - TInt err( Kern::MutexCreate( iCommunicationManagerMutex, KCommunicationManagerMutex, KMutexOrdGeneral2 ) ); + iRouter->Connect( KCommunicationManagerUID, iObjectIdentifier, this ); + ASSERT_RESET_ALWAYS( iObjectIdentifier == PN_OBJ_EVENT_MULTICAST, ( EISICommunicationManagerFatalError | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + // Ordinal three as there is zero, one and two used in other places of ISCE. + TInt err( Kern::MutexCreate( iCommunicationManagerMutex, KCommunicationManagerMutex, KMutexOrdGeneral3 ) ); ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexCreateFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); -#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE iInitDfc = new TDfc( InitDfc, this, iRouter->GetDfcThread( MISIObjectRouterIf::EISIKernelMainThread ), KInitDfcPriority ); -#else - iInitDfc = new TDfc( InitDfc, this, DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue ), KInitDfcPriority ); -#endif ASSERT_RESET_ALWAYS( iInitDfc, ( EISICommunicationManagerMemAllocFailure | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); iISIIndicationHandler = new DISIIndicationHandler( iRouter ); ASSERT_RESET_ALWAYS( iISIIndicationHandler, ( EISICommunicationManagerMemAllocFailure1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); iInitDfc->Enque(); - C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x<" ), iObjId, iRouter ) ); + C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x<" ), iObjectIdentifier, iRouter ) ); } void DISICommunicationManager::InitDfc( @@ -144,11 +130,14 @@ { C_TRACE( ( _T( "DISICommunicationManager::InitDfc 0x%x>" ), aPtr ) ); DISICommunicationManager* tmp = reinterpret_cast( aPtr ); + ASSERT_RESET_ALWAYS( tmp, ( EISICommunicationManagerNullPointer3 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); tmp->SendNameAddReqs(); - C_TRACE( ( _T( "DISICommunicationManager::InitDfc<" ) ) ); + C_TRACE( ( _T( "DISICommunicationManager::InitDfc 0x%x<" ), aPtr ) ); } -void DISICommunicationManager::SendNameAddReqs() +void DISICommunicationManager::SendNameAddReqs( + // None + ) { C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs>" ) ) ); //PN_COMMGR name @@ -156,31 +145,38 @@ TDes8& addMsg = MemApi::AllocBlock( msgLength ); addMsg.SetLength( msgLength ); TUint8* addPtr = const_cast( addMsg.Ptr() ); + ASSERT_RESET_ALWAYS( addPtr, ( EISICommunicationManagerNullPointer1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( addMsg.Length() > ( ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ) ), + ( EISICommunicationInvalidLength | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); addPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; SET_RECEIVER_DEV( addPtr, PN_DEV_OWN ); SET_SENDER_DEV( addPtr, PN_DEV_OWN ); addPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; SET_LENGTH( addPtr, ( msgLength - PN_HEADER_SIZE ) ); SET_RECEIVER_OBJ( addPtr, PN_OBJ_ROUTER ); - SET_SENDER_OBJ( addPtr, PN_OBJ_EVENT_MULTICAST ); - addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] = 0x00; + SET_SENDER_OBJ( addPtr, iObjectIdentifier ); + addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] = KDefaultTransactionIdentifier; addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_SUBFUNCTION ] = PNS_NAME_ADD_REQ; addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED1 ] = KFiller; addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED2 ] = KFiller; PUTB32( &addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_COMMGR ); addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ] = PN_DEV_OWN; - addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_OBJ ] = PN_OBJ_EVENT_MULTICAST; - addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = PN_NAME_UNDEF; + addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_OBJ ] = iObjectIdentifier; + addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = PN_NAME_NOCHG; addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller; //PN_APE_COMMGR name TDes8& addMsg2 = MemApi::AllocBlock( msgLength ); addMsg2.SetLength( msgLength ); addMsg2.Copy( addMsg ); TUint8* addPtr2 = const_cast( addMsg2.Ptr() ); + ASSERT_RESET_ALWAYS( addPtr2, ( EISICommunicationManagerNullPointer2 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( addMsg2.Length() > ( ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ) ), + ( EISICommunicationInvalidLength1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); PUTB32( &addPtr2[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_APE_COMMGR ); - //Register PN_APE_COMMGR and PN_COMMGR - iRouter->Send( addMsg, PN_OBJ_EVENT_MULTICAST ); - iRouter->Send( addMsg2, PN_OBJ_EVENT_MULTICAST ); + TInt sendResult = iRouter->Send( addMsg, iObjectIdentifier ); + ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed3 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + sendResult = iRouter->Send( addMsg2, iObjectIdentifier ); + ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed4 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs<" ) ) ); } @@ -195,176 +191,346 @@ delete iISIIndicationHandler; iISIIndicationHandler = NULL; } - iInitDfc->Cancel(); - delete iInitDfc; - iInitDfc = NULL; + if ( iInitDfc ) + { + iInitDfc->Cancel(); + delete iInitDfc; + iInitDfc = NULL; + } if( iCommunicationManagerMutex ) { ((DObject*)iCommunicationManagerMutex)->Close( NULL ); + iCommunicationManagerMutex = NULL; } - iCommunicationManagerMutex = NULL; + C_TRACE( ( _T( "DISICommunicationManager::~DISICommunicationManager<" ) ) ); } - -void DISICommunicationManager::Receive( const TDesC8& aMessage ) +void DISICommunicationManager::Receive( + const TDesC8& aMessage + ) { C_TRACE( ( _T( "DISICommunicationManager::Receive 0x%x>" ), &aMessage ) ); - TInt err( Kern::MutexWait( *iCommunicationManagerMutex ) ); + TInt err( Kern::MutexWait( *iCommunicationManagerMutex ) );//! check usage of these mutexes (be aware of ordering violations) ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexWaitFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); const TUint8* msgPtr( aMessage.Ptr() ); TDes8* blockPtr = reinterpret_cast( const_cast(&aMessage) ); if( iBootMsgCount == KDone ) { - if( msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) + switch( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] ) { - switch( msgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] ) + case PN_APE_COMMGR: { - case COMM_ISA_ENTITY_NOT_REACHABLE_RESP: - { - C_TRACE( ( _T( "DISICommunicationManager::Received not reachable resp" ) ) ); - break; - } - case COMM_ISI_VERSION_GET_REQ: - { - C_TRACE( ( _T( "DISICommunicationManager::Received version get req" ) ) ); - SendCommIsiVersionGetResp( *blockPtr ); - break; - } - default: - { - C_TRACE( ( _T( "DISICommunicationManager::Received unknown common message" ) ) ); - SendCommServiceNotIdentifiedResp( *blockPtr ); - break; - } + HandleApeCommunicationManagerMessage( *blockPtr ); + break; + } + case PN_COMMGR: + { + HandlePnCommgrMessage( *blockPtr ); + break; + } + default: + { + HandleMessageMulticast( *blockPtr ); + break; } } - else if( ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_APE_COMMGR ) - || ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_COMMGR ) ) + } + else + { + C_TRACE( ( _T( "DISICommunicationManager booting %d" ), iBootMsgCount ) ); + HandleBootMessage( *blockPtr ); + } + MemApi::DeallocBlock( *blockPtr ); + Kern::MutexSignal( *iCommunicationManagerMutex ); + C_TRACE( ( _T( "DISICommunicationManager::Receive 0x%x<" ), &aMessage ) ); + } + +void DISICommunicationManager::HandleBootMessage( + const TDesC8& aMessageDuringBoot + ) + { + C_TRACE( ( _T( "DISICommunicationManager::HandleBootMessage 0x%x>" ), &aMessageDuringBoot ) ); + const TUint8* messageDuringBootPtr = aMessageDuringBoot.Ptr(); + ASSERT_RESET_ALWAYS( messageDuringBootPtr, ( EISICommunicationManagerNullPointer7 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aMessageDuringBoot.Length() > ( ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ) ), + ( EISICommunicationInvalidLength5 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + if( messageDuringBootPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE ) + { + switch( messageDuringBootPtr[ ISI_HEADER_OFFSET_MESSAGEID ] ) { - C_TRACE( ( _T( "DISICommunicationManager::Receive subscription" ) ) ); - SendPnsSubscribeResp( *blockPtr ); - if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) + case PNS_NAME_ADD_IND : { - C_TRACE( ( _T( "DISICommunicationManager PNS_SUBSCRIBE_REQ from APE" ) ) ); - iISIIndicationHandler->Subscribe( *blockPtr ); + C_TRACE( ( _T( "DISICommunicationManager::HandleBootMessage PNS_NAME_ADD_IND" ) ) ); + iBootMsgCount--; + break; } - } - else - { - if( ( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] != PN_DEV_OWN ) - || ( MISICommunicationManagerIf::IsValidResource( *blockPtr ) ) ) + case PNS_NAME_ADD_RESP : { - C_TRACE( ( _T( "DISICommunicationManager::Receive indication" ) ) ); - iISIIndicationHandler->Multicast( *blockPtr ); + C_TRACE( ( _T( "DISICommunicationManager::HandleBootMessage PNS_NAME_ADD_RESP" ) ) ); + ASSERT_RESET_ALWAYS( ( messageDuringBootPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK ), ( EISICommunicationManagerWrongMessage | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + iBootMsgCount--; + break; } - else + default: { - C_TRACE( ( _T( "DISICommunicationManager not allowed resource from APE" ) ) ); + ASSERT_RESET_ALWAYS( 0, ( EISICommunicationManagerWrongMessageOrder2 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + break; } } } else { - C_TRACE( ( _T( "DISICommunicationManager not indication %d" ), iBootMsgCount ) ); - // From PN_NAMESERVICE && ( IND || successfull RESP ) - if( ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE ) - && ( msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ]== PNS_NAME_ADD_IND - || ( msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_SUBFUNCTION ]== PNS_NAME_ADD_RESP - && msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK ) ) ) - { - C_TRACE( ( _T( "DISICommunicationManager::Receive from NAMESERVICE message id 0x%x" ), msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ] ) ); - iBootMsgCount--; - } - else - { - ASSERT_RESET_ALWAYS( 0, ( EISICommunicationManagerWrongMessageOrder | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); - } + ASSERT_RESET_ALWAYS( 0, ( EISICommunicationManagerWrongMessageOrder | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); } - MemApi::DeallocBlock( *blockPtr ); - Kern::MutexSignal( *iCommunicationManagerMutex ); - C_TRACE( ( _T( "DISICommunicationManager::Receive<" ) ) ); + C_TRACE( ( _T( "DISICommunicationManager::HandleBootMessage 0x%x<" ), &aMessageDuringBoot ) ); } -void DISICommunicationManager::SendPnsSubscribeResp( const TDesC8& aMessage ) +void DISICommunicationManager::HandleApeCommunicationManagerMessage( + const TDesC8& aMessageToCommunicationManager + ) { - C_TRACE( ( _T( "DISICommunicationManager::SendPnsSubscribeResp 0x%x>" ), &aMessage ) ); - TUint16 msgLength( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_RESP ); - TDes8& respMsg = MemApi::AllocBlock( msgLength ); - respMsg.SetLength( msgLength ); - TUint8* msgPtr = const_cast( aMessage.Ptr() ); - TUint8* respPtr = const_cast( respMsg.Ptr() ); - respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ]; - SET_RECEIVER_DEV( respPtr, GET_SENDER_DEV( aMessage ) ); - SET_SENDER_DEV( respPtr, PN_DEV_OWN ); - respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR; - SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) ); - SET_RECEIVER_OBJ( respPtr, GET_SENDER_OBJ( aMessage ) ); - SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER ); - respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_TRANSID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ]; - respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_MESSAGEID ] = APE_COMMGR_SUBSCRIBE_RESP; - if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) + C_TRACE( ( _T( "DISICommunicationManager::HandleApeCommunicationManagerMessage 0x%x>" ), &aMessageToCommunicationManager ) ); + const TUint8* messagePtr = aMessageToCommunicationManager.Ptr(); + ASSERT_RESET_ALWAYS( messagePtr, ( EISICommunicationManagerNullPointer9 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aMessageToCommunicationManager.Length() > ( ISI_HEADER_OFFSET_MESSAGEID ) ), + ( EISICommunicationInvalidLength7 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + if( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) + { + HandleCommunicationManagerCommonMessage( aMessageToCommunicationManager ); + } + else { - respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] = APE_COMMGR_OK; + C_TRACE( ( _T( "DISICommunicationManager::HandleApeCommunicationManagerMessage subscription x%x" ), &aMessageToCommunicationManager ) ); + switch( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] ) + { + case APE_COMMGR_SUBSCRIBE_REQ: + { + SendApeCommgrSubscribeResp( aMessageToCommunicationManager ); + iISIIndicationHandler->Subscribe( aMessageToCommunicationManager ); + break; + } + default: + { + TRACE_ASSERT_ALWAYS; + SendCommServiceNotIdentifiedResp( aMessageToCommunicationManager ); + break; + } + } + } + C_TRACE( ( _T( "DISICommunicationManager::HandleApeCommunicationManagerMessage 0x%x<" ), &aMessageToCommunicationManager ) ); + } + +void DISICommunicationManager::HandlePnCommgrMessage( + const TDesC8& aMessageToCommunicationManager + ) + { + C_TRACE( ( _T( "DISICommunicationManager::HandleCellmoCommunicationManagerMessage 0x%x>" ), &aMessageToCommunicationManager ) ); + const TUint8* messagePtr = aMessageToCommunicationManager.Ptr(); + ASSERT_RESET_ALWAYS( messagePtr, ( EISICommunicationManagerNullPointer15 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aMessageToCommunicationManager.Length() > ( ISI_HEADER_OFFSET_MESSAGEID ) ), + ( EISICommunicationInvalidLength13 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + if( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) + { + HandleCommunicationManagerCommonMessage( aMessageToCommunicationManager ); } else { - respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] = APE_COMMGR_NOT_ALLOWED; - } - iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST ); - C_TRACE( ( _T( "DISICommunicationManager::SendPnsSubscribeResp<" ) ) ); + C_TRACE( ( _T( "DISICommunicationManager::HandleCellmoCommunicationManagerMessage subscription x%x" ), &aMessageToCommunicationManager ) ); + switch( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] ) + { + case PNS_SUBSCRIBED_RESOURCES_EXTEND_IND: //PNS_SUBSCRIBED_RESOURCES_EXTEND_IND: + { + iISIIndicationHandler->Subscribe( aMessageToCommunicationManager ); + break; + } + default: + { + TRACE_ASSERT_ALWAYS; + SendCommServiceNotIdentifiedResp( aMessageToCommunicationManager ); + break; + } + } + } + C_TRACE( ( _T( "DISICommunicationManager::HandleCellmoCommunicationManagerMessage 0x%x<" ), &aMessageToCommunicationManager ) ); + } + +void DISICommunicationManager::HandleCommunicationManagerCommonMessage( + const TDesC8& aMessageToCommunicationManager + ) + { + C_TRACE( ( _T( "DISICommunicationManager::HandleCommunicationManagerCommonMessage 0x%x>" ), &aMessageToCommunicationManager ) ); + const TUint8* messagePtr = aMessageToCommunicationManager.Ptr(); + ASSERT_RESET_ALWAYS( messagePtr, ( EISICommunicationManagerNullPointer16 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aMessageToCommunicationManager.Length() > ( ISI_HEADER_OFFSET_MESSAGEID ) ), + ( EISICommunicationInvalidLength14 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + if( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) + { + ASSERT_RESET_ALWAYS( ( aMessageToCommunicationManager.Length() > ( ISI_HEADER_OFFSET_SUBMESSAGEID ) ), + ( EISICommunicationInvalidLength9 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + switch( messagePtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] ) + { + case COMM_ISA_ENTITY_NOT_REACHABLE_RESP: + { + C_TRACE( ( _T( "DISICommunicationManager::HandleCommunicationManagerCommonMessage COMM_ISA_ENTITY_NOT_REACHABLE_RESP0 x%x" ), &aMessageToCommunicationManager ) ); + break; + } + case COMM_ISI_VERSION_GET_REQ: + { + C_TRACE( ( _T( "DISICommunicationManager::HandleCommunicationManagerCommonMessage COMM_ISI_VERSION_GET_REQ x%x" ), &aMessageToCommunicationManager ) ); + SendCommIsiVersionGetResp( aMessageToCommunicationManager ); + break; + } + default: + { + C_TRACE( ( _T( "DISICommunicationManager::HandleCommunicationManagerCommonMessage unknown COMMON_MESSAGE x%x" ), &aMessageToCommunicationManager ) ); + SendCommServiceNotIdentifiedResp( aMessageToCommunicationManager ); + break; + } + } + } } +void DISICommunicationManager::HandleMessageMulticast( + const TDesC8& aMessageToMulticast + ) + { + C_TRACE( ( _T( "DISICommunicationManager::HandleMessageMulticast 0x%x>" ), &aMessageToMulticast ) ); + const TUint8* messageToMulticastPtr = aMessageToMulticast.Ptr(); + ASSERT_RESET_ALWAYS( messageToMulticastPtr, ( EISICommunicationManagerNullPointer10 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aMessageToMulticast.Length() > ( ISI_HEADER_OFFSET_SENDERDEVICE ) ), + ( EISICommunicationInvalidLength8 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + if( ( messageToMulticastPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] != PN_DEV_OWN ) || +#ifndef ISCE_NO_NEED_TO_VALIDATE_RESOURCE + ( MISICommunicationManagerIf::IsValidResource( aMessageToMulticast ) ) +#else + ETrue +#endif + ) + { + C_TRACE( ( _T( "DISICommunicationManager::HandleMessageMulticast multicasting 0x%x" ), &aMessageToMulticast ) ); + iISIIndicationHandler->Multicast( aMessageToMulticast ); + } + else + { + TRACE_ASSERT_ALWAYS; + C_TRACE( ( _T( "DISICommunicationManager::HandleMessageMulticast ILLEGAL Resource from APE in message 0x%x" ), &aMessageToMulticast ) ); + } + C_TRACE( ( _T( "DISICommunicationManager::HandleMessageMulticast 0x%x<" ), &aMessageToMulticast ) ); + } -void DISICommunicationManager::SendCommServiceNotIdentifiedResp( const TDesC8& aMessage ) +void DISICommunicationManager::SendApeCommgrSubscribeResp( + const TDesC8& aMessage + ) + { + C_TRACE( ( _T( "DISICommunicationManager::SendApeCommgrSubscribeResp 0x%x>" ), &aMessage ) ); + TUint16 msgLength( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_RESP ); + TDes8& pnsSubscribeResp = MemApi::AllocBlock( msgLength ); + pnsSubscribeResp.SetLength( msgLength ); + TUint8* msgPtr = const_cast( aMessage.Ptr() ); + ASSERT_RESET_ALWAYS( msgPtr, ( EISICommunicationManagerNullPointer4 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aMessage.Length() > ( ISI_HEADER_OFFSET_TRANSID ) ), + ( EISICommunicationInvalidLength2 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + TUint8* pnsSubscribeRespPtr = const_cast( pnsSubscribeResp.Ptr() ); + ASSERT_RESET_ALWAYS( pnsSubscribeRespPtr, ( EISICommunicationManagerNullPointer5 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( pnsSubscribeResp.Length() > ( ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ) ), + ( EISICommunicationInvalidLength3 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + pnsSubscribeRespPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ]; + SET_RECEIVER_DEV( pnsSubscribeRespPtr, GET_SENDER_DEV( aMessage ) ); + SET_SENDER_DEV( pnsSubscribeRespPtr, PN_DEV_OWN ); + pnsSubscribeRespPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR; + SET_LENGTH( pnsSubscribeRespPtr, ( msgLength - PN_HEADER_SIZE ) ); + SET_RECEIVER_OBJ( pnsSubscribeRespPtr, GET_SENDER_OBJ( aMessage ) ); + SET_SENDER_OBJ( pnsSubscribeRespPtr, iObjectIdentifier ); + pnsSubscribeRespPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_TRANSID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ]; + pnsSubscribeRespPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_MESSAGEID ] = APE_COMMGR_SUBSCRIBE_RESP; + pnsSubscribeRespPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] = msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ? APE_COMMGR_OK : APE_COMMGR_NOT_ALLOWED; + TRACE_ASSERT( APE_COMMGR_OK == pnsSubscribeRespPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] ); + TInt sendResult = iRouter->Send( pnsSubscribeResp, iObjectIdentifier ); + ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed2 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + C_TRACE( ( _T( "DISICommunicationManager::SendApeCommgrSubscribeResp 0x%x<" ), &aMessage ) ); + } + +void DISICommunicationManager::SendCommServiceNotIdentifiedResp( + const TDesC8& aMessage + ) { C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp 0x%x>" ), &aMessage ) ); - TDes8& respMsg = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP ); - TUint8* ptr( const_cast( respMsg.Ptr() ) ); - const TUint8* msgPtr( aMessage.Ptr() ); - ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; - SET_RECEIVER_DEV( ptr, GET_SENDER_DEV( aMessage ) ); - SET_SENDER_DEV( ptr, PN_DEV_OWN ); - ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR; - SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMessage ) ); - SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST ); - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_TRANSACTIONID ] = 0x00; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_MESSAGEID ] = COMMON_MESSAGE; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_SUBMESSAGEID ] = COMM_SERVICE_NOT_IDENTIFIED_RESP; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDMESSAGEID ] = msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ]; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE1 ] = KFiller; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDSUBMESSAGEID ] = msgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ]; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE2 ] = KFiller; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE3 ] = KFiller; - iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST ); - C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp<" ) ) ); + // check if possible to go in wild loop if incoming message is not_reachable_resp + TInt commonServiceNotIdentifiedLength( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP ); + TDes8& commonServiceNotIdentifiedResp = MemApi::AllocBlock( commonServiceNotIdentifiedLength ); + commonServiceNotIdentifiedResp.SetLength( commonServiceNotIdentifiedLength ); + TUint8* commonServiceNotIdentifiedRespPtr( const_cast( commonServiceNotIdentifiedResp.Ptr() ) ); + ASSERT_RESET_ALWAYS( commonServiceNotIdentifiedRespPtr, ( EISICommunicationManagerNullPointer6 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( commonServiceNotIdentifiedResp.Length() > ( ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE3 ) ), + ( EISICommunicationInvalidLength4 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + const TUint8* receivedMsgPtr( aMessage.Ptr() ); + ASSERT_RESET_ALWAYS( receivedMsgPtr, ( EISICommunicationManagerNullPointer11 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aMessage.Length() > ( ISI_HEADER_OFFSET_SUBMESSAGEID ) ), + ( EISICommunicationInvalidLength10 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + SetIsiHeaderForCommonMessage( commonServiceNotIdentifiedResp, aMessage ); + commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_SUBMESSAGEID ] = COMM_SERVICE_NOT_IDENTIFIED_RESP; + commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDMESSAGEID ] = receivedMsgPtr[ ISI_HEADER_OFFSET_MESSAGEID ]; + commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE1 ] = KFiller; + commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDSUBMESSAGEID ] = receivedMsgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ]; + commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE2 ] = KFiller; + commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE3 ] = KFiller; + TInt sendResult = iRouter->Send( commonServiceNotIdentifiedResp, iObjectIdentifier ); + ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp 0x%x<" ), &aMessage ) ); } - -void DISICommunicationManager::SendCommIsiVersionGetResp( const TDesC8& aMessage ) +void DISICommunicationManager::SendCommIsiVersionGetResp( + const TDesC8& aMessage + ) { C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp 0x%x>" ), &aMessage ) ); - TDes8& respMsg = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP ); - TUint8* ptr( const_cast( respMsg.Ptr() ) ); - const TUint8* msgPtr( aMessage.Ptr() ); - ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; - SET_RECEIVER_DEV( ptr, GET_SENDER_DEV( aMessage ) ); - SET_SENDER_DEV( ptr, PN_DEV_OWN ); - ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR; - SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMessage ) ); - SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST ); - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_TRANSACTIONID ] = 0x00; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_MESSAGEID ] = COMMON_MESSAGE; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_SUBMESSAGEID ] = COMM_ISI_VERSION_GET_RESP; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONZZZ ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Z; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONYYY ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Y; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE1 ] = KFiller; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE2 ] = KFiller; - ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3 ] = KFiller; - iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST ); - C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp<" ) ) ); + TInt commonIsiVersionGetRespLength( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP ); + TDes8& commonIsiVersionGetResp = MemApi::AllocBlock( commonIsiVersionGetRespLength ); + commonIsiVersionGetResp.SetLength( commonIsiVersionGetRespLength ); + TUint8* commonIsiVersionGetRespPtr( const_cast( commonIsiVersionGetResp.Ptr() ) ); + ASSERT_RESET_ALWAYS( commonIsiVersionGetRespPtr, ( EISICommunicationManagerNullPointer8 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( commonIsiVersionGetResp.Length() > ( ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3 ) ), + ( EISICommunicationInvalidLength6 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + const TUint8* receivedMsgPtr( aMessage.Ptr() ); + ASSERT_RESET_ALWAYS( receivedMsgPtr, ( EISICommunicationManagerNullPointer12 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + SetIsiHeaderForCommonMessage( commonIsiVersionGetResp, aMessage ); + commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_SUBMESSAGEID ] = COMM_ISI_VERSION_GET_RESP; + commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONZZZ ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Z; + commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONYYY ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Y; + commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE1 ] = KFiller; + commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE2 ] = KFiller; + commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3 ] = KFiller; + TInt sendResult = iRouter->Send( commonIsiVersionGetResp, iObjectIdentifier ); + ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp 0x%x<" ), &aMessage ) ); } +void DISICommunicationManager::SetIsiHeaderForCommonMessage( + TDes8& aCommonResponse, + const TDesC8& aCommonRequest + ) + { + C_TRACE( ( _T( "DISICommunicationManager::SetIsiHeaderForCommonMessage 0x%x 0x%x>" ), &aCommonResponse, &aCommonRequest ) ); + const TUint8* commonRequestPtr = aCommonRequest.Ptr(); + TUint8* commonResponsePtr = const_cast( aCommonResponse.Ptr() ); + ASSERT_RESET_ALWAYS( commonRequestPtr, ( EISICommunicationManagerNullPointer13 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( commonResponsePtr, ( EISICommunicationManagerNullPointer14 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aCommonRequest.Length() > ISI_HEADER_OFFSET_TRANSID ), + ( EISICommunicationInvalidLength11 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + ASSERT_RESET_ALWAYS( ( aCommonResponse.Length() > ISI_HEADER_OFFSET_MESSAGEID ), + ( EISICommunicationInvalidLength12 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); + commonResponsePtr[ ISI_HEADER_OFFSET_MEDIA ] = commonRequestPtr[ ISI_HEADER_OFFSET_MEDIA ]; + SET_RECEIVER_DEV( commonResponsePtr, GET_SENDER_DEV( commonRequestPtr ) ); + SET_SENDER_DEV( commonResponsePtr, PN_DEV_OWN ); + commonResponsePtr[ ISI_HEADER_OFFSET_RESOURCEID ] = commonRequestPtr[ ISI_HEADER_OFFSET_RESOURCEID ]; + SET_LENGTH( commonResponsePtr, ( aCommonResponse.Length() - PN_HEADER_SIZE ) ); + SET_RECEIVER_OBJ( commonResponsePtr, GET_SENDER_OBJ( commonRequestPtr ) ); + SET_SENDER_OBJ( commonResponsePtr, iObjectIdentifier ); + commonResponsePtr[ ISI_HEADER_OFFSET_TRANSID ] = commonRequestPtr[ ISI_HEADER_OFFSET_TRANSID ]; + commonResponsePtr[ ISI_HEADER_OFFSET_MESSAGEID ] = COMMON_MESSAGE; + C_TRACE( ( _T( "DISICommunicationManager::SetIsiHeaderForCommonMessage 0x%x 0x%x<" ), &aCommonResponse, &aCommonRequest ) ); + } DECLARE_STANDARD_EXTENSION() {