E-MailRelay

gsmtpserversend.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 gsmtpserversend.h
19///
20
21#ifndef G_SMTP_SERVER_SEND_H
22#define G_SMTP_SERVER_SEND_H
23
24#include "gdef.h"
25#include "gsmtpserversender.h"
26#include "gstringarray.h"
27#include <string>
28#include <sstream>
29
30 namespace GSmtp
31{
32 class ServerSend ;
33}
34
35//| \class GSmtp::ServerSend
36/// A simple mix-in class for GSmtp::ServerProtocol that sends protocol
37/// responses via a GSmtp::ServerSender.
38///
39 class GSmtp::ServerSend
40{
41 public:
42 explicit ServerSend( ServerSender * ) ;
43 ///< Constructor.
44
45 void setSender( ServerSender * ) ;
46 ///< Sets the sender interface pointer.
47
48 virtual bool sendFlush() const = 0 ;
49 ///< Returns a 'flush' value for GSmtp::ServerSender::protocolSend().
50
51 public:
52 virtual ~ServerSend() = default ;
53 ServerSend( const ServerSend & ) = delete ;
54 ServerSend( ServerSend && ) = delete ;
55 ServerSend & operator=( const ServerSend & ) = delete ;
56 ServerSend & operator=( ServerSend && ) = delete ;
57
58 protected:
59 struct Advertise /// Configuration for the EHLO response.
60 {
61 std::string hello ;
62 std::size_t max_size {0U} ;
63 G::StringArray mechanisms ;
64 bool starttls {false} ;
65 bool vrfy {false} ;
66 bool chunking {false} ;
67 bool binarymime {false} ;
68 bool pipelining {false} ;
69 bool smtputf8 {false} ;
70 } ;
71 void send( const char * ) ;
72 void send( std::string , bool = false ) ;
73 void send( const std::ostringstream & ) ;
74 void sendReadyForTls() ;
75 void sendInsecureAuth( bool = false ) ;
76 void sendEncryptionRequired( bool = false ) ;
77 void sendBadMechanism( const std::string & = {} ) ;
78 void sendBadFrom( const std::string & ) ;
79 void sendTooBig() ;
80 void sendChallenge( const std::string & ) ;
81 void sendBadTo( const std::string & , const std::string & , bool ) ;
82 void sendBadDataOutOfSequence() ;
83 void sendOutOfSequence() ;
84 void sendGreeting( const std::string & , bool ) ;
85 void sendQuitOk() ;
86 void sendUnrecognised( const std::string & ) ;
87 void sendNotImplemented() ;
88 void sendHeloReply() ;
89 void sendEhloReply( const Advertise & ) ;
90 void sendRsetReply() ;
91 void sendMailReply( const std::string & from ) ;
92 void sendRcptReply( const std::string & to , bool local ) ;
93 void sendDataReply() ;
94 void sendCompletionReply( bool ok , int , const std::string & ) ;
95 void sendFailed() ;
96 void sendInvalidArgument() ;
97 void sendAuthenticationCancelled() ;
98 void sendAuthRequired( bool = false ) ;
99 void sendDisabled() ;
100 void sendNoRecipients() ;
101 void sendMissingParameter() ;
102 void sendVerified( const std::string & ) ;
103 void sendCannotVerify() ;
104 void sendNotVerified( const std::string & , bool ) ;
105 void sendWillAccept( const std::string & ) ;
106 void sendAuthDone( bool ok ) ;
107 void sendOk( const std::string & ) ;
108 void sendOk() ;
109
110 private:
111 ServerSender * m_sender ;
112} ;
113
114#endif
GSmtp::ServerSend
A simple mix-in class for GSmtp::ServerProtocol that sends protocol responses via a GSmtp::ServerSend...
Definition: gsmtpserversend.h:40
GSmtp::ServerSend::ServerSend
ServerSend(ServerSender *)
Constructor.
Definition: gsmtpserversend.cpp:29
GSmtp::ServerSend::setSender
void setSender(ServerSender *)
Sets the sender interface pointer.
Definition: gsmtpserversend.cpp:34
GSmtp::ServerSend::sendFlush
virtual bool sendFlush() const =0
Returns a 'flush' value for GSmtp::ServerSender::protocolSend().
GSmtp::ServerSender
An interface used by ServerProtocol to send protocol responses.
Definition: gsmtpserversender.h:41
gsmtpserversender.h
gstringarray.h
GSmtp
SMTP classes.
Definition: gadminserver.h:42
G::StringArray
std::vector< std::string > StringArray
A std::vector of std::strings.
Definition: gstringarray.h:30
GSmtp::ServerSend::Advertise
Configuration for the EHLO response.
Definition: gsmtpserversend.h:60