servicediscoveryandcontrol/pnp/test/upnp/upnpmessage/inc/cupnprequestcomposer.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 __CUPNPREQUESTCOMPOSER_H_
       
    17 #define __CUPNPREQUESTCOMPOSER_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 
       
    26 #include "cupnpmessagecomposer.h"
       
    27 // Local includes
       
    28 #include "CRequest.h"
       
    29 #include "mhttpmessagecomposerobserver.h"
       
    30 #include "rhttpmessagecomposer.h"
       
    31 #include "mcomposerobserver.h"
       
    32 
       
    33 class CUpnpRequestComposer: public CUPnPMessageComposer
       
    34 	{
       
    35 public:
       
    36 	IMPORT_C static CUpnpRequestComposer* NewL(MComposerObserver& aObserver);
       
    37 	IMPORT_C virtual ~CUpnpRequestComposer();
       
    38 	IMPORT_C void RequestDataSent();
       
    39 	IMPORT_C void ResetComposer();
       
    40 	
       
    41 public:
       
    42 	IMPORT_C void ComposeRequest(CRequest* aRequest);
       
    43 	inline CRequest& Request();
       
    44 	
       
    45 private:
       
    46 	// methods from MHttpMessageComposerObserver
       
    47 	void StartLineL(TPtrC8& aMethod, TPtrC8& aRequestUri, TPtrC8& aVersion);
       
    48 	TInt NextHeaderL(TPtrC8& aHeaderName, TPtrC8& aHeaderValue);
       
    49 	MHTTPDataSupplier* HasBodyL();
       
    50 	inline TInt NextTrailerL(TPtrC8& aHeaderName, TPtrC8& aHeaderValue);
       
    51 	void MessageComplete();
       
    52 	void MessageDataReadyL();
       
    53 	TInt HandleComposeError(TInt aError);
       
    54 	
       
    55 private:
       
    56 	CUpnpRequestComposer(MComposerObserver& aObserver);
       
    57 	void ConstructL();
       
    58 	
       
    59 private:
       
    60 	CRequest*				iRequest;
       
    61 	
       
    62 	__FLOG_DECLARATION_MEMBER;
       
    63 	};
       
    64 
       
    65 CRequest& CUpnpRequestComposer::Request()
       
    66 	{
       
    67 	return (*iRequest);
       
    68 	}
       
    69 
       
    70 TInt CUpnpRequestComposer::NextTrailerL(TPtrC8& /*aHeaderName*/, TPtrC8& /*aHeaderValue*/)
       
    71 	{
       
    72 	// We do not set any trailer headers in the request.
       
    73 	return KErrNotFound;
       
    74 	}
       
    75 
       
    76 #endif /*CUPNPREQUESTCOMPOSER_H_*/