|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : SipSigCompHandlerImp.cpp |
|
15 // Part of : SIPSigComp |
|
16 // Version : SIP/3.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include <centralrepository.h> |
|
22 #include <f32file.h> |
|
23 #include <utf.h> |
|
24 #include "sipprivatecrkeys.h" |
|
25 #include "sigcomp.h" |
|
26 #include "SipSigCompHandlerImp.h" |
|
27 #include "sigcompstateitem.h" |
|
28 #include "sipsigcompcompartmentctx.h" |
|
29 #include "sipsigcompcompartmentuser.h" |
|
30 #include "sigcompcompartment.h" |
|
31 #include "sigcompvalueconverter.h" |
|
32 #include "compressinglogic.h" |
|
33 #include "sipresponse.h" |
|
34 #include "siprequest.h" |
|
35 #include "sipsigcomphandlerinitparams.h" |
|
36 #include "SipAssert.h" |
|
37 #include "sip.h" |
|
38 #include "siperr.h" |
|
39 #include "sipstrings.h" |
|
40 #include "sipstrconsts.h" |
|
41 #include "TSIPTransportParams.h" |
|
42 #include "MLocalName.h" |
|
43 |
|
44 const TInt CSipSigCompCompartmentCtx::iOffset = |
|
45 _FOFF( CSipSigCompCompartmentCtx, iLink ); |
|
46 |
|
47 const TInt CSipSigCompCompartmentUser::iOffset = |
|
48 _FOFF( CSipSigCompCompartmentUser, iLink ); |
|
49 |
|
50 _LIT( KSigCompStaticDictionaryFile, "\\private\\101f5d36\\sipsdp.dic" ); |
|
51 |
|
52 const TInt KMaxAlgorithmLength = 256; // A value that should be large enough |
|
53 |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CSipSigCompHandlerImpl::NewL |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CSipSigCompHandlerImpl* CSipSigCompHandlerImpl::NewL( TAny* aInitParams ) |
|
60 { |
|
61 CSipSigCompHandlerImpl* self = CSipSigCompHandlerImpl::NewLC( aInitParams ); |
|
62 CleanupStack::Pop(); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CSipSigCompHandlerImpl::NewLC |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CSipSigCompHandlerImpl* CSipSigCompHandlerImpl::NewLC( TAny* aInitParams ) |
|
71 { |
|
72 CSipSigCompHandlerImpl* self = new ( ELeave ) CSipSigCompHandlerImpl( |
|
73 static_cast<TSIPSigCompHandlerInitParams*>( aInitParams ) ); |
|
74 CleanupStack::PushL( self ); |
|
75 self->ConstructL(); |
|
76 return self; |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CSipSigCompHandlerImpl::CSipSigCompHandlerImpl |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 CSipSigCompHandlerImpl::CSipSigCompHandlerImpl( |
|
84 TSIPSigCompHandlerInitParams* aInitParams ) : |
|
85 iCompartmentList( CSipSigCompCompartmentCtx::iOffset ), |
|
86 iCompartmentUserList( CSipSigCompCompartmentUser::iOffset ), |
|
87 iLocalName( aInitParams->iLocalName ) |
|
88 { |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CSipSigCompHandlerImpl::ConstructL |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CSipSigCompHandlerImpl::ConstructL() |
|
96 { |
|
97 iCompressingLogic = CSigCompCompressingLogic::NewL( *this ); |
|
98 |
|
99 HBufC* algorithmBuf = HBufC::NewLC( KMaxAlgorithmLength ); |
|
100 TPtr algorithm( algorithmBuf->Des() ); |
|
101 TInt cyclesPerBit = 0; |
|
102 TInt stateMemSize = 0; |
|
103 TInt decompressionMemSize = 0; |
|
104 |
|
105 CRepository* repository = CRepository::NewLC( KCRUidSIP ); |
|
106 User::LeaveIfError( repository->Get( KSIPSigCompCPB, cyclesPerBit ) ); |
|
107 User::LeaveIfError( repository->Get( KSIPSigCompSMS, stateMemSize ) ); |
|
108 User::LeaveIfError( repository->Get( KSIPSigCompDMS, decompressionMemSize ) ); |
|
109 User::LeaveIfError( repository->Get( KSIPSigCompAlgorithm, algorithm ) ); |
|
110 User::LeaveIfError( repository->Get( KSIPSigCompMaxCompartments, |
|
111 iMaxCompartmentCount ) ); |
|
112 CleanupStack::PopAndDestroy( repository ); |
|
113 |
|
114 HBufC8* algorithmBuf8 = HBufC8::NewLC( KMaxAlgorithmLength*2 ); |
|
115 TPtr8 algorithm8( algorithmBuf8->Des() ); |
|
116 TInt err = CnvUtfConverter::ConvertFromUnicodeToUtf8( algorithm8, algorithm ); |
|
117 if ( err ) |
|
118 { |
|
119 User::Leave( err ); |
|
120 } |
|
121 CleanupStack::Pop( algorithmBuf8 ); |
|
122 CleanupStack::PopAndDestroy( algorithmBuf ); |
|
123 CleanupStack::PushL( algorithmBuf8 ); |
|
124 |
|
125 TUint8 dictSHA1[] = |
|
126 { |
|
127 0xfb, 0xe5, 0x07, 0xdf, 0xe5, 0xe6, 0xaa, 0x5a, 0xf2, 0xab, |
|
128 0xb9, 0x14, 0xce, 0xaa, 0x05, 0xf9, 0x9c, 0xe6, 0x1b, 0xa5 |
|
129 }; |
|
130 |
|
131 TSigCompStateItem dict; |
|
132 dict.iStateIdentifier.Set( dictSHA1, sizeof( dictSHA1 ) ); |
|
133 dict.iStateLength = 0x12e4; |
|
134 dict.iStateAddress = 0; |
|
135 dict.iStateInstruction = 0; |
|
136 dict.iMinimumAccessLength = 6; |
|
137 dict.iStateValue.Set( KSigCompStaticDictionaryFile ); |
|
138 |
|
139 CSigComp::TMemorySize dmsIndex = |
|
140 TSigcompValueConverter::ConvertDecompressionMemorySize( |
|
141 decompressionMemSize ); |
|
142 CSigComp::TCyclesPerBit cpbIndex = |
|
143 TSigcompValueConverter::ConvertCyclesPerBit( cyclesPerBit ); |
|
144 CSigComp::TMemorySize smsIndex = |
|
145 TSigcompValueConverter::ConvertStateMemorySize( stateMemSize ); |
|
146 |
|
147 iSigComp = CSigComp::NewL( dmsIndex, |
|
148 cpbIndex, |
|
149 smsIndex, |
|
150 algorithm8, |
|
151 dict, |
|
152 EFalse ); |
|
153 |
|
154 CleanupStack::PopAndDestroy( algorithmBuf8 ); |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CSipSigCompHandlerImpl::~CSipSigCompHandlerImpl |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 CSipSigCompHandlerImpl::~CSipSigCompHandlerImpl() |
|
162 { |
|
163 delete iSigComp; |
|
164 RemoveAllCompartments(); |
|
165 delete iCompressingLogic; |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CSipSigCompHandlerImpl::CompartmentCount |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 TInt CSipSigCompHandlerImpl::CompartmentCount() |
|
173 { |
|
174 TInt compartmentcount = 0; |
|
175 TSglQueIter<CSipSigCompCompartmentCtx> listIter( iCompartmentList ); |
|
176 listIter.SetToFirst(); |
|
177 while ( ( listIter++ ) != NULL ) |
|
178 { |
|
179 compartmentcount++; |
|
180 } |
|
181 return compartmentcount; |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // CSipSigCompHandlerImpl::IsSupported |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 TBool CSipSigCompHandlerImpl::IsSupported() const |
|
189 { |
|
190 return ETrue; |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CSipSigCompHandlerImpl::CreateCompartmentL |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 TUint32 CSipSigCompHandlerImpl::CreateCompartmentL( TUint32 aIapId ) |
|
198 { |
|
199 return CreateCompartmentUserL( aIapId ); |
|
200 } |
|
201 |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CSipSigCompHandlerImpl::RemoveCompartment |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 void CSipSigCompHandlerImpl::RemoveCompartment( TUint32 aCompartmentId ) |
|
208 { |
|
209 DeleteCompartmentUser( aCompartmentId ); |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // CSipSigCompHandlerImpl::DecompressL |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 CBufBase* CSipSigCompHandlerImpl::DecompressL( |
|
217 const TDesC8& aMessage, |
|
218 TUint& aBytesConsumed, |
|
219 TBool aIsStreamBased ) |
|
220 { |
|
221 return iSigComp->DecompressL( aMessage, aBytesConsumed, aIsStreamBased ); |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CSipSigCompHandlerImpl::EncodeL |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 CBufBase* CSipSigCompHandlerImpl::EncodeL( |
|
229 const TSIPTransportParams& aTransportParams, |
|
230 CSIPRequest& aRequest, |
|
231 const TInetAddr& aAddress, |
|
232 TBool aStreambasedProtocol, |
|
233 TBool& aCompressed ) |
|
234 { |
|
235 return iCompressingLogic->EncodeL( aTransportParams, |
|
236 aRequest, |
|
237 aAddress, |
|
238 aStreambasedProtocol, |
|
239 aCompressed ); |
|
240 } |
|
241 |
|
242 // ----------------------------------------------------------------------------- |
|
243 // CSipSigCompHandlerImpl::EncodeL |
|
244 // ----------------------------------------------------------------------------- |
|
245 // |
|
246 CBufBase* CSipSigCompHandlerImpl::EncodeL( |
|
247 const TSIPTransportParams& aTransportParams, |
|
248 CSIPResponse& aResponse, |
|
249 const TInetAddr& aAddress, |
|
250 TBool aStreambasedProtocol, |
|
251 TBool& aCompressed ) |
|
252 { |
|
253 return iCompressingLogic->EncodeL( aTransportParams, |
|
254 aResponse, |
|
255 aAddress, |
|
256 aStreambasedProtocol, |
|
257 aCompressed ); |
|
258 } |
|
259 |
|
260 // ----------------------------------------------------------------------------- |
|
261 // CSipSigCompHandlerImpl::IsCompleteSigCompMessageL |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 TBool CSipSigCompHandlerImpl::IsCompleteSigCompMessageL( |
|
265 const TDesC8& aMessage ) const |
|
266 { |
|
267 return iSigComp->IsCompleteL( aMessage ); |
|
268 } |
|
269 // ----------------------------------------------------------------------------- |
|
270 // CSipSigCompHandlerImpl::IsSigCompMsg |
|
271 // ----------------------------------------------------------------------------- |
|
272 // |
|
273 TBool CSipSigCompHandlerImpl::IsSigCompMsg( const TDesC8& aMessage ) const |
|
274 { |
|
275 return iSigComp->IsSigCompMsg( aMessage ); |
|
276 } |
|
277 |
|
278 // ----------------------------------------------------------------------------- |
|
279 // CSipSigCompHandlerImpl::AllowL |
|
280 // ----------------------------------------------------------------------------- |
|
281 // |
|
282 void CSipSigCompHandlerImpl::AllowL( const TInetAddr& aAddress, TUint32 aIapId ) |
|
283 { |
|
284 CSipSigCompCompartmentCtx* compartment = |
|
285 SearchCompartmentByInetAddr( aAddress, aIapId ); |
|
286 if ( !compartment ) |
|
287 { |
|
288 iSigComp->Deny(); |
|
289 } |
|
290 else |
|
291 { |
|
292 iSigComp->AllowL( *compartment->Compartment() ); |
|
293 compartment->SetCurrentState( CSipSigCompCompartmentCtx::EAlive ); |
|
294 } |
|
295 } |
|
296 // ----------------------------------------------------------------------------- |
|
297 // CSipSigCompHandlerImpl::Deny |
|
298 // ----------------------------------------------------------------------------- |
|
299 // |
|
300 void CSipSigCompHandlerImpl::Deny() |
|
301 { |
|
302 iSigComp->Deny(); |
|
303 } |
|
304 |
|
305 // ----------------------------------------------------------------------------- |
|
306 // CSipSigCompHandlerImpl::SendFailedL |
|
307 // ----------------------------------------------------------------------------- |
|
308 // |
|
309 void CSipSigCompHandlerImpl::SendFailedL( TUint32 aCompartmentId ) |
|
310 { |
|
311 CSipSigCompCompartmentUser* compUser = |
|
312 SearchCompartmentUserByCompId( aCompartmentId ); |
|
313 |
|
314 if ( compUser) |
|
315 { |
|
316 compUser->SendFailedL(); |
|
317 } |
|
318 } |
|
319 |
|
320 // ----------------------------------------------------------------------------- |
|
321 // CSipSigCompHandlerImpl::HasCompartmentUser |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 TBool CSipSigCompHandlerImpl::HasCompartmentUser( |
|
325 const TSIPTransportParams& aTransportParams ) |
|
326 { |
|
327 return ( !aTransportParams.IgnoreCompartmentId() && |
|
328 SearchCompartmentUserByCompId( aTransportParams.CompartmentId() ) ); |
|
329 } |
|
330 |
|
331 // ----------------------------------------------------------------------------- |
|
332 // CSipSigCompHandlerImpl::CreateCompartmentId |
|
333 // ----------------------------------------------------------------------------- |
|
334 // |
|
335 TUint32 CSipSigCompHandlerImpl::CreateCompartmentId() |
|
336 { |
|
337 if ( iCompartmentIdCounter < KMaxTUint32 ) |
|
338 { |
|
339 iCompartmentIdCounter++; |
|
340 } |
|
341 else |
|
342 { |
|
343 iCompartmentIdCounter = 1; |
|
344 } |
|
345 return iCompartmentIdCounter; |
|
346 } |
|
347 |
|
348 // ----------------------------------------------------------------------------- |
|
349 // CSipSigCompHandlerImpl::CreateCompartmentUserL |
|
350 // ----------------------------------------------------------------------------- |
|
351 // |
|
352 TUint32 CSipSigCompHandlerImpl::CreateCompartmentUserL( TUint32 aIapId ) |
|
353 { |
|
354 TUint32 compId = CreateCompartmentId(); |
|
355 CSipSigCompCompartmentUser* compUser = |
|
356 CSipSigCompCompartmentUser::NewL( *this, |
|
357 compId, |
|
358 aIapId ); |
|
359 |
|
360 iCompartmentUserList.AddLast( *compUser ); |
|
361 return compId; |
|
362 } |
|
363 |
|
364 // ----------------------------------------------------------------------------- |
|
365 // CSipSigCompHandlerImpl::DeleteCompartmentUser |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 TInt CSipSigCompHandlerImpl::DeleteCompartmentUser( TUint32 aCompartmentId ) |
|
369 { |
|
370 CSipSigCompCompartmentUser* compUser = |
|
371 SearchCompartmentUserByCompId( aCompartmentId ); |
|
372 |
|
373 if ( compUser ) |
|
374 { |
|
375 iCompartmentUserList.Remove( *compUser ); |
|
376 delete compUser; |
|
377 return KErrNone; |
|
378 } |
|
379 |
|
380 return KErrNotFound; |
|
381 } |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // CSipSigCompHandlerImpl::SearchCompartmentUserL |
|
385 // ----------------------------------------------------------------------------- |
|
386 // |
|
387 CSipSigCompCompartmentUser* CSipSigCompHandlerImpl::SearchCompartmentUserL( |
|
388 TUint32 aCompartmentId, |
|
389 const TInetAddr& aAddress ) |
|
390 { |
|
391 CSipSigCompCompartmentUser* compUser = |
|
392 SearchCompartmentUserByCompId( aCompartmentId ); |
|
393 |
|
394 if ( compUser && !compUser->Match( aAddress ) ) |
|
395 { |
|
396 // SetAddressL maps compartmentUser with existing compartment |
|
397 // having same remote address. if no matching compartment |
|
398 // can be found, totally new compartment is created and |
|
399 // compartmentUser is mapped to that |
|
400 compUser->SetAddressL( aAddress ); |
|
401 } |
|
402 return compUser; |
|
403 } |
|
404 |
|
405 // ----------------------------------------------------------------------------- |
|
406 // CSipSigCompHandlerImpl::SearchCompartmentUserByCompId |
|
407 // ----------------------------------------------------------------------------- |
|
408 // |
|
409 CSipSigCompCompartmentUser* CSipSigCompHandlerImpl::SearchCompartmentUserByCompId( |
|
410 TUint32 aCompartmentId ) |
|
411 { |
|
412 CSipSigCompCompartmentUser* listItem; |
|
413 TSglQueIter<CSipSigCompCompartmentUser> listIter( iCompartmentUserList ); |
|
414 listIter.SetToFirst(); |
|
415 |
|
416 while ( ( listItem = listIter++ ) != NULL ) |
|
417 { |
|
418 if ( listItem->Match( aCompartmentId ) ) |
|
419 { |
|
420 return listItem; |
|
421 } |
|
422 } |
|
423 return 0; |
|
424 } |
|
425 |
|
426 // ----------------------------------------------------------------------------- |
|
427 // CSipSigCompHandlerImpl::RemoveAllCompartments |
|
428 // ----------------------------------------------------------------------------- |
|
429 // |
|
430 void CSipSigCompHandlerImpl::RemoveAllCompartments() |
|
431 { |
|
432 // Removing compartment users will lead to removal of compartments as well |
|
433 |
|
434 CSipSigCompCompartmentUser* listItem; |
|
435 TSglQueIter<CSipSigCompCompartmentUser> listIter( iCompartmentUserList ); |
|
436 listIter.SetToFirst(); |
|
437 |
|
438 while ( ( listItem = listIter++ ) != NULL ) |
|
439 { |
|
440 iCompartmentUserList.Remove( *listItem ); |
|
441 delete listItem; |
|
442 } |
|
443 } |
|
444 |
|
445 // ----------------------------------------------------------------------------- |
|
446 // CSipSigCompHandlerImpl::EncodeSipL |
|
447 // ----------------------------------------------------------------------------- |
|
448 // |
|
449 CBufBase* CSipSigCompHandlerImpl::EncodeSipL( |
|
450 CSIPResponse& aResponse, |
|
451 TBool aStreambasedProtocol ) |
|
452 { |
|
453 if ( aStreambasedProtocol ) |
|
454 { |
|
455 return aResponse.ToTextHeaderPartL(); |
|
456 } |
|
457 else |
|
458 { |
|
459 return aResponse.ToTextL(); |
|
460 } |
|
461 } |
|
462 |
|
463 // ----------------------------------------------------------------------------- |
|
464 // CSipSigCompHandlerImpl::EncodeSipL |
|
465 // ----------------------------------------------------------------------------- |
|
466 // |
|
467 CBufBase* CSipSigCompHandlerImpl::EncodeSipL( |
|
468 CSIPRequest& aRequest, |
|
469 TBool aStreambasedProtocol ) |
|
470 { |
|
471 if ( aStreambasedProtocol ) |
|
472 { |
|
473 return aRequest.ToTextHeaderPartL(); |
|
474 } |
|
475 else |
|
476 { |
|
477 return aRequest.ToTextL(); |
|
478 } |
|
479 } |
|
480 |
|
481 // ----------------------------------------------------------------------------- |
|
482 // CSipSigCompHandlerImpl::EncodeSipAndCompressL |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 CBufBase* CSipSigCompHandlerImpl::EncodeSipAndCompressL( |
|
486 const TSIPTransportParams& aTransportParams, |
|
487 CSIPResponse& aResponse, |
|
488 const TInetAddr& aAddress, |
|
489 TBool aStreambasedProtocol ) |
|
490 { |
|
491 TUint32 tempCompUserId( 0 ); |
|
492 |
|
493 CSipSigCompCompartmentUser* compUser = |
|
494 SearchCompartmentUserL( aTransportParams.CompartmentId(), aAddress ); |
|
495 |
|
496 if ( !compUser ) |
|
497 { |
|
498 // Create temporary compartment |
|
499 tempCompUserId = |
|
500 CreateCompartmentUserL( aTransportParams.IapId() ); |
|
501 |
|
502 compUser = SearchCompartmentUserL( tempCompUserId, aAddress ); |
|
503 |
|
504 __SIP_ASSERT_LEAVE( compUser, KErrNotFound ); |
|
505 } |
|
506 |
|
507 CBufBase* data = aResponse.ToTextL(); |
|
508 CleanupStack::PushL(data); |
|
509 |
|
510 __ASSERT_ALWAYS( compUser->Compartment(), User::Leave( KErrNotReady ) ); |
|
511 |
|
512 CBufBase* compressed = |
|
513 compUser->Compartment()->CompressL( data->Ptr(0), |
|
514 aStreambasedProtocol ); |
|
515 |
|
516 CleanupStack::PopAndDestroy(data); |
|
517 |
|
518 if ( tempCompUserId > 0 ) |
|
519 { |
|
520 // Remove temporary compartment |
|
521 RemoveCompartment( tempCompUserId ); |
|
522 } |
|
523 |
|
524 return compressed; |
|
525 } |
|
526 |
|
527 // ----------------------------------------------------------------------------- |
|
528 // CSipSigCompHandlerImpl::EncodeSipAndCompressL |
|
529 // ----------------------------------------------------------------------------- |
|
530 // |
|
531 CBufBase* CSipSigCompHandlerImpl::EncodeSipAndCompressL( |
|
532 const TSIPTransportParams& aTransportParams, |
|
533 CSIPRequest& aRequest, |
|
534 const TInetAddr& aAddress, |
|
535 TBool aStreambasedProtocol ) |
|
536 { |
|
537 CSipSigCompCompartmentUser* compUser = |
|
538 SearchCompartmentUserL( aTransportParams.CompartmentId(), |
|
539 aAddress ); |
|
540 |
|
541 __SIP_ASSERT_LEAVE( compUser, KErrNotFound ); |
|
542 CBufBase* data = aRequest.ToTextL(); |
|
543 CleanupStack::PushL( data ); |
|
544 |
|
545 __ASSERT_ALWAYS( compUser->Compartment(), User::Leave( KErrNotReady ) ); |
|
546 |
|
547 CBufBase* compressed = |
|
548 compUser->Compartment()->CompressL( data->Ptr(0), |
|
549 aStreambasedProtocol ); |
|
550 CleanupStack::PopAndDestroy( data ); |
|
551 return compressed; |
|
552 } |
|
553 |
|
554 // ----------------------------------------------------------------------------- |
|
555 // CSipSigCompHandlerImpl::KillMe |
|
556 // ----------------------------------------------------------------------------- |
|
557 // |
|
558 void CSipSigCompHandlerImpl::KillMe( CSipSigCompCompartmentCtx* aCompartmentCtx ) |
|
559 { |
|
560 iCompartmentList.Remove( *aCompartmentCtx ); |
|
561 delete aCompartmentCtx; |
|
562 } |
|
563 |
|
564 |
|
565 // ----------------------------------------------------------------------------- |
|
566 // CSipSigCompHandlerImpl::CreateCompartmentL |
|
567 // ----------------------------------------------------------------------------- |
|
568 // |
|
569 CSipSigCompCompartmentCtx* CSipSigCompHandlerImpl::CreateCompartmentL( |
|
570 const TInetAddr& aAddress, |
|
571 TUint32 aIapId, |
|
572 TBool aDynamicCompression ) |
|
573 { |
|
574 __ASSERT_ALWAYS(CompartmentCount() < iMaxCompartmentCount, |
|
575 User::Leave(KErrSIPMaxCompartmentsInUse)); |
|
576 |
|
577 CSipSigCompCompartmentCtx* compCtx = |
|
578 CSipSigCompCompartmentCtx::NewL( *this, |
|
579 *iSigComp, |
|
580 aAddress, |
|
581 aIapId, |
|
582 aDynamicCompression ); |
|
583 |
|
584 iCompartmentList.AddLast( *compCtx ); |
|
585 return compCtx; |
|
586 } |
|
587 |
|
588 // ----------------------------------------------------------------------------- |
|
589 // CSipSigCompHandlerImpl::SearchCompartmentByInetAddr |
|
590 // ----------------------------------------------------------------------------- |
|
591 // |
|
592 CSipSigCompCompartmentCtx* CSipSigCompHandlerImpl::SearchCompartmentByInetAddr( |
|
593 const TInetAddr& aAddress, |
|
594 TUint32 aIapId ) |
|
595 { |
|
596 CSipSigCompCompartmentCtx* listItem; |
|
597 TSglQueIter<CSipSigCompCompartmentCtx> listIter( iCompartmentList ); |
|
598 listIter.SetToFirst(); |
|
599 |
|
600 while ( ( listItem = listIter++ ) != NULL ) |
|
601 { |
|
602 if ( listItem->Match( aAddress, aIapId ) ) |
|
603 { |
|
604 return listItem; |
|
605 } |
|
606 } |
|
607 return 0; |
|
608 } |
|
609 |
|
610 // ----------------------------------------------------------------------------- |
|
611 // CSipSigCompHandlerImpl::Match |
|
612 // ----------------------------------------------------------------------------- |
|
613 // |
|
614 TBool CSipSigCompHandlerImpl::Match( const TDesC8& aAddress ) |
|
615 { |
|
616 return iLocalName.Match( aAddress ); |
|
617 } |
|
618 |
|
619 // End of File |
|
620 |