E-MailRelay
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:

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 (GNet::ExceptionHandler &, Sender &, Verifier &, ProtocolMessage &, const GAuth::Secrets &secrets, Text &text, GNet::Address peer_address, Config config)
 Constructor. More...
 
void init ()
 Starts the protocol. Use only once after construction.
 
virtual ~ServerProtocol ()
 Destructor.
 
bool apply (const char *line_data, size_t line_size, size_t eolsize)
 Called on receipt of a line of text from the remote client Returns true. 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 () override
 Override from GNet::TimerBase.
 

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, RFC-2821

Definition at line 58 of file gserverprotocol.h.

Constructor & Destructor Documentation

GSmtp::ServerProtocol::ServerProtocol ( GNet::ExceptionHandler &  eh,
Sender &  sender,
Verifier &  verifier,
ProtocolMessage &  pmessage,
const GAuth::Secrets &  secrets,
Text &  text,
GNet::Address  peer_address,
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.

Exceptions thrown out of event-loop and timer callbacks are delivered to the given exception handler interface.

All references are kept.

Definition at line 36 of file gserverprotocol.cpp.

Member Function Documentation

bool GSmtp::ServerProtocol::apply ( const char *  line_data,
size_t  line_size,
size_t  eolsize 
)

Called on receipt of a line of text from the remote client Returns true.

Throws ProtocolDone at the end of the protocol.

Definition at line 148 of file gserverprotocol.cpp.

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

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

Definition at line 116 of file gserverprotocol.cpp.


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