1 /* |
|
2 * Copyright (c) 2006 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: Simple Protocol implementation for Presence Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CSIMPLEPLUGINAUTHORIZATION_H |
|
22 #define CSIMPLEPLUGINAUTHORIZATION_H |
|
23 |
|
24 #include <e32std.h> |
|
25 |
|
26 #include <ximpbase.h> |
|
27 #include <protocolpresenceauthorization.h> |
|
28 |
|
29 #include "simpleplugincommon.h" |
|
30 #include "msimplepluginconnectionobs.h" |
|
31 |
|
32 class TXIMPRequestId; |
|
33 class MXIMPIdentity; |
|
34 class MPresenceInfoFilter; |
|
35 class MProtocolPresenceAuthorizationDataHost; |
|
36 |
|
37 class MSimpleWinfo; |
|
38 class CPresenceXDM; |
|
39 class CRLSXDM; |
|
40 class CXdmEngine; |
|
41 class CXdmDocument; |
|
42 |
|
43 |
|
44 /** |
|
45 * CSimplePluginAuthorization |
|
46 * |
|
47 * Simple Engine Connection |
|
48 * |
|
49 * @lib ?library |
|
50 * @since s60 v5.0 |
|
51 */ |
|
52 NONSHARABLE_CLASS( CSimplePluginAuthorization ) : public CActive, |
|
53 public MProtocolPresenceAuthorization |
|
54 { |
|
55 public: |
|
56 |
|
57 |
|
58 /** |
|
59 * Current operation |
|
60 */ |
|
61 enum TPluginAuthOperation |
|
62 { |
|
63 ENoOperation, |
|
64 // XDM operations |
|
65 EGrantPresenceForPresentity, |
|
66 EGrantPresenceForPresentityGroupMembers, |
|
67 EWithdrawFromPresentity, |
|
68 EWithdrawFromGroupMembers, |
|
69 EGrantForEveryone, |
|
70 EWithdrawFromEveryone, |
|
71 ESubscribeBlockList, |
|
72 EUnsubscribeBlockList, |
|
73 EBlockPresentity, |
|
74 EUnblockPresentity, |
|
75 // SIP and XDM operations |
|
76 ESubscribePresenceGrantRequestList, |
|
77 EUnsubscribePresenceGrantRequestList |
|
78 }; |
|
79 |
|
80 /** |
|
81 * Current default rule |
|
82 */ |
|
83 enum TPluginAuthDefRule |
|
84 { |
|
85 ERuleDef, |
|
86 ERuleConfirm, |
|
87 ERuleAllow |
|
88 }; |
|
89 |
|
90 /** |
|
91 * Constructor. |
|
92 * @param aObs callback for complete requests |
|
93 */ |
|
94 static CSimplePluginAuthorization* NewL( |
|
95 MSimplePluginConnectionObs& aObs ); |
|
96 |
|
97 virtual ~CSimplePluginAuthorization(); |
|
98 |
|
99 /** |
|
100 * SetDataHost |
|
101 * |
|
102 * Set Data Host |
|
103 * |
|
104 * @lib ?library |
|
105 * @since s60 v5.0 |
|
106 */ |
|
107 void SetDataHost( MProtocolPresenceAuthorizationDataHost& aDataHost ); |
|
108 |
|
109 /** |
|
110 * WinfoTerminatedL |
|
111 * |
|
112 * SIMPLE Winfo watcher subscription is terminated |
|
113 * @param aReason reason code |
|
114 */ |
|
115 void WinfoTerminatedL( TInt aReason ); |
|
116 |
|
117 /** |
|
118 * WINFO received from SIMPLE |
|
119 * @param aWinfo WINFO |
|
120 */ |
|
121 void WinfoNotificationL( MSimpleWinfo& aWinfo ); |
|
122 |
|
123 /** |
|
124 * This is to ensure that WINFO watchers responses are detected. |
|
125 * @param aPrFwId framework request id to be completed |
|
126 * @param sStatus error code |
|
127 */ |
|
128 TBool HandleIfMine( TXIMPRequestId aPrFwId, TInt aStatus ); |
|
129 |
|
130 |
|
131 private: |
|
132 |
|
133 CSimplePluginAuthorization( |
|
134 MSimplePluginConnectionObs& aObs ); |
|
135 |
|
136 void ConstructL( ); |
|
137 |
|
138 |
|
139 // from base class MXIMPBase |
|
140 public: |
|
141 |
|
142 /** |
|
143 * Defined in a base class |
|
144 */ |
|
145 TAny* GetInterface( |
|
146 TInt32 aInterfaceId, |
|
147 TIfGetOps aOps ); |
|
148 |
|
149 /** |
|
150 * Defined in a base class |
|
151 */ |
|
152 const TAny* GetInterface( |
|
153 TInt32 aInterfaceId, |
|
154 TIfGetOps aOps ) const; |
|
155 |
|
156 /** |
|
157 * Defined in a base class |
|
158 */ |
|
159 TInt32 GetInterfaceId() const; |
|
160 |
|
161 |
|
162 // from base class MProtocolPresenceAuthorization |
|
163 |
|
164 /** |
|
165 * Defined in a base class |
|
166 */ |
|
167 void DoSubscribePresenceGrantRequestListL( |
|
168 TXIMPRequestId aReqId ); |
|
169 |
|
170 /** |
|
171 * Defined in a base class |
|
172 */ |
|
173 void DoUnsubscribePresenceGrantRequestListL( |
|
174 TXIMPRequestId aReqId ); |
|
175 |
|
176 // Granting presence information access to single presentities |
|
177 |
|
178 /** |
|
179 * Defined in a base class |
|
180 */ |
|
181 void DoGrantPresenceForPresentityL( |
|
182 const MXIMPIdentity& aPresentityId, |
|
183 const MPresenceInfoFilter& aPif, |
|
184 TXIMPRequestId aReqId ); |
|
185 |
|
186 /** |
|
187 * Defined in a base class |
|
188 */ |
|
189 void DoUpdatePresenceGrantPifForPresentityL( |
|
190 const MXIMPIdentity& aPresentityId, |
|
191 const MPresenceInfoFilter& aPif, |
|
192 TXIMPRequestId aReqId ); |
|
193 |
|
194 /** |
|
195 * Defined in a base class |
|
196 */ |
|
197 void DoWithdrawPresenceGrantFromPresentityL( |
|
198 const MXIMPIdentity& aPresentityId, |
|
199 TXIMPRequestId aReqId ); |
|
200 |
|
201 // Granting presence information access to presentity group members |
|
202 |
|
203 /** |
|
204 * Defined in a base class |
|
205 */ |
|
206 void DoGrantPresenceForPresentityGroupMembersL( |
|
207 const MXIMPIdentity& aGroupId, |
|
208 const MPresenceInfoFilter& aPif, |
|
209 TXIMPRequestId aReqId ); |
|
210 |
|
211 /** |
|
212 * Defined in a base class |
|
213 */ |
|
214 void DoUpdatePresenceGrantPifForPresentityGroupMembersL( |
|
215 const MXIMPIdentity& aGroupId, |
|
216 const MPresenceInfoFilter& aPif, |
|
217 TXIMPRequestId aReqId ); |
|
218 |
|
219 /** |
|
220 * Defined in a base class |
|
221 */ |
|
222 void DoWithdrawPresenceGrantFromPresentityGroupMembersL( |
|
223 const MXIMPIdentity& aGroupId, |
|
224 TXIMPRequestId aReqId ); |
|
225 |
|
226 // Granting presence information access to everyone |
|
227 |
|
228 /** |
|
229 * Defined in a base class |
|
230 */ |
|
231 void DoGrantPresenceForEveryoneL( |
|
232 const MPresenceInfoFilter& aPif, |
|
233 TXIMPRequestId aReqId ); |
|
234 |
|
235 /** |
|
236 * Defined in a base class |
|
237 */ |
|
238 void DoUpdatePresenceGrantPifForEveryoneL( |
|
239 const MPresenceInfoFilter& aPif, |
|
240 TXIMPRequestId aReqId ); |
|
241 |
|
242 /** |
|
243 * Defined in a base class |
|
244 */ |
|
245 void DoWithdrawPresenceGrantFromEveryoneL( |
|
246 TXIMPRequestId aReqId ); |
|
247 |
|
248 // Subscribe presence block list |
|
249 |
|
250 /** |
|
251 * Defined in a base class |
|
252 */ |
|
253 void DoSubscribePresenceBlockListL( |
|
254 TXIMPRequestId aReqId ); |
|
255 |
|
256 /** |
|
257 * Defined in a base class |
|
258 */ |
|
259 void DoUnsubscribePresenceBlockListL( |
|
260 TXIMPRequestId aReqId ); |
|
261 |
|
262 // Blocking presence information access from single presentities |
|
263 |
|
264 /** |
|
265 * Defined in a base class |
|
266 */ |
|
267 void DoBlockPresenceForPresentityL( |
|
268 const MXIMPIdentity& aPresentityId, |
|
269 TXIMPRequestId aReqId ); |
|
270 |
|
271 /** |
|
272 * Defined in a base class |
|
273 */ |
|
274 void DoCancelPresenceBlockFromPresentityL( |
|
275 const MXIMPIdentity& aPresentityId, |
|
276 TXIMPRequestId aReqId ); |
|
277 |
|
278 |
|
279 |
|
280 protected: |
|
281 |
|
282 // from base class CActive |
|
283 |
|
284 /** |
|
285 * Defined in a base class |
|
286 */ |
|
287 void RunL(); |
|
288 |
|
289 /** |
|
290 * Defined in a base class |
|
291 */ |
|
292 TInt RunError( TInt aError ); |
|
293 |
|
294 /** |
|
295 * Defined in a base class |
|
296 */ |
|
297 void DoCancel(); |
|
298 |
|
299 private: |
|
300 |
|
301 /** |
|
302 * Save presentity id |
|
303 * @param aPresentityId presentity id |
|
304 */ |
|
305 void SetPresIdentityL( |
|
306 const MXIMPIdentity& aPresentityId ); |
|
307 |
|
308 /** |
|
309 * Calls MXIMPProtocolConnectionHost callback |
|
310 * @param aStatus error status |
|
311 */ |
|
312 void CompletePrFwReq( TInt aStatus ); |
|
313 |
|
314 |
|
315 /** |
|
316 * Start XDM operation |
|
317 */ |
|
318 void StartXdmOperationL( |
|
319 const MXIMPIdentity& aId, |
|
320 TXIMPRequestId aReqId, |
|
321 TPluginAuthOperation aOperation ); |
|
322 |
|
323 /** |
|
324 * Start XDM operation. StartXdmOperationL calls this. |
|
325 */ |
|
326 void DoStartXdmOperationL( |
|
327 const MXIMPIdentity& aId, |
|
328 TXIMPRequestId aReqId, |
|
329 TPluginAuthOperation aOperation ); |
|
330 |
|
331 /** |
|
332 * Start XDM operation. HandleIfMine calls this. |
|
333 */ |
|
334 void DoStartXdmOperationL( |
|
335 TXIMPRequestId aReqId, |
|
336 TPluginAuthOperation aOperation ); |
|
337 |
|
338 /** |
|
339 * Call CSimpleXdmUtils operation |
|
340 */ |
|
341 void CallActualXdmOperationL(); |
|
342 |
|
343 /** |
|
344 * Copy data from aBlockers to aBlockedSouls |
|
345 * @param aBlockers user ids |
|
346 * @param aBlockedSouls user PrFwIdentities |
|
347 * |
|
348 */ |
|
349 void CopyBlockersToArrayL( |
|
350 CPtrCArray& aBlockers, RPointerArray<MXIMPIdentity>& aBlockedSouls ); |
|
351 |
|
352 /** |
|
353 * Handle full Winfo notification |
|
354 * @param aWinfo WINFO |
|
355 */ |
|
356 void HandleFullWinfoNotificationL( MSimpleWinfo& aWinfo ); |
|
357 |
|
358 /** |
|
359 * Handle partial Winfo notification |
|
360 * @param aWinfo WINFO |
|
361 */ |
|
362 void HandlePartialWinfoNotificationL( MSimpleWinfo& aWinfo ); |
|
363 |
|
364 /** |
|
365 * Call HandlePresenceGrantRequestReceivedL |
|
366 * @param aUserId user id |
|
367 */ |
|
368 void CallHandlePresenceGrantRequestReceivedL( const TDesC& aUserId ); |
|
369 |
|
370 /** |
|
371 * Call HandlePresenceGrantRequestObsoletedL( |
|
372 * @param aUserId user id |
|
373 */ |
|
374 void CallHandlePresenceGrantRequestObsoletedL( const TDesC& aUserId ); |
|
375 |
|
376 /** |
|
377 * Handle block list subscription routines |
|
378 */ |
|
379 void HandleSubscribeBlockListL(); |
|
380 |
|
381 |
|
382 private: // Data |
|
383 |
|
384 /** |
|
385 * PrFw Plugin connection observer |
|
386 */ |
|
387 MSimplePluginConnectionObs& iConnObs; |
|
388 |
|
389 /** |
|
390 * PrFw Plugin Authorization Data Host |
|
391 * Not own. |
|
392 */ |
|
393 MProtocolPresenceAuthorizationDataHost* iDataHost; |
|
394 |
|
395 /** |
|
396 * XDM Settings id |
|
397 */ |
|
398 TInt iSettingsId; |
|
399 |
|
400 /** |
|
401 * PrFW request id |
|
402 */ |
|
403 TXIMPRequestId iPrFwId; |
|
404 |
|
405 /** |
|
406 * PrFW request id for own requests |
|
407 */ |
|
408 TXIMPRequestId iPrFwIdOwn; |
|
409 |
|
410 /** |
|
411 * Simple Engine request id |
|
412 */ |
|
413 TInt iSimpleId; |
|
414 |
|
415 /** |
|
416 * Current operation |
|
417 */ |
|
418 TPluginAuthOperation iOperation; |
|
419 |
|
420 /** |
|
421 * Current presentity in progress |
|
422 * Own. |
|
423 */ |
|
424 HBufC16* iPresIdentity; |
|
425 |
|
426 /** |
|
427 * Whether XDM utility is initialized |
|
428 */ |
|
429 TBool iXdmOk; |
|
430 |
|
431 /** |
|
432 * XDM Utils |
|
433 * Not own. |
|
434 */ |
|
435 CSimplePluginXdmUtils* iXdmUtils; |
|
436 |
|
437 /** |
|
438 * Current default rule |
|
439 */ |
|
440 TPluginAuthDefRule iDefRule; |
|
441 |
|
442 /** |
|
443 * Active WINFO subscription |
|
444 */ |
|
445 TBool iWinfoSubs; |
|
446 |
|
447 |
|
448 }; |
|
449 |
|
450 #endif // CSimplePluginAuthorization_H |
|