|
1 /* |
|
2 * Copyright (c) 2005-2009 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 * Name : sipimsprofileagent.h |
|
16 * Part of : sip ims agent |
|
17 * Interface : private |
|
18 * Version : 1.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 /** |
|
26 @internalComponent |
|
27 */ |
|
28 |
|
29 #ifndef CSIPIMSPROFILEAGENT_H |
|
30 #define CSIPIMSPROFILEAGENT_H |
|
31 |
|
32 // INCLUDES |
|
33 #include <e32base.h> |
|
34 #include "sipprofileagent.h" |
|
35 #include "sipprofileagentobserver.h" |
|
36 #include "sipprofilefsmuser.h" |
|
37 #include "Sipimsprofileusimprovider.h" |
|
38 #include "msipprofileimsauthenticationdataobserver.h" |
|
39 #include "sipobserver.h" |
|
40 #include "siphttpdigestchallengeobserver2.h" |
|
41 #include <sipprofileagentextensionparams.h> |
|
42 |
|
43 //FORWARD DECLARATIONS |
|
44 class CSIPConcreteProfile; |
|
45 class CSIP; |
|
46 class TSIPProfileTypeInfo; |
|
47 class CSIPIMSConnectionContext; |
|
48 class CSIPPrflInitState; |
|
49 class CSIPPrflResolvingProxiesState; |
|
50 class CSIPPrflRegisterRequestedState; |
|
51 class CSIPPrflRegisterDelayRequestedState; |
|
52 class CSIPPrflRegistrationInProgressState; |
|
53 class CSIPPrflRegisteredState; |
|
54 class CSIPPrflDeregisterRequestedState; |
|
55 class CSIPPrflDeregistrationInProgressState; |
|
56 class CSIPIMSProfileContext; |
|
57 class CDeltaTimer; |
|
58 class CSIPNotifyXmlBodyParser; |
|
59 class CSIPProfileSIMRecord; |
|
60 class CSIPProfileQueueHandling; |
|
61 class CSIPHttpDigest; |
|
62 |
|
63 // CLASS DECLARATION |
|
64 /** |
|
65 * Registers profiles and maintains |
|
66 * profile registrations as per RFC3261. |
|
67 * |
|
68 * @lib n/a |
|
69 */ |
|
70 class CSIPIMSProfileAgent: |
|
71 public CSIPProfileAgent, |
|
72 public MSIPProfileAgentObserver, |
|
73 public MSIPProfileFSMUser, |
|
74 public MSIPProfileIMSAuthenticationDataObserver, |
|
75 public MSIPObserver, |
|
76 public MSIPHttpDigestChallengeObserver2 |
|
77 { |
|
78 public: // Constructors and destructor |
|
79 |
|
80 /** |
|
81 * Two-phased constructor. |
|
82 * @param aInitParams parameters passed in the construction |
|
83 */ |
|
84 static CSIPIMSProfileAgent* NewL(TAny* aInitParams); |
|
85 |
|
86 /** |
|
87 * Destructor. |
|
88 */ |
|
89 virtual ~CSIPIMSProfileAgent(); |
|
90 |
|
91 public: // From CSIPProfileAgent |
|
92 |
|
93 const TSIPProfileTypeInfo& Type() const; |
|
94 |
|
95 CSIPConcreteProfile* CreateL(); |
|
96 |
|
97 void RegisterL( |
|
98 CSIPConcreteProfile& aSIPConcreteProfile); |
|
99 |
|
100 void UpdateL( |
|
101 CSIPConcreteProfile& aNewProfile, |
|
102 CSIPConcreteProfile& aOldProfile); |
|
103 |
|
104 void DeregisterL( |
|
105 CSIPConcreteProfile& aSIPConcreteProfile); |
|
106 |
|
107 TInt GetProfileState( |
|
108 CSIPConcreteProfile::TStatus& aState, |
|
109 CSIPConcreteProfile& aProfile) const; |
|
110 |
|
111 TBool IsIdle(); |
|
112 |
|
113 TBool RegisterPending(CSIPConcreteProfile& aSIPProfile) const; |
|
114 |
|
115 TInt TerminateHandling(CSIPConcreteProfile& aProfile); |
|
116 |
|
117 TInt Extension(TInt aOperationCode, TAny* aParams); |
|
118 |
|
119 public: // From MSIPProfileAgentObserver |
|
120 |
|
121 void SIPProfileStatusEvent( |
|
122 CSIPConcreteProfile& aProfile, |
|
123 TUint32 aContextId); |
|
124 |
|
125 void SIPProfileErrorEvent( |
|
126 CSIPConcreteProfile& aProfile, |
|
127 TInt aError); |
|
128 |
|
129 TBool ProceedRegistration(CSIPConcreteProfile& aProfile, TInt aError); |
|
130 |
|
131 void GetFailedProfilesL( |
|
132 const TSIPProfileTypeInfo& aType, |
|
133 RPointerArray<CSIPConcreteProfile>& aFailedProfiles) const; |
|
134 |
|
135 public: // From MSIPProfileFSMUser |
|
136 |
|
137 void RegisterProfileL( |
|
138 CSIPConcreteProfile& aSIPConcreteProfile); |
|
139 |
|
140 void DeregisterProfileL( |
|
141 CSIPConcreteProfile& aSIPConcreteProfile); |
|
142 |
|
143 void RetryProfileRegistrationL( |
|
144 CSIPConcreteProfile& aSIPProfile ); |
|
145 |
|
146 TBool AddProfileIntoQueue( |
|
147 CSIPConcreteProfile& aSIPConcreteProfile ) const; |
|
148 |
|
149 void RegisterProfileAfterQueueL( |
|
150 CSIPConcreteProfile& aSIPConcreteProfile ); |
|
151 |
|
152 void DeregisterProfileAfterQueueL( |
|
153 CSIPConcreteProfile& aSIPConcreteProfile ); |
|
154 |
|
155 void RetryProfileRegistrationAfterQueueL( |
|
156 CSIPConcreteProfile& aSIPConcreteProfile ); |
|
157 |
|
158 TBool IsInQueue( |
|
159 CSIPConcreteProfile& aSIPProfile ) const; |
|
160 |
|
161 void SetInterimProfile( |
|
162 CSIPConcreteProfile* aSIPConcreteProfile ); |
|
163 |
|
164 public: // From MSIPProfileIMSAuthenticationDataObserver |
|
165 |
|
166 void AuthorizedL(); |
|
167 |
|
168 void AuthorizationFailed(); |
|
169 |
|
170 void AuthorizationSIMFailed(); |
|
171 |
|
172 void AsyncDeltaTimer(); |
|
173 |
|
174 void UpdateRegistrationsL(); |
|
175 |
|
176 // A callback for CDeltaTimer |
|
177 static TInt ASyncTimerExpired(TAny* aPtr); |
|
178 |
|
179 public: // From MSIPObserver |
|
180 |
|
181 void IncomingRequest( |
|
182 TUint32 aIapId, |
|
183 CSIPServerTransaction* aTransaction); |
|
184 |
|
185 void TimedOut(CSIPServerTransaction& aTransaction); |
|
186 |
|
187 public: // From MSIPHttpDigestChallengeObserver2 |
|
188 |
|
189 void ChallengeReceived(const CSIPClientTransaction& aTransaction); |
|
190 |
|
191 void ChallengeReceived(const CSIPRefresh& aRefresh); |
|
192 |
|
193 private: |
|
194 |
|
195 /** |
|
196 * C++ default constructor. |
|
197 */ |
|
198 CSIPIMSProfileAgent(TSIPProfileAgentInitParams* aInitParams); |
|
199 |
|
200 /** |
|
201 * Provides profile context |
|
202 * @param aProfile a profile |
|
203 * @return a profile context |
|
204 */ |
|
205 CSIPIMSProfileContext& ProvideProfileContextL(CSIPConcreteProfile& aProfile); |
|
206 |
|
207 /** |
|
208 * Finds profile context |
|
209 * @param aSIPConcreteProfile a profile |
|
210 * @return profile context, the ownership is not transferred |
|
211 */ |
|
212 CSIPIMSProfileContext* FindProfileContext(CSIPConcreteProfile& aSIPConcreteProfile) const; |
|
213 |
|
214 /** |
|
215 * Finds profile context |
|
216 * @param aProfileId identifier of the profile |
|
217 * @return profile context, the ownership is not transferred |
|
218 */ |
|
219 CSIPIMSProfileContext* FindProfileContext(TUint32 aProfileId) const; |
|
220 |
|
221 /** |
|
222 * Finds connection context |
|
223 * @param aPriofile a profile |
|
224 * @return a connection context |
|
225 */ |
|
226 CSIPIMSConnectionContext* FindConnectionContext(CSIPConcreteProfile& aProfile) const; |
|
227 |
|
228 /** |
|
229 * Finds connection context |
|
230 * @param aIapId an iap id |
|
231 * @return a connection context |
|
232 */ |
|
233 CSIPIMSConnectionContext* FindConnectionContext(TUint32 aIapId) const; |
|
234 |
|
235 /** |
|
236 * Destroys idle connection contexts |
|
237 */ |
|
238 void CleanIdleConnectionContexts(); |
|
239 |
|
240 /** |
|
241 * By default Symbian 2nd phase constructor is private. |
|
242 */ |
|
243 void ConstructL(); |
|
244 |
|
245 /** |
|
246 * Finds connection context |
|
247 * @param aProfile a profile |
|
248 * register profile or puts it in to que |
|
249 */ |
|
250 void CheckIPSecRulesL(CSIPConcreteProfile& aProfile); |
|
251 |
|
252 /** |
|
253 * Checks if securitymechanism ipsec is in use, return ETrue if in use |
|
254 * @param aIsRegInProgress ETrue, if other profile |
|
255 * has registration in progress |
|
256 */ |
|
257 TBool IsIPSecAlreadyInUse(TBool& aIsRegInProgress); |
|
258 |
|
259 /** |
|
260 * Deletes all the profiles which are in que |
|
261 * waiting for permission to be registered |
|
262 */ |
|
263 void DeleteAllProfilesInWaitingQue(); |
|
264 |
|
265 |
|
266 void RegisterFromWaitingQueL(); |
|
267 |
|
268 TBool CheckIfConfigured(CSIPConcreteProfile& aSIPProfile); |
|
269 |
|
270 TBool MandatoryValuesConfigured(CSIPConcreteProfile& aSIPProfile); |
|
271 |
|
272 void RegisterFromAuthorizedArrayL(CSIPConcreteProfile& aSIPProfile); |
|
273 |
|
274 void ProfileToWaitingQueueL( CSIPConcreteProfile* aProfile ); |
|
275 |
|
276 TBool DeregisterToWaitingQueueL( CSIPIMSProfileContext* aContext ); |
|
277 |
|
278 void AuthorizationUSIMFailed(); |
|
279 |
|
280 void HandleWaitingForRegisteringArray(); |
|
281 |
|
282 TBool RegAllowedWithUSIMorISIML(CSIPConcreteProfile& aSIPProfile); |
|
283 |
|
284 TBool RegAllowedWithSIM(CSIPConcreteProfile& aSIPProfile); |
|
285 |
|
286 void GetTsyModuleNameL( TDes& aTsyModuleName ) const; |
|
287 |
|
288 CSIPConcreteProfile* RemoveFirstProfileFromArray( |
|
289 RPointerArray<CSIPConcreteProfile>& aProfileArray); |
|
290 |
|
291 |
|
292 void TerminateAndErrorEvent( CSIPConcreteProfile& aProfile, |
|
293 TInt aError ); |
|
294 |
|
295 TBool FoundIPSecProfileCandidate(); |
|
296 |
|
297 void ChooseProfileTypeL( CSIPConcreteProfile* aProfile, |
|
298 CSIPIMSProfileContext* context ); |
|
299 |
|
300 void CheckIMSReleaseTypeProfilesL(); |
|
301 |
|
302 TBool CheckRegistrationsL(); |
|
303 |
|
304 TBool HandleISIMUpdateRegistrationEventL( |
|
305 CSIPConcreteProfile& aProfile, |
|
306 CSIPIMSProfileContext* aContext); |
|
307 |
|
308 TInt RegisterQueue( CSIPConcreteProfile& aProfile, TBool aReportError ); |
|
309 |
|
310 |
|
311 TBool AllowedTakeFromQueue( CSIPConcreteProfile& aSIPConcreteProfile ); |
|
312 |
|
313 CSIPConcreteProfile* PreviouslyFailedIMSProfileL(); |
|
314 |
|
315 CSIPConcreteProfile* RemoveProfileFromWaitingQueue( |
|
316 RPointerArray<CSIPConcreteProfile>& aProfileArray, |
|
317 CSIPConcreteProfile& aSIPConcreteProfile ); |
|
318 |
|
319 void FindProfileContextAndRegisterL( CSIPConcreteProfile& aSIPConcreteProfile ); |
|
320 void ResetISIMUpdateProfile( CSIPConcreteProfile* aSIPConcreteProfile ); |
|
321 |
|
322 private: // Data |
|
323 |
|
324 CSIP* iSIP; |
|
325 CSIPHttpDigest* iHttpDigest; |
|
326 MSIPProfileAgentObserver& iSIPProfileAgentObserver; |
|
327 TSIPProfileTypeInfo iType; |
|
328 CSIPPrflInitState* iInit; |
|
329 CSIPPrflResolvingProxiesState* iResolvingProxies; |
|
330 CSIPPrflRegisterRequestedState* iRegRequested; |
|
331 CSIPPrflRegisterDelayRequestedState* iRegDelayRequested; |
|
332 CSIPPrflRegistrationInProgressState* iRegInProgress; |
|
333 CSIPPrflRegisteredState* iRegistered; |
|
334 CSIPPrflDeregisterRequestedState* iDeregRequested; |
|
335 CSIPPrflDeregistrationInProgressState* iDeregInProgress; |
|
336 RTelServer iTelServer; |
|
337 RPointerArray<CSIPIMSConnectionContext> iConnectionCtxArray; |
|
338 RPointerArray<CSIPConcreteProfile> iWaitForRegisteringArray; |
|
339 RPointerArray<CSIPConcreteProfile> iUSimWaitForAuthorizedArray; |
|
340 RPointerArray<CSIPConcreteProfile> iSIMWaitForAuthorizedArray; |
|
341 RPointerArray<CSIPConcreteProfile> iWaitForAuthorizedArray; |
|
342 |
|
343 CDeltaTimer& iDeltaTimer; |
|
344 TUint32 iReTryProfileId; |
|
345 CSIPNotifyXmlBodyParser* iXMLParser; |
|
346 CSIPProfileUsimProvider* iUsimProvider; |
|
347 CSIPProfileSIMRecord* iSIMRecord; |
|
348 TCallBack iDeltaTimerCallBack; |
|
349 TDeltaTimerEntry iDeltaTimerEntry; |
|
350 TUint iDeltaTimerEntryListCount; |
|
351 CSIPProfileQueueHandling* iProfileQueueHandling; |
|
352 CSIPConcreteProfile* iISIMUpdateProfile;//not owned |
|
353 CSIPConcreteProfile* iPreviouslyFailedIMSProfile;//not owned |
|
354 RPointerArray<CSIPConcreteProfile> iFailedProfilesArray; |
|
355 CSIPConcreteProfile* iInterimProfile;//not owned |
|
356 CSipProfileAgentConfigExtension* iConfigExtension;//not owned |
|
357 |
|
358 #ifdef CPPUNIT_TEST |
|
359 friend class CSIPIMSProfileAgentTest; |
|
360 #endif |
|
361 }; |
|
362 |
|
363 #endif // CSIPIMSPROFILEAGENT_H |