applayerpluginsandutils/httpprotocolplugins/httpclient/chttprequestbatcher.h
changeset 0 b16258d2340f
child 5 337070b4fa18
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     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 __CHTTPREQUESTBATCHER_H__
       
    17 #define __CHTTPREQUESTBATCHER_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <http/framework/logging.h>
       
    21 
       
    22 #include "moutputstream.h"
       
    23 #include "moutputstreamobserver.h"
       
    24 
       
    25 class CX509Certificate;
       
    26 
       
    27 
       
    28 class CHttpRequestBatcher : public CActive,
       
    29 							public MOutputStream,
       
    30 							public MOutputStreamObserver
       
    31 	{
       
    32 public:		// methods
       
    33 	static CHttpRequestBatcher* NewL(MOutputStream& aOutputStream, const TInt aBufferSize);
       
    34 
       
    35 	virtual ~CHttpRequestBatcher();
       
    36 
       
    37 	virtual void Bind(MOutputStreamObserver& aObserver);
       
    38 
       
    39 
       
    40 private:	// methods from MOutputStream
       
    41 	virtual void SendDataReqL(const TDesC8& aBuffer);
       
    42 
       
    43 	virtual void ShutdownReq();
       
    44 
       
    45 	virtual void SecureClientReq(const TDesC8& aHostName);
       
    46 
       
    47 	virtual void Close();
       
    48 
       
    49 	virtual const CX509Certificate* ServerCert();
       
    50 	
       
    51 	virtual TInt CipherSuite(TDes8& aCipherSuite);
       
    52 
       
    53 	virtual void MOutputStream_Reserved();
       
    54 
       
    55 	virtual void Reset ();
       
    56 	
       
    57 	virtual void SetTCPCorking(TBool aValue);
       
    58 private:	// methods from MOutputStreamObserver
       
    59 	virtual void SendDataCnfL();
       
    60 
       
    61 	virtual void SecureClientCnf();
       
    62 
       
    63 	virtual void OutputStreamCloseInd(TInt aError);
       
    64 
       
    65 	virtual void MOutputStreamObserver_Reserved();
       
    66 	
       
    67 	virtual void OnSendTimeOut();
       
    68 	
       
    69 	virtual TInt SendTimeOutVal();
       
    70 	
       
    71 private:	// methods from CActive
       
    72 	virtual void RunL();
       
    73 	
       
    74 	virtual void DoCancel();
       
    75 	
       
    76 	virtual TInt RunError(TInt aError);
       
    77 
       
    78 
       
    79 private:	// methods
       
    80 	CHttpRequestBatcher(MOutputStream& aOutputStream, const TInt aBufferSize);
       
    81 
       
    82 	void SendRequestImmediatelyL(const TDesC8& aBuffer);
       
    83 
       
    84 	void SendRequestsBatchedL(const TDesC8& aBuffer);
       
    85 
       
    86 	void BatchRequestsL(const TDesC8& aBuffer);
       
    87 
       
    88 	void HandleExcessDataL();
       
    89 
       
    90 	void StartTimer();
       
    91 
       
    92 	void ConstructL();
       
    93 
       
    94 
       
    95 private:	// typedefs
       
    96 	typedef void (CHttpRequestBatcher::*TSendFunction)(const TDesC8&);
       
    97 
       
    98 
       
    99 private:	// attributes
       
   100 	MOutputStreamObserver*		iObserver;
       
   101 
       
   102 	MOutputStream*				iOutputStream;
       
   103 
       
   104 	HBufC8*						iBuffer;
       
   105 
       
   106 	TPtr8						iDataToSend;
       
   107 
       
   108 	TPtrC8						iExcessData;
       
   109 
       
   110 	TInt						iMaxBufferSize;
       
   111 
       
   112 	TSendFunction				iFuncPtr;
       
   113 
       
   114 	RTimer						iTimer;
       
   115 
       
   116 	TBool						iTimerCompleted;
       
   117 
       
   118 public:	// attributes
       
   119 	__FLOG_DECLARATION_MEMBER2
       
   120 	};
       
   121 
       
   122 #endif	// __CHTTPREQUESTBATCHER_H__