E-MailRelay
Classes | Public Types | Public Member Functions | List of all members
GSmtp::Filter Class Referenceabstract

An interface for processing a message file through a filter. More...

#include <gfilter.h>

+ Inheritance diagram for GSmtp::Filter:

Classes

struct  Exit
 Interprets an executable filter's exit code. More...
 

Public Types

enum  Result { f_ok = 0, f_abandon = 1, f_fail = 2 }
 

Public Member Functions

virtual ~Filter ()
 Destructor.
 
virtual std::string id () const =0
 Returns the id passed to the derived-class constructor. More...
 
virtual bool simple () const =0
 Returns true if the concrete filter class is one that can never change the file (eg. More...
 
virtual void start (const std::string &path)=0
 Starts the filter for the given message file. More...
 
virtual G::Slot::Signal1< int > & doneSignal ()=0
 Returns a signal which is raised once start() has completed or failed. More...
 
virtual void cancel ()=0
 Aborts any incomplete filtering.
 
virtual bool abandoned () const =0
 Returns true if the filter result was 'abandoned'.
 
virtual std::string response () const =0
 Returns a non-empty response string iff the filter failed, or an empty response if successful or abandoned. More...
 
virtual std::string reason () const =0
 Returns a non-empty reason string iff the filter failed, or an empty reason if successful or abandoned. More...
 
virtual bool special () const =0
 Returns true if the filter indicated special handling is required. More...
 
std::string str (bool server_side) const
 Returns a diagnostic string for logging.
 

Detailed Description

An interface for processing a message file through a filter.

The interface is asynchronous, using a slot/signal completion callback.

Filters return a tri-state value (ok, abandon, fail) and a 'special' flag which is interpreted as 're-scan' for server filters and 'stop-scanning' for client filters.

The abandon state is treated more like success on the server side but more like failure on the client side.

The fail state has an associated public response (eg. "rejected") and a more expansive private reason.

Definition at line 48 of file gfilter.h.

Member Function Documentation

virtual G::Slot::Signal1<int>& GSmtp::Filter::doneSignal ( )
pure virtual

Returns a signal which is raised once start() has completed or failed.

The signal parameter is ok=0, abandon=1, fail=2.

Implemented in GSmtp::SpamFilter, GSmtp::NetworkFilter, GSmtp::NullFilter, and GSmtp::ExecutableFilter.

virtual std::string GSmtp::Filter::id ( ) const
pure virtual

Returns the id passed to the derived-class constructor.

Used in logging.

Implemented in GSmtp::SpamFilter, GSmtp::NetworkFilter, GSmtp::NullFilter, and GSmtp::ExecutableFilter.

virtual std::string GSmtp::Filter::reason ( ) const
pure virtual

Returns a non-empty reason string iff the filter failed, or an empty reason if successful or abandoned.

Implemented in GSmtp::SpamFilter, GSmtp::NetworkFilter, GSmtp::NullFilter, and GSmtp::ExecutableFilter.

virtual std::string GSmtp::Filter::response ( ) const
pure virtual

Returns a non-empty response string iff the filter failed, or an empty response if successful or abandoned.

Implemented in GSmtp::SpamFilter, GSmtp::NetworkFilter, GSmtp::NullFilter, and GSmtp::ExecutableFilter.

virtual bool GSmtp::Filter::simple ( ) const
pure virtual

Returns true if the concrete filter class is one that can never change the file (eg.

a do-nothing filter class).

Implemented in GSmtp::SpamFilter, GSmtp::NetworkFilter, GSmtp::NullFilter, and GSmtp::ExecutableFilter.

virtual bool GSmtp::Filter::special ( ) const
pure virtual

Returns true if the filter indicated special handling is required.

Implemented in GSmtp::SpamFilter, GSmtp::NetworkFilter, GSmtp::NullFilter, and GSmtp::ExecutableFilter.

virtual void GSmtp::Filter::start ( const std::string &  path)
pure virtual

Starts the filter for the given message file.

Any previous, incomplete filtering is cancel()ed. Asynchronous completion is indicated by a doneSignal().

Implemented in GSmtp::SpamFilter, GSmtp::NetworkFilter, GSmtp::NullFilter, and GSmtp::ExecutableFilter.


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