|
E-MailRelay
|
Implements the client-side SMTP protocol. More...
#include <gclientprotocol.h>
Inheritance diagram for GSmtp::ClientProtocol:Classes | |
| struct | Config |
| A structure containing GSmtp::ClientProtocol configuration parameters. More... | |
| class | Sender |
| An interface used by ClientProtocol to send protocol messages. More... | |
Public Types | |
| typedef ClientProtocolReply | Reply |
Public Member Functions | |
| ClientProtocol (GNet::ExceptionHandler &, Sender &sender, const GAuth::Secrets &secrets, Config config, bool in_secure_tunnel) | |
| Constructor. More... | |
| G::Slot::Signal3< int, std::string, std::string > & | doneSignal () |
| Returns a signal that is raised once the protocol has finished with a given message. More... | |
| G::Slot::Signal0 & | filterSignal () |
| Returns a signal that is raised when the protocol needs to do message filtering. More... | |
| void | start (const std::string &from, const G::StringArray &to, bool eight_bit, std::string mail_from_auth, unique_ptr< std::istream > content) |
| Starts transmission of the given message. More... | |
| void | finish () |
| Called after the last message has been sent. More... | |
| void | sendDone () |
| To be called when a blocked connection becomes unblocked. More... | |
| void | filterDone (bool ok, 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 server. More... | |
Protected Member Functions | |
| virtual void | onTimeout () override |
| Override from GNet::TimerBase. | |
Implements the client-side SMTP protocol.
Definition at line 156 of file gclientprotocol.h.
| GSmtp::ClientProtocol::ClientProtocol | ( | GNet::ExceptionHandler & | eh, |
| Sender & | sender, | ||
| const GAuth::Secrets & | secrets, | ||
| 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 36 of file gclientprotocol.cpp.
| bool GSmtp::ClientProtocol::apply | ( | const std::string & | rx | ) |
Called on receipt of a line of text from the server.
Returns true if the protocol is done and the doneSignal() has been emited.
Definition at line 141 of file gclientprotocol.cpp.
| G::Slot::Signal3< int, std::string, std::string > & GSmtp::ClientProtocol::doneSignal | ( | ) |
Returns a signal that is raised once the protocol has finished with a given message.
The first signal parameter is the SMTP response value, or 0 for an internal error, or -1 for filter-abandon, or -2 for a filter-fail. The second parameter is the empty string on success or a non-empty response string. The third parameter contains any additional error reason text.
Definition at line 678 of file gclientprotocol.cpp.
| void GSmtp::ClientProtocol::filterDone | ( | bool | ok, |
| const std::string & | response, | ||
| const std::string & | reason | ||
| ) |
To be called when the Filter interface has done its thing.
If ok then the message processing continues; if not ok then the message processing fails with a done signal code of -1 if the response is empty, or -2.
Definition at line 568 of file gclientprotocol.cpp.
| G::Slot::Signal0 & GSmtp::ClientProtocol::filterSignal | ( | ) |
Returns a signal that is raised when the protocol needs to do message filtering.
The callee must call filterDone() when finished.
Definition at line 683 of file gclientprotocol.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 87 of file gclientprotocol.cpp.
| void GSmtp::ClientProtocol::secure | ( | ) |
To be called when the secure socket protocol has been successfully established.
Definition at line 95 of file gclientprotocol.cpp.
| void GSmtp::ClientProtocol::sendDone | ( | ) |
To be called when a blocked connection becomes unblocked.
See ClientProtocol::Sender::protocolSend().
Definition at line 101 of file gclientprotocol.cpp.
| void GSmtp::ClientProtocol::start | ( | const std::string & | from, |
| const G::StringArray & | to, | ||
| bool | eight_bit, | ||
| std::string | mail_from_auth, | ||
| unique_ptr< std::istream > | content | ||
| ) |
Starts transmission of the given message.
The doneSignal() is used to indicate that the message has been processed.
Definition at line 67 of file gclientprotocol.cpp.
1.8.9.1