21#ifndef G_SMTP_FILTER_H
22#define G_SMTP_FILTER_H
67 unsigned int timeout {60U} ;
69 Config & set_timeout(
unsigned int ) noexcept ;
70 Config & set_domain(
const std::string & ) ;
76 virtual std::string
id()
const = 0 ;
80 virtual bool quiet()
const = 0 ;
116 std::
string str( Type type ) const ;
120 static
std::string_view
strtype( Type type ) noexcept ;
127 Exit(
int exit_code , Type ) ;
129 bool abandon()
const ;
131 Result
result {Result::fail} ;
136inline GSmtp::Filter::Config & GSmtp::Filter::Config::set_timeout(
unsigned int n )
noexcept { timeout = n ;
return *this ; }
137inline GSmtp::Filter::Config & GSmtp::Filter::Config::set_domain(
const std::string & s ) { domain = s ;
return *this ; }
An interface for processing a message file through a filter.
virtual std::string id() const =0
Returns the id passed to the derived-class constructor.
virtual Result result() const =0
Returns the filter result, after the doneSignal() has been emitted.
virtual bool special() const =0
Returns true if the filter indicated special handling is required.
virtual void cancel()=0
Aborts any incomplete filtering.
virtual ~Filter()=default
Destructor.
virtual std::string response() const =0
Returns a non-empty SMTP response string iff the filter failed, or an empty response if successful or...
virtual G::Slot::Signal< int > & doneSignal() noexcept=0
Returns a signal which is raised once start() has completed or failed.
virtual std::string reason() const =0
Returns a non-empty reason string iff the filter failed, or an empty reason if successful or abandone...
std::string str(Type type) const
Returns a diagnostic string for logging, including the filter result.
static std::string_view strtype(Type type) noexcept
Returns a type string for logging: "filter", "client-filter" or "routing-filter".
virtual void start(const GStore::MessageId &)=0
Starts the filter for the given message.
virtual int responseCode() const =0
An override for the SMTP response code for when the filter has failed.
virtual bool quiet() const =0
Returns true if there is no need for logging.
A somewhat opaque identifer for a GStore::MessageStore message id.
Configuration passed to filter constructors.
Interprets an executable filter's exit code.