|
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 <e32math.h> |
|
22 #include <sipinvitedialogassoc.h> |
|
23 #include <sipfromheader.h> |
|
24 #include <siptoheader.h> |
|
25 #include <sipcontenttypeheader.h> |
|
26 #include <sipextensionheader.h> |
|
27 #include <sipaddress.h> |
|
28 #include <sipprofile.h> |
|
29 #include <sipmessageelements.h> |
|
30 #include <sipsupportedheader.h> |
|
31 #include <siprequireheader.h> |
|
32 #include <sdpdocument.h> |
|
33 #include <siprseqheader.h> |
|
34 #include "mceactionset.h" |
|
35 #include "mcecssession.h" |
|
36 #include "mcecssessionimplementation.h" |
|
37 #include "mcecomsession.h" |
|
38 #include "mcecomrtpsink.h" |
|
39 #include "mcecomrtpsource.h" |
|
40 #include "mcecomspeakersink.h" |
|
41 #include "mcecomfilesource.h" |
|
42 #include "mcecommicsource.h" |
|
43 #include "mcesipsession.h" |
|
44 #include "mcemediamanager.h" |
|
45 #include "mcesipconnection.h" |
|
46 #include "mcesipextensions.h" |
|
47 #include "mcesip.h" |
|
48 #include "mcesrvlogs.h" |
|
49 #include "mcetimermanager.h" |
|
50 #include "mcereliablesender.h" |
|
51 #include "mcecomcamerasource.h" |
|
52 |
|
53 const TInt KMaxLengthOfSDPMessage = 1000; |
|
54 const TInt KMaxLengthOfSessionExpires = 40; |
|
55 |
|
56 #define MCE_HANDLER_WRITE( aType, aData )\ |
|
57 aType writeBuf( aData );\ |
|
58 iWriteData->Copy( writeBuf ); |
|
59 |
|
60 #define MCE_HANDLER_READ_DATA( aCastType, aType, aData, aBuffer )\ |
|
61 aCastType readBuf;\ |
|
62 readBuf.Copy( *aBuffer );\ |
|
63 aType aData = readBuf(); |
|
64 #define MCE_HANDLER_READ( aCastType, aType, aData )\ |
|
65 MCE_HANDLER_READ_DATA( aCastType, aType, aData, iReadData ) |
|
66 |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // TMceActionSet::TMceActionSet |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 TMceActionSet::TMceActionSet( CMceSipSession& aSession ) |
|
73 : iSession ( aSession ) |
|
74 { |
|
75 } |
|
76 |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // TMceActionSet::StateChanged |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void TMceActionSet::StateChanged( TMceStateIndex aNewState ) |
|
83 { |
|
84 iSession.NextState( aNewState ); |
|
85 //for long session, once session established, key updated need to be turn on |
|
86 |
|
87 if ( aNewState == KMceStateEstablished && |
|
88 ActiveBody().SecureSession()) |
|
89 { |
|
90 if ( ActiveBody().SecureSession()->iCryptoContextUpdate ) |
|
91 { |
|
92 ActiveBody().SecureSession()->iKeyNeedUpdated = ETrue; |
|
93 } |
|
94 else |
|
95 { |
|
96 ActiveBody().SecureSession()->iKeyNeedUpdated = EFalse; |
|
97 } |
|
98 } |
|
99 |
|
100 } |
|
101 |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // TMceActionSet::ClientStateChanged |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 void TMceActionSet::ClientStateChanged( TMceIds& aIds, |
|
108 CMceSession::TState aNewState, |
|
109 TInt aStatus ) |
|
110 { |
|
111 MCESRV_DEBUG("TMceActionSet::ClientStateChanged( sync ), Entry"); |
|
112 MCESRV_DEBUG_CLISTATE("new state", aNewState ); |
|
113 MCESRV_DEBUG_DVALUE("status", aStatus ); |
|
114 |
|
115 ActiveBody().iState = aNewState; |
|
116 aIds.iState = aNewState; |
|
117 aIds.iStatus = aStatus; |
|
118 |
|
119 |
|
120 MCESRV_DEBUG("TMceActionSet::ClientStateChanged( sync ), Exit"); |
|
121 } |
|
122 |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // TMceActionSet::ClientStateChangedL |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 void TMceActionSet::ClientStateChangedL( CMceSession::TState aNewState, |
|
129 TInt aReason ) |
|
130 { |
|
131 MCESRV_DEBUG("TMceActionSet::ClientStateChanged, Entry"); |
|
132 MCESRV_DEBUG_CLISTATE("new state", aNewState ); |
|
133 |
|
134 if ( &ActiveBody() ) |
|
135 { |
|
136 ActiveBody().iState = aNewState; |
|
137 } |
|
138 |
|
139 TMceIds ids; |
|
140 ids.iCallbackID = EMceItcStateChanged; |
|
141 ids.iState = aNewState; |
|
142 |
|
143 if ( aReason == KErrNone ) |
|
144 { |
|
145 iSession.SendToClient( ids ); |
|
146 } |
|
147 else |
|
148 { |
|
149 MCESRV_DEBUG_DVALUE("error", aReason ) |
|
150 ids.iStatus = aReason; |
|
151 |
|
152 CMceMsgSIPReply* replyMsg = new (ELeave) CMceMsgSIPReply(); |
|
153 CleanupStack::PushL( replyMsg ); |
|
154 replyMsg->iCode = aReason; |
|
155 |
|
156 SendSIPDataToClientL( ids, *replyMsg, NULL ); |
|
157 CleanupStack::PopAndDestroy( replyMsg ); |
|
158 } |
|
159 |
|
160 |
|
161 MCESRV_DEBUG("TMceActionSet::ClientStateChanged, Exit"); |
|
162 } |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // TMceActionSet::ClientStateChangedL |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void TMceActionSet::ClientStateChangedL( CMceSession::TState aNewState, |
|
175 CSIPClientTransaction& aResponse, |
|
176 TInt aReason ) |
|
177 { |
|
178 MCESRV_DEBUG("TMceActionSet::ClientStateChangedL( response ), Entry"); |
|
179 MCESRV_DEBUG_CLISTATE("new state", aNewState ); |
|
180 MCESRV_DEBUG_DVALUE("error", aReason ); |
|
181 |
|
182 |
|
183 const CSIPResponseElements* response = aResponse.ResponseElements(); |
|
184 if ( !response ) |
|
185 { |
|
186 ClientStateChangedL( aNewState, aReason ); |
|
187 return; |
|
188 } |
|
189 |
|
190 MCESRV_DEBUG_DVALUE("status code", response->StatusCode() ); |
|
191 MCESRV_DEBUG_SVALUE("reason", response->ReasonPhrase().DesC() ); |
|
192 |
|
193 ActiveBody().iState = aNewState; |
|
194 |
|
195 TMceIds ids; |
|
196 ids.iCallbackID = EMceItcStateChanged; |
|
197 ids.iState = aNewState; |
|
198 ids.iStatus = aReason; |
|
199 |
|
200 HBufC8* content = NULL; |
|
201 |
|
202 CMceMsgSIPReply* replyMsg = new (ELeave) CMceMsgSIPReply(); |
|
203 CleanupStack::PushL( replyMsg ); |
|
204 replyMsg->PushL(); |
|
205 |
|
206 const CSIPMessageElements* elements = ResponseDataL( *replyMsg, aResponse, ActiveBody() ); |
|
207 |
|
208 if ( elements ) |
|
209 { |
|
210 content = elements->Content().AllocLC(); |
|
211 } |
|
212 |
|
213 SendSIPDataToClientL( ids, *replyMsg, content ); |
|
214 |
|
215 if ( content ) |
|
216 { |
|
217 CleanupStack::Pop( content ); |
|
218 } |
|
219 |
|
220 CleanupStack::PopAndDestroy( replyMsg ); |
|
221 |
|
222 |
|
223 MCESRV_DEBUG("TMceActionSet::ClientStateChangedL( response ), Exit"); |
|
224 |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // TMceActionSet::ReceiveExtensionResponseL |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 void TMceActionSet::ReceiveExtensionResponseL( CSIPClientTransaction& aResponse, |
|
232 CMceComSession& aBody ) |
|
233 { |
|
234 |
|
235 MCESRV_DEBUG("TMceActionSet::ReceiveExtensionResponseL( response ), Entry"); |
|
236 TUint count = KErrNone; |
|
237 TUint TransactoinID = KMceNotAssigned; |
|
238 count = iSession.PendingTransactions().Count(); |
|
239 |
|
240 if ( count ) |
|
241 { |
|
242 for ( TUint i=0; i < count; i++ ) |
|
243 { |
|
244 if ( *iSession.PendingTransactions()[i] == aResponse ) |
|
245 { |
|
246 TransactoinID = reinterpret_cast <TUint> |
|
247 (iSession.PendingTransactions()[i]); |
|
248 } |
|
249 } |
|
250 } |
|
251 |
|
252 const CSIPMessageElements* elements = NULL; |
|
253 const CSIPResponseElements* response = aResponse.ResponseElements(); |
|
254 |
|
255 HBufC8* content = NULL; |
|
256 |
|
257 if ( response ) |
|
258 { |
|
259 MCESRV_DEBUG_DVALUE("status code", response->StatusCode() ); |
|
260 MCESRV_DEBUG_SVALUE("reason", response->ReasonPhrase().DesC() ); |
|
261 |
|
262 CMceMsgSIPReply* replyMsg = replyMsg = new (ELeave) CMceMsgSIPReply(); |
|
263 CleanupStack::PushL( replyMsg ); |
|
264 |
|
265 replyMsg->PushL();//takes ownership of its content |
|
266 |
|
267 elements = ResponseDataL( *replyMsg, aResponse, aBody ); |
|
268 |
|
269 |
|
270 TMceIds ids; |
|
271 ids.iCallbackID = EMceItcResponseReceived; |
|
272 ids.iTransactionID = TransactoinID; |
|
273 |
|
274 content = elements ? elements->Content().AllocLC() : NULL; |
|
275 |
|
276 SendSIPDataToClientL( ids, *replyMsg, content ); |
|
277 |
|
278 if ( content ) |
|
279 { |
|
280 CleanupStack::Pop( content ); |
|
281 } |
|
282 |
|
283 CleanupStack::PopAndDestroy( replyMsg ); |
|
284 |
|
285 MCESRV_DEBUG( |
|
286 "TMceActionSet::ReceiveExtensionResponseL( session, response ), Exit"); |
|
287 } |
|
288 } |
|
289 |
|
290 // ----------------------------------------------------------------------------- |
|
291 // TMceActionSet::ReceiveExtensionRequestL |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 void TMceActionSet::ReceiveExtensionRequestL( TMceStateTransitionEvent& aEvent ) |
|
295 { |
|
296 MCESRV_DEBUG("TMceActionSet::ReceiveExtensionRequestL, Entry"); |
|
297 |
|
298 CSIPServerTransaction& serverTransaction = aEvent.Session().Request(); |
|
299 |
|
300 const CSIPMessageElements* elements = |
|
301 MceSip::ToMessageElements( serverTransaction ); |
|
302 |
|
303 HBufC8* method = MceSip::Method( serverTransaction ).DesC().AllocLC(); |
|
304 |
|
305 CDesC8Array* aSIPHeaders = NULL; |
|
306 |
|
307 if ( aEvent.Dialog()) |
|
308 { |
|
309 aSIPHeaders = MceSip::UserHeadersToTextArrayL( serverTransaction, |
|
310 *aEvent.Dialog() ); |
|
311 CleanupStack::PushL( aSIPHeaders ); |
|
312 } |
|
313 |
|
314 else |
|
315 { |
|
316 aSIPHeaders = MceSip::UserHeadersToTextArrayL( serverTransaction, |
|
317 iSession.Dialog()->Dialog() ); |
|
318 CleanupStack::PushL( aSIPHeaders ); |
|
319 } |
|
320 |
|
321 HBufC8* aSIPContentType = ( elements && elements->ContentType() ) ? |
|
322 elements->ContentType()->ToTextValueL() : |
|
323 KNullDesC8().AllocL(); |
|
324 |
|
325 |
|
326 CleanupStack::PushL( aSIPContentType ); |
|
327 |
|
328 TMceIds ids; |
|
329 ids.iCallbackID = EMceItcRequestReceived; |
|
330 ids.iTransactionID = reinterpret_cast <TUint> (&serverTransaction); |
|
331 |
|
332 |
|
333 CMceMsgSIPRequest* requestMsg = new (ELeave) CMceMsgSIPRequest( *method, |
|
334 *aSIPHeaders, *aSIPContentType ); |
|
335 requestMsg->PushL(); |
|
336 |
|
337 CleanupStack::Pop( aSIPContentType ); |
|
338 CleanupStack::Pop( aSIPHeaders ); |
|
339 CleanupStack::Pop( method ); |
|
340 |
|
341 CleanupStack::PushL( requestMsg ); |
|
342 |
|
343 HBufC8* content = |
|
344 elements ? elements->Content().AllocLC() : KNullDesC8().AllocLC(); |
|
345 |
|
346 SendSIPDataToClientL( ids, *requestMsg, content ); |
|
347 |
|
348 if ( content ) |
|
349 { |
|
350 CleanupStack::Pop( content ); |
|
351 } |
|
352 |
|
353 CleanupStack::PopAndDestroy( requestMsg ); |
|
354 |
|
355 MCESRV_DEBUG("TMceActionSet::ReceiveExtensionRequestL, Exit"); |
|
356 } |
|
357 |
|
358 |
|
359 |
|
360 // ----------------------------------------------------------------------------- |
|
361 // TMceActionSet::ReceiveExtensionError |
|
362 // ----------------------------------------------------------------------------- |
|
363 // |
|
364 void TMceActionSet::ReceiveExtensionError( CSIPTransactionBase& aTransaction, |
|
365 TInt aError ) |
|
366 { |
|
367 MCESRV_DEBUG("TMceActionSet::ReceiveExtensionErrorL, Entry"); |
|
368 |
|
369 TUint count = KErrNone; |
|
370 TUint TransactoinID = KMceNotAssigned; |
|
371 TBool found = EFalse; |
|
372 |
|
373 // If Error is for Client Transaction: |
|
374 if ( aTransaction.IsSIPClientTransaction() ) |
|
375 |
|
376 { |
|
377 MCESRV_DEBUG("Error Received for Client Transaction"); |
|
378 CSIPClientTransaction& clientTransaction = |
|
379 static_cast<CSIPClientTransaction&>( aTransaction ); |
|
380 |
|
381 count = iSession.PendingTransactions().Count(); |
|
382 |
|
383 if ( count ) |
|
384 { |
|
385 for ( TUint i=0; i < count; i++ ) |
|
386 { |
|
387 if ( *iSession.PendingTransactions()[i] == clientTransaction ) |
|
388 { |
|
389 TransactoinID = reinterpret_cast <TUint> |
|
390 (iSession.PendingTransactions()[i]); |
|
391 found = ETrue; |
|
392 } |
|
393 } |
|
394 } |
|
395 } |
|
396 |
|
397 |
|
398 // If Error is for Client Transaction: |
|
399 else |
|
400 { |
|
401 MCESRV_DEBUG("Error Received for Server Transaction"); |
|
402 CSIPServerTransaction& serverTransaction = |
|
403 static_cast<CSIPServerTransaction&>( aTransaction ); |
|
404 |
|
405 count = iSession.PendingReceivedRequests().Count(); |
|
406 |
|
407 if ( count ) |
|
408 { |
|
409 for ( TUint i=0; i < count; i++ ) |
|
410 { |
|
411 if ( *iSession.PendingReceivedRequests()[i] == serverTransaction ) |
|
412 { |
|
413 TransactoinID = reinterpret_cast <TUint> |
|
414 (iSession.PendingReceivedRequests()[i]); |
|
415 found = ETrue; |
|
416 } |
|
417 } |
|
418 } |
|
419 } |
|
420 |
|
421 // Send an Error Response to the Client if client or server transcation exisit |
|
422 // for which we receive an error. |
|
423 if ( found ) |
|
424 { |
|
425 MCESRV_DEBUG("Tranaction Matched Sending Error Response"); |
|
426 TMceIds ids; |
|
427 ids.iTransactionID = TransactoinID; |
|
428 iSession.SendErrorToClient( ids, aError ); |
|
429 } |
|
430 |
|
431 MCESRV_DEBUG("TMceActionSet::ReceiveExtensionErrorL, Exit"); |
|
432 } |
|
433 |
|
434 |
|
435 // ----------------------------------------------------------------------------- |
|
436 // TMceActionSet::SendExtensionResponseL |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 void TMceActionSet::SendExtensionResponseL( CMceMsgBase& aData, TMceIds& aIds ) |
|
440 { |
|
441 MCESRV_DEBUG("TMceActionSet::SendExtensionResponseL, Entry"); |
|
442 |
|
443 TUint count = KErrNone; |
|
444 TInt index = KErrNotFound; |
|
445 CSIPServerTransaction* PendingRequest = NULL; |
|
446 |
|
447 count = iSession.PendingReceivedRequests().Count(); |
|
448 |
|
449 if ( count ) |
|
450 { |
|
451 for ( TUint i=0; i < count; i++ ) |
|
452 { |
|
453 if ( reinterpret_cast <TUint> (iSession.PendingReceivedRequests()[i]) == |
|
454 aIds.iTransactionID ) |
|
455 { |
|
456 PendingRequest = iSession.PendingReceivedRequests()[i]; |
|
457 index = i; |
|
458 } |
|
459 } |
|
460 |
|
461 if ( index != KErrNotFound ) |
|
462 |
|
463 { |
|
464 CMceMsgSIPReply* data = static_cast<CMceMsgSIPReply*>( &aData ); |
|
465 SendResponseL( *PendingRequest, *data ); |
|
466 } |
|
467 |
|
468 else |
|
469 { |
|
470 User::Leave( KErrNotFound ); |
|
471 } |
|
472 |
|
473 } |
|
474 |
|
475 MCESRV_DEBUG("TMceActionSet::SendExtensionResponseL, Exit"); |
|
476 } |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 // ----------------------------------------------------------------------------- |
|
482 // TMceActionSet::ClientStateChangedL |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 void TMceActionSet::ClientStateChangedL( CMceSession::TState aNewState, |
|
486 CSIPServerTransaction& aRequest ) |
|
487 { |
|
488 MCESRV_DEBUG("TMceActionSet::ClientStateChangedL( request ), Entry"); |
|
489 MCESRV_DEBUG_CLISTATE("new state", aNewState ); |
|
490 MCESRV_DEBUG_SVALUE("request", MceSip::Method( aRequest ).DesC() ); |
|
491 |
|
492 |
|
493 const CSIPRequestElements* request = aRequest.RequestElements(); |
|
494 |
|
495 if ( !request ) |
|
496 { |
|
497 ClientStateChangedL( aNewState ); |
|
498 return; |
|
499 } |
|
500 |
|
501 ActiveBody().iState = aNewState; |
|
502 |
|
503 TMceIds ids; |
|
504 ids.iCallbackID = EMceItcStateChanged; |
|
505 ids.iState = aNewState; |
|
506 |
|
507 CMceMsgSIPData* requestMsg = new (ELeave) CMceMsgSIPData(); |
|
508 CleanupStack::PushL( requestMsg ); |
|
509 requestMsg->PushL(); |
|
510 |
|
511 const CSIPMessageElements* elements = |
|
512 RequestDataL( *requestMsg, aRequest ); |
|
513 |
|
514 HBufC8* content = elements ? elements->Content().AllocLC() : |
|
515 KNullDesC8().AllocLC(); |
|
516 |
|
517 SendSIPDataToClientL( ids, *requestMsg, content ); |
|
518 |
|
519 if ( content ) |
|
520 { |
|
521 CleanupStack::Pop( content ); |
|
522 } |
|
523 |
|
524 CleanupStack::PopAndDestroy( requestMsg ); |
|
525 |
|
526 MCESRV_DEBUG("TMceActionSet::ClientStateChangedL( request ), Exit"); |
|
527 |
|
528 |
|
529 } |
|
530 |
|
531 |
|
532 |
|
533 // ----------------------------------------------------------------------------- |
|
534 // TMceActionSet::ClientStateChangedL |
|
535 // ----------------------------------------------------------------------------- |
|
536 // |
|
537 void TMceActionSet::ClientStateChangedL( CMceSession::TState aNewState, |
|
538 CMceComSession& aBody, |
|
539 CSIPClientTransaction& aResponse, |
|
540 TInt aReason ) |
|
541 { |
|
542 |
|
543 MCESRV_DEBUG( |
|
544 "TMceActionSet::ClientStateChangedL( session, response ), Entry"); |
|
545 MCESRV_DEBUG_CLISTATE("new state", aNewState ); |
|
546 MCESRV_DEBUG_DVALUE("error", aReason ); |
|
547 TMceComFactory factory; |
|
548 |
|
549 aBody.iState = aNewState; |
|
550 |
|
551 const CSIPMessageElements* elements = NULL; |
|
552 const CSIPResponseElements* response = aResponse.ResponseElements(); |
|
553 |
|
554 HBufC8* content = NULL; |
|
555 |
|
556 CMceMsgArray<TMceComFactory>* messageArray = |
|
557 new (ELeave) CMceMsgArray<TMceComFactory>( factory ); |
|
558 CleanupStack::PushL( messageArray ); |
|
559 |
|
560 |
|
561 if ( response ) |
|
562 { |
|
563 MCESRV_DEBUG_DVALUE("status code", response->StatusCode() ); |
|
564 MCESRV_DEBUG_SVALUE("reason", response->ReasonPhrase().DesC() ); |
|
565 |
|
566 CMceMsgSIPReply* replyMsg = replyMsg = new (ELeave) CMceMsgSIPReply(); |
|
567 CleanupStack::PushL( replyMsg ); |
|
568 replyMsg->PushL();//takes ownership of its content |
|
569 |
|
570 elements = ResponseDataL( *replyMsg, aResponse, aBody ); |
|
571 |
|
572 messageArray->iArray.AppendL( replyMsg ); |
|
573 CleanupStack::Pop( replyMsg ); |
|
574 |
|
575 } |
|
576 |
|
577 |
|
578 CMceMsgObject<CMceComSession>* sessionMsg = |
|
579 new (ELeave) CMceMsgObject<CMceComSession> |
|
580 ( aBody, EMceItcMsgTypeSession ); |
|
581 CleanupStack::PushL( sessionMsg ); |
|
582 |
|
583 messageArray->iArray.AppendL( sessionMsg ); |
|
584 CleanupStack::Pop( sessionMsg ); |
|
585 |
|
586 |
|
587 TMceIds ids; |
|
588 ids.iState = aNewState; |
|
589 ids.iCallbackID = EMceItcStateChanged; |
|
590 ids.iStatus = aReason; |
|
591 |
|
592 |
|
593 if ( aReason != KErrNone && |
|
594 iSession.SubState() == CMceSipSession::EUpdating ) |
|
595 { |
|
596 MCESRV_DEBUG("ClientStateChangedL: update failed"); |
|
597 ids.iCallbackID = EMceItcUpdateFailed; |
|
598 } |
|
599 else |
|
600 { |
|
601 MCESRV_DEBUG("ClientStateChangedL: basic"); |
|
602 } |
|
603 |
|
604 content = elements ? elements->Content().AllocLC() : NULL; |
|
605 |
|
606 |
|
607 SendSIPDataToClientL( ids, *messageArray, content ); |
|
608 |
|
609 if ( content ) |
|
610 { |
|
611 CleanupStack::Pop( content ); |
|
612 } |
|
613 |
|
614 //pops and destroys also its content |
|
615 CleanupStack::PopAndDestroy( messageArray ); |
|
616 |
|
617 |
|
618 MCESRV_DEBUG( |
|
619 "TMceActionSet::ClientStateChangedL( session, response ), Exit"); |
|
620 |
|
621 } |
|
622 |
|
623 |
|
624 // ----------------------------------------------------------------------------- |
|
625 // TMceActionSet::ClientStateChangedL |
|
626 // ----------------------------------------------------------------------------- |
|
627 // |
|
628 void TMceActionSet::ClientStateChangedL( CMceSession::TState aNewState, |
|
629 CMceComSession& aBody, |
|
630 TInt aReason ) |
|
631 |
|
632 { |
|
633 |
|
634 MCESRV_DEBUG( |
|
635 "TMceActionSet::ClientStateChangedL( newState, body. reason ), Entry"); |
|
636 MCESRV_DEBUG_CLISTATE("new state", aNewState ); |
|
637 MCESRV_DEBUG_DVALUE("error", aReason ); |
|
638 |
|
639 aBody.iState = aNewState; |
|
640 |
|
641 TMceIds ids; |
|
642 ids.iState = aNewState; |
|
643 |
|
644 if ( aReason == KErrNone ) |
|
645 { |
|
646 ids.iCallbackID = EMceItcStateChanged; |
|
647 } |
|
648 else |
|
649 { |
|
650 ids.iCallbackID = EMceItcUpdateFailed; |
|
651 ids.iStatus = aReason; |
|
652 } |
|
653 |
|
654 SendBodyToClientL( ids, aBody, NULL ); |
|
655 |
|
656 MCESRV_DEBUG( |
|
657 "TMceActionSet::ClientStateChangedL( newState, body. reason ), Entry"); |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // TMceActionSet::UpdateFailed |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 void TMceActionSet::UpdateFailed() |
|
665 { |
|
666 MCESRV_DEBUG("TMceActionSet::UpdateFailed, Entry"); |
|
667 |
|
668 if ( iSession.SubState() == CMceSipSession::EUpdating ) |
|
669 { |
|
670 iSession.UpdateRejected(); |
|
671 } |
|
672 else |
|
673 { |
|
674 MCESRV_DEBUG("UpdateFailed: Called in wrong sub state!, Exit"); |
|
675 } |
|
676 |
|
677 MCESRV_DEBUG("TMceActionSet::UpdateFailed, Exit"); |
|
678 } |
|
679 |
|
680 // ----------------------------------------------------------------------------- |
|
681 // TMceActionSet::UpdateSucceed |
|
682 // ----------------------------------------------------------------------------- |
|
683 // |
|
684 void TMceActionSet::UpdateSucceed() |
|
685 { |
|
686 if ( iSession.SubState() == CMceSipSession::EUpdating ) |
|
687 { |
|
688 MCESRV_DEBUG("TMceActionSet::UpdateSucceed, Entry"); |
|
689 iSession.UpdateAccepted(); |
|
690 MCESRV_DEBUG("TMceActionSet::UpdateSucceed, Exit"); |
|
691 } |
|
692 else |
|
693 { |
|
694 //NOP |
|
695 } |
|
696 } |
|
697 |
|
698 // ----------------------------------------------------------------------------- |
|
699 // TMceActionSet::CreateSDP |
|
700 // ----------------------------------------------------------------------------- |
|
701 // |
|
702 TInt TMceActionSet::CreateSDP( CSIPTransactionBase& aSDPContainer ) |
|
703 { |
|
704 CSdpDocument* sdp = NULL; |
|
705 TInt status = KErrNone; |
|
706 |
|
707 if ( aSDPContainer.IsSIPClientTransaction() ) |
|
708 { |
|
709 CSIPClientTransaction& answer = |
|
710 static_cast<CSIPClientTransaction&>( aSDPContainer ); |
|
711 const CSIPResponseElements* elements = answer.ResponseElements(); |
|
712 |
|
713 TRAP( status, sdp = |
|
714 CSdpDocument::DecodeL( elements->MessageElements().Content() ) ); |
|
715 } |
|
716 else |
|
717 { |
|
718 CSIPServerTransaction& offer = |
|
719 static_cast<CSIPServerTransaction&>( aSDPContainer ); |
|
720 const CSIPRequestElements* elements = offer.RequestElements(); |
|
721 |
|
722 TRAP( status, sdp = |
|
723 CSdpDocument::DecodeL( elements->MessageElements().Content() ) ); |
|
724 } |
|
725 |
|
726 if ( status == KErrNone ) |
|
727 { |
|
728 iSession.StorePrevOffer(); |
|
729 iSession.SetOffer( sdp ); |
|
730 iSession.IncrementReceivedSdpCount(); |
|
731 } |
|
732 |
|
733 return status; |
|
734 } |
|
735 |
|
736 // ----------------------------------------------------------------------------- |
|
737 // TMceActionSet::CreateBodyCandidateL |
|
738 // ----------------------------------------------------------------------------- |
|
739 // |
|
740 void TMceActionSet::CreateBodyCandidateL( CMceComSession::TType aType ) |
|
741 { |
|
742 MCESRV_DEBUG("TMceActionSet::CreateBodyCandidateL, Entry"); |
|
743 __ASSERT_ALWAYS( iSession.Body(), User::Leave( KErrArgument ) ); |
|
744 __ASSERT_ALWAYS( !iSession.BodyCandidate(), User::Leave( KErrNotReady ) ); |
|
745 |
|
746 CSIPServerTransaction& request = iSession.Request(); |
|
747 CSIPServerTransaction* requestPtr = &iSession.Request(); |
|
748 |
|
749 if ( (requestPtr!=NULL) && !MceSip::HasContent( request )) |
|
750 { |
|
751 iSession.iNewBodyCandidate = iSession.Body()->CloneL( ETrue ); |
|
752 } |
|
753 else |
|
754 { |
|
755 iSession.iNewBodyCandidate = iSession.Body()->CloneL(); |
|
756 } |
|
757 |
|
758 iSession.iNewBodyCandidate->iType = aType; |
|
759 |
|
760 iSession.SetSubState( CMceSipSession::EUpdating ); |
|
761 |
|
762 MCESRV_DEBUG("TMceActionSet::CreateBodyCandidateL, Exit"); |
|
763 } |
|
764 |
|
765 // ----------------------------------------------------------------------------- |
|
766 // TMceActionSet::UpdateBodyL |
|
767 // ----------------------------------------------------------------------------- |
|
768 // |
|
769 void TMceActionSet::UpdateBodyL( TMceIds& aIds, CMceMsgBase& aBody ) |
|
770 { |
|
771 MCESRV_DEBUG("TMceActionSet::UpdateBodyL, Entry"); |
|
772 |
|
773 CMceSipSession::TSubState subState = iSession.SubState(); |
|
774 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
775 TMceComEventHandler handler( mediaManager ); |
|
776 CMceComSession* body = NULL; |
|
777 CMceMsgObject<CMceComSession>* msg = |
|
778 static_cast<CMceMsgObject<CMceComSession>*>( &aBody ); |
|
779 |
|
780 if ( !iSession.Body() ) |
|
781 { |
|
782 iSession.SetBodyL( msg->iObject ); |
|
783 msg->Object();//ownership is transferred |
|
784 body = iSession.Body(); |
|
785 } |
|
786 else if ( subState != CMceSipSession::EUpdating ) |
|
787 { |
|
788 body = iSession.Body(); |
|
789 TMceComEvent event( aIds, msg->iObject, EMceItcUpdate, handler ); |
|
790 body->EventReceivedL( event ); |
|
791 iSession.Extensions().Update( *body ); |
|
792 } |
|
793 else |
|
794 { |
|
795 body = iSession.BodyCandidate(); |
|
796 TMceComEvent event( aIds, msg->iObject, EMceItcUpdate, handler ); |
|
797 body->EventReceivedL( event ); |
|
798 iSession.Extensions().Update( *body ); |
|
799 } |
|
800 |
|
801 aBody.Close(); |
|
802 |
|
803 // transfer ownership of content to body |
|
804 MCE_DELETE( body->iSIPContent ); |
|
805 body->iSIPContent = iSession.PopClientContent(); |
|
806 |
|
807 // If body's origin member is not set, parse origin from SIP profile. |
|
808 if ( body->iType == CMceComSession::EOutSession && |
|
809 ( !body->iOriginator || body->iOriginator->Length() == 0 ) ) |
|
810 { |
|
811 const TDesC8* userAor = NULL; |
|
812 const CSIPProfile& profile = iSession.Profile(); |
|
813 TInt result = profile.GetParameter( KSIPUserAor, userAor ); |
|
814 if ( KErrNone == result && userAor && userAor->Size() != 0 ) |
|
815 { |
|
816 MCESRV_DEBUG_SVALUE( |
|
817 "TMceActionSet::UpdateBodyL, UPDATE ORIGINATOR", *userAor ); |
|
818 body->SetOriginatorL( *userAor ); |
|
819 } |
|
820 } |
|
821 |
|
822 MCESRV_DEBUG("TMceActionSet::UpdateBodyL, Exit"); |
|
823 } |
|
824 |
|
825 // ----------------------------------------------------------------------------- |
|
826 // TMceActionSet::SendInviteL |
|
827 // ----------------------------------------------------------------------------- |
|
828 // |
|
829 void TMceActionSet::SendInviteL() |
|
830 { |
|
831 MCESRV_DEBUG("TMceActionSet::SendInviteL, Entry"); |
|
832 CMceSipSession::TSubState subState = iSession.SubState(); |
|
833 CMceComSession* body = NULL; |
|
834 |
|
835 if ( subState != CMceSipSession::EUpdating ) |
|
836 { |
|
837 body = iSession.Body(); |
|
838 } |
|
839 else |
|
840 { |
|
841 body = iSession.BodyCandidate(); |
|
842 } |
|
843 |
|
844 //send invite |
|
845 SendInviteL( *body ); |
|
846 |
|
847 MCESRV_DEBUG("TMceActionSet::SendInviteL, Exit"); |
|
848 } |
|
849 |
|
850 // ----------------------------------------------------------------------------- |
|
851 // TMceActionSet::SendSessionRefreshL |
|
852 // ----------------------------------------------------------------------------- |
|
853 // |
|
854 void TMceActionSet::SendSessionRefreshL() |
|
855 { |
|
856 MCESRV_DEBUG("TMceActionSet::SendSessionRefreshL, Entry"); |
|
857 |
|
858 iSession.SetSubState( CMceSipSession::ERefreshing ); |
|
859 |
|
860 SendInviteL( ActiveBody() ); |
|
861 |
|
862 MCESRV_DEBUG("TMceActionSet::SendSessionRefreshL, Exit"); |
|
863 } |
|
864 |
|
865 // ----------------------------------------------------------------------------- |
|
866 // TMceActionSet::EncodeL |
|
867 // ----------------------------------------------------------------------------- |
|
868 // |
|
869 void TMceActionSet::EncodeL() |
|
870 { |
|
871 MCESRV_DEBUG("TMceActionSet::EncodeL, Entry"); |
|
872 |
|
873 CMceComSession& body = ActiveBody(); |
|
874 |
|
875 CMceSipExtensions& ext = iSession.Extensions(); |
|
876 TInt localQosPreconds = ext.Local( CMceSipExtensions::EQosPreconds ); |
|
877 TInt remoteQosPreconds = ext.Remote( CMceSipExtensions::EQosPreconds ); |
|
878 body.iUseLocalPreconditions = localQosPreconds != CMceSipExtensions::ENotSupported; |
|
879 body.iUseRemotePreconditions = remoteQosPreconds != CMceSipExtensions::ENotSupported; |
|
880 |
|
881 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
882 iSession.StorePrevOffer(); |
|
883 iSession.SetOffer( mediaManager.EncodeL( body ) ); |
|
884 |
|
885 MCESRV_DEBUG("TMceActionSet::EncodeL, Exit"); |
|
886 } |
|
887 |
|
888 |
|
889 // ----------------------------------------------------------------------------- |
|
890 // TMceActionSet::DecodeL |
|
891 // ----------------------------------------------------------------------------- |
|
892 // |
|
893 TMceSipWarningCode TMceActionSet::DecodeL() |
|
894 { |
|
895 MCESRV_DEBUG("TMceActionSet::DecodeL, Entry"); |
|
896 |
|
897 TMceSipWarningCode status = KErrNone; |
|
898 |
|
899 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
900 |
|
901 CMceComSession& body = ActiveBody(); |
|
902 |
|
903 CMceSipExtensions& ext = iSession.Extensions(); |
|
904 TInt localQosPreconds = ext.Local( CMceSipExtensions::EQosPreconds ); |
|
905 TInt remoteQosPreconds = ext.Remote( CMceSipExtensions::EQosPreconds ); |
|
906 |
|
907 body.iUseLocalPreconditions = localQosPreconds != CMceSipExtensions::ENotSupported; |
|
908 body.iUseRemotePreconditions = remoteQosPreconds != CMceSipExtensions::ENotSupported; |
|
909 //set remote sec precondtions only when it is invite or update |
|
910 if ( &iSession.Request() ) |
|
911 { |
|
912 if ( |
|
913 MceSip::Method( iSession.Request() ) == SIPStrings::StringF( SipStrConsts::EInvite ) || |
|
914 MceSip::Method( iSession.Request() ) == SIPStrings::StringF( SipStrConsts::EUpdate ) ) |
|
915 { |
|
916 body.iRemoteSecPreconditionsRequired = |
|
917 ext.Remote( CMceSipExtensions::ESecPreconds ) == CMceSipExtensions::ERequired; |
|
918 } |
|
919 } |
|
920 else |
|
921 { |
|
922 body.iRemoteSecPreconditionsRequired = |
|
923 ext.Remote( CMceSipExtensions::ESecPreconds ) != CMceSipExtensions::ENotSupported; |
|
924 } |
|
925 status = mediaManager.DecodeL( body, *iSession.Offer() ); |
|
926 |
|
927 MCESRV_DEBUG_DVALUE( "DecodeL: status", status); |
|
928 |
|
929 MCESRV_DEBUG("TMceActionSet::DecodeL, Exit"); |
|
930 |
|
931 return status; |
|
932 } |
|
933 |
|
934 // ----------------------------------------------------------------------------- |
|
935 // TMceActionSet::Decode |
|
936 // ----------------------------------------------------------------------------- |
|
937 // |
|
938 TMceSipWarningCode TMceActionSet::Decode() |
|
939 { |
|
940 MCESRV_DEBUG("TMceActionSet::Decode, Entry"); |
|
941 |
|
942 TMceReturnStatus status = KErrNone; |
|
943 TInt error = KErrNone; |
|
944 |
|
945 TRAP( error, status = DecodeL() ); |
|
946 |
|
947 MCESRV_DEBUG_DVALUE( "Update: status", status ); |
|
948 MCESRV_DEBUG_DVALUE( "Update: error", error ); |
|
949 |
|
950 MCESRV_DEBUG("TMceActionSet::Decode, Exit"); |
|
951 |
|
952 return error != KErrNone ? error : status; |
|
953 } |
|
954 |
|
955 // ----------------------------------------------------------------------------- |
|
956 // TMceActionSet::UpdateL |
|
957 // ----------------------------------------------------------------------------- |
|
958 // |
|
959 TMceReturnStatus TMceActionSet::UpdateL() |
|
960 { |
|
961 MCESRV_DEBUG("TMceActionSet::UpdateL, Entry"); |
|
962 |
|
963 TMceReturnStatus status = KErrNone; |
|
964 |
|
965 status = iSession.UpdateMediaL(); |
|
966 |
|
967 MCESRV_DEBUG_DVALUE( "UpdateL: status", status ); |
|
968 |
|
969 MCESRV_DEBUG("TMceActionSet::UpdateL, Exit"); |
|
970 |
|
971 return status; |
|
972 } |
|
973 |
|
974 // ----------------------------------------------------------------------------- |
|
975 // TMceActionSet::Update |
|
976 // ----------------------------------------------------------------------------- |
|
977 // |
|
978 TMceReturnStatus TMceActionSet::Update() |
|
979 { |
|
980 MCESRV_DEBUG("TMceActionSet::Update, Entry"); |
|
981 |
|
982 TMceReturnStatus status = KErrNone; |
|
983 TInt error = KErrNone; |
|
984 |
|
985 TRAP( error, status = UpdateL() ); |
|
986 |
|
987 MCESRV_DEBUG_DVALUE( "Update: status", status ); |
|
988 MCESRV_DEBUG_DVALUE( "Update: error", error ); |
|
989 |
|
990 MCESRV_DEBUG("TMceActionSet::Update, Exit"); |
|
991 |
|
992 return error != KErrNone ? error : status; |
|
993 } |
|
994 |
|
995 // ----------------------------------------------------------------------------- |
|
996 // TMceActionSet::ReserveL |
|
997 // ----------------------------------------------------------------------------- |
|
998 // |
|
999 TMceReturnStatus TMceActionSet::ReserveL() |
|
1000 { |
|
1001 MCESRV_DEBUG("TMceActionSet::ReserveL, Entry"); |
|
1002 |
|
1003 TMceReturnStatus status = iSession.ReserveL(); |
|
1004 MCESRV_DEBUG_DVALUE( "ReserveL: status", status); |
|
1005 |
|
1006 MCESRV_DEBUG("TMceActionSet::ReserveL, Exit"); |
|
1007 |
|
1008 return status; |
|
1009 } |
|
1010 |
|
1011 // ----------------------------------------------------------------------------- |
|
1012 // TMceActionSet::ClientUpdateIncomingSessionL |
|
1013 // ----------------------------------------------------------------------------- |
|
1014 // |
|
1015 void TMceActionSet::ClientUpdateIncomingSessionL( |
|
1016 CSIPServerTransaction& aInvite ) |
|
1017 { |
|
1018 MCESRV_DEBUG("TMceActionSet::ClientUpdateIncomingSessionL, Entry"); |
|
1019 |
|
1020 ClientUpdateSessionL( aInvite, EMceItcObjectAdded ); |
|
1021 |
|
1022 MCESRV_DEBUG("TMceActionSet::ClientUpdateIncomingSessionL, Exit"); |
|
1023 } |
|
1024 |
|
1025 // ----------------------------------------------------------------------------- |
|
1026 // TMceActionSet::ClientUpdateSessionL |
|
1027 // ----------------------------------------------------------------------------- |
|
1028 // |
|
1029 void TMceActionSet::ClientUpdateSessionL( CSIPServerTransaction& aInvite, |
|
1030 TUint32 aCallback ) |
|
1031 { |
|
1032 MCESRV_DEBUG("TMceActionSet::ClientUpdateSessionL, Entry"); |
|
1033 |
|
1034 CMceComSession& body = ActiveBody(); |
|
1035 |
|
1036 const CSIPMessageElements* elements = |
|
1037 ProcessInviteL( body, aInvite ); |
|
1038 |
|
1039 RequestDataL( body, aInvite ); |
|
1040 |
|
1041 HBufC8* content = elements ? elements->Content().AllocLC() : NULL; |
|
1042 |
|
1043 TMceIds ids; |
|
1044 ids.iCallbackID = aCallback; |
|
1045 ids.iState = CMceSession::EIncoming; |
|
1046 |
|
1047 if ( aCallback == EMceItcObjectAdded ) |
|
1048 { |
|
1049 iSession.PrepareIdsL( ids ); |
|
1050 } |
|
1051 |
|
1052 SendBodyToClientL( ids, body, content ); |
|
1053 |
|
1054 if ( content ) |
|
1055 { |
|
1056 CleanupStack::Pop( content ); |
|
1057 } |
|
1058 |
|
1059 MCESRV_DEBUG("TMceActionSet::ClientUpdateSessionL, Entry"); |
|
1060 } |
|
1061 |
|
1062 // ----------------------------------------------------------------------------- |
|
1063 // TMceActionSet::ProcessInviteL |
|
1064 // ----------------------------------------------------------------------------- |
|
1065 // |
|
1066 const CSIPMessageElements* |
|
1067 TMceActionSet::ProcessInviteL( CMceComSession& aBody, |
|
1068 CSIPServerTransaction& aInvite ) |
|
1069 { |
|
1070 MCESRV_DEBUG("TMceActionSet::ProcessInviteL, Entry"); |
|
1071 |
|
1072 const CSIPRequestElements* reqElements = aInvite.RequestElements(); |
|
1073 const CSIPMessageElements* elements = |
|
1074 reqElements ? &reqElements->MessageElements() : NULL; |
|
1075 |
|
1076 |
|
1077 if ( reqElements ) |
|
1078 { |
|
1079 const CSIPAddress& from = reqElements->FromHeader()->SIPAddress(); |
|
1080 const CSIPAddress& to = reqElements->ToHeader()->SIPAddress(); |
|
1081 |
|
1082 MCE_DELETE( aBody.iOriginator ); |
|
1083 MCE_DELETE( aBody.iRecipient ); |
|
1084 |
|
1085 aBody.iOriginator = MceSip::AddressToTextL( from ); |
|
1086 aBody.iRecipient = MceSip::AddressToTextL( to ); |
|
1087 } |
|
1088 |
|
1089 |
|
1090 MCESRV_DEBUG("TMceActionSet::ProcessInviteL, Exit"); |
|
1091 |
|
1092 return elements; |
|
1093 } |
|
1094 |
|
1095 // ----------------------------------------------------------------------------- |
|
1096 // TMceActionSet::ResponseDataL |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // |
|
1099 const CSIPMessageElements* |
|
1100 TMceActionSet::ResponseDataL( CMceMsgSIPReply& aContainer, |
|
1101 CSIPClientTransaction& aResponse, |
|
1102 CMceComSession& aBody ) |
|
1103 { |
|
1104 const CSIPResponseElements* response = aResponse.ResponseElements(); |
|
1105 const CSIPMessageElements* elements = NULL; |
|
1106 |
|
1107 if ( response ) |
|
1108 { |
|
1109 const CSIPAddress& to = response->FromHeader()->SIPAddress(); |
|
1110 HBufC8* originator = MceSip::AddressToTextL( to ); |
|
1111 if ( !aBody.iOriginator || aBody.iOriginator->Length() == 0 ) |
|
1112 { |
|
1113 MCE_DELETE( aBody.iOriginator ); |
|
1114 aBody.iOriginator = originator; |
|
1115 } |
|
1116 else |
|
1117 { |
|
1118 MCE_DELETE( originator ); |
|
1119 } |
|
1120 |
|
1121 elements = &response->MessageElements(); |
|
1122 |
|
1123 aContainer.iCode = response->StatusCode(); |
|
1124 HBufC8* reason = response->ReasonPhrase().DesC().AllocLC(); |
|
1125 HBufC8* contentType = elements && elements->ContentType() ? |
|
1126 elements->ContentType()->ToTextValueL() : |
|
1127 KNullDesC8().AllocL(); |
|
1128 CleanupStack::PushL( contentType ); |
|
1129 CDesC8Array* headers = |
|
1130 MceSip::UserHeadersToTextArrayL( aResponse, |
|
1131 iSession.Dialog()->Dialog() ); |
|
1132 CleanupStack::Pop( contentType ); |
|
1133 CleanupStack::Pop( reason ); |
|
1134 aContainer.iReason = reason; |
|
1135 aContainer.iSIPHeaders = headers; |
|
1136 aContainer.iContentType = contentType; |
|
1137 } |
|
1138 |
|
1139 return elements; |
|
1140 } |
|
1141 |
|
1142 // ----------------------------------------------------------------------------- |
|
1143 // TMceActionSet::RequestDataL |
|
1144 // ----------------------------------------------------------------------------- |
|
1145 // |
|
1146 const CSIPMessageElements* |
|
1147 TMceActionSet::RequestDataL( CMceComSession& aContainer, |
|
1148 CSIPServerTransaction& aRequest ) |
|
1149 { |
|
1150 |
|
1151 const CSIPMessageElements* elements = MceSip::ToMessageElements( aRequest ); |
|
1152 |
|
1153 |
|
1154 if ( elements ) |
|
1155 { |
|
1156 MCE_DELETE( aContainer.iSIPHeaders ); |
|
1157 MCE_DELETE( aContainer.iSIPContentType ); |
|
1158 |
|
1159 aContainer.iSIPHeaders = |
|
1160 MceSip::UserHeadersToTextArrayL( aRequest, |
|
1161 iSession.Dialog()->Dialog() ); |
|
1162 aContainer.iSIPContentType = elements->ContentType() ? |
|
1163 elements->ContentType()->ToTextValueL() : |
|
1164 KNullDesC8().AllocL(); |
|
1165 } |
|
1166 |
|
1167 return elements; |
|
1168 } |
|
1169 |
|
1170 // ----------------------------------------------------------------------------- |
|
1171 // TMceActionSet::RequestDataL |
|
1172 // ----------------------------------------------------------------------------- |
|
1173 // |
|
1174 const CSIPMessageElements* |
|
1175 TMceActionSet::RequestDataL( CMceMsgSIPData& aContainer, |
|
1176 CSIPServerTransaction& aRequest ) |
|
1177 { |
|
1178 const CSIPMessageElements* elements = MceSip::ToMessageElements( aRequest ); |
|
1179 |
|
1180 |
|
1181 if ( elements ) |
|
1182 { |
|
1183 aContainer.iTrxType = aRequest.Type().Index( SIPStrings::Table() ); |
|
1184 aContainer.iSIPHeaders = |
|
1185 MceSip::UserHeadersToTextArrayL( aRequest, |
|
1186 iSession.Dialog()->Dialog() ); |
|
1187 aContainer.iContentType = elements->ContentType() ? |
|
1188 elements->ContentType()->ToTextValueL() : |
|
1189 KNullDesC8().AllocL(); |
|
1190 } |
|
1191 |
|
1192 return elements; |
|
1193 } |
|
1194 |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // TMceActionSet::SendBodyToClientL |
|
1197 // ----------------------------------------------------------------------------- |
|
1198 // |
|
1199 void TMceActionSet::SendBodyToClientL( TMceIds& aIds, |
|
1200 CMceComSession& aBody, |
|
1201 HBufC8* aContent ) |
|
1202 { |
|
1203 MCESRV_DEBUG("TMceActionSet::SendBodyToClientL, Entry"); |
|
1204 //PaisRic MCESRV_DEBUG_COMSESSION((&aBody)); |
|
1205 |
|
1206 aBody.iID = MCE_SESSION_ID(&iSession); |
|
1207 aBody.iState = static_cast<CMceSession::TState>( aIds.iState ); |
|
1208 |
|
1209 CMceMsgObject<CMceComSession>* sessionMsg = |
|
1210 new (ELeave) CMceMsgObject<CMceComSession>( aBody, |
|
1211 EMceItcMsgTypeSession ); |
|
1212 CleanupStack::PushL( sessionMsg ); |
|
1213 sessionMsg->EncodeL(); |
|
1214 aIds.iMsgType = sessionMsg->Type(); |
|
1215 |
|
1216 HBufC8* encSession = sessionMsg->EncodeBufferCloneL(); |
|
1217 CleanupStack::PopAndDestroy( sessionMsg ); |
|
1218 CleanupStack::PushL( encSession ); |
|
1219 |
|
1220 if ( aIds.iCallbackID == EMceItcObjectAdded ) |
|
1221 { |
|
1222 MCESRV_DEBUG("SendBodyToClientL: sending to manager"); |
|
1223 iSession.Client().SendToClientL( aIds, encSession, aContent ); |
|
1224 } |
|
1225 else |
|
1226 { |
|
1227 MCESRV_DEBUG("SendBodyToClientL: sending to session"); |
|
1228 iSession.SendToClientL( aIds, encSession, aContent ); |
|
1229 } |
|
1230 |
|
1231 |
|
1232 CleanupStack::Pop( encSession ); |
|
1233 |
|
1234 MCESRV_DEBUG("TMceActionSet::SendBodyToClientL, Entry"); |
|
1235 } |
|
1236 |
|
1237 // ----------------------------------------------------------------------------- |
|
1238 // TMceActionSet::SendSIPDataToClientL |
|
1239 // ----------------------------------------------------------------------------- |
|
1240 // |
|
1241 void TMceActionSet::SendSIPDataToClientL( TMceIds& aIds, |
|
1242 CMceMsgBase& aData, |
|
1243 HBufC8* aContent ) |
|
1244 |
|
1245 { |
|
1246 aData.EncodeL(); |
|
1247 |
|
1248 aIds.iMsgType = aData.Type(); |
|
1249 |
|
1250 HBufC8* context = aData.EncodeBufferCloneL(); |
|
1251 CleanupStack::PushL( context ); |
|
1252 |
|
1253 iSession.SendToClientL( aIds, context, aContent ); |
|
1254 CleanupStack::Pop( context ); |
|
1255 } |
|
1256 |
|
1257 // ----------------------------------------------------------------------------- |
|
1258 // TMceActionSet::SendAnswerL |
|
1259 // ----------------------------------------------------------------------------- |
|
1260 // |
|
1261 void TMceActionSet::SendAnswerL( CSIPServerTransaction& aRequest ) |
|
1262 { |
|
1263 MCESRV_DEBUG("TMceActionSet::SendAnswerL, Entry"); |
|
1264 |
|
1265 CMceMsgSIPReply* reply = new (ELeave) CMceMsgSIPReply(); |
|
1266 CleanupStack::PushL( reply ); |
|
1267 |
|
1268 reply->iCode = KMceSipOK; |
|
1269 reply->iReasonAsPoolIndex = SipStrConsts::EPhraseOk; |
|
1270 |
|
1271 |
|
1272 SendAnswerL( aRequest, *reply ); |
|
1273 |
|
1274 CleanupStack::PopAndDestroy( reply ); |
|
1275 |
|
1276 MCESRV_DEBUG("TMceActionSet::SendAnswerL, Exit"); |
|
1277 } |
|
1278 |
|
1279 // ----------------------------------------------------------------------------- |
|
1280 // TMceActionSet::SendAnswerL |
|
1281 // ----------------------------------------------------------------------------- |
|
1282 // |
|
1283 void TMceActionSet::SendAnswerL( CSIPServerTransaction& aRequest, |
|
1284 CMceMsgBase& aReply ) |
|
1285 { |
|
1286 MCESRV_DEBUG("TMceActionSet::SendAnswerL( message ), Entry"); |
|
1287 |
|
1288 //content, content type etc are stored to session in update |
|
1289 |
|
1290 CMceMsgSIPReply* reply = static_cast<CMceMsgSIPReply*>( &aReply ); |
|
1291 if ( !reply ) |
|
1292 { |
|
1293 SendAnswerL( aRequest ); |
|
1294 return; |
|
1295 } |
|
1296 |
|
1297 CSdpDocument* offer = iSession.Offer(); |
|
1298 HBufC8* sipContentType = ActiveBody().iSIPContentType; |
|
1299 HBufC8* sipContent = ActiveBody().iSIPContent; |
|
1300 if ( offer |
|
1301 && MCE_HAS_DATA( sipContentType ) |
|
1302 && MCE_HAS_DATA( sipContent ) |
|
1303 ) |
|
1304 { |
|
1305 reply->iContentTypeId = EMceContentTypeMultiPart; |
|
1306 } |
|
1307 else if ( offer ) |
|
1308 { |
|
1309 reply->iContentTypeId = EMceContentTypeSDP; |
|
1310 } |
|
1311 else |
|
1312 { |
|
1313 //NOP |
|
1314 } |
|
1315 |
|
1316 |
|
1317 SendResponseL( aRequest, *reply ); |
|
1318 aReply.Close(); |
|
1319 |
|
1320 if ( iSession.SubState() == CMceSipSession::EAnswering ) |
|
1321 { |
|
1322 iSession.StartSessionTimerL(); |
|
1323 } |
|
1324 |
|
1325 MCESRV_DEBUG("TMceActionSet::SendAnswerL( message ), Exit"); |
|
1326 } |
|
1327 |
|
1328 // ----------------------------------------------------------------------------- |
|
1329 // TMceActionSet::BodyToTextL |
|
1330 // ----------------------------------------------------------------------------- |
|
1331 // |
|
1332 HBufC8* TMceActionSet::BodyToTextL() |
|
1333 { |
|
1334 HBufC8* encodedBody = NULL; |
|
1335 |
|
1336 CMceMsgObject<CMceComSession>* sessionMsg = |
|
1337 new (ELeave) CMceMsgObject<CMceComSession>( *iSession.Body(), |
|
1338 EMceItcMsgTypeSession ); |
|
1339 CleanupStack::PushL( sessionMsg ); |
|
1340 sessionMsg->EncodeL(); |
|
1341 |
|
1342 encodedBody = sessionMsg->EncodeBuffer().Ptr(0).AllocL(); |
|
1343 |
|
1344 CleanupStack::PopAndDestroy( sessionMsg ); |
|
1345 |
|
1346 return encodedBody; |
|
1347 } |
|
1348 |
|
1349 |
|
1350 // |
|
1351 // SIP Sending |
|
1352 // |
|
1353 |
|
1354 // ----------------------------------------------------------------------------- |
|
1355 // TMceActionSet::SendInviteL |
|
1356 // ----------------------------------------------------------------------------- |
|
1357 // |
|
1358 void TMceActionSet::SendInviteL( CMceComSession& aData ) |
|
1359 { |
|
1360 MCESRV_DEBUG("TMceActionSet::SendInviteL, Entry"); |
|
1361 |
|
1362 SendRequestL( SipStrConsts::EInvite, &aData ); |
|
1363 |
|
1364 MCESRV_DEBUG("TMceActionSet::SendInviteL, Exit"); |
|
1365 } |
|
1366 |
|
1367 // ----------------------------------------------------------------------------- |
|
1368 // TMceActionSet::SendUpdateRequestL |
|
1369 // ----------------------------------------------------------------------------- |
|
1370 // |
|
1371 void TMceActionSet::SendUpdateRequestL() |
|
1372 { |
|
1373 MCESRV_DEBUG("TMceActionSet::SendUpdateRequestL, Entry"); |
|
1374 |
|
1375 SendRequestL( SipStrConsts::EUpdate ); |
|
1376 |
|
1377 MCESRV_DEBUG("TMceActionSet::SendUpdateMethodL, Exit"); |
|
1378 } |
|
1379 |
|
1380 // ----------------------------------------------------------------------------- |
|
1381 // TMceActionSet::SendPrackL |
|
1382 // ----------------------------------------------------------------------------- |
|
1383 // |
|
1384 void TMceActionSet::SendPrackL( TBool aContent ) |
|
1385 { |
|
1386 MCESRV_DEBUG("SendPrackL::SendUpdateRequestL, Entry"); |
|
1387 |
|
1388 SendRequestL( SipStrConsts::EPrack, NULL, aContent ); |
|
1389 |
|
1390 MCESRV_DEBUG("SendPrackL::SendUpdateMethodL, Exit"); |
|
1391 } |
|
1392 |
|
1393 |
|
1394 // ----------------------------------------------------------------------------- |
|
1395 // TMceActionSet::SendExtensionRequestL |
|
1396 // ----------------------------------------------------------------------------- |
|
1397 // |
|
1398 void TMceActionSet::SendExtensionRequestL( CMceMsgBase& aData, TMceIds& aIds ) |
|
1399 { |
|
1400 MCESRV_DEBUG("TMceActionSet::SendExtensionRequestL, Entry"); |
|
1401 |
|
1402 CMceMsgSIPRequest* data = static_cast<CMceMsgSIPRequest*>( &aData ); |
|
1403 |
|
1404 CSIPMessageElements* elements = CSIPMessageElements::NewLC(); |
|
1405 |
|
1406 CSIPContentTypeHeader* contentType = NULL; |
|
1407 |
|
1408 HBufC8* content = iSession.PopClientContent(); |
|
1409 |
|
1410 if ( MCE_HAS_DATA( content ) ) |
|
1411 { |
|
1412 CleanupStack::PushL( content ); |
|
1413 |
|
1414 MCESRV_DEBUG_SVALUE( "Sending Session Request: content size", content->Length() ); |
|
1415 if ( MCE_HAS_DATA( data->iContentType ) ) |
|
1416 { |
|
1417 MCESRV_DEBUG_SVALUE( "SendExtensionRequestL: content type", *data->iContentType ); |
|
1418 contentType = MceSip::ToContentTypeHeaderL( |
|
1419 EMceContentTypeUserDefined, |
|
1420 data->iContentType ); |
|
1421 CleanupStack::PushL( contentType ); |
|
1422 } |
|
1423 else |
|
1424 { |
|
1425 MCESRV_DEBUG( "SendSessionRequestL: no content type -> no content" ); |
|
1426 CleanupStack::PopAndDestroy( content ); |
|
1427 content = NULL; |
|
1428 } |
|
1429 } |
|
1430 else |
|
1431 { |
|
1432 delete content; |
|
1433 content = NULL; |
|
1434 } |
|
1435 |
|
1436 if ( content ) |
|
1437 { |
|
1438 elements->SetContentL( content , contentType ); |
|
1439 CleanupStack::Pop( contentType ); |
|
1440 CleanupStack::Pop( content ); |
|
1441 } |
|
1442 |
|
1443 RStringF methodStr = SIPStrings::Pool().OpenFStringL(data->RequestMethod()->Des()); |
|
1444 CleanupClosePushL( methodStr ); |
|
1445 |
|
1446 TInt method = MceSip::SIPStringIndex( methodStr.DesC() ); |
|
1447 |
|
1448 //create extension headers |
|
1449 RPointerArray<CSIPHeaderBase> headers; |
|
1450 CSIPHeaderBase::PushLC( &headers ); |
|
1451 |
|
1452 // Add extension headers |
|
1453 AddExtensionHeadersL( headers, method, ETrue ); |
|
1454 |
|
1455 |
|
1456 //Add Extra SIP Headers. |
|
1457 AddHeadersL( headers, |
|
1458 data->iSIPHeaders, |
|
1459 KErrNotFound ); |
|
1460 |
|
1461 //create session timer headers |
|
1462 AddSessionTimerFieldsClientL( headers ); |
|
1463 |
|
1464 |
|
1465 //send request within session |
|
1466 elements->SetUserHeadersL( headers ); |
|
1467 CleanupStack::PopAndDestroy( &headers ); |
|
1468 |
|
1469 CSIPInviteDialogAssoc* dialog = |
|
1470 static_cast<CSIPInviteDialogAssoc*>( iSession.Dialog() ); |
|
1471 |
|
1472 MCESRV_DEBUG_METHOD("SendRequestL: sending ", method ); |
|
1473 |
|
1474 CSIPClientTransaction* trx = NULL; |
|
1475 |
|
1476 trx = dialog->SendNonTargetRefreshRequestL( methodStr, elements ); |
|
1477 |
|
1478 CleanupStack::PopAndDestroy(); //destroy methodStr |
|
1479 CleanupStack::Pop( elements ); |
|
1480 |
|
1481 CleanupStack::PushL( trx ); |
|
1482 |
|
1483 iSession.SetPendingTransactionL( trx ); |
|
1484 |
|
1485 CleanupStack::Pop( trx ); |
|
1486 |
|
1487 MCESRV_DEBUG_METHOD("SendExtensionRequestL: sent ", method ); |
|
1488 |
|
1489 aIds.iTransactionID = reinterpret_cast <TUint> (trx); |
|
1490 |
|
1491 MCESRV_DEBUG("TMceActionSet::SendExtensionRequestL, Exit"); |
|
1492 } |
|
1493 |
|
1494 // ----------------------------------------------------------------------------- |
|
1495 // TMceActionSet::SendRequestL |
|
1496 // ----------------------------------------------------------------------------- |
|
1497 // |
|
1498 void TMceActionSet::SendRequestL( TInt aMethod, CMceComSession* aData, |
|
1499 TBool aContent ) |
|
1500 { |
|
1501 MCESRV_DEBUG("TMceActionSet::SendRequestL, Entry"); |
|
1502 |
|
1503 __ASSERT_ALWAYS( iSession.Dialog(), User::Leave( KErrGeneral ) ); |
|
1504 |
|
1505 CSIPMessageElements* elements = CSIPMessageElements::NewLC(); |
|
1506 |
|
1507 //create content |
|
1508 CSdpDocument* offer = iSession.Offer(); |
|
1509 CSIPContentTypeHeader* contentType = NULL; |
|
1510 HBufC8* content = NULL; |
|
1511 |
|
1512 if ( aContent ) |
|
1513 { |
|
1514 |
|
1515 if ( offer |
|
1516 && aData |
|
1517 && MCE_HAS_DATA( aData->iSIPContentType ) |
|
1518 && MCE_HAS_DATA( aData->iSIPContent ) |
|
1519 ) |
|
1520 { |
|
1521 MCESRV_DEBUG("SendRequestL: creating multi-part content"); |
|
1522 content = CreateMultipartContentLC( *offer, |
|
1523 *aData->iSIPContentType, |
|
1524 *aData->iSIPContent ); |
|
1525 |
|
1526 contentType = MceSip::ToContentTypeHeaderL( EMceContentTypeMultiPart ); |
|
1527 CleanupStack::PushL( contentType ); |
|
1528 } |
|
1529 else if ( offer ) |
|
1530 { |
|
1531 MCESRV_DEBUG("SendRequestL: creating SDP content"); |
|
1532 content = CreateSDPContentLC( *offer ); |
|
1533 contentType = MceSip::ToContentTypeHeaderL( EMceContentTypeSDP ); |
|
1534 CleanupStack::PushL( contentType ); |
|
1535 } |
|
1536 else |
|
1537 { |
|
1538 MCESRV_DEBUG("SendRequestL: NO OFFER"); |
|
1539 //NOP |
|
1540 } |
|
1541 } |
|
1542 else |
|
1543 { |
|
1544 MCESRV_DEBUG("SendRequestL: NO OFFER"); |
|
1545 //NOP |
|
1546 } |
|
1547 |
|
1548 |
|
1549 if ( content ) |
|
1550 { |
|
1551 elements->SetContentL( content, contentType ); |
|
1552 CleanupStack::Pop( contentType ); |
|
1553 CleanupStack::Pop( content ); |
|
1554 } |
|
1555 |
|
1556 |
|
1557 //create extension headers |
|
1558 RPointerArray<CSIPHeaderBase> headers; |
|
1559 CSIPHeaderBase::PushLC( &headers ); |
|
1560 |
|
1561 // Add extension headers |
|
1562 AddExtensionHeadersL( headers, aMethod, ETrue ); |
|
1563 |
|
1564 // Add user defined headers |
|
1565 AddHeadersL( headers, |
|
1566 ( aData ? aData->iSIPHeaders : ActiveBody().iSIPHeaders ), |
|
1567 aMethod ); |
|
1568 |
|
1569 //create session timer headers |
|
1570 AddSessionTimerFieldsClientL( headers ); |
|
1571 |
|
1572 //send invitation |
|
1573 elements->SetUserHeadersL( headers ); |
|
1574 CleanupStack::PopAndDestroy( &headers ); |
|
1575 |
|
1576 CSIPInviteDialogAssoc* dialog = |
|
1577 static_cast<CSIPInviteDialogAssoc*>( iSession.Dialog() ); |
|
1578 |
|
1579 MCESRV_DEBUG_METHOD("SendRequestL: sending ", aMethod ); |
|
1580 |
|
1581 CSIPClientTransaction* trx = NULL; |
|
1582 switch ( aMethod ) |
|
1583 { |
|
1584 case SipStrConsts::EInvite: |
|
1585 { |
|
1586 trx = dialog->SendInviteL( elements ); |
|
1587 break; |
|
1588 } |
|
1589 case SipStrConsts::EUpdate: |
|
1590 { |
|
1591 trx = dialog->SendUpdateL( elements ); |
|
1592 break; |
|
1593 } |
|
1594 case SipStrConsts::EPrack: |
|
1595 { |
|
1596 trx = dialog->SendPrackL( elements ); |
|
1597 break; |
|
1598 } |
|
1599 default: |
|
1600 { |
|
1601 User::Leave( KErrNotSupported ); |
|
1602 break; |
|
1603 } |
|
1604 } |
|
1605 CleanupStack::Pop( elements ); |
|
1606 |
|
1607 CleanupStack::PushL( trx ); |
|
1608 iSession.SetPendingTransactionL( trx ); |
|
1609 |
|
1610 MCESRV_DEBUG_METHOD("SendRequestL: sent ", aMethod ); |
|
1611 |
|
1612 CleanupStack::Pop( trx ); |
|
1613 |
|
1614 if ( content ) |
|
1615 { |
|
1616 iSession.IncrementSentSdpCount(); |
|
1617 } |
|
1618 |
|
1619 MCESRV_DEBUG("TMceActionSet::SendRequestL, Exit"); |
|
1620 } |
|
1621 |
|
1622 // ----------------------------------------------------------------------------- |
|
1623 // TMceActionSet::SendDeclineL |
|
1624 // ----------------------------------------------------------------------------- |
|
1625 // |
|
1626 void TMceActionSet::SendDeclineL( CSIPServerTransaction& aRequest, |
|
1627 CMceMsgBase& aReply ) |
|
1628 { |
|
1629 MCESRV_DEBUG("TMceActionSet::SendDeclineL, Entry"); |
|
1630 |
|
1631 CMceMsgSIPReply* reply = static_cast<CMceMsgSIPReply*>( &aReply ); |
|
1632 TBool userReply = MCE_NOT_NULL_PTR( reply ); |
|
1633 |
|
1634 if ( !userReply ) |
|
1635 { |
|
1636 reply = new (ELeave) CMceMsgSIPReply(); |
|
1637 CleanupStack::PushL( reply ); |
|
1638 reply->iCode = KMceSipDecline; |
|
1639 reply->iReasonAsPoolIndex = SipStrConsts::EPhraseDecline; |
|
1640 } |
|
1641 |
|
1642 SendResponseL( aRequest, *reply ); |
|
1643 reply->Close(); |
|
1644 |
|
1645 if ( !userReply ) |
|
1646 { |
|
1647 CleanupStack::PopAndDestroy( reply ); |
|
1648 } |
|
1649 |
|
1650 MCESRV_DEBUG("TMceActionSet::SendDeclineL, Exit"); |
|
1651 |
|
1652 } |
|
1653 |
|
1654 // ----------------------------------------------------------------------------- |
|
1655 // TMceActionSet::SendRingL |
|
1656 // ----------------------------------------------------------------------------- |
|
1657 // |
|
1658 TBool TMceActionSet::SendRingL( CSIPServerTransaction& aRequest, |
|
1659 CMceMsgBase& aReply ) |
|
1660 { |
|
1661 MCESRV_DEBUG("TMceActionSet::SendRingL, Entry"); |
|
1662 |
|
1663 CMceMsgSIPReply* reply = static_cast<CMceMsgSIPReply*>( &aReply ); |
|
1664 TBool userReply = MCE_NOT_NULL_PTR( reply ); |
|
1665 |
|
1666 if ( !userReply ) |
|
1667 { |
|
1668 reply = new (ELeave) CMceMsgSIPReply(); |
|
1669 CleanupStack::PushL( reply ); |
|
1670 reply->iCode = KMceSipRinging; |
|
1671 reply->iReasonAsPoolIndex = SipStrConsts::EPhraseRinging; |
|
1672 } |
|
1673 |
|
1674 TBool reliable = SendResponseL( aRequest, *reply ); |
|
1675 reply->Close(); |
|
1676 |
|
1677 if ( !userReply ) |
|
1678 { |
|
1679 CleanupStack::PopAndDestroy( reply ); |
|
1680 } |
|
1681 |
|
1682 MCESRV_DEBUG("TMceActionSet::SendRingL, Exit"); |
|
1683 return reliable; |
|
1684 } |
|
1685 |
|
1686 // ----------------------------------------------------------------------------- |
|
1687 // TMceActionSet::SendSipQueuedL |
|
1688 // ----------------------------------------------------------------------------- |
|
1689 |
|
1690 TBool TMceActionSet::SendSipQueuedL( CSIPServerTransaction& aRequest, |
|
1691 CMceMsgBase& aReply ) |
|
1692 { |
|
1693 MCESRV_DEBUG("TMceActionSet::SendSipQueuedL, Entry"); |
|
1694 |
|
1695 CMceMsgSIPReply* reply = static_cast<CMceMsgSIPReply*>( &aReply ); |
|
1696 TBool userReply = MCE_NOT_NULL_PTR( reply ); |
|
1697 |
|
1698 if ( !userReply ) |
|
1699 { |
|
1700 User::Leave( KErrArgument ); |
|
1701 } |
|
1702 |
|
1703 TBool reliable = SendResponseL( aRequest, *reply ); |
|
1704 reply->Close(); |
|
1705 |
|
1706 if ( !userReply ) |
|
1707 { |
|
1708 CleanupStack::PopAndDestroy( reply ); |
|
1709 } |
|
1710 |
|
1711 MCESRV_DEBUG("TMceActionSet::SendSipQueuedL, Exit"); |
|
1712 return reliable; |
|
1713 } |
|
1714 |
|
1715 |
|
1716 // ----------------------------------------------------------------------------- |
|
1717 // TMceActionSet::SendResponseL |
|
1718 // ----------------------------------------------------------------------------- |
|
1719 // |
|
1720 void TMceActionSet::SendResponseL( CSIPServerTransaction& aRequest, |
|
1721 TUint32 aCode, |
|
1722 TInt aReason ) |
|
1723 { |
|
1724 MCESRV_DEBUG("TMceActionSet::SendResponseL, Entry"); |
|
1725 |
|
1726 |
|
1727 CMceMsgSIPReply* reply = new (ELeave) CMceMsgSIPReply(); |
|
1728 CleanupStack::PushL( reply ); |
|
1729 reply->iCode = aCode; |
|
1730 reply->iReasonAsPoolIndex = aReason; |
|
1731 reply->iContentTypeId = EMceContentTypeSDP; |
|
1732 |
|
1733 if ( aReason == KMceAutoReasonPhrase ) |
|
1734 { |
|
1735 RStringF reasonPhrase = MceSip::ReasonPhraseL( aCode ); |
|
1736 CleanupClosePushL( reasonPhrase ); |
|
1737 reply->iReasonAsPoolIndex = reasonPhrase.Index( SIPStrings::Table() ); |
|
1738 reply->iContentTypeId = (TMceContentType)KMceNotAssigned; |
|
1739 CleanupStack::PopAndDestroy();//reasonPhrase |
|
1740 |
|
1741 } |
|
1742 if ( aReason == KMceSipPreconditionFailure ) |
|
1743 { |
|
1744 reply->iReasonAsPoolIndex = 0; |
|
1745 HBufC8* reason = KMceSipErrPhrase580().AllocLC(); |
|
1746 MCE_DELETE( reply->iReason ); |
|
1747 reply->iReason = reason; |
|
1748 CleanupStack::Pop( reason ); |
|
1749 } |
|
1750 |
|
1751 SendResponseL( aRequest, *reply ); |
|
1752 //delete header, icontent type and iheader, reason |
|
1753 reply->Close(); |
|
1754 CleanupStack::PopAndDestroy( reply ); |
|
1755 |
|
1756 MCESRV_DEBUG("TMceActionSet::SendResponseL, Exit"); |
|
1757 |
|
1758 } |
|
1759 |
|
1760 |
|
1761 |
|
1762 // ----------------------------------------------------------------------------- |
|
1763 // TMceActionSet::SendRejectOfferWithWarningL |
|
1764 // ----------------------------------------------------------------------------- |
|
1765 // |
|
1766 void TMceActionSet::SendRejectOfferWithWarningL( |
|
1767 TMceSipWarningCode aReason, |
|
1768 CSIPServerTransaction& aInvite ) |
|
1769 { |
|
1770 |
|
1771 if ( aReason >= KMceSipBadRequest && |
|
1772 aReason <= KMceSip6XXNotAcceptable ) |
|
1773 { |
|
1774 if ( aReason == KMceSipPreconditionFailure ) |
|
1775 { |
|
1776 SendResponseL( aInvite, (TUint32)aReason, KMceSipPreconditionFailure ); |
|
1777 } |
|
1778 else |
|
1779 { |
|
1780 SendResponseL( aInvite, (TUint32)aReason, KMceAutoReasonPhrase ); |
|
1781 } |
|
1782 } |
|
1783 else |
|
1784 { |
|
1785 SendWarningResponseL( KMceSipNotAcceptableHere, aReason, aInvite ); |
|
1786 } |
|
1787 } |
|
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 // ----------------------------------------------------------------------------- |
|
1794 // TMceActionSet::SendWarningResponseL |
|
1795 // ----------------------------------------------------------------------------- |
|
1796 // |
|
1797 void TMceActionSet::SendWarningResponseL( const TUint aResponseCode, |
|
1798 const TUint aWarnCode, |
|
1799 CSIPServerTransaction& aRequest ) |
|
1800 { |
|
1801 |
|
1802 MCESRV_DEBUG("TMceActionSet::SendWarningResponseL, Entry"); |
|
1803 MCESRV_DEBUG_DVALUES( "response", aResponseCode, "warning", aWarnCode ); |
|
1804 |
|
1805 const TInt KPopCount = 2; |
|
1806 |
|
1807 RStringF reasonPhrase = MceSip::ReasonPhraseL( aResponseCode ); |
|
1808 CleanupClosePushL( reasonPhrase ); |
|
1809 RStringF warningPhrase = MceSip::WarningPhraseL( aWarnCode ); |
|
1810 CleanupClosePushL( warningPhrase ); |
|
1811 |
|
1812 CSIPResponseElements* response = |
|
1813 CSIPResponseElements::NewLC( aResponseCode, reasonPhrase ); |
|
1814 |
|
1815 CSIPMessageElements& responseMessageElements = |
|
1816 response->MessageElements(); |
|
1817 |
|
1818 const CSIPRequestElements* requestElements = aRequest.RequestElements(); |
|
1819 const TDesC8& domain = |
|
1820 requestElements->RemoteUri().Uri().Extract( EUriHost ); |
|
1821 |
|
1822 // Create SIPExtensionHeader: |
|
1823 const TInt warnCodeLength = 3; |
|
1824 TInt warnLenght = KMceSipWarningPattern().Length() + domain.Length() + |
|
1825 warningPhrase.DesC().Length() + warnCodeLength; |
|
1826 HBufC8* warning = HBufC8::NewLC( warnLenght ); |
|
1827 warning->Des().AppendFormat( KMceSipWarningPattern, aWarnCode, |
|
1828 &domain, &(warningPhrase.DesC()) ); |
|
1829 |
|
1830 RPointerArray< CSIPHeaderBase > headerArray; |
|
1831 CSIPHeaderBase::PushLC( &headerArray ); |
|
1832 |
|
1833 CSIPExtensionHeader* sipExtensionWarningHeader = |
|
1834 CSIPExtensionHeader::NewLC( KMceSipWarning, *warning ); |
|
1835 |
|
1836 headerArray.AppendL( sipExtensionWarningHeader ); |
|
1837 CleanupStack::Pop( sipExtensionWarningHeader ); |
|
1838 |
|
1839 responseMessageElements.SetUserHeadersL( headerArray ); |
|
1840 CleanupStack::Pop( &headerArray );// headerArray |
|
1841 |
|
1842 CleanupStack::PopAndDestroy( warning ); |
|
1843 |
|
1844 aRequest.SendResponseL( response ); |
|
1845 |
|
1846 |
|
1847 CleanupStack::Pop( response ); |
|
1848 CleanupStack::PopAndDestroy( KPopCount );//warningPhrase,reasonPhrase |
|
1849 |
|
1850 MCESRV_DEBUG("TMceActionSet::SendWarningResponseL, Entry"); |
|
1851 } |
|
1852 |
|
1853 // ----------------------------------------------------------------------------- |
|
1854 // TMceActionSet::SendResponseL |
|
1855 // ----------------------------------------------------------------------------- |
|
1856 // |
|
1857 TBool TMceActionSet::SendResponseL( CSIPServerTransaction& aRequest, |
|
1858 CMceMsgSIPReply& aResponse ) |
|
1859 { |
|
1860 MCESRV_DEBUG("TMceActionSet::SendResponseL( custom ), Entry"); |
|
1861 MCESRV_DEBUG_DVALUE( "reason", aResponse.iCode ); |
|
1862 |
|
1863 CSIPResponseElements* response = NULL; |
|
1864 |
|
1865 if ( !aResponse.iReasonAsPoolIndex ) |
|
1866 { |
|
1867 MCESRV_DEBUG_SVALUE( "phrase", *aResponse.iReason ); |
|
1868 |
|
1869 RStringF reasonPhrase = |
|
1870 SIPStrings::Pool().OpenFStringL( *aResponse.iReason ); |
|
1871 CleanupClosePushL( reasonPhrase ); |
|
1872 |
|
1873 response = |
|
1874 CSIPResponseElements::NewL( aResponse.iCode, reasonPhrase ); |
|
1875 |
|
1876 CleanupStack::PopAndDestroy();//reasonPhrase |
|
1877 CleanupStack::PushL( response ); |
|
1878 } |
|
1879 else |
|
1880 { |
|
1881 MCESRV_DEBUG_SVALUE( "phrase", |
|
1882 SIPStrings::StringF( aResponse.iReasonAsPoolIndex ).DesC() ); |
|
1883 |
|
1884 response = |
|
1885 CSIPResponseElements::NewLC( aResponse.iCode, |
|
1886 SIPStrings::StringF( aResponse.iReasonAsPoolIndex ) ); |
|
1887 } |
|
1888 |
|
1889 CSIPMessageElements& elements = response->MessageElements(); |
|
1890 RPointerArray<CSIPHeaderBase> headers; |
|
1891 CSIPHeaderBase::PushLC( &headers ); |
|
1892 |
|
1893 TBool reliable = AddExtensionHeadersL( |
|
1894 headers, |
|
1895 aRequest.Type().Index( SIPStrings::Table() ), |
|
1896 aResponse.iContentTypeId == EMceContentTypeSDP ? ETrue : EFalse, |
|
1897 ETrue, |
|
1898 aResponse.iCode ); |
|
1899 |
|
1900 if ( !MCE_HAS_DATA( aResponse.iSIPHeaders ) ) |
|
1901 { |
|
1902 AddHeadersL( headers, |
|
1903 ActiveBody().iSIPHeaders, |
|
1904 KErrNotFound ); |
|
1905 } |
|
1906 else |
|
1907 { |
|
1908 AddHeadersL( headers, |
|
1909 aResponse.iSIPHeaders, |
|
1910 KErrNotFound ); |
|
1911 } |
|
1912 |
|
1913 if ( ( aRequest.Type() == SIPStrings::StringF( SipStrConsts::EInvite ) || |
|
1914 aRequest.Type() == SIPStrings::StringF( SipStrConsts::EUpdate ) ) && |
|
1915 aResponse.iCode == KMceSipOK ) |
|
1916 { |
|
1917 //add timer headers only to 200 OK of invite |
|
1918 AddSessionTimerFieldsServerL( headers ); |
|
1919 } |
|
1920 |
|
1921 elements.SetUserHeadersL( headers ); |
|
1922 CleanupStack::Pop( &headers ); |
|
1923 |
|
1924 CSIPContentTypeHeader* contentType = NULL; |
|
1925 HBufC8* content = NULL; |
|
1926 CSdpDocument* offer = iSession.Offer(); |
|
1927 |
|
1928 if ( aResponse.iContentTypeId == EMceContentTypeMultiPart ) |
|
1929 { |
|
1930 MCESRV_DEBUG( "SendResponseL: content type=\"multipart/mixed\""); |
|
1931 content = CreateMultipartContentLC( *offer, |
|
1932 *ActiveBody().iSIPContentType, |
|
1933 *ActiveBody().iSIPContent ); |
|
1934 |
|
1935 contentType = |
|
1936 MceSip::ToContentTypeHeaderL( EMceContentTypeMultiPart ); |
|
1937 CleanupStack::PushL( contentType ); |
|
1938 } |
|
1939 else if ( aResponse.iContentTypeId == EMceContentTypeSDP ) |
|
1940 { |
|
1941 MCESRV_DEBUG( "SendResponseL: content type=\"application/sdp\""); |
|
1942 content = CreateSDPContentLC( *offer ); |
|
1943 contentType = MceSip::ToContentTypeHeaderL( EMceContentTypeSDP ); |
|
1944 CleanupStack::PushL( contentType ); |
|
1945 } |
|
1946 else if ( aResponse.iContentTypeId == EMceContentTypeUserDefined && |
|
1947 MCE_HAS_DATA( aResponse.iContentType ) ) |
|
1948 { |
|
1949 MCESRV_DEBUG_SVALUE( |
|
1950 "SendResponseL: content type", *aResponse.iContentType ); |
|
1951 content = iSession.PopClientContent(); |
|
1952 if ( content ) |
|
1953 { |
|
1954 CleanupStack::PushL( content ); |
|
1955 contentType = MceSip::ToContentTypeHeaderL( |
|
1956 EMceContentTypeUserDefined, |
|
1957 aResponse.iContentType ); |
|
1958 CleanupStack::PushL( contentType ); |
|
1959 } |
|
1960 else |
|
1961 { |
|
1962 MCESRV_DEBUG( "SendResponseL: no content"); |
|
1963 } |
|
1964 } |
|
1965 else |
|
1966 { |
|
1967 MCESRV_DEBUG( "SendResponseL: no content"); |
|
1968 } |
|
1969 |
|
1970 |
|
1971 if ( content ) |
|
1972 { |
|
1973 elements.SetContentL( content, contentType ); |
|
1974 CleanupStack::Pop( contentType ); |
|
1975 CleanupStack::Pop( content ); |
|
1976 } |
|
1977 |
|
1978 |
|
1979 if ( reliable ) |
|
1980 { |
|
1981 CMceReliableSender& reliableSend = iSession.ReliableSender(); |
|
1982 reliableSend.SendResponseL( aRequest, response ); |
|
1983 CleanupStack::Pop( response ); |
|
1984 } |
|
1985 |
|
1986 else |
|
1987 { |
|
1988 aRequest.SendResponseL( response ); |
|
1989 CleanupStack::Pop( response ); |
|
1990 MCESRV_DEBUG("TMceActionSet::SendResponseL( custom ), Exit"); |
|
1991 } |
|
1992 |
|
1993 if ( aResponse.iContentTypeId == EMceContentTypeMultiPart || |
|
1994 aResponse.iContentTypeId == EMceContentTypeSDP ) |
|
1995 { |
|
1996 iSession.IncrementSentSdpCount(); |
|
1997 } |
|
1998 |
|
1999 return reliable; |
|
2000 } |
|
2001 |
|
2002 // ----------------------------------------------------------------------------- |
|
2003 // TMceActionSet::SendACKL |
|
2004 // ----------------------------------------------------------------------------- |
|
2005 // |
|
2006 void TMceActionSet::SendACKL( CSIPClientTransaction& aResponse ) |
|
2007 { |
|
2008 MCESRV_DEBUG("TMceActionSet::SendACKL, Entry"); |
|
2009 |
|
2010 CSIPMessageElements* ack = CSIPMessageElements::NewLC(); |
|
2011 |
|
2012 AddHeadersL( *ack, NULL, SipStrConsts::EAck ); |
|
2013 static_cast<CSIPInviteDialogAssoc*> |
|
2014 ( iSession.Dialog() )->SendAckL( aResponse, ack ); |
|
2015 CleanupStack::Pop( ack ); |
|
2016 MCESRV_DEBUG("TMceActionSet::SendACKL, Exit"); |
|
2017 } |
|
2018 |
|
2019 // ----------------------------------------------------------------------------- |
|
2020 // TMceActionSet::SendBYEL |
|
2021 // ----------------------------------------------------------------------------- |
|
2022 // |
|
2023 void TMceActionSet::SendBYEL() |
|
2024 { |
|
2025 MCESRV_DEBUG("TMceActionSet::SendBYEL, Entry"); |
|
2026 |
|
2027 CSIPMessageElements* bye = CSIPMessageElements::NewLC(); |
|
2028 AddHeadersL( *bye, NULL, SipStrConsts::EBye ); |
|
2029 |
|
2030 CSIPClientTransaction* trx = static_cast<CSIPInviteDialogAssoc*> |
|
2031 ( iSession.Dialog() )->SendByeL( bye ); |
|
2032 CleanupStack::Pop( bye ); |
|
2033 CleanupStack::PushL( trx ); |
|
2034 iSession.SetPendingTransactionL( trx ); |
|
2035 CleanupStack::Pop( trx ); |
|
2036 |
|
2037 MCESRV_DEBUG("TMceActionSet::SendBYEL, Exit"); |
|
2038 } |
|
2039 |
|
2040 // ----------------------------------------------------------------------------- |
|
2041 // TMceActionSet::SendBYEL |
|
2042 // ----------------------------------------------------------------------------- |
|
2043 // |
|
2044 void TMceActionSet::SendBYEL( CMceMsgBase& aData ) |
|
2045 { |
|
2046 MCESRV_DEBUG("TMceActionSet::SendBYEL(data), Entry"); |
|
2047 |
|
2048 CMceMsgSIPData* data = static_cast<CMceMsgSIPData*>( &aData ); |
|
2049 |
|
2050 if ( !data ) |
|
2051 { |
|
2052 SendBYEL(); |
|
2053 return; |
|
2054 } |
|
2055 |
|
2056 CSIPMessageElements* bye = CSIPMessageElements::NewLC(); |
|
2057 |
|
2058 AddHeadersL( *bye, data->iSIPHeaders, SipStrConsts::EBye ); |
|
2059 |
|
2060 CSIPContentTypeHeader* contentType = NULL; |
|
2061 HBufC8* content = iSession.PopClientContent(); |
|
2062 if ( MCE_HAS_DATA( content ) ) |
|
2063 { |
|
2064 CleanupStack::PushL( content ); |
|
2065 MCESRV_DEBUG_SVALUE( "SendBYEL: content size", content->Length() ); |
|
2066 if ( MCE_HAS_DATA( data->iContentType ) ) |
|
2067 { |
|
2068 MCESRV_DEBUG_SVALUE( "SendBYEL: content type", *data->iContentType ); |
|
2069 contentType = MceSip::ToContentTypeHeaderL( |
|
2070 EMceContentTypeUserDefined, |
|
2071 data->iContentType ); |
|
2072 CleanupStack::PushL( contentType ); |
|
2073 } |
|
2074 else |
|
2075 { |
|
2076 MCESRV_DEBUG( "SendBYEL: no content type -> no content" ); |
|
2077 CleanupStack::PopAndDestroy( content ); |
|
2078 content = NULL; |
|
2079 } |
|
2080 } |
|
2081 else |
|
2082 { |
|
2083 delete content; |
|
2084 content = NULL; |
|
2085 } |
|
2086 |
|
2087 if ( content ) |
|
2088 { |
|
2089 bye->SetContentL( content , contentType ); |
|
2090 CleanupStack::Pop( contentType ); |
|
2091 CleanupStack::Pop( content ); |
|
2092 } |
|
2093 |
|
2094 aData.Close(); |
|
2095 |
|
2096 CSIPClientTransaction* trx = static_cast<CSIPInviteDialogAssoc*> |
|
2097 ( iSession.Dialog() )->SendByeL( bye ); |
|
2098 CleanupStack::Pop( bye ); |
|
2099 CleanupStack::PushL( trx ); |
|
2100 iSession.SetPendingTransactionL( trx ); |
|
2101 CleanupStack::Pop( trx ); |
|
2102 |
|
2103 MCESRV_DEBUG("TMceActionSet::SendBYEL(data), Exit"); |
|
2104 } |
|
2105 |
|
2106 // ----------------------------------------------------------------------------- |
|
2107 // TMceActionSet::Send200OKL |
|
2108 // ----------------------------------------------------------------------------- |
|
2109 // |
|
2110 void TMceActionSet::Send200OKL( CSIPServerTransaction& aRequest ) |
|
2111 { |
|
2112 MCESRV_DEBUG("TMceActionSet::Send200OKL, Entry"); |
|
2113 |
|
2114 CMceMsgSIPReply* reply = new (ELeave) CMceMsgSIPReply(); |
|
2115 CleanupStack::PushL( reply ); |
|
2116 reply->iCode = KMceSipOK; |
|
2117 reply->iReasonAsPoolIndex = SipStrConsts::EPhraseOk; |
|
2118 |
|
2119 SendResponseL( aRequest, *reply ); |
|
2120 |
|
2121 CleanupStack::PopAndDestroy( reply ); |
|
2122 |
|
2123 MCESRV_DEBUG("TMceActionSet::Send200OKL, Exit"); |
|
2124 } |
|
2125 |
|
2126 // ----------------------------------------------------------------------------- |
|
2127 // TMceActionSet::SendCancelL |
|
2128 // ----------------------------------------------------------------------------- |
|
2129 // |
|
2130 TBool TMceActionSet::SendCancelL() |
|
2131 { |
|
2132 MCESRV_DEBUG("TMceActionSet::SendCancelL, Entry"); |
|
2133 TBool cancelSent = ETrue; |
|
2134 |
|
2135 CSIPClientTransaction* inviteTransaction = iSession.InviteTransaction(); |
|
2136 |
|
2137 __ASSERT_ALWAYS( inviteTransaction, User::Leave( KErrGeneral ) ); |
|
2138 __ASSERT_ALWAYS( inviteTransaction->CancelAllowed(), |
|
2139 User::Leave( KErrGeneral ) ); |
|
2140 |
|
2141 CSIPTransactionBase::TState trxState = |
|
2142 MceSip::TrxState( *inviteTransaction ); |
|
2143 |
|
2144 if ( trxState == CSIPTransactionBase::EProceeding ) |
|
2145 { |
|
2146 CSIPClientTransaction* trx = inviteTransaction->CancelL(); |
|
2147 CleanupStack::PushL( trx ); |
|
2148 iSession.SetPendingTransactionL( trx ); |
|
2149 CleanupStack::Pop( trx ); |
|
2150 } |
|
2151 else |
|
2152 { |
|
2153 MCESRV_DEBUG_DVALUE( |
|
2154 "SendCancelL: CANCEL is not sent. Trx state", trxState ); |
|
2155 cancelSent = EFalse; |
|
2156 } |
|
2157 |
|
2158 MCESRV_DEBUG("TMceActionSet::SendCancelL, Exit"); |
|
2159 |
|
2160 return cancelSent; |
|
2161 |
|
2162 } |
|
2163 |
|
2164 // ----------------------------------------------------------------------------- |
|
2165 // TMceActionSet::InterruptConfirming |
|
2166 // ----------------------------------------------------------------------------- |
|
2167 // |
|
2168 TBool TMceActionSet::InterruptConfirming() |
|
2169 { |
|
2170 MCESRV_DEBUG("TMceActionSet::InterruptConfirming, Entry"); |
|
2171 |
|
2172 TBool interrupted = EFalse; |
|
2173 CSIPClientTransaction* pending = iSession.PendingTransaction( |
|
2174 SIPStrings::StringF( SipStrConsts::EUpdate ) ); |
|
2175 pending = ( pending && !MceSip::TrxCompleted( *pending ) |
|
2176 ? pending : NULL ); |
|
2177 |
|
2178 if ( !pending ) |
|
2179 { |
|
2180 MCESRV_DEBUG("TMceActionSet::InterruptConfirming, search PRACK"); |
|
2181 // no UPDATE so search for PRACK |
|
2182 pending = iSession.PendingTransaction( |
|
2183 SIPStrings::StringF( SipStrConsts::EPrack ) ); |
|
2184 pending = ( pending && !MceSip::TrxCompleted( *pending ) |
|
2185 ? pending : NULL ); |
|
2186 } |
|
2187 |
|
2188 if ( pending ) |
|
2189 { |
|
2190 MCESRV_DEBUG("TMceActionSet::InterruptConfirming, removing"); |
|
2191 iSession.RemovePendingTrx( *pending ); |
|
2192 delete pending; |
|
2193 interrupted = ETrue; |
|
2194 } |
|
2195 |
|
2196 MCESRV_DEBUG("TMceActionSet::InterruptConfirming, Exit"); |
|
2197 return interrupted; |
|
2198 } |
|
2199 |
|
2200 // ----------------------------------------------------------------------------- |
|
2201 // TMceActionSet::ControlMediaL |
|
2202 // ----------------------------------------------------------------------------- |
|
2203 // |
|
2204 HBufC8* TMceActionSet::ControlMediaL( TMceIds& aIds, TMceItcFunctions aAction ) |
|
2205 |
|
2206 { |
|
2207 MCESRV_DEBUG("TMceActionSet::ControlMediaL, Entry"); |
|
2208 MCESRV_DEBUG_EVENT("action", aAction ); |
|
2209 |
|
2210 __ASSERT_ALWAYS( iSession.iBody, User::Leave( KErrNotReady ) ); |
|
2211 |
|
2212 HBufC8* returnMessage = NULL; |
|
2213 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
2214 |
|
2215 TMceComEventHandler handler( mediaManager, returnMessage ); |
|
2216 TMceComEvent event( aIds, NULL, aAction, handler ); |
|
2217 |
|
2218 ActiveBody().EventReceivedL( event ); |
|
2219 |
|
2220 MCESRV_DEBUG("TMceActionSet::ControlMediaL, Exit"); |
|
2221 |
|
2222 return returnMessage; |
|
2223 } |
|
2224 |
|
2225 // ----------------------------------------------------------------------------- |
|
2226 // TMceActionSet::ControlMediaL |
|
2227 // ----------------------------------------------------------------------------- |
|
2228 // |
|
2229 void TMceActionSet::ControlMediaL( TMceIds& aIds, TMceItcFunctions aAction, |
|
2230 const TDesC8& aMessage ) |
|
2231 { |
|
2232 MCESRV_DEBUG("TMceActionSet::ControlMediaL, Entry"); |
|
2233 MCESRV_DEBUG_EVENT("action", aAction ); |
|
2234 |
|
2235 __ASSERT_ALWAYS( iSession.iBody, User::Leave( KErrNotReady ) ); |
|
2236 |
|
2237 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
2238 |
|
2239 TMceComEventHandler handler( mediaManager, aMessage ); |
|
2240 TMceComEvent event( aIds, NULL, aAction, handler ); |
|
2241 |
|
2242 ActiveBody().EventReceivedL( event ); |
|
2243 |
|
2244 MCESRV_DEBUG("TMceActionSet::ControlMediaL, Exit"); |
|
2245 } |
|
2246 |
|
2247 // ----------------------------------------------------------------------------- |
|
2248 // TMceActionSet::ControlMediaL |
|
2249 // ----------------------------------------------------------------------------- |
|
2250 // |
|
2251 void TMceActionSet::ControlMediaL( TMceIds& aIds, TMceItcFunctions aAction, |
|
2252 TPtr8& aMessage ) |
|
2253 { |
|
2254 MCESRV_DEBUG("TMceActionSet::ControlMediaL, Entry"); |
|
2255 MCESRV_DEBUG_EVENT("action", aAction ); |
|
2256 |
|
2257 __ASSERT_ALWAYS( iSession.iBody, User::Leave( KErrNotReady ) ); |
|
2258 |
|
2259 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
2260 |
|
2261 TMceComEventHandler handler( mediaManager, aMessage ); |
|
2262 TMceComEvent event( aIds, NULL, aAction, handler ); |
|
2263 |
|
2264 ActiveBody().EventReceivedL( event ); |
|
2265 |
|
2266 MCESRV_DEBUG("TMceActionSet::ControlMediaL, Exit"); |
|
2267 } |
|
2268 |
|
2269 // ----------------------------------------------------------------------------- |
|
2270 // TMceActionSet::StopMedia |
|
2271 // ----------------------------------------------------------------------------- |
|
2272 // |
|
2273 void TMceActionSet::StopMedia() |
|
2274 { |
|
2275 MCESRV_DEBUG("TMceActionSet::StopMedia, Entry"); |
|
2276 |
|
2277 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
2278 |
|
2279 if ( iSession.BodyCandidate() ) |
|
2280 { |
|
2281 mediaManager.CloseSession( *iSession.BodyCandidate() ); |
|
2282 } |
|
2283 if ( iSession.Body() ) |
|
2284 { |
|
2285 iSession.CloseMedia(); |
|
2286 } |
|
2287 |
|
2288 MCESRV_DEBUG("TMceActionSet::StopMedia, Exit"); |
|
2289 } |
|
2290 |
|
2291 // ----------------------------------------------------------------------------- |
|
2292 // TMceActionSet::StopUpdatingMedia |
|
2293 // ----------------------------------------------------------------------------- |
|
2294 // |
|
2295 void TMceActionSet::StopUpdatingMedia() |
|
2296 { |
|
2297 MCESRV_DEBUG("TMceActionSet::StopUpdatingMedia, Entry"); |
|
2298 |
|
2299 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
2300 |
|
2301 if ( iSession.BodyCandidate() && |
|
2302 iSession.SubState() == CMceSipSession::EUpdating) |
|
2303 { |
|
2304 mediaManager.CloseSession( *iSession.BodyCandidate() ); |
|
2305 } |
|
2306 |
|
2307 MCESRV_DEBUG("TMceActionSet::StopUpdatingMedia, Exit"); |
|
2308 } |
|
2309 |
|
2310 // ----------------------------------------------------------------------------- |
|
2311 // TMceActionSet::ClientMediaStateChanged |
|
2312 // ----------------------------------------------------------------------------- |
|
2313 // |
|
2314 void TMceActionSet::ClientMediaStateChangedL( TMceMccComEvent* aMccEvent, |
|
2315 TMceMediaEventCode aEvent ) |
|
2316 { |
|
2317 MCESRV_DEBUG("TMceActionSet::ClientMediaStateChanged, Entry"); |
|
2318 |
|
2319 if ( aMccEvent && |
|
2320 aMccEvent->iItcEvent != EMceItcNotAssigned && |
|
2321 aMccEvent->iStream ) |
|
2322 { |
|
2323 |
|
2324 if ( aEvent == EMceMediaError && aMccEvent->iError == KErrHostUnreach ) |
|
2325 { |
|
2326 // If there have been too many ICMP errors, pause the stream. |
|
2327 const RPointerArray< CMceComMediaSink >& sinks = aMccEvent->iStream->Sinks(); |
|
2328 |
|
2329 for ( TInt i=0 ; i<sinks.Count() ; ++i ) |
|
2330 { |
|
2331 if ( sinks[i]->MccType() == KUidMccRtpSink ) |
|
2332 { |
|
2333 iSession.Manager().MediaManager().PauseL( *sinks[i] ); |
|
2334 } |
|
2335 } |
|
2336 |
|
2337 } |
|
2338 |
|
2339 TMceIds ids; |
|
2340 ids.iCallbackID = aMccEvent->iItcEvent; |
|
2341 ids.iMediaID = aMccEvent->iStream->Id(); |
|
2342 ids.iSinkID = aMccEvent->iSink ? aMccEvent->iSink->Id() : KMceMediaIdNotAssigned; |
|
2343 ids.iSourceID = aMccEvent->iSource ? aMccEvent->iSource->Id() : KMceMediaIdNotAssigned; |
|
2344 ids.iState = aMccEvent->iItcData; |
|
2345 ids.iStatus = aMccEvent->iError; |
|
2346 |
|
2347 iSession.SendToClient( ids ); |
|
2348 } |
|
2349 else |
|
2350 { |
|
2351 MCESRV_DEBUG("ClientMediaStateChanged: No target"); |
|
2352 } |
|
2353 |
|
2354 MCESRV_DEBUG("TMceActionSet::ClientMediaStateChanged, Exit"); |
|
2355 } |
|
2356 |
|
2357 // ----------------------------------------------------------------------------- |
|
2358 // TMceActionSet::ClientErrorOccured |
|
2359 // ----------------------------------------------------------------------------- |
|
2360 // |
|
2361 void TMceActionSet::ClientErrorOccured( TInt aError ) |
|
2362 { |
|
2363 MCESRV_DEBUG("TMceActionSet::ClientErrorOccured, Entry"); |
|
2364 MCESRV_DEBUG_DVALUE("error", aError ); |
|
2365 |
|
2366 TMceIds ids; |
|
2367 |
|
2368 ids.iCallbackID = EMceItcStateChanged; |
|
2369 ids.iState = CMceSession::ETerminated; |
|
2370 |
|
2371 iSession.SendErrorToClient( ids, aError ); |
|
2372 |
|
2373 MCESRV_DEBUG("TMceActionSet::ClientErrorOccured, Exit"); |
|
2374 } |
|
2375 |
|
2376 |
|
2377 // |
|
2378 // SDP manipulation |
|
2379 // |
|
2380 |
|
2381 // ----------------------------------------------------------------------------- |
|
2382 // TMceComEventHandler::CreateMultipartContentL |
|
2383 // ----------------------------------------------------------------------------- |
|
2384 // |
|
2385 HBufC8* TMceActionSet::CreateMultipartContentLC( CSdpDocument& aDocument, |
|
2386 const TDesC8& aMixedContentType, |
|
2387 const TDesC8& aMixedContent ) |
|
2388 { |
|
2389 MCESRV_DEBUG("TMceActionSet::CreateMultipartContentL, Entry"); |
|
2390 HBufC8* sdpOffer = CreateSDPContentLC( aDocument ); |
|
2391 |
|
2392 const TDesC8& sdp = *sdpOffer; |
|
2393 TInt length = KMceSipMPartMessagePattern().Length() + sdp.Length() + |
|
2394 aMixedContentType.Length() + aMixedContent.Length(); |
|
2395 HBufC8* content = HBufC8::NewL( length ); |
|
2396 |
|
2397 content->Des().AppendFormat( KMceSipMPartMessagePattern, |
|
2398 &sdp, |
|
2399 &aMixedContentType, |
|
2400 &aMixedContent ); |
|
2401 |
|
2402 CleanupStack::PopAndDestroy( sdpOffer ); |
|
2403 CleanupStack::PushL( content ); |
|
2404 |
|
2405 MCESRV_DEBUG("TMceActionSet::CreateMultipartContentL, Exit"); |
|
2406 |
|
2407 return content; |
|
2408 } |
|
2409 |
|
2410 // ----------------------------------------------------------------------------- |
|
2411 // TMceActionSet::CreateSDPContentLC |
|
2412 // ----------------------------------------------------------------------------- |
|
2413 // |
|
2414 HBufC8* TMceActionSet::CreateSDPContentLC( CSdpDocument& aDocument ) |
|
2415 { |
|
2416 MCESRV_DEBUG("TMceActionSet::CreateSDPContentLC, Entry"); |
|
2417 |
|
2418 CBufFlat* encBuf = CBufFlat::NewL( KMaxLengthOfSDPMessage ); |
|
2419 CleanupStack::PushL( encBuf ); |
|
2420 RBufWriteStream writeStream; |
|
2421 writeStream.Open( *encBuf ); |
|
2422 aDocument.EncodeL( writeStream ); |
|
2423 writeStream.Close(); |
|
2424 TPtr8 encBufPtr = encBuf->Ptr(0); |
|
2425 HBufC8* sdpBuf = sdpBuf = encBufPtr.AllocL(); |
|
2426 CleanupStack::PopAndDestroy( encBuf ); |
|
2427 CleanupStack::PushL( sdpBuf ); |
|
2428 |
|
2429 MCESRV_DEBUG("TMceActionSet::CreateSDPContentLC, Exit"); |
|
2430 |
|
2431 return sdpBuf; |
|
2432 } |
|
2433 |
|
2434 // ----------------------------------------------------------------------------- |
|
2435 // TMceActionSet::AddHeadersL |
|
2436 // ----------------------------------------------------------------------------- |
|
2437 // |
|
2438 void TMceActionSet::AddHeadersL( CSIPMessageElements& aMessageElements, |
|
2439 CDesC8Array* aPrimaryHeaders, |
|
2440 TInt aMethodInd ) |
|
2441 { |
|
2442 RPointerArray<CSIPHeaderBase> headers; |
|
2443 CSIPHeaderBase::PushLC( &headers ); |
|
2444 TInt allowInd = SipStrConsts::EAllowHeader; |
|
2445 AddHeadersL( headers, aPrimaryHeaders, aMethodInd ); |
|
2446 |
|
2447 //if allow header is there add all UA supported headers |
|
2448 |
|
2449 CSIPHeaderBase* allowHeader = MceSip::FindHeader( headers, |
|
2450 SIPStrings::StringF( SipStrConsts::EAllowHeader )); |
|
2451 if ( allowHeader ) |
|
2452 { |
|
2453 RArray<TInt> allowMethods; |
|
2454 CleanupClosePushL(allowMethods); |
|
2455 TInt index =0; |
|
2456 MceSip::BasicAllowMethodsL( allowMethods ); |
|
2457 |
|
2458 for ( index =0; index < allowMethods.Count(); index ++) |
|
2459 { |
|
2460 if ( !MceSip::HasHeaderValueL( aMessageElements, allowInd, |
|
2461 SIPStrings::StringF( allowMethods[ index ]).DesC() )) |
|
2462 { |
|
2463 MceSip::AddAllowHeaderL( headers, allowMethods[ index ]); |
|
2464 } |
|
2465 |
|
2466 } |
|
2467 CleanupStack::PopAndDestroy(&allowMethods); |
|
2468 } |
|
2469 aMessageElements.SetUserHeadersL( headers ); |
|
2470 CleanupStack::Pop( &headers ); |
|
2471 } |
|
2472 |
|
2473 // ----------------------------------------------------------------------------- |
|
2474 // TMceActionSet::AddHeadersL |
|
2475 // ----------------------------------------------------------------------------- |
|
2476 // |
|
2477 void TMceActionSet::AddHeadersL( RPointerArray<CSIPHeaderBase>& aHeaders, |
|
2478 CDesC8Array* aPrimaryHeaders, |
|
2479 TInt aMethodInd ) |
|
2480 { |
|
2481 |
|
2482 TInt allowInd = SipStrConsts::EAllowHeader; |
|
2483 RArray< TInt > allowMethods; |
|
2484 CleanupClosePushL(allowMethods); |
|
2485 TInt index =0; |
|
2486 |
|
2487 CDesC8Array& txtHeaders = aPrimaryHeaders && aPrimaryHeaders->Count() > 0 ? |
|
2488 *aPrimaryHeaders : iSession.DefaultHeaders( aMethodInd ); |
|
2489 if ( txtHeaders.Count() ) |
|
2490 { |
|
2491 MCESRV_DEBUG("AddHeadersL: creating extension headers"); |
|
2492 MceSip::ToSIPExtensionHeadersL( aHeaders, txtHeaders ); |
|
2493 } |
|
2494 //An Allow header field (Section 20.5) SHOULD be present in the INVITE. |
|
2495 //It indicates what methods can be invoked within a dialog |
|
2496 MceSip::BasicAllowMethodsL( allowMethods ); |
|
2497 for ( index =0; index < allowMethods.Count(); index ++) |
|
2498 { |
|
2499 if ( !MceSip::HasHeaderValueL( aHeaders, allowInd, |
|
2500 SIPStrings::StringF( allowMethods[ index ]).DesC() )) |
|
2501 { |
|
2502 MceSip::AddAllowHeaderL( aHeaders, allowMethods[ index ]); |
|
2503 } |
|
2504 |
|
2505 } |
|
2506 CleanupStack::PopAndDestroy(&allowMethods); |
|
2507 } |
|
2508 |
|
2509 // ----------------------------------------------------------------------------- |
|
2510 // TMceActionSet::AddExtensionHeadersL |
|
2511 // ----------------------------------------------------------------------------- |
|
2512 // |
|
2513 TBool TMceActionSet::AddExtensionHeadersL( |
|
2514 RPointerArray<CSIPHeaderBase>& aHeaders, |
|
2515 TInt aTransactionType, |
|
2516 TBool aIsBody, |
|
2517 TBool aIsResponse, |
|
2518 TUint aResponseCode ) |
|
2519 { |
|
2520 CMceSipExtensions& ext = iSession.Extensions(); |
|
2521 TMceSipResponseType type = MceSip::ResponseType( aResponseCode ); |
|
2522 |
|
2523 TInt reliable = EFalse; |
|
2524 if ( aTransactionType == SipStrConsts::EInvite ) |
|
2525 { |
|
2526 // Allow update, subscribe, prack, refer, notify |
|
2527 // extension methods for allow header |
|
2528 RArray<TInt> allowExts; |
|
2529 CleanupClosePushL(allowExts); |
|
2530 RArray< CMceSipExtensions::TExtension > localExts; |
|
2531 CleanupClosePushL(localExts); |
|
2532 TInt allowInd = SipStrConsts::EAllowHeader; |
|
2533 TInt index =0; |
|
2534 |
|
2535 ext.ExtensionAllowMethodsL( allowExts ); |
|
2536 ext.LocalSipExtensionsL( localExts ); |
|
2537 //Adding headers only if the headers does not contains the methods |
|
2538 for( index = 0; index < allowExts.Count(); index++ ) |
|
2539 { |
|
2540 TInt localExt = ext.Local( localExts[ index ] ); |
|
2541 if ( localExt != CMceSipExtensions::ENotSupported && |
|
2542 ( !aIsResponse || ( type == E1XX && aIsBody ) ) && |
|
2543 !MceSip::HasHeaderValueL( aHeaders, allowInd, |
|
2544 SIPStrings::StringF( allowExts[ index ]).DesC() )) |
|
2545 { |
|
2546 // INVITE or 1XX to INVITE with SDP |
|
2547 MceSip::AddAllowHeaderL( aHeaders, allowExts[ index ] ); |
|
2548 } |
|
2549 } |
|
2550 CleanupStack::PopAndDestroy(&localExts); |
|
2551 CleanupStack::PopAndDestroy(&allowExts); |
|
2552 //clean arrays |
|
2553 |
|
2554 // Supported: secprecondition |
|
2555 TInt localSecPreconds = ext.Local( CMceSipExtensions::ESecPreconds ); |
|
2556 |
|
2557 TBool supportedPreconds = MceSip::HasHeaderValueL( |
|
2558 aHeaders, |
|
2559 SipStrConsts::ESupportedHeader, |
|
2560 KMceSipPrecondition ); |
|
2561 |
|
2562 TBool reqPreconds = MceSip::HasHeaderValueL( |
|
2563 aHeaders, |
|
2564 SipStrConsts::ERequireHeader, |
|
2565 KMceSipPrecondition ); |
|
2566 |
|
2567 if ( localSecPreconds != CMceSipExtensions::ENotSupported && |
|
2568 ( !aIsResponse || type == E1XX || type == E2XX ) && |
|
2569 ActiveBody().Modifier( KMceSecPreconditions ) == KMcePreconditionsE2ESupported && |
|
2570 !supportedPreconds ) |
|
2571 { |
|
2572 MceSip::AddSupportedHeaderL( aHeaders, KMceSipPrecondition ); |
|
2573 supportedPreconds = ETrue; |
|
2574 } |
|
2575 |
|
2576 // Supported: 100rel |
|
2577 TInt local100rel = ext.Local( CMceSipExtensions::E100rel ); |
|
2578 if ( local100rel != CMceSipExtensions::ENotSupported && |
|
2579 ( !aIsResponse || type == E1XX ) ) |
|
2580 { |
|
2581 // INVITE or 1XX to INVITE |
|
2582 MceSip::AddSupportedHeaderL( aHeaders, KMceSip100Rel ); |
|
2583 } |
|
2584 |
|
2585 // Supported: precondition |
|
2586 TInt localQosPreconds = ext.Local( CMceSipExtensions::EQosPreconds ); |
|
2587 if ( localQosPreconds != CMceSipExtensions::ENotSupported && |
|
2588 ( !aIsResponse || type == E1XX || type == E2XX ) && |
|
2589 !supportedPreconds ) |
|
2590 { |
|
2591 // INVITE or 1XX or 2XX to INVITE |
|
2592 MceSip::AddSupportedHeaderL( aHeaders, KMceSipPrecondition ); |
|
2593 } |
|
2594 |
|
2595 // Require: 100rel |
|
2596 if ( !aIsResponse && local100rel == CMceSipExtensions::ERequired ) |
|
2597 { |
|
2598 MceSip::AddRequireHeaderL( aHeaders, KMceSip100Rel ); |
|
2599 } |
|
2600 |
|
2601 // Require: precondition |
|
2602 if ( !aIsResponse && localQosPreconds == CMceSipExtensions::ERequired && |
|
2603 !reqPreconds ) |
|
2604 { |
|
2605 MceSip::AddRequireHeaderL( aHeaders, KMceSipPrecondition ); |
|
2606 reqPreconds = ETrue; |
|
2607 } |
|
2608 |
|
2609 // Require: precondition |
|
2610 if ( !aIsResponse && localSecPreconds == CMceSipExtensions::ERequired && |
|
2611 !reqPreconds ) |
|
2612 { |
|
2613 MceSip::AddRequireHeaderL( aHeaders, KMceSipPrecondition ); |
|
2614 } |
|
2615 |
|
2616 if ( aIsResponse && type == E1XX ) |
|
2617 { |
|
2618 // Find out are we sending a 1XX reliably |
|
2619 TInt remote100rel = ext.Remote( CMceSipExtensions::E100rel ); |
|
2620 if ( local100rel == CMceSipExtensions::ERequired || |
|
2621 remote100rel == CMceSipExtensions::ERequired || |
|
2622 aIsBody ) |
|
2623 { |
|
2624 reliable = ETrue; |
|
2625 // Add headers for reliable provisional response |
|
2626 // Require: 100rel |
|
2627 MceSip::AddRequireHeaderL( aHeaders, KMceSip100Rel ); |
|
2628 |
|
2629 // RSeq |
|
2630 TUint rseqValue; |
|
2631 CMceReliableSender& reliableSend = iSession.ReliableSender(); |
|
2632 CSIPServerTransaction& serverTrans = iSession.Request(); |
|
2633 rseqValue = reliableSend.Rseq( serverTrans ); |
|
2634 CSIPRSeqHeader* rseq = new( ELeave ) CSIPRSeqHeader( rseqValue ); |
|
2635 CleanupStack::PushL( rseq ); |
|
2636 aHeaders.AppendL( rseq ); |
|
2637 CleanupStack::Pop( rseq ); |
|
2638 |
|
2639 } |
|
2640 if ( aIsBody && !reqPreconds && |
|
2641 ActiveBody().Modifier( KMceSecPreconditions ) == KMcePreconditionsE2ESupported ) |
|
2642 { |
|
2643 // Require: precondition |
|
2644 MceSip::AddRequireHeaderL( aHeaders, KMceSipPrecondition ); |
|
2645 ActiveBody().iRemoteSecPreconditionsRequired = ETrue; |
|
2646 reqPreconds = ETrue; |
|
2647 } |
|
2648 } |
|
2649 } |
|
2650 else if ( !aIsResponse && aTransactionType == SipStrConsts::EPrack ) |
|
2651 { |
|
2652 // RAck header in PRACK request |
|
2653 MceSip::AddRAckHeaderL( aHeaders, |
|
2654 *iSession.Response().ResponseElements() ); |
|
2655 |
|
2656 TBool supportedPreconds = MceSip::HasHeaderValueL( |
|
2657 aHeaders, |
|
2658 SipStrConsts::ESupportedHeader, |
|
2659 KMceSipPrecondition ); |
|
2660 TBool reqPreconds = MceSip::HasHeaderValueL( |
|
2661 aHeaders, |
|
2662 SipStrConsts::ERequireHeader, |
|
2663 KMceSipPrecondition ); |
|
2664 TInt localSecPreconds = ext.Local( CMceSipExtensions::ESecPreconds ); |
|
2665 if ( localSecPreconds != CMceSipExtensions::ENotSupported && |
|
2666 !aIsResponse && !supportedPreconds && |
|
2667 ActiveBody().Modifier( KMceSecPreconditions ) == KMcePreconditionsE2ESupported ) |
|
2668 { |
|
2669 MceSip::AddSupportedHeaderL( aHeaders, KMceSipPrecondition ); |
|
2670 } |
|
2671 if ( localSecPreconds != CMceSipExtensions::ENotSupported && |
|
2672 !aIsResponse && !reqPreconds && |
|
2673 ActiveBody().Modifier( KMceSecPreconditions ) == KMcePreconditionsE2ESupported && |
|
2674 ActiveBody().iRemoteSecPreconditionsRequired ) |
|
2675 { |
|
2676 MceSip::AddRequireHeaderL( aHeaders, KMceSipPrecondition ); |
|
2677 } |
|
2678 } |
|
2679 else |
|
2680 { |
|
2681 //NOP |
|
2682 } |
|
2683 return reliable; |
|
2684 } |
|
2685 |
|
2686 // |
|
2687 // Session timers |
|
2688 // |
|
2689 |
|
2690 // ----------------------------------------------------------------------------- |
|
2691 // TMceActionSet::ProcessSessionTimerClientL |
|
2692 // ----------------------------------------------------------------------------- |
|
2693 // |
|
2694 void TMceActionSet::ProcessSessionTimerClientL( |
|
2695 CSIPClientTransaction& aResponse ) |
|
2696 { |
|
2697 MCESRV_DEBUG("TMceActionSet::ProcessSessionTimerClientL, Entry"); |
|
2698 |
|
2699 const TInt KPopCount = 4; |
|
2700 |
|
2701 const CSIPMessageElements& msgElements = aResponse. |
|
2702 ResponseElements()->MessageElements(); |
|
2703 const RPointerArray<CSIPHeaderBase>& sipHeaders = msgElements.UserHeaders(); |
|
2704 |
|
2705 RStringF expiresKey = |
|
2706 SIPStrings::Pool().OpenFStringL( KMceSipHeaderSessionExpires() ); |
|
2707 CleanupClosePushL( expiresKey ); |
|
2708 |
|
2709 RStringF expiresKey2 = |
|
2710 SIPStrings::Pool().OpenFStringL( KMceSipHeaderCompactFormOfSessionExpires() ); |
|
2711 CleanupClosePushL( expiresKey2 ); |
|
2712 |
|
2713 RStringF timerKey = SIPStrings::Pool().OpenFStringL( KMceSipTimer() ); |
|
2714 CleanupClosePushL( timerKey ); |
|
2715 |
|
2716 RStringF minSeKey = SIPStrings::Pool().OpenFStringL( KMceSipHeaderMinSE() ); |
|
2717 CleanupClosePushL( minSeKey ); |
|
2718 |
|
2719 TBool require( EFalse ); |
|
2720 |
|
2721 // Require: timer |
|
2722 for (int i = 0; i < sipHeaders.Count(); i++) |
|
2723 { |
|
2724 CSIPHeaderBase* anotherhead = sipHeaders[i]; |
|
2725 HBufC8* value = anotherhead->ToTextValueLC(); |
|
2726 if( anotherhead->Name() == |
|
2727 SIPStrings::StringF(SipStrConsts::ERequireHeader ) |
|
2728 && value |
|
2729 && value->Find( KMceSipTimer() ) != KErrNotFound ) |
|
2730 { |
|
2731 require = ETrue; |
|
2732 } |
|
2733 else if( minSeKey == anotherhead->Name() && |
|
2734 MceSip::ResponseCode ( aResponse ) == |
|
2735 KMceSipSessionIntervalTooSmall ) |
|
2736 { |
|
2737 // 422 Response received including Min-SE field |
|
2738 TUint uintValue = MceSip::HeaderValueL( value->Des() ); |
|
2739 ActiveBody().iMinSE = uintValue; |
|
2740 ActiveBody().iTimeout = ActiveBody().iMinSE; |
|
2741 CleanupStack::PopAndDestroy( value ); |
|
2742 break; |
|
2743 } |
|
2744 CleanupStack::PopAndDestroy( value ); |
|
2745 } |
|
2746 if( require ) |
|
2747 { |
|
2748 // look for Session-Expires field |
|
2749 for (int i = 0; i < sipHeaders.Count(); i++) |
|
2750 { |
|
2751 CSIPHeaderBase* anotherhead = sipHeaders[i]; |
|
2752 if( ( expiresKey == anotherhead->Name() || |
|
2753 expiresKey2 == anotherhead->Name() ) && |
|
2754 MceSip::ResponseCode ( aResponse ) == KMceSipOK ) |
|
2755 { |
|
2756 // Session-Expires: value;refresher=uac/uas |
|
2757 HBufC8* value = anotherhead->ToTextValueLC(); |
|
2758 |
|
2759 //Need to have ; i.e. must contain refresher=uac/uas |
|
2760 User::LeaveIfError( value->Locate( KMceSipHeaderSeparator ) ); |
|
2761 |
|
2762 TUint uintValue = MceSip::HeaderValueL( value->Des() ); |
|
2763 ActiveBody().iTimeout = uintValue; |
|
2764 // find out who will perform the refresh requests |
|
2765 if( value->FindF( KMceSipRefresher ) != KErrNotFound && |
|
2766 value->FindF( KMceSipRefresherUAS ) == KErrNotFound ) |
|
2767 { |
|
2768 ActiveBody().iRefresh = ETrue; |
|
2769 } |
|
2770 else |
|
2771 { |
|
2772 ActiveBody().iRefresh = EFalse; |
|
2773 } |
|
2774 CleanupStack::PopAndDestroy( value ); |
|
2775 iSession.StartSessionTimerL(); |
|
2776 break; |
|
2777 } |
|
2778 } |
|
2779 } |
|
2780 |
|
2781 CleanupStack::PopAndDestroy( KPopCount ); // expiresKey, expiresKey2, timerKey, minSeKey |
|
2782 |
|
2783 MCESRV_DEBUG("TMceActionSet::ProcessSessionTimerClientL, Exit"); |
|
2784 } |
|
2785 |
|
2786 // ----------------------------------------------------------------------------- |
|
2787 // TMceActionSet::ProcessSessionTimerServerL |
|
2788 // ----------------------------------------------------------------------------- |
|
2789 // |
|
2790 void |
|
2791 TMceActionSet::ProcessSessionTimerServerL( CSIPServerTransaction& aRequest ) |
|
2792 { |
|
2793 const CSIPRequestElements* reqElements = aRequest.RequestElements(); |
|
2794 const CSIPMessageElements* elements = reqElements ? |
|
2795 &reqElements->MessageElements() : |
|
2796 NULL; |
|
2797 if ( elements ) |
|
2798 { |
|
2799 ProcessSessionTimerServerL( *elements ); |
|
2800 } |
|
2801 } |
|
2802 |
|
2803 // ----------------------------------------------------------------------------- |
|
2804 // TMceActionSet::ProcessSessionTimerServerL |
|
2805 // ----------------------------------------------------------------------------- |
|
2806 // |
|
2807 void TMceActionSet::ProcessSessionTimerServerL( |
|
2808 const CSIPMessageElements& aElements ) |
|
2809 { |
|
2810 MCESRV_DEBUG("TMceActionSet::ProcessSessionTimerServerL, Entry"); |
|
2811 |
|
2812 const TInt KPopCount = 3; |
|
2813 |
|
2814 RStringF expiresKey = SIPStrings::Pool(). |
|
2815 OpenFStringL( KMceSipHeaderSessionExpires() ); |
|
2816 CleanupClosePushL( expiresKey ); |
|
2817 |
|
2818 RStringF expiresKey2 = SIPStrings::Pool(). |
|
2819 OpenFStringL( KMceSipHeaderCompactFormOfSessionExpires() ); |
|
2820 CleanupClosePushL( expiresKey2 ); |
|
2821 |
|
2822 RStringF minseKey = SIPStrings::Pool(). |
|
2823 OpenFStringL( KMceSipHeaderMinSE() ); |
|
2824 CleanupClosePushL( minseKey ); |
|
2825 |
|
2826 CSIPHeaderBase* header = NULL; |
|
2827 HBufC8* sessionExpires = NULL; |
|
2828 |
|
2829 // look for Session-Expires: field, if not present then no session timer |
|
2830 ActiveBody().iTimeout = 0; |
|
2831 |
|
2832 header = MceSip::FindHeader( aElements, expiresKey ); |
|
2833 header = header ? header : ( MceSip::FindHeader( aElements, expiresKey2 ) ); |
|
2834 sessionExpires = header ? header->ToTextValueLC() : NULL; |
|
2835 |
|
2836 if ( sessionExpires ) |
|
2837 { |
|
2838 TUint timeout = MceSip::HeaderValueL( sessionExpires->Des() ); |
|
2839 ActiveBody().iTimeout = timeout; |
|
2840 |
|
2841 // Find out who will perform the refresh requests. Refresher role is |
|
2842 // only updated when UAC has provided refresher-parameter or incoming |
|
2843 // request is not a session refresh. |
|
2844 if ( iSession.SubState() != CMceSipSession::ERefreshing || |
|
2845 sessionExpires->Find( KMceSipRefresherUAC ) != KErrNotFound || |
|
2846 sessionExpires->Find( KMceSipRefresherUAS ) != KErrNotFound ) |
|
2847 { |
|
2848 if ( sessionExpires->Find( KMceSipRefresherUAC ) != KErrNotFound ) |
|
2849 { |
|
2850 ActiveBody().iRefresh = EFalse; |
|
2851 } |
|
2852 else |
|
2853 { |
|
2854 ActiveBody().iRefresh = ETrue; |
|
2855 } |
|
2856 } |
|
2857 |
|
2858 CleanupStack::PopAndDestroy( sessionExpires ); |
|
2859 } |
|
2860 |
|
2861 CleanupStack::PopAndDestroy( KPopCount ); // expiresKey, expiresKey2, minseKey |
|
2862 |
|
2863 MCESRV_DEBUG("TMceActionSet::ProcessSessionTimerServerL, Exit"); |
|
2864 } |
|
2865 |
|
2866 // ----------------------------------------------------------------------------- |
|
2867 // TMceActionSet::ProcessReliableResponseL |
|
2868 // ----------------------------------------------------------------------------- |
|
2869 // |
|
2870 TBool TMceActionSet::ProcessReliableResponse( |
|
2871 const CSIPResponseElements& aResponseElements ) |
|
2872 { |
|
2873 TUint value = MceSip::RSeq( aResponseElements ); |
|
2874 |
|
2875 if ( ( iSession.RSeq() == KErrNone ) || |
|
2876 ( iSession.RSeq() == value - 1 ) ) |
|
2877 { |
|
2878 return ETrue; |
|
2879 } |
|
2880 |
|
2881 return EFalse; |
|
2882 } |
|
2883 |
|
2884 // ----------------------------------------------------------------------------- |
|
2885 // TMceActionSet::NeedToProcess |
|
2886 // ----------------------------------------------------------------------------- |
|
2887 // |
|
2888 TBool TMceActionSet::NeedToProcessL( TMceStateTransitionEvent& aEvent ) |
|
2889 { |
|
2890 |
|
2891 TBool needToProcess = ETrue; |
|
2892 |
|
2893 CMceSipSession& session = aEvent.Session(); |
|
2894 CSIPClientTransaction& response = session.Response(); |
|
2895 |
|
2896 |
|
2897 if ( MceSip::ResponseCode( response ) == KMceSipTrying ) |
|
2898 { |
|
2899 needToProcess = EFalse; |
|
2900 } |
|
2901 else if ( (session.Extensions().LevelL( response, CMceSipExtensions::E100rel ) |
|
2902 == CMceSipExtensions::ERequired ) ) |
|
2903 { |
|
2904 const CSIPResponseElements& responseElements = *response.ResponseElements(); |
|
2905 |
|
2906 TInt rseq = MceSip::RSeq( responseElements ); |
|
2907 |
|
2908 if (rseq == KErrNotFound ) |
|
2909 { |
|
2910 User::Leave( KErrArgument ); |
|
2911 } |
|
2912 |
|
2913 if ( session.RSeq() == KErrNone || |
|
2914 rseq > session.RSeq() ) |
|
2915 |
|
2916 { |
|
2917 needToProcess = session.Actions().ProcessReliableResponse( |
|
2918 *response.ResponseElements()); |
|
2919 } |
|
2920 else |
|
2921 { |
|
2922 needToProcess = EFalse; |
|
2923 } |
|
2924 } |
|
2925 |
|
2926 return needToProcess; |
|
2927 } |
|
2928 |
|
2929 // ----------------------------------------------------------------------------- |
|
2930 // TMceActionSet::CheckContactIsSecureL |
|
2931 // ----------------------------------------------------------------------------- |
|
2932 // |
|
2933 void TMceActionSet::CheckContactIsSecureL( CSIPTransactionBase& aTransaction ) |
|
2934 { |
|
2935 MCESRV_DEBUG("TMceActionSet::CheckResponseContactIsSecureL, Entry"); |
|
2936 |
|
2937 const CSIPMessageElements* msg = MceSip::ToMessageElements( aTransaction ); |
|
2938 User::LeaveIfError( msg ? KErrNone : KErrArgument ); |
|
2939 |
|
2940 TBool contactSec = MceSip::HasSipsUriInContactL( *msg ) || |
|
2941 MceSip::HasTlsInContactL( *msg ); |
|
2942 |
|
2943 CMceComSession& body = ActiveBody(); |
|
2944 body.iSipContactAddrSecure = CMceSession::EControlPathUnsecure; |
|
2945 |
|
2946 if ( iSession.IsProfileContactSecureL( ) && |
|
2947 contactSec ) |
|
2948 { |
|
2949 MCESRV_DEBUG("profile contact and session contact header is secure"); |
|
2950 body.iSipContactAddrSecure = CMceSession::EControlPathSecure; |
|
2951 } |
|
2952 MCESRV_DEBUG("TMceActionSet::CheckResponseContactIsSecureL, Exit"); |
|
2953 } |
|
2954 |
|
2955 |
|
2956 // ----------------------------------------------------------------------------- |
|
2957 // TMceActionSet::IsExtensionRequest |
|
2958 // ----------------------------------------------------------------------------- |
|
2959 |
|
2960 TBool TMceActionSet::IsExtensionRequest ( RStringF method ) |
|
2961 { |
|
2962 |
|
2963 TBool extensionRequest = ETrue; |
|
2964 |
|
2965 if ( ( method == SIPStrings::StringF( SipStrConsts::ERegister )) || |
|
2966 ( method == SIPStrings::StringF( SipStrConsts::EInvite )) || |
|
2967 ( method == SIPStrings::StringF( SipStrConsts::ECancel)) || |
|
2968 ( method == SIPStrings::StringF( SipStrConsts::EPrack )) || |
|
2969 ( method == SIPStrings::StringF( SipStrConsts::EUpdate )) || |
|
2970 ( method == SIPStrings::StringF( SipStrConsts::EAck )) || |
|
2971 ( method == SIPStrings::StringF( SipStrConsts::EBye )) || |
|
2972 ( method == SIPStrings::StringF( SipStrConsts::ESubscribe )) || |
|
2973 ( method == SIPStrings::StringF( SipStrConsts::ERefer )) || |
|
2974 ( method == SIPStrings::StringF( SipStrConsts::ENotify ))) |
|
2975 |
|
2976 |
|
2977 { |
|
2978 extensionRequest = EFalse; |
|
2979 } |
|
2980 |
|
2981 return extensionRequest; |
|
2982 } |
|
2983 |
|
2984 |
|
2985 // ----------------------------------------------------------------------------- |
|
2986 // TMceActionSet::ResetSessionTimerL |
|
2987 // ----------------------------------------------------------------------------- |
|
2988 // |
|
2989 void TMceActionSet::ResetSessionTimerL() |
|
2990 { |
|
2991 MCESRV_DEBUG("TMceActionSet::ResetSessionTimerL, Entry"); |
|
2992 |
|
2993 if ( !ActiveBody().iRefresh ) |
|
2994 { |
|
2995 iSession.StartSessionTimerL(); |
|
2996 } |
|
2997 |
|
2998 MCESRV_DEBUG("TMceActionSet::ResetSessionTimerL, Exit"); |
|
2999 } |
|
3000 |
|
3001 // ----------------------------------------------------------------------------- |
|
3002 // TMceActionSet::StopPendingTimer |
|
3003 // ----------------------------------------------------------------------------- |
|
3004 // |
|
3005 void TMceActionSet::StopPendingTimer() |
|
3006 { |
|
3007 MCESRV_DEBUG("TMceActionSet::StopPendingTimer, Entry"); |
|
3008 CMceTimerManager& timerManager = iSession.Manager().TimerManager(); |
|
3009 if ( timerManager.IsRunning( iSession.iPendingTimer ) ) |
|
3010 { |
|
3011 timerManager.Stop( iSession.iPendingTimer ); |
|
3012 } |
|
3013 iSession.iPendingTimer = CMceTimerManager::KNoSuchTimer; |
|
3014 MCESRV_DEBUG("TMceActionSet::StopPendingTimer, Exit"); |
|
3015 } |
|
3016 |
|
3017 // ----------------------------------------------------------------------------- |
|
3018 // TMceActionSet::AddSessionTimerFieldsServerL |
|
3019 // ----------------------------------------------------------------------------- |
|
3020 // |
|
3021 void TMceActionSet::AddSessionTimerFieldsServerL( |
|
3022 RPointerArray<CSIPHeaderBase>& aHeaders ) |
|
3023 { |
|
3024 MCESRV_DEBUG("TMceActionSet::AddSessionTimerFieldsServerL, Entry"); |
|
3025 |
|
3026 RStringF timerKey = SIPStrings::Pool().OpenFStringL( KMceSipTimer() ); |
|
3027 CleanupClosePushL( timerKey ); |
|
3028 // Supported: timer |
|
3029 MCESRV_DEBUG_SVALUE("AddSessionTimerFieldsServerL: adding Supported header", |
|
3030 timerKey.DesC() ); |
|
3031 |
|
3032 CSIPSupportedHeader* supportedHeader = |
|
3033 CSIPSupportedHeader::NewLC( timerKey ); |
|
3034 |
|
3035 User::LeaveIfError( aHeaders.Append( supportedHeader ) ); |
|
3036 CleanupStack::Pop( supportedHeader ); |
|
3037 |
|
3038 if( ActiveBody().iTimeout > 0) |
|
3039 { |
|
3040 // Require: timer |
|
3041 MCESRV_DEBUG_SVALUE( |
|
3042 "AddSessionTimerFieldsServerL: adding Require header", |
|
3043 timerKey.DesC() ); |
|
3044 |
|
3045 CSIPRequireHeader* requireHeader = |
|
3046 CSIPRequireHeader::NewLC( timerKey ); |
|
3047 |
|
3048 User::LeaveIfError( aHeaders.Append( requireHeader ) ); |
|
3049 CleanupStack::Pop( requireHeader ); |
|
3050 |
|
3051 // Session-Expires: XX |
|
3052 TUint timeoutInSec = ActiveBody().iTimeout; |
|
3053 |
|
3054 HBufC8* expiresValue = HBufC8::NewLC( KMaxLengthOfSessionExpires ); |
|
3055 expiresValue->Des().Num( timeoutInSec, EDecimal ); |
|
3056 expiresValue->Des().Append( KMceSipHeaderSeparator ); |
|
3057 expiresValue->Des().Append( KMceSipRefresher ); |
|
3058 expiresValue->Des().Append( KMceSipEqualsTo ); |
|
3059 if( ActiveBody().iRefresh ) |
|
3060 { |
|
3061 expiresValue->Des().Append( KMceSipRefresherUAS ); |
|
3062 } |
|
3063 else |
|
3064 { |
|
3065 expiresValue->Des().Append( KMceSipRefresherUAC ); |
|
3066 } |
|
3067 |
|
3068 MCESRV_DEBUG_SVALUE( |
|
3069 "AddSessionTimerFieldsServerL: adding Session-Expires header", |
|
3070 *expiresValue ); |
|
3071 |
|
3072 CSIPExtensionHeader* sessionExpiresHeader = |
|
3073 CSIPExtensionHeader::NewLC( KMceSipHeaderSessionExpires(), |
|
3074 *expiresValue ); |
|
3075 |
|
3076 User::LeaveIfError( aHeaders.Append( sessionExpiresHeader ) ); |
|
3077 CleanupStack::Pop( sessionExpiresHeader ); |
|
3078 CleanupStack::PopAndDestroy( expiresValue ); |
|
3079 } |
|
3080 |
|
3081 CleanupStack::PopAndDestroy(); // timerKey |
|
3082 |
|
3083 MCESRV_DEBUG("TMceActionSet::AddSessionTimerFieldsServerL, Exit"); |
|
3084 } |
|
3085 |
|
3086 // ----------------------------------------------------------------------------- |
|
3087 // TMceActionSet::AddSessionTimerFieldsL |
|
3088 // ----------------------------------------------------------------------------- |
|
3089 // |
|
3090 void TMceActionSet::AddSessionTimerFieldsClientL( |
|
3091 RPointerArray<CSIPHeaderBase>& aSipHeaders ) |
|
3092 { |
|
3093 MCESRV_DEBUG("TMceActionSet::AddSessionTimerFieldsClientL, Entry"); |
|
3094 |
|
3095 // Supported: timer |
|
3096 RStringF timerKey = SIPStrings::Pool().OpenFStringL( KMceSipTimer() ); |
|
3097 CleanupClosePushL( timerKey ); |
|
3098 |
|
3099 MCESRV_DEBUG_SVALUE("AddSessionTimerFieldsClientL: adding Supported header", |
|
3100 timerKey.DesC() ); |
|
3101 |
|
3102 CSIPSupportedHeader* supportedHeader = |
|
3103 CSIPSupportedHeader::NewLC( timerKey ); |
|
3104 |
|
3105 User::LeaveIfError( aSipHeaders.Append( supportedHeader ) ); |
|
3106 CleanupStack::Pop( supportedHeader ); |
|
3107 CleanupStack::PopAndDestroy( &timerKey ); |
|
3108 if ( ActiveBody().iTimeout > 0 ) |
|
3109 { |
|
3110 // Session-Expires: XX |
|
3111 TUint timeoutInSec = ActiveBody().iTimeout; |
|
3112 HBufC8* timeout = HBufC8::NewLC( KMaxLengthOfSessionExpires ); |
|
3113 timeout->Des().Num( timeoutInSec, EDecimal ); |
|
3114 |
|
3115 // Add refresher parameter if request is not the initial one. |
|
3116 // RFC4028, 7.4. |
|
3117 if ( iSession.SubState() == CMceSipSession::ERefreshing ) |
|
3118 { |
|
3119 timeout->Des().Append( KMceSipHeaderSeparator ); |
|
3120 timeout->Des().Append( KMceSipRefresher ); |
|
3121 timeout->Des().Append( KMceSipEqualsTo ); |
|
3122 |
|
3123 if ( ActiveBody().iRefresh ) |
|
3124 { |
|
3125 timeout->Des().Append( KMceSipRefresherUAC ); |
|
3126 } |
|
3127 else |
|
3128 { |
|
3129 timeout->Des().Append( KMceSipRefresherUAS ); |
|
3130 } |
|
3131 } |
|
3132 |
|
3133 CSIPExtensionHeader* sessionExpiresHeader = |
|
3134 CSIPExtensionHeader::NewLC( KMceSipHeaderSessionExpires(), |
|
3135 *timeout ); |
|
3136 User::LeaveIfError( aSipHeaders.Append( sessionExpiresHeader ) ); |
|
3137 CleanupStack::Pop( sessionExpiresHeader ); |
|
3138 |
|
3139 if ( ActiveBody().iMinSE > 0 ) |
|
3140 { |
|
3141 // if we have received 422, then include this field |
|
3142 MCESRV_DEBUG_SVALUE( |
|
3143 "AddSessionTimerFieldsClientL: adding Min-SE header", |
|
3144 *timeout ); |
|
3145 |
|
3146 CSIPExtensionHeader* minSEHeader = CSIPExtensionHeader::NewLC( |
|
3147 KMceSipHeaderMinSE(), |
|
3148 *timeout ); |
|
3149 |
|
3150 User::LeaveIfError( aSipHeaders.Append( minSEHeader ) ); |
|
3151 CleanupStack::Pop( minSEHeader ); |
|
3152 } |
|
3153 |
|
3154 CleanupStack::PopAndDestroy( timeout ); |
|
3155 } |
|
3156 |
|
3157 MCESRV_DEBUG("TMceActionSet::AddSessionTimerFieldsClientL, Exit"); |
|
3158 } |
|
3159 |
|
3160 // ----------------------------------------------------------------------------- |
|
3161 // TMceActionSet::ReservationNeeded |
|
3162 // ----------------------------------------------------------------------------- |
|
3163 // |
|
3164 TBool TMceActionSet::ReservationNeeded() |
|
3165 { |
|
3166 MCESRV_DEBUG("TMceActionSet::ReservationNeeded, Entry"); |
|
3167 |
|
3168 CMceMediaManager& mediaManager = iSession.Manager().MediaManager(); |
|
3169 TBool reservationNeeded = mediaManager.ReservationNeeded( ActiveBody() ); |
|
3170 |
|
3171 MCESRV_DEBUG("TMceActionSet::ReservationNeeded, Exit"); |
|
3172 |
|
3173 return reservationNeeded; |
|
3174 } |
|
3175 |
|
3176 // ----------------------------------------------------------------------------- |
|
3177 // TMceActionSet::ActiveBody |
|
3178 // ----------------------------------------------------------------------------- |
|
3179 // |
|
3180 CMceComSession& TMceActionSet::ActiveBody() |
|
3181 { |
|
3182 return iSession.ActiveBody(); |
|
3183 } |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 // |
|
3190 // Event handler |
|
3191 // |
|
3192 |
|
3193 |
|
3194 // ----------------------------------------------------------------------------- |
|
3195 // TMceComEventHandler::TMceComEventHandler |
|
3196 // ----------------------------------------------------------------------------- |
|
3197 // |
|
3198 TMceComEventHandler::TMceComEventHandler( CMceMediaManager& aMediaManager ) |
|
3199 : iMediaManager( aMediaManager ), |
|
3200 iWriteData( NULL ), |
|
3201 iReadData( NULL ), |
|
3202 iReturnData( NULL ) |
|
3203 { |
|
3204 } |
|
3205 |
|
3206 // ----------------------------------------------------------------------------- |
|
3207 // TMceComEventHandler::TMceComEventHandler |
|
3208 // ----------------------------------------------------------------------------- |
|
3209 // |
|
3210 TMceComEventHandler::TMceComEventHandler( CMceMediaManager& aMediaManager, |
|
3211 TPtr8& aWriteData ) |
|
3212 : iMediaManager( aMediaManager ), |
|
3213 iWriteData( &aWriteData ), |
|
3214 iReadData( NULL ), |
|
3215 iReturnData( NULL ) |
|
3216 { |
|
3217 } |
|
3218 |
|
3219 // ----------------------------------------------------------------------------- |
|
3220 // TMceComEventHandler::TMceComEventHandler |
|
3221 // ----------------------------------------------------------------------------- |
|
3222 // |
|
3223 TMceComEventHandler::TMceComEventHandler( CMceMediaManager& aMediaManager, |
|
3224 const TDesC8& aReadData ) |
|
3225 : iMediaManager( aMediaManager ), |
|
3226 iWriteData( NULL ), |
|
3227 iReadData( &aReadData ), |
|
3228 iReturnData( NULL ) |
|
3229 { |
|
3230 } |
|
3231 |
|
3232 // ----------------------------------------------------------------------------- |
|
3233 // TMceComEventHandler::TMceComEventHandler |
|
3234 // ----------------------------------------------------------------------------- |
|
3235 // |
|
3236 TMceComEventHandler::TMceComEventHandler( CMceMediaManager& aMediaManager, |
|
3237 HBufC8*& aWriteData ) |
|
3238 : iMediaManager( aMediaManager ), |
|
3239 iWriteData( NULL ), |
|
3240 iReadData( NULL ), |
|
3241 iReturnData( &aWriteData ) |
|
3242 { |
|
3243 } |
|
3244 |
|
3245 // ----------------------------------------------------------------------------- |
|
3246 // TMceComEventHandler::HandleL |
|
3247 // ----------------------------------------------------------------------------- |
|
3248 // |
|
3249 TInt TMceComEventHandler::HandleL( CMceComMediaSink& aTarget, |
|
3250 TMceComEvent& aEvent ) |
|
3251 { |
|
3252 MCESRV_DEBUG("TMceComEventHandler::HandleL( sink ), Entry"); |
|
3253 |
|
3254 |
|
3255 TInt status = KMceEventConsumed; |
|
3256 switch( aEvent.Action() ) |
|
3257 { |
|
3258 case EMceItcEnable: |
|
3259 { |
|
3260 MCESRV_DEBUG("resuming paused sink"); |
|
3261 iMediaManager.ResumeL( aTarget ); |
|
3262 aEvent.Id().iState = aTarget.IsEnabled(); |
|
3263 break; |
|
3264 } |
|
3265 case EMceItcDisable: |
|
3266 { |
|
3267 MCESRV_DEBUG("pausing sink"); |
|
3268 iMediaManager.PauseL( aTarget ); |
|
3269 aEvent.Id().iState = aTarget.IsEnabled(); |
|
3270 break; |
|
3271 } |
|
3272 default: |
|
3273 { |
|
3274 status = KMceEventNotConsumed; |
|
3275 } |
|
3276 } |
|
3277 |
|
3278 MCESRV_DEBUG("TMceComEventHandler::HandleL( sink ), Exit"); |
|
3279 |
|
3280 return status; |
|
3281 } |
|
3282 |
|
3283 // ----------------------------------------------------------------------------- |
|
3284 // TMceComEventHandler::HandleL |
|
3285 // ----------------------------------------------------------------------------- |
|
3286 // |
|
3287 TInt TMceComEventHandler::HandleL( CMceComMediaSource& aTarget, |
|
3288 TMceComEvent& aEvent ) |
|
3289 { |
|
3290 MCESRV_DEBUG("TMceComEventHandler::HandleL( source ), Entry"); |
|
3291 |
|
3292 TInt status = KMceEventConsumed; |
|
3293 switch( aEvent.Action() ) |
|
3294 { |
|
3295 case EMceItcEnable: |
|
3296 { |
|
3297 MCESRV_DEBUG("resuming paused source"); |
|
3298 iMediaManager.ResumeL( aTarget ); |
|
3299 aEvent.Id().iState = aTarget.IsEnabled(); |
|
3300 break; |
|
3301 } |
|
3302 case EMceItcDisable: |
|
3303 { |
|
3304 MCESRV_DEBUG("pausing source"); |
|
3305 iMediaManager.PauseL( aTarget ); |
|
3306 aEvent.Id().iState = aTarget.IsEnabled(); |
|
3307 break; |
|
3308 } |
|
3309 case EMceItcIsDtmfActive: |
|
3310 case EMceItcStartDtmfTone: |
|
3311 case EMceItcStopDtmfTone: |
|
3312 case EMceItcSendDtmfTone: |
|
3313 case EMceItcCancelSendDtmfToneSequence: |
|
3314 { |
|
3315 MCESRV_DEBUG("dtmf handling"); |
|
3316 iMediaManager.DtmfL( aTarget, aEvent ); |
|
3317 break; |
|
3318 } |
|
3319 case EMceItcSendDtmfToneSequence: |
|
3320 { |
|
3321 MCESRV_DEBUG("dtmf handling, sequence"); |
|
3322 __ASSERT_ALWAYS( MCE_NOT_NULL_PTR( iReadData ) , User::Leave( KErrNotFound ) ); |
|
3323 iMediaManager.DtmfL( aTarget, aEvent, *iReadData ); |
|
3324 break; |
|
3325 } |
|
3326 default: |
|
3327 { |
|
3328 status = KMceEventNotConsumed; |
|
3329 break; |
|
3330 } |
|
3331 } |
|
3332 |
|
3333 MCESRV_DEBUG("TMceComEventHandler::HandleL( source ), Exit"); |
|
3334 return status; |
|
3335 } |
|
3336 |
|
3337 // ----------------------------------------------------------------------------- |
|
3338 // TMceComEventHandler::HandleL |
|
3339 // ----------------------------------------------------------------------------- |
|
3340 // |
|
3341 TInt TMceComEventHandler::HandleL( CMceComRtpSink& aTarget, |
|
3342 TMceComEvent& aEvent ) |
|
3343 { |
|
3344 MCESRV_DEBUG("TMceComEventHandler::HandleL( rtp sink ), Entry"); |
|
3345 |
|
3346 TInt status = KMceEventConsumed; |
|
3347 switch( aEvent.Action() ) |
|
3348 { |
|
3349 case EMceItcSendSR: |
|
3350 { |
|
3351 MCESRV_DEBUG("sending SR"); |
|
3352 iMediaManager.SendRTCPSenderReportL( aTarget ); |
|
3353 break; |
|
3354 } |
|
3355 default: |
|
3356 { |
|
3357 status = KMceEventNotConsumed; |
|
3358 } |
|
3359 } |
|
3360 |
|
3361 MCESRV_DEBUG("TMceComEventHandler::HandleL( rtp sink ), Exit"); |
|
3362 |
|
3363 return status; |
|
3364 } |
|
3365 |
|
3366 // ----------------------------------------------------------------------------- |
|
3367 // TMceComEventHandler::HandleL |
|
3368 // ----------------------------------------------------------------------------- |
|
3369 // |
|
3370 TInt TMceComEventHandler::HandleL( CMceComRtpSource& aTarget, |
|
3371 TMceComEvent& aEvent ) |
|
3372 { |
|
3373 MCESRV_DEBUG("TMceComEventHandler::HandleL( rtp source ), Entry"); |
|
3374 |
|
3375 TInt status = KMceEventConsumed; |
|
3376 switch( aEvent.Action() ) |
|
3377 { |
|
3378 case EMceItcEnableInactivityTimer: |
|
3379 { |
|
3380 MCESRV_DEBUG("enabling inactivity timer"); |
|
3381 MCE_HANDLER_READ( TMceItcArgTUint32, TUint32, inactivityTimeout ); |
|
3382 MCESRV_DEBUG_DVALUE("enabling inactivity timer. timeout", inactivityTimeout ); |
|
3383 |
|
3384 iMediaManager.StartInactivityTimerL( aTarget, inactivityTimeout ); |
|
3385 break; |
|
3386 } |
|
3387 case EMceItcDisableInactivityTimer: |
|
3388 { |
|
3389 MCESRV_DEBUG("disabling inactivity timer"); |
|
3390 iMediaManager.StopInactivityTimerL( aTarget ); |
|
3391 break; |
|
3392 } |
|
3393 case EMceItcSendRR: |
|
3394 { |
|
3395 MCESRV_DEBUG("sending RR"); |
|
3396 iMediaManager.SendRTCPReceiverReportL( aTarget ); |
|
3397 break; |
|
3398 } |
|
3399 default: |
|
3400 { |
|
3401 status = KMceEventNotConsumed; |
|
3402 } |
|
3403 } |
|
3404 |
|
3405 MCESRV_DEBUG("TMceComEventHandler::HandleL( rtp source ), Exit"); |
|
3406 |
|
3407 return status; |
|
3408 } |
|
3409 |
|
3410 // ----------------------------------------------------------------------------- |
|
3411 // TMceComEventHandler::HandleL |
|
3412 // ----------------------------------------------------------------------------- |
|
3413 // |
|
3414 TInt TMceComEventHandler::HandleL( CMceComSpeakerSink& aTarget, |
|
3415 TMceComEvent& aEvent ) |
|
3416 { |
|
3417 MCESRV_DEBUG("TMceComEventHandler::HandleL( speaker ), Entry"); |
|
3418 |
|
3419 TInt status = KMceEventConsumed; |
|
3420 switch( aEvent.Action() ) |
|
3421 { |
|
3422 case EMceItcVolume: |
|
3423 { |
|
3424 TInt volume = KErrNotFound; |
|
3425 iMediaManager.GetVolumeL( aTarget, volume ); |
|
3426 MCESRV_DEBUG_DVALUE("getting volume. volume", volume ); |
|
3427 MCE_HANDLER_WRITE( TMceItcArgTInt, volume ); |
|
3428 break; |
|
3429 } |
|
3430 case EMceItcAudioRouting: |
|
3431 { |
|
3432 TInt routing = KErrNotFound; |
|
3433 iMediaManager.GetAudioRoutingL( aTarget, routing ); |
|
3434 MCESRV_DEBUG_DVALUE("getting routing. value", routing ); |
|
3435 MCE_HANDLER_WRITE( TMceItcArgTInt, routing ); |
|
3436 break; |
|
3437 } |
|
3438 case EMceItcSetVolume: |
|
3439 { |
|
3440 MCE_HANDLER_READ( TMceItcArgTInt, TInt, volume ); |
|
3441 MCESRV_DEBUG_DVALUE("setting volume. new volume", volume ); |
|
3442 iMediaManager.SetVolumeL( aTarget, volume ); |
|
3443 break; |
|
3444 } |
|
3445 case EMceItcSetAudioRouting: |
|
3446 { |
|
3447 MCE_HANDLER_READ( TMceItcArgTInt, TInt, routing ); |
|
3448 MCESRV_DEBUG_DVALUE("setting routing. new value", routing ); |
|
3449 iMediaManager.SetAudioRoutingL( aTarget, routing ); |
|
3450 break; |
|
3451 } |
|
3452 default: |
|
3453 { |
|
3454 status = KMceEventNotConsumed; |
|
3455 } |
|
3456 } |
|
3457 |
|
3458 MCESRV_DEBUG("TMceComEventHandler::HandleL( speaker ), Exit"); |
|
3459 |
|
3460 return status; |
|
3461 } |
|
3462 |
|
3463 // ----------------------------------------------------------------------------- |
|
3464 // TMceComEventHandler::HandleL |
|
3465 // ----------------------------------------------------------------------------- |
|
3466 // |
|
3467 TInt TMceComEventHandler::HandleL( CMceComDisplaySink& aTarget, |
|
3468 TMceComEvent& aEvent ) |
|
3469 { |
|
3470 MCESRV_DEBUG("TMceComEventHandler::HandleL( display ), Entry"); |
|
3471 |
|
3472 TInt status = KMceEventConsumed; |
|
3473 switch( aEvent.Action() ) |
|
3474 { |
|
3475 case EMceItcDisplayRect: |
|
3476 { |
|
3477 TRect displayRect; |
|
3478 iMediaManager.GetDisplayRectL( aTarget, displayRect ); |
|
3479 MCESRV_DEBUG("getting display rect"); |
|
3480 MCE_HANDLER_WRITE( TMceItcArgTRect, displayRect ); |
|
3481 break; |
|
3482 } |
|
3483 case EMceItcDisplayPriority: |
|
3484 { |
|
3485 TInt displayPriority = KErrNotFound; |
|
3486 iMediaManager.GetDisplayPriorityL( aTarget, displayPriority ); |
|
3487 MCESRV_DEBUG_DVALUE("getting display priority. value", displayPriority ); |
|
3488 MCE_HANDLER_WRITE( TMceItcArgTInt, displayPriority ); |
|
3489 break; |
|
3490 } |
|
3491 case EMceItcDisplayRotation: |
|
3492 { |
|
3493 TInt displayRotation = KErrNotFound; |
|
3494 iMediaManager.GetDisplayRotationL( aTarget, displayRotation ); |
|
3495 MCESRV_DEBUG_DVALUE("getting display rotation. value", displayRotation ); |
|
3496 MCE_HANDLER_WRITE( TMceItcArgTInt, displayRotation ); |
|
3497 break; |
|
3498 } |
|
3499 case EMceItcSetDisplayRect: |
|
3500 { |
|
3501 MCE_HANDLER_READ( TMceItcArgTRect, TRect, rect ); |
|
3502 iMediaManager.SetDisplayRectL( aTarget, rect ); |
|
3503 MCESRV_DEBUG("setting display rect"); |
|
3504 break; |
|
3505 } |
|
3506 case EMceItcSetDisplayRotation: |
|
3507 { |
|
3508 MCE_HANDLER_READ( TMceItcArgTInt, TInt, displayRotation ); |
|
3509 iMediaManager.SetDisplayRotationL( aTarget, displayRotation ); |
|
3510 MCESRV_DEBUG("setting display rotation"); |
|
3511 break; |
|
3512 } |
|
3513 case EMceItcSetDisplayPriority: |
|
3514 { |
|
3515 MCE_HANDLER_READ( TMceItcArgTInt, TInt, displayPriority ); |
|
3516 MCESRV_DEBUG_DVALUE("setting display priority. new value", displayPriority ); |
|
3517 iMediaManager.SetDisplayPriorityL( aTarget, displayPriority ); |
|
3518 break; |
|
3519 } |
|
3520 case EMceItcSetDisplayIndex: |
|
3521 { |
|
3522 MCE_HANDLER_READ( TMceItcArgTInt, TInt, displayIndex ); |
|
3523 MCESRV_DEBUG_DVALUE("setting display index. new value", displayIndex ); |
|
3524 iMediaManager.SetDisplayIndexL( aTarget, displayIndex ); |
|
3525 break; |
|
3526 } |
|
3527 default: |
|
3528 { |
|
3529 status = KMceEventNotConsumed; |
|
3530 } |
|
3531 } |
|
3532 |
|
3533 MCESRV_DEBUG("TMceComEventHandler::HandleL( display ), Exit"); |
|
3534 |
|
3535 return status; |
|
3536 } |
|
3537 |
|
3538 // ----------------------------------------------------------------------------- |
|
3539 // TMceComEventHandler::HandleL |
|
3540 // ----------------------------------------------------------------------------- |
|
3541 // |
|
3542 TInt TMceComEventHandler::HandleL( CMceComMicSource& aTarget, |
|
3543 TMceComEvent& aEvent ) |
|
3544 { |
|
3545 MCESRV_DEBUG("TMceComEventHandler::HandleL( mic ), Entry"); |
|
3546 |
|
3547 TInt status = KMceEventConsumed; |
|
3548 switch( aEvent.Action() ) |
|
3549 { |
|
3550 case EMceItcGain: |
|
3551 { |
|
3552 TInt gain = KErrNotFound; |
|
3553 iMediaManager.GetGainL( aTarget, gain ); |
|
3554 MCESRV_DEBUG_DVALUE("getting gain. gain", gain ); |
|
3555 MCE_HANDLER_WRITE( TMceItcArgTInt, gain ); |
|
3556 break; |
|
3557 } |
|
3558 case EMceItcSetGain: |
|
3559 { |
|
3560 MCE_HANDLER_READ( TMceItcArgTInt, TInt, gain ); |
|
3561 iMediaManager.SetGainL( aTarget, gain ); |
|
3562 break; |
|
3563 } |
|
3564 default: |
|
3565 { |
|
3566 status = KMceEventNotConsumed; |
|
3567 } |
|
3568 } |
|
3569 |
|
3570 MCESRV_DEBUG("TMceComEventHandler::HandleL( mic ), Exit"); |
|
3571 |
|
3572 return status; |
|
3573 } |
|
3574 |
|
3575 // ----------------------------------------------------------------------------- |
|
3576 // TMceComEventHandler::HandleL |
|
3577 // ----------------------------------------------------------------------------- |
|
3578 // |
|
3579 TInt TMceComEventHandler::HandleL( CMceComCameraSource& aTarget, |
|
3580 TMceComEvent& aEvent ) |
|
3581 { |
|
3582 MCESRV_DEBUG("TMceComEventHandler::HandleL( camera ), Entry"); |
|
3583 |
|
3584 TInt status = KMceEventConsumed; |
|
3585 switch( aEvent.Action() ) |
|
3586 { |
|
3587 case EMceItcZoomFactor: |
|
3588 { |
|
3589 TInt zoomFactor = KErrNotFound; |
|
3590 iMediaManager.GetZoomFactorL( aTarget, zoomFactor ); |
|
3591 MCESRV_DEBUG_DVALUE("getting zoom factor. value", zoomFactor ); |
|
3592 MCE_HANDLER_WRITE( TMceItcArgTInt, zoomFactor ); |
|
3593 break; |
|
3594 } |
|
3595 case EMceItcDigitalZoomFactor: |
|
3596 { |
|
3597 TInt digitalZoomFactor = KErrNotFound; |
|
3598 iMediaManager.GetDigitalZoomFactorL( aTarget, digitalZoomFactor ); |
|
3599 MCESRV_DEBUG_DVALUE("getting digital zoom factor. value", digitalZoomFactor ); |
|
3600 MCE_HANDLER_WRITE( TMceItcArgTInt, digitalZoomFactor ); |
|
3601 break; |
|
3602 } |
|
3603 case EMceItcContrast: |
|
3604 { |
|
3605 TInt contrast = KErrNotFound; |
|
3606 iMediaManager.GetContrastL( aTarget, contrast ); |
|
3607 MCESRV_DEBUG_DVALUE("getting contrast. value", contrast ); |
|
3608 MCE_HANDLER_WRITE( TMceItcArgTInt, contrast ); |
|
3609 break; |
|
3610 } |
|
3611 case EMceItcBrightness: |
|
3612 { |
|
3613 TInt brightness = KErrNotFound; |
|
3614 iMediaManager.GetBrightnessL( aTarget, brightness ); |
|
3615 MCESRV_DEBUG_DVALUE("getting brightness. value", brightness ); |
|
3616 MCE_HANDLER_WRITE( TMceItcArgTInt, brightness ); |
|
3617 break; |
|
3618 } |
|
3619 case EMceItcExposure: |
|
3620 { |
|
3621 TInt exposure = KErrNotFound; |
|
3622 iMediaManager.GetExposureL( aTarget, exposure ); |
|
3623 MCESRV_DEBUG_DVALUE("getting exposure. value", exposure ); |
|
3624 MCE_HANDLER_WRITE( TMceItcArgTInt, exposure ); |
|
3625 break; |
|
3626 } |
|
3627 case EMceItcWhiteBalance: |
|
3628 { |
|
3629 TInt whiteBalance = KErrNotFound; |
|
3630 iMediaManager.GetWhiteBalanceL( aTarget, whiteBalance ); |
|
3631 MCESRV_DEBUG_DVALUE("getting whiteBalance. value", whiteBalance ); |
|
3632 MCE_HANDLER_WRITE( TMceItcArgTInt, whiteBalance ); |
|
3633 break; |
|
3634 } |
|
3635 case EMceItcSetCameraIndex: |
|
3636 { |
|
3637 MCE_HANDLER_READ_DATA( TMceItcArgTCameraInfo, TMceCameraInfo, cameraInfo, iWriteData ); |
|
3638 MCESRV_DEBUG_DVALUE("setting camera index. new camera index", cameraInfo.iIndex ); |
|
3639 iMediaManager.SetCameraIndexL( aTarget, cameraInfo.iIndex, cameraInfo.iInfo ); |
|
3640 MCE_HANDLER_WRITE( TMceItcArgTCameraInfo, cameraInfo ); |
|
3641 break; |
|
3642 } |
|
3643 case EMceItcSetZoomFactor: |
|
3644 { |
|
3645 MCE_HANDLER_READ( TMceItcArgTInt, TInt, zoomFactor ); |
|
3646 MCESRV_DEBUG_DVALUE("setting zoom factor. new zoom factor", zoomFactor ); |
|
3647 iMediaManager.SetZoomFactorL( aTarget, zoomFactor ); |
|
3648 break; |
|
3649 } |
|
3650 case EMceItcSetDigitalZoomFactor: |
|
3651 { |
|
3652 MCE_HANDLER_READ( TMceItcArgTInt, TInt, digitalZoomFactor ); |
|
3653 MCESRV_DEBUG_DVALUE("setting digital zoom factor. new digital zoom factor", digitalZoomFactor ); |
|
3654 iMediaManager.SetDigitalZoomFactorL( aTarget, digitalZoomFactor ); |
|
3655 break; |
|
3656 } |
|
3657 case EMceItcSetContrast: |
|
3658 { |
|
3659 MCE_HANDLER_READ( TMceItcArgTInt, TInt, contrast ); |
|
3660 MCESRV_DEBUG_DVALUE("setting contrast. new contrast", contrast ); |
|
3661 iMediaManager.SetContrastL( aTarget, contrast ); |
|
3662 break; |
|
3663 } |
|
3664 case EMceItcSetBrightness: |
|
3665 { |
|
3666 MCE_HANDLER_READ( TMceItcArgTInt, TInt, brightness ); |
|
3667 MCESRV_DEBUG_DVALUE("setting brightness. new brightness", brightness ); |
|
3668 iMediaManager.SetBrightnessL( aTarget, brightness ); |
|
3669 break; |
|
3670 } |
|
3671 case EMceItcSetExposure: |
|
3672 { |
|
3673 MCE_HANDLER_READ( TMceItcArgTInt, TInt, exposure ); |
|
3674 MCESRV_DEBUG_DVALUE("setting exposure. new exposure", exposure ); |
|
3675 iMediaManager.SetExposureL( aTarget, exposure ); |
|
3676 break; |
|
3677 } |
|
3678 case EMceItcSetWhiteBalance: |
|
3679 { |
|
3680 MCE_HANDLER_READ( TMceItcArgTInt, TInt, whiteBalance ); |
|
3681 MCESRV_DEBUG_DVALUE("setting white balance. new white balance", whiteBalance ); |
|
3682 iMediaManager.SetWhiteBalanceL( aTarget, whiteBalance ); |
|
3683 break; |
|
3684 } |
|
3685 default: |
|
3686 { |
|
3687 status = KMceEventNotConsumed; |
|
3688 break; |
|
3689 } |
|
3690 } |
|
3691 |
|
3692 MCESRV_DEBUG("TMceComEventHandler::HandleL( camera ), Exit"); |
|
3693 |
|
3694 return status; |
|
3695 } |
|
3696 |
|
3697 // ----------------------------------------------------------------------------- |
|
3698 // TMceComEventHandler::HandleL |
|
3699 // ----------------------------------------------------------------------------- |
|
3700 // |
|
3701 TInt TMceComEventHandler::HandleL( CMceComFileSource& aTarget, |
|
3702 TMceComEvent& aEvent ) |
|
3703 { |
|
3704 MCESRV_DEBUG("TMceComEventHandler::HandleL( file source ), Entry"); |
|
3705 |
|
3706 TInt status = KMceEventConsumed; |
|
3707 switch( aEvent.Action() ) |
|
3708 { |
|
3709 case EMceItcFileInfo: |
|
3710 { |
|
3711 TMceFileInfo fileInfo; |
|
3712 iMediaManager.GetFileInfoL( aTarget, fileInfo ); |
|
3713 MCE_HANDLER_WRITE( TMceItcArgTFileInfo, fileInfo ); |
|
3714 break; |
|
3715 } |
|
3716 case EMceItcFilePosition: |
|
3717 { |
|
3718 TTimeIntervalMicroSeconds filePosition; |
|
3719 iMediaManager.GetFilePositionL( aTarget, filePosition ); |
|
3720 MCE_HANDLER_WRITE( TMceItcArgTime, filePosition ); |
|
3721 break; |
|
3722 } |
|
3723 case EMceItcSetFilePosition: |
|
3724 { |
|
3725 MCE_HANDLER_READ( TMceItcArgTime, TTimeIntervalMicroSeconds, filePosition ); |
|
3726 iMediaManager.SetFilePositionL( aTarget, filePosition ); |
|
3727 break; |
|
3728 } |
|
3729 case EMceItcSetFileInfo: |
|
3730 { |
|
3731 MCE_HANDLER_READ( TMceItcArgTFileInfo, TMceFileInfo, fileInfo ); |
|
3732 iMediaManager.SetFileInfoL( aTarget, fileInfo ); |
|
3733 break; |
|
3734 } |
|
3735 case EMceItcSetFastForward: |
|
3736 { |
|
3737 TBool onoff = static_cast<TBool>( aEvent.Id().iState ); |
|
3738 iMediaManager.FastForwardL( aTarget, onoff ); |
|
3739 aEvent.Id().iState = onoff; |
|
3740 break; |
|
3741 } |
|
3742 case EMceItcSetFastRewind: |
|
3743 { |
|
3744 TBool onoff = static_cast<TBool>( aEvent.Id().iState ); |
|
3745 iMediaManager.FastRewindL( aTarget, onoff ); |
|
3746 aEvent.Id().iState = onoff; |
|
3747 break; |
|
3748 } |
|
3749 default: |
|
3750 { |
|
3751 status = KMceEventNotConsumed; |
|
3752 } |
|
3753 } |
|
3754 |
|
3755 MCESRV_DEBUG("TMceComEventHandler::HandleL( file source ), Exit"); |
|
3756 |
|
3757 return status; |
|
3758 } |
|
3759 |
|
3760 // ----------------------------------------------------------------------------- |
|
3761 // TMceComEventHandler::HandleL |
|
3762 // ----------------------------------------------------------------------------- |
|
3763 // |
|
3764 TInt TMceComEventHandler::HandleL( CMceComFileSink& /*aTarget*/, |
|
3765 TMceComEvent& aEvent ) |
|
3766 { |
|
3767 MCESRV_DEBUG("TMceComEventHandler::HandleL( file sink ), Entry"); |
|
3768 |
|
3769 TInt status = KMceEventConsumed; |
|
3770 switch( aEvent.Action() ) |
|
3771 { |
|
3772 default: |
|
3773 { |
|
3774 status = KMceEventNotConsumed; |
|
3775 } |
|
3776 } |
|
3777 |
|
3778 MCESRV_DEBUG("TMceComEventHandler::HandleL( file sink ), Exit"); |
|
3779 |
|
3780 return status; |
|
3781 } |
|
3782 |
|
3783 |
|
3784 |
|
3785 |
|
3786 |
|
3787 |
|
3788 // End of File |