E-MailRelay

Classes | Public Types | Public Member Functions | List of all members
GSmtp::ClientProtocol Class Reference

Implements the client-side SMTP protocol. More...

`#include <gsmtpclientprotocol.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
using | Reply = ClientProtocolReply

## Public Member Functions
| ClientProtocol (GNet::ExceptionSink, Sender &sender, const GAuth::SaslClientSecrets &secrets, const std::string &sasl_client_config, const Config &config, bool in_secure_tunnel)
| Constructor. More...
G::Slot::Signal< int, const std::string &, const std::string &, const G::StringArray & > & | doneSignal ()
| Returns a signal that is raised once the protocol has finished with a given message. More...
G::Slot::Signal & | filterSignal ()
| Returns a signal that is raised when the protocol needs to do message filtering. More...
void | start (std::weak_ptr< 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 (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 remote server. More...
| ClientProtocol (const ClientProtocol &)=delete
| ClientProtocol (ClientProtocol &&)=delete
void | operator= (const ClientProtocol &)=delete
void | operator= (ClientProtocol &&)=delete

## Detailed Description

Implements the client-side SMTP protocol.

Definition at line 155 of file gsmtpclientprotocol.h.

## Member Typedef Documentation

## ◆ Reply

using GSmtp::ClientProtocol::Reply = ClientProtocolReply

Definition at line 161 of file gsmtpclientprotocol.h.

## Constructor & Destructor Documentation

## ◆ ClientProtocol()

GSmtp::ClientProtocol::ClientProtocol | ( | GNet::ExceptionSink | 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 35 of file gsmtpclientprotocol.cpp.

## Member Function Documentation

## ◆ apply()

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 135 of file gsmtpclientprotocol.cpp.

## ◆ doneSignal()

G::Slot::Signal< int, const std::string &, const std::string &, const G::StringArray & > & 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 non-SMTP 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. The fourth parameter is a list of failed addressees (see 'must_accept_all_recipients').

Definition at line 651 of file gsmtpclientprotocol.cpp.

## ◆ filterDone()

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 541 of file gsmtpclientprotocol.cpp.

## ◆ filterSignal()

G::Slot::Signal & 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 656 of file gsmtpclientprotocol.cpp.

## ◆ finish()

void GSmtp::ClientProtocol::finish | ( |  | ) |

Called after the last message has been sent.

Sends a quit command and shuts down the socket.

Definition at line 81 of file gsmtpclientprotocol.cpp.

## ◆ secure()

void GSmtp::ClientProtocol::secure | ( |  | ) |

To be called when the secure socket protocol has been successfully established.

Definition at line 89 of file gsmtpclientprotocol.cpp.

## ◆ sendComplete()

void GSmtp::ClientProtocol::sendComplete | ( |  | ) |

To be called when a blocked connection becomes unblocked.

See ClientProtocol::Sender::protocolSend().

Definition at line 95 of file gsmtpclientprotocol.cpp.

## ◆ start()

void GSmtp::ClientProtocol::start | ( | std::weak_ptr< 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: StoredMessage::toCount() != 0

Definition at line 57 of file gsmtpclientprotocol.cpp.

The documentation for this class was generated from the following files:

- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/gsmtp/gsmtpclientprotocol.h
- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/gsmtp/gsmtpclientprotocol.cpp