|
1 /* |
|
2 * Copyright (c) 2000 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: Implementation of terminalsecurity components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SCPSESSION_H |
|
20 #define SCPSESSION_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <bldvariant.hrh> |
|
24 #include <etelmm.h> |
|
25 #include <rmmcustomapi.h> |
|
26 |
|
27 #include "SCPServerInterface.h" |
|
28 #include "SCPTimer.h" |
|
29 |
|
30 #include <TerminalControl3rdPartyParamsPlugin.h> |
|
31 // FORWARD DECLARATIONS |
|
32 class CSCPServer; |
|
33 class CSCPLockNotificationEventHandler; |
|
34 class CSCPLockSettingEventHandler; |
|
35 class RTelServer; |
|
36 class RMobilePhone; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * The class corresponding to a single SCP server session. |
|
42 */ |
|
43 class CSCPSession : public CSession2, public MSCPTimeoutHandler |
|
44 { |
|
45 public: // Methods |
|
46 |
|
47 // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Static constructor. |
|
51 */ |
|
52 static CSCPSession* NewL( CSCPServer& aServer ); |
|
53 |
|
54 /** |
|
55 * Static constructor, that leaves the pointer to the cleanup stack. |
|
56 */ |
|
57 static CSCPSession* NewLC( CSCPServer& aServer ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CSCPSession(); |
|
63 |
|
64 // New methods |
|
65 /** |
|
66 * Check if the given command is in progress |
|
67 * @param aCommand The command that is to be checked for |
|
68 * @return TBool: The command status |
|
69 * <BR><B>Name of return value:</B> Operation state |
|
70 * <BR><B>Type of return value:</B> TBool |
|
71 * <BR><B>Range of return value:</B> ETrue/EFalse |
|
72 * <BR><B>Contents of return value:</B> A truth value indicating |
|
73 * <BR>the operation state. |
|
74 */ |
|
75 TBool IsOperationInProgress( TSCPAdminCommand aCommand ); |
|
76 |
|
77 /** |
|
78 * Acknowledges the given operation, and returns if it was awaited |
|
79 * @param aCommand The command that was acknowledged |
|
80 * @return TBool: The wait status |
|
81 * <BR><B>Name of return value:</B> Wait status |
|
82 * <BR><B>Type of return value:</B> TBool |
|
83 * <BR><B>Range of return value:</B> ETrue/EFalse |
|
84 * <BR><B>Contents of return value:</B> A truth value indicating if the |
|
85 * <BR> acknowledgement was awaited. |
|
86 */ |
|
87 TBool AcknowledgeOperation( TSCPAdminCommand aCommand ); |
|
88 |
|
89 /** |
|
90 * Callback method, indicates the lock operation is complete |
|
91 */ |
|
92 void LockOperationCompleted(); |
|
93 |
|
94 /** |
|
95 * Informs that a lock operation is pending, waiting for an acknowledgement. |
|
96 * @param aCommand The command that is pending |
|
97 * @param aStatus The RequestStatus-variable that is to be signalled on completion. |
|
98 */ |
|
99 void LockOperationPending( TSCPAdminCommand aCommand, |
|
100 TRequestStatus* aStatus ); |
|
101 |
|
102 /** |
|
103 * Changes the DOS side lock setting utilizing the password stored on the server. |
|
104 * @param aLocked The new state for the DOS lock setting |
|
105 * @param aAutolock ETrue if Autolock should be activated on success |
|
106 */ |
|
107 void SetDOSLockSettingL( TBool aLocked, |
|
108 TBool aAutolock, |
|
109 const RMessage2 &aMessage ); |
|
110 |
|
111 /** |
|
112 * Returns the state of the SMS Lock component |
|
113 * @return TBool: ETrue if SMS Lock is active, otherwise EFalse |
|
114 * <BR><B>Name of return value:</B> SMS Lock status |
|
115 * <BR><B>Type of return value:</B> TBool |
|
116 * <BR><B>Range of return value:</B> ETrue/EFalse |
|
117 * <BR><B>Contents of return value:</B> A truth value indicating the |
|
118 * <BR> state of the component |
|
119 */ |
|
120 static TBool IsSMSLockActiveL(); |
|
121 |
|
122 /** |
|
123 * Returns the state of the Autolock component (is the timeout active) |
|
124 * @return TBool: ETrue if Autolock is active, otherwise EFalse |
|
125 * <BR><B>Name of return value:</B> Autolock status |
|
126 * <BR><B>Type of return value:</B> TBool |
|
127 * <BR><B>Range of return value:</B> ETrue/EFalse |
|
128 * <BR><B>Contents of return value:</B> A truth value indicating the |
|
129 * <BR>state of the component |
|
130 */ |
|
131 TBool IsAutolockActive(); |
|
132 |
|
133 // Methods from base classes |
|
134 |
|
135 /** |
|
136 * From CSession The standard service entry point |
|
137 * @param aMessage The message received from the client |
|
138 */ |
|
139 void ServiceL( const RMessage2 &aMessage ); |
|
140 |
|
141 /** |
|
142 * From MSCPTimeoutHandler Timeout handler function |
|
143 * @param aParam The data given to the timer object when initialized. |
|
144 */ |
|
145 void Timeout( TAny* aParam ); |
|
146 |
|
147 |
|
148 private: //Methods |
|
149 |
|
150 // New Methods |
|
151 |
|
152 /** |
|
153 * C++ default constructor. |
|
154 */ |
|
155 CSCPSession( CSCPServer& aServer ); |
|
156 |
|
157 /** |
|
158 * Panic the client |
|
159 * @param ?arg1 ?description |
|
160 * @return ?description |
|
161 */ |
|
162 void PanicClient( TInt aPanic ) const; |
|
163 |
|
164 /** |
|
165 * Handles the get code message |
|
166 * @param aMessage The message received from the client |
|
167 */ |
|
168 void HandleGetCodeMessageL( const RMessage2 &aMessage ); |
|
169 |
|
170 /** |
|
171 * Handles the store code message |
|
172 * @param aMessage The message received from the client |
|
173 */ |
|
174 void HandleSetCodeMessageL( const RMessage2 &aMessage ); |
|
175 |
|
176 /** |
|
177 * Handles the change code message |
|
178 * @param aMessage The message received from the client |
|
179 */ |
|
180 void HandleChangeCodeMessageL( const RMessage2 &aMessage ); |
|
181 |
|
182 /** |
|
183 * Handles the set phone lock message |
|
184 * @param aMessage The message received from the client |
|
185 */ |
|
186 void HandleSetLockStateMessageL( const RMessage2 &aMessage ); |
|
187 |
|
188 /** |
|
189 * Handles the query admin command message. |
|
190 * @param aMessage The message received from the client |
|
191 */ |
|
192 void HandleQueryMessageL( const RMessage2 &aMessage ); |
|
193 |
|
194 /** |
|
195 * Handles the get lock state message. |
|
196 * @param aMessage The message received from the client |
|
197 */ |
|
198 void HandleGetLockStateMessageL( const RMessage2 &aMessage ); |
|
199 |
|
200 /** |
|
201 * Handles get parameter value messages. |
|
202 * @param aMessage The message received from the client |
|
203 */ |
|
204 void HandleGetParamMessageL( const RMessage2 &aMessage ); |
|
205 |
|
206 /** |
|
207 * Handles set parameter value messages. |
|
208 * @param aMessage The message received from the client |
|
209 */ |
|
210 void HandleSetParamMessageL( const RMessage2 &aMessage ); |
|
211 |
|
212 /** |
|
213 * Handles check configuration messages. |
|
214 * @param aMessage The message received from the client |
|
215 */ |
|
216 void HandleCheckConfigMessageL( const RMessage2 &aMessage ); |
|
217 |
|
218 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS |
|
219 |
|
220 /** |
|
221 * Handles the authentication messages |
|
222 * @param aMessage The message received from the client |
|
223 */ |
|
224 void HandleAuthenticationMessageL( const RMessage2 &aMessage ); |
|
225 |
|
226 /** |
|
227 * Handles change code requests from the client |
|
228 * @param aMessage The message received from the client |
|
229 */ |
|
230 void HandleChangeEnhCodeMessageL( const RMessage2 &aMessage ); |
|
231 |
|
232 /** |
|
233 * Handles change code allowed query -messages from the client. |
|
234 * @param aMessage The message received from the client |
|
235 */ |
|
236 void HandleQueryChangeMessageL( const RMessage2 &aMessage ); |
|
237 |
|
238 /** |
|
239 * Handles cleanup (on application uninstallation) |
|
240 * @param aMessage The message received from the client |
|
241 * @return KErrNone if successful, error status otherwise |
|
242 */ |
|
243 TInt HandleCleanupL( const RMessage2 &aMessage ); |
|
244 TInt HandleSetALPeriodL( const RMessage2 &aMessage ); |
|
245 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS |
|
246 |
|
247 /** |
|
248 * Distributes the messages to the current handler function |
|
249 * @param aMessage The message received from the client |
|
250 */ |
|
251 void DispatchSynchronousMessageL( const RMessage2 &aMessage ); |
|
252 |
|
253 /** |
|
254 * By default Symbian 2nd phase constructor is private. |
|
255 */ |
|
256 void ConstructL(); |
|
257 |
|
258 /** |
|
259 * Notifies all the stakeholders of a change in parameter value(s) of the specified parameter(s). |
|
260 * This function is called either from PerformCleanupL() or SetParameterValueL() |
|
261 * |
|
262 * @params aParamIDArray: The ID(s) of the parameter that needs to be set |
|
263 * aParamValueArray: The value(s) of the parameter(s) |
|
264 * |
|
265 * NOTE: aParamValueArray.Count() SHOULD BE EQUAL TO aParamIDArray.Count() |
|
266 * |
|
267 * @return TInt: KErrNone if successful, otherwise a system error code |
|
268 */ |
|
269 TInt NotifyAllStakeHoldersL( const RArray<const TParamChange>& aChange, TUint32 aCallerID ); |
|
270 |
|
271 /** |
|
272 * Notifies all the stakeholders of a change in parameter value(s) of the specified parameter(s). |
|
273 * This function is called either from SetParameterValueL() or LockOperationCompleted() |
|
274 * |
|
275 * @params aParamID: The ID(s) of the parameter that needs to be set |
|
276 * aParamValue: The value(s) of the parameter(s) |
|
277 * |
|
278 * @return none |
|
279 */ |
|
280 void NotifyChangeL( TInt aParamID, const TDesC8 aParamVal, TUint32 aCallerID ); |
|
281 |
|
282 private: // Data |
|
283 // Possible states for iLockCommandState |
|
284 enum TSCPLockCmdState |
|
285 { |
|
286 ESCPLockCmdStateIdle, |
|
287 ESCPLockCmdStateInProgress, |
|
288 ESCPLockCmdStateInProgressAcknowledged, |
|
289 ESCPLockCmdStateFinishedAckPending |
|
290 }; |
|
291 |
|
292 /** A reference to the server */ |
|
293 CSCPServer& iServer; |
|
294 /** A pointer to the notification handler AO, owned */ |
|
295 CSCPLockNotificationEventHandler* iNotificationHandler; |
|
296 /** A pointer to the setting handler AO, owned */ |
|
297 CSCPLockSettingEventHandler* iSettingHandler; |
|
298 /** The current lock command state */ |
|
299 TSCPLockCmdState iLockCommandState; |
|
300 /** The current unlock command state */ |
|
301 TBool iUnlockMessageSent; |
|
302 /** The timeout handler ptr, if created. Owned, */ |
|
303 CSCPTimer* iLockOperationTimer; |
|
304 /** A pointer to the request status for a pending call, not owned */ |
|
305 TRequestStatus* iPendingCallStatus; |
|
306 /** An integer variable to define the input mode of the lock code query */ |
|
307 TInt def_mode; |
|
308 /** A character variable to get the very first character of the lock code */ |
|
309 TChar ch; |
|
310 |
|
311 /* Parameter ID (wil always be either ESCPAutolockPeriod or |
|
312 * ESCPMaxAutolockPeriod) that will be referred to notify the |
|
313 * stakeholders in case of async notification |
|
314 */ |
|
315 TInt iALParamID; |
|
316 |
|
317 /* Parameter value corresponding to iALParamID that |
|
318 * will be referred to notify the stakeholders in case |
|
319 * of async notification. The memory for this is allocated in |
|
320 * HandleSetParamMessageL() and deallocated in LockOperationCompleted() |
|
321 * or the destructor. |
|
322 */ |
|
323 HBufC8* iALParamValue; |
|
324 |
|
325 /* The SID of the app that set the above two (iALParamID, iALParamValue) fields |
|
326 */ |
|
327 TUint32 iALParamCallerID; |
|
328 }; |
|
329 |
|
330 #endif // SCPSESSION_H |
|
331 |
|
332 // End of File |
|
333 |