terminalsecurity/server/inc/TerminalControlServer.h
changeset 0 b497e44ab2fc
child 24 13d7c31c74e0
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 __TERMINALCONTROL_SERVER_H__
       
    20 #define __TERMINALCONTROL_SERVER_H__
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 
       
    25 #include <e32base.h>
       
    26 #include "TerminalControlClient.h"
       
    27 #include <SCPClient.h>
       
    28 
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // ----------------------------------------------------------------------------------------
       
    33 // TerminalControl server panic codes
       
    34 // ----------------------------------------------------------------------------------------
       
    35 enum TTerminalControlPanic
       
    36 	{
       
    37 	EPanicGeneral,
       
    38 	EBadSubsessionHandle,
       
    39 	EPanicIllegalFunction,
       
    40 	EBadDescriptor
       
    41 	};
       
    42 
       
    43 
       
    44 // MACROS
       
    45 // DATA TYPES
       
    46 // FUNCTION PROTOTYPES
       
    47 
       
    48 void PanicClient(const RMessagePtr2& aMessage,TTerminalControlPanic aPanic);
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 // CLASS DECLARATION
       
    52 
       
    53 /**
       
    54 *  CTerminalControlServer
       
    55 *  Description.
       
    56 */
       
    57 
       
    58 class CTerminalControlServer : public CPolicyServer
       
    59 	{
       
    60 	friend class CTerminalControlSession;
       
    61 
       
    62 public:
       
    63     class TTcProcessInfo
       
    64         {
       
    65         public:
       
    66             TFullName           iProcessName;
       
    67             TFileName           iFileName;
       
    68             TInt                iHandle;
       
    69             TProcessId          iId;
       
    70             TModuleMemoryInfo   iMemoryInfo;
       
    71             TBool               iCodeInRom;
       
    72             TSecureId           iSecureId;
       
    73             TBool               iProtected;
       
    74         };
       
    75 
       
    76 public:
       
    77 	~CTerminalControlServer();	
       
    78 
       
    79 	static CServer2*    NewLC                   ( );
       
    80 	void                AddSession              ( );
       
    81 	void                DropSession             ( );
       
    82 	CObjectCon*         NewContainerL           ( );	
       
    83 	void                Panic                   ( TInt aPanicCode );
       
    84 
       
    85 private:
       
    86 	CTerminalControlServer();
       
    87 
       
    88 	void                ConstructL              ();
       
    89 	CSession2*          NewSessionL             (const TVersion& aVersion,
       
    90 	                                             const RMessage2& aMessage) const;
       
    91 
       
    92 	//From CPolicyServer
       
    93 	CPolicyServer::TCustomResult
       
    94 	                    CustomSecurityCheckL    (const RMessage2& aMsg,
       
    95 	                                             TInt& aAction,
       
    96 	                                             TSecurityInfo& aMissing);
       
    97 
       
    98     TTcProcessInfo      FindLocalProcessInfoL   ( const TDesC8 &aProcessName );
       
    99 
       
   100 protected:
       
   101     //
       
   102     // Services
       
   103     //
       
   104 	void                DeleteFileL             ( const TDesC8 &aFileName );
       
   105     void                WipeDeviceL             ( );
       
   106     void                DeepFactoryResetL       ( );
       
   107     void                RebootDeviceL            ( );
       
   108     CBufFlat*           GetRunningProcessesL    ( );
       
   109 	CBufFlat*           GetProcessDataL         ( const TDesC8 &aProcessName, TDesC8 &aDataName );	
       
   110 	TInt                GetLockLevelL           ( );
       
   111 	TInt                GetLockTimeoutL         ( );
       
   112 	TInt                GetLockMaxTimeoutL      ( );
       
   113 	void                SetLockLevelL           ( TInt aValue );
       
   114 	void                SetLockTimeoutL         ( TInt aValue );
       
   115 	void                SetLockMaxTimeoutL      ( TInt aValue );
       
   116 	void                SetLockCodeL            ( TDesC8& aCode );
       
   117 // --------- Enhanced features BEGIN ------------------
       
   118 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   119 	void 				SetPasscodeMinLengthL	( TInt aMinLength );
       
   120 	TInt				GetPasscodeMinLengthL	();
       
   121 	void 				SetPasscodeMaxLengthL	( TInt aMaxLength );
       
   122 	TInt				GetPasscodeMaxLengthL	();	
       
   123 	void 				SetPasscodeRequireUpperAndLowerL	( TInt aRequire );
       
   124 	TInt				GetPasscodeRequireUpperAndLowerL	();	
       
   125 	void 				SetPasscodeRequireCharsAndNumbersL	( TInt aRequire );
       
   126 	TInt				GetPasscodeRequireCharsAndNumbersL	();
       
   127 	void 				SetPasscodeMaxRepeatedCharactersL	( TInt aMax );
       
   128 	TInt				GetPasscodeMaxRepeatedCharactersL	();
       
   129 	void 				SetPasscodeHistoryBufferL	( TInt aBufferLength );
       
   130 	TInt				GetPasscodeHistoryBufferL	();
       
   131 	void 				SetPasscodeExpirationL	( TInt aExpiration );
       
   132 	TInt				GetPasscodeExpirationL	();
       
   133 	void 				SetPasscodeMinChangeToleranceL	( TInt aTolerance );
       
   134 	TInt				GetPasscodeMinChangeToleranceL	();
       
   135 	void 				SetPasscodeMinChangeIntervalL	( TInt aInterval );
       
   136 	TInt				GetPasscodeMinChangeIntervalL	();
       
   137 	void 				SetPasscodeCheckSpecificStringsL	( TInt aChoice );
       
   138 	TInt				GetPasscodeCheckSpecificStringsL	();
       
   139 	void				DisallowSpecificPasscodesL( const TDesC8& aString );
       
   140 	void				AllowSpecificPasscodesL( const TDesC8& aString );
       
   141 	void 				ClearSpecificPasscodeStringsL();
       
   142 	void 				SetPasscodeMaxAttemptsL	( TInt aAttempts );
       
   143 	TInt				GetPasscodeMaxAttemptsL	();
       
   144 	void 				SetConsecutiveNumbersL	( TInt aConsecutiveNumbers );
       
   145 	TInt				GetConsecutiveNumbersL	();
       
   146     void                SetPasscodeMinSpecialCharactersL   ( TInt aMin );
       
   147     TInt                GetPasscodeMinSpecialCharactersL   ();
       
   148     void                SetDisallowSimpleL  ( TInt aDisallowSimple );
       
   149     TInt                GetDisallowSimpleL  ();
       
   150 	
       
   151 // ----- enhanced features END ----------------
       
   152 //#endif
       
   153 	void                StartProcessByUidL      ( const TUid& aUID );
       
   154 	void                StartProcessByUidL      ( const TDesC8& aUID );
       
   155 	void                StartProcessByFullNameL ( const TDesC8& aName );
       
   156 	void                StopProcessByUidL       ( const TUid& aUID );
       
   157     void                StopProcessByUidL       ( const TDesC8 &aUID );
       
   158 	void                StopProcessByFullNameL  ( const TDesC8& aName );
       
   159     TBool               GetPasscodePolicyL      ( );
       
   160     void                SetPasscodePolicyL      ( TBool aIsSet );
       
   161 
       
   162 private:
       
   163 	void 				SetIntValueL( TInt avalue, TInt aSCPCommandEnum );
       
   164 	TInt				GetIntValueL( TInt aSCPCommandEnum );
       
   165 private:
       
   166 	TInt            iSessionCount;
       
   167 	CObjectConIx    *iContainerIndex;
       
   168 
       
   169 	// Server policy
       
   170 	#define TC_NUMBER_OF_POLICIES 3
       
   171 	static const CPolicyServer::TPolicy         iTcConnectionPolicy;
       
   172     static const TInt                           iTcRanges         [TC_NUMBER_OF_POLICIES];
       
   173     static const TUint8                         iTcElementsIndex  [TC_NUMBER_OF_POLICIES];
       
   174     static const CPolicyServer::TPolicyElement  iTcElements[TC_NUMBER_OF_POLICIES];
       
   175 
       
   176     CArrayFix<TTcProcessInfo>*                  iProcessInfoArray;
       
   177 
       
   178     RSCPClient iSCPClient;
       
   179 	};
       
   180 
       
   181 #endif //__TERMINALCONTROL_SERVER_H__