terminalsecurity/SCP/SCPServer/inc/SCPServer.h
changeset 0 b497e44ab2fc
child 2 5594fba90824
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     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 SCPSERVER_H
       
    20 #define SCPSERVER_H
       
    21 
       
    22 // Define this so the precompiler in CW 3.1 won't complain about token pasting,
       
    23 // the warnings are not valid
       
    24 #pragma warn_illtokenpasting off
       
    25 
       
    26 #define SCP_USE_POLICY_ENGINE
       
    27 #define SCP_ENFORCE_SECURITY
       
    28 
       
    29 #ifdef __REMOTE_LOCK
       
    30 #define SCP_SMS_LOCK_AVAILABLE
       
    31 #endif // __REMOTE_LOCK
       
    32 
       
    33 // Note: Copy the definitions also to SCPServer.mmp
       
    34 
       
    35 //  INCLUDES
       
    36 #include <e32base.h>
       
    37 #include <bldvariant.hrh>
       
    38 #include <etelmm.h>
       
    39 #include <rmmcustomapi.h>
       
    40 #include <f32file.h>
       
    41 
       
    42 #include "SCPServerInterface.h"
       
    43 #include "SCPConfiguration.h"
       
    44 #include "SCPTimer.h"
       
    45 
       
    46 #include "SCPParamDB.h"
       
    47 #include    <settingsinternalcrkeys.h>
       
    48 #include    <centralrepository.h>
       
    49 
       
    50 #include "SCPDebug.h"
       
    51 #include <TerminalControl3rdPartyParamsPlugin.h>
       
    52 /*#ifdef _DEBUG
       
    53 #define __SCP_DEBUG
       
    54 #endif // _DEBUG
       
    55 
       
    56 #ifdef __SCP_DEBUG
       
    57 #define Dprint(a) RDebug::Print ## a
       
    58 #else
       
    59 #define Dprint(a)
       
    60 #endif // _DEBUG*/
       
    61 
       
    62 
       
    63 // LOCAL CONSTANTS
       
    64 const TInt KSCPConfigUnknown = 0;
       
    65 const TInt KSCPConfigOK = 1;
       
    66 const TInt KSCPConfigInvalid = 2;
       
    67 
       
    68 const TUint KSCPServerShutdownTimeout( 10000000 ); // 10 seconds
       
    69 
       
    70 const TUint KSCPLockOperationTimeout( 10000000 ); // 10 seconds
       
    71 const TUint KSCPAutolockPeriodMaximum( 1440 ); // Autolock period max. value
       
    72 
       
    73 const TInt KSCPCodeBlockLimit( 5 ); // The fifth attempt will lock the code
       
    74 const TInt KSCPCodeBlockedTimeMin( 5 ); // Block the code for 5min
       
    75 _LIT( KSCPNotBlocked, "NB" );
       
    76 
       
    77 const TInt KSCPErrCodeBlockStarted = -102;
       
    78 
       
    79 // Policy engine -related definitions. Used to retrieve and set the code change -policy.
       
    80 _LIT8( KSCPOKResponse, "Operation Ok");
       
    81 
       
    82 _LIT8( KSCPCodePolicyDisallowOperation, 
       
    83     "<Package><Operation action_id = \"Add\" target_id = \"device_lock_passcode_visibility_policy\"><Data><![CDATA[<Rule RuleId=\"device_lock_passcode_visibility_policy_rule2\" Effect=\"Deny\"><Target></Target></Rule>]]></Data></Operation></Package>");
       
    84         
       
    85 _LIT8( KSCPCodePolicyAllowOperation, 
       
    86     "<Package><Operation action_id = \"Remove\" target_id = \"device_lock_passcode_visibility_policy_rule2\"></Operation></Package>");        
       
    87     
       
    88 _LIT8( KCodePolicySubject, "subject" );
       
    89 _LIT8( KCodePolicySubjectValue, "autolock" );
       
    90 _LIT8( KCodePolicyAction, "action" );
       
    91 _LIT8( KCodePolicyActionValue, "lock" );
       
    92 _LIT8( KCodePolicyTypeId, "http://www.w3.org/2001/XMLSchema#string" );
       
    93 
       
    94 // Allowed SIDs for the functions
       
    95 const TUint32 KSCPServerSIDTerminalControl( 0x10207825 ); // Terminal Control Server
       
    96 const TUint32 KSCPServerSIDGeneralSettings( 0x100058EC ); // General Settings
       
    97 //const TUint32 KSCPServerSIDSecurityObserver( 0x10000938 ); // Security Observer
       
    98 const TUint32 KAknNfySrvUid( 0x10281EF2 ); // Security Notifier
       
    99 const TUint32 KSCPServerSIDAutolock( 0x100059B5 ); // Autolock
       
   100 const TUint32 KSCPEvntHndlrUid( 0x20026F5C ); // UID of the DMEventNotifier -> SCPEventHandler
       
   101 const TUint32 KDevEncUiUid( 0x2000259A ); // SID of Device Encryption UI
       
   102 const TUint32 KSCPServerSIDSysAp (0x100058F3);
       
   103 
       
   104 #ifdef SCP_ENFORCE_SECURITY
       
   105 // Policy server elements
       
   106 const CPolicyServer::TPolicyElement SCPPolicyElements[]=
       
   107     {
       
   108         {
       
   109         _INIT_SECURITY_POLICY_S0( KSCPServerSIDTerminalControl ),
       
   110             CPolicyServer::EFailClient
       
   111         },
       
   112         {
       
   113         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   114             CPolicyServer::EFailClient
       
   115         },
       
   116         {
       
   117         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   118             CPolicyServer::EFailClient
       
   119         // Access to the query-functionality will be checked in the service code
       
   120         },
       
   121         {
       
   122         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   123             CPolicyServer::EFailClient
       
   124         // Access to the get-functionality will be checked in the service code
       
   125         },
       
   126         {
       
   127         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   128             CPolicyServer::EFailClient
       
   129         // Anyone can access the authentication calls
       
   130         },
       
   131         {
       
   132         _INIT_SECURITY_POLICY_S0( KSCPServerSIDAutolock ),
       
   133             CPolicyServer::EFailClient
       
   134         // Only Autolock allowed for the Check configuration call
       
   135         },
       
   136         {
       
   137         _INIT_SECURITY_POLICY_S0( KSCPEvntHndlrUid ),
       
   138             CPolicyServer::EFailClient
       
   139         },
       
   140         {
       
   141         _INIT_SECURITY_POLICY_C1( ECapabilityAllFiles ),
       
   142             CPolicyServer::EFailClient
       
   143         }                                                 
       
   144     };
       
   145 #else
       
   146 const CPolicyServer::TPolicyElement SCPPolicyElements[]=
       
   147     {
       
   148         {
       
   149         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   150             CPolicyServer::EFailClient
       
   151         },
       
   152         {
       
   153         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   154             CPolicyServer::EFailClient
       
   155         },
       
   156         {
       
   157         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   158             CPolicyServer::EFailClient
       
   159         },
       
   160         {
       
   161         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   162             CPolicyServer::EFailClient
       
   163         },
       
   164         {
       
   165         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   166             CPolicyServer::EFailClient
       
   167         },
       
   168         {
       
   169         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   170             CPolicyServer::EFailClient        
       
   171         },        
       
   172         {
       
   173         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   174             CPolicyServer::EFailClient        
       
   175         },
       
   176         {
       
   177         _INIT_SECURITY_POLICY_C1( ECapability_None ),
       
   178             CPolicyServer::EFailClient        
       
   179         }                          
       
   180     };
       
   181 #endif // SCP_ENFORCE_SECURITY
       
   182 
       
   183 // Policy server ranges
       
   184 const TInt SCPPolicyRanges[] = 
       
   185     {
       
   186     0, // Functional calls
       
   187     10, // Store call
       
   188     20, // Query call
       
   189     30, // Getparam call
       
   190     40, // Authentication calls
       
   191     50, // CheckConfig call
       
   192     60, // App cleanup call
       
   193     70 // SetAutoLock period from UI 
       
   194     };
       
   195     
       
   196 // Policy server elements index
       
   197 const TUint8 SCPPolicyElementsIndex[] =
       
   198     {
       
   199     0,
       
   200     1,
       
   201     2,
       
   202     3,
       
   203     4,
       
   204     5,
       
   205     6,
       
   206     7
       
   207     };
       
   208     
       
   209 // Actual policy definition
       
   210 const CPolicyServer::TPolicy CSCPServerPolicy =
       
   211     {
       
   212     CPolicyServer::EAlwaysPass, // Connection policy
       
   213     8,  // Range count
       
   214     SCPPolicyRanges,
       
   215     SCPPolicyElementsIndex,
       
   216     SCPPolicyElements
       
   217     };      
       
   218 
       
   219 const TInt KSCPDefaultMaxTO( 0 );
       
   220 
       
   221 // reasons for server panic
       
   222 enum TSCPServPanic
       
   223 	{
       
   224 	ESvrCreateServer,
       
   225 	ESvrStartServer,
       
   226 	ECreateTrapCleanup,
       
   227 	EBadRequest,
       
   228 	EBadHashDigest
       
   229 	};
       
   230 
       
   231 
       
   232 // DATA TYPES
       
   233 
       
   234 // FORWARD DECLARATIONS
       
   235 class CSCPSessionbase;
       
   236 
       
   237 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   238 class CSCPPluginManager;
       
   239 class CSCPPluginEventHandler;
       
   240 class CSCPParamObject;
       
   241 class MSCPPluginEventHandler;
       
   242 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   243 
       
   244 // function to panic the server
       
   245 void PanicServer( TSCPServPanic aPanic );
       
   246 
       
   247 // FORWARD CLASS DECLARATION
       
   248 class CSCPParamDBController;
       
   249 
       
   250 /**
       
   251 *  The class which contains the actual SCP server implementation
       
   252 */
       
   253 class CSCPServer : public CPolicyServer, public MSCPTimeoutHandler
       
   254 	{
       
   255 	
       
   256 	public:  // Methods
       
   257 
       
   258         enum { EPriority = CActive::EPriorityStandard }; 
       
   259     	
       
   260         // Constructors and destructor      
       
   261 
       
   262         /**
       
   263         * Static constructor.
       
   264         */
       
   265    	    static CSCPServer* NewL();
       
   266 
       
   267         /**
       
   268         * Destructor.
       
   269         */
       
   270         virtual ~CSCPServer();
       
   271 
       
   272         // New methods
       
   273         
       
   274         /**
       
   275         * The initial entry point to the actual server code
       
   276         * @param aNone Not used
       
   277         * @return Always success, may panic if the server or 
       
   278         * the cleanup stack cannot be created
       
   279         */
       
   280         static TInt ThreadFunction(TAny* aNone);    	   	        
       
   281         
       
   282         /**
       
   283         * A method to retrieve the code stored on the server
       
   284         * @param aCode A descriptor buffer that is to contain the code
       
   285         * @return TInt: A generic status value
       
   286         * <BR><B>Name of return value:</B> Status
       
   287         * <BR><B>Type of return value:</B> TInt
       
   288         * <BR><B>Range of return value:</B> A system error code
       
   289         * <BR><B>Contents of return value:</B> The status code
       
   290         */
       
   291         TInt GetCode( TDes& aCode );
       
   292         
       
   293         /**
       
   294         * A method to store a new ISA code value to the server
       
   295         * @param aCode A descriptor buffer that contains the new code
       
   296         * @return TInt: A generic status value
       
   297         * <BR><B>Name of return value:</B> Status
       
   298         * <BR><B>Type of return value:</B> TInt
       
   299         * <BR><B>Range of return value:</B> A system error code
       
   300         * <BR><B>Contents of return value:</B> The status code        
       
   301         */
       
   302         TInt StoreCode( TDes& aCode );
       
   303         
       
   304         /**
       
   305         * Tries to change the ISA-side code using the stored old code.
       
   306         * @param aNewPassword The new password
       
   307         */        
       
   308         void ChangeISACodeL( RMobilePhone::TMobilePassword& aNewPassword );
       
   309         
       
   310 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   311         
       
   312         /**
       
   313         * Get the 5-digit ISA code value from the given hash-buffer.
       
   314         * @param aHashBuf A descriptor buffer that contains a MD5 digest
       
   315         * @return TInt: The hashed DOS code
       
   316         * <BR><B>Name of return value:</B> DOS code
       
   317         * <BR><B>Type of return value:</B> TInt
       
   318         * <BR><B>Range of return value:</B> 10000-99999
       
   319         * <BR><B>Contents of return value:</B> The hashed code        
       
   320         */
       
   321         static TInt HashISACode( TDes& aHashBuf );
       
   322         
       
   323         /**
       
   324         * A method to store a new enhanced code value to the server
       
   325         * @param aCode A descriptor buffer that contains the new code
       
   326         * @param aNewDOScode A ptr to a descriptor buffer, which will contain the new
       
   327         * DOS code after a successful call
       
   328         * @return TInt: A generic status value
       
   329         * <BR><B>Name of return value:</B> Status
       
   330         * <BR><B>Type of return value:</B> TInt
       
   331         * <BR><B>Range of return value:</B> A system error code
       
   332         * <BR><B>Contents of return value:</B> The status code        
       
   333         */
       
   334         TInt StoreEnhCode( TDes& aCode, TSCPSecCode* aNewDOSCode = NULL );
       
   335 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   336              
       
   337         /**
       
   338         * A method for checking if a session has the given operation in progress
       
   339         * @param aCommand The command to check for
       
   340         * @return The status of the given command
       
   341         * <BR><B>Name of return value:</B> Status
       
   342         * <BR><B>Type of return value:</B> TBool
       
   343         * <BR><B>Range of return value:</B> ETrue/EFalse
       
   344         * <BR><B>Contents of return value:</B> The status code        
       
   345         */
       
   346         TBool IsOperationInProgress( TSCPAdminCommand aCommand );
       
   347         
       
   348         /**
       
   349         * A method for acknowledging commands of a given type, also returns if a 
       
   350         * session was waiting for the acknowledgement
       
   351         * @param aCommand The command the acknowledgement is for
       
   352         * @return ETrue if a session was waiting, otherwise EFalse
       
   353         * <BR><B>Name of return value:</B> Status
       
   354         * <BR><B>Type of return value:</B> TBool
       
   355         * <BR><B>Range of return value:</B> ETrue/EFalse
       
   356         * <BR><B>Contents of return value:</B> The status code        
       
   357         */
       
   358         TBool AcknowledgementReceived( TSCPAdminCommand aCommand );
       
   359         
       
   360         /**
       
   361         * Handles get parameter value messages.
       
   362         * @param aMessage The message received from the client
       
   363         * <BR><B>Name of return value:</B> Status
       
   364         * <BR><B>Type of return value:</B> TInt
       
   365         * <BR><B>Range of return value:</B> A system error code
       
   366         * <BR><B>Contents of return value:</B> The status code        
       
   367         */  
       
   368         TInt SetParameterValueL( TInt aID, const TDesC& aValue, TUint32 aCallerIdentity );       
       
   369         
       
   370         /**
       
   371         * Handles set parameter value messages.
       
   372         * @param aMessage The message received from the client
       
   373         * <BR><B>Name of return value:</B> Status
       
   374         * <BR><B>Type of return value:</B> TInt
       
   375         * <BR><B>Range of return value:</B> A system error code
       
   376         * <BR><B>Contents of return value:</B> The status code        
       
   377         */  
       
   378         TInt GetParameterValueL( TInt aID, TDes& aValue, TUint32 aCallerIdentity );
       
   379         
       
   380         /**
       
   381         * Checks the validity of the given ISA code string.
       
   382         * @param aCode The code whose validity is to be checked.
       
   383         * <BR><B>Name of return value:</B> Code validity state
       
   384         * <BR><B>Type of return value:</B> TBool
       
   385         * <BR><B>Range of return value:</B> ETrue/EFalse
       
   386         * <BR><B>Contents of return value:</B> A truth value indicating the validity
       
   387         */  
       
   388         static TBool IsValidISACode( TDes& aCode );                        
       
   389              
       
   390         /**
       
   391         * Sets the autolock period.
       
   392         * @param aValue The new value for the period
       
   393         * <BR><B>Name of return value:</B> Status
       
   394         * <BR><B>Type of return value:</B> TInt
       
   395         * <BR><B>Range of return value:</B> A system error code
       
   396         * <BR><B>Contents of return value:</B> The status code 
       
   397         */  
       
   398         TInt SetAutolockPeriodL( TInt aValue );
       
   399         
       
   400         /**
       
   401         * Gets the autolock period.
       
   402         * @param aValue A reference that will contain the value on success
       
   403         * <BR><B>Name of return value:</B> Status
       
   404         * <BR><B>Type of return value:</B> TInt
       
   405         * <BR><B>Range of return value:</B> A system error code
       
   406         * <BR><B>Contents of return value:</B> The status code 
       
   407         */  
       
   408         TInt GetAutolockPeriodL( TInt& aValue );  
       
   409         
       
   410         /**
       
   411         * Informs the server that a session has been closed.
       
   412         */  
       
   413         void SessionClosed();
       
   414         
       
   415         /**
       
   416         * Informs the server that a session has been opened.
       
   417         */  
       
   418         void SessionOpened();        
       
   419         
       
   420         /**
       
   421         * Check if the given DOS code is correct.
       
   422         */           
       
   423         void CheckISACodeL( RMobilePhone::TMobilePassword aCode );  
       
   424         
       
   425         /**
       
   426         * Check if the server configuration is valid and in-sync with the DOS.
       
   427         * @param aMode The check mode, initial or complete. The initial mode only checks if the
       
   428         * configuration has already been validated.
       
   429         */        
       
   430         void ValidateConfigurationL( TInt aMode );
       
   431         
       
   432         /**
       
   433         * Fetches the server's handles to Etel sever and RMobilePhone API. Opens
       
   434         * if required.
       
   435         * @param aTelServ A handle ptr to receive the Etel API handle ptr
       
   436         * @param aPhone A handle ptr to receive the RMobilePhone API handle ptr
       
   437         */
       
   438         void GetEtelHandlesL( RTelServer** aTelServ = NULL, RMobilePhone** aPhone = NULL );                      
       
   439         
       
   440 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   441 
       
   442         /**
       
   443         * Checks the validity of the given enhanced code string.
       
   444         * @param aCode The code whose validity is to be checked.
       
   445         * <BR><B>Name of return value:</B> Code validity state
       
   446         * <BR><B>Type of return value:</B> TBool
       
   447         * <BR><B>Range of return value:</B> ETrue/EFalse
       
   448         * <BR><B>Contents of return value:</B> A truth value indicating the validity
       
   449         */  
       
   450         static TBool IsValidEnhCode( TDes& aCode );
       
   451         
       
   452         /**
       
   453         * Check if the code is blocked
       
   454         * @return The status
       
   455         */          
       
   456         TBool IsCodeBlocked();
       
   457         
       
   458         /**
       
   459         * Send a DOS code known to be invalid. Makes sure the DOS code isn't blocked.
       
   460         */          
       
   461         void SendInvalidDOSCode( RMobilePhone::TMobilePassword& aCodeToSend );
       
   462 
       
   463         /**
       
   464         * The end-point method for authentication calls. Checks the given code and returns
       
   465         * the correct/incorrect ISA code.
       
   466         */         
       
   467         TInt CheckCodeAndGiveISAL( TDes& aCodeToCheck, 
       
   468                                   TDes& aISACodeToReturn,
       
   469                                   CSCPParamObject*& aRetParams,
       
   470                                   TInt aFlags ); 
       
   471         
       
   472         /**
       
   473         * The end-point method for the change security code -call. Checks the given code, and 
       
   474         * changes the code, if it was correct.
       
   475         */          
       
   476         TInt CheckAndChangeEnhCodeL( TDes& aOldPass,
       
   477                             TDes& aNewPass,
       
   478                             CSCPParamObject*& aRetParams,
       
   479                             TSCPSecCode& aNewDOSCode );
       
   480                             
       
   481         /**
       
   482         * Retrieves the plugin event handler -object to be used.
       
   483         */          
       
   484         MSCPPluginEventHandler* GetEventHandlerL();  
       
   485         
       
   486         /**
       
   487         * Checks from the plugins, if the password is allowed to be changed at this time.
       
   488         */           
       
   489         TInt IsPasswordChangeAllowedL( CSCPParamObject*& aRetParams );
       
   490             
       
   491 		/**
       
   492 		* This method is called to remove the parameters set by the application(s) provided as arguments.
       
   493 		*/
       
   494         TInt PerformCleanupL( HBufC8* aAppIDBuffer, RArray<const TParamChange>& aChangeArray, RPointerArray<HBufC8>& aParamValArray );
       
   495 //#endif //  __SAP_DEVICE_LOCK_ENHANCEMENTS 
       
   496         
       
   497         // Methods from base classes
       
   498         
       
   499         /**
       
   500         * From CPolicyServer The session creation function
       
   501         * @param aVersion The version of the requesting client
       
   502         * @param aMsg The connection message
       
   503         * @return A pointer to a new session
       
   504         * <BR><B>Name of return value:</B> New session pointer
       
   505         * <BR><B>Type of return value:</B> CSession2*
       
   506         * <BR><B>Range of return value:</B> A valid pointer to a new session
       
   507         * <BR><B>Contents of return value:</B> A valid pointer to a new session
       
   508         */
       
   509         CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMsg ) const;
       
   510         
       
   511         /**
       
   512         * From MSCPTimeoutHandler Timeout callback
       
   513         * @param aParam The parameter passed to the timer object
       
   514         */        
       
   515         void Timeout( TAny* aParam );
       
   516         
       
   517     private: //Methods
       
   518     
       
   519         // New Methods
       
   520         
       
   521         /**
       
   522         * C++ default constructor.
       
   523         */
       
   524         CSCPServer( TInt aPriority );
       
   525         
       
   526         /**
       
   527         * The actual worker method for the server        
       
   528         * @return TInt: KErrNone is successful
       
   529         */
       
   530         static TInt ThreadFunctionStage2L(); 
       
   531 
       
   532         /**
       
   533         * By default Symbian 2nd phase constructor is private.
       
   534         */
       
   535         void ConstructL();  
       
   536         
       
   537         /**
       
   538         * Set the change policy for the security code
       
   539         * @return TInt: KErrNone is successful, otherwise a system error code
       
   540         */        
       
   541         TInt ChangeCodePolicy( const TDesC& aValue );
       
   542         
       
   543 		/**
       
   544 		* Sets the best policy for the given parameter
       
   545 		* @return TInt: KErrNone if successful, otherwise a system wide error
       
   546 		*/
       
   547         TInt SetBestPolicyL( TInt aID, const TDesC& aValue, TUint32 aCallerIdentity, CSCPParamDBController* aParamDB );
       
   548 		
       
   549         /**
       
   550         * Retrieve the change policy for the security code
       
   551         * @return TInt: KErrNone is successful, otherwise a system error code
       
   552         */
       
   553         TInt GetCodePolicy( TDes& aValue );
       
   554         
       
   555         /**
       
   556         * Check if Restore Factory Settings has been run, and reset the server
       
   557         * configuration if it has.
       
   558         */
       
   559         void CheckIfRfsPerformedL();        
       
   560         
       
   561         
       
   562        // #ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS        
       
   563         
       
   564         /**
       
   565         * Retrieve the change policy for the security code
       
   566         * @return TInt: KErrNone is successful, otherwise a system error code
       
   567         */  
       
   568         TInt IsCorrectEnhCode( TDes& aCode, TInt aFlags );
       
   569         
       
   570         //#endif //  __SAP_DEVICE_LOCK_ENHANCEMENTS        
       
   571         
       
   572         /**
       
   573         * Checks if device memory is encrypted or not. The check is only done for phone memory.
       
   574         * @return TBool. ETrue if phone memory is encrypted, otherwise EFalse.
       
   575         */  
       
   576         TBool IsDeviceMemoryEncrypted();
       
   577     
       
   578     private:   // Data
       
   579         /** An object that contains the configuration data for the server */
       
   580         TSCPConfiguration iConfiguration;                
       
   581         
       
   582         #ifndef SCP_USE_POLICY_ENGINE
       
   583         /** Used to store the state of the code change policy */
       
   584         TInt iCodePolicy;
       
   585         #endif // SCP_USE_POLICY_ENGINE
       
   586             
       
   587         /** Used for retrieving and changing the Autolock period, owned. */
       
   588         CRepository* iALPeriodRep;  
       
   589         
       
   590         /** Pointer to a timer-object used to shut down the server after
       
   591         all sessions have been closed and a specified time has elapsed. Owned.*/
       
   592         CSCPTimer* iShutdownTimer; 
       
   593         
       
   594         /** A handle to ETel server */
       
   595         RTelServer iTelServ;
       
   596         /** A handle to the multimode TSY */
       
   597         RMobilePhone iPhone;
       
   598         
       
   599         /** A handle to the File Server */
       
   600         RFs iRfs;  
       
   601         
       
   602        // #ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   603         
       
   604         /** A pointer to the plugin manager object, owned */
       
   605         CSCPPluginManager* iPluginManager;     
       
   606         
       
   607         /** A pointer to the plugin event handler object, owned */
       
   608         CSCPPluginEventHandler* iPluginEventHandler;           
       
   609         
       
   610         /** An integer variable to define the input mode of the lock code query */
       
   611         TInt def_mode;
       
   612         
       
   613     	/** A character variable to get the very first character of the lock code */
       
   614     	TChar ch;      
       
   615         
       
   616     	TBool iOverrideForCleanup;
       
   617        // #endif // __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   618     };
       
   619 
       
   620 #endif      // SCPSERVER_H   
       
   621             
       
   622 // End of File
       
   623