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