|
1 // Copyright (c) 2008-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 : sipimsconnectioncontext.cpp |
|
15 // Part of : sip ims connection context |
|
16 // implementation |
|
17 // Version : 1.0 |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <in_sock.h> |
|
25 #include "sipimsconnectioncontext.h" |
|
26 #include "sipmessageelements.h" |
|
27 #include "sipregistrationbinding.h" |
|
28 #include "sipconnection.h" |
|
29 #include "sipclienttransaction.h" |
|
30 #include "siprefresh.h" |
|
31 #include "sipimsprofilecontext.h" |
|
32 #include "sipprofileagent.h" |
|
33 #include "sipconcreteprofile.h" |
|
34 #include "SipProfileLog.h" |
|
35 #include "CSIPProxyResolver.h" |
|
36 #include "sipgendefs.h" |
|
37 #include <siperr.h> |
|
38 #include <sipresponseelements.h> |
|
39 #include <sip.h> |
|
40 #include <siphttpdigest.h> |
|
41 #include <sipprofile.h> |
|
42 |
|
43 |
|
44 const TInt KMaxIPAddressLength = 256; |
|
45 |
|
46 // ============================ MEMBER FUNCTIONS =============================== |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CSIPIMSConnectionContext::NewLC |
|
50 // (other items were commented in a header). |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CSIPIMSConnectionContext* CSIPIMSConnectionContext::NewLC() |
|
54 { |
|
55 CSIPIMSConnectionContext* self = |
|
56 new (ELeave) CSIPIMSConnectionContext(); |
|
57 CleanupStack::PushL(self); |
|
58 self->ConstructL(); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CSIPIMSConnectionContext::NewL |
|
64 // (other items were commented in a header). |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CSIPIMSConnectionContext* CSIPIMSConnectionContext::NewL() |
|
68 { |
|
69 CSIPIMSConnectionContext* self = |
|
70 CSIPIMSConnectionContext::NewLC(); |
|
71 CleanupStack::Pop(self); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CSIPIMSConnectionContext::CSIPIMSConnectionContext |
|
77 // C++ default constructor can NOT contain any code, that |
|
78 // might leave. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CSIPIMSConnectionContext::CSIPIMSConnectionContext() |
|
82 : iPreviousConnectionState(CSIPConnection::EInit) |
|
83 { |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSIPIMSConnectionContext::ConstructL |
|
88 // Symbian 2nd phase constructor can leave. |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CSIPIMSConnectionContext::ConstructL() |
|
92 { |
|
93 iLocalIP = HBufC8::NewL(KMaxIPAddressLength); |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CSIPIMSConnectionContext::~CSIPIMSConnectionContext |
|
98 // (other items were commented in a header). |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 CSIPIMSConnectionContext::~CSIPIMSConnectionContext() |
|
102 { |
|
103 iContexts.ResetAndDestroy(); |
|
104 delete iProxyResolver; |
|
105 delete iConnection; |
|
106 delete iLocalIP; |
|
107 |
|
108 iUsers.Reset(); |
|
109 iUsers.Close(); |
|
110 |
|
111 delete iSipHttpDigest; |
|
112 delete iSip; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CSIPIMSConnectionContext::SetConnectionL |
|
117 // (other items were commented in a header). |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CSIPIMSConnectionContext::SetConnectionL(CSIPConnection* aConnection) |
|
121 { |
|
122 __ASSERT_ALWAYS(aConnection != NULL, User::Leave(KErrArgument)); |
|
123 if (aConnection->State() == CSIPConnection::EActive) |
|
124 { |
|
125 RefreshLocalIPAddressL(*aConnection); |
|
126 } |
|
127 iConnection = aConnection; |
|
128 iPreviousConnectionState = iConnection->State(); |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CSIPIMSConnectionContext::Connection |
|
133 // (other items were commented in a header). |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 CSIPConnection* CSIPIMSConnectionContext::Connection() |
|
137 { |
|
138 return iConnection; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CSIPIMSConnectionContext::IsIdle |
|
143 // (other items were commented in a header). |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 TBool CSIPIMSConnectionContext::IsIdle() const |
|
147 { |
|
148 return (iContexts.Count()==0); |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CSIPIMSConnectionContext::FindContext |
|
153 // (other items were commented in a header). |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 CSIPIMSProfileContext* |
|
157 CSIPIMSConnectionContext::FindContext(TUint32 aProfileId) |
|
158 { |
|
159 CSIPIMSProfileContext* context = 0; |
|
160 TBool found = EFalse; |
|
161 for (TInt i=0; i<iContexts.Count() && !found; i++) |
|
162 { |
|
163 if (iContexts[i]->Profile() && iContexts[i]->Profile()->Id() == aProfileId) |
|
164 { |
|
165 context = iContexts[i]; |
|
166 found = ETrue; |
|
167 } |
|
168 } |
|
169 return context; |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CSIPIMSConnectionContext::IsIPSecAlreadyInUseL |
|
174 // (other items were commented in a header). |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 TBool CSIPIMSConnectionContext::IsIPSecAlreadyInUse(TBool& aRegisterInProgress) |
|
178 { |
|
179 _LIT8(KSIPIpSec3gpp, "ipsec-3gpp"); |
|
180 |
|
181 TBool ipSecInUse = EFalse; |
|
182 for (TInt i=0; i<iContexts.Count(); i++) |
|
183 { |
|
184 if (iContexts[i]->Profile() && |
|
185 iContexts[i]->Profile()->IsSecurityNegotiationEnabled() ) |
|
186 { |
|
187 if (iContexts[i]->Profile()->NegotiatedSecurityMechanism() == KSIPIpSec3gpp) |
|
188 { |
|
189 ipSecInUse = ETrue; |
|
190 } |
|
191 |
|
192 if (iContexts[i]->Profile()->Status() == CSIPConcreteProfile::ERegistrationInProgress && |
|
193 !CSIPIMSProfileContext::IsHttpDigestSettingsConfigured(*iContexts[i]->Profile())) |
|
194 { |
|
195 aRegisterInProgress = ETrue; |
|
196 } |
|
197 } |
|
198 } |
|
199 return ipSecInUse; |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CSIPIMSConnectionContext::IsIPSecInUseL |
|
204 // (other items were commented in a header). |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 TUint32 CSIPIMSConnectionContext::IsIPSecInUse() |
|
208 { |
|
209 for (TInt i=0; i<iContexts.Count(); i++) |
|
210 { |
|
211 if ( iContexts[i]->ConfiguredType() == |
|
212 CSIPIMSProfileContext::EIMSReleaseType ) |
|
213 { |
|
214 return iContexts[i]->Profile()->Id(); |
|
215 } |
|
216 } |
|
217 return 0; |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CSIPIMSConnectionContext::AddProfileContextL |
|
222 // (other items were commented in a header). |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 void |
|
226 CSIPIMSConnectionContext::AddProfileContextL(CSIPIMSProfileContext* aContext) |
|
227 { |
|
228 __ASSERT_DEBUG(aContext->Connection().IapId()==iConnection->IapId(), |
|
229 User::Invariant()); |
|
230 User::LeaveIfError(iContexts.Append(aContext)); |
|
231 } |
|
232 |
|
233 // ----------------------------------------------------------------------------- |
|
234 // CSIPIMSConnectionContext::CleanIdleContexts |
|
235 // (other items were commented in a header). |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 void CSIPIMSConnectionContext::CleanIdleContexts() |
|
239 { |
|
240 CSIPIMSProfileContext* context = 0; |
|
241 for (TInt i= iContexts.Count()-1; i >= 0;i--) |
|
242 { |
|
243 if (iContexts[i]->CurrentState() == MSIPProfileContext::EInit && |
|
244 iContexts[i]->IsIdle()) |
|
245 { |
|
246 PROFILE_DEBUG1( |
|
247 "CSIPIMSConnectionContext::CleanIdleContexts, context removed") |
|
248 context = iContexts[i]; |
|
249 iContexts.Remove(i); |
|
250 delete context; |
|
251 context = NULL; |
|
252 } |
|
253 } |
|
254 iContexts.Compress(); |
|
255 } |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // CSIPIMSConnectionContext::SetCredentials |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 TBool CSIPIMSConnectionContext::SetCredentials( |
|
262 const CSIPClientTransaction& aTransaction, |
|
263 CSIPHttpDigest& aDigest) |
|
264 { |
|
265 TBool found = EFalse; |
|
266 for (TInt i=0; i < iContexts.Count() && !found; i++) |
|
267 { |
|
268 if (iSipHttpDigest) |
|
269 { |
|
270 found = iContexts[i]->SetCredentials(aTransaction,*iSipHttpDigest); |
|
271 } |
|
272 else |
|
273 { |
|
274 found = iContexts[i]->SetCredentials(aTransaction,aDigest); |
|
275 } |
|
276 } |
|
277 return found; |
|
278 } |
|
279 |
|
280 // ----------------------------------------------------------------------------- |
|
281 // CSIPIMSConnectionContext::SetCredentials |
|
282 // ----------------------------------------------------------------------------- |
|
283 // |
|
284 TBool CSIPIMSConnectionContext::SetCredentials( |
|
285 const CSIPRefresh& aRefresh, |
|
286 CSIPHttpDigest& aDigest) |
|
287 { |
|
288 TBool found = EFalse; |
|
289 for (TInt i=0; i < iContexts.Count() && !found; i++) |
|
290 { |
|
291 if (iSipHttpDigest) |
|
292 { |
|
293 found = iContexts[i]->SetCredentials(aRefresh,*iSipHttpDigest); |
|
294 } |
|
295 else |
|
296 { |
|
297 found = iContexts[i]->SetCredentials(aRefresh,aDigest); |
|
298 } |
|
299 } |
|
300 return found; |
|
301 } |
|
302 |
|
303 // ----------------------------------------------------------------------------- |
|
304 // CSIPIMSConnectionContext::ConnectionUser |
|
305 // ----------------------------------------------------------------------------- |
|
306 // |
|
307 TBool CSIPIMSConnectionContext::ConnectionUser( CSIPConcreteProfile& aProfile ) |
|
308 { |
|
309 TBool connectionUser( EFalse ); |
|
310 if ( aProfile.IapId() == iConnection->IapId() ) |
|
311 { |
|
312 connectionUser = ( iUsers.Find( &aProfile ) != KErrNotFound ); |
|
313 } |
|
314 return connectionUser; |
|
315 } |
|
316 |
|
317 // ----------------------------------------------------------------------------- |
|
318 // CSIPIMSConnectionContext::SetConnectionUserL |
|
319 // ----------------------------------------------------------------------------- |
|
320 // |
|
321 void CSIPIMSConnectionContext::SetConnectionUserL( |
|
322 CSIPConcreteProfile& aProfile ) |
|
323 { |
|
324 __ASSERT_ALWAYS( iConnection, User::Leave( KErrNotReady ) ); |
|
325 |
|
326 iUsers.AppendL( &aProfile ); |
|
327 |
|
328 SetConnectionParameters(); |
|
329 } |
|
330 |
|
331 // ----------------------------------------------------------------------------- |
|
332 // CSIPIMSConnectionContext::CreateSipL |
|
333 // ----------------------------------------------------------------------------- |
|
334 // |
|
335 CSIP& CSIPIMSConnectionContext::CreateSipL( |
|
336 MSIPObserver& aSipObserver, |
|
337 MSIPHttpDigestChallengeObserver2& aSipHttpDigestObserver ) |
|
338 { |
|
339 __ASSERT_ALWAYS( !iSip, User::Leave( KErrAlreadyExists ) ); |
|
340 __ASSERT_ALWAYS( !iSipHttpDigest, User::Leave( KErrAlreadyExists ) ); |
|
341 |
|
342 iSip = CSIP::NewL( TUid::Null(), aSipObserver ); |
|
343 iSipHttpDigest = CSIPHttpDigest::NewL( *iSip, aSipHttpDigestObserver ); |
|
344 return *iSip; |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CSIPIMSConnectionContext::ResolveL |
|
349 // (other items were commented in a header). |
|
350 // ----------------------------------------------------------------------------- |
|
351 // |
|
352 void CSIPIMSConnectionContext::ResolveL() |
|
353 { |
|
354 CleanProxyResolving(); |
|
355 ResolveProxyL(); |
|
356 } |
|
357 |
|
358 // ----------------------------------------------------------------------------- |
|
359 // CSIPIMSConnectionContext::ResolveProxyL |
|
360 // (other items were commented in a header). |
|
361 // ----------------------------------------------------------------------------- |
|
362 // |
|
363 void CSIPIMSConnectionContext::ResolveProxyL() |
|
364 { |
|
365 PROFILE_DEBUG1("CSIPIMSConnectionContext::ResolveProxyL") |
|
366 if (iProxyResolveRequestId == 0) |
|
367 { |
|
368 if (iProxyResolver == 0) |
|
369 { |
|
370 iProxyResolver = CSIPProxyResolver::NewL(); |
|
371 } |
|
372 |
|
373 if (iConnection->State() == CSIPConnection::EActive) |
|
374 { |
|
375 PROFILE_DEBUG1("CSIPIMSConnectionContext::ResolveProxyL, resolving") |
|
376 iProxyResolver->ResolveProxyL( |
|
377 iProxyResolveRequestId, iConnection->IapId(), *this); |
|
378 } |
|
379 } |
|
380 PROFILE_DEBUG1("CSIPIMSConnectionContext::ResolveProxyL, exit") |
|
381 } |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // CSIPIMSConnectionContext::CleanProxyResolving |
|
385 // (other items were commented in a header). |
|
386 // ----------------------------------------------------------------------------- |
|
387 // |
|
388 void CSIPIMSConnectionContext::CleanProxyResolving() |
|
389 { |
|
390 PROFILE_DEBUG1("CSIPIMSConnectionContext::CleanProxyResolving") |
|
391 if(iProxyResolveRequestId) |
|
392 { |
|
393 iProxyResolver->Cancel(iProxyResolveRequestId); |
|
394 iProxyResolveRequestId = 0; |
|
395 } |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CSIPIMSConnectionContext::PreviousSIPConnectionState |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 CSIPConnection::TState |
|
403 CSIPIMSConnectionContext::PreviousSIPConnectionState() const |
|
404 { |
|
405 return iPreviousConnectionState; |
|
406 } |
|
407 |
|
408 // ----------------------------------------------------------------------------- |
|
409 // CSIPIMSConnectionContext::Contexts |
|
410 // ----------------------------------------------------------------------------- |
|
411 // |
|
412 RPointerArray<CSIPIMSProfileContext>& CSIPIMSConnectionContext::Contexts() |
|
413 { |
|
414 return iContexts; |
|
415 } |
|
416 |
|
417 // ----------------------------------------------------------------------------- |
|
418 // CSIPIMSConnectionContext::ConnectionStateChanged |
|
419 // (other items were commented in a header). |
|
420 // ----------------------------------------------------------------------------- |
|
421 // |
|
422 void CSIPIMSConnectionContext::ConnectionStateChanged( |
|
423 CSIPConnection::TState aState) |
|
424 { |
|
425 PROFILE_DEBUG1("CSIPIMSConnectionContext::ConnectionStateChanged") |
|
426 if (aState == CSIPConnection::EActive) |
|
427 { |
|
428 PROFILE_DEBUG1("ConnectionStateChanged, Active") |
|
429 TRAP_IGNORE(RefreshLocalIPAddressL(*iConnection)) |
|
430 } |
|
431 else if (aState == CSIPConnection::EInactive |
|
432 || aState == CSIPConnection::EUnavailable) |
|
433 { |
|
434 PROFILE_DEBUG3("ConnectionStateChanged, state: ", aState) |
|
435 CleanProxyResolving(); |
|
436 } |
|
437 else |
|
438 { |
|
439 PROFILE_DEBUG3("ConnectionStateChanged, state: ", aState) |
|
440 //makes pclint happy |
|
441 } |
|
442 |
|
443 CleanIdleContexts(); |
|
444 |
|
445 for (TInt i=0; i<iContexts.Count(); i++) |
|
446 { |
|
447 iContexts[i]->ConnectionStateChanged(aState); |
|
448 } |
|
449 iPreviousConnectionState = aState; |
|
450 } |
|
451 |
|
452 // ----------------------------------------------------------------------------- |
|
453 // CSIPIMSConnectionContext::IncomingResponse |
|
454 // (other items were commented in a header). |
|
455 // ----------------------------------------------------------------------------- |
|
456 // |
|
457 void CSIPIMSConnectionContext::IncomingResponse ( |
|
458 CSIPClientTransaction& aTransaction, |
|
459 CSIPRegistrationBinding& aRegistration) |
|
460 { |
|
461 PROFILE_DEBUG1("CSIPIMSConnectionContext::IncomingResponse") |
|
462 TBool handled = EFalse; |
|
463 |
|
464 CleanIdleContexts(); |
|
465 |
|
466 for (TInt i=0; i<iContexts.Count() && !handled; i++) |
|
467 { |
|
468 const CSIPResponseElements* response = aTransaction.ResponseElements(); |
|
469 if (response) |
|
470 { |
|
471 TBool isErrorResponse = (response->StatusCode() >= 300); |
|
472 TInt contextCountBefore = iContexts.Count(); |
|
473 CSIPIMSProfileContext* context = iContexts[i]; |
|
474 |
|
475 context->IncomingResponse(aTransaction, aRegistration, handled); |
|
476 |
|
477 TBool contextRemoved = (iContexts.Count() != contextCountBefore); |
|
478 if (handled && !contextRemoved && isErrorResponse) |
|
479 { |
|
480 if (context->RetryTimerInUse()) |
|
481 { |
|
482 context->RetryDeltaTimer(iContexts[i]->RetryAfterTime(), KErrNone); |
|
483 } |
|
484 else |
|
485 { |
|
486 context->RetryRegistration(); |
|
487 } |
|
488 } |
|
489 } |
|
490 } |
|
491 } |
|
492 |
|
493 // ----------------------------------------------------------------------------- |
|
494 // CSIPIMSConnectionContext::ErrorOccured |
|
495 // (other items were commented in a header). |
|
496 // ----------------------------------------------------------------------------- |
|
497 // |
|
498 void CSIPIMSConnectionContext::ErrorOccured ( |
|
499 TInt aError, |
|
500 CSIPClientTransaction& aTransaction, |
|
501 CSIPRegistrationBinding& aRegistration) |
|
502 { |
|
503 PROFILE_DEBUG3("CSIPIMSConnectionContext::ErrorOccured with transaction", aError) |
|
504 TBool handled = EFalse; |
|
505 |
|
506 CleanIdleContexts(); |
|
507 |
|
508 for (TInt i=0; i<iContexts.Count() && !handled; i++) |
|
509 { |
|
510 iContexts[i]->CSIPProfileContextBase::ErrorOccured(aError, |
|
511 aTransaction, |
|
512 aRegistration, |
|
513 handled); |
|
514 if (handled && (iProxyResolveRequestId == 0)) |
|
515 { |
|
516 if ( iContexts[i]->RetryTimerInUse() ) |
|
517 { |
|
518 iContexts[i]->RetryDeltaTimer( iContexts[i]->RetryAfterTime(), aError ); |
|
519 } |
|
520 else |
|
521 { |
|
522 iContexts[i]->RetryRegistration(); |
|
523 } |
|
524 } |
|
525 } |
|
526 } |
|
527 |
|
528 // ----------------------------------------------------------------------------- |
|
529 // CSIPIMSConnectionContext::ErrorOccured |
|
530 // (other items were commented in a header). |
|
531 // ----------------------------------------------------------------------------- |
|
532 // |
|
533 void CSIPIMSConnectionContext::ErrorOccured ( |
|
534 TInt aError, |
|
535 CSIPRegistrationBinding& aRegistration) |
|
536 { |
|
537 PROFILE_DEBUG3("CSIPIMSConnectionContext::ErrorOccured", aError) |
|
538 TBool handled = EFalse; |
|
539 |
|
540 CleanIdleContexts(); |
|
541 |
|
542 for (TInt i=0; i<iContexts.Count() && !handled; i++) |
|
543 { |
|
544 if ( aError == KErrSIPTerminatedWithResponse ) |
|
545 { |
|
546 const CSIPClientTransaction* transaction = |
|
547 iContexts[i]->Registration()->SIPRefresh()->SIPTransaction(); |
|
548 if (transaction) |
|
549 { |
|
550 aError = transaction->ResponseElements()->StatusCode(); |
|
551 iContexts[i]->CSIPProfileContextBase::ErrorOccured(aError, |
|
552 const_cast<CSIPClientTransaction&> (*transaction), |
|
553 aRegistration, |
|
554 handled); |
|
555 } |
|
556 else |
|
557 { |
|
558 iContexts[i]->CSIPProfileContextBase::ErrorOccured(aError, |
|
559 aRegistration, |
|
560 handled); |
|
561 } |
|
562 } |
|
563 else |
|
564 { |
|
565 iContexts[i]->CSIPProfileContextBase::ErrorOccured(aError, |
|
566 aRegistration, |
|
567 handled); |
|
568 } |
|
569 |
|
570 if (handled && (iProxyResolveRequestId == 0)) |
|
571 { |
|
572 if ( iContexts[i]->RetryTimerInUse() ) |
|
573 { |
|
574 iContexts[i]->RetryDeltaTimer( iContexts[i]->RetryAfterTime(), aError ); |
|
575 } |
|
576 else |
|
577 { |
|
578 iContexts[i]->RetryRegistration(); |
|
579 } |
|
580 } |
|
581 } |
|
582 } |
|
583 |
|
584 // ----------------------------------------------------------------------------- |
|
585 // CSIPIMSConnectionContext::ProxyResolvingRequestComplete |
|
586 // (other items were commented in a header). |
|
587 // ----------------------------------------------------------------------------- |
|
588 // |
|
589 void CSIPIMSConnectionContext::ProxyResolvingRequestComplete ( |
|
590 TUint /*aRequestId*/, MDesC8Array* aProxies) |
|
591 { |
|
592 PROFILE_DEBUG1("CSIPIMSConnectionContext::ProxyResolvingRequestComplete") |
|
593 iProxyResolveRequestId = 0; |
|
594 |
|
595 CleanIdleContexts(); |
|
596 |
|
597 TInt err = KErrNone; |
|
598 for (TInt i=0; i<iContexts.Count(); i++) |
|
599 { |
|
600 TRAP(err, iContexts[i]->ProxyResolvingRequestCompleteL(*aProxies)); |
|
601 if (err != KErrNone) |
|
602 { |
|
603 iContexts[i]->HandleProxyResolvingError(err); |
|
604 } |
|
605 } |
|
606 delete aProxies; |
|
607 } |
|
608 |
|
609 // ----------------------------------------------------------------------------- |
|
610 // CSIPIMSConnectionContext::ProxyResolvingRequestFailed |
|
611 // (other items were commented in a header). |
|
612 // ----------------------------------------------------------------------------- |
|
613 // |
|
614 void CSIPIMSConnectionContext::ProxyResolvingRequestFailed ( |
|
615 TUint /*aRequestId*/, TInt aError) |
|
616 { |
|
617 PROFILE_DEBUG3("CSIPIMSConnectionContext::\ |
|
618 ProxyResolvingRequestFailed", aError) |
|
619 CleanIdleContexts(); |
|
620 iProxyResolveRequestId = 0; |
|
621 |
|
622 for (TInt i=0; i<iContexts.Count(); i++) |
|
623 { |
|
624 iContexts[i]->ProxyResolvingRequestFailed(aError); |
|
625 } |
|
626 } |
|
627 |
|
628 // ----------------------------------------------------------------------------- |
|
629 // CSIPIMSConnectionContext::ErrorOccured |
|
630 // (other items were commented in a header). |
|
631 // ----------------------------------------------------------------------------- |
|
632 // |
|
633 void CSIPIMSConnectionContext::ErrorOccured ( |
|
634 TInt /*aError*/, |
|
635 CSIPTransactionBase& /*aTransaction*/) |
|
636 { |
|
637 } |
|
638 |
|
639 // ----------------------------------------------------------------------------- |
|
640 // CSIPIMSConnectionContext::IncomingRequest |
|
641 // (other items were commented in a header). |
|
642 // ----------------------------------------------------------------------------- |
|
643 // |
|
644 void CSIPIMSConnectionContext::IncomingRequest ( |
|
645 CSIPServerTransaction* /*aTransaction*/) |
|
646 { |
|
647 } |
|
648 |
|
649 // ----------------------------------------------------------------------------- |
|
650 // CSIPIMSConnectionContext::IncomingRequest |
|
651 // (other items were commented in a header). |
|
652 // ----------------------------------------------------------------------------- |
|
653 // |
|
654 void CSIPIMSConnectionContext::IncomingRequest ( |
|
655 CSIPServerTransaction* aTransaction, |
|
656 CSIPDialog& aDialog) |
|
657 { |
|
658 PROFILE_DEBUG1("CSIPIMSConnectionContext::IncomingRequest") |
|
659 TBool handled = EFalse; |
|
660 |
|
661 CleanIdleContexts(); |
|
662 |
|
663 for (TInt i=0; i<iContexts.Count() && !handled; i++) |
|
664 { |
|
665 iContexts[i]->IncomingRequest(aTransaction, aDialog, handled); |
|
666 } |
|
667 } |
|
668 |
|
669 // ----------------------------------------------------------------------------- |
|
670 // CSIPIMSConnectionContext::IncomingResponse |
|
671 // (other items were commented in a header). |
|
672 // ----------------------------------------------------------------------------- |
|
673 // |
|
674 void CSIPIMSConnectionContext::IncomingResponse ( |
|
675 CSIPClientTransaction& aTransaction) |
|
676 { |
|
677 PROFILE_DEBUG1("CSIPIMSConnectionContext::IncomingResponse") |
|
678 TBool handled = EFalse; |
|
679 |
|
680 CleanIdleContexts(); |
|
681 |
|
682 for (TInt i=0; i<iContexts.Count() && !handled; i++) |
|
683 { |
|
684 iContexts[i]->IncomingResponse(aTransaction, handled); |
|
685 } |
|
686 } |
|
687 |
|
688 // ----------------------------------------------------------------------------- |
|
689 // CSIPIMSConnectionContext::IncomingResponse |
|
690 // (other items were commented in a header). |
|
691 // ----------------------------------------------------------------------------- |
|
692 // |
|
693 void CSIPIMSConnectionContext::IncomingResponse ( |
|
694 CSIPClientTransaction& aTransaction, |
|
695 CSIPDialogAssocBase& aDialogAssoc) |
|
696 { |
|
697 PROFILE_DEBUG1("CSIPIMSConnectionContext::IncomingResponse") |
|
698 TBool handled = EFalse; |
|
699 |
|
700 CleanIdleContexts(); |
|
701 |
|
702 for (TInt i=0; i<iContexts.Count() && !handled; i++) |
|
703 { |
|
704 iContexts[i]->IncomingResponse(aTransaction, aDialogAssoc, handled); |
|
705 } |
|
706 } |
|
707 |
|
708 // ----------------------------------------------------------------------------- |
|
709 // CSIPIMSConnectionContext::IncomingResponse |
|
710 // (other items were commented in a header). |
|
711 // ----------------------------------------------------------------------------- |
|
712 // |
|
713 void CSIPIMSConnectionContext::IncomingResponse ( |
|
714 CSIPClientTransaction& /*aTransaction*/, |
|
715 CSIPInviteDialogAssoc* /*aDialogAssoc*/) |
|
716 { |
|
717 } |
|
718 |
|
719 |
|
720 // ----------------------------------------------------------------------------- |
|
721 // CSIPIMSConnectionContext::ErrorOccured |
|
722 // (other items were commented in a header). |
|
723 // ----------------------------------------------------------------------------- |
|
724 // |
|
725 void CSIPIMSConnectionContext::ErrorOccured ( |
|
726 TInt aError, |
|
727 CSIPDialogAssocBase& aDialogAssoc) |
|
728 { |
|
729 PROFILE_DEBUG3("CSIPIMSConnectionContext::ErrorOccured", aError) |
|
730 TBool handled = EFalse; |
|
731 |
|
732 CleanIdleContexts(); |
|
733 |
|
734 for (TInt i=0; i<iContexts.Count() && !handled; i++) |
|
735 { |
|
736 iContexts[i]->ErrorOccured(aDialogAssoc, aError, handled); |
|
737 } |
|
738 } |
|
739 |
|
740 // ----------------------------------------------------------------------------- |
|
741 // CSIPIMSConnectionContext::ErrorOccured |
|
742 // (other items were commented in a header). |
|
743 // ----------------------------------------------------------------------------- |
|
744 // |
|
745 void CSIPIMSConnectionContext::ErrorOccured ( |
|
746 TInt aError, |
|
747 CSIPTransactionBase& aTransaction, |
|
748 CSIPDialogAssocBase& aDialogAssoc) |
|
749 { |
|
750 PROFILE_DEBUG3("CSIPIMSConnectionContext::ErrorOccured", aError) |
|
751 TBool handled = EFalse; |
|
752 |
|
753 CleanIdleContexts(); |
|
754 |
|
755 for (TInt i=0; i<iContexts.Count() && !handled; i++) |
|
756 { |
|
757 iContexts[i]->ErrorOccured(aTransaction, aDialogAssoc, |
|
758 aError, handled); |
|
759 } |
|
760 } |
|
761 |
|
762 // ----------------------------------------------------------------------------- |
|
763 // CSIPIMSConnectionContext::ErrorOccured |
|
764 // (other items were commented in a header). |
|
765 // ----------------------------------------------------------------------------- |
|
766 // |
|
767 void CSIPIMSConnectionContext::ErrorOccured ( |
|
768 TInt /*aError*/, |
|
769 CSIPRefresh& /*aRefresh*/) |
|
770 { |
|
771 } |
|
772 |
|
773 // ----------------------------------------------------------------------------- |
|
774 // CSIPIMSConnectionContext::InviteCompleted |
|
775 // (other items were commented in a header). |
|
776 // ----------------------------------------------------------------------------- |
|
777 // |
|
778 void CSIPIMSConnectionContext::InviteCompleted ( |
|
779 CSIPClientTransaction& /*aTransaction*/) |
|
780 { |
|
781 } |
|
782 |
|
783 // ----------------------------------------------------------------------------- |
|
784 // CSIPIMSConnectionContext::InviteCanceled |
|
785 // (other items were commented in a header). |
|
786 // ----------------------------------------------------------------------------- |
|
787 // |
|
788 void CSIPIMSConnectionContext::InviteCanceled( |
|
789 CSIPServerTransaction& /*aTransaction*/) |
|
790 { |
|
791 } |
|
792 |
|
793 // ----------------------------------------------------------------------------- |
|
794 // CSIPIMSConnectionContext::LocalIPAddress |
|
795 // ----------------------------------------------------------------------------- |
|
796 // |
|
797 const TDesC8& CSIPIMSConnectionContext::LocalIPAddress() const |
|
798 { |
|
799 return *iLocalIP; |
|
800 } |
|
801 |
|
802 // ----------------------------------------------------------------------------- |
|
803 // CSIPIMSConnectionContext::AddIntoQueue |
|
804 // ----------------------------------------------------------------------------- |
|
805 // |
|
806 TBool CSIPIMSConnectionContext::AddIntoQueue( const TDesC8& aValue ) |
|
807 { |
|
808 PROFILE_DEBUG1("CSIPIMSConnectionContext::AddIntoQue") |
|
809 TBool result = EFalse; |
|
810 for (TInt i=0; i<iContexts.Count() && !result; i++) |
|
811 { |
|
812 result = iContexts[i]->AddIntoQueue( aValue ); |
|
813 } |
|
814 return result; |
|
815 } |
|
816 |
|
817 // ----------------------------------------------------------------------------- |
|
818 // CSIPIMSConnectionContext::RefreshLocalIPAddressL |
|
819 // ----------------------------------------------------------------------------- |
|
820 // |
|
821 void CSIPIMSConnectionContext::RefreshLocalIPAddressL( |
|
822 const CSIPConnection& aConnection) |
|
823 { |
|
824 TInetAddr addr; |
|
825 aConnection.GetLocalAddrL(addr); |
|
826 HBufC* tmp = HBufC::NewLC(KMaxIPAddressLength); |
|
827 TPtr tmpPtr(tmp->Des()); |
|
828 addr.Output(tmpPtr); |
|
829 iLocalIP->Des().Copy(tmpPtr); |
|
830 CleanupStack::PopAndDestroy(tmp); |
|
831 } |
|
832 |
|
833 |
|
834 // ----------------------------------------------------------------------------- |
|
835 // CSIPIMSConnectionContext::SetConnectionParameters |
|
836 // ----------------------------------------------------------------------------- |
|
837 // |
|
838 void CSIPIMSConnectionContext::SetConnectionParameters() |
|
839 { |
|
840 PROFILE_DEBUG1("CSIPIMSConnectionContext::SetConnectionParameters") |
|
841 |
|
842 // Params are taken from first user |
|
843 if ( iUsers.Count() > 0 && |
|
844 !iConnectionParamsSet && |
|
845 iConnection ) |
|
846 { |
|
847 TUint32 signallingQosValue( 0 ); |
|
848 if ( iUsers[ 0 ]->ExtensionParameter( |
|
849 KSIPSoIpTOS, signallingQosValue ) != KErrNotFound ) |
|
850 { |
|
851 PROFILE_DEBUG3( |
|
852 "CSIPIMSConnectionContext::SetConnectionParametersL, val:", |
|
853 signallingQosValue) |
|
854 |
|
855 // Errors can be ignored as they are not preventing registration |
|
856 TRAP_IGNORE( iConnection->SetOptL( KSoIpTOS, |
|
857 KProtocolInetIp, |
|
858 signallingQosValue ) ) |
|
859 iConnectionParamsSet = ETrue; |
|
860 } |
|
861 } |
|
862 |
|
863 PROFILE_DEBUG1("CSIPIMSConnectionContext::SetConnectionParameters, exit") |
|
864 } |
|
865 |