sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32test\virus\t_vshook.h sl@0: // sl@0: // sl@0: sl@0: #if !defined(__T_VSSHOOK_H__) sl@0: #define __T_VSSHOOK_H__ sl@0: sl@0: #include sl@0: sl@0: /** sl@0: The buffer sized used when scanning a file for a virus. sl@0: @internalComponent sl@0: */ sl@0: const TInt KScanBufferSize = 512; sl@0: sl@0: /** sl@0: The maximum number of virus signatures that can be stored sl@0: in a virus scanner definition file. sl@0: @internalComponent sl@0: */ sl@0: const TInt KMaxVirusSignatures = 100; sl@0: sl@0: sl@0: /** sl@0: The actual implementation of the test virus scanning hook. sl@0: It implements all of the pure virtual functions from CVirusHook. sl@0: @internalComponent sl@0: */ sl@0: class CTestVirusHook: public CFsPlugin sl@0: { sl@0: public: sl@0: static CTestVirusHook* NewL(); sl@0: ~CTestVirusHook(); sl@0: sl@0: virtual void InitialiseL(); sl@0: virtual TInt DoRequestL(TFsPluginRequest& aRequest); sl@0: sl@0: private: sl@0: enum TOperation {EFileOpen, EFileDelete, EFileRename, EFileClose}; sl@0: sl@0: private: sl@0: CTestVirusHook(); sl@0: sl@0: TInt VsFileOpen(TFsPluginRequest& aRequest); sl@0: void VsFileClose(TFsPluginRequest& aRequest); sl@0: TInt VsFileRename(TFsPluginRequest& aRequest); sl@0: TInt VsDirRename(TFsPluginRequest& aRequest); sl@0: TInt VsReadFileSection(TFsPluginRequest& aRequest); sl@0: TInt VsFileDelete(TFsPluginRequest& aRequest); sl@0: TInt VirusScannerName(TDes& aName); sl@0: sl@0: public: sl@0: /** sl@0: Signature for binary compatibility testing sl@0: @internalComponent sl@0: */ sl@0: TInt iSignature; sl@0: /** sl@0: The virus scanners file server session sl@0: @internalComponent sl@0: */ sl@0: RFs iFs; sl@0: /** sl@0: The virus scanner thread. sl@0: @internalComponent sl@0: */ sl@0: RThread iVsThread; sl@0: /** sl@0: An array containing the known virus signatures for the test virus sl@0: scanner. This array is filled up by the virus scanner thread when sl@0: it initialised. sl@0: @internalComponent sl@0: */ sl@0: HBufC8* iKnownSignatures[KMaxVirusSignatures]; sl@0: /** sl@0: The number of signatures which have been loaded in the iKnownSignatures sl@0: array. sl@0: @internalComponent sl@0: */ sl@0: TInt iSignaturesLoaded; sl@0: /** sl@0: A pointer to the class containing all of the functions executed within the sl@0: virus scanning thread. sl@0: @internalComponent sl@0: */ sl@0: // CTestVsThread* iVsThreadClass; sl@0: sl@0: private: sl@0: TInt ScanFile(const TDesC& aName); sl@0: void CleanFile(const TDesC& aName, TInt aOperation); sl@0: TInt ScanBuffer(); sl@0: TInt ValidateRequest(TFsPluginRequest& aRequest, TFileName& aFileName); sl@0: TInt ReadVirusDefinitionFile(); sl@0: sl@0: /** sl@0: An internal buffer used when scanning a file for virus signatures. sl@0: @internalComponent sl@0: */ sl@0: TBuf8 iScanBuf; sl@0: sl@0: private: sl@0: TInt iDrvNumber; sl@0: }; sl@0: sl@0: #endif