Classes | Public Member Functions | Protected Member Functions | List of all members
GSmtp::ServerProtocol Class Reference

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

#include <gserverprotocol.h>

Inheritance diagram for GSmtp::ServerProtocol:
GNet::AbstractTimer

Classes

struct  Config
 A structure containing configuration parameters for ServerProtocol. More...
 
class  Sender
 An interface used by ServerProtocol to send protocol replies. More...
 
class  Text
 An interface used by ServerProtocol to provide response text strings. More...
 

Public Member Functions

 ServerProtocol (Sender &sender, Verifier &verifier, ProtocolMessage &pmessage, const GAuth::Secrets &secrets, Text &text, GNet::Address peer_address, const std::string &peer_socket_name, Config config)
 Constructor. More...
 
void init ()
 Starts the protocol. Use only once after construction. More...
 
virtual ~ServerProtocol ()
 Destructor. More...
 
void apply (const std::string &line)
 Called on receipt of a string from the client. More...
 
void secure (const std::string &certificate)
 To be called when the transport protocol goes into secure mode. More...
 

Protected Member Functions

virtual void onTimeout ()
 Final override from GNet::AbstractTimer. More...
 
virtual void onTimeoutException (std::exception &)
 Final override from GNet::AbstractTimer. More...
 

Detailed Description

Implements the SMTP server-side protocol.

Uses the ProtocolMessage class as its down-stream interface, used for assembling and processing the incoming email messages.

Uses the ServerProtocol::Sender as its "sideways" interface to talk back to the email-sending client.

See also
GSmtp::ProtocolMessage, RFC2821

Definition at line 58 of file gserverprotocol.h.

Constructor & Destructor Documentation

GSmtp::ServerProtocol::ServerProtocol ( Sender sender,
Verifier verifier,
ProtocolMessage pmessage,
const GAuth::Secrets secrets,
Text text,
GNet::Address  peer_address,
const std::string &  peer_socket_name,
Config  config 
)

Constructor.

The Verifier interface is used to verify recipient addresses. See GSmtp::Verifier.

The ProtocolMessage interface is used to assemble and process an incoming message.

The Sender interface is used to send protocol replies back to the client.

The Text interface is used to get informational text for returning to the client.

All references are kept.

Definition at line 35 of file gserverprotocol.cpp.

References G::StateMachine< T, State, Event, Arg >::addTransition(), G::Signal3< P1, P2, P3 >::connect(), GSmtp::Verifier::doneSignal(), GSmtp::ProtocolMessage::doneSignal(), GSsl::Library::enabled(), GSsl::Library::instance(), and G::slot().

GSmtp::ServerProtocol::~ServerProtocol ( )
virtual

Destructor.

Definition at line 112 of file gserverprotocol.cpp.

Member Function Documentation

void GSmtp::ServerProtocol::apply ( const std::string &  line)

Called on receipt of a string from the client.

The string is expected to be CR-LF terminated. Throws ProtocolDone at the end of the protocol.

Definition at line 150 of file gserverprotocol.cpp.

References G_LOG, and G::Str::printable().

void GSmtp::ServerProtocol::init ( )

Starts the protocol. Use only once after construction.

Definition at line 107 of file gserverprotocol.cpp.

Referenced by GSmtp::ServerPeer::ServerPeer().

void GSmtp::ServerProtocol::onTimeout ( )
protectedvirtual

Final override from GNet::AbstractTimer.

Implements GNet::AbstractTimer.

Definition at line 214 of file gserverprotocol.cpp.

References G_WARNING.

void GSmtp::ServerProtocol::onTimeoutException ( std::exception &  e)
protectedvirtual

Final override from GNet::AbstractTimer.

Implements GNet::AbstractTimer.

Definition at line 222 of file gserverprotocol.cpp.

References G_DEBUG.

void GSmtp::ServerProtocol::secure ( const std::string &  certificate)

To be called when the transport protocol goes into secure mode.

Definition at line 118 of file gserverprotocol.cpp.


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