williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2006-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 : sipregistrationbinding.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 CSIPREGISTRATIONBINDING_H
|
williamr@2
|
25 |
#define CSIPREGISTRATIONBINDING_H
|
williamr@2
|
26 |
|
williamr@2
|
27 |
// INCLUDES
|
williamr@2
|
28 |
#include "sipregistrationcontext.h"
|
williamr@2
|
29 |
#include "_sipcodecdefs.h"
|
williamr@2
|
30 |
|
williamr@2
|
31 |
// FORWARD DECLARATIONS
|
williamr@2
|
32 |
class CUri8;
|
williamr@2
|
33 |
class CSIPToHeader;
|
williamr@2
|
34 |
class CSIPFromHeader;
|
williamr@2
|
35 |
class CSIPContactHeader;
|
williamr@2
|
36 |
class CSIPRouteHeader;
|
williamr@2
|
37 |
class CSIPMessageElements;
|
williamr@2
|
38 |
class CSIPConnection;
|
williamr@2
|
39 |
class CSIPRefresh;
|
williamr@2
|
40 |
class CSIPClientTransaction;
|
williamr@2
|
41 |
class CRegBindingImplementation;
|
williamr@2
|
42 |
|
williamr@2
|
43 |
// CLASS DECLARATION
|
williamr@2
|
44 |
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
* @publishedAll
|
williamr@2
|
47 |
* @released
|
williamr@2
|
48 |
*
|
williamr@2
|
49 |
* Class for managing SIP registration binding.
|
williamr@2
|
50 |
* Class provides functions for creating and updating SIP registration bindings.
|
williamr@2
|
51 |
*
|
williamr@2
|
52 |
* @lib sipclient.lib
|
williamr@2
|
53 |
*/
|
williamr@2
|
54 |
class CSIPRegistrationBinding :
|
williamr@2
|
55 |
public CBase,
|
williamr@2
|
56 |
public MSIPRegistrationContext
|
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 |
* @pre aAor != 0 &&
|
williamr@2
|
63 |
* aContact != 0
|
williamr@2
|
64 |
* @pre "Expires" parameter in aContact must be >= KSIPMinExpirationValue
|
williamr@2
|
65 |
* @param aConnection a SIP connection to be used
|
williamr@2
|
66 |
* @param aAor contains user's address-of-record to register;
|
williamr@2
|
67 |
* the ownership is transfered
|
williamr@2
|
68 |
* @param aContact contact(s) to be registered. The "expires" parameter
|
williamr@2
|
69 |
* indicates how long the client would like the binding to be
|
williamr@2
|
70 |
* valid.
|
williamr@2
|
71 |
* "expires" parameter value must be >= KSIPMinExpirationValue;
|
williamr@2
|
72 |
* the ownership is transfered
|
williamr@2
|
73 |
* @param aRefresh if set, created binding will be refreshed;
|
williamr@2
|
74 |
* the ownership is transfered
|
williamr@2
|
75 |
* @param aOutboundProxy an outbound proxy address;
|
williamr@2
|
76 |
* the ownership is transfered
|
williamr@2
|
77 |
* @param aRemoteUri if set, will be used in request-uri construction;
|
williamr@2
|
78 |
* the ownership is transfered
|
williamr@2
|
79 |
* @param aFrom From header, the ownership is transferred
|
williamr@2
|
80 |
* @return New object, ownership is transferred.
|
williamr@2
|
81 |
* @leave KErrArgument if aAor == 0, aContact == 0 or if "Expires"
|
williamr@2
|
82 |
* parameter in aContact is less than KSIPMinExpirationValue
|
williamr@2
|
83 |
*/
|
williamr@2
|
84 |
IMPORT_C static CSIPRegistrationBinding*
|
williamr@2
|
85 |
NewL(CSIPConnection& aConnection,
|
williamr@2
|
86 |
CSIPToHeader* aAor,
|
williamr@2
|
87 |
CSIPContactHeader* aContact,
|
williamr@2
|
88 |
CSIPRefresh* aRefresh=0,
|
williamr@2
|
89 |
CSIPRouteHeader* aOutboundProxy=0,
|
williamr@2
|
90 |
CUri8* aRemoteUri=0,
|
williamr@2
|
91 |
CSIPFromHeader* aFrom=0);
|
williamr@2
|
92 |
|
williamr@2
|
93 |
/**
|
williamr@2
|
94 |
* Two-phased constructor.
|
williamr@2
|
95 |
* @pre aAor != 0 &&
|
williamr@2
|
96 |
* aContact != 0
|
williamr@2
|
97 |
* @pre "Expires" parameter in aContact must be >= KSIPMinExpirationValue
|
williamr@2
|
98 |
* @param aConnection a SIP connection to be used
|
williamr@2
|
99 |
* @param aAor contains user's address-of-record to register;
|
williamr@2
|
100 |
* the ownership is transfered
|
williamr@2
|
101 |
* @param aContact contact to be registered; The "expires" parameter
|
williamr@2
|
102 |
* indicates how long the client would like the binding to be
|
williamr@2
|
103 |
* valid.
|
williamr@2
|
104 |
* "expires" parameter value must be >= KSIPMinExpirationValue;
|
williamr@2
|
105 |
* the ownership is transfered
|
williamr@2
|
106 |
* @param aRefresh if set, created binding will be refreshed;
|
williamr@2
|
107 |
* the ownership is transfered
|
williamr@2
|
108 |
* @param aOutboundProxy an outbound proxy address;
|
williamr@2
|
109 |
* the ownership is transfered
|
williamr@2
|
110 |
* @param aRemoteUri if set, will be used in request-uri construction;
|
williamr@2
|
111 |
* the ownership is transfered
|
williamr@2
|
112 |
* @param aFrom From header, the ownership is transferred
|
williamr@2
|
113 |
* @return New object, ownership is transferred.
|
williamr@2
|
114 |
* @leave KErrArgument if aAor == 0, aContact == 0 or if "Expires"
|
williamr@2
|
115 |
* parameter in aContact is less than KSIPMinExpirationValue
|
williamr@2
|
116 |
*/
|
williamr@2
|
117 |
IMPORT_C static CSIPRegistrationBinding*
|
williamr@2
|
118 |
NewLC(CSIPConnection& aConnection,
|
williamr@2
|
119 |
CSIPToHeader* aAor,
|
williamr@2
|
120 |
CSIPContactHeader* aContact,
|
williamr@2
|
121 |
CSIPRefresh* aRefresh=0,
|
williamr@2
|
122 |
CSIPRouteHeader* aOutboundProxy=0,
|
williamr@2
|
123 |
CUri8* aRemoteUri=0,
|
williamr@2
|
124 |
CSIPFromHeader* aFrom=0);
|
williamr@2
|
125 |
|
williamr@2
|
126 |
/**
|
williamr@2
|
127 |
* Destructor
|
williamr@2
|
128 |
*/
|
williamr@2
|
129 |
IMPORT_C ~CSIPRegistrationBinding();
|
williamr@2
|
130 |
|
williamr@2
|
131 |
public: //From MSIPRegistrationContext:
|
williamr@2
|
132 |
|
williamr@2
|
133 |
/**
|
williamr@2
|
134 |
* Checks if the registration context can be
|
williamr@2
|
135 |
* used for creating SIP messages/dialogs
|
williamr@2
|
136 |
* @return ETrue if the registration binding exists; EFalse
|
williamr@2
|
137 |
* otherwise
|
williamr@2
|
138 |
*/
|
williamr@2
|
139 |
IMPORT_C TBool IsContextActive() const;
|
williamr@2
|
140 |
|
williamr@2
|
141 |
/**
|
williamr@2
|
142 |
* Gets the context id
|
williamr@2
|
143 |
* @return context id
|
williamr@2
|
144 |
* For internal use only
|
williamr@2
|
145 |
*/
|
williamr@2
|
146 |
IMPORT_C TUint32 ContextId() const;
|
williamr@2
|
147 |
|
williamr@2
|
148 |
public: // New functions
|
williamr@2
|
149 |
/**
|
williamr@2
|
150 |
* Creates SIP REGISTER request, sends it to the given destination.
|
williamr@2
|
151 |
* Received 2xx response will create at least one registration
|
williamr@2
|
152 |
* binding.
|
williamr@2
|
153 |
* @pre Connection().State()==EActive
|
williamr@2
|
154 |
* @param aElements contains user SIP headers and content; the ownership
|
williamr@2
|
155 |
* is taken
|
williamr@2
|
156 |
* @return SIP REGISTER transaction; the ownership is transfered
|
williamr@2
|
157 |
* @leave KErrSIPMalformedMessage if aElements contains contact or
|
williamr@2
|
158 |
* expires headers
|
williamr@2
|
159 |
* @leave KErrSIPInvalidRegistrationState if already registered or
|
williamr@2
|
160 |
* registering is in progress or deregistering is in progress.
|
williamr@2
|
161 |
* @capability NetworkServices
|
williamr@2
|
162 |
*/
|
williamr@2
|
163 |
IMPORT_C CSIPClientTransaction*
|
williamr@2
|
164 |
RegisterL(CSIPMessageElements* aElements=0);
|
williamr@2
|
165 |
|
williamr@2
|
166 |
/**
|
williamr@2
|
167 |
* Creates SIP (de)REGISTER request, sends it to the given destination.
|
williamr@2
|
168 |
* This function will remove registration binding.
|
williamr@2
|
169 |
* Any SIP response (2xx - 6xx) to this request removes the binding.
|
williamr@2
|
170 |
* Note that deregistration can be done then the 2xx is received to the
|
williamr@2
|
171 |
* initial REGISTER transaction and there is no on-going registration
|
williamr@2
|
172 |
* updates.
|
williamr@2
|
173 |
* @pre Connection().State()==EActive
|
williamr@2
|
174 |
* @pre IsContextActive()==ETrue
|
williamr@2
|
175 |
* @param aElements contains user SIP headers and content; the ownership
|
williamr@2
|
176 |
* is transfered. If set, user SIP headers must not contain any
|
williamr@2
|
177 |
* Contact-header nor Expires-header
|
williamr@2
|
178 |
* @return SIP REGISTER transaction; the ownership is transfered
|
williamr@2
|
179 |
* @leave KErrSIPInvalidRegistrationState if IsContextActive()==EFalse
|
williamr@2
|
180 |
* @capability NetworkServices
|
williamr@2
|
181 |
*/
|
williamr@2
|
182 |
IMPORT_C CSIPClientTransaction*
|
williamr@2
|
183 |
DeregisterL(CSIPMessageElements* aElements=0);
|
williamr@2
|
184 |
|
williamr@2
|
185 |
/**
|
williamr@2
|
186 |
* Updates the registration binding. Note that update can be done
|
williamr@2
|
187 |
* then the 2xx is received to the REGISTER transaction that relates
|
williamr@2
|
188 |
* to the initial registration or to update.
|
williamr@2
|
189 |
* @pre aElements!=0
|
williamr@2
|
190 |
* @pre Connection().State()==EActive
|
williamr@2
|
191 |
* @pre IsContextActive()==ETrue
|
williamr@2
|
192 |
* @param aElements contains user SIP header and content, must not
|
williamr@2
|
193 |
* contain any Contact-header nor Expires-header;
|
williamr@2
|
194 |
* the ownership is transferred.
|
williamr@2
|
195 |
* @return SIP REGISTER transaction; the ownership is transfered
|
williamr@2
|
196 |
* @leave KErrArgument if aElements == NULL
|
williamr@2
|
197 |
* @leave KErrSIPInvalidRegistrationState if IsContextActive()==EFalse
|
williamr@2
|
198 |
* @capability NetworkServices
|
williamr@2
|
199 |
*/
|
williamr@2
|
200 |
IMPORT_C CSIPClientTransaction* UpdateL(CSIPMessageElements* aElements);
|
williamr@2
|
201 |
|
williamr@2
|
202 |
/**
|
williamr@2
|
203 |
* Updates the regisration binding. Note that update can be done
|
williamr@2
|
204 |
* then the 2xx is received to the REGISTER transaction that relates
|
williamr@2
|
205 |
* to the initial registration or to update.
|
williamr@2
|
206 |
* @pre aExpirationValue >= KSIPMinExpirationValue
|
williamr@2
|
207 |
* @pre Connection().State()==EActive
|
williamr@2
|
208 |
* @pre IsContextActive()==ETrue
|
williamr@2
|
209 |
* @param aExpirationValue a new expiration value in seconds
|
williamr@2
|
210 |
* @param aElements contains user SIP headers and content; must not
|
williamr@2
|
211 |
* contain any Contact-header nor Expires-header;
|
williamr@2
|
212 |
* the ownership is transferred.
|
williamr@2
|
213 |
* @return SIP REGISTER transaction; the ownership is transfered
|
williamr@2
|
214 |
* @leave KErrSIPInvalidRegistrationState if IsContextActive()==EFalse
|
williamr@2
|
215 |
* @capability NetworkServices
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
IMPORT_C CSIPClientTransaction*
|
williamr@2
|
218 |
UpdateL(TUint aExpirationValue, CSIPMessageElements* aElements=0);
|
williamr@2
|
219 |
|
williamr@2
|
220 |
/**
|
williamr@2
|
221 |
* Gets the SIP connection used for the registration.
|
williamr@2
|
222 |
* @return SIP connection used for the registration, or 0-pointer if the
|
williamr@2
|
223 |
* connection has been deleted. Ownership is not transferred.
|
williamr@2
|
224 |
*/
|
williamr@2
|
225 |
IMPORT_C CSIPConnection* Connection();
|
williamr@2
|
226 |
|
williamr@2
|
227 |
/**
|
williamr@2
|
228 |
* Gets the SIP connection used for the registration.
|
williamr@2
|
229 |
* @return SIP connection used for the registration, or 0-pointer if the
|
williamr@2
|
230 |
* connection has been deleted. Ownership is not transferred.
|
williamr@2
|
231 |
*/
|
williamr@2
|
232 |
IMPORT_C const CSIPConnection* Connection() const;
|
williamr@2
|
233 |
|
williamr@2
|
234 |
/**
|
williamr@2
|
235 |
* Sets/resets outbound proxy.
|
williamr@2
|
236 |
* If a 0-pointer is given the outbound proxy will be reset.
|
williamr@2
|
237 |
* @param aOutboundProxy an outbound proxy. Ownership is transferred.
|
williamr@2
|
238 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
239 |
* object has been deleted
|
williamr@2
|
240 |
*/
|
williamr@2
|
241 |
IMPORT_C void SetOutboundProxyL(CSIPRouteHeader* aOutboundProxy);
|
williamr@2
|
242 |
|
williamr@2
|
243 |
/**
|
williamr@2
|
244 |
* Gets the address-of-record (AOR) used for creating binding
|
williamr@2
|
245 |
* @return address-of-record (AOR)
|
williamr@2
|
246 |
*/
|
williamr@2
|
247 |
IMPORT_C const CSIPToHeader& Aor() const;
|
williamr@2
|
248 |
|
williamr@2
|
249 |
/**
|
williamr@2
|
250 |
* Gets Contact header associated with the registration binding
|
williamr@2
|
251 |
* @return Contact header
|
williamr@2
|
252 |
*/
|
williamr@2
|
253 |
IMPORT_C const CSIPContactHeader& ContactHeader() const;
|
williamr@2
|
254 |
|
williamr@2
|
255 |
/**
|
williamr@2
|
256 |
* Gets Contact header associated with the registration binding
|
williamr@2
|
257 |
* @return Contact header
|
williamr@2
|
258 |
*/
|
williamr@2
|
259 |
IMPORT_C CSIPContactHeader& ContactHeader();
|
williamr@2
|
260 |
|
williamr@2
|
261 |
/**
|
williamr@2
|
262 |
* Gets used outbound proxy
|
williamr@2
|
263 |
* @return outbound proxy or a 0-pointer if not set. Ownership is not
|
williamr@2
|
264 |
* transferred.
|
williamr@2
|
265 |
*/
|
williamr@2
|
266 |
IMPORT_C const CSIPRouteHeader* OutboundProxy() const;
|
williamr@2
|
267 |
|
williamr@2
|
268 |
/**
|
williamr@2
|
269 |
* Gets associated refresh in case the user has requested the refresh of
|
williamr@2
|
270 |
* the registration. Note that client cannot use update or terminate
|
williamr@2
|
271 |
* functions defined in the CSIPRefresh class.
|
williamr@2
|
272 |
* @return Associated refresh or a 0-pointer if the user has not
|
williamr@2
|
273 |
* requested a refresh of registration binding. Ownership is not
|
williamr@2
|
274 |
* transferred.
|
williamr@2
|
275 |
*/
|
williamr@2
|
276 |
IMPORT_C const CSIPRefresh* SIPRefresh() const;
|
williamr@2
|
277 |
|
williamr@2
|
278 |
/**
|
williamr@2
|
279 |
* Gets associated refresh in case the user has requested the refresh of
|
williamr@2
|
280 |
* the registration. Note that client cannot use update or terminate
|
williamr@2
|
281 |
* functions defined in the CSIPRefresh class.
|
williamr@2
|
282 |
* @return Associated refresh or a 0-pointer if the user has not
|
williamr@2
|
283 |
* requested a refresh of registration binding. Ownership is not
|
williamr@2
|
284 |
* transferred.
|
williamr@2
|
285 |
*/
|
williamr@2
|
286 |
IMPORT_C CSIPRefresh* SIPRefresh();
|
williamr@2
|
287 |
|
williamr@2
|
288 |
/**
|
williamr@2
|
289 |
* Compares this object to another object
|
williamr@2
|
290 |
* @param aRegistration CSIPRegistrationBinding object to compare
|
williamr@2
|
291 |
* @return ETrue if the objects are equal, otherwise EFalse
|
williamr@2
|
292 |
*/
|
williamr@2
|
293 |
IMPORT_C TBool
|
williamr@2
|
294 |
operator==(const CSIPRegistrationBinding& aRegistration) const;
|
williamr@2
|
295 |
|
williamr@2
|
296 |
/**
|
williamr@2
|
297 |
* Gets the registered Contact-header received in the 200 OK response.
|
williamr@2
|
298 |
* @return Contact header, or NULL if IsContextActive() is EFalse.
|
williamr@2
|
299 |
* Ownership is not transferred.
|
williamr@2
|
300 |
*/
|
williamr@2
|
301 |
IMPORT_C const CSIPContactHeader* RegisteredContact() const;
|
williamr@2
|
302 |
|
williamr@2
|
303 |
public: // New functions, for internal use
|
williamr@2
|
304 |
/**
|
williamr@2
|
305 |
* Returns the implementation instance.
|
williamr@2
|
306 |
*
|
williamr@2
|
307 |
* @return CRegBindingImplementation
|
williamr@2
|
308 |
*/
|
williamr@2
|
309 |
CRegBindingImplementation& Implementation();
|
williamr@2
|
310 |
|
williamr@2
|
311 |
private: // Constructors
|
williamr@2
|
312 |
CSIPRegistrationBinding();
|
williamr@2
|
313 |
|
williamr@2
|
314 |
void ConstructL(CSIPConnection& aConnection,
|
williamr@2
|
315 |
CSIPToHeader* aAor,
|
williamr@2
|
316 |
CSIPContactHeader* aContacts,
|
williamr@2
|
317 |
CSIPRefresh* aRefresh,
|
williamr@2
|
318 |
CSIPRouteHeader* aOutboundProxy,
|
williamr@2
|
319 |
CUri8* aRemoteUri,
|
williamr@2
|
320 |
CSIPFromHeader* aFrom);
|
williamr@2
|
321 |
|
williamr@2
|
322 |
private: // Data
|
williamr@2
|
323 |
CRegBindingImplementation* iImplementation;
|
williamr@2
|
324 |
|
williamr@2
|
325 |
private: // For testing purposes
|
williamr@2
|
326 |
|
williamr@2
|
327 |
UNIT_TEST(CSIP_Test)
|
williamr@2
|
328 |
UNIT_TEST(CSIPRegistrationBinding_Test)
|
williamr@2
|
329 |
UNIT_TEST(CSIPInviteDialogAssoc_Test)
|
williamr@2
|
330 |
UNIT_TEST(CSIPSubscribeDialogAssoc_Test)
|
williamr@2
|
331 |
UNIT_TEST(CSIPReferDialogAssoc_Test)
|
williamr@2
|
332 |
|
williamr@2
|
333 |
__DECLARE_TEST;
|
williamr@2
|
334 |
};
|
williamr@2
|
335 |
|
williamr@2
|
336 |
#endif
|