epoc32/include/mw/sipnotifydialogassoc.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        : sipnotifydialogassoc.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 CSIPNOTIFYDIALOGASSOC_H
    26 #define CSIPNOTIFYDIALOGASSOC_H
    27 
    28 // INCLUDES
    29 #include <e32base.h>
    30 #include "sipdialogassocbase.h"
    31 
    32 // CONSTANTS
    33 
    34 // FORWARD DECLARATIONS
    35 class CSIPEventHeader;
    36 class CSIPSubscriptionStateHeader;
    37 class MSIPRegistrationContext;
    38 
    39 // CLASS DECLARATION
    40 
    41 /**
    42 * @publishedAll
    43 * @released
    44 *
    45 * Class for managing SIP NOTIFY dialog associations.
    46 * It provides services for creating, using and
    47 * terminating SIP NOTIFY dialog associations. The user can have multiple
    48 * NOTIFY dialog associations per same SIP dialog.
    49 * Implementation handles SUBSCRIBE on the dialog level defined by Call-Id,
    50 * local and remote tags; user is responsible for "Event" and
    51 * "Subscription-State" header semantics.
    52 * @lib sipclient.lib
    53 */
    54 class CSIPNotifyDialogAssoc: public CSIPDialogAssocBase
    55 	{
    56 	public: // Constructors and destructor
    57 
    58         /**
    59 		* Two-phased constructor.
    60 		* The response to the received SIP request will create a SIP NOTIFY
    61 		* dialog association that will be correlated with the SIP dialog in
    62 		* which SIP server transaction was received. If the server transaction
    63 		* was not received within a SIP dialog, a new SIP dialog is created.
    64 		* The server transaction must be either SUBSCRIBE or REFER transaction.
    65 		* @pre aTransaction.State()==ETrying || EProceeding
    66 		* @pre aTransaction.Type() == 
    67 		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer	
    68         * @pre aEvent != 0 && aState != 0
    69 		* @param aTransaction a SIP server transaction 
    70 		* @param aEvent an event to send a notification about; the ownership
    71 		*        is transferred.
    72 		* @param aState a subscription state; the ownership is transferred.
    73 		* @return New object; the ownership is transferred
    74 		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
    75 		*	transaction, or aEvent == 0 or aState == 0.
    76 		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
    77 		*	state
    78 		*/
    79 		IMPORT_C static CSIPNotifyDialogAssoc*
    80 			NewL(CSIPServerTransaction& aTransaction,
    81 			     CSIPEventHeader* aEvent,
    82 				 CSIPSubscriptionStateHeader* aState);
    83 
    84 		/**
    85 		* Two-phased constructor.
    86 		* The response to the received SIP request will create a SIP NOTIFY
    87 		* dialog association that will be correlated with the SIP dialog in
    88 		* which SIP server transaction was received. If the server transaction
    89 		* was not received within a SIP dialog, a new SIP dialog is created.
    90 		* The server transaction must be either SUBSCRIBE or REFER transaction.
    91 		* @pre aTransaction.State()==ETrying || EProceeding
    92 		* @pre aTransaction.Type() == 
    93 		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer	
    94         * @pre aEvent != 0 && aState != 0
    95 		* @param aTransaction a SIP server transaction
    96 		* @param aEvent an event to send a notification about; the ownership
    97 		*        is transferred.
    98 		* @param aState a subscription state; the ownership is transferred.
    99 		* @return New object; the ownership is transferred
   100 		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
   101 		*	transaction, or aEvent == 0 or aState == 0.
   102 		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
   103 		*	state
   104 		*/
   105 		IMPORT_C static CSIPNotifyDialogAssoc*
   106 			NewLC(CSIPServerTransaction& aTransaction,
   107 			      CSIPEventHeader* aEvent,
   108 				  CSIPSubscriptionStateHeader* aState);
   109 				  
   110         /**
   111 		* Two-phased constructor.
   112 		* The response to the received SIP request will create a SIP NOTIFY
   113 		* dialog association that will be correlated with the SIP dialog in
   114 		* which SIP server transaction was received. If the server transaction
   115 		* was not received within a SIP dialog, a new SIP dialog is created.
   116 		* The server transaction must be either SUBSCRIBE or REFER transaction.
   117 		* @pre aTransaction.State()==ETrying || EProceeding
   118 		* @pre aTransaction.Type() == 
   119 		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer
   120 		* @pre aContext.IsContextActive() == ETrue	
   121         * @pre aEvent != 0 && aState != 0
   122 		* @param aTransaction a SIP server transaction
   123         * @param aContext that will be used for populating 
   124         *        the Contact-header of the response to aTransaction		
   125 		* @param aEvent an event to send a notification about; the ownership
   126 		*        is transferred.
   127 		* @param aState a subscription state; the ownership is transferred.
   128 		* @return New object; the ownership is transferred
   129 		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
   130 		*	transaction, or aEvent == 0 or aState == 0.
   131 		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
   132 		*	state
   133 		*/
   134 		IMPORT_C static CSIPNotifyDialogAssoc*
   135 			NewL(CSIPServerTransaction& aTransaction,
   136                  const MSIPRegistrationContext& aContext,			
   137 			     CSIPEventHeader* aEvent,
   138 				 CSIPSubscriptionStateHeader* aState);
   139 
   140 		/**
   141 		* Two-phased constructor.
   142 		* The response to the received SIP request will create a SIP NOTIFY
   143 		* dialog association that will be correlated with the SIP dialog in
   144 		* which SIP server transaction was received. If the server transaction
   145 		* was not received within a SIP dialog, a new SIP dialog is created.
   146 		* The server transaction must be either SUBSCRIBE or REFER transaction.
   147 		* @pre aTransaction.State()==ETrying || EProceeding
   148 		* @pre aTransaction.Type() == 
   149 		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer
   150 		* @pre aContext.IsContextActive() == ETrue	
   151         * @pre aEvent != 0 && aState != 0
   152 		* @param aTransaction a SIP server transaction
   153         * @param aContext that will be used for populating 
   154         *        the Contact-header of the response to aTransaction		
   155 		* @param aEvent an event to send a notification about; the ownership
   156 		*        is transferred.
   157 		* @param aState a subscription state; the ownership is transferred.
   158 		* @return New object; the ownership is transferred
   159 		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
   160 		*	transaction, or aEvent == 0 or aState == 0.
   161 		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
   162 		*	state
   163 		*/
   164 		IMPORT_C static CSIPNotifyDialogAssoc*
   165 			NewLC(CSIPServerTransaction& aTransaction,
   166                   const MSIPRegistrationContext& aContext,
   167 			      CSIPEventHeader* aEvent,
   168 				  CSIPSubscriptionStateHeader* aState);				  
   169 
   170 		/**
   171 		* Destructor
   172 		*/
   173 		IMPORT_C ~CSIPNotifyDialogAssoc();
   174 			                                  
   175 	public: // New functions
   176 
   177         /**
   178 		* Creates NOTIFY and sends it to the remote target.		
   179 		* If client provides optional SIP headers they must
   180 		* not contain Event and Subscription-State headers.		
   181 		* @pre Dialog().Connection().State()==EActive
   182 		* @pre Dialog().State()==CSIPDialog::TState::EConfirmed		
   183 		* @param aElements optional SIP message headers and body.
   184 		*	Ownership is transferred.
   185 		* @return NOTIFY SIP UAC transaction
   186 		* @leave KErrSIPInvalidDialogState if dialog's state is incorrect
   187 		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
   188 		*	object has been deleted.
   189 		* @capability NetworkServices
   190 		*/
   191 		IMPORT_C CSIPClientTransaction*
   192             SendNotifyL(CSIPMessageElements* aElements=0);
   193 
   194 		/**
   195 		* Gets an event about which the notification is done
   196 		* @return an event
   197 		*/
   198 		IMPORT_C const CSIPEventHeader& Event() const;
   199 
   200 		/**
   201 		* Gets subscription state
   202 		* @return subscription state
   203 		*/
   204 		IMPORT_C CSIPSubscriptionStateHeader& SubscriptionState();
   205 		
   206 		/**
   207 		* Gets subscription state
   208 		* @return subscription state
   209 		*/
   210 		IMPORT_C const CSIPSubscriptionStateHeader& SubscriptionState() const;
   211 
   212 	public: // New functions, for internal use
   213 
   214 		CSIPClientTransaction*
   215 			DoSendNotifyWithinDialogL(CSIPMessageElements* aElements);
   216 
   217 	private: // Constructors
   218 
   219 		CSIPNotifyDialogAssoc();
   220 
   221         void ConstructL(CSIPServerTransaction& aTransaction,
   222                         const MSIPRegistrationContext* aContext,
   223                         CSIPEventHeader* aEvent,
   224                         CSIPSubscriptionStateHeader* aState);
   225 
   226 	private: // Data
   227 
   228 		CSIPEventHeader* iEvent;
   229 		CSIPSubscriptionStateHeader* iSubscriptionState;
   230 	};
   231 
   232 #endif