GSmtp::ProtocolMessage Class Reference

An interface used by the ServerProtocol class to assemble and process an incoming message. More...

#include <gprotocolmessage.h>

Inheritance diagram for GSmtp::ProtocolMessage:

GSmtp::ProtocolMessageForward GSmtp::ProtocolMessageStore

List of all members.

Public Member Functions

virtual ~ProtocolMessage ()
 Destructor.
virtual G::Signal3< bool,
unsigned long, std::string > & 
doneSignal ()=0
 Returns a signal which is raised once process() has completed.
virtual void reset ()=0
 Resets the object state as if just constructed.
virtual void clear ()=0
 Clears the message state and terminates any asynchronous message processing.
virtual bool setFrom (const std::string &from_user)=0
 Sets the message envelope 'from'.
virtual bool addTo (const std::string &to_user, VerifierStatus to_status)=0
 Adds an envelope 'to'.
virtual void addReceived (const std::string &)=0
 Adds a 'received' line to the start of the content.
virtual bool addText (const std::string &)=0
 Adds text.
virtual std::string from () const =0
 Returns the setFrom() string.
virtual void process (const std::string &authenticated_client_id, const std::string &peer_ip_address)=0
 Starts asynchronous processing of the message.


Detailed Description

An interface used by the ServerProtocol class to assemble and process an incoming message.

It implements the three 'buffers' mentioned in RFC2821 (esp. section 4.1.1).

This interface serves to decouple the protocol class from the downstream message processing -- hence the name. Derived classes implement different types of downstream processing. For store-and-forward behaviour the ProtocolMessageStore class uses GSmtp::MessageStore to store messages; for proxying behaviour the ProtocolMessageForward class uses GSmtp::Client to do immediate forwarding.

The interface is used by the protocol class in the following sequence:

The process() method is asynchronous, but note that the completion signal may be emitted before the initiating call returns.

Definition at line 64 of file gprotocolmessage.h.


Constructor & Destructor Documentation

GSmtp::ProtocolMessage::~ProtocolMessage (  )  [virtual]

Destructor.

Definition at line 25 of file gprotocolmessage.cpp.


Member Function Documentation

virtual G::Signal3<bool,unsigned long,std::string>& GSmtp::ProtocolMessage::doneSignal (  )  [pure virtual]

Returns a signal which is raised once process() has completed.

The signal parameters are 'success', 'id' and 'reason'.

As a special case, if success is true and id is zero then the message processing was cancelled.

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.

Referenced by GSmtp::ServerProtocol::ServerProtocol(), and GSmtp::ServerProtocol::~ServerProtocol().

virtual void GSmtp::ProtocolMessage::reset (  )  [pure virtual]

Resets the object state as if just constructed.

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.

virtual void GSmtp::ProtocolMessage::clear (  )  [pure virtual]

Clears the message state and terminates any asynchronous message processing.

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.

virtual bool GSmtp::ProtocolMessage::setFrom ( const std::string &  from_user  )  [pure virtual]

Sets the message envelope 'from'.

Returns false if an invalid user.

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.

virtual bool GSmtp::ProtocolMessage::addTo ( const std::string &  to_user,
VerifierStatus  to_status 
) [pure virtual]

Adds an envelope 'to'.

The 'to_status' parameter comes from GSmtp::Verifier.verify().

Returns false if an invalid user. Precondition: setFrom() called since clear() or process().

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.

virtual void GSmtp::ProtocolMessage::addReceived ( const std::string &   )  [pure virtual]

Adds a 'received' line to the start of the content.

Precondition: at least one successful addTo() call

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.

virtual bool GSmtp::ProtocolMessage::addText ( const std::string &   )  [pure virtual]

Adds text.

Returns false on error, typically because a size limit is reached.

Precondition: at least one successful addTo() call

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.

virtual std::string GSmtp::ProtocolMessage::from (  )  const [pure virtual]

Returns the setFrom() string.

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.

virtual void GSmtp::ProtocolMessage::process ( const std::string &  authenticated_client_id,
const std::string &  peer_ip_address 
) [pure virtual]

Starts asynchronous processing of the message.

Once processing is complete the message state is cleared and the doneSignal() is raised. The signal may be raised before process() returns.

The client-id parameter is used to propogate authentication information from the SMTP AUTH command into individual messages. It is the empty string for unauthenticated clients. See also GSmtp::Sasl::id().

Implemented in GSmtp::ProtocolMessageForward, and GSmtp::ProtocolMessageStore.


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5