1.1 --- a/epoc32/include/http/mhttpdatasupplier.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,135 +0,0 @@
1.4 -// Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 -
1.21 -/**
1.22 - @file MHTTPDataSupplier.h
1.23 - @warning : This file contains Rose Model ID comments - please do not delete
1.24 -*/
1.25 -
1.26 -#ifndef __MHTTPDATASUPPLIER_H__
1.27 -#define __MHTTPDATASUPPLIER_H__
1.28 -
1.29 -// System includes
1.30 -#include <e32base.h>
1.31 -
1.32 -
1.33 -//##ModelId=3C4C187903E5
1.34 -class MHTTPDataSupplier
1.35 -/**
1.36 -A data supplier - This class is used to deliver the response data
1.37 -to the client, and is also used by the client to supply request
1.38 -body data to HTTP in POST transactions. Data is supplied in a
1.39 -number of parts. When a part is available it can be retreived
1.40 -with GetNextDataPart. The returned descriptor will remain valid until
1.41 -ReleaseData is called.
1.42 -
1.43 -To use this class to supply POST data, you have a number of
1.44 -options. If the post data needs to be URL Form encoded, you should
1.45 -use CHTTPFormEncoder, which will do the encoding and interface to
1.46 -the MHTTPDataSupplier for you. If you have all the data available,
1.47 -return its length in OverallDataSize, and pass back all the data
1.48 -from GetNextDataPart, returning ETrue to indicate that this is the
1.49 -last part.
1.50 -
1.51 -If you don't want to form all the data at once, but know how much
1.52 -you'll eventualy have, return the total length from
1.53 -OverallDataSize. When GetNextDataPart is first called, return the
1.54 -first part. If GetNextDataPart is called again before ReleaseData,
1.55 -you should still return the first part. Only when ReleaseData is
1.56 -called should you move to the second part. If you don't know the
1.57 -total size of the data, the procedure is the same but you should
1.58 -return KErrNotFound from OverallDataSize.
1.59 -
1.60 -When the next part is available, clients should call
1.61 -RHTTPTransaction::NotifyNewRequestBodyPartL to inform HTTP that
1.62 -the new data is available. They can do this from ReleaseData if
1.63 -more data is instantly available, or in some applications they may
1.64 -need to call it some time later when the next part has been
1.65 -assembled.
1.66 -
1.67 -Filter writers should note that the MHTTPDataSupplier interface is
1.68 -designed to be used by 1 client, as 1 component needs to know when
1.69 -to call ReleaseData(). However, filters can be written to
1.70 -transform the data in some way. For instance, a filter could be
1.71 -written to automaticaly handle a particular content encoding. When
1.72 -this filter first receives a GotResponseBodyData, it should take a
1.73 -copy of the response's body and replace the body with a
1.74 -MHTTPDataSupplier supplied by the filter. The filter should then
1.75 -receive the data from HTTP via the saved data supplier and give it
1.76 -to the client via its own data supplier.
1.77 -@publishedAll
1.78 -@released
1.79 -*/
1.80 - {
1.81 - public:
1.82 - /** Obtain a data part from the supplier. The data is guaranteed
1.83 - to survive until a call is made to ReleaseData().
1.84 - @param aDataPart - the data part
1.85 - @return ETrue if this is the last part. EFalse otherwise */
1.86 - //##ModelId=3C4C187A0026
1.87 - virtual TBool GetNextDataPart(TPtrC8& aDataPart) = 0;
1.88 -
1.89 - /** Release the current data part being held at the data
1.90 - supplier. This call indicates to the supplier that the part
1.91 - is no longer needed, and another one can be supplied, if
1.92 - appropriate. */
1.93 - //##ModelId=3C4C187A0025
1.94 - virtual void ReleaseData() = 0;
1.95 -
1.96 - /** Obtain the overall size of the data being supplied, if known
1.97 - to the supplier. Where a body of data is supplied in several
1.98 - parts this size will be the sum of all the part sizes. If
1.99 - the size is not known, KErrNotFound is returned; in this case
1.100 - the client must use the return code of GetNextDataPart to find
1.101 - out when the data is complete.
1.102 -
1.103 - @return A size in bytes, or KErrNotFound if the size is not known. */
1.104 - //##ModelId=3C4C187A001D
1.105 - virtual TInt OverallDataSize() = 0;
1.106 -
1.107 - /** Reset the data supplier. This indicates to the data supplier that it should
1.108 - return to the first part of the data. This could be used in a situation where
1.109 - the data consumer has encountered an error and needs the data to be supplied
1.110 - afresh. Even if the last part has been supplied (i.e. GetNextDataPart has
1.111 - returned ETrue), the data supplier should reset to the first part.
1.112 -
1.113 - If the supplier cannot reset it should return an error code; otherwise it should
1.114 - return KErrNone, where the reset will be assumed to have succeeded*/
1.115 - //##ModelId=3C4C187A001C
1.116 - virtual TInt Reset() = 0;
1.117 -
1.118 -private:
1.119 - // Some reserved methods for future expansion (e.g. better support
1.120 - // for ZCD)
1.121 - //##ModelId=3C4C187A001B
1.122 - inline virtual void MHDS_Reserved1();
1.123 - //##ModelId=3C4C187A0012
1.124 - inline virtual void MHDS_Reserved2();
1.125 - //##ModelId=3C4C187A0011
1.126 - inline virtual void MHDS_Reserved3();
1.127 - };
1.128 -
1.129 -inline void MHTTPDataSupplier::MHDS_Reserved1()
1.130 - {}
1.131 -
1.132 -inline void MHTTPDataSupplier::MHDS_Reserved2()
1.133 - {}
1.134 -
1.135 -inline void MHTTPDataSupplier::MHDS_Reserved3()
1.136 - {}
1.137 -
1.138 -#endif // __MHTTPDATASUPPLIER_H__