applayerprotocols/httpservice/inc/chttpdatasender.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:27:19 +0300
branchRCL_3
changeset 37 5f1cd966e0d9
parent 0 b16258d2340f
permissions -rw-r--r--
Revision: 201029 Kit: 201033

// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

#ifndef __CHTTPDATASENDER_H__
#define __CHTTPDATASENDER_H__

#include <e32base.h>
#include <http.h>
#include "mhttpdatasender.h"

class MHttpContentSource;
class CHttpFileReader;
class CHttpClientTransaction;

class CHttpDataSender : public CBase, 
						public MHttpDataSender, 
						public MHTTPDataSupplier
	{
	public:
	static CHttpDataSender* New(RHTTPTransaction aTrans, CHttpClientTransaction& aClientTrans, MHttpContentSource* aSource);
	static CHttpDataSender* New(RHTTPTransaction aTrans, CHttpClientTransaction& aClientTrans, RFile& aFile);

	~CHttpDataSender();
	
	void SetDynamicContentLen(TInt aLen);
	private:
	CHttpDataSender(RHTTPTransaction aTrans, CHttpClientTransaction& aClientTrans); 
	CHttpDataSender(RHTTPTransaction aTrans, CHttpClientTransaction& aClientTrans, MHttpContentSource* aSource);
	TInt Construct(RFile& aFile);
	// From MHttpDataSender
	void Notify(const TDesC8& aData, TBool aLast);
	void Error(TInt aError);
	
	// From MHTTPDataSupplier
	TBool GetNextDataPart(TPtrC8& aDataPart);
	void ReleaseData();
	TInt OverallDataSize();
	TInt Reset();
	
	void RequestData();
	
	private:
	RHTTPTransaction 			iTransaction;	
	MHttpContentSource* 		iDynamicSource;	
	CHttpFileReader*    		iFileReader;
	CHttpClientTransaction&     iClientTrans;
	TPtrC8              		iDataPtr;
	TBool               		iWaitingForRelease;	
	TBool               		iLastPart;
	TBool               		iInCallback;
	TInt                		iDynamicContentLen;
	TInt                        iTransfferedDataSize;
	};

#endif // __CHTTPDATASENDER_H__