terminalsecurity/inc/TerminalControlClient.h
changeset 0 b497e44ab2fc
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 __TERMINALCONTROLCLIENT_H__
       
    20 #define __TERMINALCONTROLCLIENT_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <ssl.h>
       
    25 #include "TerminalControl.h"
       
    26 #include "TerminalControlClientServer.h"
       
    27 
       
    28 // CONSTANTS
       
    29 _LIT8( KTCPathCDrive, "c:\\" );
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 typedef TBuf8<sizeof(TFileName)> TFileName8;
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 // FORWARD DECLARATIONS
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  RTerminalControlSession class to handle terminal control sessions
       
    42 */
       
    43 	
       
    44 class RTerminalControlSession : public RSubSessionBase
       
    45 {
       
    46 	public: 
       
    47 		//Session management		
       
    48 	    /**
       
    49 		* Connect Open client side session
       
    50 		* @param aServer Reference to connected RTerminalControl
       
    51 	    * @return KErrNone Symbian error code
       
    52         */
       
    53 		IMPORT_C TInt Open(RTerminalControl &aServer, TCertInfo &aCertification );
       
    54 		
       
    55 		/**
       
    56 		* Close Close session
       
    57         */
       
    58 		IMPORT_C void Close();
       
    59 
       
    60 		/**
       
    61 		* Scan files
       
    62         */
       
    63 		IMPORT_C TInt FileScan( const TDesC8& aStartPath = KTCPathCDrive(), TBool aRecursive=EFalse );
       
    64 		
       
    65 		/**
       
    66 		* Get file scan results
       
    67         */
       
    68         IMPORT_C TInt FileScanResultsL( CBufFlat* aBuffer );
       
    69         
       
    70 		/**
       
    71 		* Get file scan results size
       
    72         */
       
    73 		IMPORT_C TInt FileScanResultsSize( TInt &aSize );
       
    74 		
       
    75 		/**
       
    76 		* Get file scan results size
       
    77         */
       
    78 		IMPORT_C TInt FileScanResultsSize( TDes8 &aSize );
       
    79 		
       
    80 		/**		
       
    81 		* Delete file
       
    82         */
       
    83 		IMPORT_C TInt DeleteFile( const TDesC8& aFileName );
       
    84 		
       
    85 		/**
       
    86 		* Set device lock autolock period
       
    87         */
       
    88 		IMPORT_C TInt SetAutolockPeriod( TInt32 aPeriod );
       
    89 
       
    90 		/**
       
    91 		* Get device lock autolock period
       
    92         */
       
    93 		IMPORT_C TInt GetAutolockPeriod( TInt32 &aPeriod );
       
    94 
       
    95 		/**
       
    96 		* Set maximum device lock autolock period
       
    97         */
       
    98 		IMPORT_C TInt SetMaxAutolockPeriod( TInt32 aPeriod );
       
    99 
       
   100 		/**
       
   101 		* Get maximum device lock autolock period
       
   102         */
       
   103 		IMPORT_C TInt GetMaxAutolockPeriod( TInt32 &aPeriod );
       
   104 		
       
   105 		/**
       
   106 		* Set device lock level
       
   107         */
       
   108 		IMPORT_C TInt SetDeviceLockLevel( TInt32 aLevel );
       
   109 
       
   110 		/**
       
   111 		* Get device lock level
       
   112         */
       
   113 		IMPORT_C TInt GetDeviceLockLevel( TInt32 &aLevel );
       
   114 		
       
   115 		/**
       
   116 		* Set lock code
       
   117         */
       
   118 		IMPORT_C TInt SetDeviceLockCode( const TDesC8 &aCode );
       
   119 
       
   120 		/**
       
   121 		* Get lock code
       
   122         */
       
   123 		IMPORT_C TInt GetDeviceLockCode( TDesC8 &aCode );
       
   124 
       
   125 		/**
       
   126 		* Wipe device (factory reset)
       
   127         */
       
   128 		IMPORT_C TInt DeviceWipe( );
       
   129 		
       
   130 		
       
   131 // --------- Enhanced features BEGIN ------------------
       
   132 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS
       
   133 		
       
   134 		/**
       
   135 		* Set the minimum length for passcode.
       
   136 		* 4-256 characters
       
   137 		*/
       
   138 		IMPORT_C TInt SetPasscodeMinLength( TInt32 aMinLength );
       
   139 		
       
   140 		/**
       
   141 		* Get the minimum length for passcode.
       
   142 		* 4-256 characters
       
   143 		*/
       
   144 		IMPORT_C TInt GetPasscodeMinLength( TInt32& aMinLength );
       
   145 		
       
   146 		/**
       
   147 		* Set the maximum length for passcode 
       
   148 		*/
       
   149 		IMPORT_C TInt SetPasscodeMaxLength( TInt32 aMinLength );
       
   150 		
       
   151 		/**
       
   152 		* Get the maximum length for passcode 
       
   153 		*/
       
   154 		IMPORT_C TInt GetPasscodeMaxLength( TInt32& aMinLength );
       
   155 		
       
   156 		
       
   157 		/**
       
   158 		* Set if upper and lower case letter are required in the passcode
       
   159 		*/
       
   160 		IMPORT_C TInt SetPasscodeRequireUpperAndLower( TBool aRequire );
       
   161 		
       
   162 		/**
       
   163 		* Get if upper and lower case letter are required in the passcode
       
   164 		*/
       
   165 		IMPORT_C TInt GetPasscodeRequireUpperAndLower( TBool& aRequire );
       
   166 		
       
   167 		/**
       
   168 		* Set if chars and numbers are required in the passcode
       
   169 		*/
       
   170 		IMPORT_C TInt SetPasscodeRequireCharsAndNumbers( TBool aRequire );
       
   171 		
       
   172 		/**
       
   173 		* Get if chars and numbers are required in the passcode
       
   174 		*/
       
   175 		IMPORT_C TInt GetPasscodeRequireCharsAndNumbers( TBool& aRequire );
       
   176 		
       
   177 		/**
       
   178 		* Set the amount of maximum repeated characters in the passcode.
       
   179 		* 0 = No restriction
       
   180 		* 1-4 = A single character cannot be used more than X times in the password
       
   181 		*/
       
   182 		IMPORT_C TInt SetPasscodeMaxRepeatedCharacters( TInt32 aMaxChars );
       
   183 		
       
   184 		/**
       
   185 		* Get the amount of maximum repeated characters in the passcode
       
   186 		* 0 = No restriction
       
   187 		* 1-4 = A single character cannot be used more than X times in the password
       
   188 		*/
       
   189 		IMPORT_C TInt GetPasscodeMaxRepeatedCharacters( TInt32& aMaxChars );
       
   190 		
       
   191 		
       
   192 		/**
       
   193 		* Set the length of the passcode history buffer.
       
   194 		* The new password cannot match the previous X passwords.
       
   195 		*/
       
   196 		IMPORT_C TInt SetPasscodeHistoryBuffer( TInt32 aBufferLength );
       
   197 		
       
   198 		/**
       
   199 		* Get the length of the passcode history buffer
       
   200 		* The new password cannot match the previous X passwords.
       
   201 		*/
       
   202 		IMPORT_C TInt GetPasscodeHistoryBuffer( TInt32& aBufferLength );
       
   203 		
       
   204 		
       
   205 		/**
       
   206 		* Set passcode expiration time. The password expires after X days.
       
   207 		* 0 = No restriction.
       
   208 		* 1-365 = The password expires after X days.
       
   209 		* -1 = password expires immediately
       
   210 		*/
       
   211 		IMPORT_C TInt SetPasscodeExpiration( TInt32 aExpiration );
       
   212 		
       
   213 		/**
       
   214 		* Get passcode expiration time. The password expires after X days.
       
   215 		* 0 = No restriction.
       
   216 		* 1-365 = The password expires after X days.
       
   217 		*/
       
   218 		IMPORT_C TInt GetPasscodeExpiration( TInt32& aExpiration );
       
   219 		
       
   220 		
       
   221 		/**
       
   222 		* Set the minumum change tolerance for passcode change.
       
   223 		* The user can change the password only X times before 
       
   224 		* PasscodeMinChangeInterval hours have passed.
       
   225 		*/
       
   226 		IMPORT_C TInt SetPasscodeMinChangeTolerance( TInt32 aMinTolerance );
       
   227 		
       
   228 		/**
       
   229 		* Get the minumum change tolerance for passcode change.
       
   230 		* The user can change the password only X times before 
       
   231 		* PasscodeMinChangeInterval hours have passed.
       
   232 		*/
       
   233 		IMPORT_C TInt GetPasscodeMinChangeTolerance( TInt32& aMinTolerance );
       
   234 		
       
   235 		/**
       
   236 		* Set passcode minumum change iterval.
       
   237 		* 0 = No restriction.
       
   238 		* 1-1000 = The user cannot change the password more than 
       
   239 		* 		   PasscodeMinChangeTolerance times before X hours 
       
   240 		*		   have passed since the previous change.
       
   241 		*/
       
   242 		IMPORT_C TInt SetPasscodeMinChangeInterval( TInt32 aMinInterval);
       
   243 		
       
   244 		/**
       
   245 		* Get passcode minumum change iterval.
       
   246 		* 0 = No restriction.
       
   247 		* 1-1000 = The user cannot change the password more than 
       
   248 		* 		   PasscodeMinChangeTolerance times before X hours 
       
   249 		*		   have passed since the previous change.
       
   250 		*/
       
   251 		IMPORT_C TInt GetPasscodeMinChangeInterval( TInt32& aMinInterval );
       
   252 		
       
   253 		
       
   254 		/**
       
   255 		* Set if the passcode is checked not to contain specific strings.
       
   256 		*/
       
   257 		IMPORT_C TInt SetPasscodeCheckSpecificStrings( TBool aCheckSpecificStrings );
       
   258 		
       
   259 		/**
       
   260 		* Check if the passcode is checked not to contain specific strings.
       
   261 		*/
       
   262 		IMPORT_C TInt GetPasscodeCheckSpecificStrings( TBool& aCheckSpecificStrings );
       
   263 		
       
   264 		
       
   265 		/**
       
   266 		* Disallow the specific string/strings given.
       
   267 		* Individual strings can be separated with ";".
       
   268 		*/
       
   269 		IMPORT_C TInt DisallowSpecificPasscodeString( const TDesC8 &aString );
       
   270 		
       
   271 		
       
   272 		/**
       
   273 		* Re-allow the specific string/strings given.
       
   274 		* Individual strings can be separated with ";".
       
   275 		*/
       
   276 		IMPORT_C TInt AllowSpecificPasscodeString( const TDesC8 &aString );
       
   277 		
       
   278 
       
   279 		/**
       
   280 		* Clears the specific passcode strings.
       
   281 		*/
       
   282 		IMPORT_C TInt ClearSpecificPasscodeStrings();
       
   283 		
       
   284 		
       
   285 		/**
       
   286 		* Set the amount how many times the user may attempt to enter the passcode.
       
   287 		* 0 = No restriction
       
   288 		* 3-100 = The device is "hard" reset after the user has consecutively 
       
   289 		* failed X times to answer the password query
       
   290 		*/
       
   291 		IMPORT_C TInt SetPasscodeMaxAttempts( TInt32 aMaxAttempts );
       
   292 		
       
   293 		/**
       
   294 		* Set the amount how many times the user may attempt to enter the passcode.
       
   295 		* 0 = No restriction
       
   296 		* 3-100 = The device is "hard" reset after the user has consecutively 
       
   297 		* failed X times to answer the password query
       
   298 		*/
       
   299 		IMPORT_C TInt GetPasscodeMaxAttempts( TInt32& aMaxAttempts );
       
   300 		
       
   301 		/**
       
   302 		* 0 = No restriction, 1 = The password cannot contain two consecutive numbers
       
   303 		*/
       
   304 		IMPORT_C TInt SetPasscodeConsecutiveNumbers( TBool aConsecutiveNumbers );
       
   305 		
       
   306 		/**
       
   307 		* 0 = No restriction, 1 = The password cannot contain two consecutive numbers
       
   308 		*/
       
   309 		IMPORT_C TInt GetPasscodeConsecutiveNumbers( TBool& aConsecutiveNumbers );
       
   310 
       
   311         /**
       
   312         * Set the amount of minimum special characters in the passcode.
       
   313         * 0 = No restriction
       
   314         * 1-255 = Password should contain at least X number of special characters.
       
   315         */
       
   316         IMPORT_C TInt SetPasscodeMinSpecialCharacters( TInt32 aMinChars );
       
   317         
       
   318         /**
       
   319         * Get the amount of minimum special characters in the passcode.
       
   320         * 0 = No restriction
       
   321         * 1-255 = Password should contain at least X number of special characters.
       
   322         */
       
   323         IMPORT_C TInt GetPasscodeMinSpecialCharacters( TInt32& aMinChars );
       
   324         /**
       
   325         * 0 = No restriction, 1 = The password cannot be a simple string
       
   326         */
       
   327         IMPORT_C TInt SetPasscodeDisallowSimple( TBool aDisallowSimple );
       
   328         		
       
   329         /**
       
   330         * 0 = No restriction, 1 = The password cannot be a simple string
       
   331         */
       
   332         IMPORT_C TInt GetPasscodeDisallowSimple( TBool& aDisallowSimple );
       
   333 //#endif
       
   334 // --------- Enhanced features END --------------------
       
   335 		
       
   336 
       
   337         /**
       
   338 		* Get process list
       
   339         */
       
   340 		IMPORT_C TInt GetProcessListL( CBufFlat* aBuffer );
       
   341 
       
   342         /**
       
   343 		* Get process list size
       
   344         */
       
   345 		IMPORT_C TInt GetProcessListSize( TInt &aSize );
       
   346 
       
   347         /**
       
   348 		* Get process list size
       
   349         */
       
   350 		IMPORT_C TInt GetProcessListSize( TDes8 &aSizeBuf );
       
   351 
       
   352         /**
       
   353 		* Get process information
       
   354         */
       
   355 		IMPORT_C TInt GetProcessDataL( CBufFlat* aBuffer, const TDesC8& aProcessName, const TDesC8 &aData );
       
   356 
       
   357         /**
       
   358 		* Reboot device, restart actually happens after subsession is closed
       
   359         */
       
   360 		IMPORT_C TInt RebootDevice( TBool aRestartDevice=ETrue );
       
   361 
       
   362         /**
       
   363 		* Start local operation (new process)
       
   364         */
       
   365 		IMPORT_C TInt StartNewProcess( TBool aIsUid, const TDesC8& aProcessName );
       
   366 
       
   367         /**
       
   368 		* Stop local operation (in process list)
       
   369         */
       
   370 		IMPORT_C TInt StopProcess( TBool aIsUid, const TDesC8& aProcessName );
       
   371 
       
   372 };
       
   373 
       
   374 #endif //__TERMINALCONTROLCLIENT_H__