E-MailRelay

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Static 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::Location &host_and_service, bool read_only, unsigned int connect_timeout, unsigned int response_timeout)
| Constructor.
void | request (const std::string &file_path)
| Starts sending a request that comprises a few http-like header lines followed by the contents of the given file. More...
bool | busy () const
| Returns true after request() and before the subsequent event signal. More...
Public Member Functions inherited from GNet::Client
| Client (const Location &remote_info, unsigned int connection_timeout=0U, unsigned int response_timeout=0U, unsigned int secure_connection_timeout=0U, LineBufferConfig=LineBufferConfig(), bool bind_local_address=false, const Address &local_address=Address::defaultAddress(), bool sync_dns=synchronousDnsDefault())
| Constructor. The connection is initiated asynchronously.
G::Slot::Signal1< std::string > & | doneSignal ()
| Returns a signal that indicates that client processing is complete. More...
G::Slot::Signal2< std::string, std::string > & | eventSignal ()
| Returns a signal that indicates that something interesting has happened. More...
G::Slot::Signal0 & | connectedSignal ()
| Returns a signal that indicates that the client has successfully connected to the server. More...
Public Member Functions inherited from GNet::HeapClient
| HeapClient (const Location &remote_info, bool bind_local_address=false, const Address &local_address=Address::defaultAddress(), 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".
Public Member Functions inherited from GNet::SimpleClient
| SimpleClient (ExceptionHandler &, const Location &remote_info, bool bind_local_address=false, const Address &local_address=Address::defaultAddress(), bool sync_dns=synchronousDnsDefault(), unsigned int secure_connection_timeout=0U)
| Constructor. Call connect() to start connecting.
void | connect ()
| Initates a connection to the remote server. More...
bool | connected () const
| Returns true if connected to the peer.
virtual std::pair< bool, Address > | localAddress () const override
| Override from Connection. More...
virtual std::pair< bool, Address > | peerAddress () const override
| Override from Connection. More...
virtual std::string | connectionState () const override
| Returns the connection state display string. More...
virtual std::string | peerCertificate () const override
| Returns the peer's TLS certificate. More...
Location | remoteLocation () const
| Returns a Location structure containing the result of host() and service() name lookup if available. More...
void | updateLocation (const Location &)
| Updates the constructor's Location object with the given one as long as both objects have the same host and service name. More...
virtual void | readEvent () override
| Override from GNet::EventHandler.
virtual void | writeEvent () override
| Override from GNet::EventHandler.
virtual void | otherEvent (EventHandler::Reason) override
| Override from GNet::EventHandler.
bool | send (const std::string &data, std::string::size_type offset=0)
| Sends data to the peer. More...
Public Member Functions inherited from GNet::EventHandler
virtual | ~EventHandler ()
| Destructor.
Public Member Functions inherited from GNet::Connection
virtual | ~Connection ()
| Destructor.

## Static Public Member Functions
static void | username (const std::string &)
| Sets the username used in the network protocol.
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 Public Member Functions inherited from GNet::EventHandler
static std::string | str (Reason)
| Returns a printable description of the other-event reason. More...

## Protected Member Functions
virtual | ~SpamClient ()
| Destructor.
virtual void | onConnect () override
| Override from GNet::SimpleClient.
virtual bool | onReceive (const char *, size_t, size_t) override
| Override from GNet::Client.
virtual void | onSendComplete () override
| Override from GNet::SimpleClient.
virtual void | onSecure (const std::string &) override
| Override from GNet::SocketProtocolSink.
virtual void | onDelete (const std::string &) override
| Override from GNet::HeapClient.
Protected Member Functions inherited from GNet::Client
virtual | ~Client ()
| Destructor.
void | clearInput ()
| Clears the line buffer. More...
std::string | lineBufferEndOfLine () const
| Returns the line buffer end-of-line string. More...
virtual void | onDeleteImp (const std::string &reason) override
| Override from GNet::HeapClient.
virtual void | onConnectImp () override
| Override from GNet::SimpleClient.
virtual void | onData (const char *, SimpleClient::size_type) override
| Override from GNet::SocketProtocolSink.
virtual void | onConnecting () override
| Override from GNet::HeapClient.
virtual void | onSendImp () override
| Override from GNet::SimpleClient.
Protected Member Functions inherited from GNet::HeapClient
virtual | ~HeapClient ()
| Destructor.
void | finish ()
| Indicates that the last data has been sent and the client is expecting a peer disconnect. More...
virtual void | onException (std::exception &) g__final override
| Override from GNet::ExceptionHandler. More...
Protected Member Functions inherited from GNet::ExceptionHandler
virtual | ~ExceptionHandler ()
| Destructor.
Protected Member Functions inherited from GNet::SimpleClient
virtual | ~SimpleClient ()
| Destructor.
StreamSocket & | socket ()
| Returns a reference to the socket. Throws if not connected.
const StreamSocket & | socket () const
| Returns a const reference to the socket. Throws if not connected.
void | secureConnect ()
| Starts TLS/SSL client-side negotiation. More...
std::string | logId () const
| Returns a identification string for logging purposes. More...
| SimpleClient (ExceptionHandler &, const Location &remote_info, bool bind_local_address=false, const Address &local_address=Address::defaultAddress(), bool sync_dns=synchronousDnsDefault(), unsigned int secure_connection_timeout=0U)
| Constructor. Call connect() to start connecting.
void | connect ()
| Initates a connection to the remote server. More...
bool | connected () const
| Returns true if connected to the peer.
virtual std::pair< bool, Address > | localAddress () const override
| Override from Connection. More...
virtual std::pair< bool, Address > | peerAddress () const override
| Override from Connection. More...
virtual std::string | connectionState () const override
| Returns the connection state display string. More...
virtual std::string | peerCertificate () const override
| Returns the peer's TLS certificate. More...
Location | remoteLocation () const
| Returns a Location structure containing the result of host() and service() name lookup if available. More...
void | updateLocation (const Location &)
| Updates the constructor's Location object with the given one as long as both objects have the same host and service name. More...
virtual void | readEvent () override
| Override from GNet::EventHandler.
virtual void | writeEvent () override
| Override from GNet::EventHandler.
virtual void | otherEvent (EventHandler::Reason) override
| Override from GNet::EventHandler.
bool | send (const std::string &data, std::string::size_type offset=0)
| Sends data to the peer. More...
Protected Member Functions inherited from GNet::EventHandler
virtual | ~EventHandler ()
| Destructor.
Protected Member Functions inherited from GNet::Connection
virtual | ~Connection ()
| Destructor.

## Additional Inherited Members
Public Types inherited from GNet::SimpleClient
enum | ConnectStatus { Success, Failure, ImmediateSuccess }
enum | State { Idle, Resolving, Connecting, Connected, Socksing, Testing }
typedef std::string::size_type | size_type
Public Types inherited from GNet::EventHandler
enum | Reason { reason_closed, reason_down, reason_reset, reason_abort, reason_other }
Protected Types inherited from GNet::SimpleClient
enum | ConnectStatus { Success, Failure, ImmediateSuccess }
enum | State { Idle, Resolving, Connecting, Connected, Socksing, Testing }
typedef std::string::size_type | size_type
Protected Types inherited from GNet::EventHandler
enum | Reason { reason_closed, reason_down, reason_reset, reason_abort, reason_other }
Static Protected Member Functions inherited from GNet::SimpleClient
static bool | connectError (const std::string &reason)
| Returns true if the reason string implies the SimpleClient::connect() failed. More...
static bool | synchronousDnsDefault ()
| Returns true if DNS queries should normally be synchronous on this platform. More...
Static Protected Member Functions inherited from GNet::EventHandler
static std::string | str (Reason)
| Returns a printable description of the other-event reason. More...

## Detailed Description

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

The interface is similar to GSmtp::RequestClient but it is single-use: only one request() can be made per object.

Definition at line 46 of file gspamclient.h.

## Member Function Documentation

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

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

Definition at line 56 of file gspamclient.cpp.

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

Starts sending a request that comprises a few http-like header lines followed by the contents of the given file.

The response is spooled into a temporary file and then committed back to the same file.

The base class's "event" signal will be emitted when processing is complete. In this case the first signal parameter will "spam" and the second will be the parsed response.

See also GNet::Client::eventSignal().

Definition at line 61 of file gspamclient.cpp.

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

- /tmp/slackrepo/SBo/slackrepo.S3SYfd/build_emailrelay/emailrelay-2.0.1/src/gsmtp/gspamclient.h
- /tmp/slackrepo/SBo/slackrepo.S3SYfd/build_emailrelay/emailrelay-2.0.1/src/gsmtp/gspamclient.cpp