author | mikaruus |
Tue, 19 Oct 2010 13:16:20 +0300 | |
changeset 9 | 8486d82aef45 |
parent 8 | 6295dc2169f3 |
permissions | -rw-r--r-- |
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 |
||
20 |
#include <kernel.h> // For Kern |
|
21 |
||
22 |
#include "p2prouter.h" // For DP2PRouter |
|
23 |
#include "memapi.h" // For MemApi |
|
24 |
#include "p2proutertrace.h" // For C_TRACE.. |
|
25 |
#include "p2pdevice.h" // For DP2PDevice |
|
26 |
#include "mlinkmuxif.h" // For MLinkMuxIf |
|
27 |
#include "trxdefs.h" // For ETrx... |
|
28 |
#include "p2pinternaldefs.h" // For EP2PAsyncOpen |
|
29 |
||
30 |
// Faults |
|
31 |
enum TP2PRouterFaults |
|
32 |
{ |
|
33 |
EP2PRouterMemAllocFailure = 0x00, |
|
34 |
EP2PRouterMemAllocFailure1, |
|
35 |
EP2PRouterMemAllocFailure2, |
|
36 |
EP2PRouterMemAllocFailure3, |
|
37 |
EP2PRouterMemAllocFailure4, |
|
38 |
EP2PRouterMemAllocFailure5, |
|
39 |
EP2PRouterMemAllocFailure6, |
|
40 |
EP2PRouterMemAllocFailure7, |
|
41 |
EP2PRouterMemAllocFailure8, |
|
42 |
EP2PRouterOverTheLimits, |
|
43 |
EP2PRouterWrongRequest, |
|
44 |
EP2PRouterWrongRequest2, |
|
45 |
EP2PRouterNullParam, |
|
46 |
EP2PRouterWrongParam, |
|
47 |
EP2PRouterWrongParam2, |
|
48 |
EP2PRouterWrongParam3, |
|
49 |
EP2PRouterWrongParam4, |
|
50 |
EP2PRouterWrongParam5, |
|
51 |
EP2PRouterWrongParam6, |
|
52 |
EP2PRouterWrongParam7, |
|
53 |
EP2PRouterWrongParam8, |
|
54 |
}; |
|
55 |
||
56 |
const TInt KDfcPriority( 5 ); |
|
57 |
const TInt KDefaultDfcThreadPriority( 27 ); |
|
58 |
||
59 |
_LIT( KP2PDfcQThreadName, "P2PRouter" ); |
|
60 |
_LIT( KP2PLddDfcQThreadName, "P2PUserChannel" ); |
|
61 |
TDfcQue* DP2PRouter::iP2PDfcQueList[ EAmountOfP2PDfcThreads ] = { NULL, NULL }; |
|
62 |
DP2PRouter* DP2PRouter::iSelfPtr = NULL; |
|
63 |
||
64 |
DP2PRouter::DP2PRouter( |
|
65 |
// None |
|
66 |
) |
|
67 |
{ |
|
68 |
||
69 |
C_TRACE( ( _T( "DP2PRouter::DP2PRouter>" ) ) ); |
|
70 |
TInt err = Kern::DfcQCreate( iP2PDfcQueList[ MP2PChRouterIf::EP2PDfcThread ], KDefaultDfcThreadPriority, &KP2PDfcQThreadName ); |
|
71 |
ASSERT_RESET_ALWAYS( iP2PDfcQueList[ MP2PChRouterIf::EP2PDfcThread ], EP2PRouterMemAllocFailure ); |
|
72 |
err = Kern::DfcQCreate( iP2PDfcQueList[ MP2PChRouterIf::EP2PLddDfcThread ], KDefaultDfcThreadPriority, &KP2PLddDfcQThreadName ); |
|
73 |
ASSERT_RESET_ALWAYS( iP2PDfcQueList[ MP2PChRouterIf::EP2PLddDfcThread ], EP2PRouterMemAllocFailure1 ); |
|
74 |
iInitDfc = new TDfc( InitDfc, this, iP2PDfcQueList[ MP2PChRouterIf::EP2PDfcThread ], KDfcPriority ); |
|
75 |
ASSERT_RESET_ALWAYS( iInitDfc, EP2PRouterMemAllocFailure2 ); |
|
76 |
iInitDfc->Enque(); |
|
77 |
C_TRACE( ( _T( "DP2PRouter::DP2PRouter<" ) ) ); |
|
78 |
||
79 |
} |
|
80 |
||
81 |
DP2PRouter::~DP2PRouter( |
|
82 |
// None |
|
83 |
) |
|
84 |
{ |
|
85 |
||
86 |
C_TRACE( ( _T( "DP2PRouter::~DP2PRouter>" ) ) ); |
|
87 |
iSelfPtr = NULL; |
|
88 |
delete iShChannelTableFastMutex; |
|
89 |
iShChannelTableFastMutex = NULL; |
|
90 |
// owning so deleting |
|
91 |
for( TInt i( 0 ); i < EP2PAmountOfProtocols; i++ ) |
|
92 |
{ |
|
93 |
MP2PRouterLinkIf* temp = iLinksArray[ i ]; |
|
9 | 94 |
if ( temp ) |
95 |
{ |
|
96 |
temp->Release(); |
|
97 |
temp = NULL; |
|
98 |
} |
|
0 | 99 |
iLinksArray[ i ] = NULL; |
100 |
} |
|
101 |
delete []iLinksArray; |
|
102 |
delete []iP2PDfcQueList; |
|
9 | 103 |
|
104 |
if ( iInitDfc ) |
|
105 |
{ |
|
106 |
iInitDfc->Cancel();//what about this |
|
107 |
delete iInitDfc; |
|
108 |
iInitDfc = NULL; |
|
109 |
} |
|
110 |
||
111 |
if ( iTrxPrecentDfc ) |
|
112 |
{ |
|
113 |
iTrxPrecentDfc->Cancel();//what about this |
|
114 |
delete iTrxPrecentDfc; |
|
115 |
iTrxPrecentDfc = NULL; |
|
116 |
} |
|
117 |
||
118 |
if ( iTrxNotPrecentDfc ) |
|
119 |
{ |
|
120 |
iTrxNotPrecentDfc->Cancel();//what about this |
|
121 |
delete iTrxNotPrecentDfc; |
|
122 |
iTrxNotPrecentDfc = NULL; |
|
123 |
} |
|
0 | 124 |
C_TRACE( ( _T( "DP2PRouter::~DP2PRouter<" ) ) ); |
125 |
||
126 |
} |
|
127 |
||
128 |
// From MP2PLinkRouterIf start |
|
129 |
||
130 |
// Called with FM held, no blocking no nesting, allocation etc.. just enque dfc. |
|
131 |
void DP2PRouter::NotifyTrxPresenceEnqueDfc( |
|
132 |
TBool aPresent |
|
133 |
) |
|
134 |
{ |
|
135 |
||
136 |
// No traces allowed due to no blocking. |
|
137 |
if( aPresent ) |
|
138 |
{ |
|
139 |
iTrxPrecentDfc->Enque(); |
|
140 |
} |
|
141 |
else |
|
142 |
{ |
|
143 |
iTrxNotPrecentDfc->Enque(); |
|
144 |
} |
|
145 |
||
146 |
} |
|
147 |
||
148 |
// Called in some thread contextes |
|
149 |
void DP2PRouter::Receive( |
|
150 |
TDes8& aMsg, |
|
151 |
const TUint8 aProtocolId |
|
152 |
) |
|
153 |
{ |
|
154 |
||
155 |
C_TRACE( ( _T( "DP2PRouter::Receive 0x%x %d>" ), &aMsg, aProtocolId ) ); |
|
156 |
ASSERT_RESET_ALWAYS( aProtocolId < EP2PAmountOfProtocols, ( EP2PRouterWrongParam | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
|
157 |
NKern::FMWait( iShChannelTableFastMutex ); |
|
158 |
MP2PRouterChIf* channel = iShChannelTable[ aProtocolId ].iChannel; |
|
159 |
if( channel ) |
|
160 |
{ |
|
161 |
NKern::FMSignal( iShChannelTableFastMutex ); |
|
162 |
// This functions calling thread shall content with channels thread. |
|
163 |
channel->ReceiveMsg( aMsg ); |
|
164 |
} |
|
165 |
else |
|
166 |
{ |
|
167 |
NKern::FMSignal( iShChannelTableFastMutex ); |
|
168 |
// Discard incoming messages without a receiving point channel open. |
|
169 |
TRACE_ASSERT_ALWAYS; |
|
170 |
MemApi::DeallocBlock( aMsg ); |
|
171 |
} |
|
172 |
C_TRACE( ( _T( "DP2PRouter::Receive 0x%x %d<" ), &aMsg, aProtocolId ) ); |
|
173 |
||
174 |
} |
|
175 |
||
176 |
// From MP2PLinkRouterIf end |
|
177 |
||
178 |
// From MP2PChRouterIf start |
|
9 | 179 |
void DP2PRouter::Connect( |
0 | 180 |
const TUint8 aProtocolId, |
181 |
MP2PRouterChIf* aCallback |
|
182 |
) |
|
183 |
{ |
|
184 |
||
9 | 185 |
C_TRACE( ( _T( "DP2PRouter::Connect %d>" ), aProtocolId ) ); |
186 |
// assert to check always called in p2p extension thread context |
|
0 | 187 |
ASSERT_RESET_ALWAYS( aCallback, EP2PRouterNullParam ); |
188 |
ASSERT_RESET_ALWAYS( aProtocolId < EP2PAmountOfProtocols, ( EP2PRouterWrongParam2 | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
|
189 |
ASSERT_RESET_ALWAYS( iLinksArray[ aProtocolId ], ( EP2PRouterWrongParam3 | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
|
190 |
if( iLinksArray[ aProtocolId ]->TrxPresent() ) |
|
191 |
{ |
|
9 | 192 |
C_TRACE( ( _T( "DP2PRouter::Connect ok %d" ), aProtocolId ) ); |
0 | 193 |
NKern::FMWait( iShChannelTableFastMutex ); |
194 |
// Channel with the same protocol id is already opened or waiting to complete the opening. |
|
195 |
if( iShChannelTable[ aProtocolId ].iChannel || iShChannelTable[ aProtocolId ].iWaitingChannel ) |
|
196 |
{ |
|
197 |
NKern::FMSignal( iShChannelTableFastMutex ); |
|
198 |
// If another channel tries to open already open channel. |
|
199 |
TRACE_WARNING( iShChannelTable[ aProtocolId ].iChannel == aCallback, (TUint8)aProtocolId ); |
|
9 | 200 |
aCallback->EnqueChannelRequestCompleteDfc( EP2PAsyncOpen, KErrInUse );// synch user and kernel APIs return values |
0 | 201 |
} |
202 |
else |
|
203 |
{ |
|
204 |
iShChannelTable[ aProtocolId ].iChannel = aCallback; |
|
205 |
NKern::FMSignal( iShChannelTableFastMutex ); |
|
206 |
aCallback->EnqueChannelRequestCompleteDfc( EP2PAsyncOpen, KErrNone ); |
|
207 |
} |
|
208 |
} |
|
209 |
else |
|
210 |
{ |
|
9 | 211 |
C_TRACE( ( _T( "DP2PRouter::Connect pending %d" ), aProtocolId ) ); |
0 | 212 |
ASSERT_RESET_ALWAYS( !iShChannelTable[ aProtocolId ].iWaitingChannel, EP2PRouterWrongRequest ); |
213 |
NKern::FMWait( iShChannelTableFastMutex ); |
|
214 |
iShChannelTable[ aProtocolId ].iWaitingChannel = aCallback; |
|
215 |
NKern::FMSignal( iShChannelTableFastMutex ); |
|
216 |
} |
|
9 | 217 |
C_TRACE( ( _T( "DP2PRouter::Connect %d<" ), aProtocolId ) ); |
0 | 218 |
|
219 |
} |
|
220 |
||
221 |
void DP2PRouter::Close( |
|
222 |
const TUint8 aProtocolId |
|
223 |
) |
|
224 |
{ |
|
225 |
||
226 |
C_TRACE( ( _T( "DP2PRouter::Close %d>" ), aProtocolId ) ); |
|
9 | 227 |
// assert to check always called in p2p extension thread context |
0 | 228 |
ASSERT_RESET_ALWAYS( aProtocolId < EP2PAmountOfProtocols, ( EP2PRouterWrongParam4 | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
229 |
NKern::FMWait( iShChannelTableFastMutex ); |
|
230 |
if( iShChannelTable[ aProtocolId ].iChannel || iShChannelTable[ aProtocolId ].iWaitingChannel ) |
|
231 |
{ |
|
232 |
iShChannelTable[ aProtocolId ].iChannel = NULL; |
|
233 |
iShChannelTable[ aProtocolId ].iWaitingChannel = NULL; |
|
234 |
} |
|
235 |
NKern::FMSignal( iShChannelTableFastMutex ); |
|
236 |
C_TRACE( ( _T( "DP2PRouter::Close<" ) ) ); |
|
237 |
||
238 |
} |
|
239 |
||
240 |
// Shall be called from P2P ext router thread context only. |
|
241 |
TBool DP2PRouter::ConnectionExist( |
|
242 |
const TUint8 aProtocolId |
|
243 |
) |
|
244 |
{ |
|
245 |
||
246 |
C_TRACE( ( _T( "DP2PRouter::ConnectionExists %d<>" ), aProtocolId ) ); |
|
247 |
ASSERT_RESET_ALWAYS( aProtocolId < EP2PAmountOfProtocols, ( EP2PRouterWrongParam5 | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
|
248 |
ASSERT_RESET_ALWAYS( iLinksArray[ aProtocolId ], ( EP2PRouterWrongParam6 | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
|
249 |
return iLinksArray[ aProtocolId ]->TrxPresent(); |
|
250 |
||
251 |
} |
|
252 |
||
253 |
TDfcQue* DP2PRouter::GetDfcThread( |
|
254 |
const TP2PDfcThread anIndex |
|
255 |
) |
|
256 |
{ |
|
257 |
||
258 |
C_TRACE( ( _T( "DP2PRouter::GetDfcThread<>" ) ) ); |
|
259 |
ASSERT_RESET_ALWAYS( anIndex < EAmountOfP2PDfcThreads, EP2PRouterWrongRequest2 ); |
|
260 |
ASSERT_RESET_ALWAYS( iP2PDfcQueList[ anIndex ], EP2PRouterMemAllocFailure6 ); |
|
261 |
return iP2PDfcQueList[ anIndex ]; |
|
262 |
||
263 |
} |
|
264 |
||
265 |
||
266 |
MP2PChRouterIf* MP2PChRouterIf::GetIf() |
|
267 |
{ |
|
268 |
||
269 |
C_TRACE( ( _T( "MP2PChRouterIf::GetIf<>" ) ) ); |
|
270 |
return DP2PRouter::GetRouter(); |
|
271 |
||
272 |
} |
|
273 |
||
274 |
TInt DP2PRouter::Send( |
|
275 |
TDes8& aMessage, |
|
276 |
const TUint8 aProtocolId |
|
277 |
) |
|
278 |
{ |
|
279 |
||
280 |
C_TRACE( ( _T( "DP2PRouter::Send 0x%x>" ), &aMessage ) ); |
|
9 | 281 |
// assert to check always called in p2p extension thread context |
0 | 282 |
// Inside link array limits, if not programmer error. |
283 |
ASSERT_RESET_ALWAYS( aProtocolId < EP2PAmountOfProtocols, ( EP2PRouterWrongParam7 | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
|
284 |
MP2PRouterLinkIf* link = iLinksArray[ aProtocolId ]; |
|
285 |
ASSERT_RESET_ALWAYS( link, ( EP2PRouterWrongParam8 | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
|
286 |
TInt sendResult( KErrNone ); |
|
287 |
if( link->TrxPresent() ) |
|
288 |
{ |
|
289 |
link->Send( aMessage ); |
|
290 |
} |
|
291 |
else |
|
292 |
{ |
|
293 |
TRACE_ASSERT_ALWAYS; |
|
294 |
// Discard send block if connection lost |
|
295 |
MemApi::DeallocBlock( aMessage ); |
|
296 |
sendResult = KErrNotReady; |
|
297 |
} |
|
298 |
C_TRACE( ( _T( "DP2PRouter::Send 0x%x %d<" ), &aMessage, sendResult ) ); |
|
299 |
return sendResult; |
|
300 |
||
301 |
} |
|
302 |
// From MP2PChRouterIf end |
|
303 |
||
304 |
// privates start |
|
305 |
void DP2PRouter::Init( |
|
306 |
// None |
|
307 |
) |
|
308 |
{ |
|
309 |
||
310 |
C_TRACE( ( _T( "DP2PRouter::Init>" ) ) ); |
|
311 |
iLinksArray = new MP2PRouterLinkIf*[ EP2PAmountOfProtocols ]; |
|
312 |
ASSERT_RESET_ALWAYS( iLinksArray, ( EP2PRouterOverTheLimits | EDP2PRouterTraceId << KClassIdentifierShift ) ); |
|
313 |
// Initialize links |
|
314 |
for( TInt i( 0 ); i < EP2PAmountOfProtocols; i++ ) |
|
315 |
{ |
|
316 |
iLinksArray[ i ] = NULL; |
|
317 |
C_TRACE( ( _T( "DP2PRouter::DP2PRouter %d" ), i ) ); |
|
318 |
} |
|
319 |
// Initialize channels |
|
320 |
for( TInt i( 0 ); i < EP2PAmountOfProtocols; ++i ) |
|
321 |
{ |
|
322 |
iShChannelTable[ i ].iChannel = NULL; |
|
323 |
iShChannelTable[ i ].iWaitingChannel = NULL; |
|
9 | 324 |
iShChannelTable[ i ].iTrxConnectionStatus = EFalse; |
0 | 325 |
} |
9 | 326 |
// do more clever way to create links. |
0 | 327 |
// Configuration of links. |
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
328 |
iLinksArray[ EP2PRpc ] = MP2PRouterLinkIf::CreateLinkF( this, EP2PRpc, ETrxSharedMemory ); |
0 | 329 |
iLinksArray[ EP2PTest ] = MP2PRouterLinkIf::CreateLinkF( this, EP2PTest, ETrxTest ); |
330 |
iLinksArray[ EP2PTest2 ] = MP2PRouterLinkIf::CreateLinkF( this, EP2PTest2, ETrxTest ); |
|
331 |
iTrxPrecentDfc = new TDfc( TrxPrecentDfc, this, iP2PDfcQueList[ MP2PChRouterIf::EP2PDfcThread ], KDfcPriority ); |
|
332 |
iTrxNotPrecentDfc = new TDfc( TrxNotPrecentDfc, this, iP2PDfcQueList[ MP2PChRouterIf::EP2PDfcThread ], KDfcPriority ); |
|
333 |
iShChannelTableFastMutex = new NFastMutex(); |
|
334 |
ASSERT_RESET_ALWAYS( ( iTrxNotPrecentDfc && iTrxPrecentDfc && iShChannelTableFastMutex ), EP2PRouterMemAllocFailure4 ); |
|
335 |
iSelfPtr = this; |
|
336 |
C_TRACE( ( _T( "DP2PRouter::Init<" ) ) ); |
|
337 |
||
338 |
} |
|
339 |
||
340 |
void DP2PRouter::InitDfc( |
|
341 |
TAny* aPtr |
|
342 |
) |
|
343 |
{ |
|
344 |
||
345 |
C_TRACE( ( _T( "DP2PRouter::InitDfc>" ) ) ); |
|
346 |
DP2PRouter* self = reinterpret_cast<DP2PRouter*>( aPtr ); |
|
347 |
self->Init(); |
|
348 |
C_TRACE( ( _T( "DP2PRouter::InitDfc<" ) ) ); |
|
349 |
||
350 |
} |
|
351 |
||
352 |
void DP2PRouter::TrxPrecentDfc( |
|
353 |
TAny* aPtr |
|
354 |
) |
|
355 |
{ |
|
356 |
||
357 |
C_TRACE( ( _T( "DP2PRouter::TrxPrecentDfc>" ) ) ); |
|
358 |
DP2PRouter& self = *reinterpret_cast<DP2PRouter*>( aPtr ); |
|
359 |
// Notify all the protocols channel objects of the change of the presence. |
|
360 |
for( TUint8 i( 0 ); i < EP2PAmountOfProtocols; i++ ) |
|
361 |
{ |
|
362 |
TUint8 protocolId( i ); |
|
363 |
C_TRACE( ( _T( "DP2PRouter::TrxPrecentDfc Trx present id=0x%x" ), protocolId ) ); |
|
9 | 364 |
if ( !self.iShChannelTable[ protocolId ].iTrxConnectionStatus && |
365 |
self.ConnectionExist( protocolId ) ) |
|
0 | 366 |
{ |
9 | 367 |
// Trx status changed |
368 |
C_TRACE( ( _T( "DP2PRouter::TrxPrecentDfc Trx 0x%x present" ), protocolId ) ); |
|
369 |
self.iShChannelTable[ protocolId ].iTrxConnectionStatus = ETrue; |
|
370 |
NKern::FMWait( self.iShChannelTableFastMutex ); |
|
371 |
MP2PRouterChIf* waitingChannel = self.iShChannelTable[ protocolId ].iWaitingChannel; |
|
372 |
if( waitingChannel ) |
|
373 |
{ |
|
374 |
self.iShChannelTable[ protocolId ].iChannel = waitingChannel; |
|
375 |
NKern::FMSignal( self.iShChannelTableFastMutex ); |
|
376 |
C_TRACE( ( _T( "DP2PRouter::TrxPrecentDfc channel open waiting %d>" ), protocolId ) ); |
|
377 |
waitingChannel->EnqueChannelRequestCompleteDfc( EP2PAsyncOpen, KErrNone ); |
|
378 |
} |
|
379 |
else |
|
380 |
{ |
|
381 |
// No need to inform presence, when connection is lost it is closed too and must be opened again. |
|
382 |
NKern::FMSignal( self.iShChannelTableFastMutex ); |
|
383 |
C_TRACE( ( _T( "DP2PRouter::TrxPrecentDfc nothing waiting %d>" ), protocolId ) ); |
|
384 |
} |
|
0 | 385 |
} |
9 | 386 |
// No else: If trx status not changed no need to react |
0 | 387 |
} |
388 |
C_TRACE( ( _T( "DP2PRouter::TrxPrecentDfc<" )) ); |
|
389 |
||
390 |
} |
|
391 |
||
392 |
void DP2PRouter::TrxNotPrecentDfc( |
|
393 |
TAny* aPtr |
|
394 |
) |
|
395 |
{ |
|
396 |
||
397 |
C_TRACE( ( _T( "DP2PRouter::TrxNotPrecentDfc>" ) ) ); |
|
398 |
DP2PRouter& self = *reinterpret_cast<DP2PRouter*>( aPtr ); |
|
399 |
// Notify all the protocols channel objects of the change of the presence. |
|
400 |
for( TUint8 i( 0 ); i < EP2PAmountOfProtocols; i++ ) |
|
401 |
{ |
|
402 |
TUint8 protocolId( i ); |
|
9 | 403 |
if ( self.iShChannelTable[ protocolId ].iTrxConnectionStatus && |
404 |
!self.ConnectionExist( protocolId ) ) |
|
405 |
{ |
|
406 |
C_TRACE( ( _T( "DP2PRouter::TrxNotPrecentDfc Trx lost id=0x%x" ), protocolId ) ); |
|
407 |
self.iShChannelTable[ protocolId ].iTrxConnectionStatus = EFalse; |
|
408 |
// Notifying channel that connection is lost and discard any received messages. |
|
409 |
NKern::FMWait( self.iShChannelTableFastMutex ); |
|
410 |
MP2PRouterChIf* channel = self.iShChannelTable[ protocolId ].iChannel; |
|
411 |
if( channel ) |
|
412 |
{ |
|
413 |
NKern::FMSignal( self.iShChannelTableFastMutex ); |
|
414 |
C_TRACE( ( _T( "DP2PRouter::TrxNotPrecentDfc Trx lost channel found for id=0x%x" ), protocolId ) ); |
|
415 |
channel->ConnectionLost(); |
|
416 |
} |
|
417 |
else |
|
418 |
{ |
|
419 |
NKern::FMSignal( self.iShChannelTableFastMutex ); |
|
420 |
C_TRACE( ( _T( "DP2PRouter::TrxNotPrecentDfc Trx lost no channel found for id=0x%x" ), protocolId ) ); |
|
421 |
} |
|
0 | 422 |
} |
9 | 423 |
// No else: If trx status not changed no need to react |
0 | 424 |
} |
425 |
C_TRACE( ( _T( "DP2PRouter::TrxNotPrecentDfc<" )) ); |
|
426 |
||
427 |
} |
|
428 |
// privates end |
|
429 |
||
430 |
DECLARE_STANDARD_EXTENSION() |
|
431 |
{ |
|
432 |
||
433 |
Kern::Printf( "P2Prouter extension>" ); |
|
434 |
// Create a container extension |
|
435 |
DP2PRouter* extension = new DP2PRouter(); |
|
436 |
TRACE_ASSERT( extension ); |
|
437 |
Kern::Printf( "P2Prouter extension<" ); |
|
438 |
return extension ? KErrNone : KErrNoMemory; |
|
439 |
||
440 |
} |
|
441 |
||
442 |
DECLARE_EXTENSION_LDD() |
|
443 |
{ |
|
444 |
||
445 |
Kern::Printf( "P2Prouter ldd>" ); |
|
446 |
DLogicalDevice* device = new DP2PDevice; |
|
447 |
TRACE_ASSERT( device ); |
|
448 |
Kern::Printf( "P2Prouter ldd 0x%x<", device ); |
|
449 |
return( device ); |
|
450 |
||
451 |
} |
|
452 |