|
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 : InviteServerTa.h |
|
16 * Part of : Transaction |
|
17 * Version : SIP/5.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef INVITESERVERTA_H |
|
29 #define INVITESERVERTA_H |
|
30 |
|
31 // INCLUDES |
|
32 #include "ServerTransaction.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CTimerTerminateTa; |
|
36 class CTimerRetransmit; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /* |
|
40 * This class represents an INVITE server transaction. |
|
41 */ |
|
42 class CInviteServerTransaction : public CServerTransaction |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Creates a new instance of CInviteServerTransaction |
|
48 * |
|
49 * @param aUserAgent UserAgent owning the new transaction being created. |
|
50 * @param aTransmitter CTransmitter used for sending messages |
|
51 * @param aTimers LwTimer subsystem |
|
52 * @param aInitialState Initial state of the CTransaction object |
|
53 * @param aTimerValues Values for calculating timer durations |
|
54 * @return New CInviteServerTransaction object, ownership is transferred |
|
55 */ |
|
56 static CInviteServerTransaction* NewL(CUserAgentBase& aUserAgent, |
|
57 CTransmitter& aTransmitter, |
|
58 MTimerManager& aTimers, |
|
59 CTransactionState& aInitialState, |
|
60 TTimerValues& aTimerValues); |
|
61 |
|
62 ~CInviteServerTransaction(); |
|
63 |
|
64 public: // From CServerTransaction |
|
65 |
|
66 /** |
|
67 * InviteServerTransaction enters terminated state. If the |
|
68 * InviteServerTransaction has been given a 2xx response to send, it must |
|
69 * clear any pointers to the 2xx since InviteUAS owns the 2xx. |
|
70 * |
|
71 * @param aReason Reason why the InviteServerTransaction ends |
|
72 */ |
|
73 void TerminatedL(TInt aReason); |
|
74 |
|
75 void DeleteTimer(const CTransactionTimer& aTimer); |
|
76 |
|
77 TBool IsInviteTransaction() const; |
|
78 |
|
79 public: // New functions |
|
80 |
|
81 /** |
|
82 * A SIP response has been sent to network. Depending on the response code, |
|
83 * transaction enters another state. |
|
84 * |
|
85 * @param aRespCode Response code of the received SIP response |
|
86 * @param aSending2xx State where CTransaction moves, if aRespCode is |
|
87 * 200-299 |
|
88 * @param aCompleted State where CTransaction moves, if aRespCode is >= 300 |
|
89 */ |
|
90 void ResponseSent(TUint aRespCode, |
|
91 CTransactionState& aSending2xx, |
|
92 CTransactionState& aCompleted); |
|
93 |
|
94 /** |
|
95 * Transaction enters Confirmed state. Stop timers G and H and start |
|
96 * timer I. |
|
97 * |
|
98 * @param aConfirmed Confirmed state |
|
99 */ |
|
100 void EnterConfirmedStateL(CTransactionState& aConfirmed); |
|
101 |
|
102 /** |
|
103 * When CInviteServerTransaction ends after sending the first 2xx, |
|
104 * InviteUAS starts retransmitting the 2xx. The pointers to 2xx from |
|
105 * CInviteServerTransaction are cleared. |
|
106 */ |
|
107 void Leave2xxForUAS(); |
|
108 |
|
109 /** |
|
110 * Starts timer G, unless it is already running. |
|
111 */ |
|
112 void StartTimerGUnlessExistsL(); |
|
113 |
|
114 /** |
|
115 * Starts timer H. |
|
116 * |
|
117 * @pre iTimerH = NULL |
|
118 */ |
|
119 void StartTimerHL(); |
|
120 |
|
121 static CInviteServerTransaction& Ptr(CTransactionBase& aTransaction); |
|
122 |
|
123 private: // Constructors, for internal use |
|
124 |
|
125 CInviteServerTransaction(CUserAgentBase& aUserAgent, |
|
126 CTransmitter& aTransmitter, |
|
127 MTimerManager& aTimers, |
|
128 CTransactionState& aInitialState, |
|
129 TTimerValues& aTimerValues); |
|
130 |
|
131 void ConstructL(); |
|
132 |
|
133 private: // New functions, for internal use |
|
134 |
|
135 void FreeResponsesFromQueues() const; |
|
136 |
|
137 void StartTimerIL(); |
|
138 |
|
139 void StopTimerG(); |
|
140 void StopTimerH(); |
|
141 void StopTimerI(); |
|
142 |
|
143 void CancelAllTimers(); |
|
144 |
|
145 private: // Data |
|
146 |
|
147 //Duration (ms) for timer G |
|
148 TUint iTimerGDuration; |
|
149 |
|
150 //Timer G, owned. |
|
151 CTimerRetransmit* iTimerG; |
|
152 //Timer H, owned. |
|
153 CTimerTerminateTa* iTimerH; |
|
154 //Timer I, owned. |
|
155 CTimerTerminateTa* iTimerI; |
|
156 |
|
157 void __DbgTestInvariant() const; |
|
158 |
|
159 |
|
160 #ifdef CPPUNIT_TEST |
|
161 friend class CTransactionUser_Test; |
|
162 friend class CInviteServerTa_Test; |
|
163 #endif |
|
164 }; |
|
165 |
|
166 #endif // end of INVITESERVERTA_H |
|
167 |
|
168 // End of File |