E-MailRelay

Public Types | Public Member Functions | Static Public Member Functions | List of all members
GNet::DnsBlock Class Reference

Implements DNS blocklisting, as per RFC-5782. More...

`#include <gdnsblock.h>`

Inheritance diagram for GNet::DnsBlock:

## Public Types
using | ResultList = std::vector< DnsBlockServerResult >

## Public Member Functions
| DnsBlock (DnsBlockCallback &, ExceptionSink, const std::string &config=std::string())
| Constructor. More...
void | configure (const Address &dns_server, std::size_t threshold, bool allow_on_timeout, G::TimeInterval timeout, const G::StringArray &servers)
| Configures the object after construction. More...
void | configure (const std::string &)
| Configuration overload taking a configuration string containing comma-separated fields of: dns-server-address, timeout-ms, threshold, dnsbl-server-list. More...
void | start (const Address &)
| Starts an asychronous check on the given address. More...
bool | busy () const
| Returns true after start() and before the completion callback. More...
| DnsBlock (const DnsBlock &)=delete
| DnsBlock (DnsBlock &&)=delete
void | operator= (const DnsBlock &)=delete
void | operator= (DnsBlock &&)=delete

## Static Public Member Functions
static void | checkConfig (const std::string &)
| Checks the configure() string, throwing on error. More...

## Detailed Description

Implements DNS blocklisting, as per RFC-5782.

The implementation sends DNS requests for each configured block-list server incorporating the IP address to be tested, for example "1.0.0.127.nospam.com" and "1.0.0.127.blockme.org". All requests go to the same DNS server and are cached or routed in the normal way, so the block-list servers are not contacted directly.

Definition at line 144 of file gdnsblock.h.

## Member Typedef Documentation

## ◆ ResultList

using GNet::DnsBlock::ResultList = std::vector<DnsBlockServerResult>

Definition at line 148 of file gdnsblock.h.

## Constructor & Destructor Documentation

## ◆ DnsBlock()

GNet::DnsBlock::DnsBlock | ( | DnsBlockCallback & | callback,
|  | ExceptionSink | es,
|  | const std::string & | config = `std::string()`
| ) |  |

Constructor.

Use configure() if necessary and then start(), one time only.

Definition at line 87 of file gdnsblock.cpp.

## Member Function Documentation

## ◆ busy()

bool GNet::DnsBlock::busy | ( |  | ) | const

Returns true after start() and before the completion callback.

Definition at line 195 of file gdnsblock.cpp.

## ◆ checkConfig()

void GNet::DnsBlock::checkConfig | ( | const std::string & | config | ) |
| static

Checks the configure() string, throwing on error.

Definition at line 101 of file gdnsblock.cpp.

## ◆ configure() [1/2]

void GNet::DnsBlock::configure | ( | const Address & | dns_server,
|  | std::size_t | threshold,
|  | bool | allow_on_timeout,
|  | G::TimeInterval | timeout,
|  | const G::StringArray & | servers
| ) |  |

Configures the object after construction.

Definition at line 136 of file gdnsblock.cpp.

## ◆ configure() [2/2]

void GNet::DnsBlock::configure | ( | const std::string & | config | ) |

Configuration overload taking a configuration string containing comma-separated fields of: dns-server-address, timeout-ms, threshold, dnsbl-server-list.

Definition at line 113 of file gdnsblock.cpp.

## ◆ start()

void GNet::DnsBlock::start | ( | const Address & | address | ) |

Starts an asychronous check on the given address.

The result is delivered via the callback interface passed to the ctor.

Definition at line 146 of file gdnsblock.cpp.

The documentation for this class was generated from the following files:

- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/gnet/gdnsblock.h
- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/gnet/gdnsblock.cpp