|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Platsec extension API used for checking client side capabilities |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 |
|
24 #ifndef SS_PLATSECEXTAPI_H |
|
25 #define SS_PLATSECEXTAPI_H |
|
26 |
|
27 #define SYMBIAN_NETWORKING_UPS |
|
28 |
|
29 #include <e32cmn.h> |
|
30 |
|
31 #include <comms-infras/api_ext_list.h> |
|
32 #include <comms-infras/ss_api_ext.h> |
|
33 #include <comms-infras/ss_nodeinterfaces.h> |
|
34 #include <comms-infras/ss_dispatchers.h> |
|
35 |
|
36 |
|
37 namespace ESock |
|
38 { |
|
39 |
|
40 /** |
|
41 API Extension for performing platsec checks |
|
42 @internalComponent |
|
43 */ |
|
44 class MPlatsecApiExt |
|
45 { |
|
46 public: |
|
47 static const TInt KInterfaceId = 0x102864DA; |
|
48 |
|
49 |
|
50 /** |
|
51 Obtains the TSecureId of the client process |
|
52 @param aResult If the call is successful, the TSecureId. |
|
53 @return KErrNone if the call succeeds. |
|
54 Otherwise one of the other system-wide error codes. |
|
55 */ |
|
56 virtual TInt SecureId(TSecureId& aResult) const = 0; |
|
57 |
|
58 /** |
|
59 Obtains the TVendorId of the client process |
|
60 @param aResult If the call is successful, the TVendorId. |
|
61 @return KErrNone if the call succeeds. |
|
62 Otherwise one of the other system-wide error codes. |
|
63 */ |
|
64 virtual TInt VendorId(TVendorId& aResult) const = 0; |
|
65 |
|
66 /** |
|
67 Checks the client process for the capability aCapability |
|
68 @param aCapability The capability to be checked for |
|
69 @return KErrNone if the call succeeds. |
|
70 KErrPermissionDenied if the client process does not have the capability. |
|
71 Otherwise one of the other system-wide error codes. |
|
72 */ |
|
73 virtual TBool HasCapability(const TCapability aCapability) const = 0; |
|
74 |
|
75 /** |
|
76 Checks the client process for a match against the policy aPolicy |
|
77 @param aPolicy A security policy that must be matched |
|
78 @return KErrNone if the call succeeds. |
|
79 KErrPermissionDenied if the client process fails the policy check. |
|
80 Otherwise one of the other system-wide error codes. |
|
81 */ |
|
82 virtual TInt CheckPolicy(const TSecurityPolicy& aPolicy) const = 0; |
|
83 |
|
84 #ifdef SYMBIAN_NETWORKING_UPS |
|
85 virtual TInt GetProcessAndThreadId(TProcessId& /*aProcessId*/, TThreadId& /*aThreadId*/) const |
|
86 { |
|
87 return KErrNotSupported; |
|
88 } |
|
89 #endif |
|
90 }; |
|
91 |
|
92 /** |
|
93 Implementation for the MPlatsecExtensionApi interface |
|
94 |
|
95 @internalComponent |
|
96 */ |
|
97 class ASubSessionPlatsecApiExt : private AIPCClientPlatsecInfo, public MPlatsecApiExt |
|
98 { |
|
99 public: |
|
100 IMPORT_C ASubSessionPlatsecApiExt(const TSubSessionUniqueId aSubSessionUniqueId); |
|
101 |
|
102 // From MPlatsecApiExt |
|
103 IMPORT_C virtual TInt SecureId(TSecureId& aResult) const; |
|
104 IMPORT_C virtual TInt VendorId(TVendorId& aResult) const; |
|
105 IMPORT_C virtual TBool HasCapability(const TCapability aCapability) const; |
|
106 IMPORT_C virtual TInt CheckPolicy(const TSecurityPolicy& aPolicy) const; |
|
107 #ifdef SYMBIAN_NETWORKING_UPS |
|
108 IMPORT_C virtual TInt GetProcessAndThreadId(TProcessId& aProcessId, TThreadId& aThreadId) const; |
|
109 #endif //SYMBIAN_NETWORKING_UPS |
|
110 private: |
|
111 const TSubSessionUniqueId iSubSessionUniqueId; |
|
112 }; |
|
113 |
|
114 #ifdef SYMBIAN_NETWORKING_UPS |
|
115 |
|
116 NONSHARABLE_CLASS(ASockSubSessionPlatsecApiExt) : public MPlatsecApiExt |
|
117 /** |
|
118 Support for UPS. |
|
119 |
|
120 Aggregate class used with CSockSubSession derived classes to allow them |
|
121 to provide an interface for retrieving thread/process id dynamically |
|
122 according to the last message. |
|
123 |
|
124 @internalTechnology |
|
125 */ |
|
126 { |
|
127 public: |
|
128 static TInt GetProcessAndThreadIdFromRMessage(const RMessage2& aMessage, TProcessId& aProcessId, TThreadId& aThreadId); |
|
129 virtual ~ASockSubSessionPlatsecApiExt(); |
|
130 |
|
131 protected: |
|
132 ASockSubSessionPlatsecApiExt(); |
|
133 |
|
134 private: |
|
135 // from MPlatsecApiExt |
|
136 TInt SecureId(TSecureId& aResult) const; |
|
137 TInt VendorId(TVendorId& aResult) const; |
|
138 TBool HasCapability(const TCapability aCapability) const; |
|
139 TInt CheckPolicy(const TSecurityPolicy& aPolicy) const; |
|
140 }; |
|
141 |
|
142 #endif //SYMBIAN_NETWORKING_UPS |
|
143 |
|
144 class TCFSigRMessage2PlatsecExt : public TCFSigRMessage2Ext, protected MPlatsecApiExt |
|
145 { |
|
146 public: |
|
147 inline TCFSigRMessage2PlatsecExt() {}; |
|
148 TCFSigRMessage2PlatsecExt(const RMessage2& aMessage) |
|
149 : TCFSigRMessage2Ext(aMessage) |
|
150 { |
|
151 } |
|
152 |
|
153 protected: |
|
154 // From MPlatsecExtensionApi |
|
155 IMPORT_C virtual TInt SecureId(TSecureId& aResult) const; |
|
156 IMPORT_C virtual TInt VendorId(TVendorId& aResult) const; |
|
157 IMPORT_C virtual TBool HasCapability(const TCapability aCapability) const; |
|
158 IMPORT_C virtual TInt CheckPolicy(const TSecurityPolicy& aPolicy) const; |
|
159 }; |
|
160 |
|
161 |
|
162 |
|
163 } // namespace ESock |
|
164 |
|
165 |
|
166 #endif |
|
167 // SS_PLATSECEXTAPI_H |
|
168 |