upnp/upnpstack/serviceframework/inc/upnphttptransaction.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 CUpnpHttpTransaction class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __UPNPHTTPTRANSACTION_H__
       
    20 #define __UPNPHTTPTRANSACTION_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CUpnpHttpMessage;
       
    25 
       
    26 /**
       
    27  * Abstract base class for every upnp transaction.
       
    28  * Transaction encapsulates request and response message.
       
    29  * Client constructs instance of transaction with request, and sends it
       
    30  * by client engine. When response comes engine writes it to response message
       
    31  * and transaction can process it by implementing ProcessResponseL method.
       
    32  */
       
    33 class CUpnpHttpTransaction : public CBase
       
    34     {
       
    35     public:
       
    36         IMPORT_C ~CUpnpHttpTransaction();
       
    37 
       
    38         /*
       
    39          * Returns request message of transaction.
       
    40          *
       
    41          * @return request message of transaction
       
    42          */
       
    43         IMPORT_C CUpnpHttpMessage* Request();
       
    44 
       
    45         /*
       
    46          * Returns response message of transaction.
       
    47          *
       
    48          * @return response message of transaction
       
    49          */
       
    50         IMPORT_C CUpnpHttpMessage* Response();
       
    51 
       
    52         /*
       
    53          * Pure virtual method that let child classes to process
       
    54          * response in their own specific way.
       
    55          */
       
    56         virtual void ProcessResponseL() = 0;
       
    57 
       
    58         /*
       
    59          * Creates ok response for the request
       
    60          *
       
    61          * @param aResponseBody response body to set in response message
       
    62          */
       
    63         void CreateOkResponseL( const TDesC8& aResponseBody );
       
    64 
       
    65         /*
       
    66          * Creates response for the request
       
    67          *
       
    68          */      
       
    69         void CreateFaultResponseL( const TDesC8& aResponseBody, TInt aStatus, TInt aError );
       
    70 
       
    71     protected:
       
    72         IMPORT_C CUpnpHttpTransaction( CUpnpHttpMessage* aRequest );
       
    73         IMPORT_C void BaseConstructL();
       
    74 
       
    75     private://owned
       
    76         CUpnpHttpMessage* iHttpRequest;
       
    77         CUpnpHttpMessage* iHttpResponse;
       
    78     };
       
    79 
       
    80 #endif /*__UPNPHTTPTRANSACTION_H__*/
       
    81 
       
    82 //  End of File
       
    83