E-MailRelay

gexecutableverifier.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 gexecutableverifier.h
19///
20
21#ifndef G_EXECUTABLE_VERIFIER_H
22#define G_EXECUTABLE_VERIFIER_H
23
24#include "gdef.h"
25#include "gverifier.h"
26#include "gtask.h"
27#include "gtimer.h"
28#include <string>
29
30 namespace GVerifiers
31{
32 class ExecutableVerifier ;
33}
34
35//| \class GVerifiers::ExecutableVerifier
36/// A Verifier that runs an executable.
37///
38 class GVerifiers::ExecutableVerifier : public GSmtp::Verifier, private GNet::TaskCallback
39{
40 public:
41 ExecutableVerifier( GNet::EventState , const GSmtp::Verifier::Config & , const G::Path & ) ;
42 ///< Constructor.
43
44 private: // overrides
45 G::Slot::Signal<GSmtp::Verifier::Command,const GSmtp::VerifierStatus&> & doneSignal() override ; // GSmtp::Verifier
46 void cancel() override ; // GSmtp::Verifier
47 void onTaskDone( int , const std::string & ) override ; // GNet::TaskCallback
48 void verify( const GSmtp::Verifier::Request & ) override ; // GSmtp::Verifier
49
50 public:
51 ~ExecutableVerifier() override = default ;
52 ExecutableVerifier( const ExecutableVerifier & ) = delete ;
53 ExecutableVerifier( ExecutableVerifier && ) = delete ;
54 ExecutableVerifier & operator=( const ExecutableVerifier & ) = delete ;
55 ExecutableVerifier & operator=( ExecutableVerifier && ) = delete ;
56
57 private:
58 void onTimeout() ;
59
60 private:
61 GNet::Timer<ExecutableVerifier> m_timer ;
62 GSmtp::Verifier::Command m_command {GSmtp::Verifier::Command::VRFY} ;
63 GSmtp::Verifier::Config m_config ;
64 G::Path m_path ;
65 G::Slot::Signal<GSmtp::Verifier::Command,const GSmtp::VerifierStatus&> m_done_signal ;
66 std::string m_to_address ;
67 GNet::Task m_task ;
68} ;
69
70#endif
GNet::EventState
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
Definition: geventstate.h:131
GNet::TaskCallback
An abstract interface for callbacks from GNet::Task.
Definition: gtask.h:114
GNet::Task
A class for running an exectuable in a separate process with an asychronous completion callback.
Definition: gtask.h:46
GNet::Timer
A timer class template in which the timeout is delivered to the specified method.
Definition: gtimer.h:141
GSmtp::Verifier
An asynchronous interface that verifies recipient 'to' addresses.
Definition: gverifier.h:43
GVerifiers::ExecutableVerifier
A Verifier that runs an executable.
Definition: gexecutableverifier.h:39
GVerifiers::ExecutableVerifier::ExecutableVerifier
ExecutableVerifier(GNet::EventState, const GSmtp::Verifier::Config &, const G::Path &)
Constructor.
Definition: gexecutableverifier.cpp:32
G::Path
A Path object represents a file system path.
Definition: gpath.h:82
gtask.h
gtimer.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 & >