|
1 // Copyright (c) 2005-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 : CSIPRegistrationMgr.cpp |
|
15 // Part of : Registration |
|
16 // Version : SIP/4.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include "CSIPRegistrationMgr.h" |
|
23 #include "CSIPRegistrarStore.h" |
|
24 #include "CSIPRegistrar.h" |
|
25 #include "CSIPRegistrationBindingStore.h" |
|
26 #include "CSIPRegistrationBinding.h" |
|
27 #include "CSIPRegistrationRefreshBinding.h" |
|
28 #include "TSIPRegistrationUtility.h" |
|
29 #include "csipregistrationstate.h" |
|
30 #include "MRegistrationOwner.h" |
|
31 #include "MTransactionUser.h" |
|
32 #include "MSipRefreshMgr.h" |
|
33 #include "siprequest.h" |
|
34 #include "sipfromheader.h" |
|
35 #include "siptoheader.h" |
|
36 #include "sippassociateduriheader.h" |
|
37 #include "sipaddress.h" |
|
38 #include "sipcontactheader.h" |
|
39 #include "sipuri.h" |
|
40 #include "uricontainer.h" |
|
41 #include "siphostport.h" |
|
42 #include "siprouteheader.h" |
|
43 #include "SipLogs.h" |
|
44 #include "siperr.h" |
|
45 #include "SipAssert.h" |
|
46 #include "sipcodecerr.h" |
|
47 #include "TSIPTransportParams.h" |
|
48 |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CSIPRegistrationMgr::NewL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CSIPRegistrationMgr* CSIPRegistrationMgr::NewL(MTransactionUser& aTU, |
|
55 MSipRefreshMgr& aRefreshMgr, |
|
56 MTimerManager& aTimerManager, |
|
57 CSIPSec& aSIPSec, |
|
58 MSigComp& aSigComp, |
|
59 MSIPTransportMgr& aTransportMgr) |
|
60 { |
|
61 CSIPRegistrationMgr* self = |
|
62 new (ELeave) CSIPRegistrationMgr(aTU, aRefreshMgr, aTimerManager, |
|
63 aSIPSec, aSigComp, aTransportMgr); |
|
64 CleanupStack::PushL(self); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop(self); |
|
67 return self; |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CSIPRegistrationMgr::CSIPRegistrationMgr |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CSIPRegistrationMgr::CSIPRegistrationMgr(MTransactionUser& aTU, |
|
75 MSipRefreshMgr& aRefreshMgr, |
|
76 MTimerManager& aTimerManager, |
|
77 CSIPSec& aSIPSec, |
|
78 MSigComp& aSigComp, |
|
79 MSIPTransportMgr& aTransportMgr) |
|
80 : iTU (aTU), |
|
81 iRefreshMgr (aRefreshMgr), |
|
82 iTimerMgr (aTimerManager), |
|
83 iSIPSec (aSIPSec), |
|
84 iSigComp (aSigComp), |
|
85 iTransportMgr (aTransportMgr) |
|
86 { |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CSIPRegistrationMgr::ConstructL |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void CSIPRegistrationMgr::ConstructL() |
|
94 { |
|
95 //ask the local address from transaction user. |
|
96 iRegistrarStore = CSIPRegistrarStore::NewL(); |
|
97 iBindingStore = CSIPRegistrationBindingStore::NewL(*iRegistrarStore); |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CSIPRegistrationMgr::~CSIPRegistrationMgr |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 CSIPRegistrationMgr::~CSIPRegistrationMgr() |
|
105 { |
|
106 delete iBindingStore; |
|
107 delete iRegistrarStore; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CSIPRegistrationMgr::RegisterL |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 void CSIPRegistrationMgr::RegisterL (TTransactionId& aTransactionId, |
|
115 TRegistrationId& aRegistrationId, |
|
116 CSIPRequest* aRequest, |
|
117 CURIContainer& aRemoteTarget, |
|
118 MRegistrationOwner* aRegistrationOwner, |
|
119 MSIPSecUser& aSIPSecUser, |
|
120 CSIPRouteHeader* aOutboundProxy, |
|
121 TBool aRefresh, |
|
122 TBool aSendWithExpires, |
|
123 TBool aCacheOutboundProxyIP) |
|
124 { |
|
125 // panic if aRequest is 0 in debug mode. leaves in release mode. |
|
126 __SIP_ASSERT_LEAVE(aRequest, KErrArgument); |
|
127 // panic if aRegistrationOwner is 0 in debug mode. leaves in release mode. |
|
128 __SIP_ASSERT_LEAVE(aRegistrationOwner, KErrArgument); |
|
129 |
|
130 __SIP_MESSAGE_LOG("Registration::RegisterL", *aRequest) |
|
131 |
|
132 TUint32 iapId = aRegistrationOwner->TransportParams().IapId(); |
|
133 TSIPRegistrationUtility::CheckRegisterRequestL( |
|
134 *aRequest,aOutboundProxy,iapId,iTU); |
|
135 |
|
136 if (aOutboundProxy) |
|
137 { |
|
138 __ASSERT_ALWAYS(aOutboundProxy->SIPAddress().URI().IsSIPURI(), |
|
139 User::Leave(KErrSipCodecURIScheme)); |
|
140 TSIPRegistrationUtility::CheckOutboundProxyCompParameterL( |
|
141 *aOutboundProxy, iSigComp); |
|
142 } |
|
143 |
|
144 // check if there are pending bindings to same AOR (registrar) |
|
145 if(iBindingStore->RegisterPendingToAOR( |
|
146 aRequest->To()->SIPAddress().URI())) |
|
147 { |
|
148 User::Leave(KErrSIPRequestPending); |
|
149 } |
|
150 |
|
151 // find existing binding by comparing URI of To, Form and Contact |
|
152 CSIPRegistrationBindingBase* binding = |
|
153 iBindingStore->FindBinding(*aRegistrationOwner, *aRequest); |
|
154 |
|
155 // leave if binding already exists |
|
156 __ASSERT_ALWAYS (!binding, User::Leave (KErrAlreadyExists)); |
|
157 |
|
158 if (aRemoteTarget.IsSIPURI()) |
|
159 { |
|
160 aRemoteTarget.SIPURI()->DeleteUserInfo(); // user and password |
|
161 } |
|
162 |
|
163 if (aRefresh) // create refresh binding |
|
164 { |
|
165 binding = CSIPRegistrationRefreshBinding::NewLC( |
|
166 aRequest, iTU, iSigComp, iSIPSec, iRefreshMgr, |
|
167 *iBindingStore, aRegistrationOwner, aSIPSecUser, |
|
168 iTransportMgr, aRemoteTarget,aSendWithExpires, |
|
169 aCacheOutboundProxyIP); |
|
170 } |
|
171 else // create non refresh binding |
|
172 { |
|
173 binding = CSIPRegistrationBinding::NewLC( |
|
174 aRequest, iSigComp, iSIPSec, iTimerMgr, iTU, |
|
175 *iBindingStore, aRegistrationOwner, aSIPSecUser, |
|
176 iTransportMgr, aRemoteTarget,aSendWithExpires, |
|
177 aCacheOutboundProxyIP); |
|
178 } |
|
179 TCleanupItem cleanupItem (DetachBinding, binding); |
|
180 iBindingStore->AddBindingL(binding); |
|
181 // if register fails, cleanupItem detach the binding from binding store. |
|
182 CleanupStack::PushL(cleanupItem); |
|
183 // send request |
|
184 binding->CurrentState().RegisterL(aTransactionId, aRequest, aOutboundProxy); |
|
185 CleanupStack::Pop(); // cleanupItem |
|
186 CleanupStack::Pop(binding); |
|
187 aRegistrationId = binding->RegistrationId(); |
|
188 binding->SetRequest(aRequest); // take ownership of request |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CSIPRegistrationMgr::UpdateRegistrationL |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 void CSIPRegistrationMgr::UpdateRegistrationL ( |
|
196 const TRegistrationId& aRegistrationId, |
|
197 TTransactionId& aTransactionId, |
|
198 CSIPRequest* aRequest, |
|
199 const MRegistrationOwner* aOwner) |
|
200 { |
|
201 __SIP_ASSERT_LEAVE(aRequest, KErrArgument); |
|
202 |
|
203 __SIP_MESSAGE_LOG("Registration::UpdateRegistrationL", *aRequest) |
|
204 |
|
205 CSIPRegistrationBindingBase* binding = |
|
206 iBindingStore->FindBinding(aRegistrationId,aOwner); |
|
207 |
|
208 // leave if binding doesn't exist |
|
209 __ASSERT_ALWAYS (binding, User::Leave(KErrSIPInvalidRegistrationState)); |
|
210 |
|
211 TSIPRegistrationUtility::CheckUpdateRegisterRequestL(*aRequest, *binding); |
|
212 |
|
213 // if UpdateL fails the binding must be detached from binding store |
|
214 // and deleted. the cleanupItem detaches binding from binding store. |
|
215 TCleanupItem cleanupItem(DetachBinding, binding); |
|
216 CleanupStack::PushL(binding); |
|
217 CleanupStack::PushL(cleanupItem); |
|
218 // send request |
|
219 binding->CurrentState().UpdateL(aTransactionId, aRequest); |
|
220 CleanupStack::Pop(); // cleanupItem |
|
221 CleanupStack::Pop(binding); |
|
222 binding->SetRequest(aRequest); // take ownership of aRequest |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CSIPRegistrationMgr::UnRegisterL |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 void CSIPRegistrationMgr::UnRegisterL (const TRegistrationId& aRegistrationId, |
|
230 TTransactionId& aTransactionId, |
|
231 CSIPRequest* aRequest, |
|
232 const MRegistrationOwner* aOwner) |
|
233 { |
|
234 __SIP_ASSERT_LEAVE(aRequest, KErrArgument); |
|
235 |
|
236 __SIP_MESSAGE_LOG("Registration::UnRegisterL", *aRequest) |
|
237 |
|
238 CSIPRegistrationBindingBase* binding = |
|
239 iBindingStore->FindBinding(aRegistrationId,aOwner); |
|
240 |
|
241 // leave if binding doesn't exist |
|
242 __ASSERT_ALWAYS (binding, User::Leave(KErrSIPInvalidRegistrationState)); |
|
243 |
|
244 TSIPRegistrationUtility::CheckUnregisterRequestL(*aRequest, *binding); |
|
245 |
|
246 // if UnregisterL fails the binding must be detached from binding store |
|
247 // and deleted. the cleanupItem detaches binding from binding store. |
|
248 TCleanupItem cleanupItem(DetachBinding, binding); |
|
249 CleanupStack::PushL(binding); |
|
250 CleanupStack::PushL(cleanupItem); |
|
251 // send request |
|
252 binding->CurrentState().UnregisterL(aTransactionId, aRequest); |
|
253 CleanupStack::Pop(); // cleanupItem |
|
254 CleanupStack::Pop(binding); |
|
255 |
|
256 binding->SetRequest(aRequest); // take ownership of aRequest |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CSIPRegistrationMgr::SetOutboundProxyL |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 void CSIPRegistrationMgr::SetOutboundProxyL ( |
|
264 const TRegistrationId& aRegistrationId, |
|
265 CSIPRouteHeader* aOutboundProxy, |
|
266 const MRegistrationOwner* aOwner) |
|
267 { |
|
268 __SIP_ASSERT_LEAVE(aOutboundProxy, KErrArgument); |
|
269 |
|
270 __ASSERT_ALWAYS(aOutboundProxy->SIPAddress().URI().IsSIPURI(), |
|
271 User::Leave(KErrSipCodecURIScheme)); |
|
272 |
|
273 iBindingStore->SetOutboundProxyL(aRegistrationId,aOutboundProxy,aOwner); |
|
274 } |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // CSIPRegistrationMgr::RemoveOutboundProxy |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 TInt CSIPRegistrationMgr::RemoveOutboundProxy ( |
|
281 const TRegistrationId& aRegistrationId, |
|
282 const MRegistrationOwner* aOwner) |
|
283 { |
|
284 return (iBindingStore->RemoveOutboundProxy(aRegistrationId,aOwner)); |
|
285 } |
|
286 |
|
287 // ----------------------------------------------------------------------------- |
|
288 // CSIPRegistrationMgr::FetchRegistrationsL |
|
289 // ----------------------------------------------------------------------------- |
|
290 // |
|
291 void CSIPRegistrationMgr::FetchRegistrationsL ( |
|
292 const TSIPTransportParams& aTransportParams, |
|
293 TTransactionId& aTransactionId, |
|
294 CSIPRequest* aRequest, |
|
295 CURIContainer& aRemoteTarget, |
|
296 MTransactionOwner* aTransactionOwner) |
|
297 { |
|
298 __SIP_ASSERT_LEAVE(aRequest, KErrArgument); |
|
299 __SIP_ASSERT_LEAVE(aTransactionOwner, KErrArgument); |
|
300 |
|
301 __SIP_MESSAGE_LOG("Registration::FetchRegistrationsL", *aRequest) |
|
302 |
|
303 TSIPRegistrationUtility::CheckFetchingRequestL(*aRequest); |
|
304 |
|
305 if (aRemoteTarget.IsSIPURI()) |
|
306 { |
|
307 aRemoteTarget.SIPURI()->DeleteUserInfo(); // user and password |
|
308 } |
|
309 |
|
310 iTU.SendL(aTransactionId, KEmptyRegistrationId, aRequest, |
|
311 aTransactionOwner, aRemoteTarget, aTransportParams, ETrue); |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // CSIPRegistrationMgr::GetRouteL |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 void CSIPRegistrationMgr::GetRouteL ( |
|
319 const TRegistrationId& aRegistrationId, |
|
320 RPointerArray<CSIPRouteHeader>& aRouteSet, |
|
321 TBool aAddOutboundProxy) |
|
322 { |
|
323 CSIPRegistrationBindingBase* binding = |
|
324 iBindingStore->FindBinding(aRegistrationId); |
|
325 |
|
326 if (binding) |
|
327 { |
|
328 const CSIPRouteHeader* proxy = binding->OutboundProxy(); |
|
329 if (proxy && aAddOutboundProxy) |
|
330 { |
|
331 aRouteSet.AppendL(proxy); |
|
332 } |
|
333 |
|
334 for (TInt i = 0; i < binding->RouteSet().Count(); i++) |
|
335 { |
|
336 CSIPRouteHeader* routeHeader = (binding->RouteSet())[i]; |
|
337 aRouteSet.AppendL(routeHeader); |
|
338 } |
|
339 } |
|
340 } |
|
341 |
|
342 // ----------------------------------------------------------------------------- |
|
343 // CSIPRegistrationMgr::CreateFromLC |
|
344 // ----------------------------------------------------------------------------- |
|
345 // |
|
346 CSIPFromHeader* CSIPRegistrationMgr::CreateFromLC ( |
|
347 const TRegistrationId& aRegistrationId) |
|
348 { |
|
349 CSIPRegistrationBindingBase* binding = |
|
350 iBindingStore->FindBinding(aRegistrationId); |
|
351 |
|
352 __ASSERT_ALWAYS(binding, User::Leave(KErrNotFound)); |
|
353 |
|
354 CSIPFromHeader* from = NULL; |
|
355 if (binding->PAssociatedURIHeader()) |
|
356 { |
|
357 CSIPAddress* sipAddress = |
|
358 CSIPAddress::NewLC(binding->PAssociatedURIHeader()->SIPAddress()); |
|
359 from = CSIPFromHeader::NewL(sipAddress); |
|
360 CleanupStack::Pop(sipAddress); |
|
361 CleanupStack::PushL(from); |
|
362 } |
|
363 else |
|
364 { |
|
365 from = CSIPFromHeader::NewLC(binding->AOR()); |
|
366 } |
|
367 return from; |
|
368 } |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CSIPRegistrationMgr::ClearRegistrationOwner |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 TInt CSIPRegistrationMgr::ClearRegistrationOwner ( |
|
375 const MRegistrationOwner* aRegistrationOwner) |
|
376 { |
|
377 return (iBindingStore->ClearRegistrationOwner(aRegistrationOwner)); |
|
378 } |
|
379 |
|
380 // ----------------------------------------------------------------------------- |
|
381 // CSIPRegistrationMgr::TerminateRegistration |
|
382 // ----------------------------------------------------------------------------- |
|
383 // |
|
384 TInt CSIPRegistrationMgr::TerminateRegistration ( |
|
385 const TRegistrationId& aRegistrationId, |
|
386 const MRegistrationOwner* aOwner) |
|
387 { |
|
388 return iBindingStore->RemoveBinding(aRegistrationId,aOwner); |
|
389 } |
|
390 |
|
391 // ----------------------------------------------------------------------------- |
|
392 // CSIPRegistrationMgr::CheckRequestURI |
|
393 // ----------------------------------------------------------------------------- |
|
394 // |
|
395 TBool CSIPRegistrationMgr::CheckRequestURI(CURIContainer& aRequestUri) |
|
396 { |
|
397 return (iBindingStore->CheckRequestURI(aRequestUri)); |
|
398 } |
|
399 |
|
400 // ----------------------------------------------------------------------------- |
|
401 // CSIPRegistrationMgr::OutboundProxy |
|
402 // ----------------------------------------------------------------------------- |
|
403 // |
|
404 const CSIPRouteHeader* CSIPRegistrationMgr::OutboundProxy( |
|
405 TRegistrationId aRegistrationId) |
|
406 { |
|
407 return iBindingStore->OutboundProxy(aRegistrationId); |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // CSIPRegistrationMgr::HasOutboundProxy |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 TBool CSIPRegistrationMgr::HasOutboundProxy( |
|
415 TRegistrationId aRegistrationId) const |
|
416 { |
|
417 return iBindingStore->HasOutboundProxy(aRegistrationId); |
|
418 } |
|
419 |
|
420 // ----------------------------------------------------------------------------- |
|
421 // CSIPRegistrationMgr::IsOutboundProxy |
|
422 // ----------------------------------------------------------------------------- |
|
423 // |
|
424 TBool CSIPRegistrationMgr::IsOutboundProxy (const CURIContainer& aUri) |
|
425 { |
|
426 return iBindingStore->IsOutboundProxy(aUri); |
|
427 } |
|
428 |
|
429 // ----------------------------------------------------------------------------- |
|
430 // CSIPRegistrationMgr::URIFailed |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 void CSIPRegistrationMgr::URIFailed (CURIContainer& aUri) |
|
434 { |
|
435 iBindingStore->URIFailed(aUri); |
|
436 } |
|
437 |
|
438 // ----------------------------------------------------------------------------- |
|
439 // CSIPRegistrationMgr::ContactL |
|
440 // ----------------------------------------------------------------------------- |
|
441 // |
|
442 void CSIPRegistrationMgr::ContactL(TUint32 aIapId, |
|
443 TRegistrationId aRegistrationId, |
|
444 const CSIPFromToHeaderBase* aFromToHeader, |
|
445 CSIPContactHeader& aContact) |
|
446 { |
|
447 __SIP_ASSERT_LEAVE(aFromToHeader != 0, KErrArgument); |
|
448 __SIP_ASSERT_LEAVE(aContact.SIPAddress() != 0, KErrArgument); |
|
449 |
|
450 if (aContact.SIPAddress()->URI().IsSIPURI()) |
|
451 { |
|
452 CSIPURI& contactSIPURI = *(aContact.SIPAddress()->URI().SIPURI()); |
|
453 |
|
454 CSIPRegistrationBindingBase* binding = |
|
455 iBindingStore->FindBinding(aRegistrationId); |
|
456 if (binding) |
|
457 { |
|
458 CSIPURI* bindingContactURI = |
|
459 binding->Contact().SIPAddress()->URI().SIPURI(); |
|
460 __SIP_ASSERT_LEAVE(bindingContactURI != 0, KErrArgument); |
|
461 CSIPHostPort* hostPort = |
|
462 CSIPHostPort::NewLC(bindingContactURI->HostPort()); |
|
463 contactSIPURI.SetHostPortL(hostPort); |
|
464 CleanupStack::Pop(hostPort); |
|
465 } |
|
466 else |
|
467 { |
|
468 FillHostWithLocalIPL(aIapId,contactSIPURI); |
|
469 } |
|
470 |
|
471 if (contactSIPURI.User().Length() == 0 && |
|
472 !iBindingStore->FindContactByFromL(aFromToHeader,aContact)) |
|
473 { |
|
474 const CSIPURI* uriOfFromTo = |
|
475 (const_cast<CSIPFromToHeaderBase*>( |
|
476 aFromToHeader))->SIPAddress().URI().SIPURI(); |
|
477 |
|
478 __ASSERT_ALWAYS (uriOfFromTo != 0, User::Leave(KErrArgument)); |
|
479 __ASSERT_ALWAYS (uriOfFromTo->User().Length() > 0, |
|
480 User::Leave(KErrSIPInvalidContact)); |
|
481 |
|
482 contactSIPURI.SetUserL(uriOfFromTo->User()); |
|
483 } |
|
484 } |
|
485 } |
|
486 |
|
487 // ----------------------------------------------------------------------------- |
|
488 // CSIPRegistrationMgr::Contact |
|
489 // ----------------------------------------------------------------------------- |
|
490 // |
|
491 const CSIPContactHeader* CSIPRegistrationMgr::Contact ( |
|
492 const TRegistrationId& aRegistrationId) |
|
493 { |
|
494 CSIPRegistrationBindingBase* binding = |
|
495 iBindingStore->FindBinding(aRegistrationId); |
|
496 |
|
497 if (binding) |
|
498 { |
|
499 return &(binding->Contact()); |
|
500 } |
|
501 else |
|
502 { |
|
503 return NULL; |
|
504 } |
|
505 } |
|
506 |
|
507 // ----------------------------------------------------------------------------- |
|
508 // CSIPRegistrationMgr::FillTransportParams |
|
509 // ----------------------------------------------------------------------------- |
|
510 // |
|
511 TBool CSIPRegistrationMgr::FillTransportParams( |
|
512 const TRegistrationId& aRegistrationId, |
|
513 TSIPTransportParams& aTransportParams) |
|
514 { |
|
515 TBool found = EFalse; |
|
516 CSIPRegistrationBindingBase* binding = |
|
517 iBindingStore->FindBinding(aRegistrationId); |
|
518 if (binding) |
|
519 { |
|
520 found = ETrue; |
|
521 aTransportParams = binding->FillTransportParams(); |
|
522 } |
|
523 return found; |
|
524 } |
|
525 |
|
526 // ----------------------------------------------------------------------------- |
|
527 // CSIPRegistrationMgr::SIPSecUser |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 const MSIPSecUser* CSIPRegistrationMgr::SIPSecUser( |
|
531 const TRegistrationId& aRegistrationId) |
|
532 { |
|
533 return iBindingStore->FindBinding(aRegistrationId); |
|
534 } |
|
535 |
|
536 // ----------------------------------------------------------------------------- |
|
537 // CSIPRegistrationMgr::SIPSecUserForTransaction |
|
538 // ----------------------------------------------------------------------------- |
|
539 // |
|
540 const MSIPSecUser* CSIPRegistrationMgr::SIPSecUserForTransaction( |
|
541 const TTransactionId& aTransactionId) |
|
542 { |
|
543 return iBindingStore->FindBindingForTransaction(aTransactionId); |
|
544 } |
|
545 |
|
546 // ----------------------------------------------------------------------------- |
|
547 // CSIPRegistrationMgr::ConnectionStateChangedL |
|
548 // ----------------------------------------------------------------------------- |
|
549 // |
|
550 void CSIPRegistrationMgr::ConnectionStateChangedL ( |
|
551 TUint32 aIapId, |
|
552 CSIPConnection::TState aState) |
|
553 { |
|
554 if (aState == CSIPConnection::EInactive || |
|
555 aState == CSIPConnection::EUnavailable) |
|
556 { |
|
557 // remove bindings, which has same IAPId. |
|
558 iBindingStore->RemoveBindingByIAPId(aIapId); |
|
559 } |
|
560 } |
|
561 |
|
562 // ----------------------------------------------------------------------------- |
|
563 // CSIPRegistrationMgr::FillHostWithLocalIPL |
|
564 // ----------------------------------------------------------------------------- |
|
565 // |
|
566 void CSIPRegistrationMgr::FillHostWithLocalIPL (TUint32 aIapId, |
|
567 CSIPURI& aSipUri) |
|
568 { |
|
569 HBufC8* localAddr = TSIPRegistrationUtility::LocalAddressLC(aIapId, iTU); |
|
570 aSipUri.HostPort().SetHostL(*localAddr); |
|
571 CleanupStack::PopAndDestroy(localAddr); |
|
572 } |
|
573 |
|
574 // ----------------------------------------------------------------------------- |
|
575 // CSIPRegistrationMgr::DetachBinding |
|
576 // ----------------------------------------------------------------------------- |
|
577 // |
|
578 void CSIPRegistrationMgr::DetachBinding (TAny* aBinding) |
|
579 { |
|
580 __SIP_ASSERT_RETURN(aBinding, KErrGeneral); |
|
581 |
|
582 CSIPRegistrationBindingBase* binding = |
|
583 reinterpret_cast<CSIPRegistrationBinding*>(aBinding); |
|
584 |
|
585 binding->DetachFromStore(); |
|
586 } |
|
587 |
|
588 // ----------------------------------------------------------------------------- |
|
589 // CSIPRegistrationMgr::IsCacheOutboundProxyIPEanbled |
|
590 // ----------------------------------------------------------------------------- |
|
591 // |
|
592 TBool CSIPRegistrationMgr::IsCacheOutboundProxyIPEanbled( |
|
593 TRegistrationId aRegistrationId) const |
|
594 { |
|
595 CSIPRegistrationBindingBase* binding = |
|
596 iBindingStore->FindBinding(aRegistrationId); |
|
597 if (binding) |
|
598 { |
|
599 return binding->IsCacheOutboundProxyIPEnabled(); |
|
600 } |
|
601 return EFalse; |
|
602 } |
|
603 // ----------------------------------------------------------------------------- |
|
604 // CSIPRegistrationMgr::OutboundProxyIPL |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 CSIPRouteHeader& CSIPRegistrationMgr::OutboundProxyIPL( |
|
608 TRegistrationId aRegistrationId) const |
|
609 { |
|
610 CSIPRegistrationBindingBase* binding = |
|
611 iBindingStore->FindBinding(aRegistrationId); |
|
612 __SIP_ASSERT_LEAVE(binding, KErrArgument); |
|
613 return binding->OutboundProxyIPL(); |
|
614 } |