NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::dns Namespace Reference

Classes

struct  AnyAddress
 
struct  Error
 
struct  Ipv4Only
 
struct  Ipv6Only
 
class  Resolver
 

Typedefs

typedef boost::asio::ip::address IpAddress
 
typedef function< bool(const IpAddress &address)> AddressSelector
 
typedef function< void(const IpAddress &address)> SuccessCallback
 
typedef function< void(const std::string &reason)> ErrorCallback
 

Functions

void asyncResolve (const std::string &host, const SuccessCallback &onSuccess, const ErrorCallback &onError, boost::asio::io_service &ioService, const AddressSelector &addressSelector=AnyAddress(), time::nanoseconds timeout=time::seconds(4))
 Asynchronously resolve host. More...
 
IpAddress syncResolve (const std::string &host, boost::asio::io_service &ioService, const AddressSelector &addressSelector=AnyAddress())
 Synchronously resolve host. More...
 

Typedef Documentation

§ IpAddress

typedef boost::asio::ip::address ndn::dns::IpAddress

Definition at line 39 of file dns.hpp.

§ AddressSelector

typedef function<bool (const IpAddress& address)> ndn::dns::AddressSelector

Definition at line 40 of file dns.hpp.

§ SuccessCallback

typedef function<void (const IpAddress& address)> ndn::dns::SuccessCallback

Definition at line 78 of file dns.hpp.

§ ErrorCallback

typedef function<void (const std::string& reason)> ndn::dns::ErrorCallback

Definition at line 79 of file dns.hpp.

Function Documentation

§ asyncResolve()

void ndn::dns::asyncResolve ( const std::string &  host,
const SuccessCallback onSuccess,
const ErrorCallback onError,
boost::asio::io_service &  ioService,
const AddressSelector addressSelector = AnyAddress(),
time::nanoseconds  timeout = time::seconds(4) 
)

Asynchronously resolve host.

If an address selector predicate is specified, then each resolved IP address is checked against the predicate.

Available address selector predicates:

  • dns::AnyAddress()
  • dns::Ipv4Address()
  • dns::Ipv6Address()
Warning
Even after the DNS resolution has timed out, it's possible that ioService keeps running and onSuccess is invoked at a later time. This could cause segmentation fault if onSuccess is deallocated. To stop the io_service, explicitly invoke ioService.stop().

Definition at line 132 of file dns.cpp.

Referenced by ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::canonize().

§ syncResolve()

IpAddress ndn::dns::syncResolve ( const std::string &  host,
boost::asio::io_service &  ioService,
const AddressSelector addressSelector = AnyAddress() 
)

Synchronously resolve host.

If an address selector predicate is specified, then each resolved IP address is checked against the predicate.

Available address selector predicates:

  • dns::AnyAddress()
  • dns::Ipv4Address()
  • dns::Ipv6Address()

Definition at line 145 of file dns.cpp.

References ndn::dns::Resolver::syncResolve().