|
1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file CProtTransaction.h |
|
20 @warning : This file contains Rose Model ID comments - please do not delete |
|
21 */ |
|
22 |
|
23 #ifndef __CPROTTRANSACTION_H__ |
|
24 #define __CPROTTRANSACTION_H__ |
|
25 |
|
26 // System includes |
|
27 #include <e32base.h> |
|
28 #include <http/rhttptransaction.h> |
|
29 |
|
30 // Forward declarations |
|
31 class CTxData; |
|
32 class CRxData; |
|
33 class MRxDataObserver; |
|
34 |
|
35 |
|
36 //##ModelId=3B1E52B30382 |
|
37 class CProtTransaction : public CBase |
|
38 /** |
|
39 A representation of a transaction used by protocol handlers. |
|
40 This class is lower-level than the RHTTPTransaction class, |
|
41 since it owns objects that represent the request and response data as |
|
42 transmitted and received over a transport medium. |
|
43 @publishedAll |
|
44 @released |
|
45 */ |
|
46 { |
|
47 public: // Enums |
|
48 |
|
49 /** The TTransactionState type defines the states of a transaction. |
|
50 */ |
|
51 enum TTransactionState |
|
52 { |
|
53 /** Specifies that the transaction is pending servicing. |
|
54 */ |
|
55 EPending = 0, |
|
56 /** Specifies that the transaction is being serviced - active. |
|
57 */ |
|
58 EActive, |
|
59 /** Specifies that the transaction has been cancelled. |
|
60 */ |
|
61 ECancelled, |
|
62 /** Specifies that the transaction has completed. |
|
63 */ |
|
64 ECompleted |
|
65 }; |
|
66 |
|
67 public: |
|
68 |
|
69 /** |
|
70 Intended Usage: Destructor - cleans up and releases resources to the system |
|
71 */ |
|
72 //##ModelId=3B1E52B40031 |
|
73 IMPORT_C virtual ~CProtTransaction(); |
|
74 |
|
75 public: // accessors |
|
76 |
|
77 /** |
|
78 Provides the state of the transaction, e.g. pending, |
|
79 active, etc. |
|
80 @return A enum specifying the state of the transaction. |
|
81 */ |
|
82 //##ModelId=3C4C37E50306 |
|
83 TTransactionState TransactionState() const; |
|
84 |
|
85 /** |
|
86 Sets the state of the transaction. |
|
87 @param aState The state that the transaction is in. |
|
88 @post The state of the transaction has been updated. |
|
89 */ |
|
90 //##ModelId=3C4C37E502D4 |
|
91 void SetTransactionState(TTransactionState aState); |
|
92 |
|
93 /** |
|
94 Resets the Rx data object. The Rx data object must be |
|
95 created again to be used. |
|
96 @post The Rx data objects has been reset. |
|
97 */ |
|
98 //##ModelId=3C4C37E502CA |
|
99 IMPORT_C void ResetRxData(); |
|
100 |
|
101 /** |
|
102 Resets the Tx data object. The Tx data object must be |
|
103 created again to be used. |
|
104 @post The Tx data objects has been reset. |
|
105 */ |
|
106 //##ModelId=3C4C37E502C0 |
|
107 IMPORT_C void ResetTxData(); |
|
108 |
|
109 /** |
|
110 Obtain the API-level transaction to which this object |
|
111 corresponds to. |
|
112 @return The API-level transaction that this object corresponds to. |
|
113 */ |
|
114 //##ModelId=3B1E52B40013 |
|
115 IMPORT_C RHTTPTransaction Transaction() const; |
|
116 |
|
117 /** |
|
118 Obtain the Transmit Data portion of the transaction. |
|
119 @return A reference to the Tx data object of the transaction. |
|
120 */ |
|
121 //##ModelId=3B1E52B40012 |
|
122 IMPORT_C CTxData& TxData() const; |
|
123 |
|
124 /** |
|
125 Obtain the Receive Data portion of the transaction. |
|
126 @return A reference to the Rx data object of the transaction. |
|
127 */ |
|
128 //##ModelId=3B1E52B40009 |
|
129 IMPORT_C CRxData& RxData() const; |
|
130 |
|
131 public: // Methods to be implemented by derived classes |
|
132 |
|
133 /** |
|
134 Intended Usage: Creates the appropriate CTxData object. |
|
135 @leave KErrNoMemory if there is not enough memory available to |
|
136 create the object. |
|
137 */ |
|
138 //##ModelId=3C4C37E502AC |
|
139 virtual void CreateTxDataL() =0; |
|
140 |
|
141 /** |
|
142 Intended Usage: Creates the appropriate CRxData object. |
|
143 @leave KErrNoMemory if there is not enough memory available to |
|
144 create the object. |
|
145 @param aObserver A reference to the observer for the Rx data object. |
|
146 */ |
|
147 //##ModelId=3C4C37E50284 |
|
148 virtual void CreateRxDataL(MRxDataObserver& aObserver) =0; |
|
149 |
|
150 protected: // Methods |
|
151 |
|
152 /** |
|
153 Default constructor |
|
154 */ |
|
155 //##ModelId=3B1E52B303E6 |
|
156 CProtTransaction(); |
|
157 |
|
158 /** |
|
159 Normal constructor, of a CProtTransaction that corresponds to the |
|
160 supplied client transaction handle. |
|
161 @param aTrans (in) The client transaction handle. |
|
162 */ |
|
163 //##ModelId=3B1E52B303E7 |
|
164 IMPORT_C CProtTransaction(RHTTPTransaction aTrans); |
|
165 |
|
166 protected: // Attributes |
|
167 |
|
168 /** The client transaction |
|
169 */ |
|
170 //##ModelId=3B1E52B303D4 |
|
171 RHTTPTransaction iTrans; |
|
172 |
|
173 /** The transmission data |
|
174 */ |
|
175 //##ModelId=3B1E52B303CA |
|
176 CTxData* iTxData; |
|
177 |
|
178 /** The received data |
|
179 */ |
|
180 //##ModelId=3B1E52B303C0 |
|
181 CRxData* iRxData; |
|
182 |
|
183 /** Transaction state indicator. |
|
184 */ |
|
185 //##ModelId=3C4C37E50247 |
|
186 TTransactionState iTransactionState; |
|
187 |
|
188 private: // methods |
|
189 |
|
190 /** |
|
191 Intended Usage: Reserve a slot in the v-table to preserve future BC |
|
192 */ |
|
193 //##ModelId=3C4C37E5026F |
|
194 inline virtual void Reserved1(); |
|
195 |
|
196 /** |
|
197 Intended Usage: Reserve a slot in the v-table to preserve future BC |
|
198 */ |
|
199 //##ModelId=3C4C37E50251 |
|
200 inline virtual void Reserved2(); |
|
201 }; |
|
202 |
|
203 |
|
204 inline void CProtTransaction::Reserved1() |
|
205 {} |
|
206 inline void CProtTransaction::Reserved2() |
|
207 {} |
|
208 |
|
209 |
|
210 #endif // __CPROTTRANSACTION_H__ |