NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
dns.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_UTIL_DNS_HPP
23
#define NDN_UTIL_DNS_HPP
24
25
#include "../util/time.hpp"
26
27
#include <boost/asio/ip/address.hpp>
28
29
// forward declaration
30
namespace
boost
{
31
namespace
asio {
32
class
io_service;
33
}
// namespace asio
34
}
// namespace boost
35
36
namespace
ndn
{
37
namespace
dns {
38
39
typedef
boost::asio::ip::address
IpAddress
;
40
typedef
function<bool (const IpAddress& address)>
AddressSelector
;
41
42
struct
AnyAddress
43
{
44
bool
45
operator()
(
const
IpAddress& address)
const
46
{
47
return
true
;
48
}
49
};
50
51
struct
Ipv4Only
52
{
53
bool
54
operator()
(
const
IpAddress& address)
const
55
{
56
return
address.is_v4();
57
}
58
};
59
60
struct
Ipv6Only
61
{
62
bool
63
operator()
(
const
IpAddress& address)
const
64
{
65
return
address.is_v6();
66
}
67
};
68
69
struct
Error
:
public
std::runtime_error
70
{
71
explicit
72
Error
(
const
std::string& what)
73
:
std
::runtime_error(what)
74
{
75
}
76
};
77
78
typedef
function<void (const IpAddress& address)>
SuccessCallback
;
79
typedef
function<void (const std::string& reason)>
ErrorCallback
;
80
97
void
98
asyncResolve
(
const
std::string& host,
99
const
SuccessCallback& onSuccess,
100
const
ErrorCallback& onError,
101
boost::asio::io_service& ioService,
102
const
AddressSelector& addressSelector =
AnyAddress
(),
103
time::nanoseconds timeout = time::seconds(4));
104
116
IpAddress
117
syncResolve
(
const
std::string& host,
118
boost::asio::io_service& ioService,
119
const
AddressSelector& addressSelector =
AnyAddress
());
120
121
}
// namespace dns
122
}
// namespace ndn
123
124
#endif // NDN_UTIL_DNS_HPP
ndn::dns::AnyAddress
Definition:
dns.hpp:42
ndn::dns::Error::Error
Error(const std::string &what)
Definition:
dns.hpp:72
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
boost
Copyright (c) 2013-2016 Regents of the University of California.
Definition:
ndn-content-store.hpp:209
ndn::dns::SuccessCallback
function< void(const IpAddress &address)> SuccessCallback
Definition:
dns.hpp:78
std
STL namespace.
ndn::dns::syncResolve
IpAddress syncResolve(const std::string &host, boost::asio::io_service &ioService, const AddressSelector &addressSelector)
Synchronously resolve host.
Definition:
dns.cpp:145
ndn::dns::AddressSelector
function< bool(const IpAddress &address)> AddressSelector
Definition:
dns.hpp:40
ndn::dns::ErrorCallback
function< void(const std::string &reason)> ErrorCallback
Definition:
dns.hpp:79
ndn::dns::Ipv6Only::operator()
bool operator()(const IpAddress &address) const
Definition:
dns.hpp:63
ndn::dns::Error
Definition:
dns.hpp:69
ndn::dns::asyncResolve
void asyncResolve(const std::string &host, const SuccessCallback &onSuccess, const ErrorCallback &onError, boost::asio::io_service &ioService, const AddressSelector &addressSelector, time::nanoseconds timeout)
Asynchronously resolve host.
Definition:
dns.cpp:132
ndn::dns::Ipv6Only
Definition:
dns.hpp:60
ndn::dns::IpAddress
boost::asio::ip::address IpAddress
Definition:
dns.hpp:39
ndn::dns::Ipv4Only
Definition:
dns.hpp:51
ndn::dns::AnyAddress::operator()
bool operator()(const IpAddress &address) const
Definition:
dns.hpp:45
ndn::dns::Ipv4Only::operator()
bool operator()(const IpAddress &address) const
Definition:
dns.hpp:54
ndnSIM
ndn-cxx
src
util
dns.hpp
Generated on Wed Jan 11 2017 18:17:14 for ndnSIM by
1.8.13