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@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.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 : sipsubscribedialogassoc.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 CSIPSUBSCRIBEDIALOGASSOC_H
|
williamr@2
|
25 |
#define CSIPSUBSCRIBEDIALOGASSOC_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 CSIPEventHeader;
|
williamr@2
|
38 |
class CSIPMessageElements;
|
williamr@2
|
39 |
class MSIPRegistrationContext;
|
williamr@2
|
40 |
class CSIPConnection;
|
williamr@2
|
41 |
|
williamr@2
|
42 |
// CLASS DECLARATION
|
williamr@2
|
43 |
|
williamr@2
|
44 |
/**
|
williamr@2
|
45 |
* @publishedAll
|
williamr@2
|
46 |
* @released
|
williamr@2
|
47 |
*
|
williamr@2
|
48 |
* Class for managing SIP SUBSCRIBE dialog associations.
|
williamr@2
|
49 |
* It provides services for creating, using and terminating SIP SUBSCRIBE
|
williamr@2
|
50 |
* dialog associations. The client can have multiple SUBSRIBE dialog
|
williamr@2
|
51 |
* associations per same SIP dialog.
|
williamr@2
|
52 |
* Implementation handles SUBSCRIBE on the dialog level defined by Call-Id,
|
williamr@2
|
53 |
* local and remote tags; "Event" header semantics are client's responsibility
|
williamr@2
|
54 |
*
|
williamr@2
|
55 |
* @lib sipclient.lib
|
williamr@2
|
56 |
*/
|
williamr@2
|
57 |
class CSIPSubscribeDialogAssoc : public CSIPDialogAssocBase
|
williamr@2
|
58 |
{
|
williamr@2
|
59 |
public: // Constructors and destructor
|
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 aEvent != 0
|
williamr@2
|
65 |
* @param aDialog a dialog to be associated with
|
williamr@2
|
66 |
* @param aEvent an event to subscribe to; the ownership is transferred
|
williamr@2
|
67 |
* @return New object; the ownership is transferred
|
williamr@2
|
68 |
* @leave KErrArgument if aEvent == 0
|
williamr@2
|
69 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
70 |
* object has been deleted
|
williamr@2
|
71 |
*/
|
williamr@2
|
72 |
IMPORT_C static CSIPSubscribeDialogAssoc*
|
williamr@2
|
73 |
NewL(CSIPDialog& aDialog,
|
williamr@2
|
74 |
CSIPEventHeader* aEvent);
|
williamr@2
|
75 |
|
williamr@2
|
76 |
/**
|
williamr@2
|
77 |
* Two-phased constructor.
|
williamr@2
|
78 |
* Must be used if response to the SIP request to be sent
|
williamr@2
|
79 |
* will create a SIP dialog association.
|
williamr@2
|
80 |
* @param aDialog a dialog to be associated with
|
williamr@2
|
81 |
* @param aEvent an event to subscribe to; the ownership is transferred
|
williamr@2
|
82 |
* @return New object, ownership is transferred
|
williamr@2
|
83 |
* @leave KErrArgument if aEvent == 0
|
williamr@2
|
84 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
85 |
* object has been deleted
|
williamr@2
|
86 |
*/
|
williamr@2
|
87 |
IMPORT_C static CSIPSubscribeDialogAssoc*
|
williamr@2
|
88 |
NewLC(CSIPDialog& aDialog,
|
williamr@2
|
89 |
CSIPEventHeader* aEvent);
|
williamr@2
|
90 |
|
williamr@2
|
91 |
/**
|
williamr@2
|
92 |
* Two-phased constructor
|
williamr@2
|
93 |
* @pre aFrom != 0
|
williamr@2
|
94 |
* @pre aRemoteUri != 0
|
williamr@2
|
95 |
* @pre aEvent != 0
|
williamr@2
|
96 |
* The user of the class must not define tags in From-header and
|
williamr@2
|
97 |
* To-header.
|
williamr@2
|
98 |
* @param aConnection a SIP connection to be used with
|
williamr@2
|
99 |
* dialog association
|
williamr@2
|
100 |
* @param aFrom originator's address; the ownership is transfered
|
williamr@2
|
101 |
* @param aRemoteUri a remote target URI that identifies a resource that
|
williamr@2
|
102 |
* the request is addressed to.
|
williamr@2
|
103 |
* @param aEvent an event to subscribe to; the ownership is transferred
|
williamr@2
|
104 |
* @param aTo logical recipient's address; if not defined
|
williamr@2
|
105 |
* the remote target uri will be used for To-header
|
williamr@2
|
106 |
* construction; the ownership is transfered
|
williamr@2
|
107 |
* @param aContact a contact to be used in dialog creation. Must be
|
williamr@2
|
108 |
* given only if user intends to re-direct future requests;
|
williamr@2
|
109 |
* the ownership is transfered
|
williamr@2
|
110 |
* @return New object; the ownership is transferred.
|
williamr@2
|
111 |
* @leave KErrArgument if aFrom == 0, aRemoteUri == 0 or aEvent == 0
|
williamr@2
|
112 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
113 |
* object has been deleted
|
williamr@2
|
114 |
*/
|
williamr@2
|
115 |
IMPORT_C static CSIPSubscribeDialogAssoc*
|
williamr@2
|
116 |
NewL(CSIPConnection& aConnection,
|
williamr@2
|
117 |
CSIPFromHeader* aFrom,
|
williamr@2
|
118 |
CUri8* aRemoteUri,
|
williamr@2
|
119 |
CSIPEventHeader* aEvent,
|
williamr@2
|
120 |
CSIPToHeader* aTo=0,
|
williamr@2
|
121 |
CSIPContactHeader* aContact=0);
|
williamr@2
|
122 |
|
williamr@2
|
123 |
/**
|
williamr@2
|
124 |
* Two-phased constructor
|
williamr@2
|
125 |
* @pre aFrom != 0
|
williamr@2
|
126 |
* @pre aRemoteUri != 0
|
williamr@2
|
127 |
* @pre aEvent != 0
|
williamr@2
|
128 |
* The user of the class must not define tags in From-header and
|
williamr@2
|
129 |
* To-header.
|
williamr@2
|
130 |
* @param aConnection a SIP connection to be used with
|
williamr@2
|
131 |
* dialog association
|
williamr@2
|
132 |
* @param aFrom originator's address; the ownership is transfered
|
williamr@2
|
133 |
* @param aRemoteUri a remote target URI that identifies a resource that
|
williamr@2
|
134 |
* the request is addressed to.
|
williamr@2
|
135 |
* @param aEvent an event to subscribe to; the ownership is transferred
|
williamr@2
|
136 |
* @param aTo logical recipient's address; if not defined
|
williamr@2
|
137 |
* the remote target uri will be used for To-header
|
williamr@2
|
138 |
* construction; the ownership is transfered
|
williamr@2
|
139 |
* @param aContact a contact to be used in dialog creation. Must be
|
williamr@2
|
140 |
* given only if user intends to re-direct future requests;
|
williamr@2
|
141 |
* the ownership is transfered
|
williamr@2
|
142 |
* @return New object; the ownership is transferred.
|
williamr@2
|
143 |
* @leave KErrArgument if aFrom == 0, aRemoteUri == 0 or aEvent == 0
|
williamr@2
|
144 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
145 |
* object has been deleted
|
williamr@2
|
146 |
*/
|
williamr@2
|
147 |
IMPORT_C static CSIPSubscribeDialogAssoc*
|
williamr@2
|
148 |
NewLC(CSIPConnection& aConnection,
|
williamr@2
|
149 |
CSIPFromHeader* aFrom,
|
williamr@2
|
150 |
CUri8* aRemoteUri,
|
williamr@2
|
151 |
CSIPEventHeader* aEvent,
|
williamr@2
|
152 |
CSIPToHeader* aTo =0,
|
williamr@2
|
153 |
CSIPContactHeader* aContact=0);
|
williamr@2
|
154 |
|
williamr@2
|
155 |
/**
|
williamr@2
|
156 |
* Two-phased constructor
|
williamr@2
|
157 |
* @pre aRemoteUri != 0
|
williamr@2
|
158 |
* @pre aEvent != 0
|
williamr@2
|
159 |
* The user of the class must not define tags in From-header
|
williamr@2
|
160 |
* and To-header.
|
williamr@2
|
161 |
* @pre aContext.IsContextActive()==ETrue
|
williamr@2
|
162 |
* @param aConnection a SIP connection to be used with
|
williamr@2
|
163 |
* dialog association
|
williamr@2
|
164 |
* @param aRemoteUri a remote target URI that identifies a resource that
|
williamr@2
|
165 |
* the request is targeted to.
|
williamr@2
|
166 |
* @param aContext used for selecting outbound
|
williamr@2
|
167 |
* proxy and originator's address (AOR) and contact
|
williamr@2
|
168 |
* @param aEvent an event to subscribe to; the ownership is transferred
|
williamr@2
|
169 |
* @param aFrom originator's address. If not defined it will be
|
williamr@2
|
170 |
* constructed using registration context (User's AOR);
|
williamr@2
|
171 |
* the ownership is transfered
|
williamr@2
|
172 |
* @param aTo logical recipient's address; if not defined
|
williamr@2
|
173 |
* the remote target uri will be used for To-header
|
williamr@2
|
174 |
* construction; the ownership is transfered
|
williamr@2
|
175 |
* @param aContact a contact to be used in dialog creation. Must be
|
williamr@2
|
176 |
* given only if user intends to re-direct future requests;
|
williamr@2
|
177 |
* the ownership is transfered
|
williamr@2
|
178 |
* @return New object; the ownership is transferred.
|
williamr@2
|
179 |
* @leave KErrArgument if aRemoteUri == 0 or aEvent == 0
|
williamr@2
|
180 |
* @leave KErrSIPInvalidRegistrationState
|
williamr@2
|
181 |
* if aContext.IsContextActive()==EFalse
|
williamr@2
|
182 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
183 |
* object has been deleted
|
williamr@2
|
184 |
*/
|
williamr@2
|
185 |
IMPORT_C static CSIPSubscribeDialogAssoc*
|
williamr@2
|
186 |
NewL(CSIPConnection& aConnection,
|
williamr@2
|
187 |
CUri8* aRemoteUri,
|
williamr@2
|
188 |
const MSIPRegistrationContext& aContext,
|
williamr@2
|
189 |
CSIPEventHeader* aEvent,
|
williamr@2
|
190 |
CSIPFromHeader* aFrom = 0,
|
williamr@2
|
191 |
CSIPToHeader* aTo = 0,
|
williamr@2
|
192 |
CSIPContactHeader* aContact = 0);
|
williamr@2
|
193 |
|
williamr@2
|
194 |
/**
|
williamr@2
|
195 |
* Two-phased constructor
|
williamr@2
|
196 |
* @pre aRemoteUri != 0
|
williamr@2
|
197 |
* @pre aEvent != 0
|
williamr@2
|
198 |
* The user of the class must not define tags in From-header
|
williamr@2
|
199 |
* and To-header.
|
williamr@2
|
200 |
* @pre aContext.IsContextActive()==ETrue
|
williamr@2
|
201 |
* @param aConnection a SIP connection to be used with
|
williamr@2
|
202 |
* dialog association
|
williamr@2
|
203 |
* @param aRemoteUri a remote target URI that identifies a resource that
|
williamr@2
|
204 |
* the request is targeted to.
|
williamr@2
|
205 |
* @param aContext used for selecting outbound
|
williamr@2
|
206 |
* proxy and originator's address (AOR) and contact
|
williamr@2
|
207 |
* @param aEvent an event to subscribe to; the ownership is transferred
|
williamr@2
|
208 |
* @param aFrom originator's address. If not defined it will be
|
williamr@2
|
209 |
* constructed using registration context (User's AOR);
|
williamr@2
|
210 |
* the ownership is transfered
|
williamr@2
|
211 |
* @param aTo logical recipient's address; if not defined
|
williamr@2
|
212 |
* the remote target uri will be used for To-header
|
williamr@2
|
213 |
* construction; the ownership is transfered
|
williamr@2
|
214 |
* @param aContact a contact to be used in dialog creation. Must be
|
williamr@2
|
215 |
* given only if user intends to re-direct future requests;
|
williamr@2
|
216 |
* the ownership is transfered
|
williamr@2
|
217 |
* @return New object; the ownership is transferred.
|
williamr@2
|
218 |
* @leave KErrArgument if aRemoteUri == 0 or aEvent == 0
|
williamr@2
|
219 |
* @leave KErrSIPInvalidRegistrationState
|
williamr@2
|
220 |
* if aContext.IsContextActive()==EFalse
|
williamr@2
|
221 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
222 |
* object has been deleted
|
williamr@2
|
223 |
*/
|
williamr@2
|
224 |
IMPORT_C static CSIPSubscribeDialogAssoc*
|
williamr@2
|
225 |
NewLC(CSIPConnection& aConnection,
|
williamr@2
|
226 |
CUri8* aRemoteUri,
|
williamr@2
|
227 |
const MSIPRegistrationContext& aContext,
|
williamr@2
|
228 |
CSIPEventHeader* aEvent,
|
williamr@2
|
229 |
CSIPFromHeader* aFrom = 0,
|
williamr@2
|
230 |
CSIPToHeader* aTo = 0,
|
williamr@2
|
231 |
CSIPContactHeader* aContact = 0);
|
williamr@2
|
232 |
|
williamr@2
|
233 |
/**
|
williamr@2
|
234 |
* Destructor
|
williamr@2
|
235 |
*/
|
williamr@2
|
236 |
IMPORT_C ~CSIPSubscribeDialogAssoc();
|
williamr@2
|
237 |
|
williamr@2
|
238 |
public: //New functions
|
williamr@2
|
239 |
/**
|
williamr@2
|
240 |
* Creates SUBSCRIBE and sends it to the remote target.
|
williamr@2
|
241 |
* 101-199 or 2xx response to SUBSCRIBE will create a dialog association
|
williamr@2
|
242 |
* in case of the first SUBSCRIBE request within this dialog.
|
williamr@2
|
243 |
* Client must not provide Event-header in the optional message headers.
|
williamr@2
|
244 |
*
|
williamr@2
|
245 |
* @pre Dialog().Connection().State()==EActive
|
williamr@2
|
246 |
* @pre Dialog().State()==CSIPDialog::EInit ||
|
williamr@2
|
247 |
* Dialog().State()==CSIPDialog::EConfirmed
|
williamr@2
|
248 |
* @param aElements optional SIP message headers and body. Ownership is
|
williamr@2
|
249 |
* transferred.
|
williamr@2
|
250 |
* @param aRefresh if set the transaction will be refreshed at given
|
williamr@2
|
251 |
* interval. Interval must be defined by including
|
williamr@2
|
252 |
* Expires-header. Ownership is transferred.
|
williamr@2
|
253 |
* @return SUBSCRIBE SIP transaction. Ownership is transferred.
|
williamr@2
|
254 |
* @leave KErrSIPInvalidDialogState if Dialog().State() is incorrect
|
williamr@2
|
255 |
* @capability NetworkServices
|
williamr@2
|
256 |
*/
|
williamr@2
|
257 |
IMPORT_C CSIPClientTransaction*
|
williamr@2
|
258 |
SendSubscribeL(CSIPMessageElements* aElements=0,
|
williamr@2
|
259 |
CSIPRefresh* aRefresh=0);
|
williamr@2
|
260 |
|
williamr@2
|
261 |
/**
|
williamr@2
|
262 |
* Updates the subscription. Note that update can be done when 2xx
|
williamr@2
|
263 |
* response is received to the initial SUBSCRIBE or to update.
|
williamr@2
|
264 |
* Client must not provide Event-header in the optional message headers.
|
williamr@2
|
265 |
* @pre aElements != 0
|
williamr@2
|
266 |
* @pre Dialog().Connection().State()==EActive
|
williamr@2
|
267 |
* Dialog().State()==CSIPDialog::EConfirmed
|
williamr@2
|
268 |
* @param aElements contains user SIP headers and content; the ownership
|
williamr@2
|
269 |
* is transferred
|
williamr@2
|
270 |
* @return SUBSCRIBE SIP client transaction; the ownership is transferred
|
williamr@2
|
271 |
* @leave KErrArgument if aElements == 0 or aElements contain
|
williamr@2
|
272 |
* Event-header
|
williamr@2
|
273 |
* @leave KErrSIPInvalidDialogState if Dialog().State() is incorrect
|
williamr@2
|
274 |
* @capability NetworkServices
|
williamr@2
|
275 |
*/
|
williamr@2
|
276 |
IMPORT_C CSIPClientTransaction* UpdateL(CSIPMessageElements* aElements);
|
williamr@2
|
277 |
|
williamr@2
|
278 |
/**
|
williamr@2
|
279 |
* Creates (un)SUBSCRIBE and sends it to the remote target.
|
williamr@2
|
280 |
* Possible associated refresh will be terminated as well.
|
williamr@2
|
281 |
* Client must not provide Event-header in the optional message headers.
|
williamr@2
|
282 |
* @pre Dialog().Connection().State()==EActive
|
williamr@2
|
283 |
* @pre Dialog().State()==CSIPDialog::EConfirmed
|
williamr@2
|
284 |
* @param aElements optional SIP message headers and body. Ownership is
|
williamr@2
|
285 |
* transferred.
|
williamr@2
|
286 |
* @return SUBSCRIBE SIP transaction. Ownership is transferred.
|
williamr@2
|
287 |
* @leave KErrSIPInvalidDialogState if Dialog().State() is incorrect
|
williamr@2
|
288 |
* @capability NetworkServices
|
williamr@2
|
289 |
*/
|
williamr@2
|
290 |
IMPORT_C CSIPClientTransaction*
|
williamr@2
|
291 |
SendUnsubscribeL(CSIPMessageElements* aElements=0);
|
williamr@2
|
292 |
|
williamr@2
|
293 |
/**
|
williamr@2
|
294 |
* Gets associated refresh in case the user has requested
|
williamr@2
|
295 |
* the refresh of the SIP subscription.
|
williamr@2
|
296 |
* Note that refreshed SUBSCRIBE dialog association cannot be
|
williamr@2
|
297 |
* terminated nor updated using the returned object.
|
williamr@2
|
298 |
* @return Associated refresh or 0 pointer if the user has not requested
|
williamr@2
|
299 |
* a refresh. Ownership is not transferred.
|
williamr@2
|
300 |
*/
|
williamr@2
|
301 |
IMPORT_C const CSIPRefresh* SIPRefresh() const;
|
williamr@2
|
302 |
|
williamr@2
|
303 |
/**
|
williamr@2
|
304 |
* Gets an event to which the subscription is done
|
williamr@2
|
305 |
* @return an event
|
williamr@2
|
306 |
*/
|
williamr@2
|
307 |
IMPORT_C const CSIPEventHeader& Event() const;
|
williamr@2
|
308 |
|
williamr@2
|
309 |
public: // New functions, for internal use
|
williamr@2
|
310 |
|
williamr@2
|
311 |
/**
|
williamr@2
|
312 |
* @internalComponent
|
williamr@2
|
313 |
*/
|
williamr@2
|
314 |
CSIPRefresh* FindRefresh(TUint32 aRefreshId);
|
williamr@2
|
315 |
|
williamr@2
|
316 |
static CSIPSubscribeDialogAssoc* NewLC(CSIPConnection& aConnection,
|
williamr@2
|
317 |
CUri8* aRemoteUri,
|
williamr@2
|
318 |
CSIPEventHeader* aEvent,
|
williamr@2
|
319 |
CSIPFromHeader* aFrom,
|
williamr@2
|
320 |
CSIPToHeader* aTo,
|
williamr@2
|
321 |
CSIPContactHeader* aContact,
|
williamr@2
|
322 |
const MSIPRegistrationContext* aContext);
|
williamr@2
|
323 |
|
williamr@2
|
324 |
void ConnectionLost();
|
williamr@2
|
325 |
|
williamr@2
|
326 |
CSIPClientTransaction*
|
williamr@2
|
327 |
DoSendSubscribeL(CSIPMessageElements* aElements,
|
williamr@2
|
328 |
CSIPRefresh* aRefresh,
|
williamr@2
|
329 |
TBool aWithinDialog);
|
williamr@2
|
330 |
|
williamr@2
|
331 |
CSIPClientTransaction*
|
williamr@2
|
332 |
DoSendUnsubscribeL(CSIPMessageElements* aElements);
|
williamr@2
|
333 |
|
williamr@2
|
334 |
/**
|
williamr@2
|
335 |
* @internalComponent
|
williamr@2
|
336 |
*/
|
williamr@2
|
337 |
void DeletingRefresh(CSIPRefresh& aRefresh, TUint32 aRefreshId);
|
williamr@2
|
338 |
|
williamr@2
|
339 |
private: // Constructors
|
williamr@2
|
340 |
CSIPSubscribeDialogAssoc();
|
williamr@2
|
341 |
|
williamr@2
|
342 |
private: // Data
|
williamr@2
|
343 |
//If the subscription is refreshed, this is the used CSIPRefresh
|
williamr@2
|
344 |
//instance, otherwise this is NULL. CSIPSubscribeDialogAssoc owns this.
|
williamr@2
|
345 |
CSIPRefresh* iRefresh;
|
williamr@2
|
346 |
|
williamr@2
|
347 |
CSIPEventHeader* iEvent;
|
williamr@2
|
348 |
|
williamr@2
|
349 |
private: // For testing purposes
|
williamr@4
|
350 |
#ifdef CPPUNIT_TEST
|
williamr@4
|
351 |
friend class CSIP_Test;
|
williamr@4
|
352 |
friend class CSIPSubscribeDialogAssoc_Test;
|
williamr@4
|
353 |
#endif
|
williamr@2
|
354 |
};
|
williamr@2
|
355 |
|
williamr@2
|
356 |
#endif
|