upnp/upnpstack/serviceframework/inc/upnphttpclientengine.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies  this distribution, and is available 
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Declares the CUpnpHttpClientEngine class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __UPNPHTTPCLIENTENGINE_H__
       
    20 #define __UPNPHTTPCLIENTENGINE_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <http/rhttpsession.h>
       
    24 #include <es_sock.h>
       
    25 #include "upnphttpmessagesenderowner.h"
       
    26 #include "upnpconnectionmanagerproxy.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CUpnpHttpTransaction;
       
    30 class CUpnpHttpMessageSender;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * MUpnpHttpClientObserver
       
    36 * CUpnpHttpClientEngine passes end of transaction event with this interface.
       
    37 * An instance of this class must be provided for construction of CUpnpHttpClientEngine.
       
    38 */
       
    39 class MUpnpHttpClientObserver
       
    40     {
       
    41     public:
       
    42         virtual void ClientResponseRecivedLD( CUpnpHttpTransaction& aEndedTransaction ) = 0;
       
    43     };
       
    44 
       
    45 /**
       
    46 * CUpnpHTTPClientEngine
       
    47 * Provides simple interface to HTTP Client API.
       
    48 */
       
    49 NONSHARABLE_CLASS( CUpnpHttpClientEngine ): public CBase, public MUpnpHttpMessageSenderOwner
       
    50     {
       
    51     public:
       
    52         /**
       
    53         * Create a CUpnpHttpClientEngine object.
       
    54         * @param  iObserver:
       
    55         * @return A pointer to the created instance of CWebClientEngine
       
    56         */
       
    57         IMPORT_C static CUpnpHttpClientEngine* NewL(
       
    58             MUpnpHttpClientObserver& aObserver, TInt aActiveIap );
       
    59 
       
    60         /**
       
    61         * Create a CUpnpHttpClientEngine object and leave it on cleanup stack.
       
    62         * @param  iObserver:
       
    63         * @return A pointer to the created instance of CWebClientEngine
       
    64         */
       
    65         IMPORT_C static CUpnpHttpClientEngine* NewLC(
       
    66             MUpnpHttpClientObserver& aObserver, TInt aActiveIap );
       
    67 
       
    68         /**
       
    69         * Destroy the object
       
    70         */
       
    71         IMPORT_C ~CUpnpHttpClientEngine();
       
    72 
       
    73         IMPORT_C void SendL( CUpnpHttpTransaction& aTransaction );
       
    74         
       
    75         /*IMPORT_C*/ void Cancel( CUpnpHttpTransaction& aTransaction );
       
    76 private:
       
    77         TInt Find( CUpnpHttpTransaction& aTransaction );
       
    78 
       
    79 
       
    80 private://from MUpnpHttpMessageSenderOwner
       
    81 
       
    82         /*
       
    83          * Destroyes sender and removes it from senders list.
       
    84          */
       
    85         virtual void SenderFinishedLD( CUpnpHttpMessageSender* aSenderToRelease );
       
    86 
       
    87 private:
       
    88 
       
    89         /**
       
    90         * Perform the second phase construction of a CWebClientEngine object.
       
    91         */
       
    92         void ConstructL( TInt aActiveIap );
       
    93 
       
    94         /**
       
    95         * Perform the first phase of two phase construction.
       
    96         * @param iObserver:
       
    97         */
       
    98         CUpnpHttpClientEngine( MUpnpHttpClientObserver& iObserver );
       
    99 
       
   100     private: 
       
   101         RHTTPSession            	iSession;
       
   102         MUpnpHttpClientObserver&    iObserver;
       
   103 
       
   104         RSocketServ iSocketServ;
       
   105         CUpnpConnectionManagerProxy* iConnectionManagerProxy;
       
   106 
       
   107         RPointerArray<CUpnpHttpMessageSender> iSenders;
       
   108     };
       
   109 
       
   110 #endif // __UPNPHTTPCLIENTENGINE_H__
       
   111 
       
   112 //  End of File
       
   113