E-MailRelay
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 ///
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
SMTP and message-store classes.
Definition: gadminserver.h:39
virtual bool simple() const override
Override from from GSmtp::Filter.
ExecutableFilter(GNet::ExceptionHandler &, bool server_side, const std::string &)
Constructor.
virtual ~ExecutableFilter()
Destructor.
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket events...
An interface for processing a message file through a filter.
Definition: gfilter.h:48
virtual bool abandoned() const override
Override from from GSmtp::Filter.
virtual void start(const std::string &path) override
Override from from GSmtp::Filter.
virtual bool special() const override
Override from from GSmtp::Filter.
virtual std::string id() const override
Override from from GSmtp::Filter.
A class for running an exectuable in a separate process with an asychronous completion callback...
Definition: gtask.h:42
virtual G::Slot::Signal1< int > & doneSignal() override
Override from from GSmtp::Filter.
virtual std::string reason() const override
Override from from GSmtp::Filter.
virtual void cancel() override
Override from from GSmtp::Filter.
An abstract interface for callbacks from GNet::Task.
Definition: gtask.h:89
A Path object represents a file system path.
Definition: gpath.h:72
Interprets an executable filter's exit code.
Definition: gfilter.h:101
virtual std::string response() const override
Override from from GSmtp::Filter.
A Filter class that runs an external helper program.