epoc32/include/mw/sipinvitedialogassoc.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/sipinvitedialogassoc.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,423 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +* Name        : sipinvitedialogassoc.h
    1.19 +* Part of     : SIP Client
    1.20 +* Interface   : SDK API, SIP Client API
    1.21 +* Version     : 1.0
    1.22 +*
    1.23 +*/
    1.24 +
    1.25 +
    1.26 +
    1.27 +
    1.28 +#ifndef CSIPINVITEDIALOGASSOC_H
    1.29 +#define CSIPINVITEDIALOGASSOC_H
    1.30 +
    1.31 +// INCLUDES
    1.32 +#include "sipdialogassocbase.h"
    1.33 +
    1.34 +// CONSTANTS
    1.35 +
    1.36 +// FORWARD DECLARATIONS
    1.37 +class CUri8;
    1.38 +class CSIPConnection;
    1.39 +class CSIPServerTransaction;
    1.40 +class CSIPFromHeader;
    1.41 +class CSIPToHeader;
    1.42 +class CSIPContactHeader;
    1.43 +class MSIPRegistrationContext;
    1.44 +
    1.45 +// CLASS DECLARATION
    1.46 +
    1.47 +/**
    1.48 +*  @publishedAll
    1.49 +*  @released
    1.50 +*
    1.51 +*  Class for managing SIP dialog association created with INVITE.
    1.52 +*  It provides services for creating, using and
    1.53 +*  terminating SIP INVITE dialog association.
    1.54 +*
    1.55 +*  The user can have only one INVITE dialog association per dialog.
    1.56 +* 
    1.57 +*  @lib sipclient.lib
    1.58 +*/
    1.59 +class CSIPInviteDialogAssoc : public CSIPDialogAssocBase
    1.60 +	{
    1.61 +	public: // Constructors and destructor
    1.62 +
    1.63 +		/**
    1.64 +		* Two-phased constructor.
    1.65 +		* @param aDialog a dialog to be associated with
    1.66 +        * @return New object, ownership is transferred.
    1.67 +		*/
    1.68 +		IMPORT_C static CSIPInviteDialogAssoc* NewL(CSIPDialog& aDialog);
    1.69 +
    1.70 +        /**
    1.71 +		* Two-phased constructor.
    1.72 +		* @param aDialog a dialog to be associated with
    1.73 +        * @return New object, ownership is transferred.
    1.74 +		*/
    1.75 +		IMPORT_C static CSIPInviteDialogAssoc* NewLC(CSIPDialog& aDialog);
    1.76 +
    1.77 +        /**
    1.78 +        * Two-phased constructor.
    1.79 +        * Should be used if response to the received SIP request will create
    1.80 +        * a SIP dialog association.
    1.81 +        * The server transaction must be a INVITE transaction.
    1.82 +        * If SIP server transaction was received within an existing SIP dialog
    1.83 +        * the created SIP dialog association will be correlated to that SIP
    1.84 +        * dialog. Otherwise a new SIP dialog is created.
    1.85 +        * @pre aTransaction.State() == CSIPTransactionBase::EProceeding
    1.86 +        * @pre aTransaction.Type() == SipStrConsts::EInvite
    1.87 +        * @param aTransaction a SIP server transaction 
    1.88 +        * @return New object, ownership is transferred.
    1.89 +        * @leave KErrArgument if aTransaction.Type() != SipStrConsts::EInvite
    1.90 +        * @leave KErrSIPInvalidTransactionState if aTransaction.State() !=
    1.91 +        *	CSIPTransactionBase::EProceeding
    1.92 +        * @leave KErrSIPResourceNotAvailable if a required SIP Client API
    1.93 +		*	object has been deleted
    1.94 +        */
    1.95 +        IMPORT_C static CSIPInviteDialogAssoc*
    1.96 +            NewL(CSIPServerTransaction& aTransaction);
    1.97 +
    1.98 +        /**
    1.99 +        * Two-phased constructor.
   1.100 +        * Should be used if response to the received SIP request will create a
   1.101 +        * SIP dialog association.
   1.102 +        * The server transaction must be a INVITE transaction.
   1.103 +        * If SIP server transaction was received within the existing SIP dialog
   1.104 +        * the created SIP dialog association will be correlated to that
   1.105 +        * SIP dialog.  Otherwise a new SIP dialog is created.
   1.106 +		* @pre aTransaction.State() == CSIPTransactionBase::EProceeding
   1.107 +		* @pre aTransaction.Type() == SipStrConsts::EInvite
   1.108 +        * @param aTransaction a SIP server transaction
   1.109 +        * @return New object, ownership is transferred.
   1.110 +        * @leave KErrArgument if aTransaction.Type() != SipStrConsts::EInvite
   1.111 +        * @leave KErrSIPInvalidTransactionState if aTransaction.State() !=
   1.112 +        *	CSIPTransactionBase::EProceeding
   1.113 +        * @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.114 +		*	object has been deleted
   1.115 +        */
   1.116 +        IMPORT_C static CSIPInviteDialogAssoc*
   1.117 +            NewLC(CSIPServerTransaction& aTransaction);
   1.118 +
   1.119 +        /**
   1.120 +        * Two-phased constructor.
   1.121 +        * Should be used if response to the received SIP request will create
   1.122 +        * a SIP dialog association.
   1.123 +        * The server transaction must be a INVITE transaction.
   1.124 +        * If SIP server transaction was received within an existing SIP dialog
   1.125 +        * the created SIP dialog association will be correlated to that SIP
   1.126 +        * dialog. Otherwise a new SIP dialog is created.
   1.127 +        * @pre aTransaction.State() == CSIPTransactionBase::EProceeding
   1.128 +        * @pre aTransaction.Type() == SipStrConsts::EInvite
   1.129 +		* @pre aContext.IsContextActive() == ETrue        
   1.130 +        * @param aTransaction a SIP server transaction 
   1.131 +        * @param aContext that will be used for populating 
   1.132 +        *        the Contact-header of the response to aTransaction
   1.133 +        * @return New object, ownership is transferred.
   1.134 +        * @leave KErrArgument if aTransaction.Type() != SipStrConsts::EInvite
   1.135 +        * @leave KErrSIPInvalidTransactionState if aTransaction.State() !=
   1.136 +        *	CSIPTransactionBase::EProceeding
   1.137 +        * @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.138 +		*	object has been deleted
   1.139 +        */
   1.140 +        IMPORT_C static CSIPInviteDialogAssoc*
   1.141 +            NewL(CSIPServerTransaction& aTransaction,
   1.142 +                 const MSIPRegistrationContext& aContext);
   1.143 +
   1.144 +        /**
   1.145 +        * Two-phased constructor.
   1.146 +        * Should be used if response to the received SIP request will create a
   1.147 +        * SIP dialog association.
   1.148 +        * The server transaction must be a INVITE transaction.
   1.149 +        * If SIP server transaction was received within the existing SIP dialog
   1.150 +        * the created SIP dialog association will be correlated to that
   1.151 +        * SIP dialog.  Otherwise a new SIP dialog is created.
   1.152 +		* @pre aTransaction.State() == CSIPTransactionBase::EProceeding
   1.153 +		* @pre aTransaction.Type() == SipStrConsts::EInvite
   1.154 +		* @pre aContext.IsContextActive() == ETrue 
   1.155 +        * @param aTransaction a SIP server transaction
   1.156 +        * @param aContext that will be used for populating 
   1.157 +        *        the Contact-header of the response to aTransaction        
   1.158 +        * @return New object, ownership is transferred.
   1.159 +        * @leave KErrArgument if aTransaction.Type() != SipStrConsts::EInvite
   1.160 +        * @leave KErrSIPInvalidTransactionState if aTransaction.State() !=
   1.161 +        *	CSIPTransactionBase::EProceeding
   1.162 +        * @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.163 +		*	object has been deleted
   1.164 +        */
   1.165 +        IMPORT_C static CSIPInviteDialogAssoc*
   1.166 +            NewLC(CSIPServerTransaction& aTransaction,
   1.167 +                  const MSIPRegistrationContext& aContext);
   1.168 +
   1.169 +        /**
   1.170 +        * Two-phased constructor
   1.171 +        * @pre aFrom != 0
   1.172 +        * @pre aRemoteUri != 0
   1.173 +		* The user of the class must not define tags in From-header
   1.174 +		* and To-header.        
   1.175 +        * @param aConnection a SIP connection to be used with
   1.176 +        *        dialog association
   1.177 +        * @param aFrom originator's address; the ownership is transfered
   1.178 +        * @param aRemoteUri a remote target URI that identifies a resource that
   1.179 +        *		 the request is addressed to. The ownership is transferred.
   1.180 +        * @param aTo logical recipient's address; if not defined
   1.181 +        *        the remote target uri will be used for To-header
   1.182 +        *        construction; the ownership is transfered
   1.183 +        * @param aContact a contact to be used in dialog creation. Must be
   1.184 +        *        given only if user intends to re-direct future requests; 
   1.185 +        *        the ownership is transfered        
   1.186 +        * @return New object, ownership is transferred.
   1.187 +        * @leave KErrArgument if aFrom == 0 or aRemoteUri == 0
   1.188 +        */
   1.189 +        IMPORT_C static CSIPInviteDialogAssoc*
   1.190 +            NewL(CSIPConnection& aConnection,
   1.191 +                 CSIPFromHeader* aFrom,
   1.192 +                 CUri8* aRemoteUri,
   1.193 +                 CSIPToHeader* aTo=0,
   1.194 +                 CSIPContactHeader* aContact=0);
   1.195 +
   1.196 +        /**
   1.197 +        * Two-phased constructor
   1.198 +        * @pre aFrom != 0
   1.199 +        * @pre aRemoteUri != 0
   1.200 +		* The user of the class must not define tags in From-header
   1.201 +		* and To-header.
   1.202 +        * @param aSIPConnection a SIP connection to be used with
   1.203 +        *        dialog association
   1.204 +        * @param aFrom originator's address; the ownership is transfered
   1.205 +        * @param aRemoteUri a remote target URI that identifies a resource that
   1.206 +        *		 the request is addressed to. The ownership is transferred.
   1.207 +        * @param aTo logical recipient's address; if not defined
   1.208 +        *        the remote target uri will be used for To-header
   1.209 +        *        construction; the ownership is transfered
   1.210 +        * @param aContact a contact to be used in dialog creation. Must be
   1.211 +        *        given only if user intends to re-direct future requests; 
   1.212 +        *        the ownership is transfered
   1.213 +        * @return New object, ownership is transferred.
   1.214 +        * @leave KErrArgument if aFrom == 0 or aRemoteUri == 0
   1.215 +        */
   1.216 +        IMPORT_C static CSIPInviteDialogAssoc*
   1.217 +            NewLC(CSIPConnection& aConnection,
   1.218 +                  CSIPFromHeader* aFrom,
   1.219 +                  CUri8* aRemoteUri,
   1.220 +                  CSIPToHeader* aTo=0,
   1.221 +                  CSIPContactHeader* aContact=0);
   1.222 +
   1.223 +        /**
   1.224 +        * Two-phased constructor
   1.225 +		* @pre aRemoteUri != 0
   1.226 +		* The user of the class must not define tags in From-header
   1.227 +		* and To-header.
   1.228 +        * @pre aContext.IsContextActive() == ETrue
   1.229 +        * @param aConnection a SIP connection to be used with
   1.230 +        *        dialog association        
   1.231 +        * @param aRemoteUri a remote target URI that identifies a resource
   1.232 +        *		 that the request is targeted to. The ownership is transferred.
   1.233 +        * @param aContext used for selecting outbound 
   1.234 +        *        proxy and originator's address (AOR) and contact
   1.235 +        * @param aFrom originator's address. If not defined it will
   1.236 +        *        constructed using registration context (User's AOR);
   1.237 +        *        the ownership is transfered
   1.238 +        * @param aTo logical recipient's address; if not defined
   1.239 +        *        the remote target uri will be used for To-header
   1.240 +        *        construction; the ownership is transfered
   1.241 +        * @param aContact a contact to be used in dialog creation. Must be
   1.242 +        *        given only if user intends to re-direct future requests; 
   1.243 +        *        the ownership is transfered
   1.244 +        * @return New object, ownership is transferred.
   1.245 +        * @leave KErrArgument if aRemoteUri == 0
   1.246 +        * @leave KErrSIPInvalidRegistrationState
   1.247 +        *		 if aContext.IsContextActive() == EFalse
   1.248 +        */
   1.249 +        IMPORT_C static CSIPInviteDialogAssoc*
   1.250 +            NewL(CSIPConnection& aConnection,                                    
   1.251 +                 CUri8* aRemoteUri,
   1.252 +                 const MSIPRegistrationContext& aContext,
   1.253 +                 CSIPFromHeader* aFrom=0,
   1.254 +	             CSIPToHeader* aTo=0,
   1.255 +	             CSIPContactHeader* aContact=0);
   1.256 +
   1.257 +        /**
   1.258 +		* Two-phased constructor		
   1.259 +		* @pre aRemoteUri != 0
   1.260 +		* The user of the class must not define tags in From-header
   1.261 +		* and To-header.
   1.262 +		* @pre aContext.IsContextActive() == ETrue
   1.263 +		* @param aConnection a SIP connection to be used with
   1.264 +		*        dialog association		
   1.265 +		* @param aRemoteUri a remote target URI that identifies a resource
   1.266 +		*		 that the request is targeted to. The ownership is transferred.
   1.267 +        * @param aContext used for selecting outbound 
   1.268 +        *        proxy and originator's address (AOR) and contact
   1.269 +        * @param aFrom originator's address. If not defined it will
   1.270 +        *        constructed using registration context (User's AOR);
   1.271 +        *        the ownership is transfered
   1.272 +        * @param aTo logical recipient's address; if not defined
   1.273 +        *        the remote target uri will be used for To-header
   1.274 +        *        construction; the ownership is transfered
   1.275 +        * @param aContact a contact to be used in dialog creation. Must be
   1.276 +        *        given only if user intends to re-direct future requests; 
   1.277 +        *        the ownership is transfered
   1.278 +        * @return New object, ownership is transferred.
   1.279 +        * @leave KErrArgument if aRemoteUri == 0
   1.280 +        * @leave KErrSIPInvalidRegistrationState
   1.281 +        *		 if aContext.IsContextActive() == EFalse
   1.282 +		*/
   1.283 +        IMPORT_C static CSIPInviteDialogAssoc*
   1.284 +            NewLC(CSIPConnection& aConnection,			                        
   1.285 +			      CUri8* aRemoteUri,
   1.286 +                  const MSIPRegistrationContext& aContext,
   1.287 +                  CSIPFromHeader* aFrom=0,
   1.288 +	              CSIPToHeader* aTo=0,
   1.289 +	              CSIPContactHeader* aContact=0);
   1.290 +
   1.291 +		/**
   1.292 +		* Destructor
   1.293 +		*/
   1.294 +		IMPORT_C ~CSIPInviteDialogAssoc();
   1.295 +			                                  
   1.296 +	public: // New functions
   1.297 +
   1.298 +		/**
   1.299 +		* Creates INVITE and sends it to the remote target.
   1.300 +		* 101-199 or 2xx response will create INVITE dialog association in case
   1.301 +		* of first INVITE within this dialog association. Subsequent INVITE
   1.302 +		* requests are re-INVITEs.
   1.303 +		* @pre Dialog().Connection().State()==EActive
   1.304 +		* @pre Dialog().State()==CSIPDialog::EInit ||
   1.305 +		*      Dialog().State()==CSIPDialog::EConfirmed
   1.306 +		* @param aElements contains user SIP headers and content. Ownership is
   1.307 +        *   transferred.
   1.308 +		* @return INVITE SIP transaction. Ownership is transferred.
   1.309 +		* @leave KErrSIPInvalidDialogState if dialog is not in a correct state
   1.310 +		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.311 +		*	object has been deleted
   1.312 +		* @capability NetworkServices
   1.313 +		*/
   1.314 +		IMPORT_C CSIPClientTransaction*
   1.315 +            SendInviteL(CSIPMessageElements* aElements=0);
   1.316 +
   1.317 +        /**
   1.318 +		* Creates PRACK and sends it to the remote target.		
   1.319 +		* @pre Dialog().Connection().State()==EActive
   1.320 +		* @pre Dialog().State()==CSIPDialog::EEarly || 
   1.321 +		*      Dialog().State()==CSIPDialog::EConfirmed
   1.322 +        * @pre aElements must not contain Contact headers
   1.323 +		* @param aElements contains user SIP headers and content. Ownership is
   1.324 +        *   transferred.
   1.325 +		* @return PRACK SIP transaction. Ownership is transferred.
   1.326 +		* @leave KErrSIPInvalidDialogState if dialog is not in a correct state
   1.327 +		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.328 +		*	object has been deleted
   1.329 +		* @capability NetworkServices
   1.330 +		*/
   1.331 +		IMPORT_C CSIPClientTransaction*
   1.332 +            SendPrackL(CSIPMessageElements* aElements=0);
   1.333 +
   1.334 +	    /**
   1.335 +		* Creates UPDATE and sends it to the remote target.
   1.336 +		* @pre Dialog().Connection().State()==EActive
   1.337 +		* @pre Dialog().State()==CSIPDialog::EEarly || 
   1.338 +		*      Dialog().State()==CSIPDialog::EConfirmed
   1.339 +		* @param aElements contains user SIP headers and content. Ownership is
   1.340 +        *   transferred.
   1.341 +		* @return UPDATE SIP transaction. Ownership is transferred.
   1.342 +		* @leave KErrSIPInvalidDialogState if dialog is not in a correct state
   1.343 +		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.344 +		*	object has been deleted
   1.345 +		* @capability NetworkServices
   1.346 +		*/
   1.347 +		IMPORT_C CSIPClientTransaction*
   1.348 +            SendUpdateL(CSIPMessageElements* aElements=0);
   1.349 +
   1.350 +		/**
   1.351 +		* Creates SIP ACK request and sends it to the remote target.
   1.352 +		* The client transaction must be an INVITE transaction.
   1.353 +		* @pre Dialog().Connection().State()==EActive
   1.354 +		* @pre Dialog().State()==CSIPDialog::EConfirmed
   1.355 +		* @param aTransaction a SIP INVITE client transaction to acknowledge
   1.356 +		* @param aElements optional SIP message headers and body. Ownership is
   1.357 +        *   transferred.
   1.358 +        * @leave KErrArgument if aTransaction is not an INVITE transaction.
   1.359 +        * @leave KErrSIPInvalidDialogState if ACK can't be sent in the current
   1.360 +		*	dialog state
   1.361 +        * @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.362 +		*	object has been deleted
   1.363 +		* @capability NetworkServices
   1.364 +		*/
   1.365 +		IMPORT_C void SendAckL(const CSIPClientTransaction& aTransaction,
   1.366 +			                   CSIPMessageElements* aElements=0);
   1.367 +
   1.368 +	    /**
   1.369 +		* Creates SIP BYE request and sends it to the remote target.		
   1.370 +		* @pre Dialog().Connection().State()==EActive
   1.371 +		* @pre Dialog().State()==CSIPDialog::EEarly || 
   1.372 +		*      Dialog().State()==CSIPDialog::EConfirmed
   1.373 +		* @param aElements contains user SIP headers and content. Ownership is
   1.374 +        *   transferred.
   1.375 +		* @return SIP BYE transaction. Ownership is transferred.
   1.376 +		* @leave KErrSIPInvalidDialogState if BYE can't be sent in the current
   1.377 +		*	dialog state
   1.378 +		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.379 +		*	object has been deleted
   1.380 +		* @capability NetworkServices
   1.381 +		*/		
   1.382 +		IMPORT_C CSIPClientTransaction*
   1.383 +            SendByeL(CSIPMessageElements* aElements=0);
   1.384 +
   1.385 +	public: // New functions, for internal use
   1.386 +	
   1.387 +        /**
   1.388 +		* Sends initial INVITE creating a dialog and creates a transaction for
   1.389 +        * it.
   1.390 +		* @param aElements contains user SIP headers and content. Ownership is
   1.391 +        *   transferred.
   1.392 +		* @return INVITE SIP transaction. Ownership is transferred.
   1.393 +		*/
   1.394 +        CSIPClientTransaction* DoSendInviteL(CSIPMessageElements* aElements);
   1.395 +
   1.396 +        /**
   1.397 +		* Sends ACK		
   1.398 +		* @param aTransaction a SIP INVITE client transaction to acknowledge
   1.399 +		* @param aElements optional SIP message headers and body. Ownership is
   1.400 +        *   transferred.
   1.401 +		*/
   1.402 +        void DoSendAckL(const CSIPClientTransaction& aTransaction,
   1.403 +                        CSIPMessageElements* aElements);
   1.404 +
   1.405 +		CSIPClientTransaction*
   1.406 +			DoSendRequestWithinDialogL(RStringF aMethod,
   1.407 +									   CSIPMessageElements* aElements);
   1.408 +
   1.409 +        CSIPClientTransaction* DoSendCancelL(TUint32 aRequestId);
   1.410 +
   1.411 +   	private: // Constructors
   1.412 +   	   	
   1.413 +		static CSIPInviteDialogAssoc* NewLC(CSIPConnection& aConnection,
   1.414 +								 CUri8* aRemoteUri,
   1.415 +	                             CSIPFromHeader* aFrom,
   1.416 +	                             CSIPToHeader* aTo,
   1.417 +		                         CSIPContactHeader* aContact,
   1.418 +		                         const MSIPRegistrationContext* aContext);
   1.419 +
   1.420 +		CSIPInviteDialogAssoc();
   1.421 +		
   1.422 +		void ConstructL(CSIPServerTransaction& aTransaction,
   1.423 +                        const MSIPRegistrationContext* aContext);
   1.424 +	};
   1.425 +
   1.426 +#endif