Skyld AV  0.6
On access virus scanning for Linux
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
VirusScan Class Reference

Scans files for viruses. More...

#include <VirusScan.h>

Collaboration diagram for VirusScan:
Collaboration graph

Public Types

enum  Status { SCANOK = 0, SCANERROR = -1, SCANVIRUS = 1 }
 Status of virus scanning. More...
 
enum  RunStatus { RUNNING, STOPPING, STOPPED }
 

Public Member Functions

 VirusScan (Environment *)
 Initializes virus scan engine. More...
 
int scan (const int fd)
 Scans file for virus. More...
 
 ~VirusScan ()
 Deletes the virus scanner. More...
 

Private Member Functions

struct cl_engine * createEngine ()
 Creates a new virus scan engine. More...
 
int createThread ()
 Creates a new thread for managing the scan engine. More...
 
void dbstat_clear ()
 Clears database status. More...
 
int dbstat_check ()
 Checks if database has changed. 0 = unchanged, 1 = changed. More...
 
void dbstat_free ()
 Frees database status. More...
 
void destroyEngine (cl_engine *)
 
struct cl_engine * getEngine ()
 Gets reference to virus scan engine. More...
 
void releaseEngine ()
 
void log_virus_found (const int fd, const char *virname)
 Writes log entry. More...
 

Static Private Member Functions

static void * updater (void *)
 Thread to update engine. More...
 

Private Attributes

Environmentenv
 environment More...
 
struct cl_stat dbstat
 Struture indicating if database has changed. More...
 
struct cl_engine * engine
 Reference to virus scan engine. More...
 
pthread_mutex_t mutexEngine
 Mutex for accessing the engine. More...
 
pthread_mutex_t mutexUpdate
 Mutex for accessing the engine. More...
 
enum RunStatus status
 
pthread_t updateThread
 Thrad for updating. More...
 
int engineRefCount
 Reference count of virus scan enginge. More...
 

Detailed Description

Scans files for viruses.

Definition at line 38 of file VirusScan.h.

Member Enumeration Documentation

Enumerator
RUNNING 
STOPPING 
STOPPED 

Definition at line 59 of file VirusScan.h.

Status of virus scanning.

Enumerator
SCANOK 

OK.

SCANERROR 

An error occured.

SCANVIRUS 

A virus was found.

Definition at line 44 of file VirusScan.h.

Constructor & Destructor Documentation

VirusScan::VirusScan ( Environment e)

Initializes virus scan engine.

Definition at line 37 of file VirusScan.cc.

Here is the call graph for this function:

VirusScan::~VirusScan ( )

Deletes the virus scanner.

Definition at line 337 of file VirusScan.cc.

Here is the call graph for this function:

Member Function Documentation

struct cl_engine * VirusScan::createEngine ( )
private

Creates a new virus scan engine.

Returns
virus scan engine

Definition at line 71 of file VirusScan.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int VirusScan::createThread ( )
private

Creates a new thread for managing the scan engine.

Returns
success = 0

Definition at line 168 of file VirusScan.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int VirusScan::dbstat_check ( )
private

Checks if database has changed. 0 = unchanged, 1 = changed.

Definition at line 183 of file VirusScan.cc.

Here is the caller graph for this function:

void VirusScan::dbstat_clear ( )
private

Clears database status.

Definition at line 196 of file VirusScan.cc.

Here is the caller graph for this function:

void VirusScan::dbstat_free ( )
private

Frees database status.

Definition at line 204 of file VirusScan.cc.

Here is the caller graph for this function:

void VirusScan::destroyEngine ( cl_engine *  e)
private

Destroys virus scan engine.

Parameters
evirus scan engine

Definition at line 131 of file VirusScan.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

struct cl_engine * VirusScan::getEngine ( )
private

Gets reference to virus scan engine.

Returns
scan engine

Definition at line 147 of file VirusScan.cc.

Here is the caller graph for this function:

void VirusScan::log_virus_found ( const int  fd,
const char *  virname 
)
private

Writes log entry.

Parameters
fdfile descriptor
virnamename of virus

Definition at line 214 of file VirusScan.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

void VirusScan::releaseEngine ( )
private

Decreases the viurs engine reference count.

Definition at line 232 of file VirusScan.cc.

Here is the caller graph for this function:

int VirusScan::scan ( const int  fd)

Scans file for virus.

Returns
success

Definition at line 243 of file VirusScan.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

void * VirusScan::updater ( void *  virusScan)
staticprivate

Thread to update engine.

Parameters
threadPoolthread pool
Returns
return value

Definition at line 274 of file VirusScan.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

struct cl_stat VirusScan::dbstat
private

Struture indicating if database has changed.

Definition at line 76 of file VirusScan.h.

struct cl_engine* VirusScan::engine
private

Reference to virus scan engine.

Definition at line 80 of file VirusScan.h.

int VirusScan::engineRefCount
private

Reference count of virus scan enginge.

Definition at line 100 of file VirusScan.h.

Environment* VirusScan::env
private

environment

Definition at line 72 of file VirusScan.h.

pthread_mutex_t VirusScan::mutexEngine
private

Mutex for accessing the engine.

Definition at line 84 of file VirusScan.h.

pthread_mutex_t VirusScan::mutexUpdate
private

Mutex for accessing the engine.

Definition at line 88 of file VirusScan.h.

enum RunStatus VirusScan::status
private

Run status

Definition at line 92 of file VirusScan.h.

pthread_t VirusScan::updateThread
private

Thrad for updating.

Definition at line 96 of file VirusScan.h.


The documentation for this class was generated from the following files: