GSmtp::RequestClient Class Reference

A client class that interacts with a remote process with a stateless line-based request/response protocol. More...

#include <grequestclient.h>

Inheritance diagram for GSmtp::RequestClient:

GNet::Client GNet::HeapClient GNet::SimpleClient GNet::EventHandler GNet::Connection GNet::SocketProtocolSink

List of all members.

Public Member Functions

 RequestClient (const std::string &key, const std::string &ok, const std::string &eol, const GNet::ResolverInfo &host_and_service, unsigned int connect_timeout, unsigned int response_timeout)
 Constructor.
void request (const std::string &)
 Issues a request.
bool busy () const
 Returns true after request() and before the subsequent event signal.

Protected Member Functions

virtual ~RequestClient ()
 Destructor.
virtual void onConnect ()
 Final override from GNet::SimpleClient.
virtual bool onReceive (const std::string &)
 Final override from GNet::Client.
virtual void onSendComplete ()
 Final override from GNet::BufferedClient.
virtual void onDelete (const std::string &, bool)
 Final override from GNet::HeapClient.
virtual void onDeleteImp (const std::string &, bool)
 Final override from GNet::Client.
virtual void onSecure ()
 Final override from GNet::SocketProtocolSink.


Detailed Description

A client class that interacts with a remote process with a stateless line-based request/response protocol.

Definition at line 43 of file grequestclient.h.


Constructor & Destructor Documentation

GSmtp::RequestClient::RequestClient ( const std::string &  key,
const std::string &  ok,
const std::string &  eol,
const GNet::ResolverInfo host_and_service,
unsigned int  connect_timeout,
unsigned int  response_timeout 
)

Constructor.

The key parameter is used in the callback signal; the (optional) ok parameter is a response string that is considered to be a success response; the eol parameter is the response end-of-line.

Definition at line 28 of file grequestclient.cpp.

References GNet::ResolverInfo::displayString(), and G_DEBUG.

GSmtp::RequestClient::~RequestClient (  )  [protected, virtual]

Destructor.

Definition at line 41 of file grequestclient.cpp.


Member Function Documentation

void GSmtp::RequestClient::request ( const std::string &  payload  ) 

Issues a request.

The base class's "event" signal emitted when processing is complete with a first signal parameter of the "key" string specified in the constructor call and a second parameter giving the parsed response.

Every request will get a single response as long as this method is not called re-entrantly from within the previous request's response signal.

Definition at line 52 of file grequestclient.cpp.

References busy(), GNet::Client::clearInput(), and G_DEBUG.

bool GSmtp::RequestClient::busy (  )  const

Returns true after request() and before the subsequent event signal.

Definition at line 67 of file grequestclient.cpp.

Referenced by onConnect(), onDeleteImp(), onReceive(), and request().

void GSmtp::RequestClient::onConnect (  )  [protected, virtual]

Final override from GNet::SimpleClient.

Implements GNet::SimpleClient.

Definition at line 45 of file grequestclient.cpp.

References busy(), G_DEBUG, and GNet::SimpleClient::send().

bool GSmtp::RequestClient::onReceive ( const std::string &  line  )  [protected, virtual]

Final override from GNet::Client.

Implements GNet::Client.

Definition at line 96 of file grequestclient.cpp.

References busy(), G::Signal2< P1, P2 >::emit(), GNet::Client::eventSignal(), G_DEBUG, and G::Str::printable().

void GSmtp::RequestClient::onSendComplete (  )  [protected, virtual]

Final override from GNet::BufferedClient.

Implements GNet::SimpleClient.

Definition at line 109 of file grequestclient.cpp.

void GSmtp::RequestClient::onDelete ( const std::string &  ,
bool   
) [protected, virtual]

Final override from GNet::HeapClient.

Implements GNet::HeapClient.

Definition at line 72 of file grequestclient.cpp.

void GSmtp::RequestClient::onDeleteImp ( const std::string &  reason,
bool  b 
) [protected, virtual]

Final override from GNet::Client.

Reimplemented from GNet::Client.

Definition at line 76 of file grequestclient.cpp.

References busy(), G::Signal2< P1, P2 >::emit(), GNet::Client::eventSignal(), G_WARNING, and GNet::Client::onDeleteImp().

void GSmtp::RequestClient::onSecure (  )  [protected, virtual]

Final override from GNet::SocketProtocolSink.

Implements GNet::SocketProtocolSink.

Definition at line 92 of file grequestclient.cpp.


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

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