servicediscoveryandcontrol/pnp/test/upnp/upnpmessage/inc/cupnpresponsecomposer.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 __CUPNPRESPONSECOMPOSER_H_
       
    17 #define __CUPNPRESPONSECOMPOSER_H_
       
    18 
       
    19 // System includes
       
    20 #include <e32base.h>
       
    21 #include <http/mhttpdatasupplier.h>
       
    22 #include <http/thttphdrfielditer.h>
       
    23 #include <comms-infras/commsdebugutility.h>
       
    24 #include <http/thttptable.h>
       
    25 #include "cupnpmessagecomposer.h"
       
    26 
       
    27 // Local includes
       
    28 #include "mhttpmessagecomposerobserver.h"
       
    29 #include "CResponse.h"
       
    30 #include "rhttpmessagecomposer.h"
       
    31 #include "mcomposerobserver.h"
       
    32 
       
    33 class CUpnpResponseComposer: public CUPnPMessageComposer
       
    34 	{
       
    35 public:
       
    36 	IMPORT_C static CUpnpResponseComposer* NewL(MComposerObserver& aObserver);
       
    37 	IMPORT_C virtual ~CUpnpResponseComposer();
       
    38 	IMPORT_C void ResponseDataSent();
       
    39 	IMPORT_C void ResetComposer();
       
    40 
       
    41 public:
       
    42 	IMPORT_C void ComposeResponse(CResponse* aResponse);
       
    43 	
       
    44 private:
       
    45 	// methods from MHttpMessageComposerObserver
       
    46 	void StartLineL(TPtrC8& aVersion, TPtrC8& aStatusCode, TPtrC8& aStatusText);
       
    47 	TInt NextHeaderL(TPtrC8& aHeaderName, TPtrC8& aHeaderValue);
       
    48 	MHTTPDataSupplier* HasBodyL();
       
    49 	inline TInt NextTrailerL(TPtrC8& aHeaderName, TPtrC8& aHeaderValue);
       
    50 	void MessageComplete();
       
    51 	void MessageDataReadyL();
       
    52 	TInt HandleComposeError(TInt aError);
       
    53 	
       
    54 private:
       
    55 	CUpnpResponseComposer(MComposerObserver& aObserver);
       
    56 	void ConstructL();
       
    57 	
       
    58 private:
       
    59 	CResponse* 				iResponse;
       
    60 	HBufC8*					iStatusCodeBuf;
       
    61 
       
    62 	__FLOG_DECLARATION_MEMBER;
       
    63 	};
       
    64 	
       
    65 TInt CUpnpResponseComposer::NextTrailerL(TPtrC8& /*aHeaderName*/, TPtrC8& /*aHeaderValue*/)
       
    66 	{
       
    67 	// Response cannot contain trailer headers
       
    68 	return KErrNotFound;
       
    69 	}
       
    70 
       
    71 #endif /*CUPNPRESPONSECOMPOSER_H_*/