|
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 : SIPImplementation.cpp |
|
15 // Part of : SIP API |
|
16 // Version : SIP/6.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "SipImplementation.h" |
|
22 #include "SipAssert.h" |
|
23 #include "sipclient.h" |
|
24 #include "sipobserver.h" |
|
25 #include "SipConnectionImplementation.h" |
|
26 #include "siphttpdigest.h" |
|
27 #include "unregistered.h" |
|
28 #include "registering.h" |
|
29 #include "registered.h" |
|
30 #include "unregistering.h" |
|
31 #include "sipdialogtrying.h" |
|
32 #include "sipdialogearly.h" |
|
33 #include "sipdialogconfirmed.h" |
|
34 #include "sipdialogterminated.h" |
|
35 #include "sipinviteclienttransaction.h" |
|
36 #include "sipclienttransaction.h" |
|
37 #include "sipservertransaction.h" |
|
38 #include "PendingTransaction.h" |
|
39 #include "siprequestelements.h" |
|
40 #include "sipresponseelements.h" |
|
41 #include "sipmessageelements.h" |
|
42 #include "siphttpdigestchallengeobserver2.h" |
|
43 #include "sipcseqheader.h" |
|
44 #include "sipauthheaderbase.h" |
|
45 #include "sipstrings.h" |
|
46 #include "sipstrconsts.h" |
|
47 |
|
48 |
|
49 #ifdef CPPUNIT_TEST |
|
50 |
|
51 #include "TestCleanupStack.h" |
|
52 |
|
53 #endif |
|
54 |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CSIPImplementation::NewL |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 CSIPImplementation* |
|
61 CSIPImplementation::NewL(const TUid& aUid, MSIPObserver& aObserver) |
|
62 { |
|
63 CSIPImplementation* self = new (ELeave) CSIPImplementation(aObserver); |
|
64 CleanupStack::PushL(self); |
|
65 self->ConstructL(aUid); |
|
66 CleanupStack::Pop(self); |
|
67 return self; |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CSIPImplementation::CSIPImplementation |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CSIPImplementation::CSIPImplementation(MSIPObserver& aObserver) : |
|
75 iSecurityHandlingEnabled(ETrue), |
|
76 iObserver(aObserver) |
|
77 #ifdef CPPUNIT_TEST |
|
78 //For unit tests the granularity of arrays is set to 1 to cause them to |
|
79 //allocate memory every time an item is appended to array |
|
80 , iConnections(1), |
|
81 iPendingServerTransactions(1), |
|
82 iDigests(1) |
|
83 #endif |
|
84 { |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CSIPImplementation::ConstructL |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CSIPImplementation::ConstructL(const TUid& aUid) |
|
92 { |
|
93 iSIPClient = CSIPClient::NewL(aUid, *this); |
|
94 |
|
95 //Registration state machine |
|
96 iUnregistered = CUnregistered::NewL(); |
|
97 iRegistering = CRegistering::NewL(); |
|
98 iRegistered = CRegistered::NewL(); |
|
99 iUnregistering = CUnregistering::NewL(); |
|
100 |
|
101 iUnregistered->SetNeighbourStates(*iRegistering); |
|
102 iRegistering->SetNeighbourStates(*iRegistered, *iUnregistered); |
|
103 iRegistered->SetNeighbourStates(*iUnregistering, *iUnregistered); |
|
104 iUnregistering->SetNeighbourStates(*iRegistered, *iUnregistered); |
|
105 |
|
106 |
|
107 //Dialog state machine |
|
108 iDialogTrying = CDialogTrying::NewL(); |
|
109 iDialogEarly = CDialogEarly::NewL(); |
|
110 iDialogConfirmed = CDialogConfirmed::NewL(); |
|
111 iDialogTerminated = CDialogTerminated::NewL(); |
|
112 |
|
113 iDialogTrying->SetNeighbourStates(*iDialogEarly, |
|
114 *iDialogConfirmed, |
|
115 *iDialogTerminated); |
|
116 iDialogEarly->SetNeighbourStates(*iDialogConfirmed, |
|
117 *iDialogTerminated); |
|
118 iDialogConfirmed->SetNeighbourStates(*iDialogTerminated); |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CSIPImplementation::~CSIPImplementation |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 CSIPImplementation::~CSIPImplementation() |
|
126 { |
|
127 delete iSIPClient; |
|
128 |
|
129 TInt i = 0; |
|
130 for (i = 0; i < iPendingServerTransactions.Count(); i++) |
|
131 { |
|
132 iPendingServerTransactions[i]->Transaction()->Detach(*this); |
|
133 } |
|
134 iPendingServerTransactions.ResetAndDestroy(); |
|
135 |
|
136 //Free the array, not the connection objects |
|
137 for (i = 0; i < iConnections.Count(); i++) |
|
138 { |
|
139 iConnections[i]->Implementation().CSIPDeleted(); |
|
140 } |
|
141 iConnections.Reset(); |
|
142 |
|
143 for (i = 0; i < iDigests.Count(); i++) |
|
144 { |
|
145 iDigests[i]->CSIPDeleted(); |
|
146 } |
|
147 iDigests.Reset(); |
|
148 |
|
149 delete iUnregistered; |
|
150 delete iRegistering; |
|
151 delete iRegistered; |
|
152 delete iUnregistering; |
|
153 |
|
154 delete iDialogTrying; |
|
155 delete iDialogEarly; |
|
156 delete iDialogConfirmed; |
|
157 delete iDialogTerminated; |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CSIPImplementation::IncomingRequestL |
|
162 // Don't use __TEST_INVARIANT after using observer as application may've deleted |
|
163 // the CSIP within callback. |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 void CSIPImplementation::IncomingRequestL(TUint32 aIapId, |
|
167 CSIPRequestElements* aElements, |
|
168 TUint32 aRequestId) |
|
169 { |
|
170 __TEST_INVARIANT; |
|
171 __SIP_ASSERT_LEAVE(aElements, KErrArgument); |
|
172 |
|
173 CSIPConnection* connection = Connection(aIapId); |
|
174 if (connection) |
|
175 { |
|
176 connection->Implementation().IncomingRequestL(aElements, aRequestId); |
|
177 } |
|
178 else |
|
179 { |
|
180 CSIPServerTransaction* ta = |
|
181 CSIPServerTransaction::NewLC(aRequestId, *this, aElements); |
|
182 CleanupStack::PushL( |
|
183 TCleanupItem(CSIPServerTransaction::DetachRequestElements, ta)); |
|
184 CPendingTransaction* pendingTa = CPendingTransaction::NewLC(ta, aIapId); |
|
185 |
|
186 iPendingServerTransactions.AppendL(pendingTa); |
|
187 CleanupStack::Pop(3); //pendingTa, TCleanupItem, ta |
|
188 |
|
189 iObserver.IncomingRequest(aIapId, ta); |
|
190 } |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CSIPImplementation::TimeOut |
|
195 // Do everything before calling iObserver.TimedOut() as application may delete |
|
196 // CSIP withing the callback. |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CSIPImplementation::TimeOut(TUint32 aRequestId) |
|
200 { |
|
201 __TEST_INVARIANT; |
|
202 |
|
203 CPendingTransaction* ta = NULL; |
|
204 for (TInt i = 0; i < iPendingServerTransactions.Count(); i++) |
|
205 { |
|
206 ta = iPendingServerTransactions[i]; |
|
207 __SIP_ASSERT_RETURN(ta && ta->Transaction(), KErrNotFound); |
|
208 |
|
209 if (ta->Transaction()->RequestId() == aRequestId) |
|
210 { |
|
211 CSIPServerTransaction* timeOutedTa = ta->Transaction(); |
|
212 timeOutedTa->Detach(*this); |
|
213 iPendingServerTransactions.Remove(i); |
|
214 delete ta; |
|
215 iObserver.TimedOut(*timeOutedTa); |
|
216 return; |
|
217 } |
|
218 } |
|
219 __TEST_INVARIANT; |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CSIPImplementation::ChallengeReceivedL |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 void CSIPImplementation::ChallengeReceivedL( |
|
227 TUint32 aRequestId, |
|
228 CSIPResponseElements* aResponse, |
|
229 MSIPHttpDigestChallengeObserver2& aObserver) |
|
230 { |
|
231 __SIP_ASSERT_LEAVE(aResponse != NULL, KErrArgument); |
|
232 |
|
233 CSIPClientTransaction* ta(NULL); |
|
234 for (TInt i = 0; i < iConnections.Count(); ++i) |
|
235 { |
|
236 ta = iConnections[i]->Implementation().FindClientTransaction(aRequestId); |
|
237 if (ta) |
|
238 { |
|
239 // Transaction matches aRequestId, so it hasn't yet got response |
|
240 ta->SetResponseElements(aResponse); |
|
241 aObserver.ChallengeReceived(*ta); |
|
242 return; |
|
243 } |
|
244 } |
|
245 |
|
246 // If dialog's trusted user is a non-refreshed registration and INVITE is |
|
247 // challenged, INVITE transaction is not found, as ChallengeReceivedL() is |
|
248 // called in registration's SIP client instance (dialog has another SIP |
|
249 // client instance). Ignore the challenge, so it gets passed to dialog's |
|
250 // SIP client. |
|
251 |
|
252 // Only one CSIPHttpDigest instance can exist in iDigests |
|
253 if (iDigests.Count() > 0) |
|
254 { |
|
255 ta = CreateTransactionL(aRequestId, aResponse, NULL); |
|
256 IgnoreChallenges(*ta, *iDigests[0]); |
|
257 delete ta; |
|
258 } |
|
259 else |
|
260 { |
|
261 delete aResponse; |
|
262 } |
|
263 } |
|
264 |
|
265 // ----------------------------------------------------------------------------- |
|
266 // CSIPImplementation::ChallengeReceivedInRefreshL |
|
267 // Profile sets credentials synchronously. If application sets them |
|
268 // asynchronously, update code to handle many simultaneous challenges. |
|
269 // E.g. dialog's trusted user is registration, both REGISTER and INVITE are |
|
270 // challenged at the same time with different realms. |
|
271 // ----------------------------------------------------------------------------- |
|
272 // |
|
273 void CSIPImplementation::ChallengeReceivedInRefreshL( |
|
274 TUint32 aRefreshId, |
|
275 TUint32 aRequestId, |
|
276 CSIPResponseElements* aResponse, |
|
277 MSIPHttpDigestChallengeObserver2& aObserver) |
|
278 { |
|
279 __SIP_ASSERT_LEAVE(aResponse != NULL, KErrArgument); |
|
280 |
|
281 CSIPRefresh* refresh(NULL); |
|
282 for (TInt i = 0; i < iConnections.Count(); i++) |
|
283 { |
|
284 refresh = iConnections[i]->Implementation().FindRefresh(aRequestId, |
|
285 aRefreshId); |
|
286 if (refresh) |
|
287 { |
|
288 refresh->SetRefreshIdIfEmpty(aRefreshId); |
|
289 refresh->UpdateRefreshState(aResponse->StatusCode()); |
|
290 CSIPClientTransaction* ta = refresh->Transaction(); |
|
291 if (ta) |
|
292 { |
|
293 ta->SetResponseElements(aResponse); |
|
294 aObserver.ChallengeReceived(*refresh); |
|
295 } |
|
296 else |
|
297 { |
|
298 ta = CreateTransactionL(aRequestId, aResponse, refresh); |
|
299 aObserver.ChallengeReceived(*refresh); |
|
300 |
|
301 // INVITE transaction doesn't point to refresh. Manually unlink |
|
302 // transaction and refresh, instead of letting destructor do it |
|
303 refresh->RemoveTransaction(); |
|
304 if (ta->Refresh()) |
|
305 { |
|
306 ta->RemoveRefresh(); |
|
307 } |
|
308 delete ta; |
|
309 } |
|
310 return; |
|
311 } |
|
312 } |
|
313 delete aResponse; |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CSIPImplementation::SupportedSecurityMechanismsL |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 CDesC8Array* CSIPImplementation::SupportedSecurityMechanismsL() const |
|
321 { |
|
322 __TEST_INVARIANT; |
|
323 return iSIPClient->SupportedSecurityMechanismsL(); |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CSIPImplementation::IsSigCompSupportedL |
|
328 // ----------------------------------------------------------------------------- |
|
329 // |
|
330 TBool CSIPImplementation::IsSigCompSupportedL() const |
|
331 { |
|
332 __TEST_INVARIANT; |
|
333 return iSIPClient->IsSigCompSupportedL(); |
|
334 } |
|
335 |
|
336 // ----------------------------------------------------------------------------- |
|
337 // CSIPImplementation::NegotiatedSecurityMechanismL |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 HBufC8* |
|
341 CSIPImplementation::NegotiatedSecurityMechanismL(const TDesC8& aHop) const |
|
342 { |
|
343 __TEST_INVARIANT; |
|
344 return iSIPClient->NegotiatedSecurityMechanismL(aHop); |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CSIPImplementation::Connection |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 CSIPConnection* CSIPImplementation::Connection(TUint32 aIapId) const |
|
352 { |
|
353 __TEST_INVARIANT; |
|
354 |
|
355 for (TInt i = 0; i < iConnections.Count(); i++) |
|
356 { |
|
357 if (iConnections[i]->IapId() == aIapId) |
|
358 { |
|
359 return iConnections[i]; |
|
360 } |
|
361 } |
|
362 return NULL; |
|
363 } |
|
364 |
|
365 // ----------------------------------------------------------------------------- |
|
366 // CSIPImplementation::SetSecurityHandlingL |
|
367 // ----------------------------------------------------------------------------- |
|
368 // |
|
369 void CSIPImplementation::SetSecurityHandlingL(TBool aEnabled) |
|
370 { |
|
371 __TEST_INVARIANT; |
|
372 iSIPClient->SetSecurityHandlingL(aEnabled); |
|
373 iSecurityHandlingEnabled = aEnabled; |
|
374 } |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // CSIPImplementation::IsSecurityHandlingEnabled |
|
378 // ----------------------------------------------------------------------------- |
|
379 // |
|
380 TBool CSIPImplementation::IsSecurityHandlingEnabled() const |
|
381 { |
|
382 __TEST_INVARIANT; |
|
383 return iSecurityHandlingEnabled; |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CSIPImplementation::CreateTransactionL |
|
388 // It doesn't matter what MTransactionAssociation is given to NewL. |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 CSIPClientTransaction* |
|
392 CSIPImplementation::CreateTransactionL(TUint32 aRequestId, |
|
393 CSIPResponseElements* aResponse, |
|
394 CSIPRefresh* aRefresh) |
|
395 { |
|
396 __SIP_ASSERT_LEAVE(aResponse && aResponse->CSeqHeader(), KErrNotFound); |
|
397 |
|
398 CSIPClientTransaction* ta(NULL); |
|
399 RStringF method = aResponse->CSeqHeader()->Method(); |
|
400 if (method == SIPStrings::StringF(SipStrConsts::EInvite)) |
|
401 { |
|
402 ta = CSIPInviteClientTransaction::NewL(*this); |
|
403 if (aRefresh) |
|
404 { |
|
405 // Links refresh to INVITE transaction, but not the other way |
|
406 aRefresh->AddTransaction(*ta); |
|
407 } |
|
408 } |
|
409 else |
|
410 { |
|
411 ta = CSIPClientTransaction::NewL(method, *this, aRefresh); |
|
412 } |
|
413 ta->SetRequestId(aRequestId); |
|
414 ta->SetResponseElements(aResponse); |
|
415 return ta; |
|
416 } |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // CSIPImplementation::IgnoreChallenges |
|
420 // ----------------------------------------------------------------------------- |
|
421 // |
|
422 void |
|
423 CSIPImplementation::IgnoreChallenges( const CSIPClientTransaction& aTransaction, |
|
424 CSIPHttpDigest& aDigest ) |
|
425 { |
|
426 const CSIPResponseElements* resp = aTransaction.ResponseElements(); |
|
427 if ( resp ) |
|
428 { |
|
429 const RPointerArray<CSIPHeaderBase>& headers = |
|
430 resp->MessageElements().UserHeaders(); |
|
431 |
|
432 RStringF wwwAuth = |
|
433 SIPStrings::StringF(SipStrConsts::EWWWAuthenticateHeader); |
|
434 RStringF proxyAuth = |
|
435 SIPStrings::StringF(SipStrConsts::EProxyAuthenticateHeader); |
|
436 RStringF realm = SIPStrings::StringF(SipStrConsts::ERealm); |
|
437 |
|
438 for (TInt i = 0; i < headers.Count(); ++i) |
|
439 { |
|
440 const CSIPHeaderBase* header = headers[i]; |
|
441 if (header->Name() == wwwAuth || header->Name() == proxyAuth) |
|
442 { |
|
443 const CSIPAuthHeaderBase* auth = |
|
444 static_cast<const CSIPAuthHeaderBase*>(header); |
|
445 aDigest.IgnoreChallenge(aTransaction, |
|
446 auth->DesParamValue(realm)); |
|
447 } |
|
448 } |
|
449 } |
|
450 } |
|
451 |
|
452 // ----------------------------------------------------------------------------- |
|
453 // CSIPImplementation::SIPClient |
|
454 // ----------------------------------------------------------------------------- |
|
455 // |
|
456 CSIPClient& CSIPImplementation::SIPClient() |
|
457 { |
|
458 __TEST_INVARIANT; |
|
459 return *iSIPClient; |
|
460 } |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // CSIPImplementation::AddConnectionL |
|
464 // CSIPClient checks if a connection for the IAP-id already exists. No need to |
|
465 // do it here. |
|
466 // |
|
467 // Associate server transactions with the same IAP-id (aIapId), to aConnection. |
|
468 // Start search from the end of array, so if an item is removed, it doesn't |
|
469 // affect the position of items that haven't yet been checked. |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 void CSIPImplementation::AddConnectionL( |
|
473 CSIPConnectionImplementation& aConnImplementation, |
|
474 TUint32 aIapId) |
|
475 { |
|
476 __TEST_INVARIANT; |
|
477 |
|
478 CSIPConnection& conn = aConnImplementation.SIPConnectionL(); |
|
479 iConnections.AppendL(&conn); |
|
480 |
|
481 CPendingTransaction* ta(NULL); |
|
482 for (TInt i = iPendingServerTransactions.Count(); i > 0; i--) |
|
483 { |
|
484 ta = iPendingServerTransactions[i - 1]; |
|
485 __SIP_ASSERT_LEAVE(ta, KErrNotFound); |
|
486 |
|
487 if (ta->IapId() == aIapId) |
|
488 { |
|
489 ta->Transaction()->ReAssociateL(aConnImplementation); |
|
490 } |
|
491 } |
|
492 __TEST_INVARIANT; |
|
493 } |
|
494 |
|
495 // ----------------------------------------------------------------------------- |
|
496 // CSIPImplementation::RemoveConnection |
|
497 // ----------------------------------------------------------------------------- |
|
498 // |
|
499 void CSIPImplementation::RemoveConnection(const CSIPConnection& aConnection) |
|
500 { |
|
501 __TEST_INVARIANT; |
|
502 |
|
503 TInt pos = iConnections.Find(&aConnection); |
|
504 if (pos != KErrNotFound) |
|
505 { |
|
506 iConnections.Remove(pos); |
|
507 } |
|
508 __TEST_INVARIANT; |
|
509 } |
|
510 |
|
511 // ----------------------------------------------------------------------------- |
|
512 // CSIPImplementation::RemoveConnection |
|
513 // ----------------------------------------------------------------------------- |
|
514 // |
|
515 void CSIPImplementation::AddDigestL(CSIPHttpDigest& aDigest) |
|
516 { |
|
517 __TEST_INVARIANT; |
|
518 |
|
519 iDigests.AppendL(&aDigest); |
|
520 } |
|
521 |
|
522 // ----------------------------------------------------------------------------- |
|
523 // CSIPImplementation::RemoveDigest |
|
524 // ----------------------------------------------------------------------------- |
|
525 // |
|
526 void CSIPImplementation::RemoveDigest(const CSIPHttpDigest& aDigest) |
|
527 { |
|
528 __TEST_INVARIANT; |
|
529 |
|
530 TInt pos = iDigests.Find(&aDigest); |
|
531 if (pos != KErrNotFound) |
|
532 { |
|
533 iDigests.Remove(pos); |
|
534 } |
|
535 __TEST_INVARIANT; |
|
536 } |
|
537 |
|
538 // ----------------------------------------------------------------------------- |
|
539 // CSIPImplementation::ClientConnectionL |
|
540 // CSIPImplementation doesn't know which CSIPClientConnection to return since |
|
541 // no IAP-id is passed as parameter. |
|
542 // ----------------------------------------------------------------------------- |
|
543 // |
|
544 CSIPClientConnection& CSIPImplementation::ClientConnectionL() |
|
545 { |
|
546 __TEST_INVARIANT; |
|
547 |
|
548 User::Leave(KErrUnknown); |
|
549 return *(CSIPClientConnection*)1; |
|
550 } |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // CSIPImplementation::ClientConnection |
|
554 // CSIPImplementation doesn't know which CSIPClientConnection to return since |
|
555 // no IAP-id is passed as parameter. |
|
556 // ----------------------------------------------------------------------------- |
|
557 // |
|
558 CSIPClientConnection* CSIPImplementation::ClientConnection() |
|
559 { |
|
560 __TEST_INVARIANT; |
|
561 return NULL; |
|
562 } |
|
563 |
|
564 // ----------------------------------------------------------------------------- |
|
565 // CSIPImplementation::SIPConnectionL |
|
566 // CSIPImplementation doesn't know which CSIPConnection to return since no |
|
567 // IAP-id is passed as parameter. |
|
568 // ----------------------------------------------------------------------------- |
|
569 // |
|
570 CSIPConnection& CSIPImplementation::SIPConnectionL() |
|
571 { |
|
572 __TEST_INVARIANT; |
|
573 |
|
574 User::Leave(KErrUnknown); |
|
575 return *(CSIPConnection*)1; |
|
576 } |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // CSIPImplementation::AddTransactionL |
|
580 // ----------------------------------------------------------------------------- |
|
581 // |
|
582 void CSIPImplementation::AddTransactionL(CSIPTransactionBase& /*aTransaction*/) |
|
583 { |
|
584 // No action |
|
585 } |
|
586 |
|
587 // ----------------------------------------------------------------------------- |
|
588 // CSIPImplementation::RemoveTransaction |
|
589 // ----------------------------------------------------------------------------- |
|
590 // |
|
591 void |
|
592 CSIPImplementation::RemoveTransaction(const CSIPTransactionBase& aTransaction) |
|
593 { |
|
594 __TEST_INVARIANT; |
|
595 |
|
596 CPendingTransaction* ta(NULL); |
|
597 for (TInt i = 0; i < iPendingServerTransactions.Count(); i++) |
|
598 { |
|
599 ta = iPendingServerTransactions[i]; |
|
600 __SIP_ASSERT_RETURN(ta && ta->Transaction(), KErrNotFound); |
|
601 |
|
602 if (ta->Transaction() == &aTransaction) |
|
603 { |
|
604 iPendingServerTransactions.Remove(i); |
|
605 delete ta; |
|
606 return; |
|
607 } |
|
608 } |
|
609 __TEST_INVARIANT; |
|
610 } |
|
611 |
|
612 // ----------------------------------------------------------------------------- |
|
613 // CSIPImplementation::InitialRegisterState |
|
614 // ----------------------------------------------------------------------------- |
|
615 // |
|
616 CRegistrationState* CSIPImplementation::InitialRegisterState() |
|
617 { |
|
618 __TEST_INVARIANT; |
|
619 return iUnregistered; |
|
620 } |
|
621 |
|
622 // ----------------------------------------------------------------------------- |
|
623 // CSIPImplementation::InitialDialogState |
|
624 // ----------------------------------------------------------------------------- |
|
625 // |
|
626 CDialogState* CSIPImplementation::InitialDialogState() |
|
627 { |
|
628 __TEST_INVARIANT; |
|
629 return iDialogTrying; |
|
630 } |
|
631 |
|
632 // ----------------------------------------------------------------------------- |
|
633 // CSIPImplementation::__DbgTestInvariant |
|
634 // ----------------------------------------------------------------------------- |
|
635 // |
|
636 |
|
637 |
|
638 void CSIPImplementation::__DbgTestInvariant() const |
|
639 { |
|
640 if (!iSIPClient || |
|
641 !iUnregistered || !iRegistering || !iRegistered || !iUnregistering || |
|
642 !iDialogTrying || !iDialogEarly || !iDialogConfirmed || |
|
643 !iDialogTerminated) |
|
644 { |
|
645 User::Invariant(); |
|
646 } |
|
647 } |