E-MailRelay
gdnsbl.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2023 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 "gexceptionsink.h"
26#include "gaddress.h"
27#include "gstringview.h"
28#include <functional>
29
30namespace GNet
31{
32 class Dnsbl ;
33 class DnsblImp ;
34}
35
36//| \class GNet::Dnsbl
37/// A minimal bridge to GNet::DnsBlock
38///
40{
41public:
42 Dnsbl( std::function<void(bool)> callback , ExceptionSink , G::string_view config = {} ) ;
43 ///< Constructor. See DnsBlock::DnsBlock().
44
46 ///< Destructor.
47
48 void start( const Address & ) ;
49 ///< Starts an asychronous check on the given address. The result
50 ///< is delivered via the callback function passed to the ctor.
51
52 bool busy() const ;
53 ///< Returns true after start() and before the completion callback.
54
55 static void checkConfig( const std::string & ) ;
56 ///< See DnsBlock::checkConfig().
57
58public:
59 Dnsbl( const Dnsbl & ) = delete ;
60 Dnsbl( Dnsbl && ) = delete ;
61 Dnsbl & operator=( const Dnsbl & ) = delete ;
62 Dnsbl & operator=( Dnsbl && ) = delete ;
63
64private:
65 std::function<void(bool)> m_callback ;
66 std::unique_ptr<DnsblImp> m_imp ;
67} ;
68
69#endif
The GNet::Address class encapsulates a TCP/UDP transport address.
Definition: gaddress.h:62
A minimal bridge to GNet::DnsBlock.
Definition: gdnsbl.h:40
bool busy() const
Returns true after start() and before the completion callback.
static void checkConfig(const std::string &)
See DnsBlock::checkConfig().
Dnsbl(std::function< void(bool)> callback, ExceptionSink, G::string_view config={})
Constructor. See DnsBlock::DnsBlock().
void start(const Address &)
Starts an asychronous check on the given address.
~Dnsbl()
Destructor.
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
A class like c++17's std::string_view.
Definition: gstringview.h:51
Network classes.
Definition: gdef.h:1144