E-MailRelay

gnullfilter.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 gnullfilter.h
19///
20
21#ifndef G_NULL_FILTER_H
22#define G_NULL_FILTER_H
23
24#include "gdef.h"
25#include "gtimer.h"
26#include "gfilter.h"
27#include "gfilestore.h"
28#include "gdatetime.h"
29
30 namespace GFilters
31{
32 class NullFilter ;
33}
34
35//| \class GFilters::NullFilter
36/// A Filter class that does nothing.
37///
38 class GFilters::NullFilter : public GSmtp::Filter
39{
40 public:
41 NullFilter( GNet::EventState , GStore::FileStore & ,
42 Filter::Type , const Filter::Config & ) ;
43 ///< Constructor for a do-nothing filter.
44
45 NullFilter( GNet::EventState , GStore::FileStore & ,
46 Filter::Type , const Filter::Config & , unsigned int exit_code ) ;
47 ///< Constructor for a filter that behaves like an
48 ///< executable that always exits with the given
49 ///< exit code.
50
51 NullFilter( GNet::EventState , GStore::FileStore & ,
52 Filter::Type , const Filter::Config & , G::TimeInterval ) ;
53 ///< Constructor for a do-nothing filter that takes
54 ///< its time.
55
56 private: // overrides
57 std::string id() const override ; // GSmtp::Filter
58 bool quiet() const override ; // GSmtp::Filter
59 G::Slot::Signal<int> & doneSignal() noexcept override ; // GSmtp::Filter
60 void start( const GStore::MessageId & ) override ; // GSmtp::Filter
61 void cancel() override ; // GSmtp::Filter
62 Result result() const override ; // GSmtp::Filter
63 std::string response() const override ; // GSmtp::Filter
64 int responseCode() const override ; // GSmtp::Filter
65 std::string reason() const override ; // GSmtp::Filter
66 bool special() const override ; // GSmtp::Filter
67
68 public:
69 ~NullFilter() override = default ;
70 NullFilter( const NullFilter & ) = delete ;
71 NullFilter( NullFilter && ) = delete ;
72 NullFilter & operator=( const NullFilter & ) = delete ;
73 NullFilter & operator=( NullFilter && ) = delete ;
74
75 private:
76 void onTimeout() ;
77
78 private:
79 std::string m_id ;
80 Filter::Exit m_exit ;
81 bool m_quiet ;
82 G::TimeInterval m_timeout ;
83 GNet::Timer<NullFilter> m_timer ;
84 G::Slot::Signal<int> m_done_signal ;
85} ;
86
87#endif
GFilters::NullFilter
A Filter class that does nothing.
Definition: gnullfilter.h:39
GFilters::NullFilter::NullFilter
NullFilter(GNet::EventState, GStore::FileStore &, Filter::Type, const Filter::Config &)
Constructor for a do-nothing filter.
Definition: gnullfilter.cpp:27
GNet::EventState
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
Definition: geventstate.h:131
GNet::Timer
A timer class template in which the timeout is delivered to the specified method.
Definition: gtimer.h:141
GSmtp::Filter
An interface for processing a message file through a filter.
Definition: gfilter.h:51
GStore::FileStore
A concrete implementation of the MessageStore interface dealing in paired flat files.
Definition: gfilestore.h:56
GStore::MessageId
A somewhat opaque identifer for a GStore::MessageStore message id.
Definition: gmessagestore.h:43
G::TimeInterval
An interval between two G::SystemTime values or two G::TimerTime values.
Definition: gdatetime.h:305
gdatetime.h
gfilestore.h
gfilter.h
gtimer.h
GFilters
Message filter classes.
Definition: gcopyfilter.h:31
G::Slot::Signal< int >