13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
|
19 #include <kernel.h> // For Kern |
18 #include <kernel.h> // For Kern |
20 #include "isinameservice.h" // For DISINameService |
19 #include "isinameservice.h" // For DISINameService |
21 #include "misiobjectrouterif.h" // For MISIObjectRouterIf |
20 #include "misiobjectrouterif.h" // For MISIObjectRouterIf |
22 #include "isinameservicetrace.h" // For C_TRACE, ASSERT_RESET.. and fault codes |
21 #include "isinameservicetrace.h" // For C_TRACE, ASSERT_RESET.. and fault codes |
23 #include "memapi.h" // For MemApi |
22 #include "memapi.h" // For MemApi |
24 #include <phonetisi.h> // For ISI_HEADER_SIZE |
23 #include <phonetisi.h> // For ISI_HEADER_SIZE |
25 #include <pn_const.h> // For PN_NAMESERVICE |
24 #include <pn_const.h> // For PN_NAMESERVICE |
26 #include <nsisi.h> // For PN |
25 #include <nsisi.h> // For PN |
27 |
26 #include "misiobjectrouterif.h" // For MISIObjectRouterIf |
28 #ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE |
|
29 #include "isihelpers.h" // For SET_RECEIVER_OBJ... |
27 #include "isihelpers.h" // For SET_RECEIVER_OBJ... |
30 #else |
28 #include "namerecords.h" // For DNameRecords |
31 #include "iadhelpers.h" // For SET_RECEIVER_OBJ... |
29 #include "routerisi.h" // For PN_ROUTER |
|
30 #include <commisi.h> // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP |
|
31 |
|
32 #ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
|
33 #include "ape_commgrisi.h" // For APE_COMMGR |
|
34 #define ISCE_INTERNAL_EXTENDED_RESOURCE_ROUTING_SUPPORTED |
|
35 //#include "isinameserviceextended.h" // For DISINameServiceExtended |
32 #endif |
36 #endif |
33 #include "namerecords.h" // For DNameRecords |
37 |
34 #include <iscnokiadefinitions.h> // For THIS_DEVICE |
|
35 #include <commisi.h> // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP |
|
36 // Faults |
38 // Faults |
37 enum TISINameServiceFaults |
39 enum TISINameServiceFaults |
38 { |
40 { |
39 EISINameServiceMemAllocFailure = 0x01, |
41 EISINameServiceMemAllocFailure = 0x01, |
40 EISINameServiceNullPointer, |
42 EISINameServiceNullPointer, |
|
43 EISINameServiceNullPointer1, |
|
44 EISINameServiceNullPointer2, |
|
45 EISINameServiceNullPointer6, |
|
46 EISINameServiceNullPointer7, |
|
47 EISINameServiceNullPointer8, |
|
48 EISINameServiceNullPointer9, |
|
49 EISINameServiceNullPointer10, |
|
50 EISINameServiceNullPointer11, |
|
51 EISINameServiceNullPointer12, |
|
52 EISINameServiceNullPointer13, |
|
53 EISINameServiceNullPointer14, |
|
54 EISINameServiceNullPointer15, |
|
55 EISINameServiceNullPointer16, |
|
56 EISINameServiceNullPointer17, |
|
57 EISINameServiceNullPointer18, |
|
58 EISINameServiceNullPointer19, |
|
59 EISINameServiceWrongLength, |
|
60 EISINameServiceWrongLength1, |
|
61 EISINameServiceWrongLength6, |
|
62 EISINameServiceWrongLength7, |
|
63 EISINameServiceWrongLength8, |
|
64 EISINameServiceWrongLength9, |
|
65 EISINameServiceWrongLength10, |
|
66 EISINameServiceWrongLength11, |
|
67 EISINameServiceWrongLength12, |
41 EISINameServiceUnknownMessage, |
68 EISINameServiceUnknownMessage, |
42 EISINameServiceMutexCreateFailed, |
69 EISINameServiceMutexCreateFailed, |
43 EISINameServiceMutexWaitFailed, |
70 EISINameServiceMutexWaitFailed, |
|
71 EISINameServiceSendFailed, |
|
72 EISINameServiceFatalError, |
|
73 #ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
|
74 EISINameServiceWrongLength2, |
|
75 EISINameServiceWrongLength3, |
|
76 EISINameServiceNullPointer3, |
|
77 EISINameServiceNullPointer4, |
|
78 EISINameServiceNullPointer5, |
|
79 EISINameServiceNameCreateFailed, |
|
80 EISINameServiceNameCreateFailed1, |
|
81 EISINameServiceNameCreateFailed2, |
|
82 EISINameServiceNameCreateFailed3, |
|
83 EISINameServiceNameCreateFailed4, |
|
84 EISINameServiceNameCreateFailed5, |
|
85 EISINameServiceNameCreateFailed6, |
|
86 EISINameServiceNameCreateFailed7, |
|
87 EISINameServiceNameCreateFailed8, |
|
88 EISINameServiceNameCreateFailed9, |
|
89 EISINameServiceNameCreateFailed10, |
|
90 EISINameServiceNameCreateFailed11, |
|
91 EISINameServiceNameCreateFailed12, |
|
92 EISINameServiceNameCreateFailed13, |
|
93 EISINameServiceNameCreateFailed14, |
|
94 EISINameServiceNameCreateFailed15, |
|
95 EISINameServiceNameCreateFailed16, |
|
96 EISINameServiceNameCreateFailed17, |
|
97 EISINameServiceNameCreateFailed18, |
|
98 EISINameServiceWrongResponse, |
|
99 EISINameServiceNameExtendedCreateFailed, |
|
100 EISINameServiceExtendedNullPointer, |
|
101 EISINameServiceNameNotCommgrResource, |
|
102 EISINameServiceNameNotCommgrDevice, |
|
103 EISINameServiceLookUpForPhoNetAddressAndFlagsFailed, |
|
104 #endif // ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
44 }; |
105 }; |
45 |
|
46 |
|
47 /* PUTB8 macro writes byte value to given address. |
|
48 * This macro is used mainly by other PUTBXX macros. |
|
49 */ |
|
50 #define PUTB8(p,v) \ |
|
51 {(*(TUint8 *)(p)) = ((TUint8)(v));} |
|
52 |
|
53 |
|
54 /* PUTB16 macro writes 16-bit value in Big Endian format |
|
55 * to given address. 16-bit value is written as two separate |
|
56 * bytes, and so this macro can write 16-bit value to whatever |
|
57 * address, regardless of the processor alignment restrictions |
|
58 */ |
|
59 #define PUTB16(p,v) \ |
|
60 {PUTB8((p),(TUint16)(v)>>8); PUTB8((TUint8*)(p)+1,v);} |
|
61 |
|
62 |
|
63 /* PUTB32 macro writes 32-bit value in Big Endian format |
|
64 * to given address. 32-bit value is written as four separate |
|
65 * bytes, and so this macro can write 32-bit value to whatever |
|
66 * address, regardless of the processor alignment restrictions |
|
67 */ |
|
68 #define PUTB32(p,v) \ |
|
69 {PUTB16((p),(TUint32)(v)>>16); PUTB16((TUint8*)(p)+2,(TUint32)(v));} |
|
70 |
|
71 |
|
72 /** |
|
73 * Big Endian to local endian type |
|
74 */ |
|
75 /* GETB8 macro returns byte value from given address. |
|
76 * This macro is used mainly by other GETBXX macros. |
|
77 */ |
|
78 #define GETB8(p) \ |
|
79 (*(TUint8 *)(p)) |
|
80 |
|
81 |
|
82 /* GETB16 macro reads 16-bit value in Big Endian format |
|
83 * from given address. 16-bit value is read as two separate |
|
84 * bytes, and so this macro can read 16-bit value from whatever |
|
85 * address, regardless of the processor alignment restrictions |
|
86 */ |
|
87 #define GETB16(p) \ |
|
88 (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1)) |
|
89 |
|
90 |
|
91 /* GETB32 macro reads 32-bit value in Big Endian format |
|
92 * from given address. 32-bit value is read as four separate |
|
93 * bytes, and so this macro can read 32-bit value from whatever |
|
94 * address, regardless of the processor alignment restrictions |
|
95 */ |
|
96 #define GETB32(p) \ |
|
97 (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2)) |
|
98 |
|
99 |
106 |
100 const TUint32 KNameServiceUID( 0x2002A5A1 ); |
107 const TUint32 KNameServiceUID( 0x2002A5A1 ); |
101 const TUint8 KFiller( 0 ); |
108 const TUint8 KFiller( 0 ); |
|
109 const TUint8 KAlwaysAssert( 0x00 ); |
|
110 |
|
111 const TUint16 KOneMatch( 0x00001 ); |
102 |
112 |
103 DISINameService* DISINameService::iThisptr = NULL; |
113 DISINameService* DISINameService::iThisptr = NULL; |
104 DMutex* DISINameService::iNameServiceMutex = NULL; |
114 DMutex* DISINameService::iNameServiceMutex = NULL; |
105 _LIT8( KNameServiceMutex, "KNameServiceMutex" ); |
115 _LIT8( KNameServiceMutex, "KNameServiceMutex" ); |
106 |
116 const TUint8 KEightBitShift( 8 ); |
|
117 const TUint8 KSixteenBitShift( 16 ); |
|
118 const TUint8 KDeviceIdentifierPhoNetAddressShift( KEightBitShift ); |
|
119 const TUint16 KUninitializedPhoNetAddress( 0x0000 ); |
|
120 const TUint8 KRouterObjId( 0xFA ); // Only internally agreed inside isi router |
107 |
121 |
108 DISINameService::DISINameService( |
122 DISINameService::DISINameService( |
109 // None |
123 // None |
110 ) |
124 ) |
111 : iObjId( 0x00 ) |
125 : iObjId( 0x00 ) |
112 { |
126 { |
113 C_TRACE( ( _T( "DISINameService::DISINameService 0x%x 0x%x>" ), iObjId, iRouter ) ); |
127 C_TRACE( ( _T( "DISINameService::DISINameService 0x%x 0x%x>" ), iObjId, iRouter ) ); |
114 iRouter = MISIObjectRouterIf::Connect( KNameServiceUID, iObjId, this ); |
|
115 ASSERT_RESET_ALWAYS( iRouter, ( EISINameServiceNullPointer | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
116 iNameRecords = new DNameRecords(); |
128 iNameRecords = new DNameRecords(); |
117 ASSERT_RESET_ALWAYS( iNameRecords, ( EISINameServiceMemAllocFailure | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
129 ASSERT_RESET_ALWAYS( ( iNameRecords ), |
|
130 ( EISINameServiceMemAllocFailure | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
118 TInt err( Kern::MutexCreate( iNameServiceMutex, KNameServiceMutex, KMutexOrdGeneral0 ) ); |
131 TInt err( Kern::MutexCreate( iNameServiceMutex, KNameServiceMutex, KMutexOrdGeneral0 ) ); |
119 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISINameServiceMutexCreateFailed | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
132 ASSERT_RESET_ALWAYS( ( KErrNone == err ), |
|
133 ( EISINameServiceMutexCreateFailed | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
134 iRouter = MISIObjectRouterIf::GetIf(); |
|
135 ASSERT_RESET_ALWAYS( ( iRouter ), |
|
136 ( EISINameServiceNullPointer | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
137 iRouter->Connect( KNameServiceUID, iObjId, this ); |
|
138 C_TRACE( ( _T( "DISINameService::DISINameService 0x%x" ), iObjId ) ); |
|
139 ASSERT_RESET_ALWAYS( ( iObjId == PN_OBJ_ROUTING_REQ ), |
|
140 ( EISINameServiceFatalError | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
141 // Starting from here we add the PN_ROUTER object 'statically' to Name Service |
|
142 TUint32 name = PN_ROUTER; |
|
143 TUint16 phonetAddr = ( ( PN_DEV_OWN << KDeviceIdentifierPhoNetAddressShift ) | KRouterObjId ); |
|
144 TUint8 flags = PN_NAME_NOCHG; |
|
145 err = iNameRecords->AddName( name, phonetAddr, flags ); |
|
146 #ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
|
147 iISINameServiceExtended = new DISINameServiceExtended( this ); |
|
148 ASSERT_RESET_ALWAYS( ( iISINameServiceExtended ), ( EISINameServiceNameExtendedCreateFailed | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
149 #endif // ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
|
150 iThisptr = this; |
120 C_TRACE( ( _T( "DISINameService::DISINameService 0x%x 0x%x<" ), iObjId, iRouter ) ); |
151 C_TRACE( ( _T( "DISINameService::DISINameService 0x%x 0x%x<" ), iObjId, iRouter ) ); |
121 } |
152 } |
122 |
153 |
123 DISINameService::~DISINameService( |
154 DISINameService::~DISINameService( |
124 // None |
155 // None |
128 if( iNameRecords ) |
159 if( iNameRecords ) |
129 { |
160 { |
130 delete iNameRecords; |
161 delete iNameRecords; |
131 iNameRecords = NULL; |
162 iNameRecords = NULL; |
132 } |
163 } |
133 |
164 #ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
|
165 if( iISINameServiceExtended ) |
|
166 { |
|
167 delete iISINameServiceExtended; |
|
168 iISINameServiceExtended = NULL; |
|
169 } |
|
170 #endif |
134 C_TRACE( ( _T( "DISINameService::~DISINameService<" ) ) ); |
171 C_TRACE( ( _T( "DISINameService::~DISINameService<" ) ) ); |
135 } |
172 } |
136 |
173 |
137 |
174 void DISINameService::Receive( |
138 void DISINameService::Receive( const TDesC8& aMessage ) |
175 const TDesC8& aMessage |
|
176 ) |
139 { |
177 { |
140 C_TRACE( ( _T( "DISINameService::Receive 0x%x>" ), &aMessage ) ); |
178 C_TRACE( ( _T( "DISINameService::Receive 0x%x>" ), &aMessage ) ); |
141 TInt err( Kern::MutexWait( *iNameServiceMutex ) ); |
179 // This to be signaled (and only) when send back. |
142 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISINameServiceMutexWaitFailed | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
180 LockNameServiceDMutex(); |
143 TUint8* msgPtr( (TUint8*)aMessage.Ptr() ); |
181 TUint8* msgPtr( (TUint8*)aMessage.Ptr() ); |
144 |
182 TUint32 resource = GetResourceUsedInMessage( aMessage ); |
145 TUint8 resource = msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ]; |
183 if( resource == PN_NAMESERVICE |
146 if( resource == PN_NAMESERVICE ) |
184 ) |
147 { |
185 { |
148 C_TRACE( ( _T( "DISINameService message to PN_NAMESERVICE" ) ) ); |
186 C_TRACE( ( _T( "DISINameService::Receive to PN_NAMESERVICE" ) ) ); |
149 HandlePNSNameMessage( aMessage ); |
187 HandlePnsNameMessage( aMessage ); |
150 } |
188 } |
|
189 |
|
190 // Messages which are to be Resource routed. |
151 else |
191 else |
152 { |
192 { |
153 //RouterByResource( aMessage ); |
193 C_TRACE( ( _T( "DISINameService::Receive to Resource : 0x%x" ),resource ) ); |
154 |
194 TUint16 phoNetAddress( KUninitializedPhoNetAddress ); |
155 C_TRACE( ( _T( "DISINameService message to RESOURCE : %d" ),resource ) ); |
195 TInt32 error = iNameRecords->LookupPhonetAddress( resource, &phoNetAddress ); |
156 //look for nametable by resource in message |
|
157 TUint16 phonetAddress = 0; |
|
158 TInt32 error = iNameRecords->LookupPhonetAddress(resource, &phonetAddress); |
|
159 |
|
160 if( KErrNone == error ) |
196 if( KErrNone == error ) |
161 { |
197 { |
162 //change phonet addr to current message from table entries |
198 // Change phonet addr to current message from table entries. |
163 |
199 msgPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] = (TUint8) ( phoNetAddress >> KEightBitShift ); |
164 |
200 msgPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] = (TUint8) ( phoNetAddress ); |
165 msgPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] = (TUint8)( (phonetAddress & 0xFF00) >> 8); |
201 TDes8* messagePtr = reinterpret_cast<TDes8*>( const_cast<TDesC8*>( &aMessage ) ); |
166 msgPtr[ISI_HEADER_OFFSET_RECEIVEROBJECT] = (TUint8) (phonetAddress & 0xFF); |
202 C_TRACE( ( _T( "DISINameService message to recDev: 0x%x recObj: 0x%x" ), msgPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ], msgPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] ) ); |
167 TDes8* messagePtr = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) ); |
203 SendToRouter( *messagePtr ); |
168 |
|
169 C_TRACE( ( _T( "<-DISINameService message to recDev: 0x%x" ),msgPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] ) ); |
|
170 C_TRACE( ( _T( "<-DISINameService message to recObj: 0x%x" ),msgPtr[ISI_HEADER_OFFSET_RECEIVEROBJECT] ) ); |
|
171 |
|
172 //send data to router for handling |
|
173 iRouter->Send( *messagePtr, iObjId); |
|
174 } |
204 } |
175 else |
205 else |
176 { |
206 { |
177 //construct not reachable resp message |
207 C_TRACE( ( _T( "DISINameService::Receive no Resource found : 0x%x" ), resource ) ); |
178 C_TRACE( ( _T( "DISINameService::Receive **ELSE** !!" ) ) ); |
208 |
|
209 TRACE_ASSERT_ALWAYS( KAlwaysAssert ); |
179 BuildAndSendCommIsaEntityNotReachableResp(aMessage); |
210 BuildAndSendCommIsaEntityNotReachableResp(aMessage); |
180 } |
211 |
181 } |
212 } |
182 Kern::MutexSignal( *iNameServiceMutex ); |
213 } |
183 C_TRACE( ( _T( "DISINameService::DISINameService<" ) ) ); |
214 C_TRACE( ( _T( "DISINameService::Receive 0x%x<" ), &aMessage ) ); |
184 } |
215 } |
185 void DISINameService::HandleNameQueryResp( const TDesC8& aMessage, const TUint8* msgPtr ) |
216 |
186 { |
217 void DISINameService::HandleNameQueryReq( |
187 C_TRACE( ( _T( "DISINameService::HandleNameQueryResp>" ) ) ); |
218 const TDesC8& aPnsNameQueryReq |
|
219 ) |
|
220 { |
|
221 C_TRACE( ( _T( "DISINameService::HandleNameQueryReq 0x%x>" ) ,&aPnsNameQueryReq ) ); |
|
222 const TUint8* msgPtr = aPnsNameQueryReq.Ptr(); |
|
223 ASSERT_RESET_ALWAYS( msgPtr, ( EISINameServiceNullPointer6 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
188 TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_NAME ] ); |
224 TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_NAME ] ); |
189 TUint32 mask = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_BITMASK ] ); |
225 TUint32 mask = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_BITMASK ] ); |
190 RArray <TNameTable*> nameTable; |
226 RArray <TNameTableEntry*> nameTable; |
191 TInt32 count = iNameRecords->NameQuery( name, mask, &nameTable ); |
227 iNameRecords->NameQuery( name, mask, &nameTable ); |
|
228 TUint32 count( nameTable.Count() ); |
|
229 // Hoks! not needed ISI_HEADER_SIZE because in below resp contains assumption that there is one entry always. |
192 TUint16 msgLength = ( SIZE_PNS_NAME_QUERY_RESP + ( count * SIZE_PN_NAME_SRV_ITEM_STR ) ); |
230 TUint16 msgLength = ( SIZE_PNS_NAME_QUERY_RESP + ( count * SIZE_PN_NAME_SRV_ITEM_STR ) ); |
193 TDes8& respMsg = MemApi::AllocBlock( msgLength ); |
231 TDes8& respMsg = MemApi::AllocBlock( msgLength ); |
194 respMsg.SetLength( msgLength ); |
232 respMsg.SetLength( msgLength ); |
195 TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() ); |
233 TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() ); |
196 |
234 ASSERT_RESET_ALWAYS( respPtr, ( EISINameServiceNullPointer7 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
197 respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ]; |
235 SetIsiHeaderForResp( respMsg, aPnsNameQueryReq, PNS_NAME_QUERY_RESP ); |
198 SET_RECEIVER_DEV( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] ); |
236 PUTB16( &respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_TOTALMATCHES ], count ); |
199 SET_SENDER_DEV( respPtr, PN_DEV_OWN ); |
237 PUTB16( &respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_MATCHESINMSG ], count ); |
200 respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
|
201 SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) ); |
|
202 SET_RECEIVER_OBJ( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ] ); |
|
203 SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER ); |
|
204 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_UTID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ]; |
|
205 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_SUBFUNCTION ]= PNS_NAME_QUERY_RESP; |
|
206 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_TOTALMATCHES ] = count >> 8; |
|
207 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_TOTALMATCHES + 1 ] = count; |
|
208 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_MATCHESINMSG ] = count >> 8; |
|
209 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_MATCHESINMSG + 1 ] = count; |
|
210 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_RESERVED1 ] = KFiller; |
238 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_RESERVED1 ] = KFiller; |
211 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_RESERVED2 ] = KFiller; |
239 respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_RESERVED2 ] = KFiller; |
212 |
240 TUint16 index( ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_NAMEENTRYTBL ); |
213 TUint16 index = ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_NAMEENTRYTBL; |
241 C_TRACE( ( _T( "DISINameService::HandleNameQueryReq 0x%x entry count %d" ) ,&aPnsNameQueryReq, count ) ); |
214 for( int i = 0; i < count; i++) |
242 for( TInt i( 0 ); i < count; i++ ) |
215 { |
243 { |
216 //AddNameTable(); |
244 ASSERT_RESET_ALWAYS( ( respMsg.Length() > index + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ), |
217 TNameTable* tmp = (nameTable)[ i ]; |
245 ( EISINameServiceWrongLength7 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
218 |
246 TNameTableEntry* tmp = ( nameTable )[ i ]; |
219 // Name |
247 if ( ( (TUint8)( tmp->iPhonetAddress ) == PN_OBJ_ROUTING_REQ ) && |
220 respPtr[ index++ ] = (TUint8)(tmp->iName >> 24); |
248 ( tmp->iName == name ) ) |
221 respPtr[ index++ ] = (TUint8)(tmp->iName >> 16); |
249 { |
222 respPtr[ index++ ] = (TUint8)(tmp->iName >> 8); |
250 TRACE_ASSERT_ALWAYS( KAlwaysAssert ); |
223 respPtr[ index++ ] = (TUint8)(tmp->iName); |
251 Kern::Printf("PNS_NAME_QUERY_REQ NOTE! Obj Id 0 not valid!! name 0x%08x txDev 0x%02x txObj 0x%02x", name, msgPtr[ISI_HEADER_OFFSET_SENDERDEVICE], msgPtr[ISI_HEADER_OFFSET_SENDEROBJECT] ); |
224 // DevId |
252 } |
225 respPtr[ index++ ] = (TUint8)(tmp->iPhonetAddress >> 8); |
253 PUTB32( &respPtr[ index + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], tmp->iName ); |
226 // ObjId |
254 respPtr[ index + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ] = (TUint8)( tmp->iPhonetAddress >> KEightBitShift ); |
227 respPtr[ index++ ] = (TUint8)(tmp->iPhonetAddress); |
255 respPtr[ index + PN_NAME_SRV_ITEM_STR_OFFSET_OBJ ] = (TUint8)( tmp->iPhonetAddress ); |
228 // Record flags |
256 respPtr[ index + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = tmp->iFlags; |
229 respPtr[ index++ ] = tmp->iFlags; |
257 respPtr[ index + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller; |
230 respPtr[ index++ ] = KFiller; // Reserved |
258 index += SIZE_PN_NAME_SRV_ITEM_STR; |
231 } |
259 } |
232 |
260 SendToRouter( respMsg ); |
233 iRouter->Send( respMsg, iObjId ); |
261 TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aPnsNameQueryReq) ); |
234 TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) ); |
|
235 MemApi::DeallocBlock( *block ); |
262 MemApi::DeallocBlock( *block ); |
236 C_TRACE( ( _T( "DISINameService::HandleNameQueryResp<" ) ) ); |
263 C_TRACE( ( _T( "DISINameService::HandleNameQueryReq 0x%x<" ) ,&aPnsNameQueryReq ) ); |
237 } |
264 } |
238 |
265 |
239 void DISINameService::HandleNameRemoveResp( const TDesC8& aMessage, const TUint8* msgPtr ) |
266 void DISINameService::HandleNameRemoveReq( |
240 { |
267 const TDesC8& aPnsNameRemoveReq |
241 C_TRACE( ( _T( "DISINameService::HandleNameRemoveResp>" ) ) ); |
268 ) |
|
269 { |
|
270 C_TRACE( ( _T( "DISINameService::HandleNameRemoveReq 0x%x>" ), &aPnsNameRemoveReq ) ); |
|
271 const TUint8* msgPtr = aPnsNameRemoveReq.Ptr(); |
|
272 ASSERT_RESET_ALWAYS( msgPtr, ( EISINameServiceNullPointer8 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
242 TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_REQ_OFFSET_NAME ] ); |
273 TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_REQ_OFFSET_NAME ] ); |
243 |
274 TUint16 phonetAddress( KUninitializedPhoNetAddress ); |
244 TInt8 err = iNameRecords->RemoveName( name ); |
275 TUint8 flags( 0x00 ); |
245 C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_RESP 0x%x>" ), name ) ); |
276 // Need to get these values in here to guarantee that they are the same in IND if needed. |
246 |
277 TInt error = iNameRecords->LookupNamePhonetAddressAndFlags( name, &phonetAddress, &flags ); |
|
278 TRACE_ASSERT_ALWAYS( ( KErrNone == error ) ); |
|
279 const TUint8 err = iNameRecords->RemoveName( name ); |
|
280 C_TRACE( ( _T( "DISINameService::HandleNameRemoveReq PNS_NAME_REMOVE_RESP name 0x%x err 0x%x" ), name, err ) ); |
247 TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_REMOVE_RESP ); |
281 TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_REMOVE_RESP ); |
248 TDes8& respMsg = MemApi::AllocBlock( msgLength ); |
282 TDes8& respMsg = MemApi::AllocBlock( msgLength ); |
249 respMsg.SetLength( msgLength ); |
283 respMsg.SetLength( msgLength ); |
250 TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() ); |
284 TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() ); |
251 |
285 ASSERT_RESET_ALWAYS( respPtr, ( EISINameServiceNullPointer9 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
252 respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ]; |
286 ASSERT_RESET_ALWAYS( ( respMsg.Length() > ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_REASON ), |
253 SET_RECEIVER_DEV( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] ); |
287 ( EISINameServiceWrongLength6 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
254 SET_SENDER_DEV( respPtr, PN_DEV_OWN ); |
288 SetIsiHeaderForResp( respMsg, aPnsNameRemoveReq, PNS_NAME_REMOVE_RESP ); |
255 respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
|
256 SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) ); |
|
257 SET_RECEIVER_OBJ( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ] ); |
|
258 SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER ); |
|
259 respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_UTID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ]; |
|
260 respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_SUBFUNCTION ] = PNS_NAME_REMOVE_RESP; |
|
261 if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) |
289 if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) |
262 { |
290 { |
|
291 C_TRACE( ( _T( "DISINameService::HandleNameRemoveReq from own device err 0x%x" ) ) ); |
263 respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_REASON ] = err; |
292 respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_REASON ] = err; |
264 iRouter->Send( respMsg, iObjId ); |
293 SendToRouter( respMsg ); |
265 |
|
266 if( PN_NAME_OK == err ) |
294 if( PN_NAME_OK == err ) |
267 { |
295 { |
268 C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_IND>" ) ) ); |
296 TxPnsNameRemoveInd( aPnsNameRemoveReq, name, phonetAddress, flags ); |
269 msgLength = ( SIZE_PNS_NAME_REMOVE_IND + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL ); |
297 } |
270 TDes8& indMsg = MemApi::AllocBlock( msgLength ); |
298 // No need to send indication if removal did not succeed as state is the same. |
271 indMsg.SetLength( msgLength ); |
|
272 TUint8* indPtr = const_cast<TUint8*>( indMsg.Ptr() ); |
|
273 |
|
274 indPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; |
|
275 SET_RECEIVER_DEV( indPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] ); |
|
276 SET_SENDER_DEV( indPtr, PN_DEV_OWN ); |
|
277 indPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
|
278 SET_LENGTH( indPtr, ( msgLength - PN_HEADER_SIZE ) ); |
|
279 SET_RECEIVER_OBJ( indPtr, PN_OBJ_EVENT_MULTICAST ); //communicationmanager |
|
280 SET_SENDER_OBJ( indPtr, PN_OBJ_ROUTER ); |
|
281 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_UTID ] = 0x00; |
|
282 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_SUBFUNCTION ]= PNS_NAME_REMOVE_IND; |
|
283 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_TOTALMATCHES ] = 0x00; |
|
284 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_TOTALMATCHES + 1 ] = 0x01; |
|
285 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_MATCHESINMSG ] = 0x00; |
|
286 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_MATCHESINMSG + 1 ] = 0x01; |
|
287 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_RESERVED1 ] = KFiller; |
|
288 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_RESERVED2 ] = KFiller; |
|
289 PUTB32( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], name ); |
|
290 |
|
291 iRouter->Send( indMsg, iObjId ); |
|
292 TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) ); |
|
293 MemApi::DeallocBlock( *block ); |
|
294 C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_IND<" ) ) ); |
|
295 } |
|
296 C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_RESP<" ) ) ); |
|
297 } |
299 } |
298 else |
300 else |
299 { |
301 { |
300 C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage PNS_NAME_REMOVE_REQ from other device, PN_NAME_NOT_ALLOWED" ) ) ); |
302 C_TRACE( ( _T( "DISINameService::HandleNameRemoveReq PNS_NAME_REMOVE_REQ from other device not allowed" ) ) ); |
301 respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_REASON ] = PN_NAME_NOT_ALLOWED; |
303 respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_REASON ] = PN_NAME_NOT_ALLOWED; |
302 iRouter->Send( respMsg, iObjId ); |
304 SendToRouter( respMsg ); |
303 } |
305 } |
304 C_TRACE( ( _T( "DISINameService::HandleNameRemoveResp<" ) ) ); |
306 TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aPnsNameRemoveReq) ); |
305 } |
307 MemApi::DeallocBlock( *block ); |
306 |
308 C_TRACE( ( _T( "DISINameService::HandleNameRemoveReq 0x%x<" ), &aPnsNameRemoveReq ) ); |
307 void DISINameService::HandlePNSNameMessage( const TDesC8& aMessage ) |
309 } |
308 { |
310 |
309 C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage 0x%x>" ), &aMessage ) ); |
311 void DISINameService::SendToRouter( |
|
312 TDes8& aMessage |
|
313 ) |
|
314 { |
|
315 C_TRACE( ( _T( "DISINameService::SendToRouter 0x%x>" ), &aMessage ) ); |
|
316 FreeNameServiceDMutex(); |
|
317 TInt value = iRouter->Send( aMessage, iObjId ); |
|
318 ASSERT_RESET_ALWAYS( value == KErrNone, ( EISINameServiceSendFailed | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
319 C_TRACE( ( _T( "DISINameService::SendToRouter 0x%x<" ), &aMessage ) ); |
|
320 } |
|
321 |
|
322 void DISINameService::HandlePnsNameMessage( const TDesC8& aMessage ) |
|
323 { |
|
324 C_TRACE( ( _T( "DISINameService::HandlePnsNameMessage 0x%x>" ), &aMessage ) ); |
310 const TUint8* msgPtr( aMessage.Ptr() ); |
325 const TUint8* msgPtr( aMessage.Ptr() ); |
311 TInt8 err( KErrArgument ); |
|
312 switch( msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] ) |
326 switch( msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] ) |
313 { |
327 { |
314 case PNS_NAME_QUERY_REQ: |
328 case PNS_NAME_QUERY_REQ: |
315 { |
329 { |
316 C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_REQ>" ) ) ); |
330 C_TRACE( ( _T( "DISINameService::HandlePnsNameMessage PNS_NAME_QUERY_REQ" ) ) ); |
317 HandleNameQueryResp( aMessage, msgPtr ); |
331 HandleNameQueryReq( aMessage ); |
318 C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_REQ<" ) ) ); |
|
319 break; |
332 break; |
320 } |
333 } |
321 case PNS_NAME_ADD_REQ: |
334 case PNS_NAME_ADD_REQ: |
322 { |
335 { |
323 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ>" ) ) ); |
336 C_TRACE( ( _T( "DISINameService::HandlePnsNameMessage PNS_NAME_ADD_REQ" ) ) ); |
324 |
337 HandleNameAddReq( aMessage ); |
325 TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_RESP ); |
|
326 TDes8& respMsg = MemApi::AllocBlock( msgLength ); |
|
327 respMsg.SetLength( msgLength ); |
|
328 TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() ); |
|
329 |
|
330 respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ]; |
|
331 SET_RECEIVER_DEV( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] ); |
|
332 SET_SENDER_DEV( respPtr, PN_DEV_OWN ); |
|
333 respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
|
334 SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) ); |
|
335 SET_RECEIVER_OBJ( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ] ); |
|
336 SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER ); |
|
337 respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_UTID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ]; |
|
338 respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_SUBFUNCTION ] = PNS_NAME_ADD_RESP; |
|
339 |
|
340 if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) |
|
341 { |
|
342 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ from this device" ) ) ); |
|
343 TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY ] ); |
|
344 TUint16 phonetAddr = GETB16( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ] ); |
|
345 TUint8 flags = msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ]; |
|
346 err = iNameRecords->AddName( name, phonetAddr, flags ); |
|
347 respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] = err; |
|
348 iRouter->Send( respMsg, iObjId ); |
|
349 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_RESP from this device<" ) ) ); |
|
350 if( err == PN_NAME_OK ) |
|
351 { |
|
352 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_IND>" ) ) ); |
|
353 msgLength = ( SIZE_PNS_NAME_ADD_IND + ( SIZE_PN_NAME_SRV_ITEM_STR ) ); |
|
354 TDes8& indMsg = MemApi::AllocBlock( msgLength ); |
|
355 indMsg.SetLength( msgLength ); |
|
356 TUint8* indPtr = const_cast<TUint8*>( indMsg.Ptr() ); |
|
357 indPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; |
|
358 SET_RECEIVER_DEV( indPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] ); |
|
359 SET_SENDER_DEV( indPtr, PN_DEV_OWN ); |
|
360 indPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
|
361 SET_LENGTH( indPtr, ( msgLength - PN_HEADER_SIZE ) ); |
|
362 SET_RECEIVER_OBJ( indPtr, PN_OBJ_EVENT_MULTICAST ); //communicationmanager |
|
363 SET_SENDER_OBJ( indPtr, PN_OBJ_ROUTER ); |
|
364 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_UTID ] = 0x00; |
|
365 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ]= PNS_NAME_ADD_IND; |
|
366 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_TOTALMATCHES ] = 0x00; |
|
367 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_TOTALMATCHES + 1 ] = 0x01; |
|
368 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_MATCHESINMSG ] = 0x00; |
|
369 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_MATCHESINMSG + 1 ] = 0x01; |
|
370 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_RESERVED1 ] = KFiller; |
|
371 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_RESERVED2 ] = KFiller; |
|
372 PUTB32( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], name ); |
|
373 PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ], phonetAddr ); |
|
374 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = flags; |
|
375 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller; |
|
376 iRouter->Send( indMsg, iObjId ); |
|
377 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_IND<" ) ) ); |
|
378 } |
|
379 } |
|
380 else |
|
381 { |
|
382 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ from other device>" ) ) ); |
|
383 respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] = PN_NAME_NOT_ALLOWED; |
|
384 iRouter->Send( respMsg, iObjId ); |
|
385 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_RESP from other device<" ) ) ); |
|
386 } |
|
387 TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) ); |
|
388 MemApi::DeallocBlock( *block ); |
|
389 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ<" ) ) ); |
|
390 break; |
338 break; |
391 } |
339 } |
392 case PNS_NAME_REMOVE_REQ: |
340 case PNS_NAME_REMOVE_REQ: |
393 { |
341 { |
394 C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_REQ>" ) ) ); |
342 C_TRACE( ( _T( "DISINameService::HandlePnsNameMessage PNS_NAME_REMOVE_REQ" ) ) ); |
395 HandleNameRemoveResp( aMessage, msgPtr ); |
343 HandleNameRemoveReq( aMessage ); |
396 C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_REQ<" ) ) ); |
|
397 break; |
344 break; |
398 } |
345 } |
|
346 case COMMON_MESSAGE: |
|
347 { |
|
348 C_TRACE( ( _T( "DISINameService::HandlePnsNameMessage COMMON_MESSAGE" ) ) ); |
|
349 HandleCommonMessage( aMessage ); |
|
350 break; |
|
351 } |
399 default: |
352 default: |
400 { |
353 { |
401 ASSERT_RESET_ALWAYS( 0, ( EISINameServiceUnknownMessage | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
354 TRACE_ASSERT_ALWAYS( KAlwaysAssert ); |
402 C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage unknown NAMESERVICE message" ) ) ); |
355 TDes8& commonMessage = reinterpret_cast<TDes8&>( const_cast<TDesC8&>( aMessage ) ); |
403 } |
356 SendCommServiceNotIdentifiedResp( commonMessage ); |
404 } |
357 C_TRACE( ( _T( "DISINameService::HandlePnsNameMessage unknown NAMESERVICE message" ) ) ); |
405 C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage<" ) ) ); |
358 } |
406 } |
359 } |
407 |
360 C_TRACE( ( _T( "DISINameService::HandlePnsNameMessage 0x%x<" ), &aMessage ) ); |
|
361 } |
|
362 |
|
363 void DISINameService::HandleNameAddReq( |
|
364 const TDesC8& aPnsNameAddReq |
|
365 ) |
|
366 { |
|
367 C_TRACE( ( _T( "DISINameService::HandleNameAddReq 0x%x>" ), &aPnsNameAddReq ) ); |
|
368 TInt err( KErrArgument ); |
|
369 TUint16 respMsgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_RESP ); |
|
370 TDes8& respMsg = MemApi::AllocBlock( respMsgLength ); |
|
371 respMsg.SetLength( respMsgLength ); |
|
372 TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() ); |
|
373 const TUint8* msgPtr = const_cast<TUint8*>( aPnsNameAddReq.Ptr() ); |
|
374 SetIsiHeaderForResp( respMsg, aPnsNameAddReq, PNS_NAME_ADD_RESP ); |
|
375 if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) |
|
376 { |
|
377 C_TRACE( ( _T( "DISINameService::HandleNameAddReq PNS_NAME_ADD_REQ from this device" ) ) ); |
|
378 TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY ] ); |
|
379 TUint16 phonetAddr = GETB16( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ] ); |
|
380 TUint8 flags = msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ]; |
|
381 err = iNameRecords->AddName( name, phonetAddr, flags ); |
|
382 respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] = err; |
|
383 SendToRouter( respMsg ); |
|
384 if( err == PN_NAME_OK ) |
|
385 { |
|
386 TxPnsNameAddInd( aPnsNameAddReq, name, phonetAddr, flags ); |
|
387 } |
|
388 // No need for else as state is not changed and indication is not needed to send. |
|
389 } |
|
390 else |
|
391 { |
|
392 C_TRACE( ( _T( "DISINameService::HandleNameAddReq PNS_NAME_ADD_REQ from other device" ) ) ); |
|
393 respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] = PN_NAME_NOT_ALLOWED; |
|
394 SendToRouter( respMsg ); |
|
395 } |
|
396 TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aPnsNameAddReq) ); |
|
397 MemApi::DeallocBlock( *block ); |
|
398 C_TRACE( ( _T( "DISINameService::HandleNameAddReq 0x%x<" ), &aPnsNameAddReq ) ); |
|
399 } |
408 |
400 |
409 EXPORT_C TBool MISICommunicationManagerIf::IsValidResource( |
401 EXPORT_C TBool MISICommunicationManagerIf::IsValidResource( |
410 const TDesC8& aMessage |
402 const TDesC8& aMessage |
411 ) |
403 ) |
412 { |
404 { |
413 C_TRACE( ( _T( "DISINameService::IsValidResource 0x%x>" ), &aMessage ) ); |
405 C_TRACE( ( _T( "MISICommunicationManagerIf::IsValidResource 0x%x>" ), &aMessage ) ); |
414 TInt err( Kern::MutexWait( *DISINameService::iThisptr->iNameServiceMutex ) ); |
406 DISINameService* self = DISINameService::GetISINameServiceF(); |
415 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISINameServiceMutexWaitFailed | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
407 TBool found = self->HandleResourceValidationCheck( aMessage ); |
416 TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() ); |
408 C_TRACE( ( _T( "MISICommunicationManagerIf::IsValidResource 0x%x %d<" ), &aMessage, found ) ); |
417 TUint16 phonetAddress( 0 ); |
409 return found; |
418 DISINameService::iThisptr->iNameRecords->LookupPhonetAddress( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ], &phonetAddress ); |
410 } |
419 Kern::MutexSignal( *DISINameService::iThisptr->iNameServiceMutex ); |
411 |
420 if( phonetAddress == GET_SENDER_OBJ( aMessage ) ) |
412 EXPORT_C TUint8 MISICommunicationManagerIf::GetDeviceIdentifierByResource( |
421 { |
413 const TUint32 aResourceIdentifier |
422 C_TRACE( ( _T( "DISINameService::IsValidResource phonetAddress found 0x%x" ), phonetAddress ) ); |
414 ) |
423 return ETrue; |
415 { |
424 } |
416 C_TRACE( ( _T( "MISICommunicationManagerIf::GetDeviceIdentifierByResource 0x%x>" ), aResourceIdentifier ) ); |
425 else |
417 DISINameService* self = DISINameService::GetISINameServiceF(); |
426 { |
418 TUint8 deviceIdentifier = self->GetDeviceIdByResource( aResourceIdentifier ); |
427 C_TRACE( ( _T( "DISINameService::IsValidResource phonetAddress not found 0x%x" ), phonetAddress ) ); |
419 C_TRACE( ( _T( "MISICommunicationManagerIf::GetDeviceIdentifierByResource 0x%x 0x%x<" ), aResourceIdentifier, deviceIdentifier ) ); |
428 return EFalse; |
420 return deviceIdentifier; |
429 } |
421 } |
430 } |
|
431 |
|
432 |
422 |
433 DECLARE_STANDARD_EXTENSION() |
423 DECLARE_STANDARD_EXTENSION() |
434 { |
424 { |
435 Kern::Printf( "ISI Name Service extension>" ); |
425 Kern::Printf( "ISI Name Service extension>" ); |
436 // Create a container extension |
426 // Create a container extension |
437 DISINameService* extension = new DISINameService(); |
427 DISINameService* extension = new DISINameService(); |
438 TRACE_ASSERT( extension ); |
428 TRACE_ASSERT( extension ); |
439 DISINameService::iThisptr = static_cast< DISINameService* >( extension ); |
|
440 Kern::Printf( "ISI Name Service extension<" ); |
429 Kern::Printf( "ISI Name Service extension<" ); |
441 return extension ? KErrNone : KErrNoMemory; |
430 return extension ? KErrNone : KErrNoMemory; |
442 } |
431 } |
443 |
432 |
444 void DISINameService::BuildAndSendCommIsaEntityNotReachableResp( |
433 void DISINameService::BuildAndSendCommIsaEntityNotReachableResp( |
445 const TDesC8& aMsg |
434 const TDesC8& aMsg |
446 ) |
435 ) |
447 { |
436 { |
448 C_TRACE( ( _T( "DISINameService::ConstructCommIsaEntityNotReachableResp 0x%x ->" ), &aMsg ) ); |
437 C_TRACE( ( _T( "DISINameService::ConstructCommIsaEntityNotReachableResp 0x%x>" ), &aMsg ) ); |
449 // Make channel opening request followinfg COMM specification: 000.026 |
438 // Make channel opening request followinfg COMM specification: 000.026 |
450 // Length is sixteen bytes. |
|
451 TUint8 length( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP ); |
439 TUint8 length( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP ); |
452 TDes8& tempPtr = MemApi::AllocBlock( length ); |
440 TDes8& tempPtr = MemApi::AllocBlock( length ); |
453 ASSERT_RESET_ALWAYS( &tempPtr, EISINameServiceMemAllocFailure ); //lisää jotakin infoa jotta löytyy ilman tracea...pelkän luvun perusteella?? |
441 ASSERT_RESET_ALWAYS( &tempPtr, EISINameServiceMemAllocFailure ); //lisää jotakin infoa jotta löytyy ilman tracea...pelkän luvun perusteella?? |
454 TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() ); |
442 TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() ); |
455 // We start to append from transaction id. |
443 // We start to append from transaction id. |
462 SET_SENDER_DEV ( ptr, GET_RECEIVER_DEV( aMsg ) ); |
450 SET_SENDER_DEV ( ptr, GET_RECEIVER_DEV( aMsg ) ); |
463 ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = msgTmpPtr[ ISI_HEADER_OFFSET_RESOURCEID ]; |
451 ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = msgTmpPtr[ ISI_HEADER_OFFSET_RESOURCEID ]; |
464 SET_LENGTH( ptr, length - PN_HEADER_SIZE ); |
452 SET_LENGTH( ptr, length - PN_HEADER_SIZE ); |
465 SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMsg ) ); |
453 SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMsg ) ); |
466 SET_SENDER_OBJ( ptr, GET_RECEIVER_OBJ( aMsg ) ); |
454 SET_SENDER_OBJ( ptr, GET_RECEIVER_OBJ( aMsg ) ); |
467 // Transactionid. Set to 0x01 since this is the first. |
455 // Transactionid. |
468 tempPtr.Append( msgTmpPtr[ ISI_HEADER_OFFSET_TRANSID ] ); |
456 tempPtr.Append( msgTmpPtr[ ISI_HEADER_OFFSET_TRANSID ] ); |
469 // Message ID |
457 // Message ID |
470 tempPtr.Append( COMMON_MESSAGE ); // 0xF0 |
458 tempPtr.Append( COMMON_MESSAGE ); // 0xF0 |
471 // Sub message ID. |
459 // Sub message ID. |
472 tempPtr.Append( COMM_ISA_ENTITY_NOT_REACHABLE_RESP ); // 0x14 |
460 tempPtr.Append( COMM_ISA_ENTITY_NOT_REACHABLE_RESP ); // 0x14 |
473 // Not Delivered Message from original req. |
461 // Not Delivered Message from original req. |
474 tempPtr.Append( msgTmpPtr[ ISI_HEADER_OFFSET_MESSAGEID ] ); |
462 tempPtr.Append( msgTmpPtr[ ISI_HEADER_OFFSET_MESSAGEID ] ); |
475 // Status - COMM_ISA_ENTITY_NOT_EXISTING |
463 // Status - COMM_ISA_ENTITY_NOT_EXISTING |
476 tempPtr.Append( COMM_ISA_ENTITY_NOT_EXISTING); //0x01 |
464 tempPtr.Append( COMM_ISA_ENTITY_NOT_EXISTING); //0x01 |
477 // Filler |
465 // Filler |
478 tempPtr.Append( 0x00 ); |
466 tempPtr.Append( KFiller ); |
479 // Filler |
467 // Filler |
480 tempPtr.Append( 0x00 ); |
468 tempPtr.Append( KFiller ); |
481 // Filler |
469 // Filler |
482 tempPtr.Append( 0x00 ); |
470 tempPtr.Append( KFiller ); |
483 |
|
484 //send data to router for handling |
471 //send data to router for handling |
485 iRouter->Send( tempPtr, iObjId); |
472 SendToRouter( tempPtr ); |
486 |
|
487 TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMsg) ); |
473 TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMsg) ); |
488 MemApi::DeallocBlock( *block ); |
474 MemApi::DeallocBlock( *block ); |
489 C_TRACE( ( _T( "DISINameService::SendCommIsaEntityNotReachableResp 0x%x <-" ), &aMsg ) ); |
475 C_TRACE( ( _T( "DISINameService::SendCommIsaEntityNotReachableResp 0x%x<" ), &aMsg ) ); |
490 } |
476 } |
491 |
477 |
492 |
478 void DISINameService::HandleCommonMessage( |
|
479 const TDesC8& aCommonMessage |
|
480 ) |
|
481 { |
|
482 |
|
483 C_TRACE( ( _T( "DISINameService::HandleCommonMessage 0x%x>" ), &aCommonMessage ) ); |
|
484 TDes8& commonMessage = reinterpret_cast<TDes8&>( const_cast<TDesC8&>(aCommonMessage) ); |
|
485 const TUint8 subMessageIdentifier = commonMessage.Ptr()[ ISI_HEADER_OFFSET_SUBMESSAGEID ]; |
|
486 switch( subMessageIdentifier ) |
|
487 { |
|
488 case COMM_ISA_ENTITY_NOT_REACHABLE_RESP: |
|
489 { |
|
490 const TUint8 notDeliveredMessageIndex = ( ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP_OFFSET_NOTDELIVEREDMESSAGEID ); |
|
491 const TUint8 notDeliveredMessageIdentifier = commonMessage.Ptr()[ notDeliveredMessageIndex ]; |
|
492 // If some of name service _RESP worryig behaviour from client. If _IND it does not matter so much, although unsubscription for indications is not working then. |
|
493 C_TRACE( ( _T( "DISINameService::HandleCommonMessage COMM_ISA_ENTITY_NOT_REACHABLE_RESP not delivered message 0x%x" ), notDeliveredMessageIdentifier ) ); |
|
494 TRACE_ASSERT_ALWAYS( KAlwaysAssert ); |
|
495 // Dellocate here, because this is not sending a reply at all to avoid never ending loop. |
|
496 MemApi::DeallocBlock( commonMessage ); |
|
497 // Signal here because it does not send a reply. |
|
498 FreeNameServiceDMutex(); |
|
499 break; |
|
500 } |
|
501 case COMM_ISI_VERSION_GET_REQ: |
|
502 { |
|
503 C_TRACE( ( _T( "DISINameService::HandleCommonMessage version get req" ) ) ); |
|
504 SendCommIsiVersionGetResp( commonMessage ); |
|
505 break; |
|
506 } |
|
507 default: |
|
508 { |
|
509 C_TRACE( ( _T( "DISINameService::HandleCommonMessage unknown common message" ) ) ); |
|
510 TRACE_ASSERT_ALWAYS( KAlwaysAssert ); |
|
511 SendCommServiceNotIdentifiedResp( commonMessage ); |
|
512 break; |
|
513 } |
|
514 } |
|
515 C_TRACE( ( _T( "DISINameService::HandleCommonMessage 0x%x<" ), &aCommonMessage ) ); |
|
516 } |
|
517 |
|
518 void DISINameService::SendCommServiceNotIdentifiedResp( |
|
519 TDes8& aCommServiceNotIdentifiedReq |
|
520 ) |
|
521 { |
|
522 C_TRACE( ( _T( "DISINameService::SendCommServiceNotIdentifiedResp 0x%x>" ), &aCommServiceNotIdentifiedReq ) ); |
|
523 TUint8 length( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP ); |
|
524 TDes8& respMsg = MemApi::AllocBlock( length ); |
|
525 respMsg.SetLength(ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP ); |
|
526 TUint8* ptr( const_cast<TUint8*>( respMsg.Ptr() ) ); |
|
527 ASSERT_RESET_ALWAYS( ptr, ( EISINameServiceNullPointer1 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
528 ASSERT_RESET_ALWAYS( ( respMsg.Length() >= (ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE2) ), |
|
529 ( EISINameServiceWrongLength | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
530 const TUint8* msgPtr( aCommServiceNotIdentifiedReq.Ptr() ); |
|
531 SetIsiHeaderForCommonResp( respMsg, aCommServiceNotIdentifiedReq ); |
|
532 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_SUBMESSAGEID ] = COMM_SERVICE_NOT_IDENTIFIED_RESP; |
|
533 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDMESSAGEID ] = msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ]; |
|
534 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_MESSAGEEXTENSION ] = KNoExtension; |
|
535 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDSUBMESSAGEID ] = msgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ]; |
|
536 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE1 ] = KFiller; |
|
537 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE2 ] = KFiller; |
|
538 SendToRouter( respMsg ); |
|
539 MemApi::DeallocBlock( aCommServiceNotIdentifiedReq ); |
|
540 C_TRACE( ( _T( "DISINameService::SendCommServiceNotIdentifiedResp 0x%x<" ), &aCommServiceNotIdentifiedReq ) ); |
|
541 } |
|
542 |
|
543 void DISINameService::SendCommIsiVersionGetResp( |
|
544 TDes8& aCommIsiVersionGetReq |
|
545 ) |
|
546 { |
|
547 C_TRACE( ( _T( "DISINameService::SendCommIsiVersionGetResp 0x%x>" ), &aCommIsiVersionGetReq ) ); |
|
548 TUint8 length( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP ); |
|
549 TDes8& respMsg = MemApi::AllocBlock( length ); |
|
550 respMsg.SetLength(ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP); |
|
551 TUint8* ptr( const_cast<TUint8*>( respMsg.Ptr() ) ); |
|
552 ASSERT_RESET_ALWAYS( ptr, ( EISINameServiceNullPointer2 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
553 ASSERT_RESET_ALWAYS( ( respMsg.Length() >= (ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3) ), |
|
554 ( EISINameServiceWrongLength1 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
555 const TUint8* msgPtr( aCommIsiVersionGetReq.Ptr() ); |
|
556 SetIsiHeaderForCommonResp( respMsg, aCommIsiVersionGetReq ); |
|
557 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_SUBMESSAGEID ] = COMM_ISI_VERSION_GET_RESP; |
|
558 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONZZZ ] = NAME_SERVICE_ISI_VERSION_Z; |
|
559 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONYYY ] = NAME_SERVICE_ISI_VERSION_Y; |
|
560 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE1 ] = KFiller; |
|
561 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE2 ] = KFiller; |
|
562 ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3 ] = KFiller; |
|
563 SendToRouter( respMsg ); |
|
564 MemApi::DeallocBlock( aCommIsiVersionGetReq ); |
|
565 C_TRACE( ( _T( "DISINameService::SendCommIsiVersionGetResp 0x%x<" ), &aCommIsiVersionGetReq ) ); |
|
566 } |
|
567 |
|
568 void DISINameService::LockNameServiceDMutex() |
|
569 { |
|
570 C_TRACE( ( _T( "DISINameService::LockNameServiceDMutex 0x%x>" ), &iNameServiceMutex ) ); |
|
571 TInt err( Kern::MutexWait( *iNameServiceMutex ) ); |
|
572 ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISINameServiceMutexWaitFailed | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
573 C_TRACE( ( _T( "DISINameService::LockNameServiceDMutex 0x%x<" ), &iNameServiceMutex ) ); |
|
574 } |
|
575 |
|
576 void DISINameService::FreeNameServiceDMutex() |
|
577 { |
|
578 C_TRACE( ( _T( "DISINameService::FreeNameServiceDMutex 0x%x>" ), &iNameServiceMutex ) ); |
|
579 Kern::MutexSignal( *iNameServiceMutex ); |
|
580 C_TRACE( ( _T( "DISINameService::FreeNameServiceDMutex 0x%x<" ), &iNameServiceMutex ) ); |
|
581 } |
|
582 |
|
583 TBool DISINameService::HandleResourceValidationCheck( |
|
584 const TDesC8& aMessage |
|
585 ) |
|
586 { |
|
587 C_TRACE( ( _T( "DISINameService::HandleResourceValidationCheck 0x%x>" ), &aMessage ) ); |
|
588 LockNameServiceDMutex(); |
|
589 TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() ); |
|
590 TUint16 phonetAddress( KUninitializedPhoNetAddress ); |
|
591 // Extended resource identifier support for NameService |
|
592 TUint32 resource = GetResourceUsedInMessage( aMessage ); |
|
593 iNameRecords->LookupPhonetAddress( resource, &phonetAddress ); |
|
594 FreeNameServiceDMutex(); |
|
595 TBool found( EFalse ); |
|
596 TUint16 phonetAddressFromMsg = ( ( GET_SENDER_DEV( msgPtr ) << KDeviceIdentifierPhoNetAddressShift ) | GET_SENDER_OBJ( msgPtr ) ); |
|
597 if( phonetAddress == phonetAddressFromMsg ) |
|
598 { |
|
599 C_TRACE( ( _T( "DISINameService::IsValidResource phonetAddress found 0x%x" ), phonetAddress ) ); |
|
600 found = ETrue; |
|
601 } |
|
602 // No need for else, assert tells that somebody violates indication sending |
|
603 TRACE_ASSERT( found ); |
|
604 C_TRACE( ( _T( "DISINameService::HandleResourceValidationCheck 0x%x %d<" ), &aMessage, found ) ); |
|
605 return found; |
|
606 } |
|
607 |
|
608 // Extended resource identifier support for NameService |
|
609 TUint32 DISINameService::GetResourceUsedInMessage( |
|
610 const TDesC8& aMessageToBeResourceRouted |
|
611 ) |
|
612 { |
|
613 C_TRACE( ( _T( "DISINameService::GetResourceUsedInMessage 0x%x>" ), &aMessageToBeResourceRouted ) ); |
|
614 const TUint8* msgPtr( aMessageToBeResourceRouted.Ptr() ); |
|
615 ASSERT_RESET_ALWAYS( ( msgPtr ), |
|
616 ( EISINameServiceNullPointer11 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
617 TUint32 resource = msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ]; |
|
618 #ifdef ISCE_INTERNAL_EXTENDED_RESOURCE_ROUTING_SUPPORTED |
|
619 // Extended Resource Routing |
|
620 if( PN_PREFIX == msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] ) |
|
621 { |
|
622 C_TRACE( ( _T( "DISINameService::GetResourceUsedInMessage 0x%x extended resource 0x%x" ), &aMessageToBeResourceRouted, resource ) ); |
|
623 resource = ( resource | (TUint32)( msgPtr[ ISI_HEADER_OFFSET_TYPE ] << KEightBitShift ) ); |
|
624 resource = ( resource | (TUint32)( msgPtr[ ISI_HEADER_OFFSET_SUBTYPE ] << KSixteenBitShift ) ); |
|
625 } |
|
626 |
|
627 #endif // ISCE_INTERNAL_EXTENDED_RESOURCE_ROUTING_SUPPORTED |
|
628 // No need for else as first 8 bits are already used. |
|
629 C_TRACE( ( _T( "DISINameService::GetResourceUsedInMessage 0x%x resource 0x%x<" ), &aMessageToBeResourceRouted, resource ) ); |
|
630 return resource; |
|
631 } |
|
632 |
|
633 TUint8 DISINameService::GetDeviceIdByResource( |
|
634 const TUint32 aResourceIdentifier |
|
635 ) |
|
636 { |
|
637 C_TRACE( ( _T( "DISINameService::GetDeviceIdByResource 0x%x>" ), aResourceIdentifier ) ); |
|
638 TUint8 deviceIdentifier = PN_DEV_OWN; |
|
639 #ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
|
640 C_TRACE( ( _T( "DISINameService::GetDeviceIdByResource 0x%x ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE" ), aResourceIdentifier ) ); |
|
641 LockNameServiceDMutex(); |
|
642 TUint16 phonetAddress( KUninitializedPhoNetAddress ); |
|
643 TUint32 result = iNameRecords->LookupPhonetAddress( aResourceIdentifier, &phonetAddress ); |
|
644 FreeNameServiceDMutex(); |
|
645 if( result == KErrNone ) |
|
646 { |
|
647 C_TRACE( ( _T( "DISINameService::GetDeviceIdByResource 0x%x old device 0x%x phonetAddress 0x%x" ), aResourceIdentifier, deviceIdentifier, phonetAddress ) ); |
|
648 deviceIdentifier = ( (TUint8)( phonetAddress >> KEightBitShift ) ); |
|
649 C_TRACE( ( _T( "DISINameService::GetDeviceIdByResource 0x%x new device 0x%x phonetAddress 0x%x" ), aResourceIdentifier, deviceIdentifier, phonetAddress ) ); |
|
650 } |
|
651 #endif // ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
|
652 // No need for else as going to default |
|
653 C_TRACE( ( _T( "DISINameService::GetDeviceIdByResource 0x%x 0x%x<" ), aResourceIdentifier, deviceIdentifier ) ); |
|
654 return deviceIdentifier; |
|
655 } |
|
656 |
|
657 void DISINameService::TxPnsNameAddInd( |
|
658 const TDesC8& aPnsNameAddReq, |
|
659 const TUint32 aName, |
|
660 const TUint16 aPhoNetAddress, |
|
661 const TUint8 aFlags |
|
662 ) |
|
663 { |
|
664 C_TRACE( ( _T( "DISINameService::TxPnsNameAddInd 0x%x>" ), &aPnsNameAddReq ) ); |
|
665 LockNameServiceDMutex(); |
|
666 const TUint8* msgPtr( aPnsNameAddReq.Ptr() ); |
|
667 ASSERT_RESET_ALWAYS( msgPtr, |
|
668 ( EISINameServiceNullPointer13 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
669 TUint32 msgLength = ( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_IND ); |
|
670 TDes8& indMsg = MemApi::AllocBlock( msgLength ); |
|
671 indMsg.SetLength( msgLength ); |
|
672 ASSERT_RESET_ALWAYS( ( indMsg.Length() > ( ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ) ), |
|
673 ( EISINameServiceWrongLength8 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
674 TUint8* indPtr = const_cast<TUint8*>( indMsg.Ptr() ); |
|
675 SetIsiHeaderForIndication( indMsg, aPnsNameAddReq, PNS_NAME_ADD_IND ); |
|
676 PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_TOTALMATCHES ], KOneMatch ); |
|
677 PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_MATCHESINMSG ], KOneMatch ); |
|
678 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_RESERVED1 ] = KFiller; |
|
679 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_RESERVED2 ] = KFiller; |
|
680 PUTB32( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], aName ); |
|
681 PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ], aPhoNetAddress ); |
|
682 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = aFlags; |
|
683 indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller; |
|
684 SendToRouter( indMsg ); |
|
685 |
|
686 C_TRACE( ( _T( "DISINameService::TxPnsNameAddInd 0x%x<" ), &aPnsNameAddReq ) ); |
|
687 } |
|
688 |
|
689 void DISINameService::TxPnsNameRemoveInd( |
|
690 const TDesC8& aPnsNameRemoveReq, |
|
691 const TUint32 aName, |
|
692 const TUint16 aPhoNetAddress, |
|
693 const TUint8 aFlags |
|
694 ) |
|
695 { |
|
696 C_TRACE( ( _T( "DISINameService::TxPnsNameRemoveInd 0x%x>" ), &aPnsNameRemoveReq ) ); |
|
697 LockNameServiceDMutex(); |
|
698 const TUint8* msgPtr( aPnsNameRemoveReq.Ptr() ); |
|
699 ASSERT_RESET_ALWAYS( msgPtr, |
|
700 ( EISINameServiceNullPointer14 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
701 TUint32 msgLength = ( ISI_HEADER_SIZE + SIZE_PNS_NAME_REMOVE_IND ); |
|
702 TDes8& indMsg = MemApi::AllocBlock( msgLength ); |
|
703 indMsg.SetLength( msgLength ); |
|
704 ASSERT_RESET_ALWAYS( ( indMsg.Length() > ( ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ) ), |
|
705 ( EISINameServiceWrongLength8 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
706 TUint8* indPtr = const_cast<TUint8*>( indMsg.Ptr() ); |
|
707 ASSERT_RESET_ALWAYS( indPtr, ( EISINameServiceNullPointer10 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
708 SetIsiHeaderForIndication( indMsg, aPnsNameRemoveReq, PNS_NAME_REMOVE_IND ); |
|
709 C_TRACE( ( _T( "DISINameService::TxPnsNameRemoveInd 0x%x name 0x%x phonetAddress 0x%x flags 0x%x" ), &aPnsNameRemoveReq, aName, aPhoNetAddress, aFlags ) ); |
|
710 PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_TOTALMATCHES ], KOneMatch ); |
|
711 PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_MATCHESINMSG ], KOneMatch ); |
|
712 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_RESERVED1 ] = KFiller; |
|
713 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_RESERVED2 ] = KFiller; |
|
714 PUTB32( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], aName ); |
|
715 PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ], aPhoNetAddress ); |
|
716 indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = aFlags; |
|
717 SendToRouter( indMsg ); |
|
718 C_TRACE( ( _T( "DISINameService::TxPnsNameRemoveInd 0x%x<" ), &aPnsNameRemoveReq ) ); |
|
719 } |
|
720 |
|
721 DISINameService* DISINameService::GetISINameServiceF( |
|
722 // None |
|
723 ) |
|
724 { |
|
725 ASSERT_RESET_ALWAYS( iThisptr, |
|
726 ( EISINameServiceNullPointer12 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
727 return iThisptr; |
|
728 } |
|
729 |
|
730 DNameRecords* DISINameService::GetNameRecordsF( |
|
731 // None |
|
732 ) |
|
733 { |
|
734 ASSERT_RESET_ALWAYS( iNameRecords, |
|
735 ( EISINameServiceNullPointer15 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
736 return iNameRecords; |
|
737 } |
|
738 |
|
739 void DISINameService::SetIsiHeaderForResp( |
|
740 const TDesC8& aResponseMessage, |
|
741 const TDesC8& aRequestMessage, |
|
742 const TUint8 aResponseMessageIdentifier |
|
743 ) |
|
744 { |
|
745 C_TRACE( ( _T( "DISINameService::SetIsiHeaderForResp 0x%x 0x%x 0x%x>" ), &aResponseMessage, &aRequestMessage, aResponseMessageIdentifier ) ); |
|
746 const TUint8* reqMsgPtr = aRequestMessage.Ptr(); |
|
747 ASSERT_RESET_ALWAYS( reqMsgPtr, ( EISINameServiceNullPointer16 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
748 TUint8* respMsgPtr = const_cast<TUint8*>( aResponseMessage.Ptr() ); |
|
749 ASSERT_RESET_ALWAYS( respMsgPtr, ( EISINameServiceNullPointer17 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
750 ASSERT_RESET_ALWAYS( ( aResponseMessage.Length() > ISI_HEADER_OFFSET_MESSAGEID ), |
|
751 ( EISINameServiceWrongLength9 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
752 ASSERT_RESET_ALWAYS( ( aRequestMessage.Length() > ISI_HEADER_OFFSET_TRANSID ), |
|
753 ( EISINameServiceWrongLength10 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
754 respMsgPtr[ ISI_HEADER_OFFSET_MEDIA ] = reqMsgPtr[ ISI_HEADER_OFFSET_MEDIA ]; |
|
755 SET_RECEIVER_DEV( respMsgPtr, GET_SENDER_DEV( reqMsgPtr ) ); |
|
756 SET_SENDER_DEV( respMsgPtr, PN_DEV_OWN ); |
|
757 respMsgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
|
758 SET_LENGTH( respMsgPtr, ( aResponseMessage.Length() - PN_HEADER_SIZE ) ); |
|
759 SET_RECEIVER_OBJ( respMsgPtr, GET_SENDER_OBJ( reqMsgPtr ) ); |
|
760 SET_SENDER_OBJ( respMsgPtr, PN_OBJ_ROUTER ); |
|
761 respMsgPtr[ ISI_HEADER_OFFSET_TRANSID ] = reqMsgPtr[ ISI_HEADER_OFFSET_TRANSID ]; |
|
762 respMsgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] = aResponseMessageIdentifier; |
|
763 C_TRACE( ( _T( "DISINameService::SetIsiHeaderForResp 0x%x 0x%x 0x%x<" ), &aResponseMessage, &aRequestMessage, aResponseMessageIdentifier ) ); |
|
764 } |
|
765 |
|
766 void DISINameService::SetIsiHeaderForCommonResp( |
|
767 const TDesC8& aResponseMessage, |
|
768 const TDesC8& aRequestMessage |
|
769 ) |
|
770 { |
|
771 C_TRACE( ( _T( "DISINameService::SetIsiHeaderForCommonResp 0x%x 0x%x>" ), &aResponseMessage, &aRequestMessage ) ); |
|
772 const TUint8* reqMsgPtr = aRequestMessage.Ptr(); |
|
773 ASSERT_RESET_ALWAYS( reqMsgPtr, ( EISINameServiceNullPointer18 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
774 TUint8* respMsgPtr = const_cast<TUint8*>( aResponseMessage.Ptr() ); |
|
775 ASSERT_RESET_ALWAYS( respMsgPtr, ( EISINameServiceNullPointer19 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
776 ASSERT_RESET_ALWAYS( ( aResponseMessage.Length() > ISI_HEADER_OFFSET_MESSAGEID ), |
|
777 ( EISINameServiceWrongLength11 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
778 ASSERT_RESET_ALWAYS( ( aRequestMessage.Length() > ISI_HEADER_OFFSET_TRANSID ), |
|
779 ( EISINameServiceWrongLength12 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
780 respMsgPtr[ ISI_HEADER_OFFSET_MEDIA ] = ( reqMsgPtr[ ISI_HEADER_OFFSET_MEDIA ] ); |
|
781 SET_RECEIVER_DEV( respMsgPtr, GET_SENDER_DEV( reqMsgPtr ) ); |
|
782 SET_SENDER_DEV( respMsgPtr, PN_DEV_OWN ); |
|
783 respMsgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = ( reqMsgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] ); |
|
784 SET_LENGTH( respMsgPtr, ( aResponseMessage.Length() - PN_HEADER_SIZE ) ); |
|
785 SET_RECEIVER_OBJ( respMsgPtr, GET_SENDER_OBJ( reqMsgPtr ) ); |
|
786 SET_SENDER_OBJ( respMsgPtr, GET_RECEIVER_OBJ( reqMsgPtr ) ); |
|
787 respMsgPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_TRANSACTIONID ] = ( reqMsgPtr[ ISI_HEADER_OFFSET_TRANSID ] ); |
|
788 respMsgPtr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_MESSAGEID ] = COMMON_MESSAGE; |
|
789 C_TRACE( ( _T( "DISINameService::SetIsiHeaderForCommonResp 0x%x 0x%x<" ), &aResponseMessage, &aRequestMessage ) ); |
|
790 } |
|
791 |
|
792 void DISINameService::SetIsiHeaderForIndication( |
|
793 const TDesC8& aIndicationToModify, |
|
794 const TDesC8& aPnsNameRequest, |
|
795 const TUint8 aIndicationMessageIdentifier |
|
796 ) |
|
797 { |
|
798 C_TRACE( ( _T( "DISINameService::aIndicationToModify 0x%x 0x%x 0x%x>" ), &aIndicationToModify, &aPnsNameRequest, aIndicationMessageIdentifier ) ); |
|
799 const TUint8* reqMsgPtr = aPnsNameRequest.Ptr(); |
|
800 ASSERT_RESET_ALWAYS( reqMsgPtr, ( EISINameServiceNullPointer18 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
801 TUint8* indMsgPtr = const_cast<TUint8*>( aIndicationToModify.Ptr() ); |
|
802 ASSERT_RESET_ALWAYS( indMsgPtr, ( EISINameServiceNullPointer19 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
803 ASSERT_RESET_ALWAYS( ( aIndicationToModify.Length() > ISI_HEADER_OFFSET_MESSAGEID ), |
|
804 ( EISINameServiceWrongLength11 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
805 ASSERT_RESET_ALWAYS( ( aPnsNameRequest.Length() > ISI_HEADER_OFFSET_TRANSID ), |
|
806 ( EISINameServiceWrongLength12 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
807 indMsgPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ; |
|
808 SET_RECEIVER_DEV( indMsgPtr, GET_SENDER_DEV( reqMsgPtr ) ); |
|
809 SET_SENDER_DEV( indMsgPtr, PN_DEV_OWN ); |
|
810 indMsgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE; |
|
811 SET_LENGTH( indMsgPtr, ( aIndicationToModify.Length() - PN_HEADER_SIZE ) ); |
|
812 SET_RECEIVER_OBJ( indMsgPtr, PN_OBJ_EVENT_MULTICAST ); |
|
813 SET_SENDER_OBJ( indMsgPtr, PN_OBJ_ROUTER ); |
|
814 indMsgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_UTID ] = 0x00; |
|
815 indMsgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ]= aIndicationMessageIdentifier; |
|
816 C_TRACE( ( _T( "DISINameService::aIndicationToModify 0x%x 0x%x 0x%x<" ), &aIndicationToModify, &aPnsNameRequest, aIndicationMessageIdentifier ) ); |
|
817 } |
|
818 DISINameServiceExtended::DISINameServiceExtended( |
|
819 DISINameService* aNameService |
|
820 ) |
|
821 { |
|
822 C_TRACE( ( _T( "DISINameServiceExtended::DISINameServiceExtended 0x%x>" ), iISINameService ) ); |
|
823 iISINameService = aNameService; |
|
824 ASSERT_RESET_ALWAYS( iISINameService, ( EISINameServiceExtendedNullPointer | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
825 AddModemResources(); |
|
826 //AddPnDevDspMainResources(); |
|
827 // iShNameAddIndSubscriptionState = ENotSubscribed; |
|
828 |
|
829 // |
|
830 // flag: ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE |
|
831 // |
|
832 // |
|
833 // - Extended Resource routing supported by Symbian SW Name Service (Design Change) |
|
834 // - PN_COMMGR by default routed to RAPU, by device id 0x6c routed to Symbian SW PN_COMMGR (Design Change) |
|
835 // - Internally in ISCE PN_COMMGR name is handled : [0] PN_COMMGR, [1] deviceidentifier, [2] don't care, [3] don't care only visible in NameRecords table |
|
836 // - PN_NAMESERVICE by default routed to RAPU by device id 0x6c routed to Symbian SW PN_NAMESERVICE |
|
837 // - Symbian SW wider name service subscribes PNS_NAME_ADD_INDs from RAPU through Symbian SW PN_APE_COMMGR (REQ, RESP) |
|
838 // - Symbian SW Name Service contains: Symbian SW Resources added with PNS_NAME_ADD_REQ dev id PN_DEV_OWN (Phonet address 0x6c[own for all], TD MODEM Resources (Phonet address 0x6000), PN_DSP_MAIN, Symbian SW Resource stored in RAPU Name Service (dynamically added after PNS_NAME_ADD_IND received PhoNet address as got from indication), other messages are routed to RAPU (Design Change) |
|
839 // - Communication Manager calls ::GetDeviceIdentifierByResouce to get appropriate device identifier to indication subscription |
|
840 // |
|
841 // worry later the usage of shared resource such as PN_COMMGR, PN_NAME_SERVICE etc.. others that shall pop up due to missing ISA system design, use rxdev from message vs. nametable entry to differentiate them |
|
842 |
|
843 C_TRACE( ( _T( "DISINameServiceExtended::DISINameServiceExtended 0x%x<" ), iISINameService ) ); |
|
844 } |
|
845 |
|
846 DISINameServiceExtended::~DISINameServiceExtended( |
|
847 // None |
|
848 ) |
|
849 { |
|
850 C_TRACE( ( _T( "DISINameServiceExtended::~DISINameServiceExtended<>" ) ) ); |
|
851 } |
|
852 void DISINameServiceExtended::AddModemResources( |
|
853 // None |
|
854 ) |
|
855 { |
|
856 C_TRACE( ( _T( "DISINameServiceExtended::AddModemResources>" ) ) ); |
|
857 TUint8 err( PN_NAME_OK ); |
|
858 TUint8 flags = PN_NAME_NOCHG; |
|
859 TUint16 phonetAddressModemRoutingReq = ( ( PN_DEV_MODEM << KDeviceIdentifierPhoNetAddressShift ) | PN_OBJ_ROUTING_REQ ); |
|
860 |
|
861 DNameRecords* nameRecords = iISINameService->GetNameRecordsF(); |
|
862 |
|
863 err = nameRecords->AddName( PN_SMS, phonetAddressModemRoutingReq, flags ); |
|
864 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed1 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
865 |
|
866 err = nameRecords->AddName( PN_SS, phonetAddressModemRoutingReq, flags ); |
|
867 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed2 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
868 |
|
869 err = nameRecords->AddName( PN_CSD, phonetAddressModemRoutingReq, flags ); |
|
870 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed3 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
871 |
|
872 err = nameRecords->AddName( PN_GPDS, phonetAddressModemRoutingReq, flags ); |
|
873 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed4 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
874 |
|
875 err = nameRecords->AddName( PN_GSS, phonetAddressModemRoutingReq, flags ); |
|
876 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed5 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
877 |
|
878 err = nameRecords->AddName( PN_UICC, phonetAddressModemRoutingReq, flags ); |
|
879 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed6 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
880 |
|
881 err = nameRecords->AddName( PN_AT_MODEM, phonetAddressModemRoutingReq, flags ); |
|
882 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed7 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
883 |
|
884 err = nameRecords->AddName( PN_MODEM_LCS, phonetAddressModemRoutingReq, flags ); |
|
885 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed8 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
886 |
|
887 err = nameRecords->AddName( PN_MODEM_TEST, phonetAddressModemRoutingReq, flags ); |
|
888 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed9 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
889 |
|
890 err = nameRecords->AddName( PN_MODEM_NVD, phonetAddressModemRoutingReq, flags ); |
|
891 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed10 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
892 |
|
893 err = nameRecords->AddName( PN_MODEM_MCE, phonetAddressModemRoutingReq, flags ); |
|
894 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed11 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
895 |
|
896 err = nameRecords->AddName( PN_MODEM_INFO, phonetAddressModemRoutingReq, flags ); |
|
897 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed12 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
898 |
|
899 err = nameRecords->AddName( PN_MODEM_NETWORK, phonetAddressModemRoutingReq, flags ); |
|
900 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed13 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
901 |
|
902 err = nameRecords->AddName( PN_MODEM_CALL, phonetAddressModemRoutingReq, flags ); |
|
903 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed14 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
904 |
|
905 err = nameRecords->AddName( PN_WCDMA_RF_TEST, phonetAddressModemRoutingReq, flags ); |
|
906 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed15 | EDISINameServiceTraceId << KClassIdentifierShift ) ); // EISINameServiceNameCreateFailed15... |
|
907 |
|
908 err = nameRecords->AddName( PN_GSM_RF_TEST, phonetAddressModemRoutingReq, flags ); |
|
909 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed16 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
910 |
|
911 err = nameRecords->AddName( PN_RF_HAL, phonetAddressModemRoutingReq, flags ); |
|
912 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed17 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
913 |
|
914 err = nameRecords->AddName( PN_COMMON_RF_TEST, phonetAddressModemRoutingReq, flags ); |
|
915 ASSERT_RESET_ALWAYS( ( PN_NAME_OK == err ), ( EISINameServiceNameCreateFailed18 | EDISINameServiceTraceId << KClassIdentifierShift ) ); |
|
916 |
|
917 C_TRACE( ( _T( "DISINameServiceExtended::AddModemResources<" ) ) ); |
|
918 } |