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