os/kernelhwsrv/kerneltest/f32test/plugins/version_1/virus/t_vshook.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // f32test\virus\t_vshook.h
    15 // 
    16 //
    17 
    18 #if !defined(__T_VSSHOOK_H__)
    19 #define __T_VSSHOOK_H__
    20 
    21 #include <f32plugin.h>
    22 
    23 /**
    24 The buffer sized used when scanning a file for a virus.
    25 @internalComponent
    26 */
    27 const TInt KScanBufferSize = 512;
    28 
    29 /**
    30 The maximum number of virus signatures that can be stored
    31 in a virus scanner definition file.
    32 @internalComponent
    33 */
    34 const TInt KMaxVirusSignatures = 100;
    35 
    36 
    37 /**
    38 The actual implementation of the test virus scanning hook.
    39 It implements all of the pure virtual functions from CVirusHook.
    40 @internalComponent
    41 */
    42 class CTestVirusHook: public CFsPlugin
    43 	{
    44 public:
    45 	static CTestVirusHook* NewL();
    46 	~CTestVirusHook();
    47 
    48 	virtual void InitialiseL();
    49 	virtual TInt DoRequestL(TFsPluginRequest& aRequest);
    50 
    51 private:
    52 	enum TOperation {EFileOpen, EFileDelete, EFileRename, EFileClose};
    53 
    54 private:
    55 	CTestVirusHook();
    56 
    57 	TInt VsFileOpen(TFsPluginRequest& aRequest);
    58 	void VsFileClose(TFsPluginRequest& aRequest);
    59 	TInt VsFileRename(TFsPluginRequest& aRequest);
    60 	TInt VsDirRename(TFsPluginRequest& aRequest);
    61 	TInt VsReadFileSection(TFsPluginRequest& aRequest);
    62 	TInt VsFileDelete(TFsPluginRequest& aRequest);
    63 	TInt VirusScannerName(TDes& aName);
    64 
    65 public:
    66 /**
    67 Signature for binary compatibility testing
    68 @internalComponent
    69 */
    70 	TInt			iSignature;
    71 /**
    72 The virus scanners file server session
    73 @internalComponent
    74 */
    75 	RFs		   		iFs;
    76 /**
    77 The virus scanner thread.
    78 @internalComponent
    79 */
    80 	RThread		   iVsThread;
    81 /**
    82 An array containing the known virus signatures for the test virus
    83 scanner.  This array is filled up by the virus scanner thread when
    84 it initialised.
    85 @internalComponent
    86 */
    87 	HBufC8*		   iKnownSignatures[KMaxVirusSignatures];
    88 /**
    89 The number of signatures which have been loaded in the iKnownSignatures
    90 array.
    91 @internalComponent
    92 */
    93 	TInt		   iSignaturesLoaded;
    94 /**
    95 A pointer to the class containing all of the functions executed within the
    96 virus scanning thread.
    97 @internalComponent
    98 */
    99 //	CTestVsThread* iVsThreadClass;
   100 
   101 private:
   102 	TInt ScanFile(const TDesC& aName);
   103 	void CleanFile(const TDesC& aName, TInt aOperation);
   104 	TInt ScanBuffer();
   105 	TInt ValidateRequest(TFsPluginRequest& aRequest, TFileName& aFileName);
   106 	TInt ReadVirusDefinitionFile();
   107 	
   108 /**
   109 An internal buffer used when scanning a file for virus signatures.
   110 @internalComponent
   111 */
   112 	TBuf8<KScanBufferSize> iScanBuf;
   113 
   114 private:
   115 	TInt iDrvNumber;
   116 	};
   117 
   118 #endif