os/kernelhwsrv/kerneltest/f32test/plugins/version_1/virus/t_vshook.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/plugins/version_1/virus/t_vshook.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,118 @@
     1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// f32test\virus\t_vshook.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#if !defined(__T_VSSHOOK_H__)
    1.22 +#define __T_VSSHOOK_H__
    1.23 +
    1.24 +#include <f32plugin.h>
    1.25 +
    1.26 +/**
    1.27 +The buffer sized used when scanning a file for a virus.
    1.28 +@internalComponent
    1.29 +*/
    1.30 +const TInt KScanBufferSize = 512;
    1.31 +
    1.32 +/**
    1.33 +The maximum number of virus signatures that can be stored
    1.34 +in a virus scanner definition file.
    1.35 +@internalComponent
    1.36 +*/
    1.37 +const TInt KMaxVirusSignatures = 100;
    1.38 +
    1.39 +
    1.40 +/**
    1.41 +The actual implementation of the test virus scanning hook.
    1.42 +It implements all of the pure virtual functions from CVirusHook.
    1.43 +@internalComponent
    1.44 +*/
    1.45 +class CTestVirusHook: public CFsPlugin
    1.46 +	{
    1.47 +public:
    1.48 +	static CTestVirusHook* NewL();
    1.49 +	~CTestVirusHook();
    1.50 +
    1.51 +	virtual void InitialiseL();
    1.52 +	virtual TInt DoRequestL(TFsPluginRequest& aRequest);
    1.53 +
    1.54 +private:
    1.55 +	enum TOperation {EFileOpen, EFileDelete, EFileRename, EFileClose};
    1.56 +
    1.57 +private:
    1.58 +	CTestVirusHook();
    1.59 +
    1.60 +	TInt VsFileOpen(TFsPluginRequest& aRequest);
    1.61 +	void VsFileClose(TFsPluginRequest& aRequest);
    1.62 +	TInt VsFileRename(TFsPluginRequest& aRequest);
    1.63 +	TInt VsDirRename(TFsPluginRequest& aRequest);
    1.64 +	TInt VsReadFileSection(TFsPluginRequest& aRequest);
    1.65 +	TInt VsFileDelete(TFsPluginRequest& aRequest);
    1.66 +	TInt VirusScannerName(TDes& aName);
    1.67 +
    1.68 +public:
    1.69 +/**
    1.70 +Signature for binary compatibility testing
    1.71 +@internalComponent
    1.72 +*/
    1.73 +	TInt			iSignature;
    1.74 +/**
    1.75 +The virus scanners file server session
    1.76 +@internalComponent
    1.77 +*/
    1.78 +	RFs		   		iFs;
    1.79 +/**
    1.80 +The virus scanner thread.
    1.81 +@internalComponent
    1.82 +*/
    1.83 +	RThread		   iVsThread;
    1.84 +/**
    1.85 +An array containing the known virus signatures for the test virus
    1.86 +scanner.  This array is filled up by the virus scanner thread when
    1.87 +it initialised.
    1.88 +@internalComponent
    1.89 +*/
    1.90 +	HBufC8*		   iKnownSignatures[KMaxVirusSignatures];
    1.91 +/**
    1.92 +The number of signatures which have been loaded in the iKnownSignatures
    1.93 +array.
    1.94 +@internalComponent
    1.95 +*/
    1.96 +	TInt		   iSignaturesLoaded;
    1.97 +/**
    1.98 +A pointer to the class containing all of the functions executed within the
    1.99 +virus scanning thread.
   1.100 +@internalComponent
   1.101 +*/
   1.102 +//	CTestVsThread* iVsThreadClass;
   1.103 +
   1.104 +private:
   1.105 +	TInt ScanFile(const TDesC& aName);
   1.106 +	void CleanFile(const TDesC& aName, TInt aOperation);
   1.107 +	TInt ScanBuffer();
   1.108 +	TInt ValidateRequest(TFsPluginRequest& aRequest, TFileName& aFileName);
   1.109 +	TInt ReadVirusDefinitionFile();
   1.110 +	
   1.111 +/**
   1.112 +An internal buffer used when scanning a file for virus signatures.
   1.113 +@internalComponent
   1.114 +*/
   1.115 +	TBuf8<KScanBufferSize> iScanBuf;
   1.116 +
   1.117 +private:
   1.118 +	TInt iDrvNumber;
   1.119 +	};
   1.120 +
   1.121 +#endif