Classes | |
struct | AnyAddress |
struct | Ipv4Only |
struct | Ipv6Only |
Typedefs | |
using | AddressSelector = std::function< bool(const boost::asio::ip::address &)> |
using | ErrorCallback = std::function< void(const std::string &reason)> |
using | SuccessCallback = std::function< void(const boost::asio::ip::address &address)> |
Functions | |
void | asyncResolve (const std::string &host, const SuccessCallback &onSuccess, const ErrorCallback &onError, boost::asio::io_context &ioCtx, const AddressSelector &addressSelector=AnyAddress(), time::nanoseconds timeout=4_s) |
Asynchronously resolve host . More... | |
using ndn::dns::AddressSelector = typedef std::function<bool(const boost::asio::ip::address&)> |
using ndn::dns::ErrorCallback = typedef std::function<void(const std::string& reason)> |
using ndn::dns::SuccessCallback = typedef std::function<void(const boost::asio::ip::address& address)> |
void ndn::dns::asyncResolve | ( | const std::string & | host, |
const SuccessCallback & | onSuccess, | ||
const ErrorCallback & | onError, | ||
boost::asio::io_context & | ioCtx, | ||
const AddressSelector & | addressSelector = AnyAddress() , |
||
time::nanoseconds | timeout = 4_s |
||
) |
Asynchronously resolve host
.
If an address selector predicate is specified, then each resolved IP address is checked against the predicate.
Available address selector predicates:
ioCtx
keeps running and onSuccess
is invoked at a later time. This could cause segmentation fault if onSuccess
is deallocated. To stop the io_context, explicitly invoke ioCtx.stop()
.