|
1 // Copyright (c) 2003-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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __CHTTPDATASENDER_H__ |
|
17 #define __CHTTPDATASENDER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <http.h> |
|
21 #include "mhttpdatasender.h" |
|
22 |
|
23 class MHttpContentSource; |
|
24 class CHttpFileReader; |
|
25 class CHttpClientTransaction; |
|
26 |
|
27 class CHttpDataSender : public CBase, |
|
28 public MHttpDataSender, |
|
29 public MHTTPDataSupplier |
|
30 { |
|
31 public: |
|
32 static CHttpDataSender* New(RHTTPTransaction aTrans, CHttpClientTransaction& aClientTrans, MHttpContentSource* aSource); |
|
33 static CHttpDataSender* New(RHTTPTransaction aTrans, CHttpClientTransaction& aClientTrans, RFile& aFile); |
|
34 |
|
35 ~CHttpDataSender(); |
|
36 |
|
37 void SetDynamicContentLen(TInt aLen); |
|
38 private: |
|
39 CHttpDataSender(RHTTPTransaction aTrans, CHttpClientTransaction& aClientTrans); |
|
40 CHttpDataSender(RHTTPTransaction aTrans, CHttpClientTransaction& aClientTrans, MHttpContentSource* aSource); |
|
41 TInt Construct(RFile& aFile); |
|
42 // From MHttpDataSender |
|
43 void Notify(const TDesC8& aData, TBool aLast); |
|
44 void Error(TInt aError); |
|
45 |
|
46 // From MHTTPDataSupplier |
|
47 TBool GetNextDataPart(TPtrC8& aDataPart); |
|
48 void ReleaseData(); |
|
49 TInt OverallDataSize(); |
|
50 TInt Reset(); |
|
51 |
|
52 void RequestData(); |
|
53 |
|
54 private: |
|
55 RHTTPTransaction iTransaction; |
|
56 MHttpContentSource* iDynamicSource; |
|
57 CHttpFileReader* iFileReader; |
|
58 CHttpClientTransaction& iClientTrans; |
|
59 TPtrC8 iDataPtr; |
|
60 TBool iWaitingForRelease; |
|
61 TBool iLastPart; |
|
62 TBool iInCallback; |
|
63 TInt iDynamicContentLen; |
|
64 TInt iTransfferedDataSize; |
|
65 }; |
|
66 |
|
67 #endif // __CHTTPDATASENDER_H__ |