15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <kernel.h> // For Kern |
19 #include <kernel.h> // For Kern |
|
20 #include <phonetisi.h> // For ISI_HEADER_SIZE |
|
21 #include <pn_const.h> // For PN_OBJ_ROUTING_REQ... |
|
22 #include <commisi.h> // For Common messages |
|
23 #include <pn_eventmodem_extisi.h> // PN_COMMG, PNS_SUBSCRIBED_RESOURCES_... |
20 #include "isicommunicationmanager.h" // For DISICommunicationManager |
24 #include "isicommunicationmanager.h" // For DISICommunicationManager |
21 #include "misiobjectrouterif.h" // For MISIObjectRouterIf |
25 #include "misiobjectrouterif.h" // For MISIObjectRouterIf |
22 #include "isicommunicationmanagertrace.h" // For C_TRACE, ASSERT_RESET.. and fault codes |
26 #include "isicommunicationmanagertrace.h" // For C_TRACE, ASSERT_RESET.. and fault codes |
23 #include "memapi.h" // For MemApi |
27 #include "memapi.h" // For MemApi |
24 #include <phonetisi.h> // For ISI_HEADER_SIZE |
28 |
25 #include <pn_const.h> // For PN_OBJ_ROUTING_REQ... |
29 // HOX! nsisi.h is this also exported by isimsg |
26 #include "nsisi.h" // For PN_NAMESERVICE |
30 #include "nsisi.h" // For PN_NAMESERVICE.. |
27 #ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE |
31 |
28 #include "isihelpers.h" // For SET_RECEIVER_OBJ... |
32 #include "isihelpers.h" // For SET_RECEIVER_OBJ... |
|
33 |
29 #include "isirouter.h" // For GetDFCThread |
34 #include "isirouter.h" // For GetDFCThread |
30 #else |
35 |
31 //#include "misiobjectrouterif.h" // For MISIObjectRouterIf |
|
32 #include "isaaccessextension.h" // For DIsaAccessExtension |
|
33 |
|
34 #include "iadhelpers.h" // For SET_RECEIVER_OBJ... |
|
35 #endif |
|
36 #include <iscnokiadefinitions.h> // For THIS_DEVICE |
|
37 #include "isiindicationhandler.h" // For DISIIndicationHandler |
36 #include "isiindicationhandler.h" // For DISIIndicationHandler |
38 #include "ape_commgrisi.h" // For APE_COMMGR.. |
37 #include "ape_commgrisi.h" // For APE_COMMGR.. |
39 #include "misicommunicationmanagerif.h" // For MISICommunicationManagerIf |
38 #include "misicommunicationmanagerif.h" // For MISICommunicationManagerIf |
40 #include <commisi.h> // For Common messages |
39 |
41 |
40 |
|
41 //#define ISCE_NO_NEED_TO_VALIDATE_RESOURCE // to skip resource validity check |
42 |
42 |
43 // Faults |
43 // Faults |
44 enum TISICommunicationManagerFaults |
44 enum TISICommunicationManagerFaults |
45 { |
45 { |
46 EISICommunicationManagerMemAllocFailure = 0x01, |
46 EISICommunicationManagerMemAllocFailure = 0x01, |
47 EISICommunicationManagerMemAllocFailure1, |
47 EISICommunicationManagerMemAllocFailure1, |
48 EISICommunicationManagerNullPointer, |
48 EISICommunicationManagerNullPointer, |
|
49 EISICommunicationManagerNullPointer1, |
|
50 EISICommunicationManagerNullPointer2, |
|
51 EISICommunicationManagerNullPointer3, |
|
52 EISICommunicationManagerNullPointer4, |
|
53 EISICommunicationManagerNullPointer5, |
|
54 EISICommunicationManagerNullPointer6, |
|
55 EISICommunicationManagerNullPointer7, |
|
56 EISICommunicationManagerNullPointer8, |
|
57 EISICommunicationManagerNullPointer9, |
|
58 EISICommunicationManagerNullPointer10, |
|
59 EISICommunicationManagerNullPointer11, |
|
60 EISICommunicationManagerNullPointer12, |
|
61 EISICommunicationManagerNullPointer13, |
|
62 EISICommunicationManagerNullPointer14, |
|
63 EISICommunicationManagerNullPointer15, |
|
64 EISICommunicationManagerNullPointer16, |
49 EISICommunicationManagerUnknownMessage, |
65 EISICommunicationManagerUnknownMessage, |
50 EISICommunicationManagerMutexCreateFailed, |
66 EISICommunicationManagerMutexCreateFailed, |
51 EISICommunicationManagerMutexWaitFailed, |
67 EISICommunicationManagerMutexWaitFailed, |
52 EISICommunicationManagerWrongMessageOrder, |
68 EISICommunicationManagerWrongMessageOrder, |
|
69 EISICommunicationManagerWrongMessageOrder2, |
|
70 EISICommunicationManagerWrongMessage, |
|
71 EISICommunicationManagerFatalError, |
|
72 EISICommunicationInvalidLength, |
|
73 EISICommunicationInvalidLength1, |
|
74 EISICommunicationInvalidLength2, |
|
75 EISICommunicationInvalidLength3, |
|
76 EISICommunicationInvalidLength4, |
|
77 EISICommunicationInvalidLength5, |
|
78 EISICommunicationInvalidLength6, |
|
79 EISICommunicationInvalidLength7, |
|
80 EISICommunicationInvalidLength8, |
|
81 EISICommunicationInvalidLength9, |
|
82 EISICommunicationInvalidLength10, |
|
83 EISICommunicationInvalidLength11, |
|
84 EISICommunicationInvalidLength12, |
|
85 EISICommunicationInvalidLength13, |
|
86 EISICommunicationInvalidLength14, |
|
87 EISICommunicationManagerSendFailed, |
|
88 EISICommunicationManagerSendFailed1, |
|
89 EISICommunicationManagerSendFailed2, |
|
90 EISICommunicationManagerSendFailed3, |
|
91 EISICommunicationManagerSendFailed4, |
53 }; |
92 }; |
54 |
|
55 |
|
56 /* PUTB8 macro writes byte value to given address. |
|
57 * This macro is used mainly by other PUTBXX macros. |
|
58 */ |
|
59 #define PUTB8(p,v) \ |
|
60 {(*(TUint8 *)(p)) = ((TUint8)(v));} |
|
61 |
|
62 |
|
63 /* PUTB16 macro writes 16-bit value in Big Endian format |
|
64 * to given address. 16-bit value is written as two separate |
|
65 * bytes, and so this macro can write 16-bit value to whatever |
|
66 * address, regardless of the processor alignment restrictions |
|
67 */ |
|
68 #define PUTB16(p,v) \ |
|
69 {PUTB8((p),(TUint16)(v)>>8); PUTB8((TUint8*)(p)+1,v);} |
|
70 |
|
71 |
|
72 /* PUTB32 macro writes 32-bit value in Big Endian format |
|
73 * to given address. 32-bit value is written as four separate |
|
74 * bytes, and so this macro can write 32-bit value to whatever |
|
75 * address, regardless of the processor alignment restrictions |
|
76 */ |
|
77 #define PUTB32(p,v) \ |
|
78 {PUTB16((p),(TUint32)(v)>>16); PUTB16((TUint8*)(p)+2,(TUint32)(v));} |
|
79 |
|
80 |
|
81 /** |
|
82 * Big Endian to local endian type |
|
83 */ |
|
84 /* GETB8 macro returns byte value from given address. |
|
85 * This macro is used mainly by other GETBXX macros. |
|
86 */ |
|
87 #define GETB8(p) \ |
|
88 (*(TUint8 *)(p)) |
|
89 |
|
90 |
|
91 /* GETB16 macro reads 16-bit value in Big Endian format |
|
92 * from given address. 16-bit value is read as two separate |
|
93 * bytes, and so this macro can read 16-bit value from whatever |
|
94 * address, regardless of the processor alignment restrictions |
|
95 */ |
|
96 #define GETB16(p) \ |
|
97 (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1)) |
|
98 |
|
99 |
|
100 /* GETB32 macro reads 32-bit value in Big Endian format |
|
101 * from given address. 32-bit value is read as four separate |
|
102 * bytes, and so this macro can read 32-bit value from whatever |
|
103 * address, regardless of the processor alignment restrictions |
|
104 */ |
|
105 #define GETB32(p) \ |
|
106 (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2)) |
|
107 |
|
108 |
93 |
109 DMutex* DISICommunicationManager::iCommunicationManagerMutex = NULL; |
94 DMutex* DISICommunicationManager::iCommunicationManagerMutex = NULL; |
110 _LIT8( KCommunicationManagerMutex, "KCommunicationManagerMutex" ); |
95 _LIT8( KCommunicationManagerMutex, "KCommunicationManagerMutex" ); |
111 |
96 |
112 const TUint32 KCommunicationManagerUID( 0x2002B3D0 ); |
97 const TUint32 KCommunicationManagerUID( 0x2002B3D0 ); |
113 const TUint8 KFiller( 0 ); |
98 const TUint8 KFiller( 0 ); |
114 const TInt KInitDfcPriority( 7 ); |
99 const TInt KInitDfcPriority( 7 ); |
115 const TUint8 KDone( 0 ); |
100 const TUint8 KDone( 0 ); |
|
101 const TUint8 KDefaultTransactionIdentifier( 0x00 ); |
|
102 const TUint8 KUnitializedObjectIdentifier( 0xff ); |
|
103 const TUint8 KNumberOfBootMessage( 0x04 ); |
116 |
104 |
117 DISICommunicationManager::DISICommunicationManager( |
105 DISICommunicationManager::DISICommunicationManager( |
118 // None |
106 // None |
119 ) |
107 ) |
120 : iObjId( 0x00 ), |
108 : iObjectIdentifier( KUnitializedObjectIdentifier ), |
121 iBootMsgCount( 0x04 ) // 2xRESP, 2xIND |
109 iBootMsgCount( KNumberOfBootMessage ) |
122 { |
110 { |
123 C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x>" ), iObjId, iRouter ) ); |
111 C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x>" ), iObjectIdentifier, iRouter ) ); |
124 iRouter = MISIObjectRouterIf::Connect( KCommunicationManagerUID, iObjId, this ); |
112 iRouter = MISIObjectRouterIf::GetIf(); |
125 ASSERT_RESET_ALWAYS( iRouter, ( EISICommunicationManagerNullPointer | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
113 ASSERT_RESET_ALWAYS( iRouter, ( EISICommunicationManagerNullPointer | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
126 // Must be > KMutexOrdGeneral1 for nesting purposes because trx shared memory uses KMutexOrdGeneral1 |
114 iRouter->Connect( KCommunicationManagerUID, iObjectIdentifier, this ); |
127 TInt err( Kern::MutexCreate( iCommunicationManagerMutex, KCommunicationManagerMutex, KMutexOrdGeneral2 ) ); |
115 ASSERT_RESET_ALWAYS( iObjectIdentifier == PN_OBJ_EVENT_MULTICAST, ( EISICommunicationManagerFatalError | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
116 // Ordinal three as there is zero, one and two used in other places of ISCE. |
|
117 TInt err( Kern::MutexCreate( iCommunicationManagerMutex, KCommunicationManagerMutex, KMutexOrdGeneral3 ) ); |
128 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexCreateFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
118 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexCreateFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
129 #ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE |
|
130 iInitDfc = new TDfc( InitDfc, this, iRouter->GetDfcThread( MISIObjectRouterIf::EISIKernelMainThread ), KInitDfcPriority ); |
119 iInitDfc = new TDfc( InitDfc, this, iRouter->GetDfcThread( MISIObjectRouterIf::EISIKernelMainThread ), KInitDfcPriority ); |
131 #else |
|
132 iInitDfc = new TDfc( InitDfc, this, DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue ), KInitDfcPriority ); |
|
133 #endif |
|
134 ASSERT_RESET_ALWAYS( iInitDfc, ( EISICommunicationManagerMemAllocFailure | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
120 ASSERT_RESET_ALWAYS( iInitDfc, ( EISICommunicationManagerMemAllocFailure | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
135 iISIIndicationHandler = new DISIIndicationHandler( iRouter ); |
121 iISIIndicationHandler = new DISIIndicationHandler( iRouter ); |
136 ASSERT_RESET_ALWAYS( iISIIndicationHandler, ( EISICommunicationManagerMemAllocFailure1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
122 ASSERT_RESET_ALWAYS( iISIIndicationHandler, ( EISICommunicationManagerMemAllocFailure1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
137 iInitDfc->Enque(); |
123 iInitDfc->Enque(); |
138 C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x<" ), iObjId, iRouter ) ); |
124 C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x<" ), iObjectIdentifier, iRouter ) ); |
139 } |
125 } |
140 |
126 |
141 void DISICommunicationManager::InitDfc( |
127 void DISICommunicationManager::InitDfc( |
142 TAny* aPtr // Pointer to this object. |
128 TAny* aPtr // Pointer to this object. |
143 ) |
129 ) |
144 { |
130 { |
145 C_TRACE( ( _T( "DISICommunicationManager::InitDfc 0x%x>" ), aPtr ) ); |
131 C_TRACE( ( _T( "DISICommunicationManager::InitDfc 0x%x>" ), aPtr ) ); |
146 DISICommunicationManager* tmp = reinterpret_cast<DISICommunicationManager*>( aPtr ); |
132 DISICommunicationManager* tmp = reinterpret_cast<DISICommunicationManager*>( aPtr ); |
|
133 ASSERT_RESET_ALWAYS( tmp, ( EISICommunicationManagerNullPointer3 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
147 tmp->SendNameAddReqs(); |
134 tmp->SendNameAddReqs(); |
148 C_TRACE( ( _T( "DISICommunicationManager::InitDfc<" ) ) ); |
135 C_TRACE( ( _T( "DISICommunicationManager::InitDfc 0x%x<" ), aPtr ) ); |
149 } |
136 } |
150 |
137 |
151 void DISICommunicationManager::SendNameAddReqs() |
138 void DISICommunicationManager::SendNameAddReqs( |
|
139 // None |
|
140 ) |
152 { |
141 { |
153 C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs>" ) ) ); |
142 C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs>" ) ) ); |
154 //PN_COMMGR name |
143 //PN_COMMGR name |
155 TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_REQ ); |
144 TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_REQ ); |
156 TDes8& addMsg = MemApi::AllocBlock( msgLength ); |
145 TDes8& addMsg = MemApi::AllocBlock( msgLength ); |
157 addMsg.SetLength( msgLength ); |
146 addMsg.SetLength( msgLength ); |
158 TUint8* addPtr = const_cast<TUint8*>( addMsg.Ptr() ); |
147 TUint8* addPtr = const_cast<TUint8*>( addMsg.Ptr() ); |
|
148 ASSERT_RESET_ALWAYS( addPtr, ( EISICommunicationManagerNullPointer1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
149 ASSERT_RESET_ALWAYS( ( addMsg.Length() > ( ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ) ), |
|
150 ( EISICommunicationInvalidLength | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
159 addPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; |
151 addPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; |
160 SET_RECEIVER_DEV( addPtr, PN_DEV_OWN ); |
152 SET_RECEIVER_DEV( addPtr, PN_DEV_OWN ); |
161 SET_SENDER_DEV( addPtr, PN_DEV_OWN ); |
153 SET_SENDER_DEV( addPtr, PN_DEV_OWN ); |
162 addPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
154 addPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
163 SET_LENGTH( addPtr, ( msgLength - PN_HEADER_SIZE ) ); |
155 SET_LENGTH( addPtr, ( msgLength - PN_HEADER_SIZE ) ); |
164 SET_RECEIVER_OBJ( addPtr, PN_OBJ_ROUTER ); |
156 SET_RECEIVER_OBJ( addPtr, PN_OBJ_ROUTER ); |
165 SET_SENDER_OBJ( addPtr, PN_OBJ_EVENT_MULTICAST ); |
157 SET_SENDER_OBJ( addPtr, iObjectIdentifier ); |
166 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] = 0x00; |
158 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] = KDefaultTransactionIdentifier; |
167 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_SUBFUNCTION ] = PNS_NAME_ADD_REQ; |
159 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_SUBFUNCTION ] = PNS_NAME_ADD_REQ; |
168 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED1 ] = KFiller; |
160 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED1 ] = KFiller; |
169 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED2 ] = KFiller; |
161 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED2 ] = KFiller; |
170 PUTB32( &addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_COMMGR ); |
162 PUTB32( &addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_COMMGR ); |
171 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ] = PN_DEV_OWN; |
163 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ] = PN_DEV_OWN; |
172 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_OBJ ] = PN_OBJ_EVENT_MULTICAST; |
164 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_OBJ ] = iObjectIdentifier; |
173 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = PN_NAME_UNDEF; |
165 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = PN_NAME_NOCHG; |
174 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller; |
166 addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller; |
175 //PN_APE_COMMGR name |
167 //PN_APE_COMMGR name |
176 TDes8& addMsg2 = MemApi::AllocBlock( msgLength ); |
168 TDes8& addMsg2 = MemApi::AllocBlock( msgLength ); |
177 addMsg2.SetLength( msgLength ); |
169 addMsg2.SetLength( msgLength ); |
178 addMsg2.Copy( addMsg ); |
170 addMsg2.Copy( addMsg ); |
179 TUint8* addPtr2 = const_cast<TUint8*>( addMsg2.Ptr() ); |
171 TUint8* addPtr2 = const_cast<TUint8*>( addMsg2.Ptr() ); |
|
172 ASSERT_RESET_ALWAYS( addPtr2, ( EISICommunicationManagerNullPointer2 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
173 ASSERT_RESET_ALWAYS( ( addMsg2.Length() > ( ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ) ), |
|
174 ( EISICommunicationInvalidLength1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
180 PUTB32( &addPtr2[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_APE_COMMGR ); |
175 PUTB32( &addPtr2[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_APE_COMMGR ); |
181 //Register PN_APE_COMMGR and PN_COMMGR |
176 TInt sendResult = iRouter->Send( addMsg, iObjectIdentifier ); |
182 iRouter->Send( addMsg, PN_OBJ_EVENT_MULTICAST ); |
177 ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed3 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
183 iRouter->Send( addMsg2, PN_OBJ_EVENT_MULTICAST ); |
178 sendResult = iRouter->Send( addMsg2, iObjectIdentifier ); |
|
179 ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed4 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
184 C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs<" ) ) ); |
180 C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs<" ) ) ); |
185 } |
181 } |
186 |
182 |
187 |
183 |
188 DISICommunicationManager::~DISICommunicationManager( |
184 DISICommunicationManager::~DISICommunicationManager( |
193 if( iISIIndicationHandler ) |
189 if( iISIIndicationHandler ) |
194 { |
190 { |
195 delete iISIIndicationHandler; |
191 delete iISIIndicationHandler; |
196 iISIIndicationHandler = NULL; |
192 iISIIndicationHandler = NULL; |
197 } |
193 } |
198 iInitDfc->Cancel(); |
194 if ( iInitDfc ) |
199 delete iInitDfc; |
195 { |
200 iInitDfc = NULL; |
196 iInitDfc->Cancel(); |
|
197 delete iInitDfc; |
|
198 iInitDfc = NULL; |
|
199 } |
201 if( iCommunicationManagerMutex ) |
200 if( iCommunicationManagerMutex ) |
202 { |
201 { |
203 ((DObject*)iCommunicationManagerMutex)->Close( NULL ); |
202 ((DObject*)iCommunicationManagerMutex)->Close( NULL ); |
204 } |
203 iCommunicationManagerMutex = NULL; |
205 iCommunicationManagerMutex = NULL; |
204 } |
|
205 |
206 C_TRACE( ( _T( "DISICommunicationManager::~DISICommunicationManager<" ) ) ); |
206 C_TRACE( ( _T( "DISICommunicationManager::~DISICommunicationManager<" ) ) ); |
207 } |
207 } |
208 |
208 |
209 |
209 void DISICommunicationManager::Receive( |
210 void DISICommunicationManager::Receive( const TDesC8& aMessage ) |
210 const TDesC8& aMessage |
|
211 ) |
211 { |
212 { |
212 C_TRACE( ( _T( "DISICommunicationManager::Receive 0x%x>" ), &aMessage ) ); |
213 C_TRACE( ( _T( "DISICommunicationManager::Receive 0x%x>" ), &aMessage ) ); |
213 TInt err( Kern::MutexWait( *iCommunicationManagerMutex ) ); |
214 TInt err( Kern::MutexWait( *iCommunicationManagerMutex ) );//! check usage of these mutexes (be aware of ordering violations) |
214 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexWaitFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
215 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexWaitFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
215 const TUint8* msgPtr( aMessage.Ptr() ); |
216 const TUint8* msgPtr( aMessage.Ptr() ); |
216 TDes8* blockPtr = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) ); |
217 TDes8* blockPtr = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) ); |
217 if( iBootMsgCount == KDone ) |
218 if( iBootMsgCount == KDone ) |
218 { |
219 { |
219 if( msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) |
220 switch( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] ) |
220 { |
221 { |
221 switch( msgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] ) |
222 case PN_APE_COMMGR: |
222 { |
223 { |
223 case COMM_ISA_ENTITY_NOT_REACHABLE_RESP: |
224 HandleApeCommunicationManagerMessage( *blockPtr ); |
224 { |
225 break; |
225 C_TRACE( ( _T( "DISICommunicationManager::Received not reachable resp" ) ) ); |
226 } |
226 break; |
227 case PN_COMMGR: |
227 } |
228 { |
228 case COMM_ISI_VERSION_GET_REQ: |
229 HandlePnCommgrMessage( *blockPtr ); |
229 { |
230 break; |
230 C_TRACE( ( _T( "DISICommunicationManager::Received version get req" ) ) ); |
231 } |
231 SendCommIsiVersionGetResp( *blockPtr ); |
232 default: |
232 break; |
233 { |
233 } |
234 HandleMessageMulticast( *blockPtr ); |
234 default: |
235 break; |
235 { |
|
236 C_TRACE( ( _T( "DISICommunicationManager::Received unknown common message" ) ) ); |
|
237 SendCommServiceNotIdentifiedResp( *blockPtr ); |
|
238 break; |
|
239 } |
|
240 } |
236 } |
241 } |
237 } |
242 else if( ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_APE_COMMGR ) |
|
243 || ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_COMMGR ) ) |
|
244 { |
|
245 C_TRACE( ( _T( "DISICommunicationManager::Receive subscription" ) ) ); |
|
246 SendPnsSubscribeResp( *blockPtr ); |
|
247 if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) |
|
248 { |
|
249 C_TRACE( ( _T( "DISICommunicationManager PNS_SUBSCRIBE_REQ from APE" ) ) ); |
|
250 iISIIndicationHandler->Subscribe( *blockPtr ); |
|
251 } |
|
252 } |
|
253 else |
|
254 { |
|
255 if( ( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] != PN_DEV_OWN ) |
|
256 || ( MISICommunicationManagerIf::IsValidResource( *blockPtr ) ) ) |
|
257 { |
|
258 C_TRACE( ( _T( "DISICommunicationManager::Receive indication" ) ) ); |
|
259 iISIIndicationHandler->Multicast( *blockPtr ); |
|
260 } |
|
261 else |
|
262 { |
|
263 C_TRACE( ( _T( "DISICommunicationManager not allowed resource from APE" ) ) ); |
|
264 } |
|
265 } |
|
266 } |
238 } |
267 else |
239 else |
268 { |
240 { |
269 C_TRACE( ( _T( "DISICommunicationManager not indication %d" ), iBootMsgCount ) ); |
241 C_TRACE( ( _T( "DISICommunicationManager booting %d" ), iBootMsgCount ) ); |
270 // From PN_NAMESERVICE && ( IND || successfull RESP ) |
242 HandleBootMessage( *blockPtr ); |
271 if( ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE ) |
|
272 && ( msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ]== PNS_NAME_ADD_IND |
|
273 || ( msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_SUBFUNCTION ]== PNS_NAME_ADD_RESP |
|
274 && msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK ) ) ) |
|
275 { |
|
276 C_TRACE( ( _T( "DISICommunicationManager::Receive from NAMESERVICE message id 0x%x" ), msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ] ) ); |
|
277 iBootMsgCount--; |
|
278 } |
|
279 else |
|
280 { |
|
281 ASSERT_RESET_ALWAYS( 0, ( EISICommunicationManagerWrongMessageOrder | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
282 } |
|
283 } |
243 } |
284 MemApi::DeallocBlock( *blockPtr ); |
244 MemApi::DeallocBlock( *blockPtr ); |
285 Kern::MutexSignal( *iCommunicationManagerMutex ); |
245 Kern::MutexSignal( *iCommunicationManagerMutex ); |
286 C_TRACE( ( _T( "DISICommunicationManager::Receive<" ) ) ); |
246 C_TRACE( ( _T( "DISICommunicationManager::Receive 0x%x<" ), &aMessage ) ); |
287 } |
247 } |
288 |
248 |
289 void DISICommunicationManager::SendPnsSubscribeResp( const TDesC8& aMessage ) |
249 void DISICommunicationManager::HandleBootMessage( |
290 { |
250 const TDesC8& aMessageDuringBoot |
291 C_TRACE( ( _T( "DISICommunicationManager::SendPnsSubscribeResp 0x%x>" ), &aMessage ) ); |
251 ) |
|
252 { |
|
253 C_TRACE( ( _T( "DISICommunicationManager::HandleBootMessage 0x%x>" ), &aMessageDuringBoot ) ); |
|
254 const TUint8* messageDuringBootPtr = aMessageDuringBoot.Ptr(); |
|
255 ASSERT_RESET_ALWAYS( messageDuringBootPtr, ( EISICommunicationManagerNullPointer7 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
256 ASSERT_RESET_ALWAYS( ( aMessageDuringBoot.Length() > ( ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ) ), |
|
257 ( EISICommunicationInvalidLength5 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
258 if( messageDuringBootPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE ) |
|
259 { |
|
260 switch( messageDuringBootPtr[ ISI_HEADER_OFFSET_MESSAGEID ] ) |
|
261 { |
|
262 case PNS_NAME_ADD_IND : |
|
263 { |
|
264 C_TRACE( ( _T( "DISICommunicationManager::HandleBootMessage PNS_NAME_ADD_IND" ) ) ); |
|
265 iBootMsgCount--; |
|
266 break; |
|
267 } |
|
268 case PNS_NAME_ADD_RESP : |
|
269 { |
|
270 C_TRACE( ( _T( "DISICommunicationManager::HandleBootMessage PNS_NAME_ADD_RESP" ) ) ); |
|
271 ASSERT_RESET_ALWAYS( ( messageDuringBootPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK ), ( EISICommunicationManagerWrongMessage | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
272 iBootMsgCount--; |
|
273 break; |
|
274 } |
|
275 default: |
|
276 { |
|
277 ASSERT_RESET_ALWAYS( 0, ( EISICommunicationManagerWrongMessageOrder2 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
278 break; |
|
279 } |
|
280 } |
|
281 } |
|
282 else |
|
283 { |
|
284 ASSERT_RESET_ALWAYS( 0, ( EISICommunicationManagerWrongMessageOrder | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
285 } |
|
286 C_TRACE( ( _T( "DISICommunicationManager::HandleBootMessage 0x%x<" ), &aMessageDuringBoot ) ); |
|
287 } |
|
288 |
|
289 void DISICommunicationManager::HandleApeCommunicationManagerMessage( |
|
290 const TDesC8& aMessageToCommunicationManager |
|
291 ) |
|
292 { |
|
293 C_TRACE( ( _T( "DISICommunicationManager::HandleApeCommunicationManagerMessage 0x%x>" ), &aMessageToCommunicationManager ) ); |
|
294 const TUint8* messagePtr = aMessageToCommunicationManager.Ptr(); |
|
295 ASSERT_RESET_ALWAYS( messagePtr, ( EISICommunicationManagerNullPointer9 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
296 ASSERT_RESET_ALWAYS( ( aMessageToCommunicationManager.Length() > ( ISI_HEADER_OFFSET_MESSAGEID ) ), |
|
297 ( EISICommunicationInvalidLength7 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
298 if( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) |
|
299 { |
|
300 HandleCommunicationManagerCommonMessage( aMessageToCommunicationManager ); |
|
301 } |
|
302 else |
|
303 { |
|
304 C_TRACE( ( _T( "DISICommunicationManager::HandleApeCommunicationManagerMessage subscription x%x" ), &aMessageToCommunicationManager ) ); |
|
305 switch( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] ) |
|
306 { |
|
307 case APE_COMMGR_SUBSCRIBE_REQ: |
|
308 { |
|
309 SendApeCommgrSubscribeResp( aMessageToCommunicationManager ); |
|
310 iISIIndicationHandler->Subscribe( aMessageToCommunicationManager ); |
|
311 break; |
|
312 } |
|
313 default: |
|
314 { |
|
315 TRACE_ASSERT_ALWAYS; |
|
316 SendCommServiceNotIdentifiedResp( aMessageToCommunicationManager ); |
|
317 break; |
|
318 } |
|
319 } |
|
320 } |
|
321 C_TRACE( ( _T( "DISICommunicationManager::HandleApeCommunicationManagerMessage 0x%x<" ), &aMessageToCommunicationManager ) ); |
|
322 } |
|
323 |
|
324 void DISICommunicationManager::HandlePnCommgrMessage( |
|
325 const TDesC8& aMessageToCommunicationManager |
|
326 ) |
|
327 { |
|
328 C_TRACE( ( _T( "DISICommunicationManager::HandleCellmoCommunicationManagerMessage 0x%x>" ), &aMessageToCommunicationManager ) ); |
|
329 const TUint8* messagePtr = aMessageToCommunicationManager.Ptr(); |
|
330 ASSERT_RESET_ALWAYS( messagePtr, ( EISICommunicationManagerNullPointer15 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
331 ASSERT_RESET_ALWAYS( ( aMessageToCommunicationManager.Length() > ( ISI_HEADER_OFFSET_MESSAGEID ) ), |
|
332 ( EISICommunicationInvalidLength13 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
333 if( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) |
|
334 { |
|
335 HandleCommunicationManagerCommonMessage( aMessageToCommunicationManager ); |
|
336 } |
|
337 else |
|
338 { |
|
339 C_TRACE( ( _T( "DISICommunicationManager::HandleCellmoCommunicationManagerMessage subscription x%x" ), &aMessageToCommunicationManager ) ); |
|
340 switch( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] ) |
|
341 { |
|
342 case PNS_SUBSCRIBED_RESOURCES_EXTEND_IND: //PNS_SUBSCRIBED_RESOURCES_EXTEND_IND: |
|
343 { |
|
344 iISIIndicationHandler->Subscribe( aMessageToCommunicationManager ); |
|
345 break; |
|
346 } |
|
347 default: |
|
348 { |
|
349 TRACE_ASSERT_ALWAYS; |
|
350 SendCommServiceNotIdentifiedResp( aMessageToCommunicationManager ); |
|
351 break; |
|
352 } |
|
353 } |
|
354 } |
|
355 C_TRACE( ( _T( "DISICommunicationManager::HandleCellmoCommunicationManagerMessage 0x%x<" ), &aMessageToCommunicationManager ) ); |
|
356 } |
|
357 |
|
358 void DISICommunicationManager::HandleCommunicationManagerCommonMessage( |
|
359 const TDesC8& aMessageToCommunicationManager |
|
360 ) |
|
361 { |
|
362 C_TRACE( ( _T( "DISICommunicationManager::HandleCommunicationManagerCommonMessage 0x%x>" ), &aMessageToCommunicationManager ) ); |
|
363 const TUint8* messagePtr = aMessageToCommunicationManager.Ptr(); |
|
364 ASSERT_RESET_ALWAYS( messagePtr, ( EISICommunicationManagerNullPointer16 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
365 ASSERT_RESET_ALWAYS( ( aMessageToCommunicationManager.Length() > ( ISI_HEADER_OFFSET_MESSAGEID ) ), |
|
366 ( EISICommunicationInvalidLength14 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
367 if( messagePtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) |
|
368 { |
|
369 ASSERT_RESET_ALWAYS( ( aMessageToCommunicationManager.Length() > ( ISI_HEADER_OFFSET_SUBMESSAGEID ) ), |
|
370 ( EISICommunicationInvalidLength9 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
371 switch( messagePtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] ) |
|
372 { |
|
373 case COMM_ISA_ENTITY_NOT_REACHABLE_RESP: |
|
374 { |
|
375 C_TRACE( ( _T( "DISICommunicationManager::HandleCommunicationManagerCommonMessage COMM_ISA_ENTITY_NOT_REACHABLE_RESP0 x%x" ), &aMessageToCommunicationManager ) ); |
|
376 break; |
|
377 } |
|
378 case COMM_ISI_VERSION_GET_REQ: |
|
379 { |
|
380 C_TRACE( ( _T( "DISICommunicationManager::HandleCommunicationManagerCommonMessage COMM_ISI_VERSION_GET_REQ x%x" ), &aMessageToCommunicationManager ) ); |
|
381 SendCommIsiVersionGetResp( aMessageToCommunicationManager ); |
|
382 break; |
|
383 } |
|
384 default: |
|
385 { |
|
386 C_TRACE( ( _T( "DISICommunicationManager::HandleCommunicationManagerCommonMessage unknown COMMON_MESSAGE x%x" ), &aMessageToCommunicationManager ) ); |
|
387 SendCommServiceNotIdentifiedResp( aMessageToCommunicationManager ); |
|
388 break; |
|
389 } |
|
390 } |
|
391 } |
|
392 } |
|
393 |
|
394 void DISICommunicationManager::HandleMessageMulticast( |
|
395 const TDesC8& aMessageToMulticast |
|
396 ) |
|
397 { |
|
398 C_TRACE( ( _T( "DISICommunicationManager::HandleMessageMulticast 0x%x>" ), &aMessageToMulticast ) ); |
|
399 const TUint8* messageToMulticastPtr = aMessageToMulticast.Ptr(); |
|
400 ASSERT_RESET_ALWAYS( messageToMulticastPtr, ( EISICommunicationManagerNullPointer10 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
401 ASSERT_RESET_ALWAYS( ( aMessageToMulticast.Length() > ( ISI_HEADER_OFFSET_SENDERDEVICE ) ), |
|
402 ( EISICommunicationInvalidLength8 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
403 if( ( messageToMulticastPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] != PN_DEV_OWN ) || |
|
404 #ifndef ISCE_NO_NEED_TO_VALIDATE_RESOURCE |
|
405 ( MISICommunicationManagerIf::IsValidResource( aMessageToMulticast ) ) |
|
406 #else |
|
407 ETrue |
|
408 #endif |
|
409 ) |
|
410 { |
|
411 C_TRACE( ( _T( "DISICommunicationManager::HandleMessageMulticast multicasting 0x%x" ), &aMessageToMulticast ) ); |
|
412 iISIIndicationHandler->Multicast( aMessageToMulticast ); |
|
413 } |
|
414 else |
|
415 { |
|
416 TRACE_ASSERT_ALWAYS; |
|
417 C_TRACE( ( _T( "DISICommunicationManager::HandleMessageMulticast ILLEGAL Resource from APE in message 0x%x" ), &aMessageToMulticast ) ); |
|
418 } |
|
419 C_TRACE( ( _T( "DISICommunicationManager::HandleMessageMulticast 0x%x<" ), &aMessageToMulticast ) ); |
|
420 } |
|
421 |
|
422 void DISICommunicationManager::SendApeCommgrSubscribeResp( |
|
423 const TDesC8& aMessage |
|
424 ) |
|
425 { |
|
426 C_TRACE( ( _T( "DISICommunicationManager::SendApeCommgrSubscribeResp 0x%x>" ), &aMessage ) ); |
292 TUint16 msgLength( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_RESP ); |
427 TUint16 msgLength( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_RESP ); |
293 TDes8& respMsg = MemApi::AllocBlock( msgLength ); |
428 TDes8& pnsSubscribeResp = MemApi::AllocBlock( msgLength ); |
294 respMsg.SetLength( msgLength ); |
429 pnsSubscribeResp.SetLength( msgLength ); |
295 TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() ); |
430 TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() ); |
296 TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() ); |
431 ASSERT_RESET_ALWAYS( msgPtr, ( EISICommunicationManagerNullPointer4 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
297 respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ]; |
432 ASSERT_RESET_ALWAYS( ( aMessage.Length() > ( ISI_HEADER_OFFSET_TRANSID ) ), |
298 SET_RECEIVER_DEV( respPtr, GET_SENDER_DEV( aMessage ) ); |
433 ( EISICommunicationInvalidLength2 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
299 SET_SENDER_DEV( respPtr, PN_DEV_OWN ); |
434 TUint8* pnsSubscribeRespPtr = const_cast<TUint8*>( pnsSubscribeResp.Ptr() ); |
300 respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR; |
435 ASSERT_RESET_ALWAYS( pnsSubscribeRespPtr, ( EISICommunicationManagerNullPointer5 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
301 SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) ); |
436 ASSERT_RESET_ALWAYS( ( pnsSubscribeResp.Length() > ( ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ) ), |
302 SET_RECEIVER_OBJ( respPtr, GET_SENDER_OBJ( aMessage ) ); |
437 ( EISICommunicationInvalidLength3 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
303 SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER ); |
438 pnsSubscribeRespPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ]; |
304 respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_TRANSID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ]; |
439 SET_RECEIVER_DEV( pnsSubscribeRespPtr, GET_SENDER_DEV( aMessage ) ); |
305 respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_MESSAGEID ] = APE_COMMGR_SUBSCRIBE_RESP; |
440 SET_SENDER_DEV( pnsSubscribeRespPtr, PN_DEV_OWN ); |
306 if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) |
441 pnsSubscribeRespPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR; |
307 { |
442 SET_LENGTH( pnsSubscribeRespPtr, ( msgLength - PN_HEADER_SIZE ) ); |
308 respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] = APE_COMMGR_OK; |
443 SET_RECEIVER_OBJ( pnsSubscribeRespPtr, GET_SENDER_OBJ( aMessage ) ); |
309 } |
444 SET_SENDER_OBJ( pnsSubscribeRespPtr, iObjectIdentifier ); |
310 else |
445 pnsSubscribeRespPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_TRANSID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ]; |
311 { |
446 pnsSubscribeRespPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_MESSAGEID ] = APE_COMMGR_SUBSCRIBE_RESP; |
312 respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] = APE_COMMGR_NOT_ALLOWED; |
447 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; |
313 } |
448 TRACE_ASSERT( APE_COMMGR_OK == pnsSubscribeRespPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] ); |
314 iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST ); |
449 TInt sendResult = iRouter->Send( pnsSubscribeResp, iObjectIdentifier ); |
315 C_TRACE( ( _T( "DISICommunicationManager::SendPnsSubscribeResp<" ) ) ); |
450 ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed2 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
316 } |
451 C_TRACE( ( _T( "DISICommunicationManager::SendApeCommgrSubscribeResp 0x%x<" ), &aMessage ) ); |
317 |
452 } |
318 |
453 |
319 void DISICommunicationManager::SendCommServiceNotIdentifiedResp( const TDesC8& aMessage ) |
454 void DISICommunicationManager::SendCommServiceNotIdentifiedResp( |
|
455 const TDesC8& aMessage |
|
456 ) |
320 { |
457 { |
321 C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp 0x%x>" ), &aMessage ) ); |
458 C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp 0x%x>" ), &aMessage ) ); |
322 TDes8& respMsg = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP ); |
459 // check if possible to go in wild loop if incoming message is not_reachable_resp |
323 TUint8* ptr( const_cast<TUint8*>( respMsg.Ptr() ) ); |
460 TInt commonServiceNotIdentifiedLength( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP ); |
324 const TUint8* msgPtr( aMessage.Ptr() ); |
461 TDes8& commonServiceNotIdentifiedResp = MemApi::AllocBlock( commonServiceNotIdentifiedLength ); |
325 ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; |
462 commonServiceNotIdentifiedResp.SetLength( commonServiceNotIdentifiedLength ); |
326 SET_RECEIVER_DEV( ptr, GET_SENDER_DEV( aMessage ) ); |
463 TUint8* commonServiceNotIdentifiedRespPtr( const_cast<TUint8*>( commonServiceNotIdentifiedResp.Ptr() ) ); |
327 SET_SENDER_DEV( ptr, PN_DEV_OWN ); |
464 ASSERT_RESET_ALWAYS( commonServiceNotIdentifiedRespPtr, ( EISICommunicationManagerNullPointer6 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
328 ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR; |
465 ASSERT_RESET_ALWAYS( ( commonServiceNotIdentifiedResp.Length() > ( ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE3 ) ), |
329 SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMessage ) ); |
466 ( EISICommunicationInvalidLength4 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
330 SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST ); |
467 const TUint8* receivedMsgPtr( aMessage.Ptr() ); |
331 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_TRANSACTIONID ] = 0x00; |
468 ASSERT_RESET_ALWAYS( receivedMsgPtr, ( EISICommunicationManagerNullPointer11 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
332 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_MESSAGEID ] = COMMON_MESSAGE; |
469 ASSERT_RESET_ALWAYS( ( aMessage.Length() > ( ISI_HEADER_OFFSET_SUBMESSAGEID ) ), |
333 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_SUBMESSAGEID ] = COMM_SERVICE_NOT_IDENTIFIED_RESP; |
470 ( EISICommunicationInvalidLength10 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
334 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDMESSAGEID ] = msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ]; |
471 SetIsiHeaderForCommonMessage( commonServiceNotIdentifiedResp, aMessage ); |
335 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE1 ] = KFiller; |
472 commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_SUBMESSAGEID ] = COMM_SERVICE_NOT_IDENTIFIED_RESP; |
336 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDSUBMESSAGEID ] = msgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ]; |
473 commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDMESSAGEID ] = receivedMsgPtr[ ISI_HEADER_OFFSET_MESSAGEID ]; |
337 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE2 ] = KFiller; |
474 commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE1 ] = KFiller; |
338 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE3 ] = KFiller; |
475 commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDSUBMESSAGEID ] = receivedMsgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ]; |
339 iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST ); |
476 commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE2 ] = KFiller; |
340 C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp<" ) ) ); |
477 commonServiceNotIdentifiedRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE3 ] = KFiller; |
341 } |
478 TInt sendResult = iRouter->Send( commonServiceNotIdentifiedResp, iObjectIdentifier ); |
342 |
479 ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
343 |
480 C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp 0x%x<" ), &aMessage ) ); |
344 void DISICommunicationManager::SendCommIsiVersionGetResp( const TDesC8& aMessage ) |
481 } |
|
482 |
|
483 void DISICommunicationManager::SendCommIsiVersionGetResp( |
|
484 const TDesC8& aMessage |
|
485 ) |
345 { |
486 { |
346 C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp 0x%x>" ), &aMessage ) ); |
487 C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp 0x%x>" ), &aMessage ) ); |
347 TDes8& respMsg = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP ); |
488 TInt commonIsiVersionGetRespLength( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP ); |
348 TUint8* ptr( const_cast<TUint8*>( respMsg.Ptr() ) ); |
489 TDes8& commonIsiVersionGetResp = MemApi::AllocBlock( commonIsiVersionGetRespLength ); |
349 const TUint8* msgPtr( aMessage.Ptr() ); |
490 commonIsiVersionGetResp.SetLength( commonIsiVersionGetRespLength ); |
350 ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; |
491 TUint8* commonIsiVersionGetRespPtr( const_cast<TUint8*>( commonIsiVersionGetResp.Ptr() ) ); |
351 SET_RECEIVER_DEV( ptr, GET_SENDER_DEV( aMessage ) ); |
492 ASSERT_RESET_ALWAYS( commonIsiVersionGetRespPtr, ( EISICommunicationManagerNullPointer8 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
352 SET_SENDER_DEV( ptr, PN_DEV_OWN ); |
493 ASSERT_RESET_ALWAYS( ( commonIsiVersionGetResp.Length() > ( ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3 ) ), |
353 ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR; |
494 ( EISICommunicationInvalidLength6 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
354 SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMessage ) ); |
495 const TUint8* receivedMsgPtr( aMessage.Ptr() ); |
355 SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST ); |
496 ASSERT_RESET_ALWAYS( receivedMsgPtr, ( EISICommunicationManagerNullPointer12 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
356 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_TRANSACTIONID ] = 0x00; |
497 SetIsiHeaderForCommonMessage( commonIsiVersionGetResp, aMessage ); |
357 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_MESSAGEID ] = COMMON_MESSAGE; |
498 commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_SUBMESSAGEID ] = COMM_ISI_VERSION_GET_RESP; |
358 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_SUBMESSAGEID ] = COMM_ISI_VERSION_GET_RESP; |
499 commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONZZZ ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Z; |
359 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONZZZ ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Z; |
500 commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONYYY ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Y; |
360 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONYYY ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Y; |
501 commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE1 ] = KFiller; |
361 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE1 ] = KFiller; |
502 commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE2 ] = KFiller; |
362 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE2 ] = KFiller; |
503 commonIsiVersionGetRespPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3 ] = KFiller; |
363 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3 ] = KFiller; |
504 TInt sendResult = iRouter->Send( commonIsiVersionGetResp, iObjectIdentifier ); |
364 iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST ); |
505 ASSERT_RESET_ALWAYS( ( sendResult == KErrNone ), ( EISICommunicationManagerSendFailed1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
365 C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp<" ) ) ); |
506 C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp 0x%x<" ), &aMessage ) ); |
366 } |
507 } |
367 |
508 |
|
509 void DISICommunicationManager::SetIsiHeaderForCommonMessage( |
|
510 TDes8& aCommonResponse, |
|
511 const TDesC8& aCommonRequest |
|
512 ) |
|
513 { |
|
514 C_TRACE( ( _T( "DISICommunicationManager::SetIsiHeaderForCommonMessage 0x%x 0x%x>" ), &aCommonResponse, &aCommonRequest ) ); |
|
515 const TUint8* commonRequestPtr = aCommonRequest.Ptr(); |
|
516 TUint8* commonResponsePtr = const_cast<TUint8*>( aCommonResponse.Ptr() ); |
|
517 ASSERT_RESET_ALWAYS( commonRequestPtr, ( EISICommunicationManagerNullPointer13 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
518 ASSERT_RESET_ALWAYS( commonResponsePtr, ( EISICommunicationManagerNullPointer14 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
519 ASSERT_RESET_ALWAYS( ( aCommonRequest.Length() > ISI_HEADER_OFFSET_TRANSID ), |
|
520 ( EISICommunicationInvalidLength11 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
521 ASSERT_RESET_ALWAYS( ( aCommonResponse.Length() > ISI_HEADER_OFFSET_MESSAGEID ), |
|
522 ( EISICommunicationInvalidLength12 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) ); |
|
523 commonResponsePtr[ ISI_HEADER_OFFSET_MEDIA ] = commonRequestPtr[ ISI_HEADER_OFFSET_MEDIA ]; |
|
524 SET_RECEIVER_DEV( commonResponsePtr, GET_SENDER_DEV( commonRequestPtr ) ); |
|
525 SET_SENDER_DEV( commonResponsePtr, PN_DEV_OWN ); |
|
526 commonResponsePtr[ ISI_HEADER_OFFSET_RESOURCEID ] = commonRequestPtr[ ISI_HEADER_OFFSET_RESOURCEID ]; |
|
527 SET_LENGTH( commonResponsePtr, ( aCommonResponse.Length() - PN_HEADER_SIZE ) ); |
|
528 SET_RECEIVER_OBJ( commonResponsePtr, GET_SENDER_OBJ( commonRequestPtr ) ); |
|
529 SET_SENDER_OBJ( commonResponsePtr, iObjectIdentifier ); |
|
530 commonResponsePtr[ ISI_HEADER_OFFSET_TRANSID ] = commonRequestPtr[ ISI_HEADER_OFFSET_TRANSID ]; |
|
531 commonResponsePtr[ ISI_HEADER_OFFSET_MESSAGEID ] = COMMON_MESSAGE; |
|
532 C_TRACE( ( _T( "DISICommunicationManager::SetIsiHeaderForCommonMessage 0x%x 0x%x<" ), &aCommonResponse, &aCommonRequest ) ); |
|
533 } |
368 |
534 |
369 DECLARE_STANDARD_EXTENSION() |
535 DECLARE_STANDARD_EXTENSION() |
370 { |
536 { |
371 Kern::Printf( "ISI Communication Manager extension>" ); |
537 Kern::Printf( "ISI Communication Manager extension>" ); |
372 // Create a container extension |
538 // Create a container extension |