realtimenetprots/sipfw/SIP/sipapi/api/sipclienttransaction.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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 * Name        : sipclienttransaction.h
       
    16 * Part of     : SIP Client
       
    17 * Interface   :
       
    18 * Version     : 1.0
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef CSIPCLIENTTRANSACTION_H
       
    26 #define CSIPCLIENTTRANSACTION_H
       
    27 
       
    28 // INCLUDES
       
    29 #include "siptransactionbase.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CSIPRefresh;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  @publishedAll
       
    38 *  @released
       
    39 *
       
    40 *  Class for managing SIP client transactions.
       
    41 *  It provides services for ending and getting the SIP client transaction
       
    42 *  parameters. Some client transactions can also be canceled.
       
    43 *
       
    44 *  The user of the class cannot instante this class.
       
    45 *  @lib sipclient
       
    46 */
       
    47 class CSIPClientTransaction: public CSIPTransactionBase
       
    48 	{
       
    49 	public: // Destructor
       
    50 
       
    51         /**
       
    52         * Destructor
       
    53 		*/
       
    54 		IMPORT_C ~CSIPClientTransaction();
       
    55 
       
    56 	public: // New functions
       
    57 
       
    58         /**
       
    59         * Gets response elements of the most recent response.
       
    60         * @return Response elements. Ownership isn't transferred.
       
    61         */
       
    62 		IMPORT_C const CSIPResponseElements* ResponseElements() const;
       
    63 
       
    64         /**
       
    65 		* Cancels client transaction i.e. creates a CANCEL request and sends it
       
    66 		* to the remote UA.		
       
    67 		* @pre State()==EProceeding
       
    68 		* @pre CancelAllowed()==ETrue
       
    69 		* @pre Connection().State()==EActive
       
    70 		* @return SIP CANCEL transaction, ownership is transferred.		
       
    71 		* @leave KErrSIPInvalidTransactionState if canceling is not possible
       
    72 		*	at all, or because the transaction is not in a proper state or the
       
    73         *   transaction is not related to a dialog.
       
    74 		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
       
    75 		*	object has been deleted
       
    76 		* @capability NetworkServices
       
    77 		*/
       
    78 		IMPORT_C CSIPClientTransaction* CancelL();
       
    79 
       
    80 		/**
       
    81 		* Gets the associated refresh with the transaction.
       
    82 		* If the refresh is associated with the transaction,
       
    83 		* transaction will be refreshed at defined interval.
       
    84 		* @return associated refresh or 0-pointer if there's no
       
    85 		*         associated refresh. Ownership isn't transferred.
       
    86 		*/
       
    87 		IMPORT_C const CSIPRefresh* Refresh() const;
       
    88 
       
    89         /**
       
    90 		* Checks if the client transaction is such that it can be cancelled.
       
    91         * This does no check whether the transaction is currently in such a
       
    92         * state that the canceling can be done now.
       
    93         *
       
    94 		* @return ETrue if client transaction can be cancelled;
       
    95 		*         EFalse otherwise
       
    96 		*/
       
    97 		IMPORT_C virtual TBool CancelAllowed() const;
       
    98 
       
    99 	public: // Constructors, for internal use
       
   100 
       
   101         /**
       
   102 		* Instantiates a CSIPClientTransaction object, leaves on failure.
       
   103         *
       
   104         * @param aType Identifies the transaction type        
       
   105         * @param aAssociation Object to which the transaction is associated
       
   106         *   with.
       
   107         * @param aRefresh If transaction is refreshed, this points to a
       
   108         *   CSIPRefresh, otherwise this is NULL. Ownership is not transferred.
       
   109 		* @return SIP client transaction, ownership is transferred.
       
   110 		*/
       
   111 		static CSIPClientTransaction*
       
   112             NewL(RStringF aType,
       
   113                  MTransactionAssociation& aAssociation,
       
   114                  CSIPRefresh* aRefresh=0);
       
   115 
       
   116         /**
       
   117 		* Instantiates a CSIPClientTransaction object and pushes it into
       
   118         * CleanupStack, leaves on failure.
       
   119         *
       
   120         * @param aType Identifies the transaction type        
       
   121         * @param aAssociation Object to which the transaction is associated
       
   122         *   with.
       
   123         * @param aRefresh If transaction is refreshed, this points to a
       
   124         *   CSIPRefresh, otherwise this is NULL. Ownership is not transferred.
       
   125 		* @return SIP client transaction, ownership is transferred.
       
   126 		*/
       
   127 		static CSIPClientTransaction*
       
   128             NewLC(RStringF aType,
       
   129                   MTransactionAssociation& aAssociation,
       
   130                   CSIPRefresh* aRefresh=0);
       
   131 
       
   132 	public: // New functions, for internal use
       
   133 
       
   134         /**
       
   135 		* Sets the RequestId.
       
   136         *
       
   137         * @pre iRequestId == 0
       
   138         * @pre aRequestId != 0
       
   139 		* @param aRequestId RequestId obtained from SIP client
       
   140 		*/
       
   141 		void SetRequestId(TUint32 aRequestId);
       
   142 
       
   143         /**
       
   144 		* Gets the associated refresh with the transaction and allows
       
   145         * modification fo the refresh. This method is for internal use only.
       
   146         *
       
   147 		* @return associated refresh or 0-pointer if there's no
       
   148 		*         associated refresh. Ownership isn't transferred.
       
   149 		*/
       
   150         CSIPRefresh* Refresh();
       
   151 
       
   152         /**
       
   153 	    * Clears the association from ClientTransaction to CSIPRefresh
       
   154 	    */
       
   155         void RemoveRefresh();	
       
   156 
       
   157     protected: // Constructor
       
   158 
       
   159 		CSIPClientTransaction(MTransactionAssociation& aAssociation,
       
   160                               CSIPRefresh* aRefresh);
       
   161 
       
   162     private: // Data
       
   163 
       
   164         //Points to the refresh object if this transaction is refreshed.
       
   165         //NULL if not refreshed. Not owned.
       
   166         CSIPRefresh* iRefresh;
       
   167 
       
   168 	private: // For testing purposes
       
   169 #ifdef CPPUNIT_TEST
       
   170 	    friend class CSIP_Test;
       
   171 #endif
       
   172 	};
       
   173 
       
   174 #endif