cryptomgmtlibs/securitytestfw/test/testutil/client/testutilclient.h
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2004-2009 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 the License "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: 
       
    15 * TestUtil - client interface
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @test
       
    23  @internalComponent
       
    24 */
       
    25 
       
    26 #ifndef __TESTUTILCLIENT_H__
       
    27 #define __TESTUTILCLIENT_H__
       
    28 
       
    29 #include <e32std.h>
       
    30 #include <f32file.h>
       
    31 
       
    32 class RTestUtilSession : public RSessionBase
       
    33 	{
       
    34 public:
       
    35 	IMPORT_C TInt Connect();
       
    36 	IMPORT_C TInt Copy(const TDesC& aSourceFile, const TDesC& aDestinationFile);
       
    37 	IMPORT_C TInt Move(const TDesC& aSourceFile, const TDesC& aDestinationFile);
       
    38 	IMPORT_C TInt Delete(const TDesC& aFileName);
       
    39 	IMPORT_C TInt MkDirAll(const TDesC& aFileName);
       
    40 	IMPORT_C TInt RmDir(const TDesC& aFileName);
       
    41 	IMPORT_C TBool FileExistsL(const TDesC& aFileName);
       
    42 	IMPORT_C TBool FileExistsL(const TDesC& aFileName, TInt aMsecTimeout);
       
    43 
       
    44 	/**
       
    45 	 * Format the specified drive
       
    46 	 *
       
    47 	 * If the drive is NOT mounted the format will fail with error -18 KErrNotReady
       
    48 	 *
       
    49 	 * nb. Formating a drive looks like an MMC insertion to the SWI
       
    50 	 * daemon (it does NOT look like a remove followed by an insert).
       
    51 	 */
       
    52 	IMPORT_C TInt FormatDrive(TInt aDrive, TBool aFormatFatTableOnly = EFalse);
       
    53 	/**
       
    54 	 * Mount the specified drive
       
    55 	 *
       
    56 	 * Mounting an already mounted drive fails with error -21 KErrAccessDenied
       
    57 	 * 
       
    58 	 * Mounting an unmounted drive looks exactly like a MMC card
       
    59 	 * insertion to the SWI daemon.
       
    60 	 *
       
    61 	 * [The SWI daemon detects MMC insertion by registering with the
       
    62 	 * FS server using NotifyChange(ENotifyEntry,,) for a non-existent
       
    63 	 * file on the drive being watched. It then checks if it can read
       
    64 	 * the Volume info to decide if media has been inserted or
       
    65 	 * removed.]
       
    66 	 */
       
    67 	IMPORT_C TInt MountDrive(TInt aDrive);
       
    68 	/**
       
    69 	 * UnMount the specified drive
       
    70 	 *
       
    71 	 * Un-mounting an already un-mounted drive fails with error -18 KErrNotReady
       
    72 	 *
       
    73 	 * Unmounting an mounted drive looks exactly like a MMC card
       
    74 	 * removal to the SWI daemon.
       
    75 	 *
       
    76 	 * Will fail if there are any open file descriptors on the drive.
       
    77 	 */
       
    78 	IMPORT_C TInt UnMountDrive(TInt aDrive);
       
    79 
       
    80 	IMPORT_C TInt Lock(const TDesC& aFileName);
       
    81 	IMPORT_C TInt Unlock(const TDesC& aFileName);
       
    82 
       
    83 	/**
       
    84 	 * Set or clear the read only attribute for the specified file.
       
    85 	 * Set the attribut if aSetReadOnly is non-zero, clear otherwise.
       
    86 	 */	
       
    87 	IMPORT_C TInt SetReadOnly(const TDesC& aFileName, TInt aSetReadOnly = 1);
       
    88 
       
    89 	/**
       
    90 	 * Get a file handle opened for reading for the specified filename - used
       
    91 	 * to access files in private directories.
       
    92 	 */	
       
    93 	IMPORT_C TInt GetFileHandle(const TDesC& aFileName, RFile &aRFile);
       
    94 
       
    95 	/**
       
    96 	 *
       
    97 	 * Proxy file change notify request (RFS::NotifyChange needs AllFiles)
       
    98 	 *
       
    99 	 */
       
   100 	IMPORT_C void WatchFile(const TDesC& aFileName, TRequestStatus& aStatus);
       
   101 
       
   102 	/**
       
   103 	 *
       
   104 	 * Cancel outstanding file watch request.
       
   105 	 *
       
   106 	 */
       
   107 	IMPORT_C void WatchFileCancelL();
       
   108 
       
   109 	IMPORT_C TInt GetNumFilesL(const TDesC& aDirName);
       
   110 
       
   111 	/**
       
   112 	 *
       
   113 	 * Set the Secure clock time.This call requires 
       
   114 	 * TCB and WriteDeviceData Capability.
       
   115 	 * 
       
   116 	 * @param aTimeOffset  The secure clock time is 
       
   117 	 *					   incremented by this value.
       
   118 	 *
       
   119 	 */
       
   120 	IMPORT_C TInt SetSecureClock (TInt aTimeOffset);
       
   121 	};
       
   122 
       
   123 #endif