applayerprotocols/httptransportfw/Test/testhttpmessage/ctestmessageparser.h
changeset 0 b16258d2340f
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 CTESTMESSAGEPARSER_H_
       
    17 #define CTESTMESSAGEPARSER_H_
       
    18 #if !defined HTTP_H
       
    19 #include <http.h>
       
    20 #endif
       
    21 #include <e32base.h>
       
    22 #include <rhttpmessageparser.h>
       
    23 #include <mhttpmessageparserobserver.h>
       
    24 #include <http/rhttpheaders.h>
       
    25 
       
    26 #if !defined __MTESTOBSERVER_H__
       
    27 #include "mtestobserver.h"
       
    28 #endif
       
    29 
       
    30 class CTestMessageParser : public CActive,
       
    31 							   public MHttpMessageParserObserver,public MHTTPTransactionCallback
       
    32 	{
       
    33 public: 
       
    34 	static CTestMessageParser* NewL(MTestObserver& aTestObserver);
       
    35 	virtual ~CTestMessageParser();
       
    36 	void StartRequest(TInt MessageType);
       
    37 	
       
    38 private:	// methods from CActive
       
    39 
       
    40 	virtual void RunL();
       
    41 	virtual void DoCancel();
       
    42 	virtual TInt RunError(TInt aError);
       
    43 
       
    44 private:	// methods from MHttpMessageParserObserver
       
    45 
       
    46 	virtual void GetDataPacket(TPtrC8& aData);
       
    47 	virtual void ReleaseDataPacket();
       
    48 
       
    49 	virtual void StartLineL(const TDesC8& aStartLine);
       
    50 	virtual void HeaderL(const TDesC8& aFieldName, TDesC8& aFieldValue);
       
    51 	virtual TInt BodySizeL();
       
    52 	virtual void BodyChunkL(const TDesC8& aData);
       
    53 	virtual void BodyCompleteL();
       
    54 	virtual void MessageCompleteL(const TPtrC8& aExcessData);
       
    55 
       
    56 	virtual TInt HandleParserError(TInt aError);
       
    57 
       
    58 	virtual void Reserved_MHttpMessageParserObserver();	
       
    59 
       
    60 private:
       
    61 	//
       
    62 	// methods from MHTTPTransactionCallback
       
    63 	//
       
    64 	virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
       
    65 	virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
       
    66 
       
    67 private:	// methods
       
    68 
       
    69 	CTestMessageParser(MTestObserver& aObserver);
       
    70 	void ConstructL();
       
    71 	void CompleteSelf();
       
    72 	void DoReset();
       
    73 	
       
    74 private:
       
    75 	MTestObserver&		iObserver;
       
    76 	RHttpMessageParser	iMessageParser;	
       
    77 	RStringPool iStringPool;
       
    78 	RHTTPSession iSession;
       
    79 	RHTTPTransaction iTransaction; // only used to create headers
       
    80 	RHTTPHeaders iHTTPHeaders;
       
    81 	HBufC8*	iBuffer;
       
    82 	TInt iMessageType;
       
    83 	};							   
       
    84 #endif /* CTESTMESSAGEPARSER_H_ */