|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Name : NormalClientTa.h |
|
16 * Part of : Transaction |
|
17 * Version : SIP/5.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef NORMALCLIENTTA_H |
|
29 #define NORMALCLIENTTA_H |
|
30 |
|
31 // INCLUDES |
|
32 #include "ClientTransaction.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CTimerRetransmit; |
|
36 class CTimerTerminateTa; |
|
37 |
|
38 |
|
39 // CLASS DECLARATION |
|
40 /* |
|
41 * This class is used for sending a non-INVITE (and non-ACK) request, and |
|
42 * receiving the responses. |
|
43 */ |
|
44 class CNormalClientTransaction : public CClientTransaction |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Creates a new instance of CNormalClientTransaction |
|
50 * |
|
51 * @param aUserAgent UserAgent owning the new transaction being created. |
|
52 * @param aTransmitter CTransmitter used for sending messages |
|
53 * @param aTimers LwTimer subsystem |
|
54 * @param aInitialState Initial state of the CTransaction object |
|
55 * @param aTimerValues Values for calculating timer durations |
|
56 * @param aTransactionStore TransactionStore |
|
57 * @return CNormalClientTransaction object, ownership is transferred |
|
58 */ |
|
59 static CNormalClientTransaction* NewL(CUserAgentBase& aUserAgent, |
|
60 CTransmitter& aTransmitter, |
|
61 MTimerManager& aTimers, |
|
62 CTransactionState& aInitialState, |
|
63 TTimerValues& aTimerValues, |
|
64 MTransactionStore& aTransactionStore); |
|
65 |
|
66 ~CNormalClientTransaction(); |
|
67 |
|
68 public: // From CClientTransaction |
|
69 |
|
70 void DeleteTimer(const CTransactionTimer& aTimer); |
|
71 |
|
72 public: // New functions |
|
73 |
|
74 /** |
|
75 * Sets the duration used for timer E to maximum (=T2). |
|
76 * |
|
77 * @pre iTimerE = NULL |
|
78 */ |
|
79 void IncreaseTimerEtoT2(); |
|
80 |
|
81 /** |
|
82 * Starts timer E. |
|
83 * |
|
84 * @pre iTimerE = NULL |
|
85 */ |
|
86 void StartTimerEL(); |
|
87 |
|
88 /** |
|
89 * Starts timer F, unless it has already been started. |
|
90 */ |
|
91 void StartTimerFUnlessExistsL(); |
|
92 |
|
93 static CNormalClientTransaction& Ptr(CTransaction& aTransaction); |
|
94 |
|
95 /** |
|
96 * Receive a SIP response. |
|
97 * |
|
98 * @pre aResponse != NULL |
|
99 * |
|
100 * @param aResponse SIP response, ownership is transferred |
|
101 * @param aCurrentState Transaction's current state |
|
102 * @param aProceeding Proceeding state of transaction state machine |
|
103 * @param aCompleted Completed state of transaction state machine |
|
104 * @return |
|
105 */ |
|
106 void ReceiveResponseL(CSIPResponse* aResponse, |
|
107 const CTransactionState& aCurrentState, |
|
108 const CTransactionState& aProceeding, |
|
109 const CTransactionState& aCompleted); |
|
110 |
|
111 private: // Constructor, for internal use |
|
112 |
|
113 CNormalClientTransaction(CUserAgentBase& aUserAgent, |
|
114 CTransmitter& aTransmitter, |
|
115 MTimerManager& aTimers, |
|
116 CTransactionState& aInitialState, |
|
117 TTimerValues& aTimerValues, |
|
118 MTransactionStore& aTransactionStore); |
|
119 |
|
120 private: // New functions, for internal use |
|
121 |
|
122 /** |
|
123 * Starts timer K. |
|
124 * |
|
125 * @pre iTimerK = NULL |
|
126 */ |
|
127 void StartTimerKL(); |
|
128 |
|
129 /** |
|
130 * Stops timer E |
|
131 * |
|
132 * @post iTimerE = NULL |
|
133 */ |
|
134 void StopTimerE(); |
|
135 |
|
136 /** |
|
137 * Stops timer F |
|
138 * |
|
139 * @post iTimerF = NULL |
|
140 */ |
|
141 void StopTimerF(); |
|
142 |
|
143 /** |
|
144 * Stops timer K |
|
145 * |
|
146 * @post iTimerK = NULL |
|
147 */ |
|
148 void StopTimerK(); |
|
149 |
|
150 /** |
|
151 * Stops all timers of this transaction |
|
152 * |
|
153 * @post iTimerE = NULL, iTimerF = NULL, iTimerK = NULL |
|
154 */ |
|
155 void CancelAllTimers(); |
|
156 |
|
157 private: // Data |
|
158 |
|
159 //Duration (ms) of timer E |
|
160 TUint iTimerEDuration; |
|
161 |
|
162 //Timer E, owned |
|
163 CTimerRetransmit* iTimerE; |
|
164 //Timer F, owned |
|
165 CTimerTerminateTa* iTimerF; |
|
166 //Timer K, owned |
|
167 CTimerTerminateTa* iTimerK; |
|
168 |
|
169 private: // For testing purposes |
|
170 |
|
171 void __DbgTestInvariant() const; |
|
172 |
|
173 |
|
174 |
|
175 #ifdef CPPUNIT_TEST |
|
176 friend class CTransactionUser_Test; |
|
177 friend class CNormalCTa_Trying_Test; |
|
178 friend class CNormalCTa_Proceeding_Test; |
|
179 friend class CNormalCTa_Completed_Test; |
|
180 friend class ClientTransaction_Test; |
|
181 #endif |
|
182 }; |
|
183 |
|
184 #endif // end of NORMALCLIENTTA_H |
|
185 |
|
186 // End of File |