E-MailRelay

gnetworkverifier.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file gnetworkverifier.h
19///
20
21#ifndef G_NETWORK_VERIFIER_H
22#define G_NETWORK_VERIFIER_H
23
24#include "gdef.h"
25#include "gverifier.h"
26#include "grequestclient.h"
27#include "gclientptr.h"
28#include <string>
29
30 namespace GVerifiers
31{
32 class NetworkVerifier ;
33}
34
35//| \class GVerifiers::NetworkVerifier
36/// A Verifier that talks to a remote address verifier over the network.
37///
38 class GVerifiers::NetworkVerifier : public GSmtp::Verifier , private GNet::ExceptionHandler
39{
40 public:
41 NetworkVerifier( GNet::EventState , const GSmtp::Verifier::Config & config ,
42 const std::string & server ) ;
43 ///< Constructor.
44
45 ~NetworkVerifier() override ;
46 ///< Destructor.
47
48 private: // overrides
49 void verify( const GSmtp::Verifier::Request & ) override ; // GSmtp::Verifier
50 G::Slot::Signal<GSmtp::Verifier::Command,const GSmtp::VerifierStatus&> & doneSignal() override ; // GSmtp::Verifier
51 void cancel() override ; // GSmtp::Verifier
52 void onException( GNet::ExceptionSource * , std::exception & , bool ) override ; // GNet::ExceptionHandler
53
54 public:
55 NetworkVerifier( const NetworkVerifier & ) = delete ;
56 NetworkVerifier( NetworkVerifier && ) = delete ;
57 NetworkVerifier & operator=( const NetworkVerifier & ) = delete ;
58 NetworkVerifier & operator=( NetworkVerifier && ) = delete ;
59
60 private:
61 void clientEvent( const std::string & s1 , const std::string & s2 , const std::string & ) ;
62
63 private:
64 GNet::EventState m_es ;
65 G::Slot::Signal<GSmtp::Verifier::Command,const GSmtp::VerifierStatus&> m_done_signal ;
66 GSmtp::Verifier::Config m_config ;
67 GNet::Location m_location ;
68 unsigned int m_connection_timeout ;
69 unsigned int m_response_timeout ;
70 GNet::ClientPtr<GSmtp::RequestClient> m_client_ptr ;
71 std::string m_to_address ;
72 GSmtp::Verifier::Command m_command {GSmtp::Verifier::Command::VRFY} ;
73} ;
74
75#endif
GNet::ClientPtr< GSmtp::RequestClient >
GNet::EventState
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
Definition: geventstate.h:131
GNet::ExceptionHandler
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket/future event...
Definition: gexceptionhandler.h:44
GNet::ExceptionSource
A mixin base class that identifies the source of an exception when delivered to GNet::ExceptionHandle...
Definition: gexceptionsource.h:39
GNet::Location
A class that represents the remote target for out-going client connections.
Definition: glocation.h:70
GSmtp::Verifier
An asynchronous interface that verifies recipient 'to' addresses.
Definition: gverifier.h:43
GVerifiers::NetworkVerifier
A Verifier that talks to a remote address verifier over the network.
Definition: gnetworkverifier.h:39
GVerifiers::NetworkVerifier::~NetworkVerifier
~NetworkVerifier() override
Destructor.
Definition: gnetworkverifier.cpp:40
GVerifiers::NetworkVerifier::NetworkVerifier
NetworkVerifier(GNet::EventState, const GSmtp::Verifier::Config &config, const std::string &server)
Constructor.
Definition: gnetworkverifier.cpp:28
gclientptr.h
grequestclient.h
gverifier.h
GVerifiers
Address verifier classes.
Definition: gexecutableverifier.h:31
GSmtp::Verifier::Config
Configuration passed to address verifier constructors.
Definition: gverifier.h:57
GSmtp::Verifier::Request
Verification request passed to various GSmtp::Verifier::verify() overrides.
Definition: gverifier.h:47
G::Slot::Signal< GSmtp::Verifier::Command, const GSmtp::VerifierStatus & >