epoc32/include/mw/sipnotifydialogassoc.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/sipnotifydialogassoc.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,232 @@
     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        : sipnotifydialogassoc.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 CSIPNOTIFYDIALOGASSOC_H
    1.29 +#define CSIPNOTIFYDIALOGASSOC_H
    1.30 +
    1.31 +// INCLUDES
    1.32 +#include <e32base.h>
    1.33 +#include "sipdialogassocbase.h"
    1.34 +
    1.35 +// CONSTANTS
    1.36 +
    1.37 +// FORWARD DECLARATIONS
    1.38 +class CSIPEventHeader;
    1.39 +class CSIPSubscriptionStateHeader;
    1.40 +class MSIPRegistrationContext;
    1.41 +
    1.42 +// CLASS DECLARATION
    1.43 +
    1.44 +/**
    1.45 +* @publishedAll
    1.46 +* @released
    1.47 +*
    1.48 +* Class for managing SIP NOTIFY dialog associations.
    1.49 +* It provides services for creating, using and
    1.50 +* terminating SIP NOTIFY dialog associations. The user can have multiple
    1.51 +* NOTIFY dialog associations per same SIP dialog.
    1.52 +* Implementation handles SUBSCRIBE on the dialog level defined by Call-Id,
    1.53 +* local and remote tags; user is responsible for "Event" and
    1.54 +* "Subscription-State" header semantics.
    1.55 +* @lib sipclient.lib
    1.56 +*/
    1.57 +class CSIPNotifyDialogAssoc: public CSIPDialogAssocBase
    1.58 +	{
    1.59 +	public: // Constructors and destructor
    1.60 +
    1.61 +        /**
    1.62 +		* Two-phased constructor.
    1.63 +		* The response to the received SIP request will create a SIP NOTIFY
    1.64 +		* dialog association that will be correlated with the SIP dialog in
    1.65 +		* which SIP server transaction was received. If the server transaction
    1.66 +		* was not received within a SIP dialog, a new SIP dialog is created.
    1.67 +		* The server transaction must be either SUBSCRIBE or REFER transaction.
    1.68 +		* @pre aTransaction.State()==ETrying || EProceeding
    1.69 +		* @pre aTransaction.Type() == 
    1.70 +		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer	
    1.71 +        * @pre aEvent != 0 && aState != 0
    1.72 +		* @param aTransaction a SIP server transaction 
    1.73 +		* @param aEvent an event to send a notification about; the ownership
    1.74 +		*        is transferred.
    1.75 +		* @param aState a subscription state; the ownership is transferred.
    1.76 +		* @return New object; the ownership is transferred
    1.77 +		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
    1.78 +		*	transaction, or aEvent == 0 or aState == 0.
    1.79 +		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
    1.80 +		*	state
    1.81 +		*/
    1.82 +		IMPORT_C static CSIPNotifyDialogAssoc*
    1.83 +			NewL(CSIPServerTransaction& aTransaction,
    1.84 +			     CSIPEventHeader* aEvent,
    1.85 +				 CSIPSubscriptionStateHeader* aState);
    1.86 +
    1.87 +		/**
    1.88 +		* Two-phased constructor.
    1.89 +		* The response to the received SIP request will create a SIP NOTIFY
    1.90 +		* dialog association that will be correlated with the SIP dialog in
    1.91 +		* which SIP server transaction was received. If the server transaction
    1.92 +		* was not received within a SIP dialog, a new SIP dialog is created.
    1.93 +		* The server transaction must be either SUBSCRIBE or REFER transaction.
    1.94 +		* @pre aTransaction.State()==ETrying || EProceeding
    1.95 +		* @pre aTransaction.Type() == 
    1.96 +		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer	
    1.97 +        * @pre aEvent != 0 && aState != 0
    1.98 +		* @param aTransaction a SIP server transaction
    1.99 +		* @param aEvent an event to send a notification about; the ownership
   1.100 +		*        is transferred.
   1.101 +		* @param aState a subscription state; the ownership is transferred.
   1.102 +		* @return New object; the ownership is transferred
   1.103 +		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
   1.104 +		*	transaction, or aEvent == 0 or aState == 0.
   1.105 +		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
   1.106 +		*	state
   1.107 +		*/
   1.108 +		IMPORT_C static CSIPNotifyDialogAssoc*
   1.109 +			NewLC(CSIPServerTransaction& aTransaction,
   1.110 +			      CSIPEventHeader* aEvent,
   1.111 +				  CSIPSubscriptionStateHeader* aState);
   1.112 +				  
   1.113 +        /**
   1.114 +		* Two-phased constructor.
   1.115 +		* The response to the received SIP request will create a SIP NOTIFY
   1.116 +		* dialog association that will be correlated with the SIP dialog in
   1.117 +		* which SIP server transaction was received. If the server transaction
   1.118 +		* was not received within a SIP dialog, a new SIP dialog is created.
   1.119 +		* The server transaction must be either SUBSCRIBE or REFER transaction.
   1.120 +		* @pre aTransaction.State()==ETrying || EProceeding
   1.121 +		* @pre aTransaction.Type() == 
   1.122 +		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer
   1.123 +		* @pre aContext.IsContextActive() == ETrue	
   1.124 +        * @pre aEvent != 0 && aState != 0
   1.125 +		* @param aTransaction a SIP server transaction
   1.126 +        * @param aContext that will be used for populating 
   1.127 +        *        the Contact-header of the response to aTransaction		
   1.128 +		* @param aEvent an event to send a notification about; the ownership
   1.129 +		*        is transferred.
   1.130 +		* @param aState a subscription state; the ownership is transferred.
   1.131 +		* @return New object; the ownership is transferred
   1.132 +		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
   1.133 +		*	transaction, or aEvent == 0 or aState == 0.
   1.134 +		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
   1.135 +		*	state
   1.136 +		*/
   1.137 +		IMPORT_C static CSIPNotifyDialogAssoc*
   1.138 +			NewL(CSIPServerTransaction& aTransaction,
   1.139 +                 const MSIPRegistrationContext& aContext,			
   1.140 +			     CSIPEventHeader* aEvent,
   1.141 +				 CSIPSubscriptionStateHeader* aState);
   1.142 +
   1.143 +		/**
   1.144 +		* Two-phased constructor.
   1.145 +		* The response to the received SIP request will create a SIP NOTIFY
   1.146 +		* dialog association that will be correlated with the SIP dialog in
   1.147 +		* which SIP server transaction was received. If the server transaction
   1.148 +		* was not received within a SIP dialog, a new SIP dialog is created.
   1.149 +		* The server transaction must be either SUBSCRIBE or REFER transaction.
   1.150 +		* @pre aTransaction.State()==ETrying || EProceeding
   1.151 +		* @pre aTransaction.Type() == 
   1.152 +		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer
   1.153 +		* @pre aContext.IsContextActive() == ETrue	
   1.154 +        * @pre aEvent != 0 && aState != 0
   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 +		* @param aEvent an event to send a notification about; the ownership
   1.159 +		*        is transferred.
   1.160 +		* @param aState a subscription state; the ownership is transferred.
   1.161 +		* @return New object; the ownership is transferred
   1.162 +		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
   1.163 +		*	transaction, or aEvent == 0 or aState == 0.
   1.164 +		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
   1.165 +		*	state
   1.166 +		*/
   1.167 +		IMPORT_C static CSIPNotifyDialogAssoc*
   1.168 +			NewLC(CSIPServerTransaction& aTransaction,
   1.169 +                  const MSIPRegistrationContext& aContext,
   1.170 +			      CSIPEventHeader* aEvent,
   1.171 +				  CSIPSubscriptionStateHeader* aState);				  
   1.172 +
   1.173 +		/**
   1.174 +		* Destructor
   1.175 +		*/
   1.176 +		IMPORT_C ~CSIPNotifyDialogAssoc();
   1.177 +			                                  
   1.178 +	public: // New functions
   1.179 +
   1.180 +        /**
   1.181 +		* Creates NOTIFY and sends it to the remote target.		
   1.182 +		* If client provides optional SIP headers they must
   1.183 +		* not contain Event and Subscription-State headers.		
   1.184 +		* @pre Dialog().Connection().State()==EActive
   1.185 +		* @pre Dialog().State()==CSIPDialog::TState::EConfirmed		
   1.186 +		* @param aElements optional SIP message headers and body.
   1.187 +		*	Ownership is transferred.
   1.188 +		* @return NOTIFY SIP UAC transaction
   1.189 +		* @leave KErrSIPInvalidDialogState if dialog's state is incorrect
   1.190 +		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
   1.191 +		*	object has been deleted.
   1.192 +		* @capability NetworkServices
   1.193 +		*/
   1.194 +		IMPORT_C CSIPClientTransaction*
   1.195 +            SendNotifyL(CSIPMessageElements* aElements=0);
   1.196 +
   1.197 +		/**
   1.198 +		* Gets an event about which the notification is done
   1.199 +		* @return an event
   1.200 +		*/
   1.201 +		IMPORT_C const CSIPEventHeader& Event() const;
   1.202 +
   1.203 +		/**
   1.204 +		* Gets subscription state
   1.205 +		* @return subscription state
   1.206 +		*/
   1.207 +		IMPORT_C CSIPSubscriptionStateHeader& SubscriptionState();
   1.208 +		
   1.209 +		/**
   1.210 +		* Gets subscription state
   1.211 +		* @return subscription state
   1.212 +		*/
   1.213 +		IMPORT_C const CSIPSubscriptionStateHeader& SubscriptionState() const;
   1.214 +
   1.215 +	public: // New functions, for internal use
   1.216 +
   1.217 +		CSIPClientTransaction*
   1.218 +			DoSendNotifyWithinDialogL(CSIPMessageElements* aElements);
   1.219 +
   1.220 +	private: // Constructors
   1.221 +
   1.222 +		CSIPNotifyDialogAssoc();
   1.223 +
   1.224 +        void ConstructL(CSIPServerTransaction& aTransaction,
   1.225 +                        const MSIPRegistrationContext* aContext,
   1.226 +                        CSIPEventHeader* aEvent,
   1.227 +                        CSIPSubscriptionStateHeader* aState);
   1.228 +
   1.229 +	private: // Data
   1.230 +
   1.231 +		CSIPEventHeader* iEvent;
   1.232 +		CSIPSubscriptionStateHeader* iSubscriptionState;
   1.233 +	};
   1.234 +
   1.235 +#endif