epoc32/include/mw/chttpclienttransaction.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/chttpclienttransaction.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,113 @@
     1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +#ifndef __CHTTPCLIENTTRANSACTION_H__
    1.21 +#define __CHTTPCLIENTTRANSACTION_H__
    1.22 +
    1.23 +#include <e32base.h>
    1.24 +#include <f32file.h>  
    1.25 +#include <http.h>
    1.26 +#include <httpheaderiter.h>
    1.27 +#include <mhttpcontentsource.h>
    1.28 +#include <mhttpcontentsink.h>
    1.29 +
    1.30 +class CHttpService;
    1.31 +class CHttpClientTransactionImpl;
    1.32 +
    1.33 +/**
    1.34 + * In HTTP terms a single transaction is one request and its equivalent response. CHttpClientTransaction 
    1.35 + * encapsulates the information for the transaction. The client transaction is associated with the client 
    1.36 + * session. Client should derive from this class and implement the concrete use cases. [for ex; download, 
    1.37 + * upload etc..]
    1.38 + * 
    1.39 + * @publishedAll
    1.40 + * @prototype
    1.41 + * 
    1.42 + */
    1.43 +class CHttpClientTransaction : public CBase
    1.44 +	{
    1.45 +	public:
    1.46 +	
    1.47 +	IMPORT_C TInt Create(CHttpService& aClient, const TDesC8& aMethod, const TDesC8& aUri);
    1.48 +	
    1.49 +	IMPORT_C virtual ~CHttpClientTransaction();
    1.50 +		
    1.51 +	IMPORT_C TInt StatusCode() const;
    1.52 +	IMPORT_C const TDesC8& StatusText() const;
    1.53 +	
    1.54 +	IMPORT_C void DisablePipelining();
    1.55 +	IMPORT_C void SetNoRetry();
    1.56 +	
    1.57 +	IMPORT_C TInt SetContentSource(MHttpContentSource& aSource);
    1.58 +	IMPORT_C TInt SetContentSource(RFile& aFile);
    1.59 +	
    1.60 +	IMPORT_C TInt SetContentSink(MHttpContentSink& aSink);
    1.61 +	IMPORT_C TInt SetContentSink(RFile& aFile);
    1.62 +	
    1.63 +	IMPORT_C void SetRequestTimeout(TInt aValue);
    1.64 +	IMPORT_C void SetResponseTimeout(TInt aValue);
    1.65 +
    1.66 +	IMPORT_C TInt AddRequestHeader(TInt aHeaderId, const THttpHeaderValueVariant& aHeaderValue);
    1.67 +	IMPORT_C TInt AddRequestHeader(TInt aHeaderId, const THttpHeaderValueVariant& aHeaderValue, TInt aParamId, const THttpHeaderValueVariant& aParamValue); 
    1.68 +    IMPORT_C TInt AddRequestHeader(const TDesC8& aHeaderName, const THttpHeaderValueVariant& aHeaderValue);
    1.69 +    IMPORT_C TInt AddRequestHeader(const TDesC8& aHeaderName, const THttpHeaderValueVariant& aHeaderValue, const TDesC8& aParamName, const THttpHeaderValueVariant& aParamValue); 
    1.70 +    IMPORT_C TInt AddRequestHeader(const TDesC8& aHeaderName, const TDesC8& aParamName, const THttpHeaderValueVariant& aParamValue);    
    1.71 +
    1.72 +	
    1.73 +	IMPORT_C TInt AddCustomRequestHeader(const TDesC8& aHeaderName, const TDesC8& aHeaderValue);
    1.74 +	
    1.75 +	
    1.76 +	IMPORT_C THttpHeaderIterator         ResponseHeaders() const;
    1.77 +	IMPORT_C THttpHeaderElementIterator 	ResponseHeader(TInt aHeaderId);
    1.78 +	IMPORT_C THttpHeaderElementIterator 	ResponseHeader(const TDesC8& aHeaderName);
    1.79 +
    1.80 +
    1.81 +	IMPORT_C TInt SendRequest();
    1.82 +	IMPORT_C void CancelRequest();
    1.83 +	
    1.84 +	/**
    1.85 +	virtual functions
    1.86 +	*/
    1.87 +	virtual void OnResponseHeaders() =0;
    1.88 +	IMPORT_C virtual void OnTransferProgress(TInt aTotal, TInt aTransffered);
    1.89 +	IMPORT_C virtual TBool OnRedirection();
    1.90 +	virtual void OnCompletion() =0;
    1.91 +	virtual void OnError(TInt aError) =0;
    1.92 +	IMPORT_C virtual void OnWarning(TInt aWarning);
    1.93 +	
    1.94 +	private:
    1.95 +	// Reserved for future use.
    1.96 +	inline virtual void Reserved();
    1.97 +	inline virtual void Reserved2();
    1.98 +	
    1.99 +	protected:
   1.100 +	IMPORT_C CHttpClientTransaction();
   1.101 +	
   1.102 +	
   1.103 +	private:		
   1.104 +	CHttpClientTransactionImpl* iHttpClientTrans;
   1.105 +	};
   1.106 +
   1.107 +// Reserved for future use.
   1.108 +inline void CHttpClientTransaction::Reserved()
   1.109 +	{
   1.110 +	}
   1.111 +	
   1.112 +inline void CHttpClientTransaction::Reserved2()
   1.113 +	{
   1.114 +	}
   1.115 +	
   1.116 +#endif // __CHTTPCLIENTTRANSACTION_H__