epoc32/include/mw/sipreferdialogassoc.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        : sipreferdialogassoc.h
    16 * Part of     : SIP Client
    17 * Interface   : SDK API, SIP Client API
    18 * Version     : 1.0
    19 *
    20 */
    21 
    22 
    23 
    24 #ifndef CSIPREFERDIALOGASSOC_H
    25 #define CSIPREFERDIALOGASSOC_H
    26 
    27 // INCLUDES
    28 #include "sipdialogassocbase.h"
    29 
    30 // CONSTANTS
    31 
    32 // FORWARD DECLARATIONS
    33 class CUri8;
    34 class CSIPToHeader;
    35 class CSIPFromHeader;
    36 class CSIPContactHeader;
    37 class CSIPReferToHeader;
    38 class MSIPRegistrationContext;
    39 class CSIPConnection;
    40 
    41 // CLASS DECLARATION
    42 
    43 /**
    44 * @publishedAll
    45 * @released
    46 *
    47 * Class for managing SIP REFER dialog associations.
    48 * It provides services for creating, using and terminating SIP REFER
    49 * dialog associations. User can have multiple REFER dialog associations
    50 * per same SIP dialog.
    51 * Implementation handles SUBSCRIBE on the dialog level defined by Call-Id,
    52 * local and remote tags;
    53 * User is responsible for "Refer-to" header semantics.
    54 * @lib sipclient.lib
    55 */
    56 class CSIPReferDialogAssoc: public CSIPDialogAssocBase
    57 	{
    58 	public: // Constructors and destructor
    59 
    60 		/**
    61 		* Two-phased constructor.
    62 		* Should be used if response to the SIP request to be sent
    63 		* will create a SIP dialog association.
    64 		* @pre aReferTo != 0
    65 		* @param aDialog a dialog to be associated with
    66 		* @param aReferTo referred-to resource;
    67 		* Ownership is transferred
    68         * @return New object; the ownership is transferred
    69         * @leave KErrArgument if aReferTo == 0
    70 		*/
    71 		IMPORT_C static CSIPReferDialogAssoc*
    72 			NewL(CSIPDialog& aDialog,
    73 				 CSIPReferToHeader* aReferTo);
    74 
    75 		/**
    76 		* Two-phased constructor.
    77 		* Must be used if response to the SIP request to be sent
    78 		* will create a SIP dialog association.
    79 		* @pre aReferTo != 0
    80 		* @param aDialog a dialog to be associated with
    81 		* @param aReferTo referred-to resource;
    82 		* Ownership is transferred
    83         * @return New object; the ownership is transferred
    84         * @leave KErrArgument if aReferTo == 0
    85 		*/
    86 		IMPORT_C static CSIPReferDialogAssoc*
    87 			NewLC(CSIPDialog& aDialog,
    88 				  CSIPReferToHeader* aReferTo);
    89 
    90        /**
    91         * Two-phased constructor
    92         * @pre aFrom != 0 
    93         * @pre aReferTo != 0
    94 		* @pre aRemoteUri != 0
    95 		* The user of the class must not define tags in From-header
    96 		* and To-header.
    97         * @param aConnection a SIP connection to be used with
    98         *        dialog association
    99         * @param aFrom originator's address; the ownership is transfered
   100         * @param aRemoteUri a remote target URI that identifies a resource that
   101         *		 the request is addressed to.
   102 		* @param aReferTo referred-to resource;
   103 		* Ownership is transferred
   104         * @param aTo logical recipient's address; if not defined
   105         *        the remote target uri will be used for To-header
   106         *        construction; the ownership is transfered
   107         * @param aContact a contact to be used in dialog creation. Must be
   108         *        given only if user intends to re-direct future requests; 
   109         *        the ownership is transfered
   110         * @return New object; the ownership is transferred.
   111         * @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0
   112         */
   113         IMPORT_C static CSIPReferDialogAssoc*
   114             NewL(CSIPConnection& aConnection,
   115                  CSIPFromHeader* aFrom,
   116 				 CUri8* aRemoteUri,
   117 				 CSIPReferToHeader* aReferTo,
   118                  CSIPToHeader* aTo=0,                 
   119                  CSIPContactHeader* aContact=0);
   120 
   121        /**
   122         * Two-phased constructor
   123         * @pre aFrom != 0
   124         * @pre aReferTo != 0
   125 		* @pre aRemoteUri != 0
   126 		* The user of the class must not define tags in From-header
   127 		* and To-header.
   128         * @param aConnection a SIP connection to be used with
   129         *        dialog association
   130         * @param aFrom originator's address; the ownership is transfered
   131         * @param aRemoteUri a remote target URI that identifies a resource that
   132         *		 the request is addressed to.
   133 		* @param aReferTo referred-to resource;
   134 		* Ownership is transferred
   135         * @param aTo logical recipient's address; if not defined
   136         *        the remote target uri will be used for To-header
   137         *        construction; the ownership is transfered
   138         * @param aContact a contact to be used in dialog creation. Must be
   139         *        given only if user intends to re-direct future requests; 
   140         *        the ownership is transfered
   141         * @return New object; the ownership is transferred.
   142         * @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0
   143         */
   144         IMPORT_C static CSIPReferDialogAssoc*
   145             NewLC(CSIPConnection& aConnection,
   146                   CSIPFromHeader* aFrom,
   147 				  CUri8* aRemoteUri,
   148 				  CSIPReferToHeader* aReferTo,
   149                   CSIPToHeader* aTo=0,                 
   150                   CSIPContactHeader* aContact=0);
   151 
   152        /**
   153         * Two-phased constructor
   154         * @pre aReferTo != 0
   155 		* @pre aRemoteUri != 0
   156 		* The user of the class must not define tags in From-header
   157 		* and To-header.
   158         * @pre aContext.IsContextActive() == ETrue
   159         * @param aConnection a SIP connection to be used with
   160         *        dialog association 
   161         * @param aRemoteUri a remote target URI that identifies a resource that
   162         *		 the request is targeted to.
   163         * @param aContext used for selecting outbound 
   164         *        proxy and originator's address (AOR) and contact
   165         * @param aReferTo referred-to resource;
   166         * Ownership is transferred
   167         * @param aFrom originator's address. If not defined it will
   168         *        constructed using registration context (User's AOR);
   169         *        the ownership is transfered
   170         * @param aTo logical recipient's address; if not defined
   171         *        the remote target uri will be used for To-header
   172         *        construction; the ownership is transfered
   173         * @param aContact a contact to be used in dialog creation. Must be
   174         *        given only if user intends to re-direct future requests; 
   175         *        the ownership is transfered
   176         * @return New object: the ownership is transferred.
   177         * @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0
   178         * @leave KErrSIPInvalidRegistrationState
   179         *		 if aContext.IsContextActive() == EFalse
   180         */
   181         IMPORT_C static CSIPReferDialogAssoc*
   182             NewL(CSIPConnection& aConnection,                                    
   183                  CUri8* aRemoteUri,
   184                  const MSIPRegistrationContext& aContext,
   185                  CSIPReferToHeader* aReferTo,
   186                  CSIPFromHeader* aFrom=0,
   187 	             CSIPToHeader* aTo=0,
   188 	             CSIPContactHeader* aContact=0);
   189 
   190        /**
   191         * Two-phased constructor        
   192         * @pre aReferTo != 0
   193 		* @pre aRemoteUri != 0
   194 		* The user of the class must not define tags in From-header
   195 		* and To-header.
   196         * @pre aContext.IsContextActive()==ETrue
   197         * @param aConnection a SIP connection to be used with
   198         *        dialog association 
   199         * @param aRemoteUri a remote target URI that identifies a resource that
   200         *		 the request is targeted to.
   201         * @param aContext used for selecting outbound 
   202         *        proxy and originator's address (AOR) and contact
   203         * @param aReferTo referred-to resource;
   204         * Ownership is transferred
   205         * @param aFrom originator's address. If not defined it will
   206         *        constructed using registration context (User's AOR);
   207         *        the ownership is transfered
   208         * @param aTo logical recipient's address; if not defined
   209         *        the remote target uri will be used for To-header
   210         *        construction; the ownership is transfered
   211         * @param aContact a contact to be used in dialog creation. Must be
   212         *        given only if user intends to re-direct future requests; 
   213         *        the ownership is transfered
   214         * @return New object; the ownership is transferred.
   215         * @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0
   216         * @leave KErrSIPInvalidRegistrationState
   217         *		 if aContext.IsContextActive() == EFalse
   218         */
   219         IMPORT_C static CSIPReferDialogAssoc*
   220             NewLC(CSIPConnection& aConnection,                                    
   221                  CUri8* aRemoteUri,
   222                  const MSIPRegistrationContext& aContext,
   223                  CSIPReferToHeader* aReferTo,
   224                  CSIPFromHeader* aFrom=0,
   225 	             CSIPToHeader* aTo=0,
   226 	             CSIPContactHeader* aContact=0);
   227 
   228 		/**
   229 		* Destructor
   230 		*/
   231 		IMPORT_C ~CSIPReferDialogAssoc();
   232 
   233 	public: //New functions
   234 
   235 		/**
   236 		* Creates REFER and sends it to the remote target.
   237 		* leaves on failure.
   238 		* 101-199 or 2xx response will create REFER dialog 
   239 		* association in case of first REFER request within
   240 		* this dialog association.
   241 		* @pre Dialog().Connection().State()==EActive
   242 		* @pre Dialog().State()==CSIPDialog::EInit ||
   243 		*      Dialog().State()==CSIPDialog::EConfirmed
   244 		* @param aElements optional SIP message headers and body. Ownership is
   245         *   transferred.
   246 		* @return REFER SIP transaction. Ownership is transferred.
   247 		* @leave KErrSIPInvalidDialogState if dialog is in wrong state
   248 		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
   249 		*	object has been deleted.
   250 		* @capability NetworkServices
   251 		*/
   252 		IMPORT_C CSIPClientTransaction*
   253             SendReferL(CSIPMessageElements* aElements=0);
   254         
   255         /**
   256         * Gets referred-to resouce
   257         * @return referred-to resource
   258         */
   259         IMPORT_C const CSIPReferToHeader& ReferTo() const;
   260 
   261 	public: // New functions, for internal use
   262 	
   263 		/**
   264 		* Sends a REFER request.
   265 		*
   266 		* @pre Dialog().Connection().State()==EActive
   267 		* @param aElements optional SIP message headers and body.
   268 		*	Ownership is transferred.
   269 		* @param aWithinDialog ETrue if REFER is sent within dialog,
   270 		*	EFalse if REFER creates the dialog.
   271 		* @return REFER SIP transaction. Ownership is transferred.
   272 		*/
   273 		CSIPClientTransaction* DoSendReferL(CSIPMessageElements* aElements,
   274 								   			TBool aWithinDialog);
   275 
   276  	private: // Constructors
   277 
   278         CSIPReferDialogAssoc();
   279         
   280         static CSIPReferDialogAssoc* NewLC(CSIPConnection& aConnection,
   281 								CUri8* aRemoteUri,
   282 								CSIPReferToHeader* aReferTo,
   283 								CSIPFromHeader* aFrom,
   284                                 CSIPToHeader* aTo,
   285 			                    CSIPContactHeader* aContact,
   286 			                    const MSIPRegistrationContext* aContext);
   287 
   288     private: // Data
   289 
   290         CSIPReferToHeader* iReferTo;
   291 	};
   292 
   293 #endif