diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-02-26 19:34:09 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-03-03 17:44:31 +0200 |
commit | 13cb4a5e7dc1c22d25c51da52156a558be0b7d05 (patch) | |
tree | e013fb1be4c88430b4be1ef21acb656c7f91eb5d /src/klamonacc.h | |
parent | 8300c80d583320087d844b9f0ad0025d4a60aa10 (diff) | |
download | klamav-13cb4a5e7dc1c22d25c51da52156a558be0b7d05.tar.gz klamav-13cb4a5e7dc1c22d25c51da52156a558be0b7d05.zip |
Added On-Access Scanner.
There are still a few TODOs, but it seems to work quite well already.
This relates to issue #10.
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src/klamonacc.h')
-rw-r--r-- | src/klamonacc.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/klamonacc.h b/src/klamonacc.h new file mode 100644 index 0000000..3938bc1 --- /dev/null +++ b/src/klamonacc.h @@ -0,0 +1,73 @@ +/* + * KlamOnAcc class -- the non-graphical class which manages clamonacc. + * + * Copyright (C) 2021 Mavridis Philippe <mavridisf@gmail.com> + */ + +#ifndef _KLAMONACC_H_ +#define _KLAMONACC_H_ + +#include <tdeapplication.h> + +class TDEProcess; +class KlamOnAccAlert; + +class KlamOnAcc : public TQObject { + Q_OBJECT + + public: + KlamOnAcc( TQWidget *parent, const char *name = 0 ); + virtual ~KlamOnAcc(); + + const TQObject* object() { return static_cast<TQObject*>(this); }; + const bool isActive() { return active; }; + const bool isEnabled() { return enabled; }; + + public slots: + void start(); + void stop(); + void enable(); + void disable(); + void restart(); + void toggle( bool on ); + + private: + TDEConfig *config; + TDEProcess *childproc; + KlamOnAccAlert *alert; + bool enabled = false; + bool active = false; + bool crashed = false; + + /* These contain information about the file which triggered the alert */ + TQString vname; + TQString fname; + + void quarantine(); + + /* We use this to avoid showing two alerts for the same file, as clamonacc + often scans the same file multiple times, triggering the alert */ + TQStringList shownAlerts; + + /* This is a wrapper for tdesu */ + TQString tdesu( TQString command, TQString caption, bool terminal = false ); + + private slots: + /* These functions are responsible for interfacing with clamonacc */ + void childExited(); + void fatalError( TQString descr ); + void processOutput( TDEProcess*, char*, int ); + + /* These functions are responsible for preparing and executing the start/stop/restart commands + They are reused by restart() to avoid calling tdesu twice */ + TQString startPrepare(); + TQString stopPrepare(); + void startProcess( TQString command ); + void stopProcess( TQString command ); + + signals: + /* This signal causes some GUI elements to update */ + void stateUpdated(); +}; + +#endif /* _KLAMONACC_H_ */
\ No newline at end of file |