28
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_SCPPPROFILEHANDLER_H
|
|
20 |
#define C_SCPPPROFILEHANDLER_H
|
|
21 |
|
|
22 |
#include <sipprofileregistryobserver.h>
|
|
23 |
#include <sipconnectionobserver.h>
|
|
24 |
#include <sipobserver.h>
|
|
25 |
#include <sipprofilealrobserver.h>
|
|
26 |
|
|
27 |
#include "scpsipconnectionobserver.h"
|
|
28 |
#include "scpalrobserver.h"
|
|
29 |
#include "scpdefs.h"
|
|
30 |
#include "scpsipconnection.h"
|
|
31 |
#include "scpalrobserver.h"
|
|
32 |
|
|
33 |
class CSIP;
|
|
34 |
class CSIPProfileRegistry;
|
|
35 |
class CSIPManagedProfileRegistry;
|
|
36 |
class CSIPManagedProfile;
|
|
37 |
class CSipProfileAlrController;
|
|
38 |
class CScpSipConnection;
|
|
39 |
class MIpVmbxObserver;
|
|
40 |
class CIpVmbxInterface;
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Register/unregister protocol profiles.
|
|
44 |
*
|
|
45 |
* @lib sipconnectionprovider.dll
|
|
46 |
* @since Series 60 3.2
|
|
47 |
*/
|
|
48 |
class CScpProfileHandler : public CBase,
|
|
49 |
public MSIPProfileRegistryObserver,
|
|
50 |
public MSIPObserver,
|
|
51 |
public MSipProfileAlrObserver,
|
|
52 |
public MScpSipConnectionObserver
|
|
53 |
{
|
|
54 |
public:
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Enumeration for ALR events.
|
|
58 |
*/
|
|
59 |
enum TAlrEvent
|
|
60 |
{
|
|
61 |
EScpAlrAllowMigration,
|
|
62 |
EScpAlrDisallowMigration,
|
|
63 |
EScpAlrRefresh
|
|
64 |
};
|
|
65 |
|
|
66 |
public: // Constructors and destructor
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Two-phased constructor.
|
|
70 |
*/
|
|
71 |
static CScpProfileHandler* NewL();
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Destructor.
|
|
75 |
*/
|
|
76 |
virtual ~CScpProfileHandler();
|
|
77 |
|
|
78 |
public:
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Adds Sip profile observer.
|
|
82 |
* @param aObserver SIP profile observer.
|
|
83 |
*/
|
|
84 |
void AddObserverL( MScpSipConnectionObserver& aObserver );
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Remove observer from the array.
|
|
88 |
* @param aObserver SIP profile observer.
|
|
89 |
* @return KErrNone If succeed.
|
|
90 |
*/
|
|
91 |
TInt RemoveObserver( MScpSipConnectionObserver& aObserver );
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Get current state of scp connection having given sip profile id
|
|
95 |
* @param aProfileId SIP profile id.
|
|
96 |
* @param aState Current state.
|
|
97 |
* @return KErrNone if succeed.
|
|
98 |
*/
|
|
99 |
TInt GetCurrentState( TUint32 aProfileId,
|
|
100 |
CScpSipConnection::TConnectionState& aState,
|
|
101 |
TInt& aError ) const;
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Register profile to SIP.
|
|
105 |
* @param aProfileId SIP Profile id to register.
|
|
106 |
* @return Symbian error codes.
|
|
107 |
*/
|
|
108 |
void RegisterProfileL( TUint32 aProfileId );
|
|
109 |
|
|
110 |
/**
|
|
111 |
* UnRegister profile to SIP.
|
|
112 |
* @param aProfileId SIP Profile id to unregister.
|
|
113 |
* @return Symbian error codes.
|
|
114 |
*/
|
|
115 |
TInt UnregisterProfile( TUint32 aProfileId );
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Cancels any ongoing registration
|
|
119 |
* @param aProfileId SIP Profile id to unregister.
|
|
120 |
* @return Symbian error codes.
|
|
121 |
*/
|
|
122 |
TInt CancelRegistration( TUint32 aProfileId );
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Return existence info of profile id.
|
|
126 |
* @param aProfileId Protocol profile id.
|
|
127 |
* @return ETrue if profile exist.
|
|
128 |
*/
|
|
129 |
TBool ProfileExists( TUint32 aProfileId ) const;
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Uses SIP ALR controller for ALR events.
|
|
133 |
* @param aProfileId Profile id.
|
|
134 |
* @param aEvent New ALR event.
|
|
135 |
* @param aIapId IAP id.
|
|
136 |
*/
|
|
137 |
void DoAlrEventL( TUint32 aProfileId,
|
|
138 |
TAlrEvent aEvent,
|
|
139 |
TUint32 aIapId = NULL );
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Checks if sip connection for give profile id exists
|
|
143 |
* @param aProfileId Profile id.
|
|
144 |
* @return ETrue if exists
|
|
145 |
*/
|
|
146 |
TBool SipConnectionExists( TUint32 aProfileId ) const;
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Gets a asip connection for given profile id
|
|
150 |
* @param aProfileId Profile id.
|
|
151 |
* @return Sip connection. Ownership is not transferred.
|
|
152 |
*/
|
|
153 |
CScpSipConnection* GetSipConnection( TUint32 aProfileId ) const;
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Creates a sip connection for given profile id
|
|
157 |
* @param aProfileId Profile id.
|
|
158 |
* @return Sip connection. Ownership is transferred.
|
|
159 |
*/
|
|
160 |
CScpSipConnection* CreateSipConnectionL( TUint32 aProfileId ) const;
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Sets a sip profile reserved state
|
|
164 |
* @param aProfileId Sip profile id
|
|
165 |
* @param aReserved Reserved
|
|
166 |
*/
|
|
167 |
void SetSipProfileReserved( TUint32 aProfileId, TBool aReserved );
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Return VMBX service provider interface
|
|
171 |
* @param aObserver VMBX service provider observer
|
|
172 |
* @return Interface
|
|
173 |
*/
|
|
174 |
CIpVmbxInterface& VmbxInterfaceL( MIpVmbxObserver& aObserver );
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Delete VMBX service provider interface, there is no other way to remove
|
|
178 |
* MIpVmbxObserver. Observer has to remove when deleting vmbx subservice.
|
|
179 |
*/
|
|
180 |
void DeleteVmbxInterface();
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Checks if a sip profile requires update
|
|
184 |
* @param aProfileId SIP profile ID
|
|
185 |
* @param aTerminalType indicates is terminal type defined
|
|
186 |
* @param aWlanMac indicates is wlan mac defined
|
|
187 |
* @param aStringLength length of free string
|
|
188 |
*/
|
|
189 |
void UpdateSipProfileL( TUint32 aProfileId, TBool aTerminalType,
|
|
190 |
TBool aWlanMac, TInt astringLength );
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Set username and/or passowrd.
|
|
194 |
* @param aProfileId Profile id to use.
|
|
195 |
* @param aUsername to set
|
|
196 |
* @param aSetUsername If true, set username.
|
|
197 |
* @param aPassword Password to set.
|
|
198 |
* @param aSetPassword If true, set password.
|
|
199 |
* @@return none
|
|
200 |
* @leave KErrArgument if passed values are incorrect, or other
|
|
201 |
* symbian error code.
|
|
202 |
*/
|
|
203 |
void SetUsernameAndPasswordL( TUint32 aProfileId,
|
|
204 |
const TDesC8& aUsername,
|
|
205 |
TBool aSetUsername,
|
|
206 |
const TDesC8& aPassword,
|
|
207 |
TBool aSetPassword );
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Informs SIP to allow ALR migration
|
|
211 |
*
|
|
212 |
* @param aProfileId SIP profile ID
|
|
213 |
*/
|
|
214 |
void StartAlrMigration( TUint32 aProfileId );
|
|
215 |
|
|
216 |
#ifdef _DEBUG
|
|
217 |
void GetDebugInfo( TDes& aInfo ) const;
|
|
218 |
#endif
|
|
219 |
|
|
220 |
|
|
221 |
private: // Functions from base classes
|
|
222 |
|
|
223 |
/**
|
|
224 |
* From MSIPObserver
|
|
225 |
* A SIP request has been received from the network.
|
|
226 |
* @pre aTransaction != 0
|
|
227 |
* @param aIapId The IapId from which the SIP request was received.
|
|
228 |
* @param aTransaction contains local address, remote address of a SIP
|
|
229 |
* message, as well as optional SIP message method, headers and
|
|
230 |
* body. The ownership is transferred.
|
|
231 |
*/
|
|
232 |
void IncomingRequest( TUint32 aIapId, CSIPServerTransaction* aTransaction );
|
|
233 |
|
|
234 |
/**
|
|
235 |
* From MSIPObserver
|
|
236 |
* The received SIP request time-outed and it is invalid i.e. cannot be used
|
|
237 |
* anymore.
|
|
238 |
* This will be called if the user fails to create a SIP connection
|
|
239 |
* and does not send an appropriate SIP response.
|
|
240 |
* @param aTransaction The time-outed transaction.
|
|
241 |
*/
|
|
242 |
void TimedOut( CSIPServerTransaction& aTransaction );
|
|
243 |
|
|
244 |
|
|
245 |
/**
|
|
246 |
* From MSIPProfileRegistryObserver
|
|
247 |
* An event related to SIP Profile has accorred
|
|
248 |
* @param aProfileId a profile Id
|
|
249 |
* @param aEvent an occurred event
|
|
250 |
*/
|
|
251 |
void ProfileRegistryEventOccurred( TUint32 aProfileId,
|
|
252 |
MSIPProfileRegistryObserver::TEvent aEvent );
|
|
253 |
|
|
254 |
/**
|
|
255 |
* From MSIPProfileRegistryObserver
|
|
256 |
* An asynchronous error has occurred related to SIP profile
|
|
257 |
* Event is send to those observers, who have the
|
|
258 |
* corresponding profile instantiated.
|
|
259 |
* @param aProfileId the id of failed profile
|
|
260 |
* @param aError an occurred error
|
|
261 |
*/
|
|
262 |
void ProfileRegistryErrorOccurred( TUint32 aProfileId,
|
|
263 |
TInt aError );
|
|
264 |
|
|
265 |
/**
|
|
266 |
* ALR related event occurred. See MSipProfileAlrObserver.
|
|
267 |
* @param aEvent the event that occurred
|
|
268 |
* @param aProfileId identifies the SIP profile related to the event
|
|
269 |
* @param aSnapId the SNAP related to the event
|
|
270 |
* @param aIapId the IAP related to the event
|
|
271 |
*/
|
|
272 |
void AlrEvent( MSipProfileAlrObserver::TEvent aEvent,
|
|
273 |
TUint32 aProfileId,
|
|
274 |
TUint32 aSnapId,
|
|
275 |
TUint32 aIapId );
|
|
276 |
|
|
277 |
/**
|
|
278 |
* ALR related error occurred. See MSipProfileAlrObserver.
|
|
279 |
* @param aError the error that occurred
|
|
280 |
* @param aProfileId identifies the SIP profile related to the error
|
|
281 |
* @param aSnapId the SNAP related to the event
|
|
282 |
* @param aIapId the IAP related to the error
|
|
283 |
*/
|
|
284 |
void AlrError( TInt aError,
|
|
285 |
TUint32 aProfileId,
|
|
286 |
TUint32 aSnapId,
|
|
287 |
TUint32 aIapId );
|
|
288 |
|
|
289 |
/**
|
|
290 |
* Sip profile state changed
|
|
291 |
* @param aProfileId Profile id.
|
|
292 |
* @param aSipEvent A new event of profile.
|
|
293 |
*/
|
|
294 |
void HandleSipConnectionEvent( TUint32 aProfileId,
|
|
295 |
TScpConnectionEvent aSipEvent );
|
|
296 |
|
|
297 |
/**
|
|
298 |
* Query is starting to ALR allowed.
|
|
299 |
* Client can start ALR later if needed to do something first
|
|
300 |
*
|
|
301 |
* @return ETrue if allowed.
|
|
302 |
*/
|
|
303 |
TBool IsSipProfileAllowedToStartAlr();
|
|
304 |
|
|
305 |
private:
|
|
306 |
|
|
307 |
/**
|
|
308 |
* C++ default constructor.
|
|
309 |
*/
|
|
310 |
CScpProfileHandler();
|
|
311 |
|
|
312 |
/**
|
|
313 |
* By default Symbian 2nd phase constructor is private.
|
|
314 |
*/
|
|
315 |
void ConstructL();
|
|
316 |
|
|
317 |
/**
|
|
318 |
* Removes a sip connection from iSipConnections
|
|
319 |
* @param aProfilId Sip profile id
|
|
320 |
* @return Symbian error codes
|
|
321 |
*/
|
|
322 |
TInt RemoveSipConnection( TUint32 aProfileId );
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Checks if sip profile is reserved by some service
|
|
326 |
* @param aProfileId Sip profile id
|
|
327 |
* @return ETrue if reserved
|
|
328 |
*/
|
|
329 |
TBool IsSipProfileReserved( TUint32 aProfileId ) const;
|
|
330 |
|
|
331 |
private:
|
|
332 |
|
|
333 |
/**
|
|
334 |
* SIP instance. Own.
|
|
335 |
*/
|
|
336 |
CSIP* iSip;
|
|
337 |
|
|
338 |
/**
|
|
339 |
* SIP profile registry. Own.
|
|
340 |
*/
|
|
341 |
CSIPProfileRegistry* iProfileRegistry;
|
|
342 |
|
|
343 |
/**
|
|
344 |
* SIP managed profile registry. Own.
|
|
345 |
*/
|
|
346 |
CSIPManagedProfileRegistry* iManagedProfileRegistry;
|
|
347 |
|
|
348 |
/**
|
|
349 |
* SIP ALR controller. Own.
|
|
350 |
*/
|
|
351 |
CSipProfileAlrController* iAlrController;
|
|
352 |
|
|
353 |
/**
|
|
354 |
* Sip connections.
|
|
355 |
*/
|
|
356 |
RPointerArray< CScpSipConnection > iSipConnections;
|
|
357 |
|
|
358 |
/**
|
|
359 |
* SIP profile observers.
|
|
360 |
*/
|
|
361 |
RPointerArray< MScpSipConnectionObserver > iObservers;
|
|
362 |
|
|
363 |
/**
|
|
364 |
* VMBx service provider interface. Created once, when needed.
|
|
365 |
*/
|
|
366 |
CIpVmbxInterface* iVmbxInterface;
|
|
367 |
|
|
368 |
/**
|
|
369 |
* New IapId received in ALR event
|
|
370 |
*/
|
|
371 |
TUint iNewAlrIapId;
|
|
372 |
|
|
373 |
/**
|
|
374 |
* Is ALR Migration Allowed To Start Immediately
|
|
375 |
*/
|
|
376 |
TBool iAlrAllowedToStartImmediately;
|
|
377 |
|
|
378 |
// This need to be cleaned to separate macro/header
|
|
379 |
#ifdef _DEBUG
|
|
380 |
friend class T_CScpServiceManager;
|
|
381 |
friend class T_CScpProfileHandler;
|
|
382 |
friend class T_CScpSipHelper;
|
|
383 |
friend class T_CScpVmbxHandler;
|
|
384 |
friend class T_CScpVoipHandler;
|
|
385 |
friend class T_CScpPresenceHandler;
|
|
386 |
friend class T_CScpSettingHandler;
|
|
387 |
friend class T_CScpImHandler;
|
|
388 |
#endif
|
|
389 |
};
|
|
390 |
|
|
391 |
#endif // CSCPPPROFILEHANDLER_H
|
|
392 |
|
|
393 |
// End of File
|