E-MailRelay

gfilterfactorybase.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file gfilterfactorybase.h
19///
20
21#ifndef G_SMTP_FILTER_FACTORY_BASE_H
22#define G_SMTP_FILTER_FACTORY_BASE_H
23
24#include "gdef.h"
25#include "gfilter.h"
26#include "gstringview.h"
27#include "gfilestore.h"
28#include "geventstate.h"
29#include "gexception.h"
30#include <string>
31#include <utility>
32#include <memory>
33
34 namespace GSmtp
35{
36 class FilterFactoryBase ;
37}
38
39//| \class GSmtp::FilterFactoryBase
40/// A factory interface for making GSmtp::Filter message processors.
41///
42 class GSmtp::FilterFactoryBase
43{
44 public:
45 struct Spec /// Filter specification tuple for GSmtp::FilterFactoryBase::newFilter().
46 {
47 Spec() ;
48 Spec( std::string_view , std::string_view ) ;
49 Spec & operator+=( const Spec & ) ;
50 std::string first ; // "exit", "file", "net", "spam", "chain", empty on error
51 std::string second ; // reason on error, or eg. "/bin/a" if "file", eg. "file:/bin/a,file:/bin/b" if "chain"
52 } ;
53
54 virtual std::unique_ptr<Filter> newFilter( GNet::EventState ,
55 Filter::Type , const Filter::Config & , const Spec & spec ) = 0 ;
56 ///< Returns a Filter on the heap. Optionally throws if
57 ///< an invalid or unsupported filter specification.
58
59 virtual ~FilterFactoryBase() = default ;
60 ///< Destructor.
61} ;
62
63#endif
GNet::EventState
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
Definition: geventstate.h:131
GSmtp::FilterFactoryBase
A factory interface for making GSmtp::Filter message processors.
Definition: gfilterfactorybase.h:43
GSmtp::FilterFactoryBase::newFilter
virtual std::unique_ptr< Filter > newFilter(GNet::EventState, Filter::Type, const Filter::Config &, const Spec &spec)=0
Returns a Filter on the heap.
GSmtp::FilterFactoryBase::~FilterFactoryBase
virtual ~FilterFactoryBase()=default
Destructor.
geventstate.h
gexception.h
gfilestore.h
gfilter.h
gstringview.h
GSmtp
SMTP classes.
Definition: gadminserver.h:42
GSmtp::FilterFactoryBase::Spec
Filter specification tuple for GSmtp::FilterFactoryBase::newFilter().
Definition: gfilterfactorybase.h:46
GSmtp::Filter::Config
Configuration passed to filter constructors.
Definition: gfilter.h:66