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