servicediscoveryandcontrol/pnp/test/upnp/unittests/upnpmessagetest/inc/cupnpresponsecomposertest.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 // Copyright (c) 2008-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 CUPNPRESPONSECOMPOSERTEST_H_
       
    17 #define CUPNPRESPONSECOMPOSERTEST_H_
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <http/mhttpdatasupplier.h>
       
    21 #include <http/framework/cheadercodec.h>
       
    22 #include <es_mbuf.h>
       
    23 #include <comms-infras/rworkerlock.h>
       
    24 #include <comms-infras/mbufmanager.h>
       
    25 #include <cflog.h>
       
    26 
       
    27 #include "cupnpmessagetest.h"
       
    28 #include "mcomposerobserver.h"
       
    29 #include "cupnpresponsecomposer.h"
       
    30 #include "CResponse.h"
       
    31 
       
    32 _LIT(KResponseComposerTest, "ResponseComposerTest");
       
    33 
       
    34 class CUpnpResponseComposerTest: public CTestStep,
       
    35 							public MComposerObserver,
       
    36 							public MHTTPDataSupplier
       
    37 	{
       
    38 public:	// factory methods
       
    39 	static CUpnpResponseComposerTest* NewL();
       
    40 	CUpnpResponseComposerTest();
       
    41 	~CUpnpResponseComposerTest();
       
    42 
       
    43 private:	// methods from MComposerObserver
       
    44 	void ComposingConcluded();
       
    45 	void MessageDataReadyL(RBuf8& aData);
       
    46 	void ComposerError(TInt aError);
       
    47 
       
    48 public:	// methods from CTestStep
       
    49 	TVerdict doTestStepPreambleL();
       
    50 	TVerdict doTestStepL();
       
    51 	TVerdict doTestStepPostambleL();
       
    52 
       
    53 public:	// methods from MHTTPDataSupplier
       
    54 	TBool GetNextDataPart(TPtrC8& aDataPart);
       
    55 	void ReleaseData();
       
    56 	TInt OverallDataSize();
       
    57 	TInt Reset();
       
    58 
       
    59 private:
       
    60 	void ConstructResponseStatusLineL(const TInt aStatusCode, const TDesC& aStatusText);
       
    61 	void ConstructResponseHeadersL(const TInt aNoOfHdrValPairs, const TInt aNoOfHdrParamValPairs);
       
    62 	void ConstructResponseBodyL(const TBool aResponseBodyPresence);
       
    63 	void SetHeaderL(const TDesC8& aHeader, const TDesC8& aValue);
       
    64 	void SetParamL(const TDesC8& aHeader, const TDesC8& aParam, const TDesC8& aValue, const TInt aPartIndex);
       
    65 
       
    66 private:
       
    67 	CUpnpResponseComposer*			iResponseComposer;
       
    68 	HBufC8*							iResponseBody;
       
    69 	CActiveScheduler* 				iSched;
       
    70 	RBuf8							iResponseBuffer;
       
    71 	CResponse*						iResponse;
       
    72 	CHeaderCodec*					iCodec;
       
    73 	RStringPool						iStringPool;
       
    74 	CChunkManager* 					iMBufMgr;
       
    75 	//MMBufSizeAllocator* 			iMBufSzAllctr;
       
    76 	
       
    77 #ifdef __CFLOG_ACTIVE
       
    78 	__CFLOG_DECLARATION_MEMBER;
       
    79 #endif
       
    80 	
       
    81 	};
       
    82 
       
    83 #endif /*CUPNPRESPONSECOMPOSERTEST_H_*/