|
1 // Copyright (c) 2007-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 : CSIPRegistrationBindingBase.cpp |
|
15 // Part of : Registration |
|
16 // Version : SIP/6.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "CSIPRegistrationRefreshBinding.h" |
|
22 #include "CSIPRegistrationBinding.h" |
|
23 #include "TSIPRegistrationUtility.h" |
|
24 #include "CSIPRegistrar.h" |
|
25 #include "CSIPRegistrarStore.h" |
|
26 #include "CSIPRegistrationBindingStore.h" |
|
27 #include "CSIPResponseUtility.h" |
|
28 #include "MRegistrationOwner.h" |
|
29 #include "sipresponse.h" |
|
30 #include "siprequest.h" |
|
31 #include "siptoheader.h" |
|
32 #include "sipfromheader.h" |
|
33 #include "sipaddress.h" |
|
34 #include "sipcontactheader.h" |
|
35 #include "uricontainer.h" |
|
36 #include "sipuri.h" |
|
37 #include "siphostport.h" |
|
38 #include "siprouteheader.h" |
|
39 #include "sipminexpiresheader.h" |
|
40 #include "sipservicerouteheader.h" |
|
41 #include "sippassociateduriheader.h" |
|
42 #include "MSigComp.h" |
|
43 #include "sipsec.h" |
|
44 #include "siperr.h" |
|
45 #include "SipLogs.h" |
|
46 #include "SipAssert.h" |
|
47 #include "sipcodecutils.h" |
|
48 #include "sipstrings.h" |
|
49 #include "sipstrconsts.h" |
|
50 #include "csipregistering.h" |
|
51 #include "csip423responsereceived.h" |
|
52 #include "csipregistered.h" |
|
53 #include "csipregisterupdating.h" |
|
54 #include "csipunregistering.h" |
|
55 #include "csipunregistered.h" |
|
56 #include "TSIPTransportParams.h" |
|
57 #include "MSIPTransportMgr.h" |
|
58 #include <utf.h> |
|
59 |
|
60 |
|
61 #define HEADER(H, M, N) static_cast<H*>((M).Header(N,0)) |
|
62 const TUint KDefaultSipPort = 5060; |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CSIPRegistrationBindingBase::ConstructL |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void CSIPRegistrationBindingBase::ConstructL(CSIPRequest* aSIPRequest, |
|
69 CURIContainer& aRemoteTarget) |
|
70 { |
|
71 __ASSERT_ALWAYS (aSIPRequest, User::Leave (KErrArgument)); |
|
72 __ASSERT_ALWAYS (aSIPRequest->To(), User::Leave (KErrArgument)); |
|
73 __ASSERT_ALWAYS (aSIPRequest->From(), User::Leave (KErrArgument)); |
|
74 |
|
75 InitializeStatesL(); |
|
76 |
|
77 // copy to header from request |
|
78 SetToHeaderL(*aSIPRequest); |
|
79 |
|
80 // copy from header from request |
|
81 SetFromHeaderL(*aSIPRequest); |
|
82 |
|
83 // copy contact header from request. |
|
84 SetContactHeaderL(*aSIPRequest); |
|
85 |
|
86 iRegistrationId = iBindingStore.NextRegistrationId(); |
|
87 |
|
88 iRegistrar = iBindingStore.RegistrarStore().FindRegistrar(aRemoteTarget); |
|
89 |
|
90 if (!iRegistrar) // registrar not found |
|
91 { |
|
92 iRemoteTarget = CURIContainer::NewL(aRemoteTarget); |
|
93 } |
|
94 else |
|
95 { |
|
96 iRegistrar->AddRegistrationIdL(iRegistrationId); |
|
97 } |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CSIPRegistrationBindingBase::InitializeStatesL |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CSIPRegistrationBindingBase::InitializeStatesL() |
|
105 { |
|
106 iRegistering = CSIPRegistering::NewL(*this); |
|
107 iRegistered = CSIPRegistered::NewL(*this); |
|
108 iResponse423Received = CSIP423ResponseReceived::NewL(*this); |
|
109 iUpdating = CSIPRegisterUpdating::NewL(*this); |
|
110 iUnregistering = CSIPUnregistering::NewL(*this); |
|
111 iUnregistered = CSIPUnregistered::NewL(*this); |
|
112 |
|
113 // set registering neighbour states. |
|
114 iRegistering->SetNeighbourStates(iResponse423Received, iRegistered, |
|
115 iUnregistered); |
|
116 // set current state to registering. |
|
117 iCurrentState = iRegistering; |
|
118 // set registered neighbour states. |
|
119 iRegistered->SetNeighbourStates(iUpdating, iUnregistering, iUnregistered, |
|
120 iResponse423Received); |
|
121 // set response 423 received neighbour states. |
|
122 iResponse423Received->SetNeighbourStates(iRegistered, iUnregistered); |
|
123 // set unregistering states. |
|
124 iUnregistering->SetNeighbourStates(iUnregistered); |
|
125 // set updating states. |
|
126 iUpdating->SetNeighbourStates(iResponse423Received, iRegistered, |
|
127 iUnregistered); |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CSIPRegistrationBindingBase::CSIPRegistrationBindingBase |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 CSIPRegistrationBindingBase::CSIPRegistrationBindingBase ( |
|
135 MTransactionUser& aTransactionUser, |
|
136 MSigComp& aSigComp, |
|
137 CSIPSec& aSIPSec, |
|
138 CSIPRegistrationBindingStore& aBindingStore, |
|
139 MRegistrationOwner* aRegistrationOwner, |
|
140 MSIPSecUser& aSIPSecUser, |
|
141 MSIPTransportMgr& aTransportMgr, |
|
142 TBool aSendWithExpires, |
|
143 TBool aCacheOutboundProxyIP) |
|
144 : iTransactionUser (aTransactionUser), |
|
145 iOwner (aRegistrationOwner), |
|
146 iRegistrationId (KEmptyRegistrationId), |
|
147 iSIPSecUser (aSIPSecUser), |
|
148 iSigComp (aSigComp), |
|
149 iSIPSec (aSIPSec), |
|
150 iBindingStore (aBindingStore), |
|
151 iTransportMgr (aTransportMgr), |
|
152 iSendWithExpires (aSendWithExpires), |
|
153 iCacheOutboundProxyIP(aCacheOutboundProxyIP) |
|
154 { |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CSIPRegistrationBindingBase::~CSIPRegistrationBindingBase |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 CSIPRegistrationBindingBase::~CSIPRegistrationBindingBase() |
|
162 { |
|
163 if (iRegistrar) |
|
164 { |
|
165 iRegistrar->BindingRemoved(iRegistrationId); |
|
166 } |
|
167 FreeProxyTransportResources(); |
|
168 delete iPAssociatedURIHeader; |
|
169 delete iOutboundProxy; |
|
170 delete iOutboundProxyIP; |
|
171 delete iTo; |
|
172 delete iFrom; |
|
173 delete iContact; |
|
174 delete iRemoteTarget; |
|
175 iRouteSet.ResetAndDestroy(); |
|
176 delete iRequest; |
|
177 |
|
178 // delete register states |
|
179 delete iRegistering; |
|
180 delete iRegistered; |
|
181 delete iResponse423Received; |
|
182 delete iUpdating; |
|
183 delete iUnregistering; |
|
184 delete iUnregistered; |
|
185 iTransportMgr.RemoveTransport(iTransportId); |
|
186 iSIPSec.ClearCache(this); |
|
187 iTransactionUser.FreeResources(*this); |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CSIPRegistrationBindingBase::PassOnlyRealmsToUser |
|
192 // From MSIPSecUser |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 TBool CSIPRegistrationBindingBase::PassOnlyRealmsToUser() const |
|
196 { |
|
197 return iSIPSecUser.PassOnlyRealmsToUser(); |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // CSIPRegistrationBindingBase::RequestCredentialsL |
|
202 // From MSIPSecUser |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 void CSIPRegistrationBindingBase::RequestCredentialsL(const TDesC8& aRealm) |
|
206 { |
|
207 iSIPSecUser.RequestCredentialsL(aRealm); |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CSIPRegistrationBindingBase::RequestCredentialsL |
|
212 // From MSIPSecUser |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CSIPRegistrationBindingBase::RequestCredentialsL( |
|
216 CSIPResponse& aResponse, |
|
217 TTransactionId aTransactionId, |
|
218 TRefreshId aRefreshId) |
|
219 { |
|
220 iSIPSecUser.RequestCredentialsL(aResponse,aTransactionId,aRefreshId); |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CSIPRegistrationBindingBase::TrustedUser |
|
225 // From MSIPSecUser |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 const MSIPSecUser* CSIPRegistrationBindingBase::TrustedUser( |
|
229 TRegistrationId /*aRegistrationId*/) |
|
230 { |
|
231 return NULL; |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // CSIPRegistrationBindingBase::ByPassSIPSec |
|
236 // From MSIPSecUser |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 TBool CSIPRegistrationBindingBase::ByPassSIPSec() const |
|
240 { |
|
241 return iSIPSecUser.ByPassSIPSec(); |
|
242 } |
|
243 |
|
244 // ----------------------------------------------------------------------------- |
|
245 // CSIPRegistrationBindingBase::FlowFailure |
|
246 // From MSIPNATBindingObserver |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 void CSIPRegistrationBindingBase::FlowFailure(TInt /*aError*/) |
|
250 { |
|
251 iOwner->RegistrationError(iTransactionId,iRegistrationId, |
|
252 KErrSIPTransportFailure); |
|
253 ChangeState(iUnregistered); |
|
254 iTransactionUser.FreeResources(*this); |
|
255 } |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // CSIPRegistrationBindingBase::RefreshId |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 TRefreshId CSIPRegistrationBindingBase::RefreshId() const |
|
262 { |
|
263 return KEmptyRefreshId; |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CSIPRegistrationBindingBase::SetRequest |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 void CSIPRegistrationBindingBase::SetRequest (CSIPRequest* aSIPRequest) |
|
271 { |
|
272 delete iRequest; |
|
273 iRequest = aSIPRequest; |
|
274 } |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // CSIPRegistrationBindingBase::Owner |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 const MRegistrationOwner* CSIPRegistrationBindingBase::Owner() const |
|
281 { |
|
282 return iOwner; |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CSIPRegistrationBindingBase::RegisterPending |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 TBool CSIPRegistrationBindingBase::RegisterPending () const |
|
290 { |
|
291 // return ETrue when binding is in following states. |
|
292 return (iCurrentState == iRegistering || |
|
293 iCurrentState == iUpdating || |
|
294 iCurrentState == iUnregistering || |
|
295 iCurrentState == iResponse423Received); |
|
296 } |
|
297 |
|
298 // ----------------------------------------------------------------------------- |
|
299 // CSIPRegistrationBindingBase::UpdateBindingFromResponseL |
|
300 // ----------------------------------------------------------------------------- |
|
301 // |
|
302 void CSIPRegistrationBindingBase::UpdateBindingFromResponseL( |
|
303 CSIPResponse& aResponse) |
|
304 { |
|
305 // no related registrar, create one, add registrar pointer to binding |
|
306 if (!iRegistrar) |
|
307 { |
|
308 HBufC8* callId = CSIPResponseUtility::CallIdL(aResponse); |
|
309 CleanupStack::PushL(callId); |
|
310 iRegistrar = iBindingStore.RegistrarStore().CreateRegistrarL( |
|
311 *iRemoteTarget, *callId, |
|
312 CSIPResponseUtility::CSeqValueL(aResponse), iRegistrationId); |
|
313 CleanupStack::PopAndDestroy(callId); |
|
314 delete iRemoteTarget; |
|
315 iRemoteTarget = NULL; |
|
316 } |
|
317 |
|
318 const RStringF KTagParam = SIPStrings::StringF(SipStrConsts::ETag); |
|
319 if ((aResponse.From()) && (aResponse.From()->HasParam(KTagParam))) |
|
320 { |
|
321 iFrom->SetParamL(KTagParam,aResponse.From()->ParamValue(KTagParam)); |
|
322 } |
|
323 SetRouteHeaderFromResponseL(aResponse); |
|
324 SetPAssociatedURIFromResponseL(aResponse); |
|
325 } |
|
326 |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // CSIPRegistrationBindingBase::SetToHeaderL |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 void CSIPRegistrationBindingBase::SetToHeaderL(CSIPRequest& aSIPRequest) |
|
333 { |
|
334 CSIPToHeader* to = aSIPRequest.To(); |
|
335 CSIPToHeader* tempTo = CSIPToHeader::NewL(*to); |
|
336 delete iTo; |
|
337 iTo = tempTo; |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // CSIPRegistrationBindingBase::SetFromHeaderL |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 void CSIPRegistrationBindingBase::SetFromHeaderL(CSIPRequest& aSIPRequest) |
|
345 { |
|
346 CSIPFromHeader* fromHeader = aSIPRequest.From(); |
|
347 |
|
348 CSIPFromHeader* temp = CSIPFromHeader::NewL(*fromHeader); |
|
349 delete iFrom; |
|
350 iFrom = temp; |
|
351 } |
|
352 |
|
353 // ----------------------------------------------------------------------------- |
|
354 // CSIPRegistrationBindingBase::SetContactHeaderL |
|
355 // ----------------------------------------------------------------------------- |
|
356 // |
|
357 void CSIPRegistrationBindingBase::SetContactHeaderL(CSIPRequest& aSIPRequest) |
|
358 { |
|
359 const RStringF KContactHeaderName = |
|
360 SIPStrings::StringF(SipStrConsts::EContactHeader); |
|
361 |
|
362 CSIPContactHeader* contact = |
|
363 HEADER(CSIPContactHeader, aSIPRequest, KContactHeaderName); |
|
364 |
|
365 CSIPContactHeader* tmp = static_cast<CSIPContactHeader*>(contact->CloneL()); |
|
366 CleanupStack::PushL(tmp); |
|
367 if(iContact && tmp->ExpiresParameter() == KErrNotFound) |
|
368 tmp->SetExpiresParameterL(iContact->ExpiresParameter()); |
|
369 delete iContact; |
|
370 CleanupStack::Pop(tmp); |
|
371 iContact = tmp; |
|
372 } |
|
373 |
|
374 // ----------------------------------------------------------------------------- |
|
375 // CSIPRegistrationBindingBase::SetExpiresValueL |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 void CSIPRegistrationBindingBase::SetExpiresValueL(CSIPRequest& aSIPRequest) |
|
379 { |
|
380 const RStringF KContactHeaderName = |
|
381 SIPStrings::StringF(SipStrConsts::EContactHeader); |
|
382 |
|
383 CSIPContactHeader* contactHeader = |
|
384 HEADER(CSIPContactHeader, aSIPRequest, KContactHeaderName); |
|
385 |
|
386 iContact->SetExpiresParameterL(contactHeader->ExpiresParameter()); |
|
387 } |
|
388 |
|
389 // ----------------------------------------------------------------------------- |
|
390 // CSIPRegistrationBindingBase::SetMinExpiresToRequestL |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 void CSIPRegistrationBindingBase::SetMinExpiresToRequestL ( |
|
394 CSIPResponse& aResponse) |
|
395 { |
|
396 const RStringF KContactHeaderName = |
|
397 SIPStrings::StringF(SipStrConsts::EContactHeader); |
|
398 |
|
399 // the request must not be empty |
|
400 __SIP_ASSERT_LEAVE(iRequest, KErrArgument); |
|
401 __SIP_ASSERT_LEAVE(iRequest->HasHeader(KContactHeaderName), |
|
402 KErrArgument); |
|
403 // get the Min expires header from response |
|
404 CSIPMinExpiresHeader* minExpiresHeader = HEADER( |
|
405 CSIPMinExpiresHeader, aResponse, |
|
406 SIPStrings::StringF(SipStrConsts::EMinExpiresHeader)); |
|
407 // get contact header from request |
|
408 CSIPContactHeader* contactInRequest = HEADER( |
|
409 CSIPContactHeader, *iRequest, KContactHeaderName); |
|
410 // set the min expires value to contact in the original request |
|
411 contactInRequest->SetExpiresParameterL(minExpiresHeader->Value()); |
|
412 } |
|
413 |
|
414 // ----------------------------------------------------------------------------- |
|
415 // CSIPRegistrationBindingBase::SetRouteHeaderFromResponseL |
|
416 // ----------------------------------------------------------------------------- |
|
417 // |
|
418 void CSIPRegistrationBindingBase::SetRouteHeaderFromResponseL( |
|
419 CSIPResponse& aResponse) |
|
420 { |
|
421 iRouteSet.ResetAndDestroy(); |
|
422 |
|
423 TSglQueIter<CSIPHeaderBase> iter = |
|
424 aResponse.Headers( |
|
425 SIPStrings::StringF(SipStrConsts::EServiceRouteHeader)); |
|
426 |
|
427 for (CSIPHeaderBase* header = iter++; header; header = iter++) |
|
428 { |
|
429 CSIPServiceRouteHeader* routeHeader = |
|
430 static_cast<CSIPServiceRouteHeader*>(header); |
|
431 CSIPRouteHeader* newRouteHeader = |
|
432 SIPCodecUtils::CreateRouteHeaderLC(*routeHeader); |
|
433 iRouteSet.AppendL(newRouteHeader); |
|
434 CleanupStack::Pop(newRouteHeader); |
|
435 } |
|
436 } |
|
437 |
|
438 // ----------------------------------------------------------------------------- |
|
439 // CSIPRegistrationBindingBase::ServiceRouteOk |
|
440 // ----------------------------------------------------------------------------- |
|
441 // |
|
442 TBool CSIPRegistrationBindingBase::ServiceRouteOk( |
|
443 CSIPResponse& aResponse) const |
|
444 { |
|
445 // Check if the last Service-Route-header has changed |
|
446 TBool ok = ETrue; |
|
447 if (iRouteSet.Count() > 0) |
|
448 { |
|
449 TInt headerCount = |
|
450 aResponse.HeaderCount( |
|
451 SIPStrings::StringF(SipStrConsts::EServiceRouteHeader)); |
|
452 if (headerCount > 0) |
|
453 { |
|
454 CSIPRouteHeaderBase* myLastRoute = iRouteSet[iRouteSet.Count()-1]; |
|
455 |
|
456 CSIPRouteHeaderBase* newLastRoute = |
|
457 static_cast<CSIPRouteHeaderBase*>( |
|
458 aResponse.Header( |
|
459 SIPStrings::StringF(SipStrConsts::EServiceRouteHeader), |
|
460 headerCount-1)); |
|
461 |
|
462 ok = (myLastRoute->SIPAddress() == newLastRoute->SIPAddress()); |
|
463 } |
|
464 } |
|
465 return ok; |
|
466 } |
|
467 |
|
468 // ----------------------------------------------------------------------------- |
|
469 // CSIPRegistrationBindingBase::SetPAssociatedURIFromResponseL |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 void CSIPRegistrationBindingBase::SetPAssociatedURIFromResponseL( |
|
473 CSIPResponse& aResponse) |
|
474 { |
|
475 CSIPHeaderBase* headerInResponse = |
|
476 aResponse.Header( |
|
477 SIPStrings::StringF(SipStrConsts::EPAssociatedURIHeader),0); |
|
478 CSIPHeaderBase* header = NULL; |
|
479 if (headerInResponse) |
|
480 { |
|
481 header = headerInResponse->CloneL(); |
|
482 } |
|
483 delete iPAssociatedURIHeader; |
|
484 iPAssociatedURIHeader = static_cast<CSIPPAssociatedURIHeader*>(header); |
|
485 } |
|
486 |
|
487 // ----------------------------------------------------------------------------- |
|
488 // CSIPRegistrationBindingBase::PAssociatedURIHeader |
|
489 // ----------------------------------------------------------------------------- |
|
490 // |
|
491 const CSIPPAssociatedURIHeader* |
|
492 CSIPRegistrationBindingBase::PAssociatedURIHeader() const |
|
493 { |
|
494 return iPAssociatedURIHeader; |
|
495 } |
|
496 |
|
497 // ----------------------------------------------------------------------------- |
|
498 // CSIPRegistrationBindingBase::FillTransportParams |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 TSIPTransportParams CSIPRegistrationBindingBase::FillTransportParams() |
|
502 { |
|
503 TSIPTransportParams transportParams(iOwner->TransportParams()); |
|
504 transportParams.SetTransportId(iTransportId); |
|
505 transportParams.SetCompartmentId(iSigCompCompartmentId); |
|
506 transportParams.SetNATBindingObserver(this); |
|
507 return transportParams; |
|
508 } |
|
509 |
|
510 // ----------------------------------------------------------------------------- |
|
511 // CSIPRegistrationBindingBase::HasTransaction |
|
512 // ----------------------------------------------------------------------------- |
|
513 // |
|
514 TBool CSIPRegistrationBindingBase::HasTransaction( |
|
515 const TTransactionId& aTransactionId) const |
|
516 { |
|
517 return (iTransactionId == aTransactionId || |
|
518 iRetryTransactionId == aTransactionId); |
|
519 } |
|
520 |
|
521 // ----------------------------------------------------------------------------- |
|
522 // CSIPRegistrationBindingBase::OutboundProxyFailed |
|
523 // ----------------------------------------------------------------------------- |
|
524 // |
|
525 void CSIPRegistrationBindingBase::OutboundProxyFailed() |
|
526 { |
|
527 if (!RegisterPending()) |
|
528 { |
|
529 iCurrentState->TransactionEnded(KEmptyTransactionId, |
|
530 KErrSIPOutboundProxyNotResponding); |
|
531 } |
|
532 } |
|
533 |
|
534 // ----------------------------------------------------------------------------- |
|
535 // CSIPRegistrationBindingBase::RouteSet |
|
536 // ----------------------------------------------------------------------------- |
|
537 // |
|
538 RPointerArray<CSIPRouteHeader>& CSIPRegistrationBindingBase::RouteSet() |
|
539 { |
|
540 return iRouteSet; |
|
541 } |
|
542 |
|
543 // ----------------------------------------------------------------------------- |
|
544 // CSIPRegistrationBindingBase::IAPId |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 TUint32 CSIPRegistrationBindingBase::IAPId() const |
|
548 { |
|
549 return iOwner->TransportParams().IapId(); |
|
550 } |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // CSIPRegistrationBindingBase::SigCompCompartmentId |
|
554 // ----------------------------------------------------------------------------- |
|
555 // |
|
556 TUint32 CSIPRegistrationBindingBase::SigCompCompartmentId() const |
|
557 { |
|
558 return iSigCompCompartmentId; |
|
559 } |
|
560 |
|
561 // ----------------------------------------------------------------------------- |
|
562 // CSIPRegistrationBindingBase::Contact |
|
563 // ----------------------------------------------------------------------------- |
|
564 // |
|
565 CSIPContactHeader& CSIPRegistrationBindingBase::Contact() |
|
566 { |
|
567 return *iContact; |
|
568 } |
|
569 |
|
570 // ----------------------------------------------------------------------------- |
|
571 // CSIPRegistrationBindingBase::AOR |
|
572 // ----------------------------------------------------------------------------- |
|
573 // |
|
574 const CSIPToHeader& CSIPRegistrationBindingBase::AOR () const |
|
575 { |
|
576 return *iTo; |
|
577 } |
|
578 |
|
579 // ----------------------------------------------------------------------------- |
|
580 // CSIPRegistrationBindingBase::FindContactByFromL |
|
581 // ----------------------------------------------------------------------------- |
|
582 // |
|
583 TBool CSIPRegistrationBindingBase::FindContactByFromL( |
|
584 const CSIPFromToHeaderBase* aFromToHeader, |
|
585 CSIPContactHeader& aContact) |
|
586 { |
|
587 TBool found = EFalse; |
|
588 |
|
589 const CURIContainer& uriOfFromTo = (const_cast<CSIPFromToHeaderBase*>( |
|
590 aFromToHeader))->SIPAddress().URI(); |
|
591 |
|
592 // if URI of To header in binding == URI of aFromToHeader header |
|
593 if (uriOfFromTo.IsSIPURI() && |
|
594 iTo->SIPAddress().URI().IsSIPURI() && |
|
595 iTo->SIPAddress().URI() == uriOfFromTo) |
|
596 { |
|
597 CSIPURI& sipuri = *aContact.SIPAddress()->URI().SIPURI(); |
|
598 CSIPURI& sipuriInBinding = *iContact->SIPAddress()->URI().SIPURI(); |
|
599 |
|
600 if (sipuri.User().Length() > 0) |
|
601 { |
|
602 if (sipuri.User().Compare(sipuriInBinding.User()) == 0) |
|
603 { |
|
604 // fill in host part |
|
605 CSIPHostPort* hostPort = |
|
606 CSIPHostPort::NewLC(sipuriInBinding.HostPort()); |
|
607 sipuri.SetHostPortL(hostPort); |
|
608 CleanupStack::Pop(hostPort); |
|
609 found = ETrue; |
|
610 } |
|
611 } |
|
612 else |
|
613 { |
|
614 // fill in user part |
|
615 sipuri.SetUserL(sipuriInBinding.User()); |
|
616 // fill in host part |
|
617 CSIPHostPort* hostPort = |
|
618 CSIPHostPort::NewLC(sipuriInBinding.HostPort()); |
|
619 sipuri.SetHostPortL(hostPort); |
|
620 CleanupStack::Pop(hostPort); |
|
621 found = ETrue; |
|
622 } |
|
623 } |
|
624 |
|
625 return found; |
|
626 } |
|
627 |
|
628 // ----------------------------------------------------------------------------- |
|
629 // CSIPRegistrationBindingBase::CompareWithRegisterRequest |
|
630 // ----------------------------------------------------------------------------- |
|
631 // |
|
632 TBool CSIPRegistrationBindingBase::CompareWithRegisterRequest( |
|
633 const MRegistrationOwner& aRegistrationOwner, |
|
634 CSIPRequest& aSIPRequest) |
|
635 { |
|
636 TBool returnValue = EFalse; |
|
637 |
|
638 if (iOwner == &aRegistrationOwner) |
|
639 { |
|
640 // get To header from request |
|
641 CSIPToHeader* toHeader = aSIPRequest.To(); |
|
642 CURIContainer& uriOfToInReq = toHeader->SIPAddress().URI(); |
|
643 |
|
644 // get From header from request |
|
645 CSIPFromHeader* fromHeader = aSIPRequest.From(); |
|
646 CURIContainer& uriOfFromInReq = fromHeader->SIPAddress().URI(); |
|
647 |
|
648 // get Contact header from request |
|
649 CSIPContactHeader* contactHeader = HEADER( |
|
650 CSIPContactHeader, aSIPRequest, |
|
651 SIPStrings::StringF(SipStrConsts::EContactHeader)); |
|
652 |
|
653 CURIContainer& uriOfContactInReq = contactHeader->SIPAddress()->URI(); |
|
654 CURIContainer& uriOfTo = iTo->SIPAddress().URI(); |
|
655 CURIContainer& uriOfFrom = iFrom->SIPAddress().URI(); |
|
656 CURIContainer& uriOfContact = iContact->SIPAddress()->URI(); |
|
657 |
|
658 if ((uriOfToInReq == uriOfTo) && |
|
659 (uriOfFromInReq == uriOfFrom) && |
|
660 (uriOfContactInReq == uriOfContact)) |
|
661 { |
|
662 returnValue = ETrue; |
|
663 } |
|
664 } |
|
665 |
|
666 return returnValue; |
|
667 } |
|
668 |
|
669 // ----------------------------------------------------------------------------- |
|
670 // CSIPRegistrationBindingBase::RegistrationId |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 TRegistrationId CSIPRegistrationBindingBase::RegistrationId() const |
|
674 { |
|
675 return iRegistrationId; |
|
676 } |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CSIPRegistrationBindingBase::OutboundProxy |
|
680 // ----------------------------------------------------------------------------- |
|
681 // |
|
682 const CSIPRouteHeader* CSIPRegistrationBindingBase::OutboundProxy() |
|
683 { |
|
684 return iOutboundProxy; |
|
685 } |
|
686 |
|
687 // ----------------------------------------------------------------------------- |
|
688 // CSIPRegistrationBindingBase::HasOutboundProxy |
|
689 // ----------------------------------------------------------------------------- |
|
690 // |
|
691 TBool CSIPRegistrationBindingBase::HasOutboundProxy() const |
|
692 { |
|
693 return (iOutboundProxy != 0); |
|
694 } |
|
695 |
|
696 // ----------------------------------------------------------------------------- |
|
697 // CSIPRegistrationBindingBase::SetOutboundProxy |
|
698 // ----------------------------------------------------------------------------- |
|
699 // |
|
700 void CSIPRegistrationBindingBase::SetOutboundProxy( |
|
701 CSIPRouteHeader* aOutboundProxy) |
|
702 { |
|
703 __SIP_ASSERT_RETURN (aOutboundProxy, KErrArgument); |
|
704 |
|
705 delete iOutboundProxy; |
|
706 iOutboundProxy = aOutboundProxy; |
|
707 } |
|
708 |
|
709 // ----------------------------------------------------------------------------- |
|
710 // CSIPRegistrationBindingBase::SetOutboundProxyL |
|
711 // ----------------------------------------------------------------------------- |
|
712 // |
|
713 void CSIPRegistrationBindingBase::SetOutboundProxyL( |
|
714 CSIPRouteHeader* aOutboundProxy) |
|
715 { |
|
716 __SIP_ASSERT_LEAVE (aOutboundProxy, KErrArgument); |
|
717 |
|
718 CreateProxyTransportResourcesL(*aOutboundProxy); |
|
719 SetOutboundProxy(aOutboundProxy); |
|
720 } |
|
721 |
|
722 // ----------------------------------------------------------------------------- |
|
723 // CSIPRegistrationBindingBase::RemoveOutboundProxy |
|
724 // ----------------------------------------------------------------------------- |
|
725 // |
|
726 TInt CSIPRegistrationBindingBase::RemoveOutboundProxy() |
|
727 { |
|
728 TInt err = KErrNotFound; |
|
729 if (iOutboundProxy) |
|
730 { |
|
731 FreeProxyTransportResources(); |
|
732 delete iOutboundProxy; |
|
733 iOutboundProxy = NULL; |
|
734 err = KErrNone; |
|
735 } |
|
736 return err; |
|
737 } |
|
738 |
|
739 // ----------------------------------------------------------------------------- |
|
740 // CSIPRegistrationBindingBase::RemoveBinding |
|
741 // ----------------------------------------------------------------------------- |
|
742 // |
|
743 TInt CSIPRegistrationBindingBase::RemoveBinding () |
|
744 { |
|
745 TInt err = iBindingStore.RemoveBinding (this); |
|
746 |
|
747 if (err == KErrNone && iRegistrar) |
|
748 { |
|
749 if(iRegistrar->BindingRemoved(iRegistrationId)) |
|
750 { |
|
751 iRegistrar = NULL; |
|
752 } |
|
753 } |
|
754 |
|
755 return err; |
|
756 } |
|
757 |
|
758 // ----------------------------------------------------------------------------- |
|
759 // CSIPRegistrationBindingBase::CreateProxyTransportResourcesL |
|
760 // ----------------------------------------------------------------------------- |
|
761 // |
|
762 void CSIPRegistrationBindingBase::CreateProxyTransportResourcesL ( |
|
763 CSIPRouteHeader& aOutboundProxy) |
|
764 { |
|
765 CURIContainer& uri = aOutboundProxy.SIPAddress().URI(); |
|
766 TUint32 oldCompartmentId = iSigCompCompartmentId; |
|
767 if (uri.IsSIPURI() && HasSigCompParameter(*uri.SIPURI())) |
|
768 { |
|
769 iSigCompCompartmentId = iSigComp.CreateCompartmentL(IAPId()); |
|
770 } |
|
771 else |
|
772 { |
|
773 iSigCompCompartmentId = 0; |
|
774 } |
|
775 iSigComp.RemoveCompartment(oldCompartmentId); |
|
776 TUint32 oldTransportId = iTransportId; |
|
777 if (uri.IsSIPURI() && uri.SIPURI()->IsSIPSURI()) |
|
778 { |
|
779 TSIPTransportParams transportParams(FillTransportParams()); |
|
780 iTransportMgr.CreateTLSTransportL(transportParams); |
|
781 iTransportId = transportParams.TransportId(); |
|
782 } |
|
783 else |
|
784 { |
|
785 iTransportId = 0; |
|
786 } |
|
787 iTransportMgr.RemoveTransport(oldTransportId); |
|
788 } |
|
789 |
|
790 // ----------------------------------------------------------------------------- |
|
791 // CSIPRegistrationBindingBase::FreeProxyTransportResources |
|
792 // ----------------------------------------------------------------------------- |
|
793 // |
|
794 void CSIPRegistrationBindingBase::FreeProxyTransportResources() |
|
795 { |
|
796 if (iSigCompCompartmentId) |
|
797 { |
|
798 iSigComp.RemoveCompartment(iSigCompCompartmentId); |
|
799 iSigCompCompartmentId = 0; |
|
800 } |
|
801 if (iTransportId) |
|
802 { |
|
803 iTransportMgr.RemoveTransport(iTransportId); |
|
804 iTransportId = 0; |
|
805 } |
|
806 } |
|
807 |
|
808 // ----------------------------------------------------------------------------- |
|
809 // CSIPRegistrationBindingBase::HasSigCompParameter |
|
810 // ----------------------------------------------------------------------------- |
|
811 // |
|
812 TBool CSIPRegistrationBindingBase::HasSigCompParameter ( |
|
813 const CSIPURI& aUri) const |
|
814 { |
|
815 RStringF comp = SIPStrings::StringF(SipStrConsts::EComp); |
|
816 RStringF sigcomp = SIPStrings::StringF(SipStrConsts::ESigComp); |
|
817 return (iSigComp.IsSupported() && aUri.ParamValue(comp) == sigcomp); |
|
818 } |
|
819 |
|
820 |
|
821 // ----------------------------------------------------------------------------- |
|
822 // CSIPRegistrationBindingBase::RegisterL |
|
823 // ----------------------------------------------------------------------------- |
|
824 // |
|
825 void CSIPRegistrationBindingBase::RegisterL(TTransactionId& aTransactionId, |
|
826 CSIPRequest* aRequest, |
|
827 CSIPRouteHeader* aOutboundProxy) |
|
828 { |
|
829 __SIP_ASSERT_LEAVE(aRequest, KErrArgument); |
|
830 if(!iSendWithExpires) |
|
831 TSIPRegistrationUtility::RemoveRegisterExpiresParam(*aRequest); |
|
832 DoRegisterL(aTransactionId, aRequest, aOutboundProxy); |
|
833 } |
|
834 |
|
835 // ----------------------------------------------------------------------------- |
|
836 // CSIPRegistrationBindingBase::UpdateL |
|
837 // ----------------------------------------------------------------------------- |
|
838 // |
|
839 void CSIPRegistrationBindingBase::UpdateL(TTransactionId& aTransactionId, |
|
840 CSIPRequest* aRequest) |
|
841 { |
|
842 __SIP_ASSERT_LEAVE(aRequest, KErrArgument); |
|
843 if(!iSendWithExpires) |
|
844 TSIPRegistrationUtility::RemoveRegisterExpiresParam(*aRequest); |
|
845 DoUpdateL(aTransactionId, aRequest); |
|
846 } |
|
847 |
|
848 // ----------------------------------------------------------------------------- |
|
849 // CSIPRegistrationBindingBase::UnregisterL |
|
850 // ----------------------------------------------------------------------------- |
|
851 // |
|
852 void CSIPRegistrationBindingBase::UnregisterL(TTransactionId& aTransactionId, |
|
853 CSIPRequest* aRequest) |
|
854 { |
|
855 __SIP_ASSERT_LEAVE(aRequest, KErrArgument); |
|
856 DoUnregisterL(aTransactionId, aRequest); |
|
857 } |
|
858 |
|
859 // ----------------------------------------------------------------------------- |
|
860 // CSIPRegistrationBindingBase::Registrar |
|
861 // ----------------------------------------------------------------------------- |
|
862 // |
|
863 CSIPRegistrar* CSIPRegistrationBindingBase::Registrar() |
|
864 { |
|
865 return iRegistrar; |
|
866 } |
|
867 |
|
868 // ----------------------------------------------------------------------------- |
|
869 // CSIPRegistrationBindingBase::FillToFromL |
|
870 // ----------------------------------------------------------------------------- |
|
871 // |
|
872 void CSIPRegistrationBindingBase::FillToFromL(CSIPRequest& aRequest) |
|
873 { |
|
874 // fill in to header from binding |
|
875 CSIPToHeader* to = aRequest.To(); |
|
876 if (!to) |
|
877 { |
|
878 to = CSIPToHeader::NewLC(*iTo); |
|
879 aRequest.AddHeaderL(to); |
|
880 CleanupStack::Pop(to); |
|
881 } |
|
882 |
|
883 // fill in from header from binding |
|
884 CSIPFromHeader* from = aRequest.From(); |
|
885 if (!from) |
|
886 { |
|
887 from = CSIPFromHeader::NewLC(*iFrom); |
|
888 aRequest.AddHeaderL(from); |
|
889 CleanupStack::Pop(from); |
|
890 } |
|
891 } |
|
892 |
|
893 // ----------------------------------------------------------------------------- |
|
894 // CSIPRegistrationBindingBase::CurrentState |
|
895 // ----------------------------------------------------------------------------- |
|
896 // |
|
897 CSIPRegistrationState& CSIPRegistrationBindingBase::CurrentState() |
|
898 { |
|
899 return *iCurrentState; |
|
900 } |
|
901 |
|
902 // ----------------------------------------------------------------------------- |
|
903 // CSIPRegistrationBindingBase::ChangeState |
|
904 // ----------------------------------------------------------------------------- |
|
905 // |
|
906 void CSIPRegistrationBindingBase::ChangeState(CSIPRegistrationState* aState) |
|
907 { |
|
908 iCurrentState = aState; |
|
909 } |
|
910 |
|
911 // ----------------------------------------------------------------------------- |
|
912 // CSIPRegistrationBindingBase::Request |
|
913 // ----------------------------------------------------------------------------- |
|
914 // |
|
915 CSIPRequest* CSIPRegistrationBindingBase::Request() |
|
916 { |
|
917 return iRequest; |
|
918 } |
|
919 |
|
920 // ----------------------------------------------------------------------------- |
|
921 // CSIPRegistrationBindingBase::UpdateContactFromRequestL |
|
922 // ----------------------------------------------------------------------------- |
|
923 // |
|
924 void CSIPRegistrationBindingBase::UpdateContactFromRequestL() |
|
925 { |
|
926 if (iRequest) |
|
927 { |
|
928 SetContactHeaderL(*iRequest); |
|
929 } |
|
930 } |
|
931 |
|
932 // ----------------------------------------------------------------------------- |
|
933 // CSIPRegistrationBindingBase::SelfDetach |
|
934 // ----------------------------------------------------------------------------- |
|
935 // |
|
936 void CSIPRegistrationBindingBase::SelfDetach(TBool aRefresh) |
|
937 { |
|
938 if (IsRefresh()) |
|
939 { |
|
940 if (aRefresh) |
|
941 { |
|
942 static_cast<CSIPRegistrationRefreshBinding*>(this)-> |
|
943 ClearRefreshOwner(); |
|
944 } |
|
945 } |
|
946 else |
|
947 { |
|
948 static_cast<CSIPRegistrationBinding*>(this)->ClearTransactionOwner(); |
|
949 } |
|
950 } |
|
951 |
|
952 // ----------------------------------------------------------------------------- |
|
953 // CSIPRegistrationBindingBase::SelfDetach |
|
954 // ----------------------------------------------------------------------------- |
|
955 // |
|
956 void CSIPRegistrationBindingBase::SelfDetach(TBool aRefresh, TBool aUseRetryId) |
|
957 { |
|
958 if( !IsRefresh() && aUseRetryId ) |
|
959 { |
|
960 static_cast<CSIPRegistrationBinding*>(this)-> |
|
961 ClearTransactionOwner( aUseRetryId ); |
|
962 } |
|
963 else |
|
964 { |
|
965 SelfDetach( aRefresh ); |
|
966 } |
|
967 } |
|
968 |
|
969 // ----------------------------------------------------------------------------- |
|
970 // CSIPRegistrationBindingBase::Received2XXResponseL |
|
971 // ----------------------------------------------------------------------------- |
|
972 // |
|
973 void CSIPRegistrationBindingBase::Received2XXResponseL(CSIPResponse& aResponse, |
|
974 TTransactionId aTransactionId) |
|
975 { |
|
976 if (iRequest) |
|
977 { |
|
978 // Update the From- and To-headers in case some parameters have changed |
|
979 SetToHeaderL(*iRequest); |
|
980 SetFromHeaderL(*iRequest); |
|
981 } |
|
982 |
|
983 UpdateBindingFromResponseL(aResponse); |
|
984 if (HasOutboundProxy() && iCacheOutboundProxyIP) |
|
985 SetOutboundProxyIPL(aTransactionId); |
|
986 if (!IsRefresh()) |
|
987 { |
|
988 // start timer for non refresh binding |
|
989 static_cast<CSIPRegistrationBinding*>(this)->StartTimerL( |
|
990 CSIPResponseUtility::ExpireValueL(*iContact, aResponse)); |
|
991 } |
|
992 } |
|
993 |
|
994 // ----------------------------------------------------------------------------- |
|
995 // CSIPRegistrationBindingBase::ClearRequest |
|
996 // ----------------------------------------------------------------------------- |
|
997 // |
|
998 void CSIPRegistrationBindingBase::ClearRequest() |
|
999 { |
|
1000 if (!IsRefresh() && iRequest) |
|
1001 { |
|
1002 delete iRequest; |
|
1003 iRequest = NULL; |
|
1004 } |
|
1005 } |
|
1006 |
|
1007 // ----------------------------------------------------------------------------- |
|
1008 // CSIPRegistrationBindingBase::ReceivedErrorResponseL |
|
1009 // ----------------------------------------------------------------------------- |
|
1010 // |
|
1011 void CSIPRegistrationBindingBase::ReceivedErrorResponseL() |
|
1012 { |
|
1013 // return KErrNotFound when binding could not found, |
|
1014 // return KErrNone when binding is found and is added to delete manager |
|
1015 TInt err = RemoveBinding (); |
|
1016 |
|
1017 // leaves if binding is found and it is not added to delete manager |
|
1018 if (err != KErrNotFound && err != KErrNone) |
|
1019 { |
|
1020 User::Leave(err); |
|
1021 } |
|
1022 } |
|
1023 |
|
1024 // ----------------------------------------------------------------------------- |
|
1025 // CSIPRegistrationBindingBase::Received423ResponseL |
|
1026 // ----------------------------------------------------------------------------- |
|
1027 // |
|
1028 void CSIPRegistrationBindingBase::Received423ResponseL(CSIPResponse& aResponse) |
|
1029 { |
|
1030 // set min expires value to request contact header. |
|
1031 SetMinExpiresToRequestL(aResponse); |
|
1032 // detaching "this" registration from lower layer. |
|
1033 SelfDetach(ETrue); |
|
1034 // set refresh id to KEmptyRefreshId if it's refresh binding |
|
1035 if (IsRefresh()) |
|
1036 { |
|
1037 static_cast<CSIPRegistrationRefreshBinding*>(this)->SetRefreshId( |
|
1038 KEmptyRefreshId); |
|
1039 } |
|
1040 } |
|
1041 |
|
1042 // ----------------------------------------------------------------------------- |
|
1043 // CSIPRegistrationBindingBase::DetachFromStore |
|
1044 // ----------------------------------------------------------------------------- |
|
1045 // |
|
1046 void CSIPRegistrationBindingBase::DetachFromStore() |
|
1047 { |
|
1048 iBindingStore.DetachBinding(this); |
|
1049 } |
|
1050 |
|
1051 // ----------------------------------------------------------------------------- |
|
1052 // CSIPRegistrationBindingBase::DetachOutboundProxy |
|
1053 // ----------------------------------------------------------------------------- |
|
1054 // |
|
1055 void CSIPRegistrationBindingBase::DetachOutboundProxy(TAny* aBinding) |
|
1056 { |
|
1057 __SIP_ASSERT_RETURN(aBinding, KErrGeneral); |
|
1058 |
|
1059 CSIPRegistrationBindingBase* binding = |
|
1060 reinterpret_cast<CSIPRegistrationBindingBase*>(aBinding); |
|
1061 |
|
1062 binding->FreeProxyTransportResources(); |
|
1063 binding->iOutboundProxy = NULL; // detach the OutboundProxy |
|
1064 } |
|
1065 |
|
1066 // ----------------------------------------------------------------------------- |
|
1067 // CSIPRegistrationBindingBase::SetOutboundProxyIPL |
|
1068 // ----------------------------------------------------------------------------- |
|
1069 // |
|
1070 TInt CSIPRegistrationBindingBase::SetOutboundProxyIPL(const TTransactionId& aTransactionId) |
|
1071 { |
|
1072 TInetAddr outboundProxyIP; |
|
1073 TInt error = iTransactionUser.NextHopIP(aTransactionId, outboundProxyIP); |
|
1074 if (!error) |
|
1075 { |
|
1076 CSIPAddress* sipAddress = CSIPAddress::NewLC(iOutboundProxy->SIPAddress()); |
|
1077 |
|
1078 HBufC8* addressText = ConvertInetAddrToTextL(outboundProxyIP); |
|
1079 CleanupStack::PushL(addressText); |
|
1080 CSIPHostPort* hostport = CSIPHostPort::DecodeL( *addressText ); |
|
1081 CleanupStack::PopAndDestroy(addressText); |
|
1082 CleanupStack::PushL(hostport); |
|
1083 |
|
1084 TUint port = outboundProxyIP.Port() > 0 ? |
|
1085 outboundProxyIP.Port() : KDefaultSipPort; |
|
1086 hostport->SetPort(port); |
|
1087 |
|
1088 sipAddress->URI().SIPURI()->SetHostPortL(hostport); |
|
1089 |
|
1090 sipAddress->URI().SIPURI()->SetSIPS( |
|
1091 iOutboundProxy->SIPAddress().URI().SIPURI()->IsSIPSURI()); |
|
1092 |
|
1093 CleanupStack::Pop(hostport); |
|
1094 delete iOutboundProxyIP; |
|
1095 iOutboundProxyIP = NULL; |
|
1096 iOutboundProxyIP = CSIPRouteHeader::NewL(sipAddress); |
|
1097 CleanupStack::Pop(sipAddress); |
|
1098 } |
|
1099 return error; |
|
1100 } |
|
1101 |
|
1102 // ----------------------------------------------------------------------------- |
|
1103 // CSIPRegistrationBindingBase::ConvertInetAddrToTextL |
|
1104 // ----------------------------------------------------------------------------- |
|
1105 // |
|
1106 HBufC8* CSIPRegistrationBindingBase::ConvertInetAddrToTextL(const TInetAddr& aAddr) |
|
1107 { |
|
1108 const TInt KMaxIPAddrLen = 256; |
|
1109 HBufC* addressOut = HBufC::NewLC(KMaxIPAddrLen); |
|
1110 TPtr outputPtr(addressOut->Des()); |
|
1111 aAddr.Output(outputPtr); |
|
1112 |
|
1113 HBufC8* addressResult = HBufC8::NewL(addressOut->Length()); |
|
1114 TPtr8 resultPtr(addressResult->Des()); |
|
1115 CnvUtfConverter::ConvertFromUnicodeToUtf8(resultPtr, *addressOut); |
|
1116 CleanupStack::PopAndDestroy(addressOut); |
|
1117 |
|
1118 return addressResult; |
|
1119 } |
|
1120 |
|
1121 // ----------------------------------------------------------------------------- |
|
1122 // CSIPRegistrationBindingBase::IsCacheOutboundProxyIPEnabled |
|
1123 // ----------------------------------------------------------------------------- |
|
1124 // |
|
1125 TBool CSIPRegistrationBindingBase::IsCacheOutboundProxyIPEnabled() |
|
1126 { |
|
1127 return iCacheOutboundProxyIP; |
|
1128 } |
|
1129 |
|
1130 // ----------------------------------------------------------------------------- |
|
1131 // CSIPRegistrationBindingBase::OutboundProxyIPL |
|
1132 // ----------------------------------------------------------------------------- |
|
1133 // |
|
1134 CSIPRouteHeader& CSIPRegistrationBindingBase::OutboundProxyIPL() |
|
1135 { |
|
1136 __ASSERT_ALWAYS (iOutboundProxyIP, User::Leave (KErrNotSupported)); |
|
1137 return *iOutboundProxyIP; |
|
1138 } |
|
1139 |