epoc32/include/mw/sipdialog.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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        : sipdialog.h
    16 * Part of     : SIP Client
    17 * Interface   : SDK API, SIP Client API
    18 * Version     : 1.0
    19 *
    20 */
    21 
    22 
    23 
    24 
    25 #ifndef CSIPDIALOG_H
    26 #define CSIPDIALOG_H
    27 
    28 // INCLUDES
    29 #include <e32base.h>
    30 #include <stringpool.h>
    31 
    32 // FORWARD DECLARATIONS
    33 class CSIPConnection;
    34 class CSIPConnectionImplementation;
    35 class MSIPRegistrationContext;
    36 class CSIPDialogAssocBase;
    37 class CSIPFromHeader;
    38 class CSIPToHeader;
    39 class CSIPCallIDHeader;
    40 class CUri8;
    41 class CSIPDialogImplementation;
    42 
    43 // CLASS DECLARATION
    44 
    45 /**
    46 *  @publishedAll
    47 *  @released
    48 *
    49 *  Class for managing SIP dialogs.
    50 *  It provides services querying dialog state, obtaining the dialog related
    51 *  SIP headers and getting all dialog associations.
    52 *
    53 *  The user of the class cannot instantiate this class.
    54 *  @lib sipclient
    55 */
    56 
    57 class CSIPDialog: public CBase
    58 	{
    59 	public:
    60 		/** Dialog states */
    61 		enum TState
    62 			{
    63 			/** Initiliazed state */
    64 			EInit,
    65 			/** Early state */
    66 			EEarly,
    67 			/** Confirmed state */
    68 			EConfirmed,
    69 			/** Terminated state */
    70 			ETerminated
    71 			};
    72 
    73 	public: //New functions
    74 		/**
    75 		* Gets dialog state		
    76 		* @return dialog state
    77 		*/
    78         IMPORT_C CSIPDialog::TState State() const;
    79 
    80 		/**
    81 		* Gets all dialog associations. 		
    82 		* @return All dialog associations. Ownership of the array or the items
    83         *   inside it, is not transferred.
    84 		*/
    85 		IMPORT_C const RPointerArray<CSIPDialogAssocBase>&
    86 					   SIPDialogAssociations() const;
    87 
    88         /**
    89         * Gets used registration context for this dialog
    90         * @return associated registration or 0-pointer otherwise.
    91         *   Ownership is not transferred.
    92         */
    93         IMPORT_C const MSIPRegistrationContext* RegistrationContext() const;
    94 	
    95         /**
    96 		* Checks if the dialog association belongs to this dialog
    97 		* @param aDialogAssoc a dialog association
    98 		* @return ETrue if belongs, EFalse otherwise
    99 		*/
   100 		IMPORT_C TBool
   101             IsAssociated(const CSIPDialogAssocBase& aDialogAssoc) const;
   102 
   103         /**
   104 		* Gets the SIP connection used for this dialog
   105 		* @return SIP connection used for the dialog, or 0-pointer if the
   106         *   connection has been deleted. Ownership isn't transferred.
   107 		*/
   108         IMPORT_C CSIPConnection* Connection();
   109 
   110         /**
   111 		* Gets the SIP connection used for this dialog.
   112 		* @return SIP connection used for the dialog, or 0-pointer if the
   113         *   connection has been deleted. Ownership isn't transferred.
   114 		*/
   115         IMPORT_C const CSIPConnection* Connection() const;
   116 
   117         /**
   118 		* Gets originator's address
   119 		* @return originator's address (From-header)
   120 		*/
   121 		IMPORT_C const CSIPFromHeader& FromHeader() const;
   122 
   123 		/**
   124 		* Gets recipient's address
   125 		* @return recipient's address (To-header)
   126 		*/
   127 		IMPORT_C const CSIPToHeader& ToHeader() const;
   128 
   129 		/**
   130 		* Gets remote-uri used during dialog creation
   131 		* @return Remote target uri
   132 		*/
   133 		IMPORT_C const CUri8& RemoteURI() const;
   134 
   135 		/**
   136 		* Gets Call-ID of SIP dialog
   137 		* @pre State()==CSIPDialog::EEarly || State()==CSIPDialog::EConfirmed
   138 		* @return Call-ID of SIP dialog
   139 		* @leave KErrSIPInvalidDialogState if dialog doesn't yet have a Call-ID
   140 		*/
   141 		IMPORT_C const CSIPCallIDHeader& CallIdL() const;
   142 
   143         /**
   144 		* Compares this object to another object
   145 		* @param aDialog CSIPDialog object to compare
   146 		* @returns ETrue if the objects are equal, otherwise EFalse
   147 		*/
   148         IMPORT_C TBool operator==(const CSIPDialog& aDialog) const;
   149         
   150         /**
   151         * Sets the dialog to state to CSIPDialog::EInit.
   152         * The local dialog identifier data 
   153         * (Call-ID, CSeq and From-header's tag) will be reused. 
   154         * After calling this function, the dialog that was already terminated 
   155         * can be used for sending the dialog initiating request such as 
   156         * INVITE or SUBSCRIBE reusing the stored Call-ID and From-header's tag
   157         * and the stored CSeq incremented by one.
   158         * @pre State()==CSIPDialog::ETerminated
   159         * @returns KErrNone if succesful and KErrNoMemory if the memory is low.
   160         */
   161         IMPORT_C TInt ReuseInitialRequestData();
   162 
   163 	public: //Constructors and destructor, for internal use
   164 		/**
   165 		* Two-phased constructor. 
   166 		* This constructor should be used if the user has received
   167 		* SIP request that creates a SIP dialog association.
   168         *
   169         * @param aConnImplementation Implementation of the used SIP connection
   170         * @return New object, ownership is transferred.
   171         */
   172 		static CSIPDialog*
   173 			NewL(CSIPConnectionImplementation& aConnImplementation);
   174 
   175 		/**
   176 		* Two-phased constructor
   177 		* This constructor should be used if the user has received
   178 		* SIP request that creates a SIP dialog association.
   179         *
   180 		* @param aConnImplementation Implementation of the used SIP connection
   181         * @return New object, ownership is transferred.
   182        	*/
   183 		static CSIPDialog*
   184 			NewLC(CSIPConnectionImplementation& aConnImplementation);
   185 
   186 		/**
   187 		* Two-phased constructor
   188 		* This constructor should be used if the user has received
   189 		* SIP request that creates a SIP dialog association.
   190         *
   191         * @param aConnImplementation Implementation of the used SIP connection
   192 		* @param aContext Registration context whose outbound proxy and other
   193 		*        parameters are to be used.
   194         * @return New object, ownership is transferred.
   195        	*/
   196 		static CSIPDialog*
   197 			NewL(CSIPConnectionImplementation& aConnImplementation,
   198                  const MSIPRegistrationContext& aContext);
   199 
   200 		/**
   201 		* Two-phased constructor
   202 		* This constructor should be used if the user has received
   203 		* SIP request that creates a SIP dialog association.
   204         *
   205         * @param aConnImplementation Implementation of the used SIP connection
   206 		* @param aContext Registration context whose outbound proxy and other
   207 		*        parameters are to be used.
   208         * @return New object, ownership is transferred.
   209         */
   210 		static CSIPDialog*
   211 			NewLC(CSIPConnectionImplementation& aConnImplementation,
   212                   const MSIPRegistrationContext& aContext);
   213 
   214 		/**
   215 		* Destructor
   216 		*/
   217 		~CSIPDialog();
   218 
   219 	public: // New functions, for internal use
   220 
   221 		/**
   222 		* Returns the CSIPDialogImplementation.
   223  		* @return CSIPDialogImplementation
   224  		*/
   225 		CSIPDialogImplementation& Implementation();
   226 
   227     private: // Constructors
   228 
   229         CSIPDialog();        
   230 
   231         void ConstructL(CSIPConnectionImplementation& aConnImplementation);
   232         
   233         void ConstructL(CSIPConnectionImplementation& aConnImplementation,
   234                    		const MSIPRegistrationContext& aContext);
   235 
   236 private: // Data
   237 
   238 		//Implementation instance, CSIPDialog doesn't own it
   239 		CSIPDialogImplementation* iImplementation;
   240 
   241 private: // For testing purposes
   242 #ifdef CPPUNIT_TEST
   243 	    friend class CSIP_Test;
   244         friend class CSIPInviteDialogAssoc_Test;
   245         friend class CSIPSubscribeDialogAssoc_Test;
   246         friend class CSIPReferDialogAssoc_Test;
   247 #endif
   248 	void __DbgTestInvariant() const;
   249 
   250 	};
   251 
   252 #endif