E-MailRelay
|
Implements the client-side SMTP protocol. More...
#include <gsmtpclientprotocol.h>
Classes | |
struct | Config |
A structure containing GSmtp::ClientProtocol configuration parameters. More... | |
struct | DoneInfo |
Parameters for GSmtp::ClientProtocol::doneSignal() More... | |
class | Sender |
An interface used by ClientProtocol to send protocol messages. More... | |
Public Member Functions | |
ClientProtocol (GNet::EventState, Sender &sender, const GAuth::SaslClientSecrets &secrets, const std::string &sasl_client_config, const Config &config, bool in_secure_tunnel) | |
Constructor. More... | |
G::Slot::Signal< const DoneInfo & > & | doneSignal () noexcept |
Returns a signal that is raised once the protocol has finished with a given message. More... | |
G::Slot::Signal & | filterSignal () noexcept |
Returns a signal that is raised when the protocol needs to do message filtering. More... | |
void | reconfigure (const std::string &ehlo) |
Updates a configuration parameter after construction. More... | |
void | start (std::weak_ptr< GStore::StoredMessage >) |
Starts transmission of the given message. More... | |
void | finish () |
Called after the last message has been sent. More... | |
void | sendComplete () |
To be called when a blocked connection becomes unblocked. More... | |
void | filterDone (Filter::Result result, const std::string &response, const std::string &reason) |
To be called when the Filter interface has done its thing. More... | |
void | secure () |
To be called when the secure socket protocol has been successfully established. More... | |
bool | apply (const std::string &rx) |
Called on receipt of a line of text from the remote server. More... | |
ClientProtocol (const ClientProtocol &)=delete | |
ClientProtocol (ClientProtocol &&)=delete | |
ClientProtocol & | operator= (const ClientProtocol &)=delete |
ClientProtocol & | operator= (ClientProtocol &&)=delete |
Implements the client-side SMTP protocol.
Definition at line 49 of file gsmtpclientprotocol.h.
GSmtp::ClientProtocol::ClientProtocol | ( | GNet::EventState | es, |
Sender & | sender, | ||
const GAuth::SaslClientSecrets & | secrets, | ||
const std::string & | sasl_client_config, | ||
const Config & | config, | ||
bool | in_secure_tunnel | ||
) |
Constructor.
The Sender interface is used to send protocol messages to the peer. The references are kept.
Definition at line 64 of file gsmtpclientprotocol.cpp.
bool GSmtp::ClientProtocol::apply | ( | const std::string & | rx | ) |
Called on receipt of a line of text from the remote server.
Returns true if the protocol is done and the doneSignal() has been emitted.
Definition at line 139 of file gsmtpclientprotocol.cpp.
|
noexcept |
Returns a signal that is raised once the protocol has finished with a given message.
If 'must_accept_all_recipients' is false and the message was successfully sent to only some of the recipients then this is signalled as an error with a non-empty reject list.
Definition at line 129 of file gsmtpclientprotocol.cpp.
void GSmtp::ClientProtocol::filterDone | ( | Filter::Result | result, |
const std::string & | response, | ||
const std::string & | reason | ||
) |
To be called when the Filter interface has done its thing.
If the result is Result::ok then the message processing continues; otherwise the message processing fails with a doneSignal() code of -1 for Result::abandon or -2 for Result::fail.
Definition at line 567 of file gsmtpclientprotocol.cpp.
|
noexcept |
Returns a signal that is raised when the protocol needs to do message filtering.
The signal callee must call filterDone() when the filter has finished.
Definition at line 134 of file gsmtpclientprotocol.cpp.
void GSmtp::ClientProtocol::finish | ( | ) |
Called after the last message has been sent.
Sends a quit command and shuts down the socket.
Definition at line 101 of file gsmtpclientprotocol.cpp.
void GSmtp::ClientProtocol::reconfigure | ( | const std::string & | ehlo | ) |
Updates a configuration parameter after construction.
Definition at line 79 of file gsmtpclientprotocol.cpp.
void GSmtp::ClientProtocol::secure | ( | ) |
To be called when the secure socket protocol has been successfully established.
Definition at line 108 of file gsmtpclientprotocol.cpp.
void GSmtp::ClientProtocol::sendComplete | ( | ) |
To be called when a blocked connection becomes unblocked.
See ClientProtocol::Sender::protocolSend().
Definition at line 113 of file gsmtpclientprotocol.cpp.
void GSmtp::ClientProtocol::start | ( | std::weak_ptr< GStore::StoredMessage > | message_in | ) |
Starts transmission of the given message.
The doneSignal() is used to indicate that the message has been processed and the shared object should remain valid until then.
Precondition: GStore::StoredMessage::toCount() != 0
Definition at line 85 of file gsmtpclientprotocol.cpp.