mmsharing/livecommsui/lcui/tsrc/mustester/Stubs/sipclientstub/inc/sipservertransaction.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2003 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSIPSERVERTRANSACTION_H
       
    20 #define CSIPSERVERTRANSACTION_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "siptransactionbase.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CSIPRequestElements;
       
    27 class CSIPRefresh;
       
    28 class MSIPResponseSender;
       
    29 class CSIPConnection;
       
    30 
       
    31 /**
       
    32 *  Class for managing SIP server transactions.
       
    33 *  It provides services for creating, ending
       
    34 *  and getting SIP transaction parameters.
       
    35 *  Client cannot instantiate this class.
       
    36 *  
       
    37 *  @lib sipclient
       
    38 */
       
    39 class CSIPServerTransaction: public CSIPTransactionBase
       
    40 	{
       
    41 	public:
       
    42 
       
    43         /**
       
    44         * Destructor
       
    45 		*/
       
    46 
       
    47 		IMPORT_C ~CSIPServerTransaction();
       
    48 
       
    49     public: // Not in real SIP API
       
    50     
       
    51  		IMPORT_C static CSIPServerTransaction* NewL( RStringF aType );
       
    52 
       
    53         IMPORT_C void SetRequestElements(CSIPRequestElements* aElements);
       
    54 
       
    55 
       
    56 	public:
       
    57 		
       
    58         /**
       
    59 		* Sends response and ends the transaction;
       
    60 		* The user must not send 100 Trying response. Leaves on failure.
       
    61         * @pre aElements!=0
       
    62         * @pre State()==ETrying || State()==EProceeding
       
    63 		* @pre CSIPConnection::State()==EActive
       
    64 		* @pre ResponseAllowed()==ETrue		
       
    65 		* @param aElements contains Status Code, optional Reason Phrase and
       
    66         *   optional SIP message headers and body. Ownership is transferred.
       
    67 		* @leave KErrArgument if aElements == NULL
       
    68 		* @leave KErrGeneral if ResponseAllowed() == EFalse
       
    69 		*/
       
    70 
       
    71 		IMPORT_C void SendResponseL(CSIPResponseElements *aElements);
       
    72 
       
    73 
       
    74 	    /**
       
    75 		* Gets the request elements
       
    76 		* @return Request elements. Ownership is not transferred.
       
    77 		*/
       
    78 
       
    79 		IMPORT_C const CSIPRequestElements* RequestElements() const;
       
    80 
       
    81 
       
    82         /**
       
    83 		* Checks if the response sending is allowed for this server
       
    84         * transaction. For instance response is not allowed in ACK transaction.
       
    85 		* @return ETrue if response sending is allowed, EFalse otherwise
       
    86 		*/
       
    87 
       
    88 		IMPORT_C TBool ResponseAllowed() const;
       
    89 
       
    90         /**
       
    91 		* Sets a new respose sender, replacing the current sender.
       
    92 		*
       
    93         * @param aSender Response sender to be used from now on. Ownership is
       
    94         *   	 transferred.		
       
    95 		*/
       
    96 
       
    97         void SetResponseSender(MSIPResponseSender* aSender);
       
    98 
       
    99 
       
   100         /**
       
   101 	    * Obtains the associated CSIPConnection instance. If connection can't
       
   102         * be accessed anymore, this function leaves.
       
   103         *	
       
   104 	    * @return CSIPConnection
       
   105 	    */
       
   106 
       
   107         CSIPConnection& SIPConnectionL();
       
   108 
       
   109 
       
   110         /**
       
   111 		* Update the MTransactionAssociation to point to aAssociation.
       
   112 		*
       
   113         * @param aAssociation Associated object		
       
   114 		*/
       
   115 
       
   116         void ReAssociateL(MTransactionAssociation& aAssociation);
       
   117 
       
   118 
       
   119         /**
       
   120 		* Removes, but does not delete, request elements from
       
   121         * aServerTransaction.
       
   122         *
       
   123 		* @param aServerTransaction Server transaction from which response
       
   124         *   elements are removed. Ownership is not transferred.
       
   125 		*/
       
   126 
       
   127         static void DetachRequestElements(TAny* aServerTransaction);
       
   128 
       
   129 	public:
       
   130 
       
   131         /**
       
   132 		* Creates a server transaction.
       
   133 		*
       
   134         * @param aRequestId RequestId for the transaction to use
       
   135         * @param aAssociation Object with which the transaction is associated
       
   136         * @param aElements Request elements. Ownership is transferred.
       
   137         * @return New object. Ownership is transferred.
       
   138 		*/
       
   139 
       
   140 		static CSIPServerTransaction*
       
   141             NewL(TUint32 aRequestId,
       
   142                  MTransactionAssociation& aAssociation,
       
   143                  CSIPRequestElements* aElements);
       
   144 
       
   145 
       
   146         /**
       
   147 		* Creates a server transaction and pushes it to cleanup stack.
       
   148 		*
       
   149         * @param aRequestId RequestId for the transaction to use
       
   150         * @param aAssociation Object with which the transaction is associated
       
   151         * @param aElements Request elements. Ownership is transferred.
       
   152         * @return New object. Ownership is transferred.
       
   153 		*/
       
   154 
       
   155 		static CSIPServerTransaction*
       
   156             NewLC(TUint32 aRequestId,
       
   157                   MTransactionAssociation& aAssociation,
       
   158                   CSIPRequestElements* aElements);
       
   159 
       
   160 
       
   161         
       
   162 	private:
       
   163 		CSIPServerTransaction( RStringF aType );
       
   164 
       
   165 
       
   166         /**
       
   167 		* Second phase constructor.
       
   168 		*        
       
   169         * @param aElements Request elements. Ownership is transferred.        
       
   170 		*/
       
   171         void ConstructL(CSIPRequestElements* aElements);
       
   172 
       
   173 
       
   174         CSIPRequestElements* iRequestElements;
       
   175 
       
   176         //This interface is used for sending the response.
       
   177         //CSIPServerTransaction owns iResponseSender.
       
   178         MSIPResponseSender* iResponseSender;
       
   179     
       
   180     };
       
   181 
       
   182 #endif