E-MailRelay
|
A FilterFactory implementation. More...
#include <gfilterfactory.h>
Public Member Functions | |
FilterFactory (GStore::FileStore &) | |
Constructor. More... | |
FilterFactory (const FilterFactory &)=delete | |
FilterFactory (FilterFactory &&)=delete | |
FilterFactory & | operator= (const FilterFactory &)=delete |
FilterFactory & | operator= (FilterFactory &&)=delete |
![]() | |
virtual std::unique_ptr< Filter > | newFilter (GNet::EventState, Filter::Type, const Filter::Config &, const Spec &spec)=0 |
Returns a Filter on the heap. More... | |
virtual | ~FilterFactoryBase ()=default |
Destructor. | |
Static Public Member Functions | |
static Spec | parse (std::string_view spec, const G::Path &base_dir={}, const G::Path &app_dir={}, G::StringArray *warnings_p=nullptr) |
Parses and validates the filter specification string returning the type and value in a Spec tuple, eg. More... | |
Protected Member Functions | |
std::unique_ptr< GSmtp::Filter > | newFilter (GNet::EventState, GSmtp::Filter::Type, const GSmtp::Filter::Config &, const Spec &) override |
Returns a Filter on the heap. More... | |
A FilterFactory implementation.
It holds a GSmtp::FileStore reference so that it can instantiate filters that operate on messages stored as files.
Definition at line 44 of file gfilterfactory.h.
|
explicit |
Constructor.
The FileStore reference is retained and passed to new filter objects so that they can derive the paths of the content and envelope files that they process.
Definition at line 41 of file gfilterfactory.cpp.
|
overrideprotectedvirtual |
Returns a Filter on the heap.
Optionally throws if an invalid or unsupported filter specification.
Implements GSmtp::FilterFactoryBase.
Definition at line 122 of file gfilterfactory.cpp.
|
static |
Parses and validates the filter specification string returning the type and value in a Spec tuple, eg.
("file","/usr/bin/foo") or ("net","127.0.0.1:99").
The specification string can be a comma-separated list with the component parts checked separately and the returned Spec is like ("chain","file:foo,net:bar").
Any relative file paths are made absolute using the given base directory, if given. (This is normally from G::Process::cwd() called at startup).
Any "@app" sub-strings in file paths are substituted with the given application directory, if given.
Returns 'first' empty if a fatal parsing error, with the reason in 'second'.
Returns warnings by reference for non-fatal errors, such as missing files.
Definition at line 46 of file gfilterfactory.cpp.