realtimenetprots/sipfw/SIP/sipapi/api/sipdialogassocbase.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        : sipdialogassocbase.h
       
    16 * Part of     : SIP Client
       
    17 * Interface   : SDK API, SIP Client API
       
    18 * Version     : 1.0
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 #ifndef CSIPDIALOGASSOCBASE_H
       
    25 #define CSIPDIALOGASSOCBASE_H
       
    26 
       
    27 // INCLUDES
       
    28 #include <stringpool.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CSIPMessageElements;
       
    32 class CSIPClientTransaction;
       
    33 class CSIPDialog;
       
    34 class CSIPRefresh;
       
    35 class CSIPServerTransaction;
       
    36 class CSIPDialogAssocImplementation;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  @publishedAll
       
    42 *  @released
       
    43 *
       
    44 *  Base class for SIP dialog associations. It provides services for getting
       
    45 *  associated SIP dialog, actual dialog association type and for sending non
       
    46 *  target refresh requests within the dialog association.
       
    47 *  @lib sipclient
       
    48 */
       
    49 class CSIPDialogAssocBase : public CBase
       
    50 	{
       
    51 	public: // Destructor
       
    52 
       
    53 		/**
       
    54 		* Destructor
       
    55         * @internalComponent		
       
    56 		*/
       
    57 		virtual ~CSIPDialogAssocBase();    
       
    58 
       
    59 	public: // New functions
       
    60 
       
    61 		/**
       
    62 		* Gets the dialog this dialog association belongs to
       
    63 		* @return associated dialog
       
    64 		*/
       
    65 		IMPORT_C const CSIPDialog& Dialog() const;
       
    66 
       
    67 		/**
       
    68 		* Gets dialog this dialog association belongs to
       
    69 		* @return associated dialog
       
    70 		*/
       
    71 		IMPORT_C CSIPDialog& Dialog();
       
    72 
       
    73 		/**
       
    74 		* Creates SIP request and sends it to the remote target.
       
    75 		* This function should be used for sending SIP extension
       
    76 		* requests within dialog assocation that do not cause 
       
    77 		* sip dialog associations to be created. In SIP terms
       
    78 		* this request is non target refresh request.
       
    79 		* @pre SIPDialog().State() != CSIPDialog::EInit &&
       
    80 		*      SIPDialog().State() != CSIPDialog::ETerminated
       
    81         * @pre Dialog().Connection().State() == EActive
       
    82 		* @pre aMethod != "REGISTER" |"INVITE" | "BYE" | "CANCEL" | "ACK" |
       
    83         *   "SUBSCRIBE" | "NOTIFY" | "UPDATE" | "PRACK" | "REFER"
       
    84 		* @param aElements contains optional SIP message headers and body.
       
    85         *   Ownership is transferred.
       
    86 		* @return SIP extension client transaction. Ownership is transferred.
       
    87 		* @leave KErrSIPInvalidDialogState If dialog's state is not correct
       
    88 		* @leave KErrArgument if invalid value has been set to aMethod		
       
    89 		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
       
    90 		*	object has been deleted
       
    91 		* @capability NetworkServices
       
    92 		*/
       
    93 		IMPORT_C virtual CSIPClientTransaction*
       
    94             SendNonTargetRefreshRequestL(RStringF aMethod,
       
    95                                          CSIPMessageElements* aElements);
       
    96 
       
    97         /**
       
    98         * Gets dialog association type.
       
    99         *
       
   100         * @return dialog association type e.g. "INVITE", "SUBSCRIBE" etc...
       
   101         */
       
   102         IMPORT_C RStringF Type() const;
       
   103 
       
   104 		/**
       
   105         * Tests if the request is a non target refresh request
       
   106         * @param aMethod a method to test
       
   107         * @return ETrue if is non target refresh request; EFalse otherwise
       
   108         */        
       
   109         IMPORT_C TBool IsNonTargetRefreshRequest(RStringF aMethod) const;
       
   110 
       
   111 	public: // New functions, for internal use
       
   112 
       
   113 		/**
       
   114 		* Returns the implementation instance.
       
   115  		* @return CSIPDialogAssocImplementation
       
   116 		*/
       
   117 		CSIPDialogAssocImplementation& Implementation();
       
   118 
       
   119 		/**
       
   120         * Searches for a refresh with the matching id. Default implementation
       
   121         * returns NULL. Those classes derived from CSIPDialogAssocBase, which
       
   122         * can contain refreshes must implement this function for searching the
       
   123         * correct refresh.
       
   124         *
       
   125         * @return CSIPRefresh if found, NULL otherwise. 
       
   126         *         The ownership is not transferred.
       
   127         * @internalComponent
       
   128         */
       
   129         virtual CSIPRefresh* FindRefresh(TUint32 aRefreshId);
       
   130 
       
   131         /**
       
   132         * @internalComponent
       
   133         */
       
   134 		virtual void DeletingRefresh(CSIPRefresh& aRefresh, TUint32 aRefreshId);
       
   135 		
       
   136 	protected: // Constructors, for internal use
       
   137 
       
   138         /*
       
   139 		* Constructor
       
   140 		*/
       
   141         CSIPDialogAssocBase();
       
   142 
       
   143         void ConstructL(RStringF aType, CSIPDialog& aDialog);
       
   144         void ConstructL(RStringF aType,
       
   145         				CSIPDialog& aDialog,
       
   146         				CSIPServerTransaction& aTransaction);
       
   147 
       
   148     protected: // Data
       
   149 
       
   150         /**
       
   151         * Implementation instance, CSIPDialogAssocBase owns it
       
   152         * @internalComponent
       
   153         */
       
   154 		CSIPDialogAssocImplementation* iImplementation;
       
   155 
       
   156 	private: // For testing purposes
       
   157 #ifdef CPPUNIT_TEST
       
   158         friend class CSIPInviteDialogAssoc_Test;
       
   159 #endif
       
   160 		void __DbgTestInvariant() const;
       
   161 
       
   162 	};
       
   163 
       
   164 #endif