E-MailRelay

gdnsbl.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 gdnsbl.h
19///
20
21#ifndef G_NET_DNSBL_H
22#define G_NET_DNSBL_H
23
24#include "gdef.h"
25#include "geventstate.h"
26#include "gaddress.h"
27#include "gstringview.h"
28#include <functional>
29#include <memory>
30
31 namespace GNet
32{
33 class Dnsbl ;
34 class DnsblImp ;
35}
36
37//| \class GNet::Dnsbl
38/// A minimal bridge to GNet::DnsBlock
39///
40 class GNet::Dnsbl
41{
42 public:
43 Dnsbl( std::function<void(bool)> callback , EventState , std::string_view config = {} ) ;
44 ///< Constructor. See DnsBlock::DnsBlock().
45
46 ~Dnsbl() ;
47 ///< Destructor.
48
49 void start( const Address & ) ;
50 ///< Starts an asychronous check on the given address. The result
51 ///< is delivered via the callback function passed to the ctor.
52
53 bool busy() const ;
54 ///< Returns true after start() and before the completion callback.
55
56 static void checkConfig( const std::string & ) ;
57 ///< See DnsBlock::checkConfig().
58
59 public:
60 Dnsbl( const Dnsbl & ) = delete ;
61 Dnsbl( Dnsbl && ) = delete ;
62 Dnsbl & operator=( const Dnsbl & ) = delete ;
63 Dnsbl & operator=( Dnsbl && ) = delete ;
64
65 private:
66 std::function<void(bool)> m_callback ;
67 std::unique_ptr<DnsblImp> m_imp ;
68} ;
69
70#endif
GNet::Address
The GNet::Address class encapsulates a TCP/UDP transport address.
Definition: gaddress.h:63
GNet::Dnsbl
A minimal bridge to GNet::DnsBlock.
Definition: gdnsbl.h:41
GNet::Dnsbl::busy
bool busy() const
Returns true after start() and before the completion callback.
Definition: gdnsbl_disabled.cpp:42
GNet::Dnsbl::checkConfig
static void checkConfig(const std::string &)
See DnsBlock::checkConfig().
Definition: gdnsbl_disabled.cpp:47
GNet::Dnsbl::start
void start(const Address &)
Starts an asychronous check on the given address.
Definition: gdnsbl_disabled.cpp:37
GNet::Dnsbl::Dnsbl
Dnsbl(std::function< void(bool)> callback, EventState, std::string_view config={})
Constructor. See DnsBlock::DnsBlock().
Definition: gdnsbl_disabled.cpp:29
GNet::Dnsbl::~Dnsbl
~Dnsbl()
Destructor.
GNet::EventState
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
Definition: geventstate.h:131
gaddress.h
geventstate.h
gstringview.h
GNet
Network classes.
Definition: gdef.h:1243