epoc32/include/mw/sipreferdialogassoc.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/sipreferdialogassoc.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
* Name        : sipreferdialogassoc.h
williamr@2
    16
* Part of     : SIP Client
williamr@2
    17
* Interface   : SDK API, SIP Client API
williamr@2
    18
* Version     : 1.0
williamr@2
    19
*
williamr@2
    20
*/
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
#ifndef CSIPREFERDIALOGASSOC_H
williamr@2
    25
#define CSIPREFERDIALOGASSOC_H
williamr@2
    26
williamr@2
    27
// INCLUDES
williamr@2
    28
#include "sipdialogassocbase.h"
williamr@2
    29
williamr@2
    30
// CONSTANTS
williamr@2
    31
williamr@2
    32
// FORWARD DECLARATIONS
williamr@2
    33
class CUri8;
williamr@2
    34
class CSIPToHeader;
williamr@2
    35
class CSIPFromHeader;
williamr@2
    36
class CSIPContactHeader;
williamr@2
    37
class CSIPReferToHeader;
williamr@2
    38
class MSIPRegistrationContext;
williamr@2
    39
class CSIPConnection;
williamr@2
    40
williamr@2
    41
// CLASS DECLARATION
williamr@2
    42
williamr@2
    43
/**
williamr@2
    44
* @publishedAll
williamr@2
    45
* @released
williamr@2
    46
*
williamr@2
    47
* Class for managing SIP REFER dialog associations.
williamr@2
    48
* It provides services for creating, using and terminating SIP REFER
williamr@2
    49
* dialog associations. User can have multiple REFER dialog associations
williamr@2
    50
* per same SIP dialog.
williamr@2
    51
* Implementation handles SUBSCRIBE on the dialog level defined by Call-Id,
williamr@2
    52
* local and remote tags;
williamr@2
    53
* User is responsible for "Refer-to" header semantics.
williamr@2
    54
* @lib sipclient.lib
williamr@2
    55
*/
williamr@2
    56
class CSIPReferDialogAssoc: public CSIPDialogAssocBase
williamr@2
    57
	{
williamr@2
    58
	public: // Constructors and destructor
williamr@2
    59
williamr@2
    60
		/**
williamr@2
    61
		* Two-phased constructor.
williamr@2
    62
		* Should be used if response to the SIP request to be sent
williamr@2
    63
		* will create a SIP dialog association.
williamr@2
    64
		* @pre aReferTo != 0
williamr@2
    65
		* @param aDialog a dialog to be associated with
williamr@2
    66
		* @param aReferTo referred-to resource
williamr@2
    67
        * @return New object; the ownership is transferred
williamr@2
    68
        * @leave KErrArgument if aReferTo == 0
williamr@2
    69
		*/
williamr@2
    70
		IMPORT_C static CSIPReferDialogAssoc*
williamr@2
    71
			NewL(CSIPDialog& aDialog,
williamr@2
    72
				 CSIPReferToHeader* aReferTo);
williamr@2
    73
williamr@2
    74
		/**
williamr@2
    75
		* Two-phased constructor.
williamr@2
    76
		* Must be used if response to the SIP request to be sent
williamr@2
    77
		* will create a SIP dialog association.
williamr@2
    78
		* @pre aReferTo != 0
williamr@2
    79
		* @param aDialog a dialog to be associated with
williamr@2
    80
		* @param aReferTo referred-to resource
williamr@2
    81
        * @return New object; the ownership is transferred
williamr@2
    82
        * @leave KErrArgument if aReferTo == 0
williamr@2
    83
		*/
williamr@2
    84
		IMPORT_C static CSIPReferDialogAssoc*
williamr@2
    85
			NewLC(CSIPDialog& aDialog,
williamr@2
    86
				  CSIPReferToHeader* aReferTo);
williamr@2
    87
williamr@2
    88
       /**
williamr@2
    89
        * Two-phased constructor
williamr@2
    90
        * @pre aFrom != 0 
williamr@2
    91
        * @pre aReferTo != 0
williamr@2
    92
		* @pre aRemoteUri != 0
williamr@2
    93
		* The user of the class must not define tags in From-header
williamr@2
    94
		* and To-header.
williamr@2
    95
        * @param aConnection a SIP connection to be used with
williamr@2
    96
        *        dialog association
williamr@2
    97
        * @param aFrom originator's address; the ownership is transfered
williamr@2
    98
        * @param aRemoteUri a remote target URI that identifies a resource that
williamr@2
    99
        *		 the request is addressed to.
williamr@2
   100
		* @param aReferTo referred-to resource
williamr@2
   101
        * @param aTo logical recipient's address; if not defined
williamr@2
   102
        *        the remote target uri will be used for To-header
williamr@2
   103
        *        construction; the ownership is transfered
williamr@2
   104
        * @param aContact a contact to be used in dialog creation. Must be
williamr@2
   105
        *        given only if user intends to re-direct future requests; 
williamr@2
   106
        *        the ownership is transfered
williamr@2
   107
        * @return New object; the ownership is transferred.
williamr@2
   108
        * @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0
williamr@2
   109
        */
williamr@2
   110
        IMPORT_C static CSIPReferDialogAssoc*
williamr@2
   111
            NewL(CSIPConnection& aConnection,
williamr@2
   112
                 CSIPFromHeader* aFrom,
williamr@2
   113
				 CUri8* aRemoteUri,
williamr@2
   114
				 CSIPReferToHeader* aReferTo,
williamr@2
   115
                 CSIPToHeader* aTo=0,                 
williamr@2
   116
                 CSIPContactHeader* aContact=0);
williamr@2
   117
williamr@2
   118
       /**
williamr@2
   119
        * Two-phased constructor
williamr@2
   120
        * @pre aFrom != 0
williamr@2
   121
        * @pre aReferTo != 0
williamr@2
   122
		* @pre aRemoteUri != 0
williamr@2
   123
		* The user of the class must not define tags in From-header
williamr@2
   124
		* and To-header.
williamr@2
   125
        * @param aConnection a SIP connection to be used with
williamr@2
   126
        *        dialog association
williamr@2
   127
        * @param aFrom originator's address; the ownership is transfered
williamr@2
   128
        * @param aRemoteUri a remote target URI that identifies a resource that
williamr@2
   129
        *		 the request is addressed to.
williamr@2
   130
		* @param aReferTo referred-to resource
williamr@2
   131
        * @param aTo logical recipient's address; if not defined
williamr@2
   132
        *        the remote target uri will be used for To-header
williamr@2
   133
        *        construction; the ownership is transfered
williamr@2
   134
        * @param aContact a contact to be used in dialog creation. Must be
williamr@2
   135
        *        given only if user intends to re-direct future requests; 
williamr@2
   136
        *        the ownership is transfered
williamr@2
   137
        * @return New object; the ownership is transferred.
williamr@2
   138
        * @leave KErrArgument if aFrom == 0 or aRemoteuri == 0 or aReferTo == 0
williamr@2
   139
        */
williamr@2
   140
        IMPORT_C static CSIPReferDialogAssoc*
williamr@2
   141
            NewLC(CSIPConnection& aConnection,
williamr@2
   142
                  CSIPFromHeader* aFrom,
williamr@2
   143
				  CUri8* aRemoteUri,
williamr@2
   144
				  CSIPReferToHeader* aReferTo,
williamr@2
   145
                  CSIPToHeader* aTo=0,                 
williamr@2
   146
                  CSIPContactHeader* aContact=0);
williamr@2
   147
williamr@2
   148
       /**
williamr@2
   149
        * Two-phased constructor
williamr@2
   150
        * @pre aReferTo != 0
williamr@2
   151
		* @pre aRemoteUri != 0
williamr@2
   152
		* The user of the class must not define tags in From-header
williamr@2
   153
		* and To-header.
williamr@2
   154
        * @pre aContext.IsContextActive() == ETrue
williamr@2
   155
        * @param aConnection a SIP connection to be used with
williamr@2
   156
        *        dialog association 
williamr@2
   157
        * @param aRemoteUri a remote target URI that identifies a resource that
williamr@2
   158
        *		 the request is targeted to.
williamr@2
   159
        * @param aContext used for selecting outbound 
williamr@2
   160
        *        proxy and originator's address (AOR) and contact
williamr@2
   161
        * @param aReferTo referred-to resource
williamr@2
   162
        * @param aFrom originator's address. If not defined it will
williamr@2
   163
        *        constructed using registration context (User's AOR);
williamr@2
   164
        *        the ownership is transfered
williamr@2
   165
        * @param aTo logical recipient's address; if not defined
williamr@2
   166
        *        the remote target uri will be used for To-header
williamr@2
   167
        *        construction; the ownership is transfered
williamr@2
   168
        * @param aContact a contact to be used in dialog creation. Must be
williamr@2
   169
        *        given only if user intends to re-direct future requests; 
williamr@2
   170
        *        the ownership is transfered
williamr@2
   171
        * @return New object: the ownership is transferred.
williamr@2
   172
        * @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0
williamr@2
   173
        * @leave KErrSIPInvalidRegistrationState
williamr@2
   174
        *		 if aContext.IsContextActive() == EFalse
williamr@2
   175
        */
williamr@2
   176
        IMPORT_C static CSIPReferDialogAssoc*
williamr@2
   177
            NewL(CSIPConnection& aConnection,                                    
williamr@2
   178
                 CUri8* aRemoteUri,
williamr@2
   179
                 const MSIPRegistrationContext& aContext,
williamr@2
   180
                 CSIPReferToHeader* aReferTo,
williamr@2
   181
                 CSIPFromHeader* aFrom=0,
williamr@2
   182
	             CSIPToHeader* aTo=0,
williamr@2
   183
	             CSIPContactHeader* aContact=0);
williamr@2
   184
williamr@2
   185
       /**
williamr@2
   186
        * Two-phased constructor        
williamr@2
   187
        * @pre aReferTo != 0
williamr@2
   188
		* @pre aRemoteUri != 0
williamr@2
   189
		* The user of the class must not define tags in From-header
williamr@2
   190
		* and To-header.
williamr@2
   191
        * @pre aContext.IsContextActive()==ETrue
williamr@2
   192
        * @param aConnection a SIP connection to be used with
williamr@2
   193
        *        dialog association 
williamr@2
   194
        * @param aRemoteUri a remote target URI that identifies a resource that
williamr@2
   195
        *		 the request is targeted to.
williamr@2
   196
        * @param aContext used for selecting outbound 
williamr@2
   197
        *        proxy and originator's address (AOR) and contact
williamr@2
   198
        * @param aReferTo referred-to resource
williamr@2
   199
        * @param aFrom originator's address. If not defined it will
williamr@2
   200
        *        constructed using registration context (User's AOR);
williamr@2
   201
        *        the ownership is transfered
williamr@2
   202
        * @param aTo logical recipient's address; if not defined
williamr@2
   203
        *        the remote target uri will be used for To-header
williamr@2
   204
        *        construction; the ownership is transfered
williamr@2
   205
        * @param aContact a contact to be used in dialog creation. Must be
williamr@2
   206
        *        given only if user intends to re-direct future requests; 
williamr@2
   207
        *        the ownership is transfered
williamr@2
   208
        * @return New object; the ownership is transferred.
williamr@2
   209
        * @leave KErrArgument if aRemoteuri == 0 or aReferTo == 0
williamr@2
   210
        * @leave KErrSIPInvalidRegistrationState
williamr@2
   211
        *		 if aContext.IsContextActive() == EFalse
williamr@2
   212
        */
williamr@2
   213
        IMPORT_C static CSIPReferDialogAssoc*
williamr@2
   214
            NewLC(CSIPConnection& aConnection,                                    
williamr@2
   215
                 CUri8* aRemoteUri,
williamr@2
   216
                 const MSIPRegistrationContext& aContext,
williamr@2
   217
                 CSIPReferToHeader* aReferTo,
williamr@2
   218
                 CSIPFromHeader* aFrom=0,
williamr@2
   219
	             CSIPToHeader* aTo=0,
williamr@2
   220
	             CSIPContactHeader* aContact=0);
williamr@2
   221
williamr@2
   222
		/**
williamr@2
   223
		* Destructor
williamr@2
   224
		*/
williamr@2
   225
		IMPORT_C ~CSIPReferDialogAssoc();
williamr@2
   226
williamr@2
   227
	public: //New functions
williamr@2
   228
williamr@2
   229
		/**
williamr@2
   230
		* Creates REFER and sends it to the remote target.
williamr@2
   231
		* leaves on failure.
williamr@2
   232
		* 101-199 or 2xx response will create REFER dialog 
williamr@2
   233
		* association in case of first REFER request within
williamr@2
   234
		* this dialog association.
williamr@2
   235
		* @pre Dialog().Connection().State()==EActive
williamr@2
   236
		* @pre Dialog().State()==CSIPDialog::EInit ||
williamr@2
   237
		*      Dialog().State()==CSIPDialog::EConfirmed
williamr@2
   238
		* @param aElements optional SIP message headers and body. Ownership is
williamr@2
   239
        *   transferred.
williamr@2
   240
		* @return REFER SIP transaction. Ownership is transferred.
williamr@2
   241
		* @leave KErrSIPInvalidDialogState if dialog is in wrong state
williamr@2
   242
		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
williamr@2
   243
		*	object has been deleted.
williamr@2
   244
		* @capability NetworkServices
williamr@2
   245
		*/
williamr@2
   246
		IMPORT_C CSIPClientTransaction*
williamr@2
   247
            SendReferL(CSIPMessageElements* aElements=0);
williamr@2
   248
        
williamr@2
   249
        /**
williamr@2
   250
        * Gets referred-to resouce
williamr@2
   251
        * @return referred-to resource
williamr@2
   252
        */
williamr@2
   253
        IMPORT_C const CSIPReferToHeader& ReferTo() const;
williamr@2
   254
williamr@2
   255
	public: // New functions, for internal use
williamr@2
   256
	
williamr@2
   257
		/**
williamr@2
   258
		* Sends a REFER request.
williamr@2
   259
		*
williamr@2
   260
		* @pre Dialog().Connection().State()==EActive
williamr@2
   261
		* @param aElements optional SIP message headers and body.
williamr@2
   262
		*	Ownership is transferred.
williamr@2
   263
		* @param aWithinDialog ETrue if REFER is sent within dialog,
williamr@2
   264
		*	EFalse if REFER creates the dialog.
williamr@2
   265
		* @return REFER SIP transaction. Ownership is transferred.
williamr@2
   266
		*/
williamr@2
   267
		CSIPClientTransaction* DoSendReferL(CSIPMessageElements* aElements,
williamr@2
   268
								   			TBool aWithinDialog);
williamr@2
   269
williamr@2
   270
 	private: // Constructors
williamr@2
   271
williamr@2
   272
        CSIPReferDialogAssoc();
williamr@2
   273
        
williamr@2
   274
        static CSIPReferDialogAssoc* NewLC(CSIPConnection& aConnection,
williamr@2
   275
								CUri8* aRemoteUri,
williamr@2
   276
								CSIPReferToHeader* aReferTo,
williamr@2
   277
								CSIPFromHeader* aFrom,
williamr@2
   278
                                CSIPToHeader* aTo,
williamr@2
   279
			                    CSIPContactHeader* aContact,
williamr@2
   280
			                    const MSIPRegistrationContext* aContext);
williamr@2
   281
williamr@2
   282
    private: // Data
williamr@2
   283
williamr@2
   284
        CSIPReferToHeader* iReferTo;
williamr@2
   285
	};
williamr@2
   286
williamr@2
   287
#endif