1 /* |
|
2 * Copyright (c) 2003 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSIPTRANSACTIONBASE_H |
|
20 #define CSIPTRANSACTIONBASE_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <stringpool.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CSIPResponseElements; |
|
29 class MTransactionAssociation; |
|
30 |
|
31 /** |
|
32 * Base class for managing SIP transactions. |
|
33 * It provides services for quering transaction |
|
34 * type and its state. |
|
35 * |
|
36 * This class is an abstract class and cannot be |
|
37 * instantiated. |
|
38 * @lib sipclient |
|
39 */ |
|
40 class CSIPTransactionBase: public CBase |
|
41 { |
|
42 public: |
|
43 /** SIP transaction state */ |
|
44 enum TState |
|
45 { |
|
46 /** Trying state */ |
|
47 ETrying, |
|
48 /** Calling state */ |
|
49 ECalling, |
|
50 /** Proceeding state */ |
|
51 EProceeding, |
|
52 /** Completed state */ |
|
53 ECompleted, |
|
54 /** Confirmed state */ |
|
55 EConfirmed, |
|
56 /** Terminated state */ |
|
57 ETerminated |
|
58 }; |
|
59 |
|
60 public: |
|
61 |
|
62 /** |
|
63 * Destructor |
|
64 */ |
|
65 |
|
66 virtual ~CSIPTransactionBase(); |
|
67 |
|
68 |
|
69 public: |
|
70 /** |
|
71 * Gets the SIP transaction type |
|
72 * @return SIP transaction type |
|
73 */ |
|
74 |
|
75 IMPORT_C RStringF Type() const; |
|
76 |
|
77 |
|
78 /** |
|
79 * Gets SIP transaction state |
|
80 * @return SIP transaction state |
|
81 */ |
|
82 |
|
83 IMPORT_C CSIPTransactionBase::TState StateL(); |
|
84 |
|
85 |
|
86 /** |
|
87 * Checks the if the actual object |
|
88 * is of type CSIPClientTransaction. |
|
89 * @return ETrue if object is of type CSIPClientTransaction and |
|
90 * EFalse otherwise |
|
91 */ |
|
92 |
|
93 IMPORT_C TBool IsSIPClientTransaction() const; |
|
94 |
|
95 |
|
96 /** |
|
97 * Compares this object to another object also having |
|
98 * CSIPTransactionBase base class |
|
99 * The function has to be implemented in each of the sub-classes. |
|
100 * @param aTransaction a CSIPTransactionBase object to compare |
|
101 * @return ETrue if the objects are equal otherwise EFalse |
|
102 */ |
|
103 |
|
104 IMPORT_C TBool |
|
105 operator==(const CSIPTransactionBase& aTransaction) const; |
|
106 |
|
107 /** |
|
108 * Obtains the RequestId of the transaction. |
|
109 * |
|
110 * @return RequestId |
|
111 */ |
|
112 |
|
113 TUint32 RequestId() const; |
|
114 |
|
115 |
|
116 /** |
|
117 * Clears the MTransactionAssociation. After this the object can't be |
|
118 * used anymore and it is expected that user will delete it soon. |
|
119 * |
|
120 * @param aAssociation Object requesting the detach |
|
121 */ |
|
122 |
|
123 virtual void Detach(const MTransactionAssociation& aAssociation); |
|
124 |
|
125 |
|
126 /** |
|
127 * Changes the transaction state. |
|
128 * |
|
129 * @param aNextState State into which transaction moves |
|
130 */ |
|
131 |
|
132 void ChangeState(CSIPTransactionBase::TState aNextState); |
|
133 |
|
134 |
|
135 /** |
|
136 * Determines whether this transaction has an effect on the associated |
|
137 * dialog's state. |
|
138 * |
|
139 * @return ETrue if transaction has an effect on the dialog's state, |
|
140 * EFalse otherwise. |
|
141 */ |
|
142 |
|
143 TBool AffectsDialogState() const; |
|
144 |
|
145 |
|
146 /** |
|
147 * Sets this transaction to affect the dialog state. |
|
148 */ |
|
149 |
|
150 void SetAffectsDialogState(); |
|
151 |
|
152 |
|
153 /** |
|
154 * Determines whether the transaction type is a target refresh request. |
|
155 * |
|
156 * @param aType Type of transaction |
|
157 * @return ETrue If the transaction is a target refresh request, EFalse |
|
158 * otherwise. |
|
159 */ |
|
160 |
|
161 static TBool IsTargetRefresh(RStringF aType); |
|
162 |
|
163 |
|
164 /** |
|
165 * Stores response elements. Depending on the status code, transaction |
|
166 * may enter another state. |
|
167 * |
|
168 * @param aElements Response elements, ownership is transferred. |
|
169 */ |
|
170 |
|
171 void SetResponseElements(CSIPResponseElements* aElements); |
|
172 |
|
173 |
|
174 protected: |
|
175 CSIPTransactionBase( RStringF aType, TBool aIsCliTrx ); |
|
176 |
|
177 void ConstructL(); |
|
178 |
|
179 |
|
180 /** |
|
181 * Checks that iAssociation is available (not NULL). If iAssociation is |
|
182 * NULL, it means user has deleted a resource needed by |
|
183 * CSIPTransactionBase, and this function leaves. |
|
184 */ |
|
185 |
|
186 void CheckAssociationL() const; |
|
187 |
|
188 |
|
189 /** |
|
190 * Gets response elements. |
|
191 * |
|
192 * @return Response elements. Ownership isn't transferred. |
|
193 */ |
|
194 |
|
195 const CSIPResponseElements* ResponseElements() const; |
|
196 |
|
197 |
|
198 //RequestId received from SIP client |
|
199 TUint32 iRequestId; |
|
200 |
|
201 //Every transaction is associated to exactly one other object: |
|
202 //CSIP, CSIPConnection, CSIPRegistrationBinding or CSIPDialogAssocBase |
|
203 MTransactionAssociation* iAssociation; |
|
204 |
|
205 public: |
|
206 |
|
207 RStringF iType; |
|
208 |
|
209 //ETrue is the transaction is a client transaction, EFalse otherwise |
|
210 TBool iIsClientTransaction; |
|
211 |
|
212 |
|
213 //ETrue if the transaction has an effect on the dialog state in case |
|
214 //the transaction is associated with a dialog. |
|
215 //EFalse otherwise. |
|
216 TBool iAffectsDialogState; |
|
217 |
|
218 //SIP response elements |
|
219 CSIPResponseElements* iResponseElements; |
|
220 |
|
221 public: |
|
222 //Current transaction state |
|
223 TState iState; |
|
224 |
|
225 |
|
226 }; |
|
227 |
|
228 #endif |
|