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