0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <phonetisi.h> // For ISI_HEADER_SIZE
|
|
20 |
#include <pn_const.h> // For PN_HEADER_SIZE
|
|
21 |
#include <pipeisi.h> // For PNS_PIPE_DATA_OFFSET_DATA
|
|
22 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
23 |
#include <mediaisi.h> // For PNS_MEDIA_SPECIFIC_REQ/RESP
|
|
24 |
#include <nsisi.h> // For PNS_NAME...
|
|
25 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
26 |
#include <commisi.h> // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP
|
|
27 |
#include "router.h"
|
|
28 |
#include "iadtrace.h" // For C_TRACE..
|
|
29 |
#include "isaaccessextension.h" // For DIsaAccessExtension
|
|
30 |
#include "indicationhandler.h" // For DIndicationHandler
|
|
31 |
#include "queue.h" // For DQueue
|
|
32 |
#include "iadinternaldefinitions.h" // For EIADAsync...
|
|
33 |
#include "iadhelpers.h" // For GET_RECEIVER
|
|
34 |
|
|
35 |
#include "pipehandler.h" // For PipeHandler
|
|
36 |
#include "OstTraceDefinitions.h"
|
|
37 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
38 |
#include "routerTraces.h"
|
|
39 |
#endif
|
|
40 |
|
|
41 |
//#define MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD // TODO: to be removed when Bridge Modem SW is ok
|
|
42 |
|
|
43 |
// ISCE
|
|
44 |
#include "memapi.h" // For MemApi
|
|
45 |
#include "trxdefs.h" // For ETrx...
|
|
46 |
// ISCE
|
|
47 |
// ISCE #include "miad2istapi.h" // For MIAD2ISTApi
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
// CONSTS
|
|
52 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
53 |
|
|
54 |
// TODO : spec this to some document
|
|
55 |
/**** IAD<->SOS_MM ****/
|
|
56 |
const TUint8 KIADObjId( 0xfe );
|
|
57 |
/* CTRL CONF REQ START *
|
|
58 |
[0] media, PN_MEDIA_SOS;
|
|
59 |
[1] recdev, PN_MEDIA_ROUTING_REQ
|
|
60 |
[2] senderdev, PN_DEV_SOS
|
|
61 |
[3] function, PN_MEDIA_CONTROL
|
|
62 |
[4,5] length, 8
|
|
63 |
[6] recobj, PN_OBJ_ROUTER
|
|
64 |
[7] senderobj, KIADObjId
|
|
65 |
[8] transaction 0x00
|
|
66 |
[9] messageid PNS_MEDIA_SPECIFIC_REQ
|
|
67 |
[10] media2control PN_MEDIA_SOS
|
|
68 |
[11] ctrl msg id KIADCtrlConfReq (0x05)
|
|
69 |
[12] filler 0x00
|
|
70 |
[13] filler 0x00
|
|
71 |
* CTRL CONF REQ END */
|
|
72 |
const TUint8 KIADCtrlConfReq( 0x5 );
|
|
73 |
/* CTRL CONF RESP START *
|
|
74 |
[0] media, PN_MEDIA_SOS;
|
|
75 |
[1] recdev, PN_DEV_SOS
|
|
76 |
[2] senderdev, PN_MEDIA_ROUTING_REQ
|
|
77 |
[3] function, PN_MEDIA_CONTROL
|
|
78 |
[4,5] length, 10
|
|
79 |
[6] recobj, KIADObjId
|
|
80 |
[7] senderobj, PN_OBJ_ROUTER
|
|
81 |
[8] transaction 0x00
|
|
82 |
[9] messageid PNS_MEDIA_SPECIFIC_REQ
|
|
83 |
[10] media2control PN_MEDIA_SOS
|
|
84 |
[11] media error PN_MCTRL_NO_ERROR
|
|
85 |
[12] ctrl msg id KIADCtrlConfResp (0x06)
|
|
86 |
[13] conf size 8 bytes
|
|
87 |
[14] conf size 8 bytes
|
|
88 |
[15] filler 0x00
|
|
89 |
* CTRL CONF RESP END */
|
|
90 |
const TUint8 KIADCtrlConfResp( 0x6 );
|
|
91 |
/* CTRL DRM REQ START *
|
|
92 |
[0] media, PN_MEDIA_SOS;
|
|
93 |
[1] recdev, PN_MEDIA_ROUTING_REQ
|
|
94 |
[2] senderdev, PN_DEV_SOS
|
|
95 |
[3] function, PN_MEDIA_CONTROL
|
|
96 |
[4,5] length, 8 ( + 6 = KIADCtrlDrmReqLength )
|
|
97 |
[6] recobj, PN_OBJ_ROUTER
|
|
98 |
[7] senderobj, KIADObjId
|
|
99 |
[8] channel number IAD client's channel number
|
|
100 |
[9] messageid PNS_MEDIA_SPECIFIC_REQ
|
|
101 |
[10] mediatocontrol PN_MEDIA_SOS
|
|
102 |
[11] ctrl msg id KIADCtrlDrmReq (0x07)
|
|
103 |
[12] ch is 2 be reg IAD client's channel number
|
|
104 |
[13] filler 0x00
|
|
105 |
* CTRL DRM REQ END */
|
|
106 |
const TUint8 KIADCtrlDrmReq( 0x7 );
|
|
107 |
const TInt KIADCtrlDrmReqLength( 14 );
|
|
108 |
/* CTRL DRM RESP START *
|
|
109 |
[0] media, PN_MEDIA_SOS;
|
|
110 |
[1] recdev, PN_DEV_SOS
|
|
111 |
[2] senderdev, PN_MEDIA_ROUTING_REQ
|
|
112 |
[3] function, PN_MEDIA_CONTROL
|
|
113 |
[4,5] length, 8
|
|
114 |
[6] recobj, KIADObjId
|
|
115 |
[7] senderobj, PN_OBJ_ROUTER
|
|
116 |
[8] channel number IAD client's channel number
|
|
117 |
[9] messageid PNS_MEDIA_SPECIFIC_RESP
|
|
118 |
[10] mediatocontrol PN_MEDIA_SOS
|
|
119 |
[11] media error PN_MCTRL_NO_ERROR
|
|
120 |
[12] ctrl msg id KIADCtrlDrmResp (0x08)
|
|
121 |
[13] filler 0x00
|
|
122 |
* CTRL DRM REQ END */
|
|
123 |
const TUint8 KIADCtrlDrmResp( 0x8 );
|
|
124 |
|
|
125 |
#define CTRL_REQ_OFFSET_MESSAGEID ( ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_DATA )
|
|
126 |
#define CTRL_RESP_OFFSET_MESSAGEID ( ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_DATA )
|
|
127 |
#define CTRL_CONF_RESP_OFFSET_SIZE_BYTE1 ( CTRL_RESP_OFFSET_MESSAGEID + 1 )
|
|
128 |
#define CTRL_CONF_RESP_OFFSET_SIZE_BYTE2 ( CTRL_CONF_RESP_OFFSET_SIZE_BYTE1 + 1 )
|
|
129 |
#define CTR_DRM_REQ_RESP_OFFSET_CHANNEL_ID ( ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_UTID )
|
|
130 |
#define CTRL_DRM_REQ_OFFSET_REQUIRED_CHANNEL_ID ( CTRL_REQ_OFFSET_MESSAGEID + 1 )
|
|
131 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
132 |
|
|
133 |
// TODO: change this to use UnuqueID instead and to extension..
|
|
134 |
void DRouter::CheckDfc()
|
|
135 |
{
|
|
136 |
OstTrace0( TRACE_NORMAL, DROUTER_CHECKDFC_ENTRY, ">DRouter::CheckDfc" );
|
|
137 |
|
|
138 |
DObject* tempObj = reinterpret_cast<DObject*>( &Kern::CurrentThread() );
|
|
139 |
TUint8* buffer = ( TUint8* )Kern::Alloc( 100 );
|
|
140 |
TPtr8* bufferPtr = new ( TPtr8 )( buffer, 100 );
|
|
141 |
tempObj->Name( *bufferPtr );
|
|
142 |
C_TRACE( ( _T( "DRouter::CheckDfc" ) ) );
|
|
143 |
if ( bufferPtr->Compare( KIADExtensionDfc ) != KErrNone )
|
|
144 |
{
|
|
145 |
for( TInt i( 0 );i < bufferPtr->Length(); ++i )
|
|
146 |
{
|
|
147 |
Kern::Printf( "%c", i, bufferPtr->Ptr()[ i ]);
|
|
148 |
}
|
|
149 |
ASSERT_RESET_ALWAYS( 0, EIADWrongDFCQueueUsed | EIADFaultIdentifier2 << KFaultIdentifierShift );
|
|
150 |
}
|
|
151 |
Kern::Free( buffer );
|
|
152 |
delete bufferPtr;
|
|
153 |
bufferPtr = NULL;
|
|
154 |
|
|
155 |
OstTrace0( TRACE_NORMAL, DROUTER_CHECKDFC_EXIT, "<DRouter::CheckDfc" );
|
|
156 |
}
|
|
157 |
|
|
158 |
#ifdef _DEBUG
|
|
159 |
#define ASSERT_DFCTHREAD_INEXT() CheckDfc()
|
|
160 |
#else
|
|
161 |
#define ASSERT_DFCTHREAD_INEXT()
|
|
162 |
#endif
|
|
163 |
|
|
164 |
DRouter::DRouter():
|
|
165 |
iConnectionStatus( EIADConnectionNotOk )
|
|
166 |
, iBootDone( EFalse )
|
|
167 |
{
|
|
168 |
OstTrace0( TRACE_NORMAL, DROUTER_DROUTER_ENTRY, "<DRouter::DRouter" );
|
|
169 |
|
|
170 |
C_TRACE( ( _T( "DRouter::DRouter ->" ) ) );
|
|
171 |
// owned
|
|
172 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
173 |
iPipeHandler = new DPipeHandler( *this );
|
|
174 |
#endif
|
|
175 |
iIndicationHandler = new DIndicationHandler( *this );
|
|
176 |
iCommonRxQueue = new DQueue( KIADExtensionRxQueueSize );
|
|
177 |
ASSERT_RESET_ALWAYS( /*iPipeHandler &&*/ iIndicationHandler && iCommonRxQueue, EIADMemoryAllocationFailure | EIADFaultIdentifier17 << KFaultIdentifierShift );
|
|
178 |
// Initialize channels to NULL when channel is opened !NULL.
|
|
179 |
for( TInt i( 0 ); i < EIADSizeOfChannels; ++i )
|
|
180 |
{
|
|
181 |
iChannelTable[ i ].iChannel = NULL;
|
|
182 |
iChannelTable[ i ].iWaitingChannel = NULL;
|
|
183 |
iChannelTable[ i ].iType = ENormalOpen;
|
|
184 |
}
|
|
185 |
|
|
186 |
iCommonRxDfc = new TDfc( CommonRxDfc, this, DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue ), KIADExtCommonRxPriori );
|
|
187 |
// not owned, just using.
|
|
188 |
// Set null when not registered.
|
|
189 |
iInitCmtDfc = new TDfc( InitCmtDfc, this, DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue ), KIADExtInitCmtPriori );
|
|
190 |
iConnStatDfc = new TDfc( NotifyObjLayerConnStatDfc, this, DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue ), KIADExtConnStatPriori );
|
|
191 |
ASSERT_RESET_ALWAYS( iCommonRxDfc && iInitCmtDfc && iConnStatDfc, EIADMemoryAllocationFailure | EIADFaultIdentifier18 << KFaultIdentifierShift );
|
|
192 |
iMaxFrameSize = 0x0000;
|
|
193 |
// ISCE
|
|
194 |
iLinksArray = new MISIRouterLinkIf*[ DRouter::EISIAmountOfMedias ];
|
|
195 |
// TODO: fault codes and ids
|
|
196 |
ASSERT_RESET_ALWAYS( iLinksArray, ( EIADMemoryAllocationFailure | EIADFaultIdentifier17 << KFaultIdentifierShift ) );
|
|
197 |
// Initialize links
|
|
198 |
for( TInt i( 0 ); i < DRouter::EISIAmountOfMedias; i++ )
|
|
199 |
{
|
|
200 |
iLinksArray[ i ] = NULL;
|
|
201 |
C_TRACE( ( _T( "DRouter::DRouter %d" ), i ) );
|
|
202 |
}
|
|
203 |
// Configuration of ISI links. TODO: devices and link configurations for coming platforms are unknown and to be done later.
|
|
204 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
205 |
iLinksArray[ DRouter::EISIMediaSOS ] = MISIRouterLinkIf::CreateLinkF( this, PN_MEDIA_SOS, ETrxPartnerOS );
|
|
206 |
#else
|
|
207 |
// Bridge media = PN_MEDIA_MODEM_HOST_IF
|
|
208 |
iLinksArray[ DRouter::EISIMediaHostSSI ] = MISIRouterLinkIf::CreateLinkF( this, PN_MEDIA_MODEM_HOST_IF, ETrxSharedMemory );
|
|
209 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
210 |
// ISCE
|
|
211 |
C_TRACE( ( _T( "DRouter::DRouter 0x%x <-" ), this ) );
|
|
212 |
OstTrace1( TRACE_NORMAL, DROUTER_DROUTER_EXIT, "<DRouter::DRouter;this=%x", this );
|
|
213 |
}
|
|
214 |
|
|
215 |
DRouter::~DRouter(
|
|
216 |
// None
|
|
217 |
)
|
|
218 |
{
|
|
219 |
OstTrace0( TRACE_NORMAL, DUP1_DROUTER_DROUTER_ENTRY, "<DRouter::~DRouter" );
|
|
220 |
//ISCE
|
|
221 |
// owning so deleting
|
|
222 |
for( TInt i( 0 ); i < EISIAmountOfMedias; i++ )
|
|
223 |
{
|
|
224 |
MISIRouterLinkIf* temp = iLinksArray[ i ];
|
|
225 |
temp->Release();
|
|
226 |
temp = NULL;
|
|
227 |
iLinksArray[ i ] = NULL;
|
|
228 |
}
|
|
229 |
//ISCE
|
|
230 |
C_TRACE( ( _T( "DRouter::~DRouter 0x%x ->" ), this ) );
|
|
231 |
// Initialize channels to NULL when channel is opened !NULL.
|
|
232 |
for( TInt i( 0 ); i < EIADSizeOfChannels; ++i )
|
|
233 |
{
|
|
234 |
iChannelTable[ i ].iChannel = NULL;
|
|
235 |
iChannelTable[ i ].iWaitingChannel = NULL;
|
|
236 |
iChannelTable[ i ].iType = ENormalOpen;
|
|
237 |
}
|
|
238 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
239 |
if( iPipeHandler )
|
|
240 |
{
|
|
241 |
delete iPipeHandler;
|
|
242 |
iPipeHandler = NULL;
|
|
243 |
}
|
|
244 |
#endif
|
|
245 |
if( iIndicationHandler )
|
|
246 |
{
|
|
247 |
delete iIndicationHandler;
|
|
248 |
iIndicationHandler = NULL;
|
|
249 |
}
|
|
250 |
if( iCommonRxQueue )
|
|
251 |
{
|
|
252 |
delete iCommonRxQueue;
|
|
253 |
iCommonRxQueue = NULL;
|
|
254 |
}
|
|
255 |
if( iCommonRxDfc )
|
|
256 |
{
|
|
257 |
iCommonRxDfc->Cancel();
|
|
258 |
delete iCommonRxDfc;
|
|
259 |
iCommonRxDfc = NULL;
|
|
260 |
}
|
|
261 |
if( iInitCmtDfc )
|
|
262 |
{
|
|
263 |
delete iInitCmtDfc;
|
|
264 |
iInitCmtDfc = NULL;
|
|
265 |
}
|
|
266 |
if( iConnStatDfc )
|
|
267 |
{
|
|
268 |
delete iConnStatDfc;
|
|
269 |
iConnStatDfc = NULL;
|
|
270 |
}
|
|
271 |
C_TRACE( ( _T( "DRouter::~DRouter 0x%x <-" ), this ) );
|
|
272 |
|
|
273 |
OstTrace1( TRACE_NORMAL, DUP1_DROUTER_DROUTER_EXIT, "<DRouter::~DRouter;this=%x", this );
|
|
274 |
}
|
|
275 |
|
|
276 |
// From start
|
|
277 |
// Do not call from ISR context!! Can only be called from Extension DFCThread context.
|
|
278 |
EXPORT_C TDes8& DRouter::AllocateBlock(
|
|
279 |
const TUint16 aSize
|
|
280 |
)
|
|
281 |
{
|
|
282 |
OstTraceExt1( TRACE_NORMAL, DROUTER_ALLOCATEBLOCK_ENTRY, "<>DRouter::AllocateBlock;aSize=%hu", aSize );
|
|
283 |
|
|
284 |
C_TRACE( ( _T( "DRouter::AllocateBlock %d <->" ), aSize ) );
|
|
285 |
ASSERT_CONTEXT_ALWAYS( NKern::EThread, 0 );
|
|
286 |
ASSERT_DFCTHREAD_INEXT();
|
|
287 |
ASSERT_RESET_ALWAYS( aSize, EIADWrongParameter | EIADFaultIdentifier9 << KFaultIdentifierShift );
|
|
288 |
// ISCE
|
|
289 |
// ASSERT_RESET_ALWAYS( iIST, EIADNullParameter | EIADFaultIdentifier17 << KFaultIdentifierShift );
|
|
290 |
// return iIST->AllocateBlock( aSize );// TODO: Print ptr!!!
|
|
291 |
return MemApi::AllocBlock( aSize );
|
|
292 |
// ISCE
|
|
293 |
}
|
|
294 |
|
|
295 |
EXPORT_C TDes8& DRouter::AllocateDataBlock(
|
|
296 |
const TUint16 aSize
|
|
297 |
)
|
|
298 |
{
|
|
299 |
OstTraceExt1( TRACE_NORMAL, DROUTER_ALLOCATEDATABLOCK_ENTRY, ">DRouter::AllocateDataBlock;aSize=%hu", aSize );
|
|
300 |
|
|
301 |
C_TRACE( ( _T( "DRouter::AllocateDataBlock %d <->" ), aSize ) );
|
|
302 |
TUint32 neededLength( aSize + ISI_HEADER_SIZE + PNS_PIPE_DATA_OFFSET_DATA );
|
|
303 |
TDes8& tmp = this->AllocateBlock( neededLength );
|
|
304 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
305 |
tmp.SetLength( neededLength );
|
|
306 |
TUint8* msgPtr = const_cast<TUint8*>( tmp.Ptr() );
|
|
307 |
SET_RECEIVER_DEV( msgPtr, PN_DEV_DONT_CARE );
|
|
308 |
ASSERT_RESET_ALWAYS( neededLength > ISI_HEADER_OFFSET_MESSAGEID, EIADOverTheLimits | EIADFaultIdentifier1 << KFaultIdentifierShift );
|
|
309 |
msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_PIPE;
|
|
310 |
msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] = PNS_PIPE_DATA;
|
|
311 |
SET_RECEIVER_OBJ( msgPtr, PN_OBJ_ROUTER );
|
|
312 |
SET_LENGTH( tmp, ( tmp.Length() - PN_HEADER_SIZE ) );
|
|
313 |
#endif
|
|
314 |
OstTrace1( TRACE_NORMAL, DROUTER_ALLOCATEDATABLOCK_EXIT, "<DRouter::AllocateDataBlock;tmp=%x",( TUint )&( tmp ) );
|
|
315 |
return tmp;
|
|
316 |
}
|
|
317 |
|
|
318 |
|
|
319 |
EXPORT_C void DRouter::Close(
|
|
320 |
const TUint16 aChannelId
|
|
321 |
)
|
|
322 |
{
|
|
323 |
|
|
324 |
OstTraceExt1( TRACE_NORMAL, DROUTER_CLOSE_ENTRY, ">DRouter::Close;aChannelId=%hx", aChannelId );
|
|
325 |
C_TRACE( ( _T( "DRouter::Close 0x%x ->" ), aChannelId ) );
|
|
326 |
// Channel must be from appropiate length and although it is sixteenbit value it must contain only 8-bit values. If over 8-bit changes needed.
|
|
327 |
ASSERT_RESET_ALWAYS( aChannelId < EIADSizeOfChannels || aChannelId < 0xff, EIADWrongParameter | EIADFaultIdentifier10 << KFaultIdentifierShift );
|
|
328 |
ASSERT_DFCTHREAD_INEXT();
|
|
329 |
// If channel open (!NULL) set as closed (NULL) or if channel open is pending.
|
|
330 |
ASSERT_RESET_ALWAYS( aChannelId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)aChannelId << KChannelNumberShift | EIADFaultIdentifier21 << KFaultIdentifierShift );
|
|
331 |
if( iChannelTable[ aChannelId ].iChannel || iChannelTable[ aChannelId ].iWaitingChannel )
|
|
332 |
{
|
|
333 |
C_TRACE( ( _T( "DRouter::Close open->close 0x%x" ), aChannelId ) );
|
|
334 |
#if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95)
|
|
335 |
if( iChannelTable[ aChannelId ].iType != ELoan )
|
|
336 |
{
|
|
337 |
#endif
|
|
338 |
iChannelTable[ aChannelId ].iChannel = NULL;
|
|
339 |
iChannelTable[ aChannelId ].iWaitingChannel = NULL;
|
|
340 |
iChannelTable[ aChannelId ].iType = ENormalOpen;
|
|
341 |
const TInt indicationCancelOrderSize( 2 );
|
|
342 |
TDes8& cancelOrder = AllocateBlock( indicationCancelOrderSize );
|
|
343 |
cancelOrder.Append( 0x00 );
|
|
344 |
cancelOrder.Append( 0x00 );
|
|
345 |
// Order internally, so no return values above ::Close { 0x00, 0x00 } 8-bit cancel indication.
|
|
346 |
TInt error( OrderIndication( cancelOrder, aChannelId, EFalse ) );
|
|
347 |
C_TRACE( ( _T( "DRouter::Close open->close indication order returned %d 0x%x" ), error, aChannelId ) );
|
|
348 |
OstTraceExt2( TRACE_NORMAL, DROUTER_CLOSE, "DRouter::Close open->close indication order returned;error=%d;aChannelId=%x", error, aChannelId );
|
|
349 |
ASSERT_RESET_ALWAYS( KErrNone == error, EIADIndicationOrderFailed | static_cast<TUint8>( ( aChannelId << KChannelNumberShift ) ) );
|
|
350 |
DeAllocateBlock( cancelOrder );
|
|
351 |
#if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95)
|
|
352 |
}
|
|
353 |
else
|
|
354 |
{
|
|
355 |
C_TRACE( ( _T( "DRouter::Close open->close loaned channel 0x%x" ), aChannelId ) );
|
|
356 |
OstTrace1( TRACE_NORMAL, DROUTER_CLOSE_2, "DRouter::Close open->close loaned channel;aChannelId=%x", aChannelId );
|
|
357 |
iChannelTable[ aChannelId ].iType = ENormalOpen;
|
|
358 |
iChannelTable[ aChannelId ].iChannel = iChannelTable[ aChannelId ].iWaitingChannel;
|
|
359 |
iChannelTable[ aChannelId ].iWaitingChannel = NULL;
|
|
360 |
}
|
|
361 |
#endif
|
|
362 |
}
|
|
363 |
C_TRACE( ( _T( "DRouter::Close 0x%x <-" ), aChannelId ) );
|
|
364 |
OstTrace0( TRACE_NORMAL, DROUTER_CLOSE_EXIT, "<DRouter::Close" );
|
|
365 |
|
|
366 |
}
|
|
367 |
|
|
368 |
// Do not call from ISR context!! Can only be called from Extension DFCThread context.
|
|
369 |
EXPORT_C void DRouter::DeAllocateBlock(
|
|
370 |
TDes8& aBlock
|
|
371 |
)
|
|
372 |
{
|
|
373 |
OstTrace1( TRACE_NORMAL, DROUTER_DEALLOCATEBLOCK_ENTRY, ">DRouter::DeAllocateBlock;aBlock=%x", ( TUint )&( aBlock ) );
|
|
374 |
|
|
375 |
C_TRACE( ( _T( "DRouter::DeAllocateBlock 0x%x ->" ), &aBlock ) );
|
|
376 |
ASSERT_CONTEXT_ALWAYS( NKern::EThread, 0 );
|
|
377 |
ASSERT_DFCTHREAD_INEXT();
|
|
378 |
// ISCE
|
|
379 |
// ASSERT_RESET_ALWAYS( iIST, EIADNullParameter | EIADFaultIdentifier18 << KFaultIdentifierShift );
|
|
380 |
// iIST->DeallocateBlock( aBlock );
|
|
381 |
MemApi::DeallocBlock( aBlock );
|
|
382 |
// ISCE
|
|
383 |
C_TRACE( ( _T( "DRouter::DeAllocateBlock 0x%x <-" ), &aBlock ) );
|
|
384 |
|
|
385 |
OstTrace0( TRACE_NORMAL, DROUTER_DEALLOCATEBLOCK_EXIT, "<DRouter::DeAllocateBlock" );
|
|
386 |
}
|
|
387 |
|
|
388 |
EXPORT_C TInt DRouter::GetConnectionStatus(
|
|
389 |
// None
|
|
390 |
)
|
|
391 |
{
|
|
392 |
OstTrace0( TRACE_NORMAL, DROUTER_GETCONNECTIONSTATUS_ENTRY, "<DRouter::GetConnectionStatus" );
|
|
393 |
|
|
394 |
C_TRACE( ( _T( "DRouter::GetConnectionStatus %d <->" ), iConnectionStatus ) );
|
|
395 |
ASSERT_DFCTHREAD_INEXT();
|
|
396 |
|
|
397 |
OstTrace1( TRACE_NORMAL, DROUTER_GETCONNECTIONSTATUS, "<DRouter::GetConnectionStatus;iConnectionStatus=%x", iConnectionStatus );
|
|
398 |
return iConnectionStatus;
|
|
399 |
}
|
|
400 |
|
|
401 |
EXPORT_C TInt DRouter::GetFlowControlStatus()
|
|
402 |
{
|
|
403 |
OstTrace0( TRACE_NORMAL, DROUTER_GETFLOWCONTROLSTATUS_ENTRY, "<>DRouter::GetFlowControlStatus" );
|
|
404 |
ASSERT_DFCTHREAD_INEXT();
|
|
405 |
return KErrNotSupported; // TODO
|
|
406 |
}
|
|
407 |
|
|
408 |
EXPORT_C TInt DRouter::GetMaxDataSize(
|
|
409 |
// None
|
|
410 |
)
|
|
411 |
{
|
|
412 |
OstTrace0( TRACE_NORMAL, DROUTER_GETMAXDATASIZE_ENTRY, ">DRouter::GetMaxDataSize" );
|
|
413 |
|
|
414 |
C_TRACE( ( _T( "DRouter::GetMaxDataSize ->" ) ) );
|
|
415 |
ASSERT_DFCTHREAD_INEXT();
|
|
416 |
TInt excludeSize( iMaxFrameSize - ( ISI_HEADER_SIZE + PNS_PIPE_DATA_OFFSET_DATA ) );
|
|
417 |
// Set the data to be divisible by four.
|
|
418 |
TInt allowedCount( excludeSize - ( excludeSize % 4 ) );
|
|
419 |
C_TRACE( ( _T( "DRouter::GetMaxDataSize %d <-" ), allowedCount ) );
|
|
420 |
|
|
421 |
OstTrace1( TRACE_NORMAL, DROUTER_GETMAXDATASIZE_EXIT, "<DRouter::GetMaxDataSize;allowedCount=%d", allowedCount );
|
|
422 |
return allowedCount;
|
|
423 |
}
|
|
424 |
|
|
425 |
// KErrNone, channelid with channel object open ok
|
|
426 |
// KErrNotSupported, resource not supported or in use causes name_add_req to fail
|
|
427 |
// KErrInUse, channelid opened by same channel object earlier
|
|
428 |
// KErrAlreadyExists, channel opened by some other channel object earlier
|
|
429 |
// In completechannelreq, set ~channel number as ~~channelnumber only if KErrNone or KErrInUse
|
|
430 |
EXPORT_C void DRouter::Open(
|
|
431 |
const TUint16 aChannel,
|
|
432 |
const TUint16 aRequest,
|
|
433 |
MIAD2ChannelApi* aCallback
|
|
434 |
)
|
|
435 |
{
|
|
436 |
OstTraceExt3( TRACE_NORMAL, DROUTER_OPEN_ENTRY, ">DRouter::Open;aChannel=%hx;aRequest=%hu;aCallback=%x", aChannel, aRequest, ( TUint )( aCallback ) );
|
|
437 |
|
|
438 |
|
|
439 |
C_TRACE( ( _T( "DRouter::Open 0x%x %d 0x%x ->" ), aChannel, aRequest, aCallback ) );
|
|
440 |
ASSERT_RESET_ALWAYS( aCallback, EIADNullParameter | EIADFaultIdentifier19 << KFaultIdentifierShift );
|
|
441 |
ASSERT_DFCTHREAD_INEXT();
|
|
442 |
ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, EIADWrongParameter | (TUint8)aChannel << KChannelNumberShift | EIADFaultIdentifier26 << KFaultIdentifierShift );
|
|
443 |
if( iConnectionStatus == EIADConnectionOk )
|
|
444 |
{
|
|
445 |
// If not null channel is allready open.
|
|
446 |
if( iChannelTable[ aChannel ].iChannel ||
|
|
447 |
iChannelTable[ aChannel ].iWaitingChannel )
|
|
448 |
{
|
|
449 |
// If another channel tries to open already open channel.
|
|
450 |
TRACE_WARNING( iChannelTable[ aChannel ].iChannel == aCallback, (TUint8)aChannel << KChannelNumberShift );
|
|
451 |
// If same object calling KErrInUser if other but same channel KErrAlreadyExists
|
|
452 |
aCallback->CompleteChannelRequest( aRequest, ( iChannelTable[ aChannel ].iChannel == aCallback ? KErrInUse : KErrAlreadyExists ) );
|
|
453 |
}
|
|
454 |
// Null so channel is not open, set !null to mark opened channel.
|
|
455 |
else
|
|
456 |
{
|
|
457 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
458 |
const TBool drmChannel( ( aChannel == EIADNokiaDRM || aChannel == EIADNokiaSecurityDriver ) ? ETrue : EFalse );
|
|
459 |
if( drmChannel )
|
|
460 |
{
|
|
461 |
C_TRACE( ( _T( "DRouter::Open channel 0x%x drm 0x%x" ), aChannel, aCallback ) );
|
|
462 |
OstTraceExt1( TRACE_NORMAL, DROUTER_OPEN, "DRouter::Open DRM;aChannel=%hx", aChannel );
|
|
463 |
iChannelTable[ aChannel ].iWaitingChannel = aCallback;
|
|
464 |
iChannelTable[ aChannel ].iType = EDrmOpen;
|
|
465 |
SendDrmReq( aChannel );
|
|
466 |
}
|
|
467 |
else
|
|
468 |
{
|
|
469 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
470 |
C_TRACE( ( _T( "DRouter::Open channel 0x%x normal 0x%x" ), aChannel, aCallback ) );
|
|
471 |
OstTraceExt1( TRACE_NORMAL, DUP1_DROUTER_OPEN, "DRouter::Open normal;aChannel=%hx", aChannel );
|
|
472 |
iChannelTable[ aChannel ].iChannel = aCallback;
|
|
473 |
aCallback->CompleteChannelRequest( aRequest, KErrNone );
|
|
474 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
475 |
}
|
|
476 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
477 |
}
|
|
478 |
}
|
|
479 |
else
|
|
480 |
{
|
|
481 |
C_TRACE( ( _T( "DRouter::Open not ready" ) ) );
|
|
482 |
OstTrace0( TRACE_NORMAL, DUP2_DROUTER_OPEN, "DRouter::Open Not ready" );
|
|
483 |
ASSERT_RESET_ALWAYS( !iChannelTable[ aChannel ].iWaitingChannel, EIADWrongRequest | EIADFaultIdentifier15 << KFaultIdentifierShift );
|
|
484 |
iChannelTable[ aChannel ].iWaitingChannel = aCallback;
|
|
485 |
iChannelTable[ aChannel ].iType = ( ( aChannel == EIADNokiaDRM || aChannel == EIADNokiaSecurityDriver ) ?
|
|
486 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
487 |
EDrmOpen : ENormalOpen );
|
|
488 |
#else
|
|
489 |
ENormalOpen : ENormalOpen );
|
|
490 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
491 |
}
|
|
492 |
C_TRACE( ( _T( "DRouter::Open 0x%x <-" ), aChannel ) );
|
|
493 |
|
|
494 |
OstTraceExt1( TRACE_NORMAL, DROUTER_OPEN_EXIT, "<DRouter::Open;aChannel=%hx", aChannel );
|
|
495 |
|
|
496 |
}
|
|
497 |
|
|
498 |
// With resource and media
|
|
499 |
EXPORT_C void DRouter::Open(
|
|
500 |
const TUint16 aChannel,
|
|
501 |
const TUint16 aRequest,
|
|
502 |
const TDesC8& aOpenInfo,
|
|
503 |
MIAD2ChannelApi* aCallback
|
|
504 |
)
|
|
505 |
{
|
|
506 |
OstTraceExt4( TRACE_NORMAL, DUP1_DROUTER_OPEN_ENTRY, ">DRouter::Open;aChannel=%hx;aRequest=%hu;aOpenInfo=%x;aCallback=%x", aChannel, aRequest, ( TUint )&( aOpenInfo ), ( TUint )( aCallback ) );
|
|
507 |
//TODO: open with resource: change not to be permit one and in closing pn_name_remove_req.
|
|
508 |
C_TRACE( ( _T( "DRouter::Open 0x%x %d 0x%x 0x%x ->" ), aChannel, aRequest, &aOpenInfo, aCallback ) );
|
|
509 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
510 |
ASSERT_RESET_ALWAYS( aCallback, EIADNullParameter | EIADFaultIdentifier20 << KFaultIdentifierShift );
|
|
511 |
ASSERT_DFCTHREAD_INEXT();
|
|
512 |
ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, EIADWrongParameter | (TUint8)aChannel << KChannelNumberShift | EIADFaultIdentifier27 << KFaultIdentifierShift );
|
|
513 |
if( iConnectionStatus == EIADConnectionOk )
|
|
514 |
{
|
|
515 |
// If not null channel is allready open.
|
|
516 |
if( iChannelTable[ aChannel ].iChannel ||
|
|
517 |
iChannelTable[ aChannel ].iWaitingChannel )
|
|
518 |
{
|
|
519 |
// If another channel tries to open already open channel.
|
|
520 |
OstTrace0( TRACE_NORMAL, DUP4_DROUTER_OPEN, "DRouter::Open already open channel" );
|
|
521 |
TRACE_WARNING( iChannelTable[ aChannel ].iChannel == aCallback, (TUint8)aChannel << KChannelNumberShift );
|
|
522 |
aCallback->CompleteChannelRequest( aRequest, ( iChannelTable[ aChannel ].iChannel == aCallback ? KErrInUse : KErrAlreadyExists ) );
|
|
523 |
}
|
|
524 |
// Null so channel is not open, set !null to mark opened channel.
|
|
525 |
else
|
|
526 |
{
|
|
527 |
OstTrace0( TRACE_NORMAL, DUP3_DROUTER_OPEN, "DRouter::Open with resource" );
|
|
528 |
C_TRACE( ( _T( "DRouter::Open channel with resource 0x%x 0x%x" ), aChannel, aCallback ) );
|
|
529 |
iChannelTable[ aChannel ].iWaitingChannel = aCallback;
|
|
530 |
iChannelTable[ aChannel ].iType = ENameAddOpen;
|
|
531 |
SendPnsNameAddReq( aChannel, aOpenInfo );
|
|
532 |
}
|
|
533 |
}
|
|
534 |
else
|
|
535 |
{
|
|
536 |
C_TRACE( ( _T( "DRouter::Open with resource not ready" ) ) );
|
|
537 |
// Opening with resource Id is not supported before IAD is initialized.
|
|
538 |
// If needed, client can open channel without resource Id and send PNS_NAME_ADD_REQ after
|
|
539 |
// channel open is actually completed
|
|
540 |
TRACE_ASSERT_INFO( 0, (TUint8)aChannel<<KChannelNumberShift );
|
|
541 |
ASSERT_RESET_ALWAYS( iBootDone, EIADNotSupported | EIADFaultIdentifier5 << KFaultIdentifierShift | (TUint8)aChannel<<KChannelNumberShift );
|
|
542 |
}
|
|
543 |
#else // NCP_COMMON_BRIDGE_FAMILY
|
|
544 |
// Some maniac from modem sw decided to remove name service in the last meters, hip-hip hurray inform which clients use resource from open to help debug!
|
|
545 |
TRACE_ASSERT_INFO( 0, (TUint8)aChannel<<KChannelNumberShift );
|
|
546 |
// Treat as normal open to enable the sending NOTE! resource is not functioning!!
|
|
547 |
Open( aChannel, aRequest, aCallback );
|
|
548 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
549 |
|
|
550 |
C_TRACE( ( _T( "DRouter::Open 0x%x <-" ), aChannel ) );
|
|
551 |
|
|
552 |
OstTraceExt1( TRACE_NORMAL, DUP1_DROUTER_OPEN_EXIT, "<DRouter::Open;aChannel=%hx", aChannel );
|
|
553 |
}
|
|
554 |
|
|
555 |
#if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95)
|
|
556 |
EXPORT_C TInt DRouter::Loan(
|
|
557 |
const TUint16 aChannel,
|
|
558 |
const TUint16 aRequest,
|
|
559 |
MIAD2ChannelApi* aCallback
|
|
560 |
)
|
|
561 |
{
|
|
562 |
|
|
563 |
C_TRACE( ( _T( "DRouter::Loan 0x%x %d 0x%x ->" ), aChannel, aRequest, aCallback ) );
|
|
564 |
OstTraceExt3( TRACE_NORMAL, DUP1_DROUTER_LOAN_ENTRY, ">DRouter::Loan;aChannel=%hx;aRequest=%hu;aCallback=%x", aChannel, aRequest, ( TUint )( aCallback ) );
|
|
565 |
ASSERT_RESET_ALWAYS( aCallback, EIADNullParameter | EIADFaultIdentifier19 << KFaultIdentifierShift );// TODO
|
|
566 |
ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, EIADWrongParameter | EIADFaultIdentifier11 << KFaultIdentifierShift );// TODO
|
|
567 |
ASSERT_DFCTHREAD_INEXT();
|
|
568 |
ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, aChannel );
|
|
569 |
TInt error( KErrNone );
|
|
570 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
571 |
// Is connection lost.
|
|
572 |
error = ( iConnectionStatus == EIADConnectionNotOk ) ? KErrNotSupported : error;
|
|
573 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
574 |
// Is loaning a resticted channel.
|
|
575 |
error = ( KErrNone == error && ( aChannel == EIADNokiaDRM || aChannel == EIADNokiaSecurityDriver ) ) ? KErrNotSupported : error;
|
|
576 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
577 |
// Is loaning it self?
|
|
578 |
error = ( KErrNone == error && ( iChannelTable[ aChannel ].iChannel == aCallback ) ) ? KErrNotSupported : error;
|
|
579 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
580 |
// Is loaning currently not open channel.
|
|
581 |
error = ( KErrNone == error && ( !iChannelTable[ aChannel ].iChannel ) ) ? KErrNotSupported : error;
|
|
582 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
583 |
// Is loaning already loaned channel.
|
|
584 |
error = ( KErrNone == error && ( iChannelTable[ aChannel ].iType == ELoan ) ) ? KErrAlreadyExists : error;
|
|
585 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
586 |
if( KErrNone == error )
|
|
587 |
{
|
|
588 |
// Who is loaning whose channel.
|
|
589 |
C_TRACE( ( _T( "DRouter::Loan loaning ch 0x%x from chObj 0x%x to chObj 0x%x setting previous as waiting" ), aChannel, iChannelTable[ aChannel ].iChannel, aCallback ) );
|
|
590 |
OstTraceExt3( TRACE_NORMAL, DUP1_DROUTER_LOAN, "DRouter::Loan loaning;aChannel=%hx;channelPtr=%hx;callbackPtr=%hx", aChannel, (TUint)iChannelTable[ aChannel ].iChannel, (TUint)aCallback );
|
|
591 |
iChannelTable[ aChannel ].iWaitingChannel = iChannelTable[ aChannel ].iChannel;// TEST WITH WAITING CHANNEL FIRST
|
|
592 |
iChannelTable[ aChannel ].iType = ELoan;
|
|
593 |
iChannelTable[ aChannel ].iChannel = aCallback;
|
|
594 |
iPipeHandler->PipeLoaned( aChannel, aCallback );
|
|
595 |
}
|
|
596 |
#endif
|
|
597 |
C_TRACE( ( _T( "DRouter::Loan 0x%x %d<-" ), aChannel, error ) );
|
|
598 |
OstTraceExt2( TRACE_NORMAL, DUP1_DROUTER_LOAN_EXIT, "<DRouter::Loan;aChannel=%hx;error=%d", aChannel, error );
|
|
599 |
return error;
|
|
600 |
|
|
601 |
}
|
|
602 |
|
|
603 |
EXPORT_C TInt DRouter::ReturnLoan(
|
|
604 |
const TUint16 aChannel,
|
|
605 |
const TUint16 aRequest,
|
|
606 |
MIAD2ChannelApi* aCallback
|
|
607 |
)
|
|
608 |
{
|
|
609 |
|
|
610 |
C_TRACE( ( _T( "DRouter::ReturnLoan 0x%x %d 0x%x ->" ), aChannel, aRequest, aCallback ) );
|
|
611 |
OstTraceExt3( TRACE_NORMAL, DUP1_DROUTER_RETURNLOAN_ENTRY, ">DRouter::ReturnLoan;aChannel=%hx;aRequest=%hu;aCallback=%x", aChannel, aRequest, ( TUint )( aCallback ) );
|
|
612 |
ASSERT_RESET_ALWAYS( aCallback, EIADNullParameter | EIADFaultIdentifier19 << KFaultIdentifierShift );// TODO
|
|
613 |
ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, EIADWrongParameter | EIADFaultIdentifier11 << KFaultIdentifierShift );// TODO
|
|
614 |
ASSERT_DFCTHREAD_INEXT();
|
|
615 |
ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, aChannel );
|
|
616 |
TInt error( KErrNone );
|
|
617 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
618 |
// Is connection lost.
|
|
619 |
error = ( iConnectionStatus == EIADConnectionNotOk ) ? KErrNotSupported : error;
|
|
620 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
621 |
// Is loaning a resticted channel.
|
|
622 |
error = ( KErrNone == error && ( aChannel == EIADNokiaDRM || aChannel == EIADNokiaSecurityDriver ) ) ? KErrNotSupported : error;
|
|
623 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
624 |
// Is retuning someone elses loan?
|
|
625 |
error = ( KErrNone == error && ( iChannelTable[ aChannel ].iChannel != aCallback ) ) ? KErrNotSupported : error;
|
|
626 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
627 |
// Is returning currently not open channel.
|
|
628 |
error = ( KErrNone == error && ( !iChannelTable[ aChannel ].iChannel ) ) ? KErrNotSupported : error;
|
|
629 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
630 |
// Is returning a not loaned channel.
|
|
631 |
error = ( KErrNone == error && ( iChannelTable[ aChannel ].iType != ELoan ) ) ? KErrAlreadyExists : error;
|
|
632 |
TRACE_ASSERT_INFO( KErrNone == error, error );
|
|
633 |
if( KErrNone == error )
|
|
634 |
{
|
|
635 |
// Who is loaning whose channel.
|
|
636 |
C_TRACE( ( _T( "DRouter::ReturnLoan returning loan ch 0x%x to chObj 0x%x from chObj 0x%x setting previous as waiting" ), aChannel, iChannelTable[ aChannel ].iWaitingChannel, aCallback ) );
|
|
637 |
OstTraceExt3( TRACE_NORMAL, DUP1_DROUTER_RETURNLOAN, "DRouter::Loan loaning;aChannel=%hx;waitingchannelPtr=%hx;callbackPtr=%hx", aChannel, (TUint)iChannelTable[ aChannel ].iWaitingChannel, (TUint)aCallback );
|
|
638 |
iPipeHandler->PipeLoanReturned( aChannel, iChannelTable[ aChannel ].iWaitingChannel );
|
|
639 |
}
|
|
640 |
#endif
|
|
641 |
C_TRACE( ( _T( "DRouter::ReturnLoan 0x%x %d<-" ), aChannel, error ) );
|
|
642 |
OstTraceExt2( TRACE_NORMAL, DUP1_DROUTER_RETURNLOAN_EXIT, "<DRouter::ReturnLoan;aChannel=%hx;error=%d", aChannel, error );
|
|
643 |
return error;
|
|
644 |
|
|
645 |
}
|
|
646 |
#endif
|
|
647 |
|
|
648 |
EXPORT_C TInt DRouter::OrderIndication(
|
|
649 |
TDes8& anOrder,
|
|
650 |
const TUint16 aCh,
|
|
651 |
const TBool a32Bit
|
|
652 |
)
|
|
653 |
{
|
|
654 |
OstTraceExt3( TRACE_NORMAL, DROUTER_ORDERINDICATION_ENTRY, ">DRouter::OrderIndication;anOrder=%x;aCh=%hx;a32Bit=%d", ( TUint )&( anOrder ), aCh, a32Bit );
|
|
655 |
|
|
656 |
C_TRACE( ( _T( "DRouter::OrderIndication 0x%x 0x%x %d ->" ), &anOrder, aCh, a32Bit ) );
|
|
657 |
ASSERT_DFCTHREAD_INEXT();
|
|
658 |
TInt orderLength( anOrder.Length() );
|
|
659 |
TInt msgOk = ( 0 == orderLength ) ? KErrBadDescriptor : KErrNone;
|
|
660 |
TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
|
|
661 |
// Should be divisible by two if not 32 bit.
|
|
662 |
msgOk = ( ( msgOk == KErrNone && ( !a32Bit && 0 != orderLength % 2 ) ) ? KErrBadDescriptor : msgOk );
|
|
663 |
TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
|
|
664 |
// Should be divisible by five if 32 bit.
|
|
665 |
msgOk = ( ( msgOk == KErrNone && ( a32Bit && 0 != orderLength % 5 ) ) ? KErrBadDescriptor : msgOk );
|
|
666 |
TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
|
|
667 |
msgOk = ( ( msgOk == KErrNone && ( orderLength > GetMaxDataSize() ) ) ? KErrUnderflow : msgOk );
|
|
668 |
TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
|
|
669 |
if( KErrNone == msgOk )
|
|
670 |
{
|
|
671 |
msgOk = iIndicationHandler->Subscribe( anOrder, aCh, a32Bit );
|
|
672 |
TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
|
|
673 |
}
|
|
674 |
C_TRACE( ( _T( "DRouter::OrderIndication 0x%x 0x%x %d %d <-" ), &anOrder, aCh, a32Bit, msgOk ) );
|
|
675 |
|
|
676 |
OstTrace1( TRACE_NORMAL, DROUTER_ORDERINDICATION, "<DRouter::OrderIndication;msgOk=%x", msgOk );
|
|
677 |
return msgOk;
|
|
678 |
}
|
|
679 |
|
|
680 |
EXPORT_C TInt DRouter::SendMessage(
|
|
681 |
TDes8& aMessage,
|
|
682 |
const TUint16 aCh
|
|
683 |
)
|
|
684 |
{
|
|
685 |
|
|
686 |
OstTraceExt2( TRACE_NORMAL, DROUTER_SENDMESSAGE_ENTRY, "<DRouter::SendMessage;aMessage=%x;aCh=%hx", ( TUint )&( aMessage ), aCh );
|
|
687 |
OstTraceExt1( TRACE_NORMAL, DUP4_DROUTER_SENDMESSAGE, "DRouter::SendMessage;aCh=%hx", aCh );
|
|
688 |
C_TRACE( ( _T( "DRouter::SendMessage 0x%x 0x%x ->" ), &aMessage, aCh ) );
|
|
689 |
ASSERT_RESET_ALWAYS( iMaxFrameSize != 0x0000, EIADCmtConnectionNotInit );
|
|
690 |
TInt error( ValiDateIsiMessage( aMessage ) );
|
|
691 |
error = ( KErrNone == error && iConnectionStatus != EIADConnectionOk ) ? KErrNotReady : error;
|
|
692 |
if( KErrNone == error )
|
|
693 |
{
|
|
694 |
ASSERT_RESET_ALWAYS( aCh != KNotInitializedChannel, EIADWrongParameter | EIADFaultIdentifier12 << KFaultIdentifierShift );
|
|
695 |
C_TRACE( ( _T( "DRouter::SendMessage sending 0x%x" ), &aMessage ) );
|
|
696 |
OstTraceExt2( TRACE_NORMAL, DROUTER_SENDMESSAGE, "DRouter::SendMessage;error=%d;aCh=%hx", error, aCh );
|
|
697 |
|
|
698 |
SetSenderInfo( aMessage, aCh );
|
|
699 |
const TUint8* msgBlockPtr( aMessage.Ptr() );
|
|
700 |
// TODO: Simplify this
|
|
701 |
ASSERT_RESET_ALWAYS( aMessage.Length() > ISI_HEADER_OFFSET_RESOURCEID, EIADOverTheLimits | EIADFaultIdentifier2 << KFaultIdentifierShift );
|
|
702 |
if( msgBlockPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_PIPE && msgBlockPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == THIS_DEVICE )
|
|
703 |
{
|
|
704 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
705 |
// This shall send the message and deallocate it too.
|
|
706 |
error = iPipeHandler->SendPipeMessage( aMessage, aCh );
|
|
707 |
#endif
|
|
708 |
if( error != KErrNone )
|
|
709 |
{
|
|
710 |
// Deallocate the block.
|
|
711 |
this->DeAllocateBlock( aMessage );
|
|
712 |
}
|
|
713 |
}
|
|
714 |
else
|
|
715 |
{
|
|
716 |
// Route indication to possible subscribers in this device
|
|
717 |
if( GET_RECEIVER_OBJ( msgBlockPtr ) == PN_OBJ_EVENT_MULTICAST &&
|
|
718 |
IS_DEV_HOST( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] ) )
|
|
719 |
{
|
|
720 |
DATA_DUMP_TRACE( aMessage, ETrue );
|
|
721 |
OstTraceData( TRACE_ISIMSG, DROUTER_SENDMESSAGE_DATA, "DRouter::SendMsg indication TX: %hx", aMessage.Ptr(), aMessage.Length() );
|
|
722 |
C_TRACE( ( _T( "DRouter::SendMessage routing indication to device PN_DEV_SOS 0x%x" ), &aMessage ) );
|
|
723 |
OstTrace0( TRACE_NORMAL, DUP2_DROUTER_SENDMESSAGE, "DRouter::SendMessage indication to PN_DEV_SOS" );
|
|
724 |
TDes8& tmpIndication = AllocateBlock( aMessage.Length() );
|
|
725 |
tmpIndication.SetLength( aMessage.Length() );
|
|
726 |
tmpIndication.Copy( aMessage );
|
|
727 |
TUint8* indicationPtr = const_cast<TUint8*>( tmpIndication.Ptr() );
|
|
728 |
SET_RECEIVER_DEV( indicationPtr, THIS_DEVICE );
|
|
729 |
SET_RECEIVER_OBJ( indicationPtr, KIADEventSubscriptionObjId );
|
|
730 |
this->MessageReceived( tmpIndication );
|
|
731 |
}
|
|
732 |
// The IST shall deallocate the block when it's approriate to do.
|
|
733 |
C_TRACE( ( _T( "DRouter::SendMessage sending 0x%x" ), &aMessage ) );
|
|
734 |
OstTrace1( TRACE_NORMAL, DUP3_DROUTER_SENDMESSAGE, "DRouter::SendMessage;aMessage=%x", (TUint)&(aMessage ));
|
|
735 |
error = SendMsg( aMessage );
|
|
736 |
}//PIPE
|
|
737 |
}
|
|
738 |
else
|
|
739 |
{
|
|
740 |
C_TRACE( ( _T( "DRouter::SendMessage not sending due error 0x%x %d %d" ), &aMessage, aCh, error ) );
|
|
741 |
OstTraceExt2( TRACE_NORMAL, DUP1_DROUTER_SENDMESSAGE, "DRouter::SendMessage;aCh=%hx;error=%d", aCh, error );
|
|
742 |
// Deallocate the block.
|
|
743 |
TRACE_ASSERT_INFO( 0, (TUint8)aCh<<KChannelNumberShift | (TUint8)error );
|
|
744 |
this->DeAllocateBlock( aMessage );
|
|
745 |
// TODO: who should NULL the block? IST or IAD
|
|
746 |
}
|
|
747 |
C_TRACE( ( _T( "DRouter::SendMessage 0x%x %d %d <-" ), &aMessage, aCh, error ) );
|
|
748 |
OstTraceExt2( TRACE_NORMAL, DROUTER_SENDMESSAGE_EXIT, "<DRouter::SendMessage;aCh=%hx;error=%d", aCh, error );
|
|
749 |
return error;
|
|
750 |
|
|
751 |
}
|
|
752 |
|
|
753 |
EXPORT_C TInt DRouter::SendIndication(
|
|
754 |
TDes8& aMessage,
|
|
755 |
const TUint16 aCh
|
|
756 |
)
|
|
757 |
{
|
|
758 |
|
|
759 |
OstTraceExt2( TRACE_NORMAL, DROUTER_SENDINDICATION_ENTRY, ">DRouter::SendIndication;aMessage=%x;aCh=%hx", ( TUint )&( aMessage ), aCh );
|
|
760 |
C_TRACE( ( _T( "DRouter::SendIndication 0x%x 0x%x ->" ), &aMessage, aCh ) );
|
|
761 |
TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() );
|
|
762 |
SET_RECEIVER_DEV( msgPtr,OTHER_DEVICE_1 );
|
|
763 |
SET_RECEIVER_OBJ( msgPtr,PN_OBJ_EVENT_MULTICAST );
|
|
764 |
TInt error( SendMessage( aMessage, aCh ) );
|
|
765 |
C_TRACE( ( _T( "DRouter::SendIndication 0x%x 0x%x %d <-" ), &aMessage, aCh, error ) );
|
|
766 |
OstTrace1( TRACE_NORMAL, DROUTER_SENDINDICATION_EXIT, "<DRouter::SendIndication;error=%d", error );
|
|
767 |
return error;
|
|
768 |
|
|
769 |
}
|
|
770 |
|
|
771 |
// From end
|
|
772 |
|
|
773 |
void DRouter::NotifyObjLayerConnStatDfc(
|
|
774 |
TAny* aPtr
|
|
775 |
)
|
|
776 |
{
|
|
777 |
OstTrace1( TRACE_NORMAL, DROUTER_NOTIFYOBJLAYERCONNSTATDFC_ENTRY, ">DRouter::NotifyObjLayerConnStatDfc;aPtr=%x", ( TUint )( aPtr ) );
|
|
778 |
|
|
779 |
C_TRACE( ( _T( "DRouter::NotifyObjLayerConnStatDfc ->" ) ) );
|
|
780 |
DRouter* self = reinterpret_cast<DRouter*>( aPtr );
|
|
781 |
self->NotifyObjLayerConnStat( self->iConnectionStatus );
|
|
782 |
C_TRACE( ( _T( "DRouter::NotifyObjLayerConnStatDfc to %d <-" ), self->iConnectionStatus ) );
|
|
783 |
|
|
784 |
OstTrace1( TRACE_NORMAL, DROUTER_NOTIFYOBJLAYERCONNSTATDFC_EXIT, "<DRouter::NotifyObjLayerConnStatDfc;self->iConnectionStatus=%x", self->iConnectionStatus );
|
|
785 |
}
|
|
786 |
|
|
787 |
void DRouter::NotifyObjLayerConnStat(
|
|
788 |
const TIADConnectionStatus aStatus
|
|
789 |
)
|
|
790 |
{
|
|
791 |
OstTrace1( TRACE_NORMAL, DROUTER_NOTIFYOBJLAYERCONNSTAT_ENTRY, ">DRouter::NotifyObjLayerConnStat;aStatus=%x", ( TUint )&( aStatus ) );
|
|
792 |
|
|
793 |
C_TRACE( ( _T( "DRouter::NotifyObjLayerConnStat %d ->" ), aStatus ) );
|
|
794 |
ASSERT_DFCTHREAD_INEXT();
|
|
795 |
for( TUint16 i( 0 ); i < EIADSizeOfChannels; ++i )
|
|
796 |
{
|
|
797 |
if( iChannelTable[ i ].iChannel )
|
|
798 |
{
|
|
799 |
C_TRACE( ( _T( "DRouter::NotifyObjLayerConnStat ch %d ptr 0x%x" ), i, iChannelTable[ i ].iChannel ) );
|
|
800 |
OstTraceExt2( TRACE_NORMAL, DUP1_DROUTER_NOTIFYOBJLAYERCONNSTAT, "DRouter::NotifyObjLayerConnStat;i=%hx;iChannelTable[ i ].iChannel=%x", i,( TUint ) ( iChannelTable[ i ].iChannel ) );
|
|
801 |
iChannelTable[ i ].iChannel->NotifyConnectionStatus( aStatus );
|
|
802 |
}
|
|
803 |
// TODO: If we need open to be waiting until connection status is ok, set waiting here.
|
|
804 |
}
|
|
805 |
C_TRACE( ( _T( "DRouter::NotifyObjLayerConnStat %d <-" ), aStatus ) );
|
|
806 |
OstTrace0( TRACE_NORMAL, DROUTER_NOTIFYOBJLAYERCONNSTAT_EXIT, "<DRouter::NotifyObjLayerConnStat" );
|
|
807 |
}
|
|
808 |
|
|
809 |
// Used internally in IAD.
|
|
810 |
// Can be called in 1..N thread contextes and returns immediately.
|
|
811 |
void DRouter::MessageReceived(
|
|
812 |
TDes8& aMsg
|
|
813 |
)
|
|
814 |
{
|
|
815 |
|
|
816 |
OstTrace1( TRACE_NORMAL, DROUTER_MESSAGERECEIVED_ENTRY, ">DRouter::MessageReceived;aMsg=%x", ( TUint )&( aMsg ) );
|
|
817 |
C_TRACE( ( _T( "DRouter::MessageReceived 0x%x ->" ), &aMsg ) );
|
|
818 |
// Let MaxLength to be the length of the allocated block. (IST (SSI&SISA) can work differently.
|
|
819 |
// SISA set length and maxlength according to ISI msg length, but SSI set length according to block length
|
|
820 |
// Block length in SSI at the moment always %4.
|
|
821 |
// Set the length of the descriptor to ISI message length + PN_HEADER_SIZE
|
|
822 |
// TODO : harmonize these IST differencies.
|
|
823 |
TInt len( GET_LENGTH( aMsg ) );
|
|
824 |
len += PN_HEADER_SIZE;
|
|
825 |
aMsg.SetLength( len );
|
|
826 |
iCommonRxQueue->Add( aMsg );
|
|
827 |
iCommonRxDfc->Enque();
|
|
828 |
C_TRACE( ( _T( "DRouter::MessageReceived 0x%x <-" ), &aMsg ) );
|
|
829 |
OstTrace0( TRACE_NORMAL, DROUTER_MESSAGERECEIVED_EXIT, "<DRouter::MessageReceived" );
|
|
830 |
|
|
831 |
}
|
|
832 |
|
|
833 |
//PRIVATES
|
|
834 |
|
|
835 |
void DRouter::HandleIsiMessage(
|
|
836 |
TDes8& aMsg
|
|
837 |
)
|
|
838 |
{
|
|
839 |
OstTrace1( TRACE_NORMAL, DROUTER_HANDLEISIMESSAGE_ENTRY, ">DRouter::HandleIsiMessage;aMsg=%x", ( TUint )&( aMsg ) );
|
|
840 |
|
|
841 |
C_TRACE( ( _T( "DRouter::HandleIsiMessage 0x%x ->" ), &aMsg ) );
|
|
842 |
const TUint16 rcvObjId( GET_RECEIVER_OBJ( aMsg ) );
|
|
843 |
C_TRACE( ( _T( "DRouter::HandleIsiMessage rcvObjId 0x%x" ), rcvObjId ) );
|
|
844 |
ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift | EIADFaultIdentifier22 << KFaultIdentifierShift );
|
|
845 |
if( iChannelTable[ rcvObjId ].iChannel )
|
|
846 |
{
|
|
847 |
iChannelTable[ rcvObjId ].iChannel->ReceiveMsg( aMsg );
|
|
848 |
// DeAllocation done by the channel after writing to client's address space.
|
|
849 |
}
|
|
850 |
else
|
|
851 |
{
|
|
852 |
SendCommIsaEntityNotReachableResp( aMsg );
|
|
853 |
// Not going to anywhere deallocate.
|
|
854 |
DeAllocateBlock( aMsg );
|
|
855 |
}
|
|
856 |
C_TRACE( ( _T( "DRouter::HandleIsiMessage 0x%x <-" ), &aMsg ) );
|
|
857 |
|
|
858 |
OstTrace0( TRACE_NORMAL, DROUTER_HANDLEISIMESSAGE_EXIT, "<DRouter::HandleIsiMessage" );
|
|
859 |
}
|
|
860 |
|
|
861 |
|
|
862 |
void DRouter::HandlePipeMessage(
|
|
863 |
TDes8& aMsg
|
|
864 |
)
|
|
865 |
{
|
|
866 |
OstTrace1( TRACE_NORMAL, DROUTER_HANDLEPIPEMESSAGE_ENTRY, ">DRouter::HandlePipeMessage;aMsg=%x", ( TUint )&( aMsg ) );
|
|
867 |
|
|
868 |
C_TRACE( ( _T( "DRouter::HandlePipeMessage 0x%x ->" ), &aMsg ) );
|
|
869 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
870 |
const TUint16 rcvObjId( GET_RECEIVER_OBJ( aMsg ) );
|
|
871 |
C_TRACE( ( _T( "DRouter::HandlePipeMessage rcvObjId 0x%x" ), rcvObjId ) );
|
|
872 |
ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift| EIADFaultIdentifier25 << KFaultIdentifierShift );
|
|
873 |
MIAD2ChannelApi* openChannel = iChannelTable[ rcvObjId ].iChannel;
|
|
874 |
if( openChannel )
|
|
875 |
{
|
|
876 |
// TODO: is it ok to give channel from here?
|
|
877 |
iPipeHandler->ReceivePipeMessage( aMsg, openChannel );
|
|
878 |
// DeAllocation done by the pipehandler or someone who it frwd's the message.
|
|
879 |
}
|
|
880 |
else
|
|
881 |
{
|
|
882 |
// COMM_ISA_ENTITY_NOT_REACHABLE_RESP NOT SEND TO PIPE MESSAGES
|
|
883 |
TRACE_ASSERT_INFO( 0, (TUint8)rcvObjId<<KChannelNumberShift );
|
|
884 |
// Not going to anywhere deallocate.
|
|
885 |
for( TInt i( 0 ); i < aMsg.Length(); i++ )
|
|
886 |
{
|
|
887 |
Kern::Printf( "%d 0x%x", i, aMsg.Ptr()[ i ] );
|
|
888 |
}
|
|
889 |
DeAllocateBlock( aMsg );
|
|
890 |
}
|
|
891 |
#endif
|
|
892 |
C_TRACE( ( _T( "DRouter::HandlePipeMessage 0x%x <-" ), &aMsg ) );
|
|
893 |
|
|
894 |
OstTrace0( TRACE_NORMAL, DROUTER_HANDLEPIPEMESSAGE_EXIT, "<DRouter::HandlePipeMessage" );
|
|
895 |
}
|
|
896 |
|
|
897 |
void DRouter::HandleMediaMessage(
|
|
898 |
TDes8& aMsg
|
|
899 |
)
|
|
900 |
{
|
|
901 |
OstTrace1( TRACE_NORMAL, DROUTER_HANDLEMEDIAMESSAGE_ENTRY, ">DRouter::HandleMediaMessage;aMsg=%x", ( TUint )&( aMsg ) );
|
|
902 |
|
|
903 |
C_TRACE( ( _T( "DRouter::HandleMediaMessage 0x%x ->" ), &aMsg ) );
|
|
904 |
TUint8 rcvObjId( 0x00);
|
|
905 |
ASSERT_RESET_ALWAYS( aMsg.Length() > ISI_HEADER_OFFSET_MEDIA, EIADOverTheLimits | EIADFaultIdentifier3 << KFaultIdentifierShift );
|
|
906 |
switch( aMsg[ ISI_HEADER_OFFSET_MEDIA ] )
|
|
907 |
{
|
|
908 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
909 |
case PN_MEDIA_USB:
|
|
910 |
{
|
|
911 |
C_TRACE( ( _T( "DRouter::HandleMediaMessage USB" ) ) );
|
|
912 |
OstTrace0( TRACE_NORMAL, DROUTER_HANDLEMEDIAMESSAGE_USB, "DRouter::HandleMediaMessage USB" );
|
|
913 |
rcvObjId = EIADNokiaUsbPhonetLink;
|
|
914 |
break;
|
|
915 |
}
|
|
916 |
case PN_MEDIA_BT:
|
|
917 |
{
|
|
918 |
C_TRACE( ( _T( "DRouter::HandleMediaMessage BT" ) ) );
|
|
919 |
OstTrace0( TRACE_NORMAL, DROUTER_HANDLEMEDIAMESSAGE_BT, "DRouter::HandleMediaMessage BT" );
|
|
920 |
rcvObjId = EIADNokiaBtPhonetLink;
|
|
921 |
break;
|
|
922 |
}
|
|
923 |
//TBR AFTER CMT ERROR CORRECTION : wk49 cellmo has correction, so remove this later on
|
|
924 |
case PN_MEDIA_ROUTING_REQ:
|
|
925 |
{
|
|
926 |
// TODO: write an error! Someone is sending to APE with wrong media.
|
|
927 |
// USB PDD
|
|
928 |
TRACE_ASSERT_ALWAYS;
|
|
929 |
rcvObjId = GET_RECEIVER_OBJ( aMsg );
|
|
930 |
Kern::Printf("Unknown message 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", aMsg[ 0 ], aMsg[ 1 ], aMsg[ 2 ], aMsg[ 3 ], aMsg[ 4 ], aMsg[ 5 ], aMsg[ 6 ], aMsg[ 7 ], aMsg[ 8 ], aMsg[ 9 ] );
|
|
931 |
break;
|
|
932 |
}
|
|
933 |
#endif
|
|
934 |
//TBR AFTER CMT ERROR CORRECTION
|
|
935 |
default:
|
|
936 |
{
|
|
937 |
rcvObjId = GET_RECEIVER_OBJ( aMsg );
|
|
938 |
ASSERT_RESET_ALWAYS( 0, EIADUnkownMedia | ( rcvObjId << KChannelNumberShift ) );
|
|
939 |
break;
|
|
940 |
}
|
|
941 |
}
|
|
942 |
// TODO: UNIQUE
|
|
943 |
ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift | EIADFaultIdentifier3 << KFaultIdentifierShift );
|
|
944 |
if( iChannelTable[ rcvObjId ].iChannel )
|
|
945 |
{
|
|
946 |
iChannelTable[ rcvObjId ].iChannel->ReceiveMsg( aMsg );
|
|
947 |
// DeAllocation done by the channel after writing to client's address space.
|
|
948 |
}
|
|
949 |
else
|
|
950 |
{
|
|
951 |
SendCommIsaEntityNotReachableResp( aMsg );
|
|
952 |
// Not going to anywhere deallocate.
|
|
953 |
DeAllocateBlock( aMsg );
|
|
954 |
}
|
|
955 |
C_TRACE( ( _T( "DRouter::HandleMediaMessage 0x%x <-" ), &aMsg ) );
|
|
956 |
|
|
957 |
OstTrace0( TRACE_NORMAL, DROUTER_HANDLEMEDIAMESSAGE_EXIT, "<DRouter::HandleMediaMessage" );
|
|
958 |
}
|
|
959 |
|
|
960 |
void DRouter::HandleControlMessage(
|
|
961 |
TDes8& aMsg
|
|
962 |
)
|
|
963 |
{
|
|
964 |
OstTrace1( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_ENTRY, ">DRouter::HandleControlMessage;aMsg=%x", ( TUint )&( aMsg ) );
|
|
965 |
|
|
966 |
C_TRACE( ( _T( "DRouter::HandleControlMessage 0x%x ->" ), &aMsg ) );
|
|
967 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
968 |
const TUint8* msgPtr( aMsg.Ptr() );
|
|
969 |
// Check legal msgs
|
|
970 |
ASSERT_RESET_ALWAYS( msgPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_SUBFUNCTION ] == PNS_MEDIA_SPECIFIC_RESP, EIADInvalidCtrlMessage | EIADFaultIdentifier1 << KFaultIdentifierShift );
|
|
971 |
ASSERT_RESET_ALWAYS( msgPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_MEDIATOCTRL ] == PN_MEDIA_SOS, EIADInvalidCtrlMessage | EIADFaultIdentifier2 << KFaultIdentifierShift );
|
|
972 |
ASSERT_RESET_ALWAYS( msgPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_ERRORCODE ] == PN_MCTRL_NO_ERROR, EIADInvalidCtrlMessage | EIADFaultIdentifier3 << KFaultIdentifierShift );
|
|
973 |
ASSERT_RESET_ALWAYS( aMsg.Length() > CTRL_RESP_OFFSET_MESSAGEID, EIADOverTheLimits | EIADFaultIdentifier4 << KFaultIdentifierShift );
|
|
974 |
switch( msgPtr[ CTRL_RESP_OFFSET_MESSAGEID ] )
|
|
975 |
{
|
|
976 |
case KIADCtrlConfResp:
|
|
977 |
{
|
|
978 |
// In MINI_OS case take the maximumdatasize amount from configuration message if bigger than "hat" constant.
|
|
979 |
iMaxFrameSize = KIADMaxIsiMsgSize;
|
|
980 |
#ifdef NCP_COMMON_MINIOS
|
|
981 |
TUint16 confMsgSize = ( ( ( ( TUint16 )( msgPtr[ CTRL_CONF_RESP_OFFSET_SIZE_BYTE1 ] ) ) << 8 ) | ( ( TUint16 )( msgPtr[ CTRL_CONF_RESP_OFFSET_SIZE_BYTE2 ] ) ) );
|
|
982 |
// NOTE! This hat constant has relation to cmt side (sos_mm) if the const is changed in either place harmonize!!
|
|
983 |
const TUint16 KSosProxyHatConst( 2140 );
|
|
984 |
iMaxFrameSize = ( confMsgSize > KSosProxyHatConst ? confMsgSize : KIADMaxIsiMsgSize );
|
|
985 |
ASSERT_RESET_ALWAYS( iMaxFrameSize <= confMsgSize, EIADConfigurationInvalid );
|
|
986 |
#endif
|
|
987 |
// Datalink layer initialized, router layer is this and knows it, now inform obj layer clients.
|
|
988 |
iConnectionStatus = EIADConnectionOk;
|
|
989 |
iBootDone = ETrue;
|
|
990 |
// Could call straight cause the context is the same thread (extension dfc)
|
|
991 |
NotifyObjLayerConnStat( EIADConnectionOk );
|
|
992 |
// TODO: pns_name_add_req
|
|
993 |
// Initialize channels to NULL when channel is opened !NULL.
|
|
994 |
for( TInt i( 0 ); i < EIADSizeOfChannels; ++i )
|
|
995 |
{
|
|
996 |
ASSERT_RESET_ALWAYS( !iChannelTable[ i ].iChannel, EIADChannelOpenedBeforePhysicalLayerInit );
|
|
997 |
C_TRACE( ( _T( "DRouter::HandleControlMessage loop TBR 0x%x" ), i ) );
|
|
998 |
if( iChannelTable[ i ].iWaitingChannel )
|
|
999 |
{
|
|
1000 |
switch( iChannelTable[ i ].iType )
|
|
1001 |
{
|
|
1002 |
case ENormalOpen:
|
|
1003 |
{
|
|
1004 |
C_TRACE( ( _T( "DRouter::HandleControlMessage booting ENormalOpen 0x%x" ), i ) );
|
|
1005 |
OstTrace1( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_NORMAL_OPEN, "DRouter::HandleControlMessage;i=%x", i );
|
|
1006 |
|
|
1007 |
MIAD2ChannelApi* tmpChannel = iChannelTable[ i ].iWaitingChannel;
|
|
1008 |
iChannelTable[ i ].iChannel = tmpChannel;
|
|
1009 |
iChannelTable[ i ].iWaitingChannel = NULL;
|
|
1010 |
iChannelTable[ i ].iChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNone );
|
|
1011 |
break;
|
|
1012 |
}
|
|
1013 |
case EDrmOpen:
|
|
1014 |
{
|
|
1015 |
C_TRACE( ( _T( "DRouter::HandleControlMessage booting EDrmOpen 0x%x" ), i ) );
|
|
1016 |
OstTrace1( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_DRM_OPEN, "DRouter::HandleControlMessage EDrmOpen;i=%x", i );
|
|
1017 |
|
|
1018 |
SendDrmReq( i );
|
|
1019 |
break;
|
|
1020 |
}
|
|
1021 |
case ENameAddOpen:
|
|
1022 |
{
|
|
1023 |
C_TRACE( ( _T( "DRouter::HandleControlMessage booting ENameAddOpen 0x%x" ), i ) );
|
|
1024 |
OstTrace1( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_NAMEADD_OPEN, "DRouter::HandleControlMessage ENameAddOpen;i=%x", i );
|
|
1025 |
|
|
1026 |
// TODO: Not done yet, problem info get as param, channel to allocate deallocate after open complete?
|
|
1027 |
ASSERT_RESET_ALWAYS( 0, EIADWrongParameter | EIADFaultIdentifier13 << KFaultIdentifierShift );
|
|
1028 |
break;
|
|
1029 |
}
|
|
1030 |
default:
|
|
1031 |
{
|
|
1032 |
ASSERT_RESET_ALWAYS( 0, EIADWrongParameter | EIADFaultIdentifier14 << KFaultIdentifierShift );
|
|
1033 |
break;
|
|
1034 |
}
|
|
1035 |
}
|
|
1036 |
}
|
|
1037 |
}
|
|
1038 |
C_TRACE( ( _T( "DRouter::HandleControlMessage conf %d" ), iMaxFrameSize ) );
|
|
1039 |
break;
|
|
1040 |
}
|
|
1041 |
case KIADCtrlDrmResp:
|
|
1042 |
{
|
|
1043 |
const TUint16 channelId( msgPtr[ CTR_DRM_REQ_RESP_OFFSET_CHANNEL_ID ] );
|
|
1044 |
C_TRACE( ( _T( "DRouter::HandleControlMessage drm resp 0x%x" ), channelId ) );
|
|
1045 |
OstTrace0( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_DRM_RESP, "DRouter::HandleControlMessage drm resp");
|
|
1046 |
|
|
1047 |
// Check is this waiting
|
|
1048 |
ASSERT_RESET_ALWAYS( channelId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)channelId << KChannelNumberShift | EIADFaultIdentifier28 << KFaultIdentifierShift );
|
|
1049 |
TRACE_ASSERT_INFO( iChannelTable[ channelId ].iWaitingChannel, (TUint8)channelId<<KChannelNumberShift );
|
|
1050 |
TRACE_ASSERT_INFO( !iChannelTable[ channelId ].iChannel, (TUint8)channelId<<KChannelNumberShift );
|
|
1051 |
ASSERT_RESET_ALWAYS( iChannelTable[ channelId ].iType == EDrmOpen, EIADWrongTypeOfOpenPending | EIADFaultIdentifier1 << KFaultIdentifierShift );
|
|
1052 |
MIAD2ChannelApi* tmpChannel = iChannelTable[ channelId ].iWaitingChannel;
|
|
1053 |
iChannelTable[ channelId ].iChannel = tmpChannel;
|
|
1054 |
iChannelTable[ channelId ].iWaitingChannel = NULL;
|
|
1055 |
C_TRACE( ( _T( "DRouter::HandleControlMessage drm resp 0x%x 0x%x 0x%x 0x%x" ), channelId, tmpChannel, iChannelTable[ channelId ].iChannel, &aMsg ) );
|
|
1056 |
iChannelTable[ channelId ].iChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNone );
|
|
1057 |
break;
|
|
1058 |
}
|
|
1059 |
default:
|
|
1060 |
{
|
|
1061 |
// If wrong message reset! IF changed take care of completion of requests.
|
|
1062 |
ASSERT_RESET_ALWAYS( 0, EIADInvalidCtrlMessage | EIADFaultIdentifier5 << KFaultIdentifierShift );
|
|
1063 |
break;
|
|
1064 |
}
|
|
1065 |
} // switch
|
|
1066 |
#endif
|
|
1067 |
// De-allocate cause not going anywhere else.
|
|
1068 |
DeAllocateBlock( aMsg );
|
|
1069 |
C_TRACE( ( _T( "DRouter::HandleControlMessage 0x%x <-" ), &aMsg ) );
|
|
1070 |
|
|
1071 |
OstTrace0( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_EXIT, "<DRouter::HandleControlMessage" );
|
|
1072 |
}
|
|
1073 |
|
|
1074 |
// KErrBadDescriptor, if message length too small
|
|
1075 |
// KErrUnderFlow, if message length too big.
|
|
1076 |
// KErrCouldNotConnect, if receiver object is out of scope.
|
|
1077 |
TInt DRouter::ValiDateIsiMessage(
|
|
1078 |
TDes8& aMsg
|
|
1079 |
)
|
|
1080 |
{
|
|
1081 |
OstTrace1( TRACE_NORMAL, DROUTER_VALIDATEISIMESSAGE_ENTRY, ">DRouter::ValiDateIsiMessage;aMsg=%x", ( TUint )&( aMsg ) );
|
|
1082 |
|
|
1083 |
C_TRACE( ( _T( "DRouter::ValiDateIsiMessage ->" ) ) );
|
|
1084 |
const TUint16 descLength( aMsg.Length() );
|
|
1085 |
TInt msgOk( KErrNone );
|
|
1086 |
msgOk = ( ISI_HEADER_OFFSET_MESSAGEID >= descLength ) ? KErrBadDescriptor : msgOk;
|
|
1087 |
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
|
|
1088 |
// Get ISI message length after known that the descriptor is big enough.
|
|
1089 |
const TUint8* msgPtr( aMsg.Ptr() );
|
|
1090 |
const TUint16 isiMsgLength( GET_LENGTH( msgPtr ) + PN_HEADER_SIZE );
|
|
1091 |
// TODO: Do we need the underflow information or is it BadDescriptor as good? If so remove msgok == KErrNone...
|
|
1092 |
// If the descriptor length is less than ISI message length.
|
|
1093 |
msgOk = ( ( msgOk == KErrNone && isiMsgLength > descLength ) ? KErrUnderflow : msgOk );
|
|
1094 |
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
|
|
1095 |
// If the ISI message length is bigger that the largest supported.
|
|
1096 |
msgOk = ( ( msgOk == KErrNone && isiMsgLength > KIADMaxIsiMsgSize ) ? KErrUnderflow : msgOk );
|
|
1097 |
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
|
|
1098 |
// If the ISI message length with PN_HEADER_SIZE is less or equal than ISI_HEADER_OFFSET_MESSAGEID.
|
|
1099 |
msgOk = ( ( msgOk == KErrNone && isiMsgLength <= ISI_HEADER_OFFSET_MESSAGEID ) ? KErrUnderflow : msgOk );
|
|
1100 |
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
|
|
1101 |
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
|
|
1102 |
TRACE_ASSERT_INFO( msgOk == KErrNone, isiMsgLength );
|
|
1103 |
TRACE_ASSERT_INFO( msgOk == KErrNone, descLength );
|
|
1104 |
|
|
1105 |
// Check is receiver object valid if going from SOS<->SOS.
|
|
1106 |
msgOk = ( ( msgOk == KErrNone && ( GET_RECEIVER_DEV( msgPtr ) == THIS_DEVICE && GET_RECEIVER_OBJ( msgPtr ) > EIADSizeOfChannels ) ) ? KErrCouldNotConnect : msgOk );
|
|
1107 |
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
|
|
1108 |
// TODO: checking that receiver object is ok in SOS<->ISA cases.
|
|
1109 |
C_TRACE( ( _T( "DRouter::ValiDateIsiMessage <- %d" ), msgOk ) );
|
|
1110 |
|
|
1111 |
|
|
1112 |
OstTrace1( TRACE_NORMAL, DROUTER_VALIDATEISIMESSAGE_EXIT, "<DRouter::ValiDateIsiMessage;msgOk=%x", msgOk );
|
|
1113 |
return msgOk;
|
|
1114 |
}
|
|
1115 |
|
|
1116 |
void DRouter::CheckRouting(
|
|
1117 |
DRouter& aTmp,
|
|
1118 |
TDes8& aMsg
|
|
1119 |
)
|
|
1120 |
{
|
|
1121 |
|
|
1122 |
ASSERT_DFCTHREAD_INEXT();
|
|
1123 |
const TUint8* msg( aMsg.Ptr() );
|
|
1124 |
OstTrace1( TRACE_NORMAL, DROUTER_CHECKROUTING_ENTRY, ">DRouter::CheckRouting;aMsg=%x", ( TUint )( msg ) );
|
|
1125 |
C_TRACE( ( _T( "DRouter::CheckRouting 0x%x 0x%x ->" ), msg, msg[ ISI_HEADER_OFFSET_RESOURCEID ] ) );
|
|
1126 |
TRoutingRule route( ENotKnownMsg );
|
|
1127 |
// Message to symbian side (media sos).
|
|
1128 |
if( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS )
|
|
1129 |
{
|
|
1130 |
if( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == THIS_DEVICE )
|
|
1131 |
{
|
|
1132 |
switch( msg[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] )
|
|
1133 |
{
|
|
1134 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
1135 |
// Router <-> SOSMM
|
|
1136 |
case KIADObjId:
|
|
1137 |
{
|
|
1138 |
// Name add resp, drm or conf
|
|
1139 |
ASSERT_RESET_ALWAYS( msg[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE || msg[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_MEDIA_CONTROL, EIADWrongParameter | msg[ ISI_HEADER_OFFSET_RESOURCEID ] );
|
|
1140 |
route = ( msg[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE ) ? EPnNameAddRespMsg : EControlMsg;
|
|
1141 |
break;
|
|
1142 |
}
|
|
1143 |
#endif
|
|
1144 |
// Indication
|
|
1145 |
case KIADEventSubscriptionObjId:
|
|
1146 |
{
|
|
1147 |
ASSERT_RESET_ALWAYS( msg[ ISI_HEADER_OFFSET_RESOURCEID ] != PN_PIPE, EIADWrongParameter | msg[ ISI_HEADER_OFFSET_RESOURCEID ] );
|
|
1148 |
route = EIndicationMsg;
|
|
1149 |
break;
|
|
1150 |
}
|
|
1151 |
// Any other message.
|
|
1152 |
default:
|
|
1153 |
{
|
|
1154 |
// Indication message. Receiver object equals to event subscription obj id (0xfc).
|
|
1155 |
route = ( msg[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_PIPE ) ? EPipeMsg : EIsiMsg;
|
|
1156 |
break;
|
|
1157 |
}
|
|
1158 |
}
|
|
1159 |
}
|
|
1160 |
else if ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_GLOBAL )// TODO: This (PN_DEV_GLOBAL) should be removed from Bridge when modem SW MCE Server is ok
|
|
1161 |
{
|
|
1162 |
#ifdef MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD // TODO: To be removed depends on modem sw version MCE server
|
|
1163 |
if ( aTmp.iBootDone )
|
|
1164 |
{
|
|
1165 |
#endif // MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD
|
|
1166 |
C_TRACE( ( _T( "DRouter::CheckRouting message to PN_DEV_GLOBAL -> EIndicationMsg" ) ) );
|
|
1167 |
OstTrace0( TRACE_NORMAL, DROUTER_CHECKROUTING_PN_DEV_GLOBAL, "DRouter::CheckRouting PN_DEV_GLOBAL -> EIndicationMsg");
|
|
1168 |
TUint8* ptr = const_cast<TUint8*>( msg );
|
|
1169 |
SET_RECEIVER_DEV( ptr, THIS_DEVICE );
|
|
1170 |
route = EIndicationMsg;
|
|
1171 |
}
|
|
1172 |
#ifdef MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD
|
|
1173 |
#include <mceisi.h>
|
|
1174 |
else
|
|
1175 |
{
|
|
1176 |
Kern::Printf("0x%x 0x%x", msg[ ISI_HEADER_SIZE + MCE_MODEM_STATE_IND_OFFSET_MESSAGEID ], msg[ ISI_HEADER_SIZE + MCE_MODEM_STATE_IND_OFFSET_ACTION ] );
|
|
1177 |
if ( ( msg[ ISI_HEADER_SIZE + MCE_MODEM_STATE_IND_OFFSET_MESSAGEID ] == MCE_MODEM_STATE_IND ) &&
|
|
1178 |
( msg[ ISI_HEADER_SIZE + MCE_MODEM_STATE_IND_OFFSET_ACTION ] == MCE_READY ) )
|
|
1179 |
{
|
|
1180 |
//15:08:55.563 xti: MASTER_ASCII_PRINTF; string:M_HSI: TX common: 26ff60c2 06000014 00000004 ffffffff
|
|
1181 |
Kern::Printf("Connection OK");
|
|
1182 |
aTmp.InitConnectionOk();
|
|
1183 |
}
|
|
1184 |
else
|
|
1185 |
{
|
|
1186 |
// just ignore and wait for MCE_READY_IND DEALLOC????
|
|
1187 |
Kern::Printf("Connection NOK");
|
|
1188 |
}
|
|
1189 |
}
|
|
1190 |
}
|
|
1191 |
#endif // MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD
|
|
1192 |
else
|
|
1193 |
{
|
|
1194 |
C_TRACE( ( _T( "DRouter::CheckRouting Unknown message" ) ) );
|
|
1195 |
TRACE_ASSERT_ALWAYS;
|
|
1196 |
Kern::Printf("Unknown message 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", msg[ 0 ], msg[ 1 ], msg[ 2 ], msg[ 3 ], msg[ 4 ], msg[ 5 ], msg[ 6 ], msg[ 7 ], msg[ 8 ], msg[ 9 ] );
|
|
1197 |
}
|
|
1198 |
}
|
|
1199 |
// Message to other media than sos in symbian side.
|
|
1200 |
else
|
|
1201 |
{
|
|
1202 |
route = EMediaMsg;
|
|
1203 |
}
|
|
1204 |
C_TRACE( ( _T( "DRouter::CheckRouting msg 0x%x route %d" ), msg, route ) );
|
|
1205 |
OstTraceExt2( TRACE_NORMAL, DROUTER_CHECKROUTING_ROUTE, "DRouter::CheckRouting;aMsg=0x%x;route=%d", ( TUint )msg, route );
|
|
1206 |
switch( route )
|
|
1207 |
{
|
|
1208 |
case EIsiMsg:
|
|
1209 |
{
|
|
1210 |
aTmp.HandleIsiMessage( aMsg );
|
|
1211 |
break;
|
|
1212 |
}
|
|
1213 |
case EPipeMsg:
|
|
1214 |
{
|
|
1215 |
aTmp.HandlePipeMessage( aMsg );
|
|
1216 |
break;
|
|
1217 |
}
|
|
1218 |
case EMediaMsg:
|
|
1219 |
{
|
|
1220 |
aTmp.HandleMediaMessage( aMsg );
|
|
1221 |
break;
|
|
1222 |
}
|
|
1223 |
case EIndicationMsg:
|
|
1224 |
{
|
|
1225 |
aTmp.iIndicationHandler->Multicast( aMsg );
|
|
1226 |
// De-allocate, message is multicasted to subsribers as new
|
|
1227 |
// message and the original is ready to be deallocated.
|
|
1228 |
aTmp.DeAllocateBlock( aMsg );
|
|
1229 |
break;
|
|
1230 |
}
|
|
1231 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
1232 |
case EControlMsg:
|
|
1233 |
{
|
|
1234 |
aTmp.HandleControlMessage( aMsg );
|
|
1235 |
break;
|
|
1236 |
}
|
|
1237 |
case EPnNameAddRespMsg:
|
|
1238 |
{
|
|
1239 |
aTmp.HandlePnsNameAddResp( aMsg );
|
|
1240 |
break;
|
|
1241 |
}
|
|
1242 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
1243 |
case ENotKnownMsg:
|
|
1244 |
{
|
|
1245 |
// Not going to anywhere deallocate.
|
|
1246 |
aTmp.DeAllocateBlock( aMsg );
|
|
1247 |
break;
|
|
1248 |
}
|
|
1249 |
default:
|
|
1250 |
{
|
|
1251 |
ASSERT_RESET_ALWAYS( 0, EIADWrongParameter | EIADFaultIdentifier16 << KFaultIdentifierShift );
|
|
1252 |
break;
|
|
1253 |
}
|
|
1254 |
}
|
|
1255 |
C_TRACE( ( _T( "DRouter::CheckRouting 0x%x<-" ), msg ) );
|
|
1256 |
OstTrace1( TRACE_NORMAL, DROUTER_CHECKROUTING_EXIT, "<DRouter::CheckRouting;msg=0x%x", (TUint)msg );
|
|
1257 |
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
void DRouter::CommonRxDfc(
|
|
1261 |
TAny* aPtr // Pointer to this object.
|
|
1262 |
)
|
|
1263 |
{
|
|
1264 |
|
|
1265 |
OstTrace1( TRACE_NORMAL, DROUTER_COMMONRXDFC_ENTRY, ">DRouter::CommonRxDfc;aPtr=%x", ( TUint )( aPtr ) );
|
|
1266 |
C_TRACE( ( _T( "DRouter::CommonRxDfc ->" ) ) );
|
|
1267 |
DRouter& tmp = *reinterpret_cast<DRouter*>( aPtr );
|
|
1268 |
ASSERT_DFCTHREAD_INEXT();
|
|
1269 |
if( tmp.iCommonRxQueue->Count() > KErrNone )
|
|
1270 |
{
|
|
1271 |
TDes8& msg( tmp.iCommonRxQueue->Get() );
|
|
1272 |
DATA_DUMP_TRACE( msg, EFalse );// TODO: this causes problems in legacy flowcontrol causing main rx to overflow!!
|
|
1273 |
OstTraceData( TRACE_ISIMSG, DROUTER_COMMONRXDFC_DATA, "DRouter::CommonRxDfc RX: 0x%hx", msg.Ptr(), msg.Length() );
|
|
1274 |
CheckRouting( tmp, msg );
|
|
1275 |
// Check here too to avoid unnecessary dfc queuing.
|
|
1276 |
if( tmp.iCommonRxQueue->Count() > KErrNone )
|
|
1277 |
{
|
|
1278 |
C_TRACE( ( _T( "DRouter::CommonRxDfc enque commonrxdfc" ) ) );
|
|
1279 |
tmp.iCommonRxDfc->Enque();
|
|
1280 |
}
|
|
1281 |
}
|
|
1282 |
C_TRACE( ( _T( "DRouter::CommonRxDfc <-" ) ) );
|
|
1283 |
OstTrace0( TRACE_NORMAL, DROUTER_COMMONRXDFC_EXIT, "<DRouter::CommonRxDfc" );
|
|
1284 |
|
|
1285 |
}
|
|
1286 |
|
|
1287 |
void DRouter::SendCommIsaEntityNotReachableResp(
|
|
1288 |
const TDesC8& aMsg
|
|
1289 |
)
|
|
1290 |
{
|
|
1291 |
OstTrace1( TRACE_NORMAL, DROUTER_SENDCOMMISAENTITYNOTREACHABLERESP_ENTRY, ">DRouter::SendCommIsaEntityNotReachableResp;aMsg=%x", ( TUint )&( aMsg ) );
|
|
1292 |
|
|
1293 |
C_TRACE( ( _T( "DRouter::SendCommIsaEntityNotReachableResp 0x%x ->" ), &aMsg ) );
|
|
1294 |
// Make channel opening request followinfg COMM specification: 000.026
|
|
1295 |
// Length is sixteen bytes.
|
|
1296 |
TUint8 length( 16 );
|
|
1297 |
TDes8& tempPtr = AllocateBlock( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP );
|
|
1298 |
ASSERT_RESET_ALWAYS( &tempPtr, EIADMemoryAllocationFailure | EIADFaultIdentifier19 << KFaultIdentifierShift );
|
|
1299 |
ASSERT_RESET_ALWAYS( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP > ISI_HEADER_OFFSET_MESSAGEID, EIADOverTheLimits | EIADFaultIdentifier5 << KFaultIdentifierShift );
|
|
1300 |
TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() );
|
|
1301 |
// We start to append from transaction id.
|
|
1302 |
tempPtr.SetLength( ISI_HEADER_OFFSET_TRANSID );
|
|
1303 |
// Get the header until messageid from prev. message.
|
|
1304 |
// Just turn receiver and sender device and object vice versa.
|
|
1305 |
const TUint8* msgTmpPtr( aMsg.Ptr() );
|
|
1306 |
ptr[ ISI_HEADER_OFFSET_MEDIA ] = msgTmpPtr[ ISI_HEADER_OFFSET_MEDIA ];
|
|
1307 |
SET_RECEIVER_DEV( ptr, GET_SENDER_DEV( aMsg ) );
|
|
1308 |
SET_SENDER_DEV ( ptr, GET_RECEIVER_DEV( aMsg ) );
|
|
1309 |
ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = msgTmpPtr[ ISI_HEADER_OFFSET_RESOURCEID ];
|
|
1310 |
SET_LENGTH( ptr, length - PN_HEADER_SIZE );
|
|
1311 |
SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMsg ) );
|
|
1312 |
SET_SENDER_OBJ( ptr, GET_RECEIVER_OBJ( aMsg ) );
|
|
1313 |
// Transactionid. Set to 0x01 since this is the first.
|
|
1314 |
tempPtr.Append( msgTmpPtr[ ISI_HEADER_OFFSET_TRANSID ] );
|
|
1315 |
// Message ID
|
|
1316 |
tempPtr.Append( 0xF0 );
|
|
1317 |
// Sub message ID.
|
|
1318 |
tempPtr.Append( 0x14 );
|
|
1319 |
// Not Delivered Message from original req.
|
|
1320 |
tempPtr.Append( msgTmpPtr[ ISI_HEADER_OFFSET_MESSAGEID ] );
|
|
1321 |
// Status - COMM_ISA_ENTITY_NOT_AVAILABLE
|
|
1322 |
tempPtr.Append( 0x00 );
|
|
1323 |
// Filler
|
|
1324 |
tempPtr.Append( 0x00 );
|
|
1325 |
// Filler
|
|
1326 |
tempPtr.Append( 0x00 );
|
|
1327 |
// Filler
|
|
1328 |
tempPtr.Append( 0x00 );
|
|
1329 |
|
|
1330 |
// ASSERT_RESET_ALWAYS( iConnectionStatus == EIADConnectionOk, EIADCmtConnectionLost | EIADFaultIdentifier2 << KFaultIdentifierShift );
|
|
1331 |
SendMsg( tempPtr );
|
|
1332 |
C_TRACE( ( _T( "DRouter::SendCommIsaEntityNotReachableResp 0x%x <-" ), &aMsg ) );
|
|
1333 |
|
|
1334 |
OstTrace0( TRACE_NORMAL, DROUTER_SENDCOMMISAENTITYNOTREACHABLERESP_EXIT, "<DRouter::SendCommIsaEntityNotReachableResp" );
|
|
1335 |
}
|
|
1336 |
|
|
1337 |
void DRouter::InitCmtDfc(
|
|
1338 |
TAny* aPtr
|
|
1339 |
)
|
|
1340 |
{
|
|
1341 |
OstTrace1( TRACE_NORMAL, DROUTER_INITCMTDFC_ENTRY, ">DRouter::InitCmtDfc;aPtr=%x", ( TUint )( aPtr ) );
|
|
1342 |
|
|
1343 |
C_TRACE( ( _T( "DRouter::InitCmtDfc ->" ) ) );
|
|
1344 |
DRouter& tmp = *reinterpret_cast<DRouter*>( aPtr );
|
|
1345 |
if( !tmp.iBootDone )
|
|
1346 |
{
|
|
1347 |
#ifdef NCP_COMMON_BRIDGE_FAMILY
|
|
1348 |
#ifndef MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD
|
|
1349 |
tmp.InitConnectionOk();
|
|
1350 |
#endif // MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD
|
|
1351 |
#else
|
|
1352 |
tmp.InitCmtConnection();
|
|
1353 |
#endif
|
|
1354 |
}
|
|
1355 |
|
|
1356 |
// ISCE tmp.InitCmtConnection();
|
|
1357 |
C_TRACE( ( _T( "DRouter::InitCmtDfc <-" ) ) );
|
|
1358 |
|
|
1359 |
OstTrace0( TRACE_NORMAL, DROUTER_INITCMTDFC_EXIT, "<DRouter::InitCmtDfc" );
|
|
1360 |
}
|
|
1361 |
|
|
1362 |
#ifdef NCP_COMMON_BRIDGE_FAMILY
|
|
1363 |
void DRouter::InitConnectionOk()
|
|
1364 |
{
|
|
1365 |
|
|
1366 |
C_TRACE( ( _T( "DRouter::InitConnectionOk ->" ) ) );
|
|
1367 |
iMaxFrameSize = KIADMaxIsiMsgSize;
|
|
1368 |
iConnectionStatus = EIADConnectionOk;
|
|
1369 |
iBootDone = ETrue;
|
|
1370 |
NotifyObjLayerConnStat( EIADConnectionOk );
|
|
1371 |
// Initialize channels to NULL when channel is opened !NULL.
|
|
1372 |
for( TInt i( 0 ); i < EIADSizeOfChannels; ++i )
|
|
1373 |
{
|
|
1374 |
ASSERT_RESET_ALWAYS( !iChannelTable[ i ].iChannel, EIADChannelOpenedBeforePhysicalLayerInit );
|
|
1375 |
C_TRACE( ( _T( "DRouter::InitConnectionOk %d" ), i ) );
|
|
1376 |
if( iChannelTable[ i ].iWaitingChannel )
|
|
1377 |
{
|
|
1378 |
switch( iChannelTable[ i ].iType )
|
|
1379 |
{
|
|
1380 |
case ENormalOpen:
|
|
1381 |
{
|
|
1382 |
C_TRACE( ( _T( "DRouter::InitConnectionOk booting ENormalOpen 0x%x" ), i ) );
|
|
1383 |
MIAD2ChannelApi* tmpChannel = iChannelTable[ i ].iWaitingChannel;
|
|
1384 |
iChannelTable[ i ].iChannel = tmpChannel;
|
|
1385 |
iChannelTable[ i ].iWaitingChannel = NULL;
|
|
1386 |
iChannelTable[ i ].iChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNone );
|
|
1387 |
break;
|
|
1388 |
}
|
|
1389 |
default:
|
|
1390 |
{
|
|
1391 |
ASSERT_RESET_ALWAYS( 0, -1111 );
|
|
1392 |
break;
|
|
1393 |
}
|
|
1394 |
}
|
|
1395 |
}
|
|
1396 |
}
|
|
1397 |
C_TRACE( ( _T( "DRouter::InitConnectionOk <-" ) ) );
|
|
1398 |
}
|
|
1399 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
1400 |
|
|
1401 |
void DRouter::InitCmtConnection(
|
|
1402 |
// None
|
|
1403 |
)
|
|
1404 |
{
|
|
1405 |
OstTrace0( TRACE_NORMAL, DROUTER_INITCMTCONNECTION_ENTRY, ">DRouter::InitCmtConnection" );
|
|
1406 |
|
|
1407 |
C_TRACE( ( _T( "DRouter::InitCmtConnection ->" ) ) );
|
|
1408 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
1409 |
|
|
1410 |
// send configuration request to proxy
|
|
1411 |
const TInt KCtrlConfReqLength( 14 );
|
|
1412 |
//ASSERT_RESET_ALWAYS( iIST, EIADNullParameter | EIADFaultIdentifier16 << KFaultIdentifierShift );
|
|
1413 |
TDes8& temp = AllocateBlock( KCtrlConfReqLength );
|
|
1414 |
ASSERT_RESET_ALWAYS( ( KCtrlConfReqLength > CTRL_REQ_OFFSET_MESSAGEID + 2 ), EIADOverTheLimits | EIADFaultIdentifier6 << KFaultIdentifierShift );
|
|
1415 |
temp.SetLength( KCtrlConfReqLength );
|
|
1416 |
TUint8* tmpPtr( const_cast<TUint8*>( temp.Ptr() ) );
|
|
1417 |
tmpPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
|
|
1418 |
SET_RECEIVER_DEV( tmpPtr, PN_MEDIA_ROUTING_REQ );
|
|
1419 |
SET_SENDER_DEV( tmpPtr, THIS_DEVICE );
|
|
1420 |
tmpPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_MEDIA_CONTROL;
|
|
1421 |
SET_LENGTH( tmpPtr, ( KCtrlConfReqLength - PN_HEADER_SIZE ) );
|
|
1422 |
SET_RECEIVER_OBJ( tmpPtr, PN_OBJ_ROUTER );
|
|
1423 |
SET_SENDER_OBJ( tmpPtr, KIADObjId );
|
|
1424 |
tmpPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_UTID ] = 0x00;
|
|
1425 |
tmpPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_SUBFUNCTION ] = PNS_MEDIA_SPECIFIC_REQ;
|
|
1426 |
tmpPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_MEDIATOCTRL ] = PN_MEDIA_SOS;
|
|
1427 |
tmpPtr[ CTRL_REQ_OFFSET_MESSAGEID ] = KIADCtrlConfReq;
|
|
1428 |
tmpPtr[ CTRL_REQ_OFFSET_MESSAGEID + 1 ] = 0x00; // Filler
|
|
1429 |
tmpPtr[ CTRL_REQ_OFFSET_MESSAGEID +2 ] = 0x00; // Filler
|
|
1430 |
temp.SetLength( KCtrlConfReqLength );
|
|
1431 |
SendMsg( temp );
|
|
1432 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
1433 |
|
|
1434 |
C_TRACE( ( _T( "DRouter::InitCmtConnection <-" ) ) );
|
|
1435 |
|
|
1436 |
OstTrace0( TRACE_NORMAL, DROUTER_INITCMTCONNECTION_EXIT, "<DRouter::InitCmtConnection" );
|
|
1437 |
}
|
|
1438 |
|
|
1439 |
void DRouter::SendDrmReq(
|
|
1440 |
const TUint16 aChannelId
|
|
1441 |
)
|
|
1442 |
{
|
|
1443 |
OstTraceExt1( TRACE_NORMAL, DROUTER_SENDDRMREQ_ENTRY, ">DRouter::SendDrmReq;aChannelId=%hx", aChannelId );
|
|
1444 |
|
|
1445 |
C_TRACE( ( _T( "DRouter::SendDrmReq 0x%x ->" ), aChannelId) );
|
|
1446 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
1447 |
// DRM REQ/RESP messages are spec so that only 8-bit values for channelid are possible.
|
|
1448 |
ASSERT_RESET_ALWAYS( aChannelId <= 0xff, EIADTooManyBytesToPresent );
|
|
1449 |
TDes8& block = AllocateBlock( KIADCtrlDrmReqLength );
|
|
1450 |
ASSERT_RESET_ALWAYS( ( KIADCtrlDrmReqLength > CTRL_DRM_REQ_OFFSET_REQUIRED_CHANNEL_ID ), EIADOverTheLimits | EIADFaultIdentifier7 << KFaultIdentifierShift );;
|
|
1451 |
block.SetLength( KIADCtrlDrmReqLength );
|
|
1452 |
TUint8* ptr( const_cast<TUint8*>( block.Ptr() ) );
|
|
1453 |
ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
|
|
1454 |
SET_RECEIVER_DEV( ptr, PN_MEDIA_ROUTING_REQ );
|
|
1455 |
SET_SENDER_DEV( ptr, THIS_DEVICE );
|
|
1456 |
ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_MEDIA_CONTROL;
|
|
1457 |
SET_LENGTH( ptr, ( KIADCtrlDrmReqLength - PN_HEADER_SIZE ) );
|
|
1458 |
SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER );
|
|
1459 |
SET_SENDER_OBJ( ptr, KIADObjId );
|
|
1460 |
ptr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_UTID ] = aChannelId;
|
|
1461 |
ptr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_SUBFUNCTION ] = PNS_MEDIA_SPECIFIC_REQ;
|
|
1462 |
ptr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_MEDIATOCTRL ] = PN_MEDIA_SOS;
|
|
1463 |
ptr[ CTRL_REQ_OFFSET_MESSAGEID ] = KIADCtrlDrmReq;
|
|
1464 |
ptr[ CTRL_DRM_REQ_OFFSET_REQUIRED_CHANNEL_ID ] = aChannelId;
|
|
1465 |
ASSERT_RESET_ALWAYS( iConnectionStatus == EIADConnectionOk, EIADCmtConnectionLost | EIADFaultIdentifier3 << KFaultIdentifierShift );
|
|
1466 |
SendMsg( block );
|
|
1467 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
1468 |
C_TRACE( ( _T( "DRouter::SendDrmReq 0x%x <-" ), aChannelId) );
|
|
1469 |
|
|
1470 |
OstTrace0( TRACE_NORMAL, DROUTER_SENDDRMREQ_EXIT, "<DRouter::SendDrmReq" );
|
|
1471 |
}
|
|
1472 |
|
|
1473 |
void DRouter::SendPnsNameAddReq(
|
|
1474 |
const TUint16 aChannel,
|
|
1475 |
const TDesC8& aOpenInfo
|
|
1476 |
)
|
|
1477 |
{
|
|
1478 |
OstTraceExt2( TRACE_NORMAL, DROUTER_SENDPNSNAMEADDREQ_ENTRY, ">DRouter::SendPnsNameAddReq;aChannel=%hx;aOpenInfo=%x", aChannel, ( TUint )&( aOpenInfo ) );
|
|
1479 |
|
|
1480 |
C_TRACE( ( _T( "DRouter::SendPnsNameAddReq 0x%x 0x%x ->" ), aChannel, &aOpenInfo ) );
|
|
1481 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
1482 |
|
|
1483 |
TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_REQ );
|
|
1484 |
TDes8& block = AllocateBlock( msgLength );
|
|
1485 |
ASSERT_RESET_ALWAYS( ( msgLength > ( ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 7 ) ), EIADOverTheLimits | EIADFaultIdentifier8 << KFaultIdentifierShift );
|
|
1486 |
block.SetLength( msgLength );
|
|
1487 |
TUint8* ptr = const_cast<TUint8*>( block.Ptr() );
|
|
1488 |
|
|
1489 |
ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
|
|
1490 |
SET_RECEIVER_DEV( ptr, OTHER_DEVICE_1 );
|
|
1491 |
SET_SENDER_DEV( ptr, THIS_DEVICE );
|
|
1492 |
ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE;
|
|
1493 |
SET_LENGTH( ptr, ( msgLength - PN_HEADER_SIZE ) );
|
|
1494 |
SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER);
|
|
1495 |
SET_SENDER_OBJ( ptr, KIADObjId );
|
|
1496 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] = aChannel;
|
|
1497 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_SUBFUNCTION ] = PNS_NAME_ADD_REQ;
|
|
1498 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED1 ] = 0x00;
|
|
1499 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED2 ] = 0x00;
|
|
1500 |
|
|
1501 |
TUint8* resourcePtr = const_cast<TUint8*>( aOpenInfo.Ptr() );
|
|
1502 |
/*
|
|
1503 |
//TBR
|
|
1504 |
for( TInt i( 0 ); i < aOpenInfo.Length(); i++ )
|
|
1505 |
{
|
|
1506 |
Kern::Printf( "resource[%d]0x%x", i, resourcePtr[i] );
|
|
1507 |
}
|
|
1508 |
//TBR
|
|
1509 |
*/
|
|
1510 |
switch( aOpenInfo.Length() )
|
|
1511 |
{
|
|
1512 |
// Resource bigendian 32-bit, TODO : how about winscw?
|
|
1513 |
case 4:
|
|
1514 |
{
|
|
1515 |
C_TRACE( ( _T( "DRouter::SendPnsNameAddReq 32-bit resourceid used 0x%x 0x%x" ), aChannel, &aOpenInfo ) );
|
|
1516 |
OstTraceExt5( TRACE_NORMAL, DROUTER_SENDPNSNAMEADDREQ_32BIT, "DRouter::SendPnsNameAddReq;aChannel=%hx;resourcePtr[0]=%hhx;resourcePtr[1]=%hhx;resourcePtr[2]=%hhx;resourcePtr[3]=%hhx", aChannel, resourcePtr[0], resourcePtr[1], resourcePtr[2], resourcePtr[3] );
|
|
1517 |
|
|
1518 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY ] = resourcePtr[ 0 ];
|
|
1519 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 1 ] = resourcePtr[ 1 ];
|
|
1520 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 2 ] = resourcePtr[ 2 ];
|
|
1521 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 3 ] = resourcePtr[ 3 ];
|
|
1522 |
break;
|
|
1523 |
}
|
|
1524 |
case 1:
|
|
1525 |
{
|
|
1526 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY ] = 0x00;
|
|
1527 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 1 ] = 0x00;
|
|
1528 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 2 ] = 0x00;
|
|
1529 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 3 ] = resourcePtr[ 0 ];
|
|
1530 |
OstTraceExt2( TRACE_NORMAL, DROUTER_SENDPNSNAMEADDREQ_8BIT, "DRouter::SendPnsNameAddReq;aChannel=%hx;resourcePtr[0]=%hhx", aChannel, resourcePtr[0] );
|
|
1531 |
C_TRACE( ( _T( "DRouter::SendPnsNameAddReq 8-bit resourceid used 0x%x 0x%x" ), aChannel, &aOpenInfo ) );
|
|
1532 |
break;
|
|
1533 |
}
|
|
1534 |
default:
|
|
1535 |
{
|
|
1536 |
ASSERT_RESET_ALWAYS( 0, EIADWrongParameter | EIADFaultIdentifier17 << KFaultIdentifierShift );
|
|
1537 |
break;
|
|
1538 |
}
|
|
1539 |
}
|
|
1540 |
// Phonet device id associated with name.
|
|
1541 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 4 ] = THIS_DEVICE;
|
|
1542 |
// Phonet object id associated with name.
|
|
1543 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 5 ] = aChannel;
|
|
1544 |
// Record flags. This entry cannot be changed.
|
|
1545 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 6 ] = PN_NAME_NOCHG;
|
|
1546 |
ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 7 ] = 0x00;
|
|
1547 |
ASSERT_RESET_ALWAYS( iConnectionStatus == EIADConnectionOk, EIADCmtConnectionLost | EIADFaultIdentifier4 << KFaultIdentifierShift );
|
|
1548 |
SendMsg( block );
|
|
1549 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
1550 |
C_TRACE( ( _T( "DRouter::SendPnsNameAddReq 0x%x 0x%x <-" ), aChannel, &aOpenInfo ) );
|
|
1551 |
|
|
1552 |
OstTrace0( TRACE_NORMAL, DROUTER_SENDPNSNAMEADDREQ_EXIT, "<DRouter::SendPnsNameAddReq" );
|
|
1553 |
}
|
|
1554 |
|
|
1555 |
void DRouter::HandlePnsNameAddResp(
|
|
1556 |
TDes8& aMsg
|
|
1557 |
)
|
|
1558 |
{
|
|
1559 |
OstTrace1( TRACE_NORMAL, DROUTER_HANDLEPNSNAMEADDRESP_ENTRY, ">DRouter::HandlePnsNameAddResp;aMsg=%x", ( TUint )&( aMsg ) );
|
|
1560 |
|
|
1561 |
C_TRACE( ( _T( "DRouter::HandlePnsNameAddResp 0x%x ->" ), &aMsg ) );
|
|
1562 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
1563 |
|
|
1564 |
// Channel id from Transaction ID.
|
|
1565 |
const TUint8* cptr( aMsg.Ptr() );
|
|
1566 |
ASSERT_RESET_ALWAYS( ( ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ) < aMsg.Length(), EIADOverTheLimits | EIADFaultIdentifier9 << KFaultIdentifierShift );
|
|
1567 |
TUint8 channelId( cptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] );
|
|
1568 |
ASSERT_RESET_ALWAYS( channelId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)channelId << KChannelNumberShift | EIADFaultIdentifier23 << KFaultIdentifierShift );
|
|
1569 |
if( iChannelTable[ channelId ].iWaitingChannel )
|
|
1570 |
{
|
|
1571 |
ASSERT_RESET_ALWAYS( iChannelTable[ channelId ].iType == ENameAddOpen, EIADWrongTypeOfOpenPending | EIADFaultIdentifier2 << KFaultIdentifierShift );
|
|
1572 |
if( cptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK )
|
|
1573 |
{
|
|
1574 |
MIAD2ChannelApi* tmpChannel = iChannelTable[ channelId ].iWaitingChannel;
|
|
1575 |
iChannelTable[ channelId ].iChannel = tmpChannel;
|
|
1576 |
iChannelTable[ channelId ].iWaitingChannel = NULL;
|
|
1577 |
C_TRACE( ( _T( "DRouter::HandlePnsNameAddResp name add resp ok 0x%x 0x%x 0x%x 0x%x" ), channelId, tmpChannel, iChannelTable[ channelId ].iChannel, &aMsg ) );
|
|
1578 |
|
|
1579 |
OstTraceExt2( TRACE_NORMAL, DROUTER_HANDLEPNSNAMEADDRESP_OK, "DRouter::HandlePnsNameAddResp OK;channelId=%hhx;tmpChannel=%x", channelId, (TUint) ( tmpChannel ) );
|
|
1580 |
|
|
1581 |
iChannelTable[ channelId ].iChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNone );
|
|
1582 |
}
|
|
1583 |
else
|
|
1584 |
{
|
|
1585 |
C_TRACE( ( _T( "DRouter::HandlePnsNameAddResp name add resp NOK 0x%x 0x%x" ), channelId, &aMsg ) );
|
|
1586 |
OstTraceExt1( TRACE_NORMAL, DROUTER_HANDLEPNSNAMEADDRESP_NOK, "DRouter::HandlePnsNameAddResp;channelId=%hhx", channelId );
|
|
1587 |
|
|
1588 |
TRACE_ASSERT( cptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK );
|
|
1589 |
iChannelTable[ channelId ].iWaitingChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNotSupported );
|
|
1590 |
// Set channel open waiting to null, open was failed.
|
|
1591 |
iChannelTable[ channelId ].iWaitingChannel = NULL;
|
|
1592 |
}
|
|
1593 |
}
|
|
1594 |
else
|
|
1595 |
{
|
|
1596 |
// Check is this waiting
|
|
1597 |
// TODO: Does pns_name_add_resp need to be informed with comm_isa_entity_not_reachable_resp if channel is closed?
|
|
1598 |
TRACE_ASSERT_INFO( !iChannelTable[ channelId ].iChannel, channelId<<KChannelNumberShift );
|
|
1599 |
TRACE_ASSERT_INFO( iChannelTable[ channelId ].iWaitingChannel, channelId<<KChannelNumberShift ); // TODO: This will come when open cancel called with resource.
|
|
1600 |
}
|
|
1601 |
// De-allocate cause not going anywhere else.
|
|
1602 |
DeAllocateBlock( aMsg );
|
|
1603 |
#endif // NCP_COMMON_BRIDGE_FAMILY
|
|
1604 |
|
|
1605 |
C_TRACE( ( _T( "DRouter::HandlePnsNameAddResp 0x%x <-" ), &aMsg ) );
|
|
1606 |
|
|
1607 |
OstTrace0( TRACE_NORMAL, DROUTER_HANDLEPNSNAMEADDRESP_EXIT, "<DRouter::HandlePnsNameAddResp" );
|
|
1608 |
}
|
|
1609 |
|
|
1610 |
// router and handler (pipe and indication)
|
|
1611 |
TInt DRouter::SendMsg(
|
|
1612 |
TDes8& aMsg
|
|
1613 |
)
|
|
1614 |
{
|
|
1615 |
OstTrace1( TRACE_NORMAL, DROUTER_SENDMSG_ENTRY, ">DRouter::SendMsg;aMsg=%x", ( TUint )&( aMsg ) );
|
|
1616 |
|
|
1617 |
C_TRACE( ( _T( " DRouter::SendMsg 0x%x ->" ), &aMsg ) );
|
|
1618 |
// The IST shall deallocate the block when it's approriate to do.
|
|
1619 |
DATA_DUMP_TRACE( aMsg, ETrue );
|
|
1620 |
OstTraceData( TRACE_ISIMSG, DROUTER_SENDMSG_DATA, "DRouter::SendMsg TX: %{hex8[]}", aMsg.Ptr(), aMsg.Length() );
|
|
1621 |
|
|
1622 |
//ISCE
|
|
1623 |
//TInt error = iIST->SendMessage( aMsg, MIAD2ISTApi::EISTPriorityDefault );// priority 0
|
|
1624 |
// TODO error codes and ids
|
|
1625 |
TUint8 linkId = MapMediaToLinkId( aMsg.Ptr()[ ISI_HEADER_OFFSET_MEDIA ] );
|
|
1626 |
ASSERT_RESET_ALWAYS( linkId < DRouter::EISIAmountOfMedias, -1000 );
|
|
1627 |
MISIRouterLinkIf* link = iLinksArray[ linkId ];
|
|
1628 |
ASSERT_RESET_ALWAYS( link, -999 );
|
|
1629 |
TInt error( KErrNone );
|
|
1630 |
if( link->TrxPresent() )
|
|
1631 |
{
|
|
1632 |
link->Send( aMsg );
|
|
1633 |
}
|
|
1634 |
else
|
|
1635 |
{
|
|
1636 |
TRACE_ASSERT_ALWAYS;
|
|
1637 |
// Discard send block if connection lost
|
|
1638 |
MemApi::DeallocBlock( aMsg );
|
|
1639 |
error = KErrNotReady;
|
|
1640 |
}
|
|
1641 |
//ISCE
|
|
1642 |
OstTraceExt2( TRACE_NORMAL, DROUTER_SENDMSG_EXIT, "<DRouter::SendMsg;aMsg=%x;error=%d", ( TUint )&( aMsg ), error );
|
|
1643 |
return error;
|
|
1644 |
}
|
|
1645 |
|
|
1646 |
//pipehandler
|
|
1647 |
MIAD2ChannelApi* DRouter::GetChannel(
|
|
1648 |
const TUint16 aChannel
|
|
1649 |
)
|
|
1650 |
{
|
|
1651 |
OstTraceExt1( TRACE_NORMAL, DROUTER_GETCHANNEL_ENTRY, ">DRouter::GetChannel;aChannel=%hx", aChannel );
|
|
1652 |
|
|
1653 |
ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, EIADWrongParameter | (TUint8)aChannel << KChannelNumberShift | EIADFaultIdentifier24 << KFaultIdentifierShift );
|
|
1654 |
|
|
1655 |
MIAD2ChannelApi* channelApi = iChannelTable[ aChannel ].iChannel;
|
|
1656 |
|
|
1657 |
OstTrace1( TRACE_NORMAL, DROUTER_GETCHANNEL_EXIT, "<DRouter::GetChannel;channelApi=%x", ( TUint )( channelApi ) );
|
|
1658 |
return channelApi;
|
|
1659 |
}
|
|
1660 |
//pipehandler
|
|
1661 |
|
|
1662 |
void DRouter::SetSenderInfo(
|
|
1663 |
TDes8& aMessage,
|
|
1664 |
const TUint16 aCh
|
|
1665 |
)
|
|
1666 |
{
|
|
1667 |
OstTraceExt2( TRACE_NORMAL, DROUTER_SETSENDERINFO_ENTRY, ">DRouter::SetSenderInfo;aMessage=%x;aCh=%hx", ( TUint )&( aMessage ), aCh );
|
|
1668 |
|
|
1669 |
C_TRACE( ( _T( "DRouter::SetSenderInfo 0x%x ->" ), &aMessage ) );
|
|
1670 |
TUint8* msgBlockPtr = const_cast<TUint8*>( aMessage.Ptr() );
|
|
1671 |
ASSERT_RESET_ALWAYS( aMessage.Length() > ISI_HEADER_OFFSET_MEDIA, EIADOverTheLimits | EIADFaultIdentifier10 << KFaultIdentifierShift );
|
|
1672 |
switch( aCh )
|
|
1673 |
{
|
|
1674 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
1675 |
case EIADNokiaBtPhonetLink:
|
|
1676 |
{
|
|
1677 |
OstTrace0( TRACE_NORMAL, DROUTER_SETSENDERINFO_BT, "DRouter::SetSenderInfo BT" );
|
|
1678 |
msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_BT;
|
|
1679 |
break;
|
|
1680 |
}
|
|
1681 |
case EIADNokiaUsbPhonetLink:
|
|
1682 |
{
|
|
1683 |
OstTrace0( TRACE_NORMAL, DROUTER_SETSENDERINFO_USB, "DRouter::SetSenderInfo USB" );
|
|
1684 |
msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_USB;
|
|
1685 |
break;
|
|
1686 |
}
|
|
1687 |
#endif
|
|
1688 |
default:
|
|
1689 |
{
|
|
1690 |
msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
|
|
1691 |
SET_SENDER_DEV( msgBlockPtr, THIS_DEVICE );
|
|
1692 |
SET_RECEIVER_DEV( msgBlockPtr, OTHER_DEVICE_1 );
|
|
1693 |
SET_SENDER_OBJ( msgBlockPtr, aCh );
|
|
1694 |
break;
|
|
1695 |
}
|
|
1696 |
}
|
|
1697 |
C_TRACE( ( _T( "DRouter::SetSenderInfo 0x%x <-" ), &aMessage ) );
|
|
1698 |
|
|
1699 |
OstTrace0( TRACE_NORMAL, DROUTER_SETSENDERINFO_EXIT, "<DRouter::SetSenderInfo" );
|
|
1700 |
}
|
|
1701 |
|
|
1702 |
void DRouter::CheckSameThreadContext()
|
|
1703 |
{
|
|
1704 |
OstTrace0( TRACE_NORMAL, DROUTER_CHECKSAMETHREADCONTEXT_ENTRY, ">DRouter::CheckSameThreadContext" );
|
|
1705 |
|
|
1706 |
DObject* tempObj = reinterpret_cast<DObject*>( &Kern::CurrentThread() );
|
|
1707 |
// If Null set current thread otherwise ignore
|
|
1708 |
iThreadPtr = !iThreadPtr ? tempObj : iThreadPtr;
|
|
1709 |
|
|
1710 |
IAD_ASSERT_RESET_ALWAYS( ( iThreadPtr == tempObj ? ETrue : EFalse ) , -1112, "NOTSAMETHREAD" );
|
|
1711 |
|
|
1712 |
OstTrace0( TRACE_NORMAL, DROUTER_CHECKSAMETHREADCONTEXT_EXIT, "<DRouter::CheckSameThreadContext" );
|
|
1713 |
}
|
|
1714 |
|
|
1715 |
// FM held, must not block and nor acquire locks.
|
|
1716 |
void DRouter::NotifyTrxPresenceEnqueDfc(
|
|
1717 |
TBool aPresent
|
|
1718 |
)
|
|
1719 |
{
|
|
1720 |
|
|
1721 |
C_TRACE( ( _T( "DRouter::NotifyTrxPresenceEnqueDfc %d ->" ), aPresent ) );
|
|
1722 |
if( !iBootDone )
|
|
1723 |
{
|
|
1724 |
iInitCmtDfc->Enque();
|
|
1725 |
}
|
|
1726 |
else
|
|
1727 |
{
|
|
1728 |
iConnectionStatus = ( aPresent ) ? EIADConnectionOk : EIADConnectionNotOk;// TODO: atomicity check
|
|
1729 |
iConnStatDfc->Enque();
|
|
1730 |
}
|
|
1731 |
C_TRACE( ( _T( "DRouter::NotifyTrxPresenceEnqueDfc %d <-" ), aPresent ) );
|
|
1732 |
|
|
1733 |
}
|
|
1734 |
|
|
1735 |
void DRouter::Receive(
|
|
1736 |
TDes8& aMsg
|
|
1737 |
)
|
|
1738 |
{
|
|
1739 |
|
|
1740 |
C_TRACE( ( _T( "DRouter::Receive 0x%x ->" ), &aMsg ) );
|
|
1741 |
MessageReceived( aMsg );
|
|
1742 |
C_TRACE( ( _T( "DRouter::Receive 0x%x <-" ), &aMsg ) );
|
|
1743 |
|
|
1744 |
}
|
|
1745 |
|
|
1746 |
EXPORT_C void DRouter::DummyDoNothing()
|
|
1747 |
{
|
|
1748 |
|
|
1749 |
ASSERT_RESET_ALWAYS( 0, -1001 );
|
|
1750 |
|
|
1751 |
}
|
|
1752 |
|
|
1753 |
EXPORT_C void DRouter::DummyDoNothing2()
|
|
1754 |
{
|
|
1755 |
|
|
1756 |
ASSERT_RESET_ALWAYS( 0, -1000 );
|
|
1757 |
|
|
1758 |
}
|
|
1759 |
|
|
1760 |
|
|
1761 |
TUint8 DRouter::MapMediaToLinkId(
|
|
1762 |
const TUint8 aMedia
|
|
1763 |
)
|
|
1764 |
{
|
|
1765 |
|
|
1766 |
TUint8 linkdId( DRouter::EISIAmountOfMedias );
|
|
1767 |
switch( aMedia )
|
|
1768 |
{
|
|
1769 |
case PN_MEDIA_SOS:
|
|
1770 |
{
|
|
1771 |
#ifndef NCP_COMMON_BRIDGE_FAMILY
|
|
1772 |
linkdId = EISIMediaSOS;
|
|
1773 |
#else
|
|
1774 |
linkdId = EISIMediaHostSSI;
|
|
1775 |
#endif
|
|
1776 |
break;
|
|
1777 |
}
|
|
1778 |
// Not supported media
|
|
1779 |
default:
|
|
1780 |
{
|
|
1781 |
ASSERT_RESET_ALWAYS( 0, -998 );
|
|
1782 |
break;
|
|
1783 |
}
|
|
1784 |
}
|
|
1785 |
return linkdId;
|
|
1786 |
|
|
1787 |
}
|
|
1788 |
|
|
1789 |
// End of file.
|
|
1790 |
|