|
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 : TransactionTimer.h |
|
16 * Part of : Transaction |
|
17 * Version : SIP/6.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef TRANSACTIONTIMER_H |
|
29 #define TRANSACTIONTIMER_H |
|
30 |
|
31 // INCLUDES |
|
32 #include "TimerBase.h" |
|
33 #include <stringpool.h> |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CSIPResponse; |
|
37 class TSIPTransportParams; |
|
38 class CTransaction; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 class CTransactionTimer : public CTimerBase |
|
43 { |
|
44 public: // Destructor |
|
45 |
|
46 virtual ~CTransactionTimer() {} |
|
47 |
|
48 public: // New functions |
|
49 |
|
50 /** |
|
51 * Handle the timer expiration. |
|
52 * |
|
53 * @param aTransaction Transaction whose timer expired |
|
54 * @param aTimerId Timer identifier |
|
55 */ |
|
56 virtual void ExpiredL(CTransaction& aTransaction, TTimerId aTimerId) = 0; |
|
57 |
|
58 protected: // Constructor |
|
59 |
|
60 /** |
|
61 * Creates a timer and starts it. Since there is no StartL() function in |
|
62 * the CTransactionTimer, if a timer is stopped, it can't be restarted. |
|
63 * |
|
64 * @pre aObserver != NULL |
|
65 * |
|
66 * @param aTimerMgr Timer subsystem |
|
67 * @param aObserver Callback for handling timer expiration. Ownership isn't |
|
68 * transferred. |
|
69 * @param aDuration Timer duration, in milliseconds |
|
70 */ |
|
71 CTransactionTimer(MTimerManager& aTimerMgr, |
|
72 MExpirationHandler* aObserver, |
|
73 TUint32 aDuration); |
|
74 }; |
|
75 |
|
76 |
|
77 |
|
78 /* |
|
79 * When this timer expires, client transaction retransmits the previously sent |
|
80 * SIP request. |
|
81 */ |
|
82 class CTimerRetransmit : public CTransactionTimer |
|
83 { |
|
84 public: // Enumerations |
|
85 |
|
86 enum TRetransmitTimerDuration |
|
87 { |
|
88 // Retransmission interval for sending INVITE using UDP to keep a NAT |
|
89 // binding alive. Unit is milliseconds. |
|
90 KNATBindingInterval = 28000 |
|
91 }; |
|
92 |
|
93 public: // Constructor |
|
94 |
|
95 static CTimerRetransmit* NewL(MTimerManager& aTimerMgr, |
|
96 MExpirationHandler* aObserver, |
|
97 TUint32 aDuration); |
|
98 |
|
99 public: // From CTransactionTimer |
|
100 |
|
101 void ExpiredL(CTransaction& aTransaction, TTimerId aTimerId); |
|
102 |
|
103 private: // Constructor, for internal use |
|
104 |
|
105 CTimerRetransmit(MTimerManager& aTimerMgr, |
|
106 MExpirationHandler* aObserver, |
|
107 TUint32 aDuration); |
|
108 }; |
|
109 |
|
110 |
|
111 |
|
112 /* |
|
113 * When this timer expires, transaction will terminate. |
|
114 */ |
|
115 class CTimerTerminateTa : public CTransactionTimer |
|
116 { |
|
117 public: // Enumerations |
|
118 |
|
119 enum TTransactionTimerDuration |
|
120 { |
|
121 // How long INVITE client transaction waits in proceeding state. |
|
122 // Unit is milliseconds. |
|
123 KProceedingTimerDuration = 300000 |
|
124 }; |
|
125 |
|
126 public: // Constructor |
|
127 |
|
128 static CTimerTerminateTa* NewL(MTimerManager& aTimerMgr, |
|
129 MExpirationHandler* aObserver, |
|
130 TUint32 aDuration, |
|
131 TInt aReason = KErrNone); |
|
132 |
|
133 public: // From CTransactionTimer |
|
134 |
|
135 void ExpiredL(CTransaction& aTransaction, TTimerId aTimerId); |
|
136 |
|
137 private: // Constructor, for internal use |
|
138 |
|
139 CTimerTerminateTa(MTimerManager& aTimerMgr, |
|
140 MExpirationHandler* aObserver, |
|
141 TUint32 aDuration, |
|
142 TInt aReason); |
|
143 |
|
144 private: // Data |
|
145 |
|
146 //Reason value which is passed to CTransaction::TerminatedL() when the |
|
147 //timer expires |
|
148 TInt iReason; |
|
149 }; |
|
150 |
|
151 |
|
152 |
|
153 /* |
|
154 * When this timer expires, server transaction sends a 100 response. |
|
155 */ |
|
156 class CTimerSend100 : public CTransactionTimer |
|
157 { |
|
158 public: // Constructor and destructor |
|
159 |
|
160 /** |
|
161 * Creates the timer and starts it timer. |
|
162 * |
|
163 * @pre aObserver != NULL |
|
164 * @pre aResponse != NULL |
|
165 * |
|
166 * @param aTimerMgr Timer subsystem |
|
167 * @param aObserver Callback handling the timer expiration, ownership is |
|
168 * not transferred. |
|
169 * @param aDuration Duration until timer expires. |
|
170 * @param aResponse SIP response, ownership is transferred. |
|
171 * @param aTransportProtocol Transport protocol to use when sending the |
|
172 * response. |
|
173 * @param aTransportParams Parameters to use when sending the response. |
|
174 */ |
|
175 static CTimerSend100* NewL(MTimerManager& aTimerMgr, |
|
176 MExpirationHandler* aObserver, |
|
177 TUint32 aDuration, |
|
178 CSIPResponse* aResponse, |
|
179 RStringF aTransportProtocol, |
|
180 TSIPTransportParams& aTransportParams); |
|
181 |
|
182 ~CTimerSend100(); |
|
183 |
|
184 public: // From CTransactionTimer |
|
185 |
|
186 void ExpiredL(CTransaction& aTransaction, TTimerId aTimerId); |
|
187 |
|
188 private: // Constructor, for internal use |
|
189 |
|
190 CTimerSend100(MTimerManager& aTimerMgr, |
|
191 MExpirationHandler* aObserver, |
|
192 TUint32 aDuration, |
|
193 RStringF aTransportProtocol, |
|
194 TSIPTransportParams& aTransportParams); |
|
195 |
|
196 private: // Data |
|
197 |
|
198 // Owned |
|
199 CSIPResponse* iResponse; |
|
200 RStringF iTransportProtocol; |
|
201 TSIPTransportParams& iTransportParams; |
|
202 |
|
203 #ifdef CPPUNIT_TEST |
|
204 friend class CTransactionUser_Test; |
|
205 #endif |
|
206 }; |
|
207 |
|
208 #endif // end of TRANSACTIONTIMER_H |
|
209 |
|
210 // End of File |