|
1 /* |
|
2 * Copyright (c) 2005 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 "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 |
|
21 #include <sipdialogassocbase.h> |
|
22 #include <sipdialog.h> |
|
23 #include <sipcontactheader.h> |
|
24 #include <sipprofile.h> |
|
25 #include "mceserver.pan" |
|
26 |
|
27 #include "mcecssubsession.h" |
|
28 #include "mcesipmanager.h" |
|
29 #include "mcecssessionimplementation.h" |
|
30 #include "mcecssession.h" |
|
31 #include "mceservercore.h" |
|
32 #include "mcesipconnection.h" |
|
33 #include "mcecssubsessionreceiver.h" |
|
34 #include "mcecsserveritc.h" |
|
35 #include "mcecomsession.h" |
|
36 #include "mcecommediastream.h" |
|
37 #include "mcecommediastream.h" |
|
38 #include "mcecomaudiocodec.h" |
|
39 #include "mcecommediasink.h" |
|
40 #include "mcecommediasource.h" |
|
41 #include "mceserial.h" |
|
42 #include "mcesrvlogs.h" |
|
43 #include "mcemessagedispatcher.h" |
|
44 |
|
45 |
|
46 const TInt KMaxAddressLength = 256; |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CMceCsSubSession::CMceCsSubSession |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 |
|
53 CMceCsSubSession::CMceCsSubSession ( TMceCsSessionType aType, |
|
54 CMceCsSession& aClientSession, |
|
55 CMceSipConnection& aSIPConnection ) |
|
56 : iType( EUnknown ), |
|
57 iClientType( aType ), |
|
58 iDialogId( KMceNotAssigned ), |
|
59 iClientExists( EFalse ), |
|
60 iCurrentDialog( NULL ), |
|
61 iClientSession (NULL ), |
|
62 iSIPConnection( aSIPConnection ), |
|
63 iServerCore( aClientSession.ServerCore() ), |
|
64 iProfile( NULL ) |
|
65 { |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CMceCsSubSession::CMceCsSubSession |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CMceCsSubSession::CMceCsSubSession ( TMceCsSessionType aType, |
|
73 CMceCsSession& aClientSession, |
|
74 CMceSipConnection& aSIPConnection, |
|
75 CSIPProfile& aProfile ) |
|
76 : iType( EUnknown ), |
|
77 iClientType( aType ), |
|
78 iDialogId( KMceNotAssigned ), |
|
79 iClientExists( EFalse ), |
|
80 iCurrentDialog( NULL ), |
|
81 iClientSession (NULL ), |
|
82 iSIPConnection( aSIPConnection ), |
|
83 iServerCore( aClientSession.ServerCore() ), |
|
84 iProfile( &aProfile ) |
|
85 { |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CMceCsSubSession::ConstructL |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CMceCsSubSession::ConstructL ( CMceCsSession& aClientSession ) |
|
93 { |
|
94 MCESRV_DEBUG("CMceCsSubSession::ConstructL, Entry") |
|
95 |
|
96 SetSessionReceiver( aClientSession.CreateSubSessionReceiverL() ); |
|
97 SetClient( aClientSession.Implementation() ); |
|
98 |
|
99 MCESRV_DEBUG("CMceCsSubSession::ConstructL, Exit") |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CMceCsSubSession::~CMceCsSubSession |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 CMceCsSubSession::~CMceCsSubSession() |
|
107 { |
|
108 MCESRV_DEBUG("CMceCsSubSession::~CMceCsSubSession, Entry") |
|
109 |
|
110 TInt index = iPendingTransactions.Find( iInitialInvite ); |
|
111 if ( index != KErrNotFound ) |
|
112 { |
|
113 iPendingTransactions.Remove( index ); |
|
114 } |
|
115 index = iPendingTransactions.Find( iResponse ); |
|
116 if ( index != KErrNotFound ) |
|
117 { |
|
118 iPendingTransactions.Remove( index ); |
|
119 } |
|
120 |
|
121 iPendingTransactions.ResetAndDestroy(); |
|
122 iPendingTransactions.Close(); |
|
123 |
|
124 iPendingReceivedRequests.ResetAndDestroy(); |
|
125 |
|
126 if ( iInitialInvite != iResponse ) |
|
127 { |
|
128 delete iInitialInvite; |
|
129 } |
|
130 |
|
131 iInitialInvite = NULL; |
|
132 delete iReceiver; |
|
133 delete iDialog; |
|
134 delete iResponse; |
|
135 delete iClientContent; |
|
136 Manager().UnRegisterSubSession( *this ); |
|
137 |
|
138 delete iAutoEventMsg; |
|
139 delete iAutoEventIds; |
|
140 delete iAutoEvent; |
|
141 |
|
142 MCESRV_DEBUG("CMceCsSubSession::~CMceCsSubSession, Exit") |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CMceCsSubSession::Type |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 CMceCsSubSession::TType CMceCsSubSession::Type() const |
|
150 { |
|
151 return iType; |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CMceCsSubSession::ClientType |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 TMceCsSessionType CMceCsSubSession::ClientType() const |
|
159 { |
|
160 return iClientType; |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CMceCsSubSession::ClientSession |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 CMceCsSessionImplementation& CMceCsSubSession::Client() const |
|
168 { |
|
169 return *iClientSession; |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CMceCsSubSession::SetClient |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CMceCsSubSession::SetClient( CMceCsSessionImplementation& aClient ) |
|
177 { |
|
178 iClientSession = &aClient; |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CMceCsSubSession::SetClient |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 void CMceCsSubSession::SetSessionReceiver( |
|
186 CMceCsSubSessionReceiver* aSessionReceiver ) |
|
187 { |
|
188 delete iReceiver; |
|
189 iReceiver = aSessionReceiver; |
|
190 } |
|
191 |
|
192 // ----------------------------------------------------------------------------- |
|
193 // CMceCsSubSession::IsOrphan |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 TBool CMceCsSubSession::IsOrphan() |
|
197 { |
|
198 return !iReceiver; |
|
199 } |
|
200 |
|
201 // ----------------------------------------------------------------------------- |
|
202 // CMceCsSubSession::HasInitialInviteTransactionBeenCompleted() |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 TBool CMceCsSubSession::HasInitialInviteTransactionBeenCompleted() const |
|
206 { |
|
207 TBool completed( ETrue ); |
|
208 if ( iInitialInvite ) |
|
209 { |
|
210 CSIPTransactionBase::TState state( CSIPTransactionBase::ETerminated ); |
|
211 TRAP_IGNORE( ( state = iInitialInvite->StateL() ) ) |
|
212 completed = ( state == CSIPTransactionBase::ECompleted || |
|
213 state == CSIPTransactionBase::ETerminated ); |
|
214 } |
|
215 return completed; |
|
216 } |
|
217 |
|
218 // ----------------------------------------------------------------------------- |
|
219 // CMceCsSubSession::SIPConnection |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 CMceSipConnection& CMceCsSubSession::SIPConnection() const |
|
223 { |
|
224 return iSIPConnection; |
|
225 } |
|
226 |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CMceCsSubSession::DialogId |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 TUint32 CMceCsSubSession::DialogId() const |
|
233 { |
|
234 return iDialogId; |
|
235 } |
|
236 |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CMceCsSubSession::Manager |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 CMceSipManager& CMceCsSubSession::Manager() const |
|
243 { |
|
244 return ServerCore().Manager(); |
|
245 } |
|
246 |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
|
249 // CMceCsSubSession::ServerCore |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 CMceServerCore& CMceCsSubSession::ServerCore() const |
|
253 { |
|
254 return iServerCore; |
|
255 } |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // CMceCsSubSession::FCSession |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 const CFCSession* CMceCsSubSession::FCSession() const |
|
262 { |
|
263 return iFCSession; |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CMceCsSubSession::Request |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 CSIPServerTransaction& CMceCsSubSession::Request() const |
|
271 { |
|
272 if ( iAutoEventEnabled && iAutoEventAssociatedRequest ) |
|
273 { |
|
274 TInt index = iPendingReceivedRequests.Find( iAutoEventAssociatedRequest ); |
|
275 if ( index != KErrNotFound ) |
|
276 { |
|
277 return *iAutoEventAssociatedRequest; |
|
278 } |
|
279 } |
|
280 return *CURRENT_REQUEST(); |
|
281 } |
|
282 |
|
283 // ----------------------------------------------------------------------------- |
|
284 // CMceCsSubSession::InitialRequest |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 CSIPServerTransaction& CMceCsSubSession::InitialRequest() const |
|
288 { |
|
289 return *FIRST_REQUEST(); |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // CMceCsSubSession::PopRequest |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 CSIPServerTransaction* CMceCsSubSession::PopRequest() |
|
297 { |
|
298 CSIPServerTransaction* request = NULL; |
|
299 |
|
300 request = CURRENT_REQUEST(); |
|
301 if ( request ) |
|
302 { |
|
303 iPendingReceivedRequests.Remove( CURRENT_REQUEST_IND ); |
|
304 } |
|
305 return request; |
|
306 } |
|
307 |
|
308 // ----------------------------------------------------------------------------- |
|
309 // CMceCsSubSession::Response |
|
310 // ----------------------------------------------------------------------------- |
|
311 // |
|
312 CSIPClientTransaction& CMceCsSubSession::Response() const |
|
313 { |
|
314 return *iResponse; |
|
315 } |
|
316 |
|
317 // ----------------------------------------------------------------------------- |
|
318 // CMceCsSubSession::PopResponse |
|
319 // ----------------------------------------------------------------------------- |
|
320 // |
|
321 CSIPClientTransaction* CMceCsSubSession::PopResponse() |
|
322 { |
|
323 CSIPClientTransaction* response = iResponse; |
|
324 if ( response && MceSip::TrxCompleted( *response ) ) |
|
325 { |
|
326 iResponse = NULL; |
|
327 } |
|
328 else |
|
329 { |
|
330 response = NULL; |
|
331 } |
|
332 |
|
333 return response; |
|
334 |
|
335 } |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CMceCsSubSession::SetDialog |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 void CMceCsSubSession::SetDialog( CMceCsSubSession::TType aType, |
|
342 CSIPDialogAssocBase* aDialog, |
|
343 TUint32 aDialogId ) |
|
344 { |
|
345 __ASSERT_ALWAYS( !iDialog, User::Panic( KMceServerPanic, KErrArgument ) ); |
|
346 iType = aType; |
|
347 iDialogId = aDialogId; |
|
348 iDialog = aDialog; |
|
349 } |
|
350 |
|
351 |
|
352 // ----------------------------------------------------------------------------- |
|
353 // CMceCsSubSession::SetPendingTransactionL |
|
354 // ----------------------------------------------------------------------------- |
|
355 // |
|
356 void CMceCsSubSession::SetPendingTransactionL( |
|
357 CSIPClientTransaction* aTransaction ) |
|
358 { |
|
359 __ASSERT_ALWAYS( aTransaction, User::Leave( KErrArgument ) ); |
|
360 __ASSERT_ALWAYS( iPendingTransactions.Find( aTransaction ) == KErrNotFound, |
|
361 User::Leave( KErrArgument ) ); |
|
362 |
|
363 iPendingTransactions.AppendL( aTransaction ); |
|
364 |
|
365 if ( Type() == EOutSession && |
|
366 aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EInvite ) ) |
|
367 { |
|
368 iType = EOutSIPSession; |
|
369 iInitialInvite = aTransaction; |
|
370 } |
|
371 } |
|
372 |
|
373 |
|
374 // ----------------------------------------------------------------------------- |
|
375 // CMceCsSubSession::Consumes |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 TBool CMceCsSubSession::Consumes( CSIPTransactionBase& aTransaction ) |
|
379 { |
|
380 TBool isPending = EFalse; |
|
381 |
|
382 if ( aTransaction.IsSIPClientTransaction() ) |
|
383 { |
|
384 CSIPClientTransaction& transaction = |
|
385 static_cast<CSIPClientTransaction&>( aTransaction ); |
|
386 isPending = iPendingTransactions.Find( &transaction ) >= 0; |
|
387 } |
|
388 else |
|
389 { |
|
390 CSIPServerTransaction& transaction = |
|
391 static_cast<CSIPServerTransaction&>( aTransaction ); |
|
392 isPending = iPendingReceivedRequests.Find( &transaction ) >= 0; |
|
393 } |
|
394 |
|
395 return isPending; |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CMceCsSubSession::AcceptDialogTransaction |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 TBool CMceCsSubSession::AcceptDialogTransaction( |
|
403 CSIPServerTransaction& /*aTransaction*/ ) |
|
404 { |
|
405 return ETrue; |
|
406 } |
|
407 |
|
408 // ----------------------------------------------------------------------------- |
|
409 // CMceCsSubSession::AcceptStandAloneTransaction |
|
410 // ----------------------------------------------------------------------------- |
|
411 // |
|
412 TBool CMceCsSubSession::AcceptStandAloneTransaction( |
|
413 CSIPServerTransaction& /*aTransaction*/ ) |
|
414 { |
|
415 return ETrue; |
|
416 } |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // CMceCsSubSession::Consumes |
|
420 // ----------------------------------------------------------------------------- |
|
421 // |
|
422 TBool CMceCsSubSession::Consumes( CSIPDialog& aDialog, |
|
423 CSIPServerTransaction& aTransaction, |
|
424 TBool& aAssociatesWithDialog ) |
|
425 { |
|
426 aAssociatesWithDialog = ( Dialog()->Dialog() == aDialog ); |
|
427 return aAssociatesWithDialog && ( Consumes( aTransaction ) || |
|
428 AcceptMethod( MceSip::Method( aTransaction ) ) ); |
|
429 } |
|
430 |
|
431 // ----------------------------------------------------------------------------- |
|
432 // CMceCsSubSession::DoServiceL |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 HBufC8* CMceCsSubSession::DoServiceL( TMceIds& /*aIds*/, |
|
436 TMceItcFunctions /*aFunction*/ ) |
|
437 { |
|
438 MCESRV_DEBUG("CMceCsSubSession::DoServiceL( no message ), NOT SUPPORTED") |
|
439 User::Leave( KErrNotSupported ); |
|
440 return NULL; |
|
441 } |
|
442 |
|
443 // ----------------------------------------------------------------------------- |
|
444 // CMceCsSubSession::DoServiceL |
|
445 // ----------------------------------------------------------------------------- |
|
446 // |
|
447 void CMceCsSubSession::DoServiceL( TMceIds& /*aIds*/, |
|
448 TMceItcFunctions /*aFunction*/, |
|
449 const TDesC8& /*aMessage*/ ) |
|
450 { |
|
451 MCESRV_DEBUG("CMceCsSubSession::DoServiceL( data ), NOT SUPPORTED") |
|
452 User::Leave( KErrNotSupported ); |
|
453 } |
|
454 |
|
455 // ----------------------------------------------------------------------------- |
|
456 // CMceCsSubSession::DoServiceL |
|
457 // ----------------------------------------------------------------------------- |
|
458 // |
|
459 void CMceCsSubSession::DoServiceL( TMceIds& /*aIds*/, |
|
460 TMceItcFunctions /*aFunction*/, |
|
461 TPtr8& /*aMessage*/ ) |
|
462 { |
|
463 MCESRV_DEBUG("CMceCsSubSession::DoServiceL( data ), NOT SUPPORTED") |
|
464 User::Leave( KErrNotSupported ); |
|
465 } |
|
466 |
|
467 // ----------------------------------------------------------------------------- |
|
468 // CMceCsSubSession::DoServiceL |
|
469 // ----------------------------------------------------------------------------- |
|
470 // |
|
471 void CMceCsSubSession::DoServiceL( TMceIds& /*aIds*/, |
|
472 TMceItcFunctions /*aFunction*/, |
|
473 CMceMsgBase& /*aMessage*/ ) |
|
474 { |
|
475 MCESRV_DEBUG("CMceCsSubSession::DoServiceL( message ), NOT SUPPORTED") |
|
476 User::Leave( KErrNotSupported ); |
|
477 } |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // CMceCsSubSession::PendingTransactions |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 const RPointerArray<CSIPClientTransaction>& |
|
484 CMceCsSubSession::PendingTransactions() |
|
485 { |
|
486 return iPendingTransactions; |
|
487 } |
|
488 |
|
489 // ----------------------------------------------------------------------------- |
|
490 // CMceCsSubSession::PendingReceivedRequests |
|
491 // ----------------------------------------------------------------------------- |
|
492 // |
|
493 const RPointerArray<CSIPServerTransaction>& |
|
494 CMceCsSubSession::PendingReceivedRequests() |
|
495 { |
|
496 return iPendingReceivedRequests; |
|
497 } |
|
498 |
|
499 // ----------------------------------------------------------------------------- |
|
500 // CMceCsSubSession::PendingTransaction |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 CSIPClientTransaction* CMceCsSubSession::PendingTransaction( RStringF aType ) |
|
504 { |
|
505 CSIPClientTransaction* trx = NULL; |
|
506 TInt index = PendingTransactions().Count()-1; |
|
507 |
|
508 while( !trx && index >= 0 ) |
|
509 { |
|
510 trx = PendingTransactions()[ index-- ]; |
|
511 TBool isMatch = trx->Type() == aType; |
|
512 trx = isMatch ? trx : NULL; |
|
513 } |
|
514 |
|
515 return trx; |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CMceCsSubSession::RegisterDialogAssoc |
|
520 // ----------------------------------------------------------------------------- |
|
521 // |
|
522 void CMceCsSubSession::RegisterDialogAssoc( CSIPDialogAssocBase& aDialogAssoc ) |
|
523 { |
|
524 iCurrentDialog = &aDialogAssoc; |
|
525 } |
|
526 |
|
527 // ----------------------------------------------------------------------------- |
|
528 // CMceCsSubSession::ResponseReceivedWithinDialog |
|
529 // ----------------------------------------------------------------------------- |
|
530 // |
|
531 void CMceCsSubSession::ResponseReceivedWithinDialog( CSIPClientTransaction& aTransaction, |
|
532 CSIPDialogAssocBase& aDialogAssoc ) |
|
533 { |
|
534 RegisterDialogAssoc( aDialogAssoc ); |
|
535 DialogResponseReceived( aTransaction ); |
|
536 } |
|
537 |
|
538 // ----------------------------------------------------------------------------- |
|
539 // CMceCsSubSession::DialogRequestReceived |
|
540 // ----------------------------------------------------------------------------- |
|
541 // |
|
542 TBool CMceCsSubSession::DialogRequestReceived( |
|
543 CSIPServerTransaction* aTransaction, |
|
544 CSIPDialog& aDialog ) |
|
545 { |
|
546 RemoveCompletedRequests(); |
|
547 TBool consumed = ETrue; |
|
548 |
|
549 CSIPServerTransaction* firstRequest = FIRST_REQUEST(); |
|
550 |
|
551 MCESRV_DEBUG("CMceCsSubSession::DialogRequestReceived, Entry") |
|
552 if ( !AcceptDialogTransaction( *aTransaction ) ) |
|
553 { |
|
554 consumed = EFalse; |
|
555 } |
|
556 else |
|
557 { |
|
558 MCESRV_DEBUG("no pending request") |
|
559 |
|
560 consumed = iPendingReceivedRequests.Append( aTransaction ) == KErrNone; |
|
561 if ( consumed ) |
|
562 { |
|
563 RequestReceived( ETrue, aDialog ); |
|
564 } |
|
565 } |
|
566 |
|
567 MCESRV_DEBUG("CMceCsSubSession::DialogRequestReceived, Exit") |
|
568 return consumed; |
|
569 } |
|
570 |
|
571 // ----------------------------------------------------------------------------- |
|
572 // CMceCsSubSession::SetResponse |
|
573 // ----------------------------------------------------------------------------- |
|
574 // |
|
575 void CMceCsSubSession::SetResponse( CSIPClientTransaction& aTransaction ) |
|
576 { |
|
577 |
|
578 if ( iResponse && |
|
579 iPendingTransactions.Find( iResponse ) < 0 ) |
|
580 { |
|
581 iInitialInvite = iResponse == iInitialInvite ? NULL : iInitialInvite; |
|
582 delete iResponse; |
|
583 iResponse = NULL; |
|
584 } |
|
585 |
|
586 iResponse = &aTransaction; |
|
587 |
|
588 } |
|
589 |
|
590 // ----------------------------------------------------------------------------- |
|
591 // CMceCsSubSession::RemovePendingTrx |
|
592 // ----------------------------------------------------------------------------- |
|
593 // |
|
594 TBool CMceCsSubSession::RemovePendingTrx( |
|
595 CSIPClientTransaction& aTransaction ) |
|
596 { |
|
597 TBool removed = EFalse; |
|
598 |
|
599 if ( iInitialInvite ? !( *iInitialInvite == aTransaction ) : ETrue ) |
|
600 { |
|
601 TInt index = iPendingTransactions.Find( &aTransaction ); |
|
602 iPendingTransactions.Remove( index ); |
|
603 removed = ETrue; |
|
604 } |
|
605 |
|
606 return removed; |
|
607 } |
|
608 |
|
609 // ----------------------------------------------------------------------------- |
|
610 // CMceCsSubSession::RemovePendingCompletedTrx |
|
611 // ----------------------------------------------------------------------------- |
|
612 // |
|
613 TBool CMceCsSubSession::RemovePendingCompletedTrx( |
|
614 CSIPClientTransaction& aTransaction ) |
|
615 { |
|
616 TBool removed = EFalse; |
|
617 |
|
618 TBool trxCompleted = MceSip::TrxCompleted( aTransaction ); |
|
619 |
|
620 if ( trxCompleted ) |
|
621 { |
|
622 RemovePendingTrx( aTransaction ); |
|
623 } |
|
624 |
|
625 return removed; |
|
626 } |
|
627 |
|
628 // ----------------------------------------------------------------------------- |
|
629 // CMceCsSubSession::RemoveCompletedRequests |
|
630 // ----------------------------------------------------------------------------- |
|
631 // |
|
632 void CMceCsSubSession::RemoveCompletedRequests( TBool aAll ) |
|
633 { |
|
634 TInt ind = iPendingReceivedRequests.Count() - 1; |
|
635 while ( ind >= 0 ) |
|
636 { |
|
637 CSIPServerTransaction* transaction = iPendingReceivedRequests[ ind ]; |
|
638 if ( MceSip::TrxCompleted( *transaction ) ) |
|
639 { |
|
640 // Don't remove the incoming invite until ACK has been received |
|
641 if ( MceSip::TrxType( *transaction ) != SipStrConsts::EInvite || aAll ) |
|
642 { |
|
643 iPendingReceivedRequests.Remove( ind ); |
|
644 delete transaction; |
|
645 } |
|
646 } |
|
647 ind--; |
|
648 } |
|
649 } |
|
650 |
|
651 // ----------------------------------------------------------------------------- |
|
652 // CMceCsSubSession::InitializeIncomingDialogL |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 void CMceCsSubSession::InitializeIncomingDialogL( |
|
656 CSIPServerTransaction* aTransaction ) |
|
657 { |
|
658 MCESRV_DEBUG("CMceCsSubSession::InitializeIncomingDialogL, Entry") |
|
659 __ASSERT_ALWAYS( !CURRENT_REQUEST(), User::Leave( KErrArgument ) ); |
|
660 DoInitializeIncomingDialogL( *aTransaction ); |
|
661 iPendingReceivedRequests.AppendL( aTransaction ); |
|
662 |
|
663 RequestReceived( EFalse, Dialog()->Dialog() ); |
|
664 |
|
665 MCESRV_DEBUG("CMceCsSubSession::InitializeIncomingDialogL, Exit") |
|
666 } |
|
667 |
|
668 // ----------------------------------------------------------------------------- |
|
669 // CMceCsSubSession::DialogResponseReceived |
|
670 // ----------------------------------------------------------------------------- |
|
671 // |
|
672 void CMceCsSubSession::DialogResponseReceived( |
|
673 CSIPClientTransaction& aTransaction ) |
|
674 { |
|
675 MCESRV_DEBUG("CMceCsSubSession::DialogResponseReceived, Entry") |
|
676 SetResponse( aTransaction ); |
|
677 switch ( MceSip::ResponseType( aTransaction ) ) |
|
678 { |
|
679 case E1XX: |
|
680 { |
|
681 ProvisionalResponseReceived(); |
|
682 break; |
|
683 } |
|
684 case E2XX: |
|
685 { |
|
686 ResponseReceived(); |
|
687 break; |
|
688 } |
|
689 case E3XX: |
|
690 { |
|
691 RedirectionResponseReceived(); |
|
692 break; |
|
693 } |
|
694 case E4XX: |
|
695 case E5XX: |
|
696 case E6XX: |
|
697 default: |
|
698 { |
|
699 ErrorResponseReceived(); |
|
700 break; |
|
701 } |
|
702 } |
|
703 |
|
704 RemovePendingCompletedTrx( aTransaction ); |
|
705 MCESRV_DEBUG("CMceCsSubSession::DialogResponseReceived, Exit") |
|
706 } |
|
707 |
|
708 // ----------------------------------------------------------------------------- |
|
709 // CMceCsSubSession::MessageRequestReceived |
|
710 // ----------------------------------------------------------------------------- |
|
711 // |
|
712 TBool CMceCsSubSession::MessageRequestReceived( |
|
713 CSIPServerTransaction* aTransaction ) |
|
714 { |
|
715 MCESRV_DEBUG("CMceCsSubSession::MessageRequestReceived, Entry") |
|
716 TBool consumed = AcceptStandAloneTransaction( *aTransaction ); |
|
717 RemoveCompletedRequests(); |
|
718 if ( consumed ) |
|
719 { |
|
720 consumed = iPendingReceivedRequests.Append( aTransaction ) == KErrNone; |
|
721 if ( consumed ) |
|
722 { |
|
723 StandAloneRequestReceived(); |
|
724 } |
|
725 } |
|
726 MCESRV_DEBUG("CMceCsSubSession::MessageRequestReceived, Exit") |
|
727 return consumed; |
|
728 } |
|
729 |
|
730 // ----------------------------------------------------------------------------- |
|
731 // CMceCsSubSession::MessageResponseReceived |
|
732 // ----------------------------------------------------------------------------- |
|
733 // |
|
734 void CMceCsSubSession::MessageResponseReceived( |
|
735 CSIPClientTransaction& aTransaction ) |
|
736 { |
|
737 MCESRV_DEBUG("CMceCsSubSession::MessageResponseReceived, Entry") |
|
738 |
|
739 SetResponse( aTransaction ); |
|
740 |
|
741 StandAloneResponseReceived( MceSip::ResponseType( aTransaction ) ); |
|
742 |
|
743 RemovePendingCompletedTrx( aTransaction ); |
|
744 |
|
745 MCESRV_DEBUG("CMceCsSubSession::MessageResponseReceived, Exit") |
|
746 } |
|
747 |
|
748 // ----------------------------------------------------------------------------- |
|
749 // CMceCsSubSession::InviteCompleted |
|
750 // ----------------------------------------------------------------------------- |
|
751 // |
|
752 void CMceCsSubSession::InviteCompleted( CSIPClientTransaction& aTransaction ) |
|
753 { |
|
754 MCESRV_DEBUG("CMceCsSubSession::InviteCompleted, Entry") |
|
755 |
|
756 TInt index = iPendingTransactions.Find( &aTransaction ); |
|
757 if ( index != KErrNotFound ) |
|
758 { |
|
759 iPendingTransactions.Remove( index ); |
|
760 if ( iInitialInvite != iResponse ) |
|
761 { |
|
762 delete iInitialInvite; |
|
763 iInitialInvite = NULL; |
|
764 } |
|
765 } |
|
766 else |
|
767 { |
|
768 MCESRV_DEBUG("InviteCompleted: NO PENDING TRANSACTION") |
|
769 } |
|
770 |
|
771 MCESRV_DEBUG("CMceCsSubSession::InviteCompleted, Exit") |
|
772 } |
|
773 |
|
774 // ----------------------------------------------------------------------------- |
|
775 // CMceCsSubSession::ErrorOccured |
|
776 // ----------------------------------------------------------------------------- |
|
777 // |
|
778 void CMceCsSubSession::ErrorOccured( TInt aError, |
|
779 CSIPTransactionBase& aTransaction ) |
|
780 { |
|
781 MCESRV_DEBUG("CMceCsSubSession::ErrorOccured, Entry") |
|
782 MCESRV_DEBUG_DVALUE("ERROR", aError ) |
|
783 |
|
784 if ( aTransaction.IsSIPClientTransaction() ) |
|
785 { |
|
786 CSIPClientTransaction& clientTransaction = |
|
787 static_cast<CSIPClientTransaction&>( aTransaction ); |
|
788 SetResponse( clientTransaction ); |
|
789 DoErrorOccured( aError, clientTransaction ); |
|
790 RemovePendingCompletedTrx( clientTransaction ); |
|
791 } |
|
792 else |
|
793 { |
|
794 DoErrorOccured( aError, aTransaction ); |
|
795 } |
|
796 |
|
797 MCESRV_DEBUG("CMceCsSubSession::ErrorOccured, Exit") |
|
798 } |
|
799 |
|
800 // ----------------------------------------------------------------------------- |
|
801 // CMceCsSubSession::Dialog |
|
802 // ----------------------------------------------------------------------------- |
|
803 // |
|
804 CSIPDialogAssocBase* CMceCsSubSession::Dialog() const |
|
805 { |
|
806 return iDialog; |
|
807 } |
|
808 |
|
809 // ----------------------------------------------------------------------------- |
|
810 // CMceCsSubSession::ServiceL |
|
811 // ----------------------------------------------------------------------------- |
|
812 // |
|
813 void CMceCsSubSession::ServiceL( TMceIds& aIds, |
|
814 TMceItcFunctions aFunction, |
|
815 const RMessage2& aMessage) |
|
816 { |
|
817 MCESRV_DEBUG("CMceCsSubSession::ServiceL, Entry") |
|
818 MCESRV_DEBUG_EVENT("ITC", aFunction ) |
|
819 |
|
820 User::LeaveIfNull( iReceiver ); |
|
821 |
|
822 switch (aFunction) |
|
823 { |
|
824 case EMceItcClientReadyToReceive: // Asynchronous. Do not complete yet. |
|
825 { |
|
826 ClientReadyToReceiveL (aMessage); |
|
827 return; |
|
828 } |
|
829 case EMceItcClientCancelReceive: |
|
830 { |
|
831 CancelClientReceiveL (); |
|
832 break; |
|
833 } |
|
834 case EMceItcReceive: |
|
835 { |
|
836 ReceiveL (aMessage); |
|
837 break; |
|
838 } |
|
839 default: |
|
840 { |
|
841 DoServiceL(aIds, aFunction, aMessage ); |
|
842 } |
|
843 } |
|
844 iReceiver->ITC().WriteL(aMessage, aIds); |
|
845 iReceiver->ITC().Complete(aMessage, KErrNone); |
|
846 |
|
847 MCESRV_DEBUG("CMceCsSubSession::ServiceL, Exit") |
|
848 } |
|
849 |
|
850 // ----------------------------------------------------------------------------- |
|
851 // CMceCsSubSession::DoServiceL |
|
852 // ----------------------------------------------------------------------------- |
|
853 // |
|
854 void CMceCsSubSession::DoServiceL( TMceIds& aIds, |
|
855 TMceItcFunctions aFunction, |
|
856 const RMessage2& aMessage ) |
|
857 { |
|
858 MCESRV_DEBUG("CMceCsSubSession::DoServiceL, Entry") |
|
859 MCESRV_DEBUG_IDS("IDS", aIds ) |
|
860 |
|
861 // Clean completed requests |
|
862 RemoveCompletedRequests(); |
|
863 |
|
864 TMceMessageDispatcher<CMceCsSubSession> dispatcher( *this, iReceiver->ITC() ); |
|
865 |
|
866 dispatcher.DispatchL( aIds, aFunction, aMessage ); |
|
867 |
|
868 MCESRV_DEBUG("CMceCsSubSession::DoServiceL, Exit") |
|
869 } |
|
870 |
|
871 // ----------------------------------------------------------------------------- |
|
872 // CMceCsSubSession::SendErrorToClient |
|
873 // ----------------------------------------------------------------------------- |
|
874 // |
|
875 TInt CMceCsSubSession::SendErrorToClient( TMceIds& aIds, TInt aError ) |
|
876 { |
|
877 MCESRV_DEBUG("CMceCsSubSession::SendErrorToClient, Entry") |
|
878 MCESRV_DEBUG_DVALUE("error", aError ) |
|
879 |
|
880 TInt status = KErrNone; |
|
881 if ( !IsOrphan() ) |
|
882 { |
|
883 TMceIds ids = iReceiver->Ids(); |
|
884 ids.Copy( aIds ); |
|
885 |
|
886 MCESRV_DEBUG_IDS("IDS", ids ) |
|
887 |
|
888 TRAP( status, iReceiver->SendToClientL( ids, aError ) ); |
|
889 } |
|
890 else |
|
891 { |
|
892 MCESRV_DEBUG("orphan -> no recipient to send") |
|
893 } |
|
894 |
|
895 MCESRV_DEBUG("CMceCsSubSession::SendErrorToClient, Exit") |
|
896 return status; |
|
897 } |
|
898 |
|
899 // ----------------------------------------------------------------------------- |
|
900 // CMceCsSubSession::SendToClient |
|
901 // ----------------------------------------------------------------------------- |
|
902 // |
|
903 TInt CMceCsSubSession::SendToClient( TMceIds& aIds ) |
|
904 { |
|
905 MCESRV_DEBUG("CMceCsSubSession::SendToClient( ids ), Entry") |
|
906 |
|
907 TInt status = KErrNone; |
|
908 if ( !IsOrphan() ) |
|
909 { |
|
910 TMceIds ids = iReceiver->Ids(); |
|
911 ids.Copy( aIds ); |
|
912 |
|
913 MCESRV_DEBUG_IDS("IDS", ids ) |
|
914 |
|
915 TRAP( status, iReceiver->SendToClientL( ids ) ); |
|
916 } |
|
917 else |
|
918 { |
|
919 MCESRV_DEBUG("orphan -> no recipient to send") |
|
920 } |
|
921 |
|
922 MCESRV_DEBUG("CMceCsSubSession::SendToClient( ids ), Exit") |
|
923 return status; |
|
924 } |
|
925 |
|
926 // ----------------------------------------------------------------------------- |
|
927 // CMceCsSubSession::SendToClientL |
|
928 // ----------------------------------------------------------------------------- |
|
929 // |
|
930 void CMceCsSubSession::SendToClientL( TMceIds& aIds, |
|
931 HBufC8* aContext, |
|
932 HBufC8* aContent ) |
|
933 { |
|
934 MCESRV_DEBUG("CMceCsSubSession::SendToClient(ids,context,content), Entry") |
|
935 |
|
936 if ( !IsOrphan() ) |
|
937 { |
|
938 TMceIds ids = iReceiver->Ids(); |
|
939 ids.Copy( aIds ); |
|
940 |
|
941 MCESRV_DEBUG_IDS("IDS", ids ) |
|
942 |
|
943 if ( aContent ) |
|
944 { |
|
945 iReceiver->SendToClientL( ids, aContext, aContent ); |
|
946 } |
|
947 else |
|
948 { |
|
949 iReceiver->SendToClientL( ids, aContext ); |
|
950 } |
|
951 } |
|
952 else |
|
953 { |
|
954 delete aContext; |
|
955 delete aContent; |
|
956 } |
|
957 |
|
958 MCESRV_DEBUG("CMceCsSubSession::SendToClient(ids,context,content), Exit") |
|
959 } |
|
960 |
|
961 // ----------------------------------------------------------------------------- |
|
962 // CMceCsSubSession::ClientReadyToReceiveL |
|
963 // ----------------------------------------------------------------------------- |
|
964 // |
|
965 void CMceCsSubSession::ClientReadyToReceiveL( const RMessage2& aMessage ) |
|
966 { |
|
967 MCESRV_DEBUG("CMceCsSubSession::ClientReadyToReceiveL, Entry") |
|
968 |
|
969 iReceiver->ClientReadyToReceiveL( aMessage ); |
|
970 iClientExists = ETrue; |
|
971 |
|
972 MCESRV_DEBUG("CMceCsSubSession::ClientReadyToReceiveL, Exit") |
|
973 } |
|
974 |
|
975 // ----------------------------------------------------------------------------- |
|
976 // CMceCsSubSession::CancelClientReceiveL |
|
977 // ----------------------------------------------------------------------------- |
|
978 // |
|
979 void CMceCsSubSession::CancelClientReceiveL() |
|
980 { |
|
981 MCESRV_DEBUG("CMceCsSubSession::CancelClientReceiveL, Entry") |
|
982 |
|
983 iClientExists = EFalse; |
|
984 iReceiver->CancelClientReceiveL(); |
|
985 |
|
986 MCESRV_DEBUG("CMceCsSubSession::CancelClientReceiveL, Exit") |
|
987 } |
|
988 |
|
989 // ----------------------------------------------------------------------------- |
|
990 // CMceCsSubSession::ReceiveL |
|
991 // ----------------------------------------------------------------------------- |
|
992 // |
|
993 void CMceCsSubSession::ReceiveL( const RMessage2& aMessage ) |
|
994 { |
|
995 MCESRV_DEBUG("CMceCsSubSession::ReceiveL, Entry") |
|
996 |
|
997 iReceiver->ReceiveL (aMessage); |
|
998 |
|
999 MCESRV_DEBUG("CMceCsSubSession::ReceiveL, Exit") |
|
1000 } |
|
1001 |
|
1002 // ----------------------------------------------------------------------------- |
|
1003 // CMceCsSubSession::ClientExists |
|
1004 // ----------------------------------------------------------------------------- |
|
1005 // |
|
1006 TBool CMceCsSubSession::ClientExists() |
|
1007 { |
|
1008 return iClientExists; |
|
1009 } |
|
1010 |
|
1011 // ----------------------------------------------------------------------------- |
|
1012 // CMceCsSubSession::DefaultHeaders |
|
1013 // ----------------------------------------------------------------------------- |
|
1014 // |
|
1015 CDesC8Array& CMceCsSubSession::DefaultHeaders( TInt aMethodInd ) |
|
1016 { |
|
1017 return Client().DefaultHeaders( aMethodInd ); |
|
1018 } |
|
1019 |
|
1020 |
|
1021 // ----------------------------------------------------------------------------- |
|
1022 // CMceCsSubSession::StoreClientContent |
|
1023 // ----------------------------------------------------------------------------- |
|
1024 // |
|
1025 void CMceCsSubSession::StoreClientContent( HBufC8* aClientContent ) |
|
1026 { |
|
1027 delete iClientContent; |
|
1028 iClientContent = aClientContent; |
|
1029 } |
|
1030 |
|
1031 // ----------------------------------------------------------------------------- |
|
1032 // CMceCsSubSession::PopClientContent |
|
1033 // ----------------------------------------------------------------------------- |
|
1034 // |
|
1035 HBufC8* CMceCsSubSession::PopClientContent() |
|
1036 { |
|
1037 HBufC8* clientContent = iClientContent; |
|
1038 iClientContent = NULL; |
|
1039 return clientContent; |
|
1040 } |
|
1041 |
|
1042 |
|
1043 // ----------------------------------------------------------------------------- |
|
1044 // CMceCsSubSession::ConnectionStateChanged |
|
1045 // ----------------------------------------------------------------------------- |
|
1046 // |
|
1047 void CMceCsSubSession::ConnectionStateChanged( CSIPConnection::TState aState ) |
|
1048 { |
|
1049 TBool isActive = EFalse; |
|
1050 if ( aState == CSIPConnection::EActive ) |
|
1051 { |
|
1052 isActive = ETrue; |
|
1053 } |
|
1054 |
|
1055 DoConnectionStateChanged( isActive ); |
|
1056 |
|
1057 TMceIds ids; |
|
1058 ids.iCallbackID = EMceItcSessionConnectionStateChanged; |
|
1059 ids.iState = isActive; |
|
1060 SendToClient( ids ); |
|
1061 } |
|
1062 |
|
1063 // --------------------------------------------------------------------------------- |
|
1064 // CMceCsSubSession::ResetInitialInvite |
|
1065 // --------------------------------------------------------------------------------- |
|
1066 // |
|
1067 void CMceCsSubSession::ResetInitialInvite() |
|
1068 { |
|
1069 iInitialInvite = NULL; |
|
1070 } |
|
1071 |
|
1072 // --------------------------------------------------------------------------------- |
|
1073 // CMceCsSubSession::SetAutoEvent |
|
1074 // --------------------------------------------------------------------------------- |
|
1075 // |
|
1076 void CMceCsSubSession::SetAutoEvent( TBool aIsEnabled ) |
|
1077 { |
|
1078 iAutoEventEnabled = aIsEnabled; |
|
1079 } |
|
1080 |
|
1081 // --------------------------------------------------------------------------------- |
|
1082 // CMceCsSubSession::AutoEvent |
|
1083 // --------------------------------------------------------------------------------- |
|
1084 // |
|
1085 TBool CMceCsSubSession::AutoEvent() |
|
1086 { |
|
1087 return iAutoEventEnabled; |
|
1088 } |
|
1089 |
|
1090 // ----------------------------------------------------------------------------- |
|
1091 // CMceCsSubSession::StoreAutoEventL |
|
1092 // ----------------------------------------------------------------------------- |
|
1093 // |
|
1094 /*lint -e506*/ |
|
1095 void CMceCsSubSession::StoreAutoEventL( |
|
1096 TMceStateTransitionEvent* aEvent, |
|
1097 CSIPServerTransaction* aAssociatedRequest ) |
|
1098 { |
|
1099 delete iAutoEventMsg; |
|
1100 iAutoEventMsg = NULL; |
|
1101 delete iAutoEventIds; |
|
1102 iAutoEventIds = NULL; |
|
1103 delete iAutoEvent; |
|
1104 iAutoEvent = NULL; |
|
1105 |
|
1106 if ( aEvent ) |
|
1107 { |
|
1108 // Have to duplicate certain elements as their lifetime may end |
|
1109 // while waiting for auto accept. |
|
1110 TMceIds* ids = NULL; |
|
1111 if ( &aEvent->ParamIDs() ) |
|
1112 { |
|
1113 ids = new ( ELeave ) TMceIds( aEvent->ParamIDs() ); |
|
1114 } |
|
1115 else |
|
1116 { |
|
1117 ids = new ( ELeave ) TMceIds; |
|
1118 } |
|
1119 CleanupStack::PushL( ids ); |
|
1120 |
|
1121 CMceMsgBase& clonedMsg = aEvent->ParamClientMessage(); |
|
1122 if ( &clonedMsg ) |
|
1123 { |
|
1124 CMceMsgSIPReply* msg = new ( ELeave ) CMceMsgSIPReply(); |
|
1125 CleanupStack::PushL( msg ); |
|
1126 msg->PushL(); |
|
1127 clonedMsg.EncodeL(); |
|
1128 msg->DecodeL( clonedMsg.EncodeBuffer().Ptr( 0 ) ); |
|
1129 iAutoEventMsg = msg; |
|
1130 CleanupStack::Pop( msg ); |
|
1131 } |
|
1132 |
|
1133 iAutoEventIds = ids; |
|
1134 CleanupStack::Pop( ids ); |
|
1135 |
|
1136 iAutoEvent = new ( ELeave ) TMceStateTransitionEvent; |
|
1137 *iAutoEvent = *aEvent; |
|
1138 iAutoEvent->SetParamIDs( *iAutoEventIds ); |
|
1139 iAutoEvent->SetParamClientMessage( iAutoEventMsg ); |
|
1140 } |
|
1141 |
|
1142 iAutoEventAssociatedRequest = aAssociatedRequest; |
|
1143 } |
|
1144 |
|
1145 // ----------------------------------------------------------------------------- |
|
1146 // CMceCsSubSession::StoredAutoEvent |
|
1147 // ----------------------------------------------------------------------------- |
|
1148 // |
|
1149 TMceStateTransitionEvent* CMceCsSubSession::StoredAutoEvent() |
|
1150 { |
|
1151 return iAutoEvent; |
|
1152 } |
|
1153 |
|
1154 // ----------------------------------------------------------------------------- |
|
1155 // CMceCsSubSession::Profile |
|
1156 // ----------------------------------------------------------------------------- |
|
1157 // |
|
1158 CSIPProfile& CMceCsSubSession::Profile() const |
|
1159 { |
|
1160 return *iProfile; |
|
1161 } |
|
1162 |
|
1163 // ----------------------------------------------------------------------------- |
|
1164 // CMceCsSubSession::SetProfile |
|
1165 // ----------------------------------------------------------------------------- |
|
1166 // |
|
1167 void CMceCsSubSession::SetProfile( CSIPProfile& aProfile ) |
|
1168 { |
|
1169 iProfile = &aProfile; |
|
1170 } |
|
1171 |
|
1172 // ----------------------------------------------------------------------------- |
|
1173 // CMceCsSubSession::ProfileConfigured |
|
1174 // ----------------------------------------------------------------------------- |
|
1175 // |
|
1176 TBool CMceCsSubSession::ProfileConfigured() const |
|
1177 { |
|
1178 return ( iProfile != 0 ); |
|
1179 } |
|
1180 |
|
1181 // ----------------------------------------------------------------------------- |
|
1182 // CMceCsSubSession::NextHopL |
|
1183 // ----------------------------------------------------------------------------- |
|
1184 // |
|
1185 TInetAddr* CMceCsSubSession::NextHopL( TInetAddr& aNextHop ) |
|
1186 { |
|
1187 TInetAddr* nextHop = NULL; |
|
1188 |
|
1189 const TDesC8* registeredContact = NULL; |
|
1190 |
|
1191 if ( ProfileConfigured() && Profile().GetParameter( KSIPRegisteredContact, |
|
1192 registeredContact ) == KErrNone ) |
|
1193 { |
|
1194 CSIPContactHeader* contact = MceSip::ToContactHeaderL( *registeredContact ); |
|
1195 CleanupStack::PushL( contact ); |
|
1196 const CUri8& contactUri = contact->SIPAddress()->Uri8(); |
|
1197 const TDesC8& contactUriHost = contactUri.Uri().Extract( EUriHost ); |
|
1198 TBuf<KMaxAddressLength> addr16; |
|
1199 addr16.Copy( contactUriHost ); |
|
1200 if ( aNextHop.Input( addr16 ) == KErrNone ) |
|
1201 { |
|
1202 CleanupStack::PopAndDestroy( contact ); |
|
1203 nextHop = &aNextHop; |
|
1204 } |
|
1205 } |
|
1206 |
|
1207 return nextHop; |
|
1208 } |
|
1209 |
|
1210 // ----------------------------------------------------------------------------- |
|
1211 // CMceCsSubSession::IsProfileContactSecureL |
|
1212 // ----------------------------------------------------------------------------- |
|
1213 // |
|
1214 TBool CMceCsSubSession::IsProfileContactSecureL( ) |
|
1215 { |
|
1216 MCESRV_DEBUG("CMceSipConnection::IsProfileContactSecureL, Entry") |
|
1217 const TDesC8* registeredContact = NULL; |
|
1218 TBool contactSecure = EFalse; |
|
1219 if ( ProfileConfigured() && |
|
1220 Profile().GetParameter( KSIPRegisteredContact, |
|
1221 registeredContact ) == KErrNone ) |
|
1222 { |
|
1223 CSIPContactHeader* contact = MceSip::ToContactHeaderL( *registeredContact ); |
|
1224 CleanupStack::PushL( contact ); |
|
1225 const CUri8& contactUri = contact->SIPAddress()->Uri8(); |
|
1226 const TDesC8& uriScheme = contactUri.Uri().Extract( EUriScheme ); |
|
1227 const TDesC8& uriPath = contactUri.Uri().Extract( EUriPath ); |
|
1228 if ( uriScheme.FindF( KMceSipUriSchemeSIPs ) != KErrNotFound || |
|
1229 uriPath.FindF( KMceSipTransportTLS ) != KErrNotFound ) |
|
1230 { |
|
1231 contactSecure = ETrue; |
|
1232 MCESRV_DEBUG("profile contact header has sips uri or tls") |
|
1233 } |
|
1234 |
|
1235 CleanupStack::PopAndDestroy( contact ); |
|
1236 return contactSecure; |
|
1237 } |
|
1238 MCESRV_DEBUG("CMceSipConnection::IsProfileContactSecureL, Entry") |
|
1239 return contactSecure; |
|
1240 } |
|
1241 |
|
1242 // End of File |