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
31namespace GNet
32{
33 class Dnsbl ;
34 class DnsblImp ;
35}
36
37//| \class GNet::Dnsbl
38/// A minimal bridge to GNet::DnsBlock
39///
41{
42public:
43 Dnsbl( std::function<void(bool)> callback , EventState , std::string_view config = {} ) ;
44 ///< Constructor. See DnsBlock::DnsBlock().
45
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
59public:
60 Dnsbl( const Dnsbl & ) = delete ;
61 Dnsbl( Dnsbl && ) = delete ;
62 Dnsbl & operator=( const Dnsbl & ) = delete ;
63 Dnsbl & operator=( Dnsbl && ) = delete ;
64
65private:
66 std::function<void(bool)> m_callback ;
67 std::unique_ptr<DnsblImp> m_imp ;
68} ;
69
70#endif
The GNet::Address class encapsulates a TCP/UDP transport address.
Definition: gaddress.h:63
A minimal bridge to GNet::DnsBlock.
Definition: gdnsbl.h:41
bool busy() const
Returns true after start() and before the completion callback.
static void checkConfig(const std::string &)
See DnsBlock::checkConfig().
void start(const Address &)
Starts an asychronous check on the given address.
Dnsbl(std::function< void(bool)> callback, EventState, std::string_view config={})
Constructor. See DnsBlock::DnsBlock().
~Dnsbl()
Destructor.
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
Definition: geventstate.h:131
Network classes.
Definition: gdef.h:1243