E-MailRelay
gsmtpserversender.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 gsmtpserversender.h
19///
20
21#ifndef G_SMTP_SERVER_SENDER_H
22#define G_SMTP_SERVER_SENDER_H
23
24#include "gdef.h"
25#include <string>
26
27namespace GSmtp
28{
29 class ServerSender ;
30}
31
32//| \class GSmtp::ServerSender
33/// An interface used by ServerProtocol to send protocol responses.
34///
35/// The RFC-2920 PIPELINING extension defines how SMTP input requests
36/// and output responses should be batched up. At this interface that
37/// means that protocolSend() has a 'flush' parameter to mark the
38/// end of an output batch.
39///
41{
42public:
43 virtual void protocolSend( const std::string & s , bool flush ) = 0 ;
44 ///< Called when the server protocol class wants to send data
45 ///< down the socket. The data should be batched up if
46 ///< 'flush' is false. The 'flush' parameter will always be
47 ///< true if the server protocol is not using pipelining.
48 ///<
49 ///< If the server protocol is using pipelining then calls
50 ///< to protocolSend() might come in quick succession, so
51 ///< the implementation must queue up the output if the
52 ///< socket applies flow control. There is no need to
53 ///< tell the protocol when flow control is released.
54
55 virtual void protocolSecure() = 0 ;
56 ///< Called when the protocol class wants a secure
57 ///< connection to be initiated. ServerProtocol::secure()
58 ///< should be called when complete.
59
60 virtual void protocolShutdown( int how ) = 0 ;
61 ///< Called on receipt of a quit command after the quit
62 ///< response has been sent. The implementation should
63 ///< normally do a socket shutdown if the parameter is
64 ///< 0, 1 or 2. See also Socket::shutdown().
65
66 virtual void protocolExpect( std::size_t n ) = 0 ;
67 ///< Requests that the next call to ServerProtocol::apply()
68 ///< carries exactly 'n' bytes of binary data rather than a
69 ///< line of text. This only called if the protocol config
70 ///< item 'with_chunking' is true.
71
72 virtual ~ServerSender() = default ;
73 ///< Destructor.
74} ;
75
76#endif
An interface used by ServerProtocol to send protocol responses.
virtual void protocolSend(const std::string &s, bool flush)=0
Called when the server protocol class wants to send data down the socket.
virtual void protocolExpect(std::size_t n)=0
Requests that the next call to ServerProtocol::apply() carries exactly 'n' bytes of binary data rathe...
virtual void protocolSecure()=0
Called when the protocol class wants a secure connection to be initiated.
virtual ~ServerSender()=default
Destructor.
virtual void protocolShutdown(int how)=0
Called on receipt of a quit command after the quit response has been sent.
SMTP classes.
Definition: gadminserver.h:42