1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/sipreferdialogassoc.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,287 @@
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 : sipreferdialogassoc.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 +#ifndef CSIPREFERDIALOGASSOC_H
1.28 +#define CSIPREFERDIALOGASSOC_H
1.29 +
1.30 +// INCLUDES
1.31 +#include "sipdialogassocbase.h"
1.32 +
1.33 +// CONSTANTS
1.34 +
1.35 +// FORWARD DECLARATIONS
1.36 +class CUri8;
1.37 +class CSIPToHeader;
1.38 +class CSIPFromHeader;
1.39 +class CSIPContactHeader;
1.40 +class CSIPReferToHeader;
1.41 +class MSIPRegistrationContext;
1.42 +class CSIPConnection;
1.43 +
1.44 +// CLASS DECLARATION
1.45 +
1.46 +/**
1.47 +* @publishedAll
1.48 +* @released
1.49 +*
1.50 +* Class for managing SIP REFER dialog associations.
1.51 +* It provides services for creating, using and terminating SIP REFER
1.52 +* dialog associations. User can have multiple REFER dialog associations
1.53 +* per same SIP dialog.
1.54 +* Implementation handles SUBSCRIBE on the dialog level defined by Call-Id,
1.55 +* local and remote tags;
1.56 +* User is responsible for "Refer-to" header semantics.
1.57 +* @lib sipclient.lib
1.58 +*/
1.59 +class CSIPReferDialogAssoc: public CSIPDialogAssocBase
1.60 + {
1.61 + public: // Constructors and destructor
1.62 +
1.63 + /**
1.64 + * Two-phased constructor.
1.65 + * Should be used if response to the SIP request to be sent
1.66 + * will create a SIP dialog association.
1.67 + * @pre aReferTo != 0
1.68 + * @param aDialog a dialog to be associated with
1.69 + * @param aReferTo referred-to resource
1.70 + * @return New object; the ownership is transferred
1.71 + * @leave KErrArgument if aReferTo == 0
1.72 + */
1.73 + IMPORT_C static CSIPReferDialogAssoc*
1.74 + NewL(CSIPDialog& aDialog,
1.75 + CSIPReferToHeader* aReferTo);
1.76 +
1.77 + /**
1.78 + * Two-phased constructor.
1.79 + * Must be used if response to the SIP request to be sent
1.80 + * will create a SIP dialog association.
1.81 + * @pre aReferTo != 0
1.82 + * @param aDialog a dialog to be associated with
1.83 + * @param aReferTo referred-to resource
1.84 + * @return New object; the ownership is transferred
1.85 + * @leave KErrArgument if aReferTo == 0
1.86 + */
1.87 + IMPORT_C static CSIPReferDialogAssoc*
1.88 + NewLC(CSIPDialog& aDialog,
1.89 + CSIPReferToHeader* aReferTo);
1.90 +
1.91 + /**
1.92 + * Two-phased constructor
1.93 + * @pre aFrom != 0
1.94 + * @pre aReferTo != 0
1.95 + * @pre aRemoteUri != 0
1.96 + * The user of the class must not define tags in From-header
1.97 + * and To-header.
1.98 + * @param aConnection a SIP connection to be used with
1.99 + * dialog association
1.100 + * @param aFrom originator's address; the ownership is transfered
1.101 + * @param aRemoteUri a remote target URI that identifies a resource that
1.102 + * the request is addressed to.
1.103 + * @param aReferTo referred-to resource
1.104 + * @param aTo logical recipient's address; if not defined
1.105 + * the remote target uri will be used for To-header
1.106 + * construction; the ownership is transfered
1.107 + * @param aContact a contact to be used in dialog creation. Must be
1.108 + * given only if user intends to re-direct future requests;
1.109 + * the ownership is transfered
1.110 + * @return New object; the ownership is transferred.
1.111 + * @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0
1.112 + */
1.113 + IMPORT_C static CSIPReferDialogAssoc*
1.114 + NewL(CSIPConnection& aConnection,
1.115 + CSIPFromHeader* aFrom,
1.116 + CUri8* aRemoteUri,
1.117 + CSIPReferToHeader* aReferTo,
1.118 + CSIPToHeader* aTo=0,
1.119 + CSIPContactHeader* aContact=0);
1.120 +
1.121 + /**
1.122 + * Two-phased constructor
1.123 + * @pre aFrom != 0
1.124 + * @pre aReferTo != 0
1.125 + * @pre aRemoteUri != 0
1.126 + * The user of the class must not define tags in From-header
1.127 + * and To-header.
1.128 + * @param aConnection a SIP connection to be used with
1.129 + * dialog association
1.130 + * @param aFrom originator's address; the ownership is transfered
1.131 + * @param aRemoteUri a remote target URI that identifies a resource that
1.132 + * the request is addressed to.
1.133 + * @param aReferTo referred-to resource
1.134 + * @param aTo logical recipient's address; if not defined
1.135 + * the remote target uri will be used for To-header
1.136 + * construction; the ownership is transfered
1.137 + * @param aContact a contact to be used in dialog creation. Must be
1.138 + * given only if user intends to re-direct future requests;
1.139 + * the ownership is transfered
1.140 + * @return New object; the ownership is transferred.
1.141 + * @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0
1.142 + */
1.143 + IMPORT_C static CSIPReferDialogAssoc*
1.144 + NewLC(CSIPConnection& aConnection,
1.145 + CSIPFromHeader* aFrom,
1.146 + CUri8* aRemoteUri,
1.147 + CSIPReferToHeader* aReferTo,
1.148 + CSIPToHeader* aTo=0,
1.149 + CSIPContactHeader* aContact=0);
1.150 +
1.151 + /**
1.152 + * Two-phased constructor
1.153 + * @pre aReferTo != 0
1.154 + * @pre aRemoteUri != 0
1.155 + * The user of the class must not define tags in From-header
1.156 + * and To-header.
1.157 + * @pre aContext.IsContextActive() == ETrue
1.158 + * @param aConnection a SIP connection to be used with
1.159 + * dialog association
1.160 + * @param aRemoteUri a remote target URI that identifies a resource that
1.161 + * the request is targeted to.
1.162 + * @param aContext used for selecting outbound
1.163 + * proxy and originator's address (AOR) and contact
1.164 + * @param aReferTo referred-to resource
1.165 + * @param aFrom originator's address. If not defined it will
1.166 + * constructed using registration context (User's AOR);
1.167 + * the ownership is transfered
1.168 + * @param aTo logical recipient's address; if not defined
1.169 + * the remote target uri will be used for To-header
1.170 + * construction; the ownership is transfered
1.171 + * @param aContact a contact to be used in dialog creation. Must be
1.172 + * given only if user intends to re-direct future requests;
1.173 + * the ownership is transfered
1.174 + * @return New object: the ownership is transferred.
1.175 + * @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0
1.176 + * @leave KErrSIPInvalidRegistrationState
1.177 + * if aContext.IsContextActive() == EFalse
1.178 + */
1.179 + IMPORT_C static CSIPReferDialogAssoc*
1.180 + NewL(CSIPConnection& aConnection,
1.181 + CUri8* aRemoteUri,
1.182 + const MSIPRegistrationContext& aContext,
1.183 + CSIPReferToHeader* aReferTo,
1.184 + CSIPFromHeader* aFrom=0,
1.185 + CSIPToHeader* aTo=0,
1.186 + CSIPContactHeader* aContact=0);
1.187 +
1.188 + /**
1.189 + * Two-phased constructor
1.190 + * @pre aReferTo != 0
1.191 + * @pre aRemoteUri != 0
1.192 + * The user of the class must not define tags in From-header
1.193 + * and To-header.
1.194 + * @pre aContext.IsContextActive()==ETrue
1.195 + * @param aConnection a SIP connection to be used with
1.196 + * dialog association
1.197 + * @param aRemoteUri a remote target URI that identifies a resource that
1.198 + * the request is targeted to.
1.199 + * @param aContext used for selecting outbound
1.200 + * proxy and originator's address (AOR) and contact
1.201 + * @param aReferTo referred-to resource
1.202 + * @param aFrom originator's address. If not defined it will
1.203 + * constructed using registration context (User's AOR);
1.204 + * the ownership is transfered
1.205 + * @param aTo logical recipient's address; if not defined
1.206 + * the remote target uri will be used for To-header
1.207 + * construction; the ownership is transfered
1.208 + * @param aContact a contact to be used in dialog creation. Must be
1.209 + * given only if user intends to re-direct future requests;
1.210 + * the ownership is transfered
1.211 + * @return New object; the ownership is transferred.
1.212 + * @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0
1.213 + * @leave KErrSIPInvalidRegistrationState
1.214 + * if aContext.IsContextActive() == EFalse
1.215 + */
1.216 + IMPORT_C static CSIPReferDialogAssoc*
1.217 + NewLC(CSIPConnection& aConnection,
1.218 + CUri8* aRemoteUri,
1.219 + const MSIPRegistrationContext& aContext,
1.220 + CSIPReferToHeader* aReferTo,
1.221 + CSIPFromHeader* aFrom=0,
1.222 + CSIPToHeader* aTo=0,
1.223 + CSIPContactHeader* aContact=0);
1.224 +
1.225 + /**
1.226 + * Destructor
1.227 + */
1.228 + IMPORT_C ~CSIPReferDialogAssoc();
1.229 +
1.230 + public: //New functions
1.231 +
1.232 + /**
1.233 + * Creates REFER and sends it to the remote target.
1.234 + * leaves on failure.
1.235 + * 101-199 or 2xx response will create REFER dialog
1.236 + * association in case of first REFER request within
1.237 + * this dialog association.
1.238 + * @pre Dialog().Connection().State()==EActive
1.239 + * @pre Dialog().State()==CSIPDialog::EInit ||
1.240 + * Dialog().State()==CSIPDialog::EConfirmed
1.241 + * @param aElements optional SIP message headers and body. Ownership is
1.242 + * transferred.
1.243 + * @return REFER SIP transaction. Ownership is transferred.
1.244 + * @leave KErrSIPInvalidDialogState if dialog is in wrong state
1.245 + * @leave KErrSIPResourceNotAvailable if a required SIP Client API
1.246 + * object has been deleted.
1.247 + * @capability NetworkServices
1.248 + */
1.249 + IMPORT_C CSIPClientTransaction*
1.250 + SendReferL(CSIPMessageElements* aElements=0);
1.251 +
1.252 + /**
1.253 + * Gets referred-to resouce
1.254 + * @return referred-to resource
1.255 + */
1.256 + IMPORT_C const CSIPReferToHeader& ReferTo() const;
1.257 +
1.258 + public: // New functions, for internal use
1.259 +
1.260 + /**
1.261 + * Sends a REFER request.
1.262 + *
1.263 + * @pre Dialog().Connection().State()==EActive
1.264 + * @param aElements optional SIP message headers and body.
1.265 + * Ownership is transferred.
1.266 + * @param aWithinDialog ETrue if REFER is sent within dialog,
1.267 + * EFalse if REFER creates the dialog.
1.268 + * @return REFER SIP transaction. Ownership is transferred.
1.269 + */
1.270 + CSIPClientTransaction* DoSendReferL(CSIPMessageElements* aElements,
1.271 + TBool aWithinDialog);
1.272 +
1.273 + private: // Constructors
1.274 +
1.275 + CSIPReferDialogAssoc();
1.276 +
1.277 + static CSIPReferDialogAssoc* NewLC(CSIPConnection& aConnection,
1.278 + CUri8* aRemoteUri,
1.279 + CSIPReferToHeader* aReferTo,
1.280 + CSIPFromHeader* aFrom,
1.281 + CSIPToHeader* aTo,
1.282 + CSIPContactHeader* aContact,
1.283 + const MSIPRegistrationContext* aContext);
1.284 +
1.285 + private: // Data
1.286 +
1.287 + CSIPReferToHeader* iReferTo;
1.288 + };
1.289 +
1.290 +#endif