E-MailRelay

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gexecutablefilter.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2018 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 gexecutablefilter.h
19 ///
20
21 #ifndef G_SMTP_EXECUTABLE_FILTER__H
22 #define G_SMTP_EXECUTABLE_FILTER__H
23
24 #include "gdef.h"
25 #include "gsmtp.h"
26 #include "gpath.h"
27 #include "gfilter.h"
28 #include "geventhandler.h"
29 #include "gfutureevent.h"
30 #include "gtask.h"
31 #include <utility>
32
33 namespace GSmtp
34 {
35 class ExecutableFilter ;
36 }
37
38 /// \class GSmtp::ExecutableFilter
39 /// A Filter class that runs an external helper program.
40 ///
41 class GSmtp::ExecutableFilter : public Filter, private GNet::TaskCallback
42 {
43 public:
44 ExecutableFilter( GNet::ExceptionHandler & , bool server_side , const std::string & ) ;
45 ///< Constructor.
46
47 virtual ~ExecutableFilter() ;
48 ///< Destructor.
49
50 virtual std::string id() const override ;
51 ///< Override from from GSmtp::Filter.
52
53 virtual bool simple() const override ;
54 ///< Override from from GSmtp::Filter.
55
56 virtual G::Slot::Signal1<int> & doneSignal() override ;
57 ///< Override from from GSmtp::Filter.
58
59 virtual void start( const std::string & path ) override ;
60 ///< Override from from GSmtp::Filter.
61
62 virtual void cancel() override ;
63 ///< Override from from GSmtp::Filter.
64
65 virtual bool abandoned() const override ;
66 ///< Override from from GSmtp::Filter.
67
68 virtual std::string response() const override ;
69 ///< Override from from GSmtp::Filter.
70
71 virtual std::string reason() const override ;
72 ///< Override from from GSmtp::Filter.
73
74 virtual bool special() const override ;
75 ///< Override from from GSmtp::Filter.
76
77 private:
78 ExecutableFilter( const ExecutableFilter & ) ; // not implemented
79 void operator=( const ExecutableFilter & ) ; // not implemented
80 std::pair<std::string,std::string> parseOutput( std::string , const std::string & ) const ;
81 virtual void onTaskDone( int , const std::string & ) override ; // override from GNet::TaskCallback
82
83 private:
84 G::Slot::Signal1<int> m_done_signal ;
85 bool m_server_side ;
86 std::string m_prefix ;
87 Exit m_exit ;
88 G::Path m_path ;
89 std::string m_response ;
90 std::string m_reason ;
91 GNet::Task m_task ;
92 } ;
93
94 #endif
GSmtp
SMTP and message-store classes.
Definition: gadminserver.h:39
GSmtp::ExecutableFilter::simple
virtual bool simple() const override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:45
GSmtp::ExecutableFilter::ExecutableFilter
ExecutableFilter(GNet::ExceptionHandler &, bool server_side, const std::string &)
Constructor.
Definition: gexecutablefilter.cpp:31
GSmtp::ExecutableFilter::~ExecutableFilter
virtual ~ExecutableFilter()
Destructor.
Definition: gexecutablefilter.cpp:41
GNet::ExceptionHandler
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket events...
Definition: gexceptionhandler.h:44
GSmtp::Filter
An interface for processing a message file through a filter.
Definition: gfilter.h:48
GSmtp::ExecutableFilter::abandoned
virtual bool abandoned() const override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:162
GSmtp::ExecutableFilter::start
virtual void start(const std::string &path) override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:78
GSmtp::ExecutableFilter::special
virtual bool special() const override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:55
GSmtp::ExecutableFilter::id
virtual std::string id() const override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:50
geventhandler.h
GNet::Task
A class for running an exectuable in a separate process with an asychronous completion callback...
Definition: gtask.h:42
GSmtp::ExecutableFilter::doneSignal
virtual G::Slot::Signal1< int > & doneSignal() override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:152
GSmtp::ExecutableFilter::reason
virtual std::string reason() const override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:69
gpath.h
GSmtp::ExecutableFilter::cancel
virtual void cancel() override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:157
gtask.h
gfilter.h
gsmtp.h
GNet::TaskCallback
An abstract interface for callbacks from GNet::Task.
Definition: gtask.h:89
G::Slot::Signal1< int >
G::Path
A Path object represents a file system path.
Definition: gpath.h:72
gfutureevent.h
GSmtp::Filter::Exit
Interprets an executable filter's exit code.
Definition: gfilter.h:101
GSmtp::ExecutableFilter::response
virtual std::string response() const override
Override from from GSmtp::Filter.
Definition: gexecutablefilter.cpp:60
GSmtp::ExecutableFilter
A Filter class that runs an external helper program.
Definition: gexecutablefilter.h:41