|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "mceserial.h" |
|
22 #include "mcefactory.h" |
|
23 #include "ecam.h" |
|
24 |
|
25 |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 // MceSerial |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // MceSerial::DecodeL |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 void MceSerial::DecodeL( TDes8& aString, RReadStream& aReadStream ) |
|
35 { |
|
36 TUint32 len = aReadStream.ReadUint32L(); |
|
37 if ( len > 0 ) |
|
38 { |
|
39 aReadStream.ReadL( aString, len ); |
|
40 } |
|
41 else |
|
42 { |
|
43 aString.SetLength( 0 ); |
|
44 } |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // MceSerial::EncodeL |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 void MceSerial::EncodeL( const TDesC8& aString, RWriteStream& aWriteStream ) |
|
52 { |
|
53 aWriteStream.WriteUint32L( aString.Length() ); |
|
54 if ( aString.Length() > 0 ) |
|
55 { |
|
56 aWriteStream.WriteL( aString ); |
|
57 } |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // MceSerial::EncodeL |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 void MceSerial::EncodeL( HBufC8* aString, RWriteStream& aWriteStream ) |
|
65 { |
|
66 if ( aString ) |
|
67 { |
|
68 EncodeL( *aString, aWriteStream ); |
|
69 } |
|
70 else |
|
71 { |
|
72 EncodeL( KNullDesC8, aWriteStream ); |
|
73 } |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // MceSerial::DecodeL |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void MceSerial::DecodeL( HBufC8*& aBuffer, RReadStream& aReadStream ) |
|
81 { |
|
82 delete aBuffer; |
|
83 aBuffer = NULL; |
|
84 |
|
85 TUint32 len = aReadStream.ReadUint32L(); |
|
86 |
|
87 if ( len > 0 ) |
|
88 { |
|
89 HBufC8* tmpBuffer = HBufC8::NewLC ( len ); |
|
90 TPtr8 bufPtr = tmpBuffer->Des(); |
|
91 aReadStream.ReadL( bufPtr, len ); |
|
92 CleanupStack::Pop( tmpBuffer ); |
|
93 aBuffer = tmpBuffer; |
|
94 } |
|
95 else |
|
96 { |
|
97 aBuffer = KNullDesC8().AllocL(); |
|
98 } |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // MceSerial::DecodeL |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void MceSerial::DecodeL( CDesC8Array*& aArray, RReadStream& aReadStream ) |
|
106 { |
|
107 delete aArray; |
|
108 aArray = NULL; |
|
109 |
|
110 TInt count = aReadStream.ReadUint32L(); |
|
111 CDesC8ArrayFlat* tmpArray = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); |
|
112 CleanupStack::PushL( tmpArray ); |
|
113 for ( int i=0;i<count;i++ ) |
|
114 { |
|
115 TInt length = aReadStream.ReadUint32L(); |
|
116 HBufC8* item = HBufC8::NewLC( length ); |
|
117 TPtr8 ptr = item->Des(); |
|
118 aReadStream.ReadL( ptr , length ); |
|
119 tmpArray->AppendL( *item ); |
|
120 CleanupStack::PopAndDestroy( item );//item |
|
121 } |
|
122 |
|
123 CleanupStack::Pop( tmpArray ); |
|
124 aArray = tmpArray; |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // MceSerial::EncodeL |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void MceSerial::EncodeL( CDesC8Array* aArray, RWriteStream& aWriteStream ) |
|
132 { |
|
133 TInt count = aArray ? aArray->MdcaCount() : 0; |
|
134 aWriteStream.WriteUint32L( count ); |
|
135 for ( int i=0;i<count;i++ ) |
|
136 { |
|
137 TPtrC8 item = aArray->MdcaPoint( i ); |
|
138 aWriteStream.WriteUint32L( item.Length() ); |
|
139 aWriteStream.WriteL( item ); |
|
140 } |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // MceSerial::DecodeL |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void MceSerial::DecodeL( TMceMediaId& aId, RReadStream& aReadStream ) |
|
148 { |
|
149 aId.iAppId = aReadStream.ReadUint32L(); |
|
150 aId.iId = aReadStream.ReadUint32L(); |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // MceSerial::EncodeL |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 void MceSerial::EncodeL( TMceMediaId aId, RWriteStream& aWriteStream ) |
|
158 { |
|
159 aWriteStream.WriteUint32L( aId.iAppId ); |
|
160 aWriteStream.WriteUint32L( aId.iId ); |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // MceSerial::EncodeL |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 void MceSerial::EncodeL( RArray<TMceCryptoContext>& aArray, |
|
168 RWriteStream& aWriteStream ) |
|
169 { |
|
170 TInt count = aArray.Count(); |
|
171 aWriteStream.WriteUint32L( count ); |
|
172 for (int i=0; i<count; i++) |
|
173 { |
|
174 aWriteStream.WriteInt32L(aArray[i]); |
|
175 } |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // MceSerial::DecodeL |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 void MceSerial::DecodeL( RArray<TMceCryptoContext>& aArray, |
|
183 RReadStream& aReadStream ) |
|
184 { |
|
185 aArray.Reset(); |
|
186 TInt count = aReadStream.ReadUint32L(); |
|
187 for ( int i=0; i < count; i++ ) |
|
188 { |
|
189 TMceCryptoContext item = |
|
190 static_cast <TMceCryptoContext> ( aReadStream.ReadInt32L() ); |
|
191 aArray.InsertL( item, i ); |
|
192 } |
|
193 } |
|
194 |
|
195 |
|
196 // ============================ MEMBER FUNCTIONS =============================== |
|
197 // CMceMsgBase |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CMceMsgBase::CMceMsgBase |
|
201 // Initialize all members, since this class is instantiated also from stack, |
|
202 // without using new (ELeave). That means the members are not automatically |
|
203 // initialized to zero, like CBase derived objects would normally do if |
|
204 // allocated from the heap. |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 CMceMsgBase::CMceMsgBase( TMceItcDataType aType ) |
|
208 : iEncodeBuf( NULL ), |
|
209 iType( aType ), |
|
210 iPushed( EFalse ) |
|
211 { |
|
212 } |
|
213 |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CMceMsgBase::~CMceMsgBase |
|
216 // ----------------------------------------------------------------------------- |
|
217 // |
|
218 CMceMsgBase::~CMceMsgBase() |
|
219 { |
|
220 MCE_DELETE( iEncodeBuf ); |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CMceMsgBase::Type |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 TMceItcDataType CMceMsgBase::Type() |
|
228 { |
|
229 return iType; |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CMceMsgBase::EncodeBuffer |
|
234 // ----------------------------------------------------------------------------- |
|
235 // |
|
236 CBufFlat& CMceMsgBase::EncodeBuffer() |
|
237 { |
|
238 return *iEncodeBuf; |
|
239 } |
|
240 |
|
241 // ----------------------------------------------------------------------------- |
|
242 // CMceMsgBase::EncodeBufferCloneL |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 HBufC8* CMceMsgBase::EncodeBufferCloneL() |
|
246 { |
|
247 HBufC8* clone = NULL; |
|
248 if ( iEncodeBuf ) |
|
249 { |
|
250 clone = iEncodeBuf->Ptr(0).AllocL(); |
|
251 } |
|
252 return clone; |
|
253 } |
|
254 |
|
255 // ----------------------------------------------------------------------------- |
|
256 // CMceMsgBase::DecodeL |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 void CMceMsgBase::DecodeL( const TDesC8& aContext ) |
|
260 { |
|
261 |
|
262 RDesReadStream readStream( aContext ); |
|
263 CleanupClosePushL( readStream ); |
|
264 |
|
265 TBool pushed = iPushed; |
|
266 iPushed = ETrue; |
|
267 |
|
268 DoDecodeL( readStream ); |
|
269 |
|
270 iPushed = pushed; |
|
271 |
|
272 CleanupStack::PopAndDestroy(); // readStream |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CMceMsgBase::DoDecodeL |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 void CMceMsgBase::DoDecodeL( MMceComSerializationContext& aSerCtx ) |
|
280 { |
|
281 DoDecodeL( aSerCtx.ReadStream() ); |
|
282 } |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // CMceMsgBase::PushL |
|
286 // ----------------------------------------------------------------------------- |
|
287 // |
|
288 void CMceMsgBase::PushL() |
|
289 { |
|
290 User::LeaveIfError( iPushed ? KErrGeneral : KErrNone ); |
|
291 iPushed = ETrue; |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CMceMsgBase::Pop |
|
296 // ----------------------------------------------------------------------------- |
|
297 // |
|
298 void CMceMsgBase::Pop() |
|
299 { |
|
300 iPushed = EFalse; |
|
301 } |
|
302 |
|
303 // ----------------------------------------------------------------------------- |
|
304 // CMceMsgBase::OwnershipRollbackPushLC |
|
305 // ----------------------------------------------------------------------------- |
|
306 // |
|
307 void CMceMsgBase::OwnershipRollbackPushLC() |
|
308 { |
|
309 TCleanupItem paramsCleanup( OwnershipRollback, this ); |
|
310 CleanupStack::PushL( paramsCleanup ); |
|
311 } |
|
312 |
|
313 // ----------------------------------------------------------------------------- |
|
314 // CMceMsgBase::OwnershipRollback |
|
315 // ----------------------------------------------------------------------------- |
|
316 // |
|
317 void CMceMsgBase::OwnershipRollback( TAny* aMsg ) |
|
318 { |
|
319 if ( !aMsg ) |
|
320 { |
|
321 return; |
|
322 } |
|
323 CMceMsgBase* msg = reinterpret_cast< CMceMsgBase* >( aMsg ); |
|
324 msg->DoOwnershipRollback(); |
|
325 } |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // CMceMsgBase::OwnershipRollback |
|
329 // ----------------------------------------------------------------------------- |
|
330 // |
|
331 void CMceMsgBase::DoOwnershipRollback() |
|
332 { |
|
333 } |
|
334 |
|
335 // ============================ MEMBER FUNCTIONS =============================== |
|
336 // CMceMsgTextArray |
|
337 |
|
338 |
|
339 // ----------------------------------------------------------------------------- |
|
340 // CMceMsgTextArray::CMceMsgTextArray |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 CMceMsgTextArray::CMceMsgTextArray() |
|
344 : CMceMsgBase( EMceItcMsgTypeTextArray ), |
|
345 iArray( NULL ) |
|
346 { |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // CMceMsgTextArray::CMceMsgTextArray |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 CMceMsgTextArray::CMceMsgTextArray( CDesC8Array& aArray ) |
|
354 : CMceMsgBase( EMceItcMsgTypeTextArray ), |
|
355 iArray( &aArray ) |
|
356 { |
|
357 } |
|
358 |
|
359 // ----------------------------------------------------------------------------- |
|
360 // CMceMsgTextArray::~CMceMsgTextArray |
|
361 // ----------------------------------------------------------------------------- |
|
362 // |
|
363 CMceMsgTextArray::~CMceMsgTextArray() |
|
364 { |
|
365 if ( iPushed ) |
|
366 { |
|
367 LocalClose(); |
|
368 } |
|
369 } |
|
370 |
|
371 // ----------------------------------------------------------------------------- |
|
372 // CMceMsgTextArray::EncodeL |
|
373 // ----------------------------------------------------------------------------- |
|
374 // |
|
375 void CMceMsgTextArray::EncodeL() |
|
376 { |
|
377 delete iEncodeBuf; |
|
378 iEncodeBuf = NULL; |
|
379 iEncodeBuf = CBufFlat::NewL( KMceExternalizeBufferExpandSize ); |
|
380 |
|
381 RBufWriteStream writeStream( *iEncodeBuf, 0 ); |
|
382 writeStream.PushL(); |
|
383 |
|
384 MceSerial::EncodeL( iArray, writeStream ); |
|
385 |
|
386 CleanupStack::PopAndDestroy(); // writeStream |
|
387 } |
|
388 |
|
389 // ----------------------------------------------------------------------------- |
|
390 // CMceMsgTextArray::DoDecodeL |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 void CMceMsgTextArray::DoDecodeL( RReadStream& aReadStream ) |
|
394 { |
|
395 MceSerial::DecodeL( iArray, aReadStream ); |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CMceMsgTextArray::Close |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 void CMceMsgTextArray::Close() |
|
403 { |
|
404 LocalClose(); |
|
405 } |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // CMceMsgTextArray::LocalClose |
|
409 // ----------------------------------------------------------------------------- |
|
410 // |
|
411 void CMceMsgTextArray::LocalClose() |
|
412 { |
|
413 MCE_DELETE( iArray ); |
|
414 } |
|
415 |
|
416 // ----------------------------------------------------------------------------- |
|
417 // CMceMsgTextArray::Array |
|
418 // ----------------------------------------------------------------------------- |
|
419 // |
|
420 CDesC8Array* CMceMsgTextArray::Array() |
|
421 { |
|
422 MCE_MOVE_ARRPTR( iArray, ret ); |
|
423 return ret; |
|
424 } |
|
425 |
|
426 |
|
427 // ============================ MEMBER FUNCTIONS =============================== |
|
428 // CMceMsgSIPData |
|
429 |
|
430 |
|
431 // ----------------------------------------------------------------------------- |
|
432 // CMceMsgSIPData::CMceMsgSIPData |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 CMceMsgSIPData::CMceMsgSIPData() |
|
436 : CMceMsgBase( EMceItcMsgTypeSIPData ), |
|
437 iTrxType( (TUint32)KErrNotFound ), |
|
438 iSIPHeaders( NULL ), |
|
439 iContentType( NULL ), |
|
440 iContentTypeId( EMceContentTypeUserDefined ) |
|
441 { |
|
442 } |
|
443 |
|
444 // ----------------------------------------------------------------------------- |
|
445 // CMceMsgSIPData::CMceMsgSIPData |
|
446 // ----------------------------------------------------------------------------- |
|
447 // |
|
448 CMceMsgSIPData::CMceMsgSIPData( TUint32 aType, |
|
449 CDesC8Array& aSIPHeaders, |
|
450 HBufC8& aContentType ) |
|
451 : CMceMsgBase( EMceItcMsgTypeSIPData ), |
|
452 iTrxType( aType ), |
|
453 iSIPHeaders( &aSIPHeaders ), |
|
454 iContentType ( &aContentType ), |
|
455 iContentTypeId( EMceContentTypeUserDefined ) |
|
456 { |
|
457 } |
|
458 |
|
459 // ----------------------------------------------------------------------------- |
|
460 // CMceMsgSIPData::CMceMsgSIPData |
|
461 // ----------------------------------------------------------------------------- |
|
462 // |
|
463 CMceMsgSIPData::CMceMsgSIPData(TMceItcDataType aType ) |
|
464 : CMceMsgBase( aType ), |
|
465 iTrxType( (TUint32)KErrNotFound ), |
|
466 iSIPHeaders( NULL ), |
|
467 iContentType( NULL ), |
|
468 iContentTypeId( EMceContentTypeUserDefined ) |
|
469 { |
|
470 } |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // CMceMsgSIPData::CMceMsgSIPData |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 CMceMsgSIPData::CMceMsgSIPData( TMceItcDataType aType, |
|
477 TUint32 aTrxType, |
|
478 CDesC8Array& aSIPHeaders, |
|
479 HBufC8& aContentType ) |
|
480 : CMceMsgBase( aType ), |
|
481 iTrxType( aTrxType ), |
|
482 iSIPHeaders( &aSIPHeaders ), |
|
483 iContentType( &aContentType ), |
|
484 iContentTypeId( EMceContentTypeUserDefined ) |
|
485 { |
|
486 } |
|
487 |
|
488 // ----------------------------------------------------------------------------- |
|
489 // CMceMsgSIPData::~CMceMsgSIPData |
|
490 // ----------------------------------------------------------------------------- |
|
491 // |
|
492 CMceMsgSIPData::~CMceMsgSIPData() |
|
493 { |
|
494 if ( iPushed ) |
|
495 { |
|
496 LocalClose(); |
|
497 } |
|
498 } |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // CMceMsgSIPData::EncodeL |
|
502 // ----------------------------------------------------------------------------- |
|
503 // |
|
504 void CMceMsgSIPData::EncodeL() |
|
505 { |
|
506 delete iEncodeBuf; |
|
507 iEncodeBuf = NULL; |
|
508 |
|
509 iEncodeBuf = CBufFlat::NewL( KMceExternalizeBufferExpandSize ); |
|
510 |
|
511 RBufWriteStream writeStream( *iEncodeBuf, 0 ); |
|
512 writeStream.PushL(); |
|
513 |
|
514 EncodeStreamL( writeStream ); |
|
515 |
|
516 CleanupStack::PopAndDestroy(); // writeStream |
|
517 } |
|
518 |
|
519 // ----------------------------------------------------------------------------- |
|
520 // CMceMsgSIPData::EncodeL |
|
521 // ----------------------------------------------------------------------------- |
|
522 // |
|
523 void CMceMsgSIPData::EncodeStreamL( RBufWriteStream& aWriteStream ) |
|
524 { |
|
525 aWriteStream.WriteUint32L( iTrxType ); |
|
526 MceSerial::EncodeL( iSIPHeaders, aWriteStream ); |
|
527 MceSerial::EncodeL( iContentType, aWriteStream ); |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CMceMsgSIPData::DoDecodeL |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 void CMceMsgSIPData::DoDecodeL( RReadStream& aReadStream ) |
|
535 { |
|
536 iTrxType = aReadStream.ReadUint32L(); |
|
537 MceSerial::DecodeL( iSIPHeaders, aReadStream ); |
|
538 MceSerial::DecodeL( iContentType, aReadStream ); |
|
539 } |
|
540 |
|
541 // ----------------------------------------------------------------------------- |
|
542 // CMceMsgSIPData::Close |
|
543 // ----------------------------------------------------------------------------- |
|
544 // |
|
545 void CMceMsgSIPData::Close() |
|
546 { |
|
547 LocalClose(); |
|
548 } |
|
549 |
|
550 // ----------------------------------------------------------------------------- |
|
551 // CMceMsgSIPData::LocalClose |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 void CMceMsgSIPData::LocalClose() |
|
555 { |
|
556 MCE_DELETE( iContentType ); |
|
557 MCE_DELETE( iSIPHeaders ); |
|
558 } |
|
559 |
|
560 // ----------------------------------------------------------------------------- |
|
561 // CMceMsgSIPData::DoOwnershipRollback |
|
562 // ----------------------------------------------------------------------------- |
|
563 // |
|
564 void CMceMsgSIPData::DoOwnershipRollback() |
|
565 { |
|
566 iSIPHeaders = 0; |
|
567 iContentType = 0; |
|
568 } |
|
569 |
|
570 // ----------------------------------------------------------------------------- |
|
571 // CMceMsgSIPData::Headers |
|
572 // ----------------------------------------------------------------------------- |
|
573 // |
|
574 CDesC8Array* CMceMsgSIPData::Headers() |
|
575 { |
|
576 MCE_MOVE_ARRPTR( iSIPHeaders, ret ); |
|
577 return ret; |
|
578 } |
|
579 |
|
580 // ----------------------------------------------------------------------------- |
|
581 // CMceMsgSIPData::ContentType |
|
582 // ----------------------------------------------------------------------------- |
|
583 // |
|
584 HBufC8* CMceMsgSIPData::ContentType() |
|
585 { |
|
586 MCE_MOVE_BUFPTR( iContentType, ret ); |
|
587 return ret; |
|
588 } |
|
589 |
|
590 |
|
591 // ============================ MEMBER FUNCTIONS =============================== |
|
592 // CMceMsgSIPReply |
|
593 |
|
594 |
|
595 |
|
596 // ----------------------------------------------------------------------------- |
|
597 // CMceMsgSIPReply::CMceMsgSIPReply |
|
598 // ----------------------------------------------------------------------------- |
|
599 // |
|
600 CMceMsgSIPReply::CMceMsgSIPReply() |
|
601 : CMceMsgSIPData( EMceItcMsgTypeSIPReply ), |
|
602 iReason( NULL ), |
|
603 iCode( (TUint32)KErrNotFound ), |
|
604 iReasonAsPoolIndex( KErrNone ) |
|
605 { |
|
606 } |
|
607 |
|
608 // ----------------------------------------------------------------------------- |
|
609 // CMceMsgSIPReply::CMceMsgSIPReply |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 CMceMsgSIPReply::CMceMsgSIPReply( TUint32 aTrxType, |
|
613 HBufC8& aReason, |
|
614 TUint32 aCode, |
|
615 CDesC8Array& aSIPHeaders, |
|
616 HBufC8& aContentType ) |
|
617 : CMceMsgSIPData( EMceItcMsgTypeSIPReply, aTrxType, aSIPHeaders, aContentType ), |
|
618 iReason( &aReason ), |
|
619 iCode( aCode ), |
|
620 iReasonAsPoolIndex( KErrNone ) |
|
621 { |
|
622 } |
|
623 |
|
624 // ----------------------------------------------------------------------------- |
|
625 // CMceMsgSIPReply::CMceMsgSIPReply |
|
626 // ----------------------------------------------------------------------------- |
|
627 // |
|
628 CMceMsgSIPReply::CMceMsgSIPReply( HBufC8& aReason, |
|
629 TUint32 aCode, |
|
630 CDesC8Array& aSIPHeaders, |
|
631 HBufC8& aContentType) |
|
632 : CMceMsgSIPData( EMceItcMsgTypeSIPReply, |
|
633 (TUint32)KErrNotFound, |
|
634 aSIPHeaders, aContentType ), |
|
635 iReason( &aReason ), |
|
636 iCode( aCode ), |
|
637 iReasonAsPoolIndex( KErrNone ) |
|
638 { |
|
639 } |
|
640 |
|
641 // ----------------------------------------------------------------------------- |
|
642 // CMceMsgSIPReply::~CMceMsgSIPReply |
|
643 // ----------------------------------------------------------------------------- |
|
644 // |
|
645 CMceMsgSIPReply::~CMceMsgSIPReply() |
|
646 { |
|
647 if ( iPushed ) |
|
648 { |
|
649 MCE_DELETE( iReason ); |
|
650 } |
|
651 } |
|
652 |
|
653 // ----------------------------------------------------------------------------- |
|
654 // CMceMsgSIPReply::EncodeL |
|
655 // ----------------------------------------------------------------------------- |
|
656 // |
|
657 void CMceMsgSIPReply::EncodeL() |
|
658 { |
|
659 delete iEncodeBuf; |
|
660 iEncodeBuf = NULL; |
|
661 |
|
662 iEncodeBuf = CBufFlat::NewL( KMceExternalizeBufferExpandSize ); |
|
663 |
|
664 RBufWriteStream writeStream( *iEncodeBuf, 0 ); |
|
665 writeStream.PushL(); |
|
666 |
|
667 CMceMsgSIPData::EncodeStreamL( writeStream ); |
|
668 |
|
669 MceSerial::EncodeL( iReason, writeStream ); |
|
670 writeStream.WriteUint32L( iCode ); |
|
671 |
|
672 CleanupStack::PopAndDestroy(); // writeStream |
|
673 } |
|
674 |
|
675 |
|
676 // ----------------------------------------------------------------------------- |
|
677 // CMceMsgSIPReply::DoDecodeL |
|
678 // ----------------------------------------------------------------------------- |
|
679 // |
|
680 void CMceMsgSIPReply::DoDecodeL( RReadStream& aReadStream ) |
|
681 { |
|
682 CMceMsgSIPData::DoDecodeL( aReadStream ); |
|
683 |
|
684 MceSerial::DecodeL( iReason, aReadStream ); |
|
685 iCode = aReadStream.ReadUint32L(); |
|
686 } |
|
687 |
|
688 // ----------------------------------------------------------------------------- |
|
689 // CMceMsgSIPReply::Close |
|
690 // ----------------------------------------------------------------------------- |
|
691 // |
|
692 void CMceMsgSIPReply::Close() |
|
693 { |
|
694 LocalClose(); |
|
695 } |
|
696 |
|
697 // ----------------------------------------------------------------------------- |
|
698 // CMceMsgSIPReply::LocalClose |
|
699 // ----------------------------------------------------------------------------- |
|
700 // |
|
701 void CMceMsgSIPReply::LocalClose() |
|
702 { |
|
703 CMceMsgSIPData::Close(); |
|
704 MCE_DELETE( iReason ); |
|
705 } |
|
706 |
|
707 // ----------------------------------------------------------------------------- |
|
708 // CMceMsgSIPReply::Reason |
|
709 // ----------------------------------------------------------------------------- |
|
710 // |
|
711 HBufC8* CMceMsgSIPReply::Reason() |
|
712 { |
|
713 MCE_MOVE_BUFPTR( iReason, ret ); |
|
714 return ret; |
|
715 } |
|
716 |
|
717 |
|
718 // ============================ MEMBER FUNCTIONS =============================== |
|
719 // CMceMsgSIPRequest |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 // ----------------------------------------------------------------------------- |
|
725 // CMceMsgSIPRequest::CMceMsgSIPRequest |
|
726 // ----------------------------------------------------------------------------- |
|
727 // |
|
728 CMceMsgSIPRequest::CMceMsgSIPRequest() |
|
729 : CMceMsgSIPData( EMceItcMsgTypeSIPRequest ), |
|
730 iMethod( NULL ) |
|
731 { |
|
732 } |
|
733 |
|
734 |
|
735 // ----------------------------------------------------------------------------- |
|
736 // CMceMsgSIPRequest::CMceMsgSIPRequest |
|
737 // ----------------------------------------------------------------------------- |
|
738 // |
|
739 |
|
740 |
|
741 CMceMsgSIPRequest::CMceMsgSIPRequest( HBufC8& aMethod, |
|
742 CDesC8Array& aSIPHeaders, |
|
743 HBufC8& aContentType ) |
|
744 |
|
745 : CMceMsgSIPData( EMceItcMsgTypeSIPRequest, |
|
746 (TUint32)KErrNotFound, |
|
747 aSIPHeaders, |
|
748 aContentType ), |
|
749 |
|
750 iMethod (&aMethod) |
|
751 |
|
752 { |
|
753 } |
|
754 |
|
755 // ----------------------------------------------------------------------------- |
|
756 // CMceMsgSIPRequest::~CMceMsgSIPRequest |
|
757 // ----------------------------------------------------------------------------- |
|
758 // |
|
759 CMceMsgSIPRequest::~CMceMsgSIPRequest() |
|
760 { |
|
761 if ( iPushed ) |
|
762 { |
|
763 MCE_DELETE( iMethod ); |
|
764 } |
|
765 } |
|
766 |
|
767 // ----------------------------------------------------------------------------- |
|
768 // CMceMsgSIPRequest::EncodeL |
|
769 // ----------------------------------------------------------------------------- |
|
770 // |
|
771 void CMceMsgSIPRequest::EncodeL() |
|
772 { |
|
773 delete iEncodeBuf; |
|
774 iEncodeBuf = NULL; |
|
775 iEncodeBuf = CBufFlat::NewL( KMceExternalizeBufferExpandSize ); |
|
776 |
|
777 RBufWriteStream writeStream( *iEncodeBuf, 0 ); |
|
778 writeStream.PushL(); |
|
779 |
|
780 MceSerial::EncodeL( iMethod, writeStream ); |
|
781 |
|
782 CMceMsgSIPData::EncodeStreamL( writeStream ); |
|
783 |
|
784 CleanupStack::PopAndDestroy(); // writeStream |
|
785 } |
|
786 |
|
787 |
|
788 // ----------------------------------------------------------------------------- |
|
789 // CMceMsgSIPRequest::DoDecodeL |
|
790 // ----------------------------------------------------------------------------- |
|
791 // |
|
792 void CMceMsgSIPRequest::DoDecodeL( RReadStream& aReadStream ) |
|
793 { |
|
794 |
|
795 MceSerial::DecodeL( iMethod, aReadStream ); |
|
796 CMceMsgSIPData::DoDecodeL( aReadStream ); |
|
797 } |
|
798 |
|
799 |
|
800 // ----------------------------------------------------------------------------- |
|
801 // CMceMsgSIPRequest::Close |
|
802 // ----------------------------------------------------------------------------- |
|
803 // |
|
804 void CMceMsgSIPRequest::Close() |
|
805 { |
|
806 LocalClose(); |
|
807 } |
|
808 |
|
809 |
|
810 // ----------------------------------------------------------------------------- |
|
811 // CMceMsgSIPRequest::LocalClose |
|
812 // ----------------------------------------------------------------------------- |
|
813 // |
|
814 void CMceMsgSIPRequest::LocalClose() |
|
815 { |
|
816 CMceMsgSIPData::Close(); |
|
817 MCE_DELETE( iMethod ); |
|
818 } |
|
819 |
|
820 |
|
821 // ----------------------------------------------------------------------------- |
|
822 // CMceMsgSIPRequest::RequestMethod |
|
823 // ----------------------------------------------------------------------------- |
|
824 // |
|
825 HBufC8* CMceMsgSIPRequest::RequestMethod() |
|
826 { |
|
827 return iMethod; |
|
828 } |
|
829 |
|
830 |
|
831 // ============================ MEMBER FUNCTIONS =============================== |
|
832 // CMceMsgSipEvent |
|
833 |
|
834 |
|
835 // ----------------------------------------------------------------------------- |
|
836 // CMceMsgSipEvent::CMceMsgSipEvent |
|
837 // ----------------------------------------------------------------------------- |
|
838 // |
|
839 CMceMsgSIPEvent::CMceMsgSIPEvent() |
|
840 : CMceMsgSIPData( EMceItcMsgTypeEvent ), |
|
841 iId( ( TUint32 ) KErrNotFound ), |
|
842 iDialogId( ( TUint32 ) KErrNotFound ), |
|
843 iEventType( ( TUint32 ) EMceItcEventTypeEither ), |
|
844 iRecipient( NULL ), |
|
845 iOriginator( NULL ), |
|
846 iEventHeader( NULL ), |
|
847 iReferTo( NULL ), |
|
848 iReferType( CMceRefer::ENoSuppression ), |
|
849 iRefreshInterval( ( TUint32 ) KErrNotFound ) |
|
850 { |
|
851 } |
|
852 |
|
853 // ----------------------------------------------------------------------------- |
|
854 // CMceMsgSIPEvent::CMceMsgSIPEvent |
|
855 // ----------------------------------------------------------------------------- |
|
856 // |
|
857 CMceMsgSIPEvent::CMceMsgSIPEvent( |
|
858 TUint32 aId, |
|
859 TUint32 aDialogId, |
|
860 TMceItcEventType aEventType, |
|
861 HBufC8* aRecipient, |
|
862 HBufC8* aOriginator, |
|
863 HBufC8* aEventHeader, |
|
864 HBufC8* aReferTo, |
|
865 CMceRefer::TType aReferType, |
|
866 TUint32 aRefreshInterval, |
|
867 CDesC8Array* aSIPHeaders, |
|
868 HBufC8* aContentType ) |
|
869 : CMceMsgSIPData( EMceItcMsgTypeEvent, |
|
870 (TUint32)KErrNotFound, |
|
871 *aSIPHeaders, |
|
872 *aContentType ), |
|
873 iId( aId ), |
|
874 iDialogId( aDialogId ), |
|
875 iEventType( aEventType ), |
|
876 iRecipient( aRecipient ), |
|
877 iOriginator( aOriginator ), |
|
878 iEventHeader( aEventHeader ), |
|
879 iReferTo( aReferTo ), |
|
880 iReferType( aReferType ), |
|
881 iRefreshInterval( aRefreshInterval ) |
|
882 { |
|
883 } |
|
884 |
|
885 // ----------------------------------------------------------------------------- |
|
886 // CMceMsgSIPEvent::CMceMsgSIPEvent |
|
887 // ----------------------------------------------------------------------------- |
|
888 // |
|
889 CMceMsgSIPEvent::CMceMsgSIPEvent( TUint32 aId, |
|
890 TUint32 aDialogId, |
|
891 TMceItcEventType aEventType, |
|
892 CMceRefer::TType aReferType, |
|
893 TUint32 aRefreshInterval, |
|
894 CDesC8Array* aSIPHeaders, |
|
895 HBufC8* aContentType ) |
|
896 : CMceMsgSIPData( EMceItcMsgTypeEvent, |
|
897 (TUint32)KErrNotFound, |
|
898 *aSIPHeaders, |
|
899 *aContentType ), |
|
900 iId( aId ), |
|
901 iDialogId( aDialogId ), |
|
902 iEventType( aEventType ), |
|
903 iRecipient( NULL ), |
|
904 iOriginator( NULL ), |
|
905 iEventHeader( NULL ), |
|
906 iReferTo( NULL ), |
|
907 iReferType( aReferType ), |
|
908 iRefreshInterval( aRefreshInterval ) |
|
909 { |
|
910 } |
|
911 |
|
912 // ----------------------------------------------------------------------------- |
|
913 // CMceMsgSIPEvent::~CMceMsgSIPEvent |
|
914 // ----------------------------------------------------------------------------- |
|
915 // |
|
916 CMceMsgSIPEvent::~CMceMsgSIPEvent() |
|
917 { |
|
918 MCE_DELETE( iRecipient ); |
|
919 MCE_DELETE( iOriginator ); |
|
920 MCE_DELETE( iEventHeader ); |
|
921 MCE_DELETE( iReferTo ); |
|
922 MCE_DELETE( iSIPHeaders ); |
|
923 MCE_DELETE( iContentType ); |
|
924 } |
|
925 |
|
926 // ----------------------------------------------------------------------------- |
|
927 // CMceMsgSIPEvent::EncodeL |
|
928 // ----------------------------------------------------------------------------- |
|
929 // |
|
930 void CMceMsgSIPEvent::EncodeL() |
|
931 { |
|
932 delete iEncodeBuf; |
|
933 iEncodeBuf = NULL; |
|
934 iEncodeBuf = CBufFlat::NewL( KMceExternalizeBufferExpandSize ); |
|
935 |
|
936 RBufWriteStream writeStream( *iEncodeBuf, 0 ); |
|
937 writeStream.PushL(); |
|
938 writeStream.WriteUint32L( iId ); |
|
939 writeStream.WriteUint32L( iDialogId ); |
|
940 writeStream.WriteUint32L( iEventType ); |
|
941 MceSerial::EncodeL( iRecipient, writeStream ); |
|
942 MceSerial::EncodeL( iOriginator, writeStream ); |
|
943 MceSerial::EncodeL( iEventHeader, writeStream ); |
|
944 MceSerial::EncodeL( iReferTo, writeStream ); |
|
945 writeStream.WriteUint32L( iReferType ); |
|
946 writeStream.WriteUint32L( iRefreshInterval ); |
|
947 |
|
948 CMceMsgSIPData::EncodeStreamL( writeStream ); |
|
949 |
|
950 CleanupStack::PopAndDestroy(); // writeStream |
|
951 } |
|
952 |
|
953 // ----------------------------------------------------------------------------- |
|
954 // CMceMsgSipEvent::DoDecodeL |
|
955 // ----------------------------------------------------------------------------- |
|
956 // |
|
957 void CMceMsgSIPEvent::DoDecodeL( RReadStream& aReadStream ) |
|
958 { |
|
959 iId = aReadStream.ReadUint32L(); |
|
960 iDialogId = aReadStream.ReadUint32L(); |
|
961 iEventType = aReadStream.ReadUint32L(); |
|
962 MceSerial::DecodeL( iRecipient, aReadStream ); |
|
963 MceSerial::DecodeL( iOriginator, aReadStream ); |
|
964 MceSerial::DecodeL( iEventHeader, aReadStream ); |
|
965 MceSerial::DecodeL( iReferTo, aReadStream ); |
|
966 iReferType = aReadStream.ReadUint32L(); |
|
967 iRefreshInterval = aReadStream.ReadUint32L(); |
|
968 CMceMsgSIPData::DoDecodeL( aReadStream ); |
|
969 } |
|
970 |
|
971 // ----------------------------------------------------------------------------- |
|
972 // CMceMsgSIPEvent::Close |
|
973 // ----------------------------------------------------------------------------- |
|
974 // |
|
975 void CMceMsgSIPEvent::Close() |
|
976 { |
|
977 } |
|
978 |
|
979 // ----------------------------------------------------------------------------- |
|
980 // CMceMsgSIPEvent::LocalClose |
|
981 // ----------------------------------------------------------------------------- |
|
982 // |
|
983 void CMceMsgSIPEvent::LocalClose() |
|
984 { |
|
985 } |
|
986 |
|
987 // ----------------------------------------------------------------------------- |
|
988 // CMceMsgSIPEvent::DoOwnershipRollback |
|
989 // ----------------------------------------------------------------------------- |
|
990 // |
|
991 void CMceMsgSIPEvent::DoOwnershipRollback() |
|
992 { |
|
993 iRecipient = 0; |
|
994 iOriginator = 0; |
|
995 iEventHeader = 0; |
|
996 iReferTo = 0; |
|
997 iSIPHeaders = 0; |
|
998 iContentType = 0; |
|
999 } |
|
1000 |
|
1001 // ----------------------------------------------------------------------------- |
|
1002 // CMceMsgSIPEvent::Id |
|
1003 // ----------------------------------------------------------------------------- |
|
1004 // |
|
1005 TUint32 CMceMsgSIPEvent::Id() |
|
1006 { |
|
1007 return iId; |
|
1008 } |
|
1009 |
|
1010 // ----------------------------------------------------------------------------- |
|
1011 // CMceMsgSIPEvent::DialogId |
|
1012 // ----------------------------------------------------------------------------- |
|
1013 // |
|
1014 TUint32 CMceMsgSIPEvent::DialogId() |
|
1015 { |
|
1016 return iDialogId; |
|
1017 } |
|
1018 |
|
1019 // ----------------------------------------------------------------------------- |
|
1020 // CMceMsgSIPEvent::EventType |
|
1021 // ----------------------------------------------------------------------------- |
|
1022 // |
|
1023 TUint32 CMceMsgSIPEvent::EventType() |
|
1024 { |
|
1025 return iEventType; |
|
1026 } |
|
1027 |
|
1028 // ----------------------------------------------------------------------------- |
|
1029 // CMceMsgSIPEvent::Recipient |
|
1030 // ----------------------------------------------------------------------------- |
|
1031 // |
|
1032 HBufC8* CMceMsgSIPEvent::Recipient() |
|
1033 { |
|
1034 MCE_MOVE_BUFPTR( iRecipient, ret ); |
|
1035 return ret; |
|
1036 } |
|
1037 |
|
1038 // ----------------------------------------------------------------------------- |
|
1039 // CMceMsgSIPEvent::Originator |
|
1040 // ----------------------------------------------------------------------------- |
|
1041 // |
|
1042 HBufC8* CMceMsgSIPEvent::Originator() |
|
1043 { |
|
1044 MCE_MOVE_BUFPTR( iOriginator, ret ); |
|
1045 return ret; |
|
1046 } |
|
1047 |
|
1048 // ----------------------------------------------------------------------------- |
|
1049 // CMceMsgSIPEvent::EventHeader |
|
1050 // ----------------------------------------------------------------------------- |
|
1051 // |
|
1052 HBufC8* CMceMsgSIPEvent::EventHeader() |
|
1053 { |
|
1054 MCE_MOVE_BUFPTR( iEventHeader, ret ); |
|
1055 return ret; |
|
1056 } |
|
1057 |
|
1058 // ----------------------------------------------------------------------------- |
|
1059 // CMceMsgSIPEvent::ReferTo |
|
1060 // ----------------------------------------------------------------------------- |
|
1061 // |
|
1062 HBufC8* CMceMsgSIPEvent::ReferTo() |
|
1063 { |
|
1064 MCE_MOVE_BUFPTR( iReferTo, ret ); |
|
1065 return ret; |
|
1066 } |
|
1067 |
|
1068 // ----------------------------------------------------------------------------- |
|
1069 // CMceMsgSIPEvent::ReferType |
|
1070 // ----------------------------------------------------------------------------- |
|
1071 // |
|
1072 TUint32 CMceMsgSIPEvent::ReferType() |
|
1073 { |
|
1074 return iReferType; |
|
1075 } |
|
1076 |
|
1077 // ----------------------------------------------------------------------------- |
|
1078 // CMceMsgSIPEvent::RefreshInterval |
|
1079 // ----------------------------------------------------------------------------- |
|
1080 // |
|
1081 TUint32 CMceMsgSIPEvent::RefreshInterval() |
|
1082 { |
|
1083 return iRefreshInterval; |
|
1084 } |
|
1085 |
|
1086 // ----------------------------------------------------------------------------- |
|
1087 // CMceMsgSIPEvent::SIPHeaders |
|
1088 // ----------------------------------------------------------------------------- |
|
1089 // |
|
1090 CDesC8Array* CMceMsgSIPEvent::SIPHeaders() |
|
1091 { |
|
1092 MCE_MOVE_ARRPTR( iSIPHeaders, ret ); |
|
1093 return ret; |
|
1094 } |
|
1095 |
|
1096 // ----------------------------------------------------------------------------- |
|
1097 // CMceMsgSIPEvent::ContentType |
|
1098 // ----------------------------------------------------------------------------- |
|
1099 // |
|
1100 HBufC8* CMceMsgSIPEvent::ContentType() |
|
1101 { |
|
1102 MCE_MOVE_BUFPTR( iContentType, ret ); |
|
1103 return ret; |
|
1104 } |
|
1105 |
|
1106 |
|
1107 |
|
1108 // End of File |