|
1 /* |
|
2 * Copyright (c) 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 * |
|
16 */ |
|
17 #ifndef MIDP2PERMISSIONDB_H |
|
18 #define MIDP2PERMISSIONDB_H |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <string> |
|
22 |
|
23 namespace MIDP |
|
24 { |
|
25 // ** Please keep in synch with the below array! |
|
26 enum TMidp2Domain |
|
27 { |
|
28 EDomainUntrusted = 0, |
|
29 EDomainTTP, |
|
30 EDomainOperator, |
|
31 EDomainManufacturer, |
|
32 EDomainOnDeviceOperator, |
|
33 EDomainOperatorUserPerms, |
|
34 EDomainOnDeviceOperatorUserPerms, |
|
35 EDomainManufacturerUserPerms, |
|
36 |
|
37 ELastDomainMarker |
|
38 }; |
|
39 |
|
40 static const TUint16* const KJcfDomains[] = |
|
41 { |
|
42 _S16("*UTD*"), // 0 |
|
43 _S16("*TTPD*"), |
|
44 _S16("*OPD*"), |
|
45 _S16("*MFD*"), |
|
46 _S16("*ODOPD*"), |
|
47 _S16("*OPDU*"), |
|
48 _S16("*ODOPDU*"), |
|
49 _S16("*MFDU*") |
|
50 }; |
|
51 |
|
52 // |
|
53 // ******************************************************************** |
|
54 // Permission type and mode definitions |
|
55 // ******************************************************************** |
|
56 // |
|
57 enum TMidp2PermissionType |
|
58 { |
|
59 ENotAllowed, |
|
60 EUser, |
|
61 EAllowed |
|
62 }; |
|
63 |
|
64 enum TMidp2PermissionMode |
|
65 { |
|
66 EDenied = 0x01, |
|
67 EOneShot = 0x02, |
|
68 ESession = 0x04, |
|
69 EBlanket = 0x08 |
|
70 }; |
|
71 |
|
72 // |
|
73 // ******************************************************************** |
|
74 // Permission definitions |
|
75 // ******************************************************************** |
|
76 // |
|
77 |
|
78 // ** Please keep in synch with the below array! |
|
79 enum TMidp2Permission |
|
80 { |
|
81 // MIDP 2.0 JSR 118 |
|
82 EPermissionConnectorHttp = 0, |
|
83 EPermissionConnectorHttps, |
|
84 EPermissionConnectorDatagram, |
|
85 EPermissionConnectorDatagramReceiver, |
|
86 EPermissionConnectorSocket, |
|
87 EPermissionConnectorServerSocket, |
|
88 EPermissionConnectorSsl, |
|
89 EPermissionConnectorComm, |
|
90 EPermissionPushRegistry, |
|
91 |
|
92 // Wireless Messaging API JSRs 120 & 205 |
|
93 EPermissionConnectorSms, |
|
94 EPermissionWirelessSmsSend, |
|
95 EPermissionWirelessSmsReceive, |
|
96 EPermissionConnectorCbs, |
|
97 EPermissionWirelessCbsReceive, |
|
98 EPermissionConnectorMms, // JSR 205 |
|
99 EPermissionWirelessMmsSend, // JSR 205 |
|
100 EPermissionWirelessMmsReceive, // JSR 205 |
|
101 |
|
102 |
|
103 // Mobile Media API JSR 135 |
|
104 EPermissionMediaRecordControl, |
|
105 EPermissionMediaGetSnapshot, |
|
106 EPermissionConnectorRtsp, |
|
107 |
|
108 // Bluetooth API JSR 82 |
|
109 EPermissionConnectorBtClient, |
|
110 EPermissionConnectorBtServer, |
|
111 EPermissionConnectorObexClient, |
|
112 EPermissionConnectorObexClientTcp, //Not supported in releases before and including S60 3.2 |
|
113 EPermissionConnectorObexServer, |
|
114 EPermissionConnectorObexServerTcp, //Not supported in releases before and including S60 3.2 |
|
115 EPermissionJavaxObexClientSession, |
|
116 EPermissionJavaxObexOperation, |
|
117 |
|
118 // File API JSR 75 |
|
119 EPermissionConnectorFileRead, |
|
120 EPermissionConnectorFileWrite, |
|
121 |
|
122 // PIM API JSR 75 |
|
123 EPermissionPimContactListRead, |
|
124 EPermissionPimContactListWrite, |
|
125 EPermissionPimEventListRead, |
|
126 EPermissionPimEventListWrite, |
|
127 EPermissionPimToDoListRead, |
|
128 EPermissionPimToDoListWrite, |
|
129 |
|
130 // Location API JSR 179 |
|
131 EPermissionLocationLocation, |
|
132 EPermissionLocationOrientation, // Not supported in releases before and including S60 3.2, still not commented out because handled by not defining fg binding in policy file |
|
133 EPermissionLocationProximityListener, //Not supported in releases before and including S60 3.2 |
|
134 EPermissionLocationLandmarkStoreRead, |
|
135 EPermissionLocationLandmarkStoreWrite, |
|
136 EPermissionLocationLandmarkStoreCategory, |
|
137 EPermissionLocationLandmarkStoreManagement, |
|
138 |
|
139 // SATSA API JSR 177 |
|
140 EPermissionSATSAAPDUApduSat, // bind to dummy functiongroup "SATSA APDU" |
|
141 EPermissionSmartCardCommunicationApduAid, // Not supported in releases before and including S60 3.2, still not commented out because handled by not defining fg binding in policy file |
|
142 EPermissionSmartCardCommunicationJcrmi, //Not supported in 3.1 |
|
143 EPermissionAuthenticationSecServCMSMsgSignServ, |
|
144 |
|
145 // SIP API JSR 180 |
|
146 EPermissionConnectorSip, |
|
147 EPermissionConnectorSips, |
|
148 |
|
149 // Content Handler JSR 211 |
|
150 // EPermissionContentContentHandler, Not supported in releases before and including S60 3.2 |
|
151 |
|
152 // API Extensions |
|
153 EPermissionAPIEXTActiveIdleSet, |
|
154 EPermissionAPIEXTSasfSet, |
|
155 EPermissionAPIEXTSasfGet, |
|
156 EPermissionAPIEXTSoftNotificationSet, |
|
157 EPermissionAPIEXTNewMailLEDSet, |
|
158 |
|
159 // Restricted API Extensions |
|
160 EPermissionAPIEXTMobinfoIMSI, |
|
161 |
|
162 // Platform Request |
|
163 EPermissionPlatformRequestNetAccess, |
|
164 EPermissionPlatformRequestTel, |
|
165 EPermissionPlatformRequestLocalApp, |
|
166 |
|
167 //new |
|
168 EPermissionAmmsControlCameraEnableShutterFeedback, |
|
169 EPermissionAmmsControlTunerSetPreset, |
|
170 EPermissionPaymentProcess, |
|
171 |
|
172 // API JSR 272 |
|
173 EPermissionBroadcastRecordingRecordingSchedulerAdd, |
|
174 EPermissionBroadcastRecordingRecordingSchedulerRemove, |
|
175 EPermissionBroadcastRecordingRecordingSchedulerAccess, |
|
176 EPermissionBroadcastEsgServiceGuideAccess, |
|
177 EPermissionBroadcastServiceContextCreate, |
|
178 EPermissionBroadcastServiceContextDefault, |
|
179 EPermissionBroadcastServiceContextSelect, |
|
180 EPermissionBroadcastPurchaseSubscriptionManagerGetSubscriptions, |
|
181 EPermissionBroadcastPurchasePurchaseObjectPurchase, |
|
182 EPermissionBroadcastPurchasePurchaseObjectCancel, |
|
183 EPermissionBroadcastServiceContextBroadcastDatagram, |
|
184 EPermissionIoConnectorBroadcastFileRead, |
|
185 |
|
186 ELastPermissionMarker |
|
187 }; |
|
188 |
|
189 static const TUint16* const KJcfPermissions[] = |
|
190 { |
|
191 // MIDP 2.0 JSR 118 |
|
192 _S16("javax.microedition.io.Connector.http"), // 0 |
|
193 _S16("javax.microedition.io.Connector.https"), |
|
194 _S16("javax.microedition.io.Connector.datagram"), |
|
195 _S16("javax.microedition.io.Connector.datagramreceiver"), |
|
196 _S16("javax.microedition.io.Connector.socket"), |
|
197 _S16("javax.microedition.io.Connector.serversocket"), |
|
198 _S16("javax.microedition.io.Connector.ssl"), |
|
199 _S16("javax.microedition.io.Connector.comm"), |
|
200 _S16("javax.microedition.io.PushRegistry"), |
|
201 |
|
202 // Wireless Messaging API JSRs 120 & 205 |
|
203 _S16("javax.microedition.io.Connector.sms"), |
|
204 _S16("javax.wireless.messaging.sms.send"), |
|
205 _S16("javax.wireless.messaging.sms.receive"), |
|
206 _S16("javax.microedition.io.Connector.cbs"), |
|
207 _S16("javax.wireless.messaging.cbs.receive"), |
|
208 _S16("javax.microedition.io.Connector.mms"), // JSR 205 |
|
209 _S16("javax.wireless.messaging.mms.send"), // JSR 205 |
|
210 _S16("javax.wireless.messaging.mms.receive"), // JSR 205 |
|
211 |
|
212 // Mobile Media API JSR 135 |
|
213 _S16("javax.microedition.media.control.RecordControl"), |
|
214 _S16("javax.microedition.media.control.VideoControl.getSnapshot"), |
|
215 _S16("javax.microedition.io.Connector.rtsp"), |
|
216 |
|
217 // Bluetooth API JSR 82 |
|
218 _S16("javax.microedition.io.Connector.bluetooth.client"), |
|
219 _S16("javax.microedition.io.Connector.bluetooth.server"), |
|
220 _S16("javax.microedition.io.Connector.obex.client"), |
|
221 _S16("javax.microedition.io.Connector.obex.client.tcp"), //Not supported in releases before and including S60 3.2 |
|
222 _S16("javax.microedition.io.Connector.obex.server"), |
|
223 _S16("javax.microedition.io.Connector.obex.server.tcp"), //Not supported in releases before and including S60 3.2 |
|
224 _S16("javax.obex.ClientSession"), |
|
225 _S16("javax.obex.Operation"), |
|
226 |
|
227 // File API JSR 75 |
|
228 _S16("javax.microedition.io.Connector.file.read"), |
|
229 _S16("javax.microedition.io.Connector.file.write"), |
|
230 |
|
231 // PIM API JSR 75 |
|
232 _S16("javax.microedition.pim.ContactList.read"), |
|
233 _S16("javax.microedition.pim.ContactList.write"), |
|
234 _S16("javax.microedition.pim.EventList.read"), |
|
235 _S16("javax.microedition.pim.EventList.write"), |
|
236 _S16("javax.microedition.pim.ToDoList.read"), |
|
237 _S16("javax.microedition.pim.ToDoList.write"), |
|
238 |
|
239 // Location API JSR 179 |
|
240 _S16("javax.microedition.location.Location"), |
|
241 _S16("javax.microedition.location.Orientation"), // Not supported in releases before and including S60 3.2, still not commented out because handled by not defining fg binding in policy file |
|
242 _S16("javax.microedition.location.ProximityListener"), //Not supported in releases before and including S60 3.2 |
|
243 _S16("javax.microedition.location.LandmarkStore.read"), |
|
244 _S16("javax.microedition.location.LandmarkStore.write"), |
|
245 _S16("javax.microedition.location.LandmarkStore.category"), |
|
246 _S16("javax.microedition.location.LandmarkStore.management"), |
|
247 |
|
248 // SATSA API JSR 177 |
|
249 _S16("javax.microedition.apdu.sat"), // bind to dummy functiongroup "SATSA APDU" |
|
250 _S16("javax.microedition.apdu.aid"), //// Not supported in releases before and including S60 3.2, still not commented out because handled by not defining fg binding in policy file |
|
251 _S16("javax.microedition.jcrmi"), //Not supported in 3.1 |
|
252 _S16("javax.microedition.securityservice.CMSMessageSignatureService"), |
|
253 |
|
254 // SIP API JSR 180 |
|
255 _S16("javax.microedition.io.Connector.sip"), |
|
256 _S16("javax.microedition.io.Connector.sips"), |
|
257 |
|
258 // Content Handler JSR 211 |
|
259 // _S16("javax.microedition.content.ContentHandler"), Not supported in releases before and including S60 3.2 |
|
260 |
|
261 // API Extensions |
|
262 _S16("com.nokia.mid.ActiveIdle.set"), |
|
263 _S16("com.nokia.mid.sasf.set"), |
|
264 _S16("com.nokia.mid.sasf.get"), |
|
265 _S16("com.nokia.mid.SoftNotification.set"), |
|
266 _S16("com.nokia.mid.NewMailLED.set"), |
|
267 |
|
268 // Restricted API Extensions |
|
269 _S16("com.nokia.mid.Mobinfo.IMSI"), |
|
270 |
|
271 // Platform Request |
|
272 _S16("com.nokia.midp.platformrequest.netaccess"), |
|
273 _S16("com.nokia.midp.platformrequest.tel"), |
|
274 _S16("com.nokia.midp.platformrequest.localapp"), |
|
275 |
|
276 //new |
|
277 _S16("javax.microedition.amms.control.camera.enableShutterFeedback"), |
|
278 _S16("javax.microedition.amms.control.tuner.setPreset"), |
|
279 _S16("javax.microedition.payment.process"), |
|
280 |
|
281 // API JSR 272 |
|
282 _S16("javax.microedition.broadcast.recording.RecordingScheduler.add"), |
|
283 _S16("javax.microedition.broadcast.recording.RecordingScheduler.remove"), |
|
284 _S16("javax.microedition.broadcast.recording.RecordingScheduler.access"), |
|
285 _S16("javax.microedition.broadcast.esg.ServiceGuide.access"), |
|
286 _S16("javax.microedition.broadcast.ServiceContext.create"), |
|
287 _S16("javax.microedition.broadcast.ServiceContext.default"), |
|
288 _S16("javax.microedition.broadcast.ServiceContext.select"), |
|
289 _S16("javax.microedition.broadcast.purchase.SubscriptionManager.getSubscriptions"), |
|
290 _S16("javax.microedition.broadcast.purchase.PurchaseObject.purchase"), |
|
291 _S16("javax.microedition.broadcast.purchase.PurchaseObject.cancel"), |
|
292 _S16("javax.microedition.broadcast.ServiceContext.broadcastdatagram"), |
|
293 _S16("javax.microedition.io.Connector.broadcastfile.read") |
|
294 }; |
|
295 |
|
296 // |
|
297 // ******************************************************************** |
|
298 // Function grouping mappings |
|
299 // ******************************************************************** |
|
300 // |
|
301 |
|
302 // ** Please keep in synch with the below array! |
|
303 enum TMidp2FunctionGroup |
|
304 { |
|
305 EPhoneCall = 0, |
|
306 ENetAccess, |
|
307 ELowLevelNetAccess, |
|
308 ECallControl, |
|
309 EMessaging, |
|
310 ERestrictedMessaging, |
|
311 EAppAutoInvocation, |
|
312 ELocalConnectivity, |
|
313 EMultimediaRecording, |
|
314 EReadUserDataAccess, |
|
315 EWriteUserDataAccess, |
|
316 ELocation, |
|
317 ELandmark, |
|
318 EOrientationDummy, // Dummy function group due to the fact that Orientation |
|
319 // permission is not tied to any real Func.group... |
|
320 ESatsaApduDummy, // Dummy fg defined for SATSA permission javax.microedition.apdu.sat which |
|
321 // is not bind to any of those official function groups. See JSR 177, page 157. |
|
322 EAuthentication, |
|
323 ESmartCardCommunication, |
|
324 EAPIExtensions, // Dummy fg defined for API Extensions such as ActiveIdle, SASF, etc. |
|
325 ERestrictedAPIExtensions, // Dummy fg defined for API Extensions such as Mobinfo. |
|
326 EPlatformRequest, // Dummy fg defined for PlatformRequest |
|
327 EMobileBroadcastingService, |
|
328 ELastFunctionGroupMarker |
|
329 }; |
|
330 |
|
331 // Must be in sync with the previous enums AND ones defined in *.xpf policy file! |
|
332 static const TUint16* const KJcfFunctionGroups[] = |
|
333 { |
|
334 _S16("Phone Call"), |
|
335 _S16("Net Access"), |
|
336 _S16("Low Level Net Access"), |
|
337 _S16("Call Control"), |
|
338 _S16("Messaging"), |
|
339 _S16("Restricted Messaging"), |
|
340 _S16("Application Auto Invocation"), |
|
341 _S16("Local Connectivity"), |
|
342 _S16("Multimedia Recording"), |
|
343 _S16("Read User Data Access"), |
|
344 _S16("Write User Data Access"), |
|
345 _S16("Location"), |
|
346 _S16("Landmark"), |
|
347 _S16("Orientation"), // Dummy |
|
348 _S16("Unassigned APIs"), // Dummy |
|
349 _S16("Authentication"), |
|
350 _S16("Smart Card Communication"), |
|
351 _S16("API Extensions"), // Dummy |
|
352 _S16("Restricted API Extensions"), // Dummy |
|
353 _S16("Platform Request"), // Dummy |
|
354 _S16("Mobile Broadcasting Service") |
|
355 }; |
|
356 |
|
357 // The function group visibility part of the enum must be kept in sync with TMidp2FunctionGroup |
|
358 enum TMidp2ConfigKey |
|
359 { |
|
360 ECFGfgPhoneCallVisible = 0, |
|
361 ECFGfgNetAccessVisible, |
|
362 ECFGfgLowLevelNetAccessVisible, |
|
363 ECFGfgCallControlVisible, |
|
364 ECFGfgMessagingVisible, |
|
365 ECFGfgRestrictedMessagingVisible, |
|
366 ECFGfgAppAutoInvocationVisible, |
|
367 ECFGfgLocalConnectivityVisible, |
|
368 ECFGfgMultimediaRecordingVisible, |
|
369 ECFGfgReadUserDataAccessVisible, |
|
370 ECFGfgWriteUserDataAccessVisible, |
|
371 ECFGfgLocationVisible, |
|
372 ECFGfgLandmarkVisible, |
|
373 ECFGfgOrientationDummyVisible, |
|
374 ECFGfgSatsaApduDummyVisible, |
|
375 ECFGfgAuthenticationVisible, |
|
376 ECFGfgSmartCardCommunicationVisible, |
|
377 ECFGfgAPIExtensionsVisible, |
|
378 ECFGfgRestrictedAPIExtensionsVisible, |
|
379 ECFGfgPlatformRequestVisible, |
|
380 ECFGfgMobileBroadcastingServiceVisible, |
|
381 ECFGfgLastFunctionGroupVisibleMarker |
|
382 }; |
|
383 |
|
384 class Midp2PermissionDB : public CBase |
|
385 { |
|
386 public: |
|
387 Midp2PermissionDB(); |
|
388 virtual ~Midp2PermissionDB(); |
|
389 |
|
390 IMPORT_C static Midp2PermissionDB* NewL(const TDesC& aMidletSuiteName, |
|
391 const TDesC& aVendor, |
|
392 const TDesC& aVersion); |
|
393 |
|
394 IMPORT_C TInt GetDomain(TMidp2Domain& aDomain); |
|
395 |
|
396 IMPORT_C TInt GetFunctionGroupPermission( |
|
397 const enum TMidp2FunctionGroup& aFunctionGroup, |
|
398 TMidp2PermissionType& aCurrentType, |
|
399 TMidp2PermissionMode& aCurrentMode, |
|
400 TUint8& aAllowedModesMask); |
|
401 |
|
402 IMPORT_C TInt SetFunctionGroupPermission( |
|
403 const enum TMidp2FunctionGroup& aFunctionGroup, |
|
404 const TMidp2PermissionType& aCurrentType, |
|
405 const TMidp2PermissionMode& aCurrentMode); |
|
406 |
|
407 IMPORT_C void ReadMIDP2ConfigSetting( |
|
408 const enum TMidp2ConfigKey& aKey, TInt& aKeyValue); |
|
409 |
|
410 // ************************************************************************** |
|
411 // Helper functions to convert string names vs. enumarated values |
|
412 // ************************************************************************** |
|
413 // |
|
414 // Finds the enumerated domain value from the given plain text domain name. |
|
415 // |
|
416 IMPORT_C static TInt GetDomainFromName( |
|
417 const TDesC& aName, TMidp2Domain& aDomain); |
|
418 // |
|
419 // Finds the enumerated function group value from the given plain text |
|
420 // permission name. |
|
421 // |
|
422 IMPORT_C static TInt GetFunctionGroupFromName( |
|
423 const TDesC& aName, TMidp2FunctionGroup& aFunctionGroup); |
|
424 // |
|
425 // Finds the enumerated permission value from the given plain text |
|
426 // permission name. |
|
427 // |
|
428 IMPORT_C static TInt GetPermissionFromName(const TDesC& aName, |
|
429 TMidp2Permission& aPermission); |
|
430 private: |
|
431 void ConstructL(const TDesC& aMidletSuiteName, const TDesC& aMidletSuiteVendor, const TDesC& aMidletSuiteVersion); |
|
432 std::wstring iMidletSuiteUid; |
|
433 std::wstring iMidletSuiteProtectionDomain; |
|
434 TBool IsFunctionGroupGranted(TInt aFGIndex); |
|
435 }; |
|
436 |
|
437 } // namespace MIDP |
|
438 #endif // MIDP2PERMISSIONDB_H |