E-MailRelay

gnetworkfilter.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2021 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 gnetworkfilter.h
19///
20
21#ifndef G_SMTP_NETWORK_FILTER_H
22#define G_SMTP_NETWORK_FILTER_H
23
24#include "gdef.h"
25#include "gfilter.h"
26#include "gfilestore.h"
27#include "gclientptr.h"
28#include "grequestclient.h"
29#include "geventhandler.h"
30
31 namespace GSmtp
32{
33 class NetworkFilter ;
34}
35
36//| \class GSmtp::NetworkFilter
37/// A Filter class that passes the name of a message file to a
38/// remote network server. The response of ok/abandon/fail is
39/// delivered via the base class's doneSignal().
40///
41 class GSmtp::NetworkFilter : public Filter
42{
43 public:
44 NetworkFilter( GNet::ExceptionSink , FileStore & , const std::string & server_location ,
45 unsigned int connection_timeout , unsigned int response_timeout ) ;
46 ///< Constructor.
47
48 ~NetworkFilter() override ;
49 ///< Destructor.
50
51 private: // overrides
52 std::string id() const override ; // Override from from GSmtp::Filter.
53 bool simple() const override ; // Override from from GSmtp::Filter.
54 G::Slot::Signal<int> & doneSignal() override ; // Override from from GSmtp::Filter.
55 void start( const MessageId & ) override ; // Override from from GSmtp::Filter.
56 void cancel() override ; // Override from from GSmtp::Filter.
57 bool abandoned() const override ; // Override from from GSmtp::Filter.
58 std::string response() const override ; // Override from from GSmtp::Filter.
59 std::string reason() const override ; // Override from from GSmtp::Filter.
60 bool special() const override ; // Override from from GSmtp::Filter.
61
62 public:
63 NetworkFilter( const NetworkFilter & ) = delete ;
64 NetworkFilter( NetworkFilter && ) = delete ;
65 void operator=( const NetworkFilter & ) = delete ;
66 void operator=( NetworkFilter && ) = delete ;
67
68 private:
69 void clientEvent( const std::string & , const std::string & , const std::string & ) ;
70 void clientDeleted( const std::string & ) ;
71
72 private:
73 GNet::ExceptionSink m_es ;
74 FileStore & m_file_store ;
75 G::Slot::Signal<int> m_done_signal ;
76 GNet::Location m_location ;
77 unsigned int m_connection_timeout ;
78 unsigned int m_response_timeout ;
79 GNet::ClientPtr<RequestClient> m_client_ptr ;
80 std::string m_text ;
81} ;
82
83#endif
GNet::ClientPtr
A smart pointer class for GNet::Client.
Definition: gclientptr.h:135
GNet::ExceptionSink
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
Definition: gexceptionsink.h:100
GNet::Location
A class that represents the remote target for out-going client connections.
Definition: glocation.h:71
GSmtp::FileStore
A concrete implementation of the MessageStore interface dealing in paired flat files.
Definition: gfilestore.h:58
GSmtp::Filter
An interface for processing a message file through a filter.
Definition: gfilter.h:49
GSmtp::MessageId
A somewhat opaque identifer for a MessageStore message.
Definition: gmessagestore.h:43
GSmtp::NetworkFilter
A Filter class that passes the name of a message file to a remote network server.
Definition: gnetworkfilter.h:42
GSmtp::NetworkFilter::~NetworkFilter
~NetworkFilter() override
Destructor.
Definition: gnetworkfilter.cpp:38
GSmtp::NetworkFilter::NetworkFilter
NetworkFilter(GNet::ExceptionSink, FileStore &, const std::string &server_location, unsigned int connection_timeout, unsigned int response_timeout)
Constructor.
Definition: gnetworkfilter.cpp:26
gclientptr.h
geventhandler.h
gfilestore.h
gfilter.h
grequestclient.h
GSmtp
SMTP and message-store classes.
Definition: gadminserver.h:39
G::Slot::Signal< int >