E-MailRelay

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

An SMTP server class. More...

`#include <gsmtpserver.h>`

Inheritance diagram for GSmtp::Server:
[legend]
Collaboration diagram for GSmtp::Server:
[legend]

## Classes
struct | Config
| A configuration structure for GSmtp::Server. More...

## Public Types
using | AddressList = std::vector< GNet::Address >
Public Types inherited from GNet::MultiServer
using | AddressList = std::vector< Address >

## Public Member Functions
| Server (GNet::EventState es, GStore::MessageStore &, FilterFactoryBase &, VerifierFactoryBase &, const GAuth::SaslClientSecrets &, const GAuth::SaslServerSecrets &, const Config &server_config, const std::string &forward_to, int forward_to_family, const GSmtp::Client::Config &client_config)
| Constructor. More...
| ~Server () override
| Destructor. More...
void | report (const std::string &group={}) const
| Generates helpful diagnostics after construction. More...
G::Slot::Signal< const std::string &, const std::string & > & | eventSignal () noexcept
| Returns a signal that indicates that something has happened. More...
std::unique_ptr< ProtocolMessage > | newProtocolMessage (GNet::EventState)
| Called by GSmtp::ServerPeer to construct a ProtocolMessage. More...
Config & | config ()
| Exposes the configuration sub-object. More...
void | nodnsbl (unsigned int seconds)
| Clears the DNSBL configuration string for a period of time. More...
void | enable (bool)
| Disables or re-enables new SMTP sessions. More...
| Server (const Server &)=delete
| Server (Server &&)=delete
Server & | operator= (const Server &)=delete
Server & | operator= (Server &&)=delete
Public Member Functions inherited from GNet::MultiServer
| MultiServer (EventState es_listener, const G::StringArray &listen_list, unsigned int port, const std::string &server_type, ServerPeer::Config server_peer_config, Server::Config server_config)
| Constructor. More...
| ~MultiServer () override
| Destructor. More...
bool | hasPeers () const
| Returns true if peers() is not empty. More...
std::vector< std::weak_ptr< ServerPeer > > | peers ()
| Returns the list of ServerPeer-derived objects. More...
std::unique_ptr< ServerPeer > | doNewPeer (EventStateUnbound, ServerPeerInfo &&, const ServerInfo &)
| Pseudo-private method used by the pimple class. More...
| MultiServer (const MultiServer &)=delete
| MultiServer (MultiServer &&)=delete
MultiServer & | operator= (const MultiServer &)=delete
MultiServer & | operator= (MultiServer &&)=delete

## Additional Inherited Members
Protected Member Functions inherited from GNet::MultiServer
virtual std::unique_ptr< ServerPeer > | newPeer (EventStateUnbound, ServerPeerInfo &&, ServerInfo)=0
| A factory method which creates a ServerPeer-derived object. More...
void | serverCleanup ()
| Should be called from all derived classes' destructors so that peer objects can use their Server objects safely during their own destruction. More...
void | serverReport (const std::string &group={}) const
| Writes to the system log a summary of the underlying server objects and their addresses. More...

## Detailed Description

An SMTP server class.

Definition at line 54 of file gsmtpserver.h.

## Member Typedef Documentation

## ◆ AddressList

using GSmtp::Server::AddressList = std::vector<GNet::Address>

Definition at line 57 of file gsmtpserver.h.

## Constructor & Destructor Documentation

## ◆ Server()

GSmtp::Server::Server | ( | GNet::EventState | es,
|  | GStore::MessageStore & | store,
|  | FilterFactoryBase & | ff,
|  | VerifierFactoryBase & | vf,
|  | const GAuth::SaslClientSecrets & | client_secrets,
|  | const GAuth::SaslServerSecrets & | server_secrets,
|  | const Config & | server_config,
|  | const std::string & | forward_to,
|  | int | forward_to_family,
|  | const GSmtp::Client::Config & | client_config
| ) |  |

Constructor.

Listens on the given port number using INET_ANY if 'server_config.interfaces' is empty, or on specific interfaces otherwise.

If the forward-to address is given then all messages are forwarded as soon as they are received using the GSmtp::ProtocolMessageForward class and the given client configuration.

The forward-to-family is used if the forward-to address is a DNS name that needs to be resolved.

Definition at line 175 of file gsmtpserver.cpp.

## ◆ ~Server()

GSmtp::Server::~Server | ( |  | ) |
| override

Destructor.

Definition at line 196 of file gsmtpserver.cpp.

## Member Function Documentation

## ◆ config()

GSmtp::Server::Config & GSmtp::Server::config | ( |  | ) |

Exposes the configuration sub-object.

Definition at line 202 of file gsmtpserver.cpp.

## ◆ enable()

void GSmtp::Server::enable | ( | bool | b | ) |

Disables or re-enables new SMTP sessions.

When disabled new network connections are allowed but the SMTP protocol is disabled in some way.

Definition at line 260 of file gsmtpserver.cpp.

## ◆ eventSignal()

G::Slot::Signal< const std::string &, const std::string & > & GSmtp::Server::eventSignal | ( |  | ) |
| noexcept

Returns a signal that indicates that something has happened.

Definition at line 208 of file gsmtpserver.cpp.

## ◆ newProtocolMessage()

std::unique_ptr< GSmtp::ProtocolMessage > GSmtp::Server::newProtocolMessage | ( | GNet::EventState | es | ) |

Called by GSmtp::ServerPeer to construct a ProtocolMessage.

Definition at line 292 of file gsmtpserver.cpp.

## ◆ nodnsbl()

void GSmtp::Server::nodnsbl | ( | unsigned int | seconds | ) |

Clears the DNSBL configuration string for a period of time.

Definition at line 254 of file gsmtpserver.cpp.

## ◆ report()

void GSmtp::Server::report | ( | const std::string & | group = `{}` | ) | const

Generates helpful diagnostics after construction.

Definition at line 213 of file gsmtpserver.cpp.

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

- /tmp/slackdce/slackrepo.HKsbdz/build_emailrelay/emailrelay-2.6/src/gsmtp/gsmtpserver.h
- /tmp/slackdce/slackrepo.HKsbdz/build_emailrelay/emailrelay-2.6/src/gsmtp/gsmtpserver.cpp