E-MailRelay
gfilterfactorybase.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2023 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 "gfilestore.h"
27#include "gexceptionsink.h"
28#include "gexception.h"
29#include <string>
30#include <utility>
31#include <memory>
32
33namespace GSmtp
34{
35 class FilterFactoryBase ;
36}
37
38//| \class GSmtp::FilterFactoryBase
39/// A factory interface for making GSmtp::Filter message processors.
40///
42{
43public:
44 struct Spec /// Filter specification tuple for GSmtp::FilterFactoryBase::newFilter().
45 {
46 Spec() ;
47 Spec( const std::string & , const std::string & ) ;
48 Spec & operator+=( const Spec & ) ;
49 std::string first ; // "exit", "file", "net", "spam", "chain", empty on error
50 std::string second ; // reason on error, or eg. "/bin/a" if "file", eg. "file:/bin/a,file:/bin/b" if "chain"
51 } ;
52
53 virtual std::unique_ptr<Filter> newFilter( GNet::ExceptionSink ,
54 Filter::Type , const Filter::Config & , const Spec & spec ) = 0 ;
55 ///< Returns a Filter on the heap. Optionally throws if
56 ///< an invalid or unsupported filter specification.
57
58 virtual ~FilterFactoryBase() = default ;
59 ///< Destructor.
60} ;
61
62#endif
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
A factory interface for making GSmtp::Filter message processors.
virtual std::unique_ptr< Filter > newFilter(GNet::ExceptionSink, Filter::Type, const Filter::Config &, const Spec &spec)=0
Returns a Filter on the heap.
virtual ~FilterFactoryBase()=default
Destructor.
SMTP classes.
Definition: gadminserver.h:42
Filter specification tuple for GSmtp::FilterFactoryBase::newFilter().
Configuration passed to filter constructors.
Definition: gfilter.h:66