- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

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

A client class that interacts with a remote process using a protocol somewhat similar to the spamassassin spamc/spamd protocol. More...

`#include <gspamclient.h>`

Inheritance diagram for GSmtp::SpamClient:

## Public Member Functions
| SpamClient (const GNet::ResolverInfo &host_and_service, unsigned int connect_timeout, unsigned int response_timeout)
| Constructor. More...
void | request (const std::string &)
| Issues a request. More...
bool | busy () const
| Returns true after request() and before the subsequent event signal. More...
Public Member Functions inherited from GNet::Client
| Client (const ResolverInfo &remote_info, unsigned int connection_timeout=0U, unsigned int response_timeout=0U, unsigned int secure_connection_timeout=0U, const std::string &eol=std::string("\n"), const Address &local_interface=Address(0U), bool privileged=false, bool sync_dns=synchronousDnsDefault())
| Constructor. More...
G::Signal2< std::string, bool > & | doneSignal ()
| Returns a signal that indicates that client processing is complete. More...
G::Signal2< std::string, std::string > & | eventSignal ()
| Returns a signal that indicates that something interesting has happened. More...
G::Signal0 & | connectedSignal ()
| Returns a signal that incidcates that the client has successfully connected to the server. More...
G::Signal0 & | secureSignal ()
| Returns a signal that incidcates that the security layer has been successfully established. More...
Public Member Functions inherited from GNet::HeapClient
| HeapClient (const ResolverInfo &remote_info, const Address &local_interface=Address(0U), bool privileged=false, bool sync_dns=synchronousDnsDefault(), unsigned int secure_connection_timeout=0U)
| Constructor. More...
void | doDelete (const std::string &reason)
| Calls onDelete() and then does a delayed "delete this". More...
virtual void | onException (std::exception &)
| Final override from GNet::EventHandler. More...
void | doDeleteForExit ()
| A destructor method that may be called at program termination when the normal doDelete() mechanism has become unusable. More...
Public Member Functions inherited from GNet::SimpleClient
| SimpleClient (const ResolverInfo &remote_info, const Address &local_address=Address(0U), bool privileged=false, bool sync_dns=synchronousDnsDefault(), unsigned int secure_connection_timeout=0U)
| Constructor. More...
void | connect ()
| Initates a connection to the remote server. More...
bool | connected () const
| Returns true if connected to the peer. More...
virtual std::pair< bool, Address > | localAddress () const
| Override from Connection. More...
virtual std::pair< bool, Address > | peerAddress () const
| Override from Connection. More...
virtual std::string | peerCertificate () const
| Returns the peer's TLS certificate. More...
ResolverInfo | resolverInfo () const
| Returns a ResolverInfo structure containing the result of host() and service() name lookup if available. More...
void | updateResolverInfo (const ResolverInfo &)
| Updates the constructor's ResolverInfo object with the given one as long as both objects have the same host and service name. More...
virtual void | readEvent ()
| Final override from GNet::EventHandler. More...
virtual void | writeEvent ()
| Final override from GNet::EventHandler. More...
bool | send (const std::string &data, std::string::size_type offset=0)
| Returns true if all sent, or false if flow control was asserted. More...
Public Member Functions inherited from GNet::EventHandler
virtual | ~EventHandler ()
| Destructor. More...
virtual void | exceptionEvent ()
| Called for an exception event. More...
Public Member Functions inherited from GNet::Connection
virtual | ~Connection ()
| Destructor. More...
Public Member Functions inherited from GNet::SocketProtocolSink
virtual | ~SocketProtocolSink ()
| Destructor. More...

## Protected Member Functions
virtual | ~SpamClient ()
| Destructor. More...
virtual void | onConnect ()
| Final override from GNet::SimpleClient. More...
virtual bool | onReceive (const std::string &)
| Final override from GNet::Client. More...
virtual void | onSendComplete ()
| Final override from GNet::BufferedClient. More...
virtual void | onDelete (const std::string &, bool)
| Final override from GNet::HeapClient. More...
virtual void | onDeleteImp (const std::string &, bool)
| Final override from GNet::Client. More...
virtual void | onSecure (const std::string &)
| Final override from GNet::SocketProtocol. More...
Protected Member Functions inherited from GNet::Client
virtual | ~Client ()
| Destructor. More...
void | clearInput ()
| Clears any pending input from the server. More...
virtual void | onConnectImp ()
| Final override from GNet::SimpleClient. More...
virtual void | onData (const char *, SimpleClient::size_type)
| Final override from GNet::SocketProtocolSink. More...
virtual void | onConnecting ()
| Final override from GNet::HeapClient. More...
virtual void | onSendImp ()
| Final override from GNet::SimpleClient. More...
Protected Member Functions inherited from GNet::HeapClient
virtual | ~HeapClient ()
| Destructor. More...
Protected Member Functions inherited from GNet::SimpleClient
virtual | ~SimpleClient ()
| Destructor. More...
StreamSocket & | socket ()
| Returns a reference to the socket. Throws if not connected. More...
const StreamSocket & | socket () const
| Returns a const reference to the socket. Throws if not connected. More...
void | sslConnect ()
| Starts TLS/SSL client-side negotiation. More...
std::string | logId () const
| Returns a identification string for logging purposes. More...

## Additional Inherited Members
Public Types inherited from GNet::SimpleClient
enum | ConnectStatus { Success, Failure, Retry, ImmediateSuccess }
enum | State { Idle, Resolving, Connecting, Connected, Socksing }
typedef std::string::size_type | size_type
Static Public Member Functions inherited from GNet::SimpleClient
static bool | synchronousDnsDefault ()
| Returns true if DNS queries should normally be synchronous on this platform. More...
Static Protected Member Functions inherited from GNet::SimpleClient
static bool | canRetry (const std::string &reason)
| Parses the given failure reason and returns true if the client can reasonably retry at some later time. More...

## Detailed Description

A client class that interacts with a remote process using a protocol somewhat similar to the spamassassin spamc/spamd protocol.

Definition at line 47 of file gspamclient.h.

## Constructor & Destructor Documentation

GSmtp::SpamClient::SpamClient | ( | const GNet::ResolverInfo & | host_and_service,
|  | unsigned int | connect_timeout,
|  | unsigned int | response_timeout
| ) |  |

Constructor.

Definition at line 29 of file gspamclient.cpp.

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

GSmtp::SpamClient::~SpamClient | ( |  | ) |
| protected virtual

Destructor.

Definition at line 43 of file gspamclient.cpp.

## Member Function Documentation

bool GSmtp::SpamClient::busy | ( |  | ) | const

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

Definition at line 47 of file gspamclient.cpp.

void GSmtp::SpamClient::onConnect | ( |  | ) |
| protected virtual

Final override from GNet::SimpleClient.

Implements GNet::SimpleClient.

Definition at line 95 of file gspamclient.cpp.

References G_DEBUG.

void GSmtp::SpamClient::onDelete | ( | const std::string & | ,
|  | bool |
| ) |  |
| protected virtual

Final override from GNet::HeapClient.

Implements GNet::HeapClient.

Definition at line 52 of file gspamclient.cpp.

void GSmtp::SpamClient::onDeleteImp | ( | const std::string & | reason,
|  | bool | b
| ) |  |
| protected virtual

Final override from GNet::Client.

Reimplemented from GNet::Client.

Definition at line 56 of file gspamclient.cpp.

References G_WARNING.

bool GSmtp::SpamClient::onReceive | ( | const std::string & | line | ) |
| protected virtual

Final override from GNet::Client.

Implements GNet::Client.

Definition at line 176 of file gspamclient.cpp.

References G::Str::printable().

void GSmtp::SpamClient::onSecure | ( | const std::string & |  | ) |
| protected virtual

Final override from GNet::SocketProtocol.

Implements GNet::SocketProtocolSink.

Definition at line 172 of file gspamclient.cpp.

void GSmtp::SpamClient::onSendComplete | ( |  | ) |
| protected virtual

Final override from GNet::BufferedClient.

Implements GNet::SimpleClient.

Definition at line 108 of file gspamclient.cpp.

void GSmtp::SpamClient::request | ( | const std::string & | path | ) |

Issues a request.

The base class's "event" signal emitted when processing is complete with a first signal parameter of "spam" 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 73 of file gspamclient.cpp.

References G_DEBUG, and G::File::sizeString().

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

- gspamclient.h
- gspamclient.cpp