|
1 /* |
|
2 * Copyright (c) 2007 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 "mcecomsession.h" |
|
22 #include "mceserial.h" |
|
23 #include "mceevents.h" |
|
24 #include "cleanupresetanddestroy.h" |
|
25 |
|
26 #ifdef MCE_COMMON_SERVER_SIDE |
|
27 |
|
28 #include "mcesrvstream.h" |
|
29 #include "mcemediaidle.h" |
|
30 #include "mcemedianegotiated.h" |
|
31 #include "mcemediamanager.h" |
|
32 #include "mcesrvstreamiterator.h" |
|
33 #include "mceadoptedsrvstream.h" |
|
34 #include "mcesdpsession.h" |
|
35 |
|
36 #else |
|
37 |
|
38 #define KMceNegotiationAnswerTypeNotDefined 0 |
|
39 #define KMceCodecSelectionOff 0 |
|
40 |
|
41 #endif//MCE_COMMON_SERVER_SIDE |
|
42 |
|
43 |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =============================== |
|
46 |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CMceComSession::NewL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CMceComSession* CMceComSession::NewL() |
|
53 { |
|
54 return NewL( EInSession ); |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CMceComSession::NewL |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CMceComSession* CMceComSession::NewL( CMceComSession::TType aType ) |
|
62 { |
|
63 CMceComSession* self = NewLC( aType ); |
|
64 CleanupStack::Pop( self ); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CMceComSession::NewLC |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CMceComSession* CMceComSession::NewLC( CMceComSession::TType aType ) |
|
73 { |
|
74 CMceComSession* self = new (ELeave) CMceComSession( aType ); |
|
75 CleanupStack::PushL( self ); |
|
76 self->ConstructL(); |
|
77 return self; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CMceComSession::NewL |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 CMceComSession* CMceComSession::NewL( MMceComSerializationContext& aSerCtx ) |
|
85 { |
|
86 CMceComSession* self = NewLC( aSerCtx ); |
|
87 CleanupStack::Pop( self ); |
|
88 return self; |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CMceComSession::NewLC |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 CMceComSession* CMceComSession::NewLC( MMceComSerializationContext& aSerCtx ) |
|
96 { |
|
97 CMceComSession* self = new (ELeave) CMceComSession(); |
|
98 CleanupStack::PushL( self ); |
|
99 self->InternalizeL( aSerCtx ); |
|
100 self->InitializeL(); |
|
101 return self; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CMceComSession::~CMceComSession |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 CMceComSession::~CMceComSession() |
|
109 { |
|
110 delete iRecipient; |
|
111 delete iOriginator; |
|
112 delete iSIPHeaders; |
|
113 delete iSIPContentType; |
|
114 delete iSIPContentHeaders; |
|
115 delete iLocalSessionSDPLines; |
|
116 delete iRemoteSessionSDPLines; |
|
117 delete iSIPContent; |
|
118 iMediaStreams.ResetAndDestroy(); |
|
119 iBundles.ResetAndDestroy(); |
|
120 iClientCryptoSuites.Close(); |
|
121 |
|
122 #ifdef MCE_COMMON_SERVER_SIDE |
|
123 |
|
124 DeleteSecureSession(); |
|
125 if ( iSdpSession ) |
|
126 { |
|
127 if( iSdpSession->DetachMedia( *this ) ) |
|
128 { |
|
129 iSdpSession = NULL; |
|
130 } |
|
131 } |
|
132 |
|
133 iMccStreams.ResetAndDestroy(); |
|
134 iMccAdoptedStreams.ResetAndDestroy(); |
|
135 delete iNegotiationState; |
|
136 #endif // MCE_COMMON_SERVER_SIDE |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CMceComSession::BaseFactory |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 TMceComFactory CMceComSession::BaseFactory() |
|
144 { |
|
145 return TMceComFactory(); |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CMceComSession::Factory |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 TMceComFactory CMceComSession::Factory() |
|
153 { |
|
154 return TMceComFactory(); |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CMceComSession::ConstructL |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CMceComSession::ConstructL() |
|
162 { |
|
163 |
|
164 iRecipient = KNullDesC8().AllocL(); |
|
165 iOriginator = KNullDesC8().AllocL(); |
|
166 iSIPHeaders = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
167 iSIPContentType = KNullDesC8().AllocL(); |
|
168 iSIPContentHeaders = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
169 iLocalSessionSDPLines = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
170 iRemoteSessionSDPLines = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
171 iIsSecureSession = EFalse; |
|
172 } |
|
173 |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CMceComSession::ConstructL |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 void CMceComSession::ConstructL( CMceComSession& aSession, TBool aPullModeUpdate ) |
|
180 { |
|
181 |
|
182 |
|
183 iID = aSession.iID; |
|
184 iRecipient = aSession.iRecipient ? |
|
185 aSession.iRecipient->AllocL() : KNullDesC8().AllocL(); |
|
186 iOriginator = aSession.iOriginator ? |
|
187 aSession.iOriginator->AllocL() : KNullDesC8().AllocL(); |
|
188 iSIPContentType = aSession.iSIPContentType ? |
|
189 aSession.iSIPContentType->AllocL() : KNullDesC8().AllocL(); |
|
190 iState = aSession.iState; |
|
191 iIsConnectionActive = aSession.iIsConnectionActive; |
|
192 iDialogId = aSession.iDialogId; |
|
193 iIapId = aSession.iIapId; |
|
194 iLocalIpAddress = aSession.iLocalIpAddress; |
|
195 iRemoteIpAddress = aSession.iRemoteIpAddress; |
|
196 iMediaObserver = aSession.iMediaObserver; |
|
197 iTimeout = aSession.iTimeout; |
|
198 iMinSE = aSession.iMinSE; |
|
199 iRefresh = aSession.iRefresh; |
|
200 iIsSecureSession = aSession.iIsSecureSession; |
|
201 iAnswerType = aSession.iAnswerType; |
|
202 |
|
203 iPullModeUpdate = aPullModeUpdate; |
|
204 |
|
205 iClientCryptoSuites.Reset(); |
|
206 for (TInt i=0; i<aSession.iClientCryptoSuites.Count(); i++) |
|
207 { |
|
208 iClientCryptoSuites.InsertL( aSession.iClientCryptoSuites[i], i); |
|
209 } |
|
210 |
|
211 iSIPHeaders = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
212 |
|
213 for( TInt i = 0;i<aSession.iSIPHeaders->MdcaCount();i++ ) |
|
214 { |
|
215 iSIPHeaders->AppendL( aSession.iSIPHeaders->MdcaPoint( i ) ); |
|
216 } |
|
217 |
|
218 iSIPContentHeaders = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
219 for( TInt i = 0;i<aSession.iSIPContentHeaders->MdcaCount();i++ ) |
|
220 { |
|
221 iSIPContentHeaders->AppendL( aSession.iSIPContentHeaders->MdcaPoint( i ) ); |
|
222 } |
|
223 |
|
224 iLocalSessionSDPLines = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
225 for( TInt i = 0; i < aSession.iLocalSessionSDPLines->MdcaCount(); i++ ) |
|
226 { |
|
227 iLocalSessionSDPLines->AppendL( aSession.iLocalSessionSDPLines->MdcaPoint( i ) ); |
|
228 } |
|
229 |
|
230 iRemoteSessionSDPLines = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
231 for( TInt i = 0; i < aSession.iRemoteSessionSDPLines->MdcaCount(); i++ ) |
|
232 { |
|
233 iRemoteSessionSDPLines->AppendL( aSession.iRemoteSessionSDPLines->MdcaPoint( i ) ); |
|
234 } |
|
235 |
|
236 for( TInt i = 0; i < KMceMaxSessionModifiers; i++ ) |
|
237 { |
|
238 iSessionModifiers[ i ] = aSession.iSessionModifiers[ i ]; |
|
239 } |
|
240 |
|
241 if ( !aPullModeUpdate ) |
|
242 { |
|
243 CloneStreamsL( aSession ); |
|
244 CloneBudlesL( aSession ); |
|
245 } |
|
246 |
|
247 iServiceType = aSession.iServiceType; |
|
248 iSipContactAddrSecure = aSession.iSipContactAddrSecure; |
|
249 |
|
250 #ifdef MCE_COMMON_SERVER_SIDE |
|
251 iSdpSession = aSession.iSdpSession; |
|
252 if (iClientCryptoSuites.Count()) |
|
253 { |
|
254 CloneSecureSessionL(aSession); |
|
255 } |
|
256 |
|
257 #endif//MCE_COMMON_SERVER_SIDE |
|
258 } |
|
259 |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // CMceComSession::CloneStreamsL |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 void CMceComSession::CloneStreamsL( CMceComSession& aSession ) |
|
266 { |
|
267 for( TInt i = 0; i<aSession.Streams().Count(); i++ ) |
|
268 { |
|
269 CMceComMediaStream* stream = aSession.Streams()[i]->CloneL(); |
|
270 CleanupStack::PushL( stream ); |
|
271 AddStreamL( stream ); |
|
272 CleanupStack::Pop( stream ); |
|
273 } |
|
274 } |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // CMceComSession::CloneBudlesL |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 void CMceComSession::CloneBudlesL( CMceComSession& aSession ) |
|
281 { |
|
282 for( TInt i = 0; i<aSession.Bundles().Count(); i++ ) |
|
283 { |
|
284 CMceComStreamBundle* bundle = aSession.Bundles()[i]->CloneL( Streams() ); |
|
285 CleanupStack::PushL( bundle ); |
|
286 AddBundleL( bundle ); |
|
287 CleanupStack::Pop( bundle ); |
|
288 } |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // CMceComSession::CloneL |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 CMceComSession* CMceComSession::CloneL( TBool aPullModeUpdate ) |
|
296 { |
|
297 CMceComSession* copy = new (ELeave) CMceComSession( iType ); |
|
298 CleanupStack::PushL( copy ); |
|
299 copy->ConstructL( *this, aPullModeUpdate ); |
|
300 copy->InitializeL(); |
|
301 CleanupStack::Pop( copy ); |
|
302 copy->iCloneOrigin = this; |
|
303 |
|
304 return copy; |
|
305 } |
|
306 |
|
307 |
|
308 // ----------------------------------------------------------------------------- |
|
309 // CMceComSession::AddStreamL |
|
310 // ----------------------------------------------------------------------------- |
|
311 // |
|
312 void CMceComSession::AddStreamL( CMceComMediaStream* aMediaStream ) |
|
313 { |
|
314 iMediaStreams.AppendL( aMediaStream ); |
|
315 } |
|
316 |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // CMceComSession::Streams |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 RPointerArray<CMceComMediaStream>& CMceComSession::Streams() |
|
323 { |
|
324 return iMediaStreams; |
|
325 } |
|
326 |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // CMceComSession::AddBundleL |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 void CMceComSession::AddBundleL( CMceComStreamBundle* aBundle ) |
|
333 { |
|
334 aBundle->AddedL(); |
|
335 iBundles.AppendL( aBundle ); |
|
336 } |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CMceComSession::RemoveBundleL |
|
340 // ----------------------------------------------------------------------------- |
|
341 // |
|
342 void CMceComSession::RemoveBundleL( CMceComStreamBundle& aBundle ) |
|
343 { |
|
344 TInt index = iBundles.Find( &aBundle ); |
|
345 User::LeaveIfError( index ); |
|
346 iBundles.Remove( index ); |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // CMceComSession::Bundles |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 const RPointerArray< CMceComStreamBundle >& CMceComSession::Bundles() const |
|
354 { |
|
355 return iBundles; |
|
356 } |
|
357 |
|
358 // ----------------------------------------------------------------------------- |
|
359 // CMceComSession::SetObserver |
|
360 // ----------------------------------------------------------------------------- |
|
361 // |
|
362 void CMceComSession::SetObserver( MMceMediaSessionObserver& aMediaObserver ) |
|
363 { |
|
364 iMediaObserver = &aMediaObserver; |
|
365 } |
|
366 |
|
367 // ----------------------------------------------------------------------------- |
|
368 // CMceComSession::SetObserver |
|
369 // ----------------------------------------------------------------------------- |
|
370 // |
|
371 MMceMediaSessionObserver& CMceComSession::MediaObserver() |
|
372 { |
|
373 return *iMediaObserver; |
|
374 } |
|
375 // ----------------------------------------------------------------------------- |
|
376 // CMceComSession::SetOriginatorL |
|
377 // ----------------------------------------------------------------------------- |
|
378 // |
|
379 void CMceComSession::SetOriginatorL( const TDesC8& aOriginator ) |
|
380 { |
|
381 delete iOriginator; |
|
382 iOriginator = NULL; |
|
383 iOriginator = aOriginator.AllocL(); |
|
384 } |
|
385 // ----------------------------------------------------------------------------- |
|
386 // CMceComSession::SetRecipientL |
|
387 // ----------------------------------------------------------------------------- |
|
388 // |
|
389 void CMceComSession::SetRecipientL( const TDesC8& aRecipient ) |
|
390 { |
|
391 delete iRecipient; |
|
392 iRecipient = NULL; |
|
393 iRecipient = aRecipient.AllocL(); |
|
394 } |
|
395 |
|
396 |
|
397 // ----------------------------------------------------------------------------- |
|
398 // CMceComSession::SerializationId |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 TUint64 CMceComSession::SerializationId() const |
|
402 { |
|
403 return _MAKE_TUINT64_ZX( iID ); |
|
404 } |
|
405 |
|
406 // ----------------------------------------------------------------------------- |
|
407 // CMceComSession::InternalizeFlatL |
|
408 // ----------------------------------------------------------------------------- |
|
409 // |
|
410 void CMceComSession::InternalizeFlatL( RReadStream& aReadStream ) |
|
411 { |
|
412 |
|
413 |
|
414 //iType |
|
415 iType = static_cast<TType>( aReadStream.ReadUint8L() ); |
|
416 |
|
417 //iID |
|
418 iID = aReadStream.ReadUint32L(); |
|
419 |
|
420 //iState |
|
421 iState = static_cast<CMceSession::TState>( aReadStream.ReadUint8L() ); |
|
422 |
|
423 //iRecipient |
|
424 MceSerial::DecodeL( iRecipient, aReadStream ); |
|
425 |
|
426 //iOriginator |
|
427 MceSerial::DecodeL( iOriginator, aReadStream ); |
|
428 |
|
429 //iIsConnectionActive |
|
430 iIsConnectionActive = static_cast<TBool>( aReadStream.ReadUint8L() ); |
|
431 |
|
432 //iDialogId |
|
433 iDialogId = aReadStream.ReadUint32L(); |
|
434 |
|
435 //iTimeout |
|
436 iTimeout = aReadStream.ReadUint32L(); |
|
437 |
|
438 // iMinSE |
|
439 iMinSE = aReadStream.ReadUint32L(); |
|
440 |
|
441 //iSIPHeaders |
|
442 MceSerial::DecodeL( iSIPHeaders, aReadStream ); |
|
443 |
|
444 //iSIPContentType |
|
445 MceSerial::DecodeL( iSIPContentType, aReadStream ); |
|
446 |
|
447 //iSIPContentHeaders |
|
448 MceSerial::DecodeL( iSIPContentHeaders, aReadStream ); |
|
449 |
|
450 //iLocalSessionSDPLines |
|
451 MceSerial::DecodeL( iLocalSessionSDPLines, aReadStream ); |
|
452 |
|
453 //iRemoteSessionSDPLines |
|
454 MceSerial::DecodeL( iRemoteSessionSDPLines, aReadStream ); |
|
455 |
|
456 //iSessionModifiers |
|
457 TPckgBuf<TMceComSessionModifiers> modifiers; |
|
458 MceSerial::DecodeL( modifiers, aReadStream ); |
|
459 iSessionModifiers = modifiers(); |
|
460 |
|
461 //check RArray |
|
462 |
|
463 MceSerial::DecodeL(iClientCryptoSuites, aReadStream); |
|
464 |
|
465 iServiceType = aReadStream.ReadUint32L(); |
|
466 iSipContactAddrSecure = |
|
467 static_cast<CMceSession::TControlPathSecurityLevel>( aReadStream.ReadUint8L() ); |
|
468 } |
|
469 |
|
470 |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // CMceComSession::ExternalizeFlatL |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 void CMceComSession::ExternalizeFlatL( RWriteStream& aWriteStream ) |
|
477 { |
|
478 aWriteStream.WriteUint8L( iType ); |
|
479 aWriteStream.WriteUint32L( iID ); |
|
480 aWriteStream.WriteUint8L( iState ); |
|
481 MceSerial::EncodeL( iRecipient, aWriteStream ); |
|
482 MceSerial::EncodeL( iOriginator, aWriteStream ); |
|
483 aWriteStream.WriteUint8L( iIsConnectionActive ); |
|
484 aWriteStream.WriteUint32L( iDialogId ); |
|
485 aWriteStream.WriteUint32L( iTimeout ); |
|
486 aWriteStream.WriteUint32L( iMinSE ); |
|
487 MceSerial::EncodeL( iSIPHeaders, aWriteStream ); |
|
488 MceSerial::EncodeL( iSIPContentType, aWriteStream ); |
|
489 MceSerial::EncodeL( iSIPContentHeaders, aWriteStream ); |
|
490 MceSerial::EncodeL( iLocalSessionSDPLines, aWriteStream ); |
|
491 MceSerial::EncodeL( iRemoteSessionSDPLines, aWriteStream ); |
|
492 TPckgBuf<TMceComSessionModifiers> modifiers( iSessionModifiers ); |
|
493 MceSerial::EncodeL( modifiers, aWriteStream ); |
|
494 MceSerial::EncodeL(iClientCryptoSuites, aWriteStream); |
|
495 aWriteStream.WriteUint32L( iServiceType ); |
|
496 aWriteStream.WriteUint8L( iSipContactAddrSecure ); |
|
497 } |
|
498 |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // CMceComSession::InternalizeL |
|
502 // ----------------------------------------------------------------------------- |
|
503 // |
|
504 void CMceComSession::InternalizeL( MMceComSerializationContext& aSerCtx ) |
|
505 { |
|
506 TMceSessionSerializer<CMceComSession> serial( *this ); |
|
507 serial.InternalizeL( aSerCtx ); |
|
508 } |
|
509 |
|
510 // ----------------------------------------------------------------------------- |
|
511 // CMceComSession::InternalizeL |
|
512 // ----------------------------------------------------------------------------- |
|
513 // |
|
514 void CMceComSession::ExternalizeL( MMceComSerializationContext& aSerCtx ) |
|
515 { |
|
516 TMceSessionSerializer<CMceComSession> serial( *this ); |
|
517 serial.ExternalizeL( aSerCtx ); |
|
518 } |
|
519 |
|
520 |
|
521 // ----------------------------------------------------------------------------- |
|
522 // CMceComSession::CMceComSession |
|
523 // ----------------------------------------------------------------------------- |
|
524 // |
|
525 CMceComSession::CMceComSession() |
|
526 : iID( KMceNotAssigned ), |
|
527 iType( EInSession ), |
|
528 iState( CMceSession::EIncoming ), |
|
529 iRecipient( NULL ), |
|
530 iOriginator( NULL ), |
|
531 iIsConnectionActive( ETrue ), |
|
532 iMccID( KMceNotAssigned ), |
|
533 iStructureChanged( EFalse ), |
|
534 iUseLocalPreconditions( EFalse ), |
|
535 iUseRemotePreconditions( EFalse ), |
|
536 iFcSignallingRequired( EFalse ), |
|
537 iRequireSignalling( EFalse ), |
|
538 iServiceType( KMceDefaultTypeOfServiceValue ), |
|
539 iAnswerType( KMceNegotiationAnswerTypeNotDefined ), |
|
540 iCodecSelection( KMceCodecSelectionOff ), |
|
541 iRemoteSecPreconditionsRequired( EFalse ), |
|
542 iTimeout( 0 ), |
|
543 iMinSE( 0 ) |
|
544 { |
|
545 for( TInt i = 0;i<KMceMaxSessionModifiers;i++ ) |
|
546 { |
|
547 iSessionModifiers[ i ] = KMaxTUint16; |
|
548 } |
|
549 Modifier( KMcePreconditions ) = KMcePreconditionsSupported; |
|
550 Modifier( KMce100Rel ) = KMce100RelSupported; |
|
551 Modifier( KMceMediaDirection ) = KMceMediaDirectionOnly; |
|
552 } |
|
553 |
|
554 // ----------------------------------------------------------------------------- |
|
555 // CMceComSession::CMceComSession |
|
556 // ----------------------------------------------------------------------------- |
|
557 // |
|
558 CMceComSession::CMceComSession( CMceComSession::TType aType ) |
|
559 : iID( KMceNotAssigned ), |
|
560 iType( aType ), |
|
561 iState( CMceSession::EIdle ), |
|
562 iRecipient( NULL ), |
|
563 iOriginator( NULL ), |
|
564 iIsConnectionActive( ETrue ), |
|
565 iMccID( KMceNotAssigned ), |
|
566 iServiceType( KMceDefaultTypeOfServiceValue ), |
|
567 iTimeout( 0 ), |
|
568 iMinSE( 0 ) |
|
569 { |
|
570 if ( iType == EInSession ) |
|
571 { |
|
572 iState = CMceSession::EIncoming; |
|
573 } |
|
574 for( TInt i = 0;i<KMceMaxSessionModifiers;i++ ) |
|
575 { |
|
576 iSessionModifiers[ i ] = KMaxTUint16; |
|
577 } |
|
578 Modifier( KMcePreconditions ) = KMcePreconditionsSupported; |
|
579 Modifier( KMce100Rel ) = KMce100RelSupported; |
|
580 Modifier( KMceMediaDirection ) = KMceMediaDirectionOnly; |
|
581 } |
|
582 |
|
583 // ----------------------------------------------------------------------------- |
|
584 // CMceComSession::Id |
|
585 // ----------------------------------------------------------------------------- |
|
586 // |
|
587 TUint32 CMceComSession::Id() const |
|
588 { |
|
589 return iID; |
|
590 } |
|
591 |
|
592 |
|
593 // ----------------------------------------------------------------------------- |
|
594 // CMceComSession::IsStructureChanged |
|
595 // ----------------------------------------------------------------------------- |
|
596 // |
|
597 TBool& CMceComSession::IsStructureChanged() |
|
598 { |
|
599 return iStructureChanged; |
|
600 } |
|
601 |
|
602 |
|
603 // ----------------------------------------------------------------------------- |
|
604 // CMceComSession::EventReceivedL |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 void CMceComSession::EventReceivedL( TMceComEvent& aEvent ) |
|
608 { |
|
609 |
|
610 __ASSERT_ALWAYS( aEvent.Id().iSessionID == iID, User::Leave( KErrGeneral ) ); |
|
611 |
|
612 if ( aEvent.Id().IsSessionId() ) |
|
613 { |
|
614 if ( aEvent.Action() == EMceItcUpdate ) |
|
615 { |
|
616 CMceComSession* updateSession = static_cast<CMceComSession*>( aEvent.Message() ); |
|
617 UpdateL( *updateSession ); |
|
618 } |
|
619 else |
|
620 { |
|
621 User::Leave( KErrGeneral ); |
|
622 } |
|
623 } |
|
624 else |
|
625 { |
|
626 TInt j = 0; |
|
627 TInt status = KMceEventNotConsumed; |
|
628 while ( status != KMceEventConsumed && j < iMediaStreams.Count() ) |
|
629 { |
|
630 CMceComMediaStream* stream = iMediaStreams[j]; |
|
631 status = stream->EventReceivedL( aEvent ); |
|
632 j++; |
|
633 } |
|
634 |
|
635 } |
|
636 |
|
637 |
|
638 } |
|
639 |
|
640 |
|
641 |
|
642 // ----------------------------------------------------------------------------- |
|
643 // CMceComSession::InitializeL |
|
644 // ----------------------------------------------------------------------------- |
|
645 // |
|
646 |
|
647 void CMceComSession::InitializeL() |
|
648 { |
|
649 for( int i = 0; i < Streams().Count(); i++ ) |
|
650 { |
|
651 Streams()[i]->InitializeL( *this ); |
|
652 } |
|
653 for( int i = 0; i < Bundles().Count(); i++ ) |
|
654 { |
|
655 Bundles()[i]->InitializeL( *this ); |
|
656 } |
|
657 |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CMceComSession::UpdateL |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 void CMceComSession::UpdateL( CMceComSession& aSession ) |
|
665 { |
|
666 |
|
667 IsStructureChanged() = EFalse; |
|
668 |
|
669 UpdateFlatL( aSession ); |
|
670 |
|
671 delete iSIPHeaders; |
|
672 iSIPHeaders = aSession.iSIPHeaders; |
|
673 aSession.iSIPHeaders = NULL; |
|
674 |
|
675 delete iSIPContentType; |
|
676 iSIPContentType = aSession.iSIPContentType; |
|
677 aSession.iSIPContentType = NULL; |
|
678 |
|
679 delete iSIPContentHeaders; |
|
680 iSIPContentHeaders = aSession.iSIPContentHeaders; |
|
681 aSession.iSIPContentHeaders = NULL; |
|
682 |
|
683 delete iLocalSessionSDPLines; |
|
684 iLocalSessionSDPLines = aSession.iLocalSessionSDPLines; |
|
685 aSession.iLocalSessionSDPLines = NULL; |
|
686 |
|
687 UpdateStreamsL( aSession ); |
|
688 InitializeL(); |
|
689 |
|
690 } |
|
691 |
|
692 |
|
693 // --------------------------------------------------------- |
|
694 // CMceComSession::UpdateFlatL |
|
695 // --------------------------------------------------------- |
|
696 void CMceComSession::UpdateFlatL( CMceComSession& aSession ) |
|
697 { |
|
698 |
|
699 iType = aSession.iType; |
|
700 iID = aSession.iID; |
|
701 iState = aSession.iState; |
|
702 |
|
703 delete iRecipient; |
|
704 iRecipient = aSession.iRecipient; |
|
705 aSession.iRecipient = NULL; |
|
706 |
|
707 delete iOriginator; |
|
708 iOriginator = aSession.iOriginator; |
|
709 aSession.iOriginator = NULL; |
|
710 |
|
711 iIsConnectionActive = aSession.iIsConnectionActive; |
|
712 iTimeout = aSession.iTimeout; |
|
713 iMinSE = aSession.iMinSE; |
|
714 |
|
715 delete iRemoteSessionSDPLines; |
|
716 iRemoteSessionSDPLines = aSession.iRemoteSessionSDPLines; |
|
717 aSession.iRemoteSessionSDPLines = NULL; |
|
718 |
|
719 iSessionModifiers = aSession.iSessionModifiers; |
|
720 |
|
721 iIsSecureSession=aSession.iIsSecureSession; |
|
722 iClientCryptoSuites.Reset(); |
|
723 for (TInt i=0; i<aSession.iClientCryptoSuites.Count(); i++) |
|
724 { |
|
725 iClientCryptoSuites.InsertL( aSession.iClientCryptoSuites[i], i); |
|
726 } |
|
727 iServiceType = aSession.iServiceType; |
|
728 iSipContactAddrSecure = aSession.iSipContactAddrSecure; |
|
729 } |
|
730 |
|
731 // --------------------------------------------------------- |
|
732 // CMceComSession::UpdateStreamsL |
|
733 // --------------------------------------------------------- |
|
734 void CMceComSession::UpdateStreamsL( CMceComSession& aSession ) |
|
735 { |
|
736 RPointerArray<CMceComMediaStream> updated; |
|
737 MceCleanupResetAndDestroyPushL( updated ); |
|
738 TInt push = 0; |
|
739 |
|
740 TInt i = 0; |
|
741 for( i = 0; i < aSession.Streams().Count(); i++ ) |
|
742 { |
|
743 CMceComMediaStream* update = aSession.Streams()[i]; |
|
744 |
|
745 TBool isUpdated = EFalse; |
|
746 TInt j = 0; |
|
747 while( !isUpdated && j < Streams().Count() ) |
|
748 { |
|
749 CMceComMediaStream* stream = Streams()[j]; |
|
750 |
|
751 if ( stream->Id() == update->Id() ) |
|
752 { |
|
753 stream->UpdateL( *update ); |
|
754 aSession.Streams().Remove( i ); |
|
755 CleanupStack::PushL( update ); |
|
756 push++; |
|
757 updated.AppendL( stream ); |
|
758 Streams().Remove( j ); |
|
759 i--; |
|
760 isUpdated = ETrue; |
|
761 } |
|
762 j++; |
|
763 } |
|
764 } |
|
765 |
|
766 if ( Streams().Count() > 0 )//streams have been removed |
|
767 { |
|
768 IsStructureChanged() = ETrue; |
|
769 } |
|
770 |
|
771 UpdateBundlesL( aSession, updated ); |
|
772 |
|
773 if ( push ) |
|
774 { |
|
775 CleanupStack::PopAndDestroy( push ); |
|
776 } |
|
777 |
|
778 iMediaStreams.ResetAndDestroy(); |
|
779 while( updated.Count() > 0 ) |
|
780 { |
|
781 AddStreamL( updated[0] ); |
|
782 updated.Remove( 0 ); |
|
783 } |
|
784 |
|
785 CleanupStack::PopAndDestroy();//updated |
|
786 |
|
787 if ( aSession.Streams().Count() > 0 )//streams have been added |
|
788 { |
|
789 IsStructureChanged() = ETrue; |
|
790 |
|
791 while( aSession.Streams().Count() > 0 ) |
|
792 { |
|
793 IsStructureChanged() = ETrue; |
|
794 CMceComMediaStream* add = aSession.Streams()[0]; |
|
795 AddStreamL( add ); |
|
796 aSession.Streams().Remove( 0 ); |
|
797 } |
|
798 } |
|
799 |
|
800 } |
|
801 |
|
802 // --------------------------------------------------------- |
|
803 // CMceComSession::UpdateBundlesL |
|
804 // --------------------------------------------------------- |
|
805 void CMceComSession::UpdateBundlesL( CMceComSession& aSession, |
|
806 const RPointerArray<CMceComMediaStream>& aStreams ) |
|
807 { |
|
808 |
|
809 iBundles.ResetAndDestroy(); |
|
810 |
|
811 TInt i = 0; |
|
812 for( i = 0; i < aSession.Bundles().Count(); i++ ) |
|
813 { |
|
814 CMceComStreamBundle* update = aSession.Bundles()[i]; |
|
815 CMceComStreamBundle* bundle = update->CloneL( aStreams ); |
|
816 CleanupStack::PushL( bundle ); |
|
817 bundle->UpdateL( *update ); |
|
818 AddBundleL( bundle ); |
|
819 CleanupStack::Pop( bundle ); |
|
820 } |
|
821 } |
|
822 |
|
823 |
|
824 // --------------------------------------------------------- |
|
825 // CMceComSession::Modifier |
|
826 // --------------------------------------------------------- |
|
827 // |
|
828 TUint& CMceComSession::Modifier( TMceSessionModifier aModifier ) |
|
829 { |
|
830 return iSessionModifiers[ (TInt) aModifier ]; |
|
831 } |
|
832 |
|
833 // --------------------------------------------------------- |
|
834 // CMceComSession::UseRtcp |
|
835 // --------------------------------------------------------- |
|
836 // |
|
837 TBool CMceComSession::UseRtcp() const |
|
838 { |
|
839 TBool useRtcp( ETrue ); |
|
840 for( TInt i=0; i < iMediaStreams.Count() && useRtcp; i++ ) |
|
841 { |
|
842 useRtcp = iMediaStreams[i]->UseRtcp(); |
|
843 } |
|
844 return useRtcp; |
|
845 } |
|
846 |
|
847 #ifdef MCE_COMMON_SERVER_SIDE |
|
848 |
|
849 // --------------------------------------------------------- |
|
850 // CMceComSession::Delete |
|
851 // --------------------------------------------------------- |
|
852 // |
|
853 void CMceComSession::Delete( CMceComSession*& aThis, |
|
854 CMceMediaManager& aManager ) |
|
855 { |
|
856 if( aThis ) |
|
857 { |
|
858 aManager.CloseSession( *aThis ); |
|
859 |
|
860 aThis->iMccStreams.ResetAndDestroy(); |
|
861 aThis->iMccAdoptedStreams.ResetAndDestroy(); |
|
862 delete aThis->iNegotiationState; |
|
863 aThis->iNegotiationState = NULL; |
|
864 |
|
865 delete aThis; |
|
866 aThis = NULL; |
|
867 } |
|
868 } |
|
869 |
|
870 |
|
871 // --------------------------------------------------------- |
|
872 // CMceComSession::SdpSession |
|
873 // --------------------------------------------------------- |
|
874 CMceSdpSession& CMceComSession::SdpSession() const |
|
875 { |
|
876 return *iSdpSession; |
|
877 } |
|
878 |
|
879 |
|
880 // ----------------------------------------------------------------------------- |
|
881 // CMceComSession::Backup |
|
882 // ----------------------------------------------------------------------------- |
|
883 // |
|
884 CMceComSession* CMceComSession::Backup() |
|
885 { |
|
886 CMceComSession* backup = NULL; |
|
887 |
|
888 if ( iSdpSession ) |
|
889 { |
|
890 backup = SdpSession().Backup(); |
|
891 } |
|
892 |
|
893 return backup; |
|
894 |
|
895 } |
|
896 |
|
897 |
|
898 // ----------------------------------------------------------------------------- |
|
899 // CMceComSession::IsBackup |
|
900 // ----------------------------------------------------------------------------- |
|
901 // |
|
902 TBool CMceComSession::IsBackup() |
|
903 { |
|
904 CMceComSession* backup = Backup(); |
|
905 |
|
906 return this == backup; |
|
907 |
|
908 } |
|
909 |
|
910 |
|
911 // ----------------------------------------------------------------------------- |
|
912 // CMceComSession::IsMerged |
|
913 // ----------------------------------------------------------------------------- |
|
914 // |
|
915 TBool CMceComSession::IsMerged() |
|
916 { |
|
917 TBool isMerged = EFalse; |
|
918 |
|
919 if ( Backup() ) |
|
920 { |
|
921 isMerged = SdpSession().MediaSession()->iMccID == |
|
922 SdpSession().Backup()->iMccID; |
|
923 } |
|
924 |
|
925 return isMerged; |
|
926 |
|
927 } |
|
928 |
|
929 |
|
930 |
|
931 // --------------------------------------------------------- |
|
932 // CMceComSession::AnswerType |
|
933 // --------------------------------------------------------- |
|
934 TMceNegotiationAnswerType& CMceComSession::AnswerType() |
|
935 { |
|
936 return iAnswerType; |
|
937 } |
|
938 |
|
939 |
|
940 |
|
941 // --------------------------------------------------------- |
|
942 // CMceComSession::AttachSDPSessionL |
|
943 // --------------------------------------------------------- |
|
944 void CMceComSession::AttachSDPSessionL( CMceSdpSession& aSdpSession ) |
|
945 { |
|
946 TMceMediaState* state = NULL; |
|
947 |
|
948 iSdpSession = &aSdpSession; |
|
949 |
|
950 if ( iCloneOrigin && !iNegotiationState ) |
|
951 { |
|
952 __ASSERT_ALWAYS( |
|
953 iCloneOrigin->NegotiationState().Id() == KMceMediaNegotiated, |
|
954 User::Leave( KErrArgument ) ); |
|
955 |
|
956 __ASSERT_ALWAYS( iCloneOrigin == aSdpSession.MediaSession(), |
|
957 User::Leave( KErrArgument ) ); |
|
958 |
|
959 //set negotiated state |
|
960 state = new (ELeave) TMceMediaNegotiated( *this ); |
|
961 SetNegotiationState( state ); |
|
962 |
|
963 aSdpSession.SetBackup( iCloneOrigin ); |
|
964 iCloneOrigin = NULL; |
|
965 |
|
966 } |
|
967 else if ( !iNegotiationState ) |
|
968 { |
|
969 //set idle state |
|
970 state = new (ELeave) TMceMediaIdle( *this ); |
|
971 SetNegotiationState( state ); |
|
972 } |
|
973 else |
|
974 { |
|
975 //NOP |
|
976 } |
|
977 |
|
978 aSdpSession.SetMediaSession( this ); |
|
979 |
|
980 } |
|
981 |
|
982 // --------------------------------------------------------- |
|
983 // CMceComSession::DetachSDPSession |
|
984 // --------------------------------------------------------- |
|
985 void CMceComSession::DetachSDPSession() |
|
986 { |
|
987 iSdpSession = NULL; |
|
988 } |
|
989 |
|
990 |
|
991 // --------------------------------------------------------- |
|
992 // CMceComSession::NegotiationState |
|
993 // --------------------------------------------------------- |
|
994 TMceMediaState& CMceComSession::NegotiationState() const |
|
995 { |
|
996 return *iNegotiationState; |
|
997 } |
|
998 |
|
999 |
|
1000 // --------------------------------------------------------- |
|
1001 // CMceComSession::SetNegotiationStateL |
|
1002 // --------------------------------------------------------- |
|
1003 TMceMMState CMceComSession::SetNegotiationStateL( TMceMediaState* aNewState ) |
|
1004 { |
|
1005 |
|
1006 __ASSERT_ALWAYS( aNewState != NULL, User::Leave( KErrArgument ) ); |
|
1007 __ASSERT_ALWAYS( aNewState != iNegotiationState, User::Leave( KErrArgument ) ); |
|
1008 |
|
1009 TBool callbackAllowed = EFalse; |
|
1010 if ( iNegotiationState ) |
|
1011 { |
|
1012 iNegotiationState->Pushed(); |
|
1013 TInt oldIndex = iNegotiationState->StackIndex(); |
|
1014 callbackAllowed = aNewState->CallbackAllowed(); |
|
1015 aNewState->EntryL(); |
|
1016 TInt newIndex = iNegotiationState->StackIndex(); |
|
1017 if ( oldIndex == newIndex ) //EntryL didn't push |
|
1018 { |
|
1019 SetNegotiationState( aNewState ); |
|
1020 } |
|
1021 else if ( iNegotiationState->StackIndex() == 0 ) //new state is transitional |
|
1022 { |
|
1023 delete aNewState; |
|
1024 aNewState = NULL; |
|
1025 } |
|
1026 |
|
1027 if ( callbackAllowed && iNegotiationState == aNewState ) |
|
1028 { |
|
1029 iNegotiationState->Callback(); |
|
1030 } |
|
1031 |
|
1032 } |
|
1033 else |
|
1034 { |
|
1035 SetNegotiationState( aNewState ); |
|
1036 } |
|
1037 |
|
1038 |
|
1039 return iNegotiationState->Id(); |
|
1040 |
|
1041 } |
|
1042 |
|
1043 |
|
1044 // ----------------------------------------------------------------------------- |
|
1045 // CMceComSession::SetNegotiationState |
|
1046 // ----------------------------------------------------------------------------- |
|
1047 // |
|
1048 void CMceComSession::SetNegotiationState( TMceMediaState* aNewState ) |
|
1049 { |
|
1050 delete iNegotiationState; |
|
1051 iNegotiationState = aNewState; |
|
1052 } |
|
1053 |
|
1054 |
|
1055 // ----------------------------------------------------------------------------- |
|
1056 // CMceComSession::CloneAndMergeL |
|
1057 // ----------------------------------------------------------------------------- |
|
1058 // |
|
1059 CMceComSession* CMceComSession::CloneAndMergeLC( CMceComSession& aSession ) |
|
1060 { |
|
1061 |
|
1062 CMceComSession* copy = new (ELeave) CMceComSession( iType ); |
|
1063 CleanupStack::PushL( copy ); |
|
1064 copy->ConstructL( *this ); |
|
1065 copy->InitializeL(); |
|
1066 |
|
1067 TMceMediaState* state = |
|
1068 aSession.NegotiationState().CloneL( *copy ); |
|
1069 copy->SetNegotiationState( state ); |
|
1070 |
|
1071 copy->iUseLocalPreconditions = aSession.iUseLocalPreconditions; |
|
1072 copy->iUseRemotePreconditions = aSession.iUseRemotePreconditions; |
|
1073 copy->iFcSignallingRequired = aSession.iFcSignallingRequired; |
|
1074 copy->iRequireSignalling = aSession.iRequireSignalling; |
|
1075 copy->iServiceType = aSession.iServiceType; |
|
1076 copy->iAnswerType = aSession.iAnswerType; |
|
1077 copy->iRemoteSecPreconditionsRequired = aSession.iRemoteSecPreconditionsRequired; |
|
1078 |
|
1079 TInt index = 0; |
|
1080 for( index = 0; index < copy->Streams().Count(); index++ ) |
|
1081 { |
|
1082 TBool dges = aSession.Streams()[ index ]->DowngradedEndpoints(); |
|
1083 copy->Streams()[ index ]->DowngradedEndpoints() = dges; |
|
1084 } |
|
1085 |
|
1086 copy->PrepareL( aSession.SdpSession().Manager() ); |
|
1087 |
|
1088 |
|
1089 |
|
1090 return copy; |
|
1091 |
|
1092 } |
|
1093 |
|
1094 |
|
1095 // ----------------------------------------------------------------------------- |
|
1096 // CMceComSession::PrepareL |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // |
|
1099 void CMceComSession::PrepareL( CMceMediaManager& aManager ) |
|
1100 |
|
1101 { |
|
1102 TInt i = 0; |
|
1103 MccStreams().ResetAndDestroy(); |
|
1104 for ( i = 0; i < iMediaStreams.Count(); i++) |
|
1105 { |
|
1106 CMceSrvStream::DecodeL( MccStreams(), *iMediaStreams[i], aManager ); |
|
1107 } |
|
1108 } |
|
1109 |
|
1110 |
|
1111 // ----------------------------------------------------------------------------- |
|
1112 // CMceComSession::AdoptStreamL |
|
1113 // ----------------------------------------------------------------------------- |
|
1114 // |
|
1115 void CMceComSession::AdoptStreamL( CMceSrvStream& aStream ) |
|
1116 { |
|
1117 |
|
1118 CMceSrvStream* adopted = CMceAdoptedSrvStream::NewL( aStream ); |
|
1119 CleanupStack::PushL( adopted ); |
|
1120 iMccAdoptedStreams.AppendL( adopted ); |
|
1121 CleanupStack::Pop( adopted ); |
|
1122 |
|
1123 } |
|
1124 |
|
1125 |
|
1126 // ----------------------------------------------------------------------------- |
|
1127 // CMceComSession::RemoveAdoptedStream |
|
1128 // ----------------------------------------------------------------------------- |
|
1129 // |
|
1130 CMceSrvStream* CMceComSession::RemoveAdoptedStream( CMceSrvStream& aStream ) |
|
1131 { |
|
1132 |
|
1133 TMceSrvStreamIterator adopts( AdoptedMccStreams() ); |
|
1134 CMceSrvStream* adopted = NULL; |
|
1135 |
|
1136 if ( adopts.Next( adopted, aStream ) ) |
|
1137 { |
|
1138 AdoptedMccStreams().Remove( adopts.Current() ); |
|
1139 } |
|
1140 return adopted; |
|
1141 |
|
1142 } |
|
1143 |
|
1144 |
|
1145 |
|
1146 // ----------------------------------------------------------------------------- |
|
1147 // CMceComSession::Merge |
|
1148 // ----------------------------------------------------------------------------- |
|
1149 // |
|
1150 void CMceComSession::Merge( CMceComSession& aSession, TBool aDeepMerge ) |
|
1151 { |
|
1152 |
|
1153 iMccID = aSession.iMccID; |
|
1154 |
|
1155 TMceSrvStreamIterator mergeStreams( MccStreams() ); |
|
1156 TMceSrvStreamIterator mergeWithStreams( aSession.MccStreams() ); |
|
1157 |
|
1158 CMceSrvStream* merge = NULL; |
|
1159 CMceSrvStream* mergeWith = NULL; |
|
1160 |
|
1161 while( mergeStreams.NextIntersect( merge, mergeWithStreams, mergeWith ) ) |
|
1162 { |
|
1163 merge->Merge( *mergeWith, aDeepMerge ); |
|
1164 } |
|
1165 |
|
1166 TInt index = 0; |
|
1167 for( index = 0; index < Streams().Count(); index++ ) |
|
1168 { |
|
1169 Streams()[ index ]->DowngradedEndpoints() = EFalse; |
|
1170 } |
|
1171 for( index = 0; index < aSession.Streams().Count(); index++ ) |
|
1172 { |
|
1173 aSession.Streams()[ index ]->DowngradedEndpoints() = EFalse; |
|
1174 } |
|
1175 |
|
1176 } |
|
1177 |
|
1178 // ----------------------------------------------------------------------------- |
|
1179 // CMceComSession::UnMerge |
|
1180 // ----------------------------------------------------------------------------- |
|
1181 // |
|
1182 void CMceComSession::UnMerge() |
|
1183 { |
|
1184 |
|
1185 TMceSrvStreamIterator streams( MccStreams() ); |
|
1186 CMceSrvStream* stream = NULL; |
|
1187 |
|
1188 while( streams.Next( stream ) ) |
|
1189 { |
|
1190 stream->UnMerge(); |
|
1191 } |
|
1192 |
|
1193 } |
|
1194 |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // CMceComSession::UnMergeL |
|
1197 // ----------------------------------------------------------------------------- |
|
1198 // |
|
1199 void CMceComSession::UnMergeL( CMceComSession& aSession ) |
|
1200 { |
|
1201 TMceSrvStreamIterator unmergeStreams( MccStreams() ); |
|
1202 TMceSrvStreamIterator unmergeFromStreams( aSession.MccStreams() ); |
|
1203 |
|
1204 CMceSrvStream* stream = NULL; |
|
1205 CMceSrvStream* unmergeFrom = NULL; |
|
1206 |
|
1207 while( unmergeStreams.NextIntersect( stream, unmergeFromStreams, unmergeFrom ) ) |
|
1208 { |
|
1209 stream->UnMergeL( *unmergeFrom ); |
|
1210 } |
|
1211 |
|
1212 } |
|
1213 |
|
1214 |
|
1215 // ----------------------------------------------------------------------------- |
|
1216 // CMceComSession::PrepareL |
|
1217 // ----------------------------------------------------------------------------- |
|
1218 // |
|
1219 void CMceComSession::PrepareL() |
|
1220 { |
|
1221 TInt i = 0; |
|
1222 for ( i = 0; i < iMediaStreams.Count(); i++) |
|
1223 { |
|
1224 iMediaStreams[i]->PrepareL(); |
|
1225 } |
|
1226 } |
|
1227 |
|
1228 |
|
1229 // ----------------------------------------------------------------------------- |
|
1230 // CMceComSession::MccStreams |
|
1231 // ----------------------------------------------------------------------------- |
|
1232 // |
|
1233 RPointerArray<CMceSrvStream>& CMceComSession::MccStreams() |
|
1234 { |
|
1235 return iMccStreams; |
|
1236 } |
|
1237 |
|
1238 // ----------------------------------------------------------------------------- |
|
1239 // CMceComSession::AdoptedMccStreams |
|
1240 // ----------------------------------------------------------------------------- |
|
1241 // |
|
1242 RPointerArray<CMceSrvStream>& CMceComSession::AdoptedMccStreams() |
|
1243 { |
|
1244 return iMccAdoptedStreams; |
|
1245 } |
|
1246 |
|
1247 |
|
1248 // ------------------------------------------------------------------------------ |
|
1249 // CMceComSession::SecureSessionL |
|
1250 // ------------------------------------------------------------------------------ |
|
1251 CMceSecureMediaSession& CMceComSession::SecureSessionL() |
|
1252 { |
|
1253 if ( !SecureSession() ) |
|
1254 { |
|
1255 iSecureMediaSession = CMceSecureMediaSession::NewL( *this, |
|
1256 SdpSession().iManager, |
|
1257 *(SdpSession().iManager.iMccSecureInterface ) ); |
|
1258 } |
|
1259 return *SecureSession(); |
|
1260 } |
|
1261 |
|
1262 |
|
1263 // ------------------------------------------------------------------------------ |
|
1264 // CMceComSession::SecureSession() |
|
1265 // ------------------------------------------------------------------------------ |
|
1266 CMceSecureMediaSession* CMceComSession::SecureSession() |
|
1267 { |
|
1268 return iSecureMediaSession; |
|
1269 } |
|
1270 |
|
1271 // -------------------------------------------------------------------------------------- |
|
1272 // CMceComSession::CloneSecureSessionL() |
|
1273 // -------------------------------------------------------------------------------------- |
|
1274 void CMceComSession::CloneSecureSessionL(CMceComSession& aSession) |
|
1275 { |
|
1276 CMceSecureMediaSession* secureMediaSession = CMceSecureMediaSession::NewL(*this, |
|
1277 aSession.SdpSession().iManager, |
|
1278 *(aSession.SdpSession().iManager.iMccSecureInterface)); |
|
1279 CleanupStack::PushL(secureMediaSession); |
|
1280 |
|
1281 secureMediaSession->CopyStreamsL( *aSession.SecureSession()); |
|
1282 CleanupStack::Pop(secureMediaSession); |
|
1283 |
|
1284 delete iSecureMediaSession; |
|
1285 |
|
1286 iSecureMediaSession = secureMediaSession; |
|
1287 } |
|
1288 |
|
1289 // -------------------------------------------------------------------------------------- |
|
1290 // CMceComSession::DeleteSecureSession() |
|
1291 // -------------------------------------------------------------------------------------- |
|
1292 void CMceComSession::DeleteSecureSession() |
|
1293 { |
|
1294 delete iSecureMediaSession; |
|
1295 iSecureMediaSession = NULL; |
|
1296 } |
|
1297 |
|
1298 // -------------------------------------------------------------------------------------- |
|
1299 // CMceComSession::SdpCleanup() |
|
1300 // -------------------------------------------------------------------------------------- |
|
1301 void CMceComSession::SdpCleanup( CSdpDocument* aPrevious, CSdpDocument* aReplacement ) |
|
1302 { |
|
1303 if ( iSdpSession ) |
|
1304 { |
|
1305 iSdpSession->SdpCleanup( aPrevious, aReplacement ); |
|
1306 } |
|
1307 |
|
1308 if ( Backup() && &Backup()->SdpSession() ) |
|
1309 { |
|
1310 Backup()->SdpSession().SdpCleanup( aPrevious, aReplacement ); |
|
1311 } |
|
1312 } |
|
1313 |
|
1314 |
|
1315 #endif//MCE_COMMON_SERVER_SIDE |