|
1 /* |
|
2 * Copyright (c) 2002-2005 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 |
|
20 |
|
21 #ifndef WSF_RFILE_TXN_STATE_H |
|
22 #define WSF_RFILE_TXN_STATE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include "sentxnstate.h" |
|
27 #include "senhttpchannelimpl.h" |
|
28 |
|
29 // CLASS DECLARATION |
|
30 /** |
|
31 * Class for handling the transaction state in the http client class. |
|
32 * Implements the MHTTPDataSupplier interface. |
|
33 * |
|
34 */ |
|
35 class CSenRfileTxnState : public CSenTxnState |
|
36 { |
|
37 public: // Constructors and destructor |
|
38 |
|
39 /** |
|
40 * Two-phased constructor. |
|
41 * |
|
42 */ |
|
43 static CSenRfileTxnState* NewLC(MSenResponseObserver& aObserver, |
|
44 //RFileLogger* aLog, |
|
45 const TDesC8* aUri, |
|
46 CSenHttpChannelImpl* aHttpClient, |
|
47 const TDesC8& aContentType, |
|
48 const RFile& aContent); |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * |
|
53 */ |
|
54 static CSenRfileTxnState* NewL(MSenResponseObserver& aObserver, |
|
55 //RFileLogger* aLog, |
|
56 const TDesC8* aUri, |
|
57 CSenHttpChannelImpl* aHttpClient, |
|
58 const TDesC8& aContentType, |
|
59 const RFile& aContent); |
|
60 |
|
61 /** |
|
62 * Virtual destructor. |
|
63 * |
|
64 */ |
|
65 virtual ~CSenRfileTxnState(); |
|
66 |
|
67 // New functions |
|
68 |
|
69 // Functions from base classes |
|
70 |
|
71 /** |
|
72 * From MHTTPDataSupplier::GetNextDataPart. |
|
73 * Obtain a data part from the supplier. The data is guaranteed |
|
74 * to survive until a call is made to ReleaseData(). |
|
75 * @param aDataPart The data part. |
|
76 * @return ETrue if this is the last part, EFalse otherwise. |
|
77 */ |
|
78 virtual TBool GetNextDataPart(TPtrC8& aDataPart); |
|
79 |
|
80 /** |
|
81 * From MHTTPDataSupplier::ReleaseData. |
|
82 * Release the current data part being held at the data |
|
83 * supplier. This call indicates to the supplier that the part |
|
84 * is no longer needed, and another one can be supplied, if |
|
85 * appropriate. |
|
86 */ |
|
87 virtual void ReleaseData(); |
|
88 |
|
89 /** |
|
90 * From MHTTPDataSupplier::OverallDataSize. |
|
91 * Obtain the overall size of the data being supplied, if known |
|
92 * to the supplier. Where a body of data is supplied in several |
|
93 * parts this size will be the sum of all the part sizes. If |
|
94 * the size is not known, KErrNotFound is returned; in this case |
|
95 * the client must use the return code of GetNextDataPart to find |
|
96 * out when the data is complete. |
|
97 * |
|
98 * @return A size in bytes, or KErrNotFound if the size is not known. |
|
99 */ |
|
100 virtual TInt OverallDataSize(); |
|
101 |
|
102 /** |
|
103 * From MHTTPDataSupplier::Reset. |
|
104 * Reset the data supplier. This indicates to the data supplier |
|
105 * that it should return to the first part of the data. |
|
106 * This could be used in a situation where the data consumer has |
|
107 * encountered an error and needs the data to be supplied afresh. |
|
108 * Even if the last part has been supplied (i.e. GetNextDataPart |
|
109 * has returned ETrue), the data supplier should reset to the |
|
110 * first part. If the supplier cannot reset it should return an |
|
111 * error code; otherwise it should return KErrNone, where the |
|
112 * reset will be assumed to have succeeded. |
|
113 * |
|
114 * @return KErrNone if successful, otherwise another error code. |
|
115 */ |
|
116 virtual TInt Reset(); |
|
117 |
|
118 protected: |
|
119 /** |
|
120 * C++ default constructor. |
|
121 * |
|
122 */ |
|
123 CSenRfileTxnState(MSenResponseObserver& aObserver);//, |
|
124 //RFileLogger* aLog); |
|
125 |
|
126 /** |
|
127 * File logger. |
|
128 * |
|
129 */ |
|
130 //RFileLogger* Log() const; |
|
131 private://data |
|
132 |
|
133 RFile iFile; |
|
134 CSenHttpChannelImpl *iHttpClient ; |
|
135 TBool iMoreContent; |
|
136 HBufC8* iReadData; |
|
137 /**Message content data pointer for POSTs.Not own.*/ |
|
138 // const TDesC8* iContent; |
|
139 TInt iSize; |
|
140 /** |
|
141 * Return flag if more body to be send. Only in chunked mode. |
|
142 * |
|
143 * @since S60 ?S60_version |
|
144 * @return True if more body to be send. |
|
145 */ |
|
146 TBool MoreBody() const; |
|
147 |
|
148 |
|
149 private: |
|
150 |
|
151 /** |
|
152 * 2nd phase constructor. |
|
153 * |
|
154 */ |
|
155 void ConstructL(const TDesC8* aUri, |
|
156 CSenHttpChannelImpl* aHttpClient, |
|
157 const TDesC8& aContentType, |
|
158 const RFile& aContent); |
|
159 |
|
160 |
|
161 }; |
|
162 |
|
163 #endif // WSF_TXN_STATE_H |
|
164 |
|
165 // End of File |