|
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 : NormalUAC.cpp |
|
15 // Part of : TransactionUser |
|
16 // Version : SIP/4.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "SipAssert.h" |
|
22 #include "Transmitter.h" |
|
23 #include "TransactionMgr.h" |
|
24 #include "ClientTransaction.h" |
|
25 |
|
26 #include "NormalUAC.h" |
|
27 |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CNormalUAC::NewL |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CNormalUAC* CNormalUAC::NewL(CUserAgentCreateParams& aParams, |
|
34 MSipConnectionMgr& aConnectionMgr, |
|
35 MSipUriResolver& aResolver, |
|
36 CSIPSec& aSIPSec, |
|
37 TUint32 aCSeqNumber) |
|
38 { |
|
39 CNormalUAC* self = |
|
40 new (ELeave) CNormalUAC(aParams, aResolver, aSIPSec, aCSeqNumber); |
|
41 CleanupStack::PushL(self); |
|
42 self->CUserAgent::ConstructL(aConnectionMgr); |
|
43 self->CUserAgentClient::ConstructL(); |
|
44 CleanupStack::Pop(self); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CNormalUAC::CNormalUAC |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CNormalUAC::CNormalUAC(CUserAgentCreateParams& aParams, |
|
53 MSipUriResolver& aResolver, |
|
54 CSIPSec& aSIPSec, |
|
55 TUint32 aCSeqNumber) : |
|
56 CUserAgentClient(aParams, aResolver, aSIPSec, aCSeqNumber) |
|
57 { |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CNormalUAC::CreateTransactionL |
|
62 // Creates a transaction object used by NormalUAC. The possible previous |
|
63 // transaction should have been given to CDeleteMgr for deletion before |
|
64 // UserAgent can create another transaction. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CNormalUAC::CreateTransactionL() |
|
68 { |
|
69 __SIP_ASSERT_LEAVE(!iTransaction, KErrAlreadyExists); |
|
70 |
|
71 iTransaction = |
|
72 iTransactionMgr.CreateTransactionL(CTransactionBase::KClientTransaction, |
|
73 *this, |
|
74 *iTransmitter, |
|
75 iTimerValues); |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CNormalUAC::ReceiveResponseL |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CNormalUAC::ReceiveResponseL(CSIPResponse* aResp, |
|
83 const CUserAgentState& aResolve, |
|
84 const CUserAgentState& aWaitResponse, |
|
85 const CUserAgentState& /*aWaitAckFromApp*/, |
|
86 const CUserAgentState& /*aWaitTransactionToEnd*/) |
|
87 { |
|
88 __SIP_ASSERT_LEAVE(aResp, KErrArgument); |
|
89 |
|
90 if (!ShouldUaTryAgainL(aResp, aResolve, aWaitResponse)) |
|
91 { |
|
92 //Ownership of the response is passed to the upper layer |
|
93 PassRespToTransactionOwnerL(aResp); |
|
94 } |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CNormalUAC::PrepareTxForNewRequestL |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CNormalUAC::PrepareTxForNewRequestL(TTransactionId& aNewTransactionId) |
|
102 { |
|
103 __SIP_ASSERT_LEAVE(iTransmitter, KErrNotFound); |
|
104 |
|
105 iTransmitter->Cancel(); |
|
106 static_cast<CClientTransaction*>(iTransaction)-> |
|
107 RunIndependently(aNewTransactionId, &iDeleteMgr, ETrue); |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CNormalUAC::Ptr |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 CNormalUAC& CNormalUAC::Ptr(CUserAgent& aUserAgent) |
|
115 { |
|
116 return static_cast<CNormalUAC&>(aUserAgent); |
|
117 } |