NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ndnSIM
ndnSIM documentation
All Attributes
All GlobalValues
All LogComponents
All TraceSources
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
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_H
23
#define NDN_UTIL_DNS_H
24
25
#include "../util/time.hpp"
26
#include <boost/asio/ip/address.hpp>
27
#include <boost/asio/io_service.hpp>
28
29
namespace
ndn
{
30
namespace
dns {
31
32
typedef
function<bool (const boost::asio::ip::address& address)>
AddressSelector
;
33
34
struct
AnyAddress
35
{
36
bool
37
operator()
(
const
boost::asio::ip::address& address)
38
{
39
return
true
;
40
}
41
};
42
43
struct
Ipv4Only
44
{
45
bool
46
operator()
(
const
boost::asio::ip::address& address)
47
{
48
return
address.is_v4();
49
}
50
};
51
52
struct
Ipv6Only
53
{
54
bool
55
operator()
(
const
boost::asio::ip::address& address)
56
{
57
return
address.is_v6();
58
}
59
};
60
61
struct
Error
:
public
std::runtime_error
62
{
63
Error
(
const
std::string& what)
64
:
std
::runtime_error(what)
65
{
66
}
67
};
68
69
typedef
boost::asio::ip::address
IpAddress
;
70
71
typedef
function<void (const IpAddress& address)>
SuccessCallback
;
72
typedef
function<void (const std::string& reason)>
ErrorCallback
;
73
85
void
86
asyncResolve
(
const
std::string& host,
87
const
SuccessCallback& onSuccess,
88
const
ErrorCallback& onError,
89
boost::asio::io_service& ioService,
90
const
ndn::dns::AddressSelector
& addressSelector =
ndn::dns::AnyAddress
(),
91
const
time::nanoseconds& timeout = time::seconds(4));
92
104
IpAddress
105
syncResolve
(
const
std::string& host,
106
boost::asio::io_service& ioService,
107
const
ndn::dns::AddressSelector
& addressSelector =
ndn::dns::AnyAddress
());
108
109
}
// namespace dns
110
}
// namespace ndn
111
112
#endif // NDN_UTIL_DNS_H
ndn::dns::AnyAddress
Definition:
dns.hpp:34
ndn::dns::Error::Error
Error(const std::string &what)
Definition:
dns.hpp:63
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::dns::asyncResolve
void asyncResolve(const std::string &host, const SuccessCallback &onSuccess, const ErrorCallback &onError, boost::asio::io_service &ioService, const ndn::dns::AddressSelector &addressSelector, const time::nanoseconds &timeout)
Asynchronously resolve host.
Definition:
dns.cpp:123
ndn::dns::AddressSelector
function< bool(const boost::asio::ip::address &address)> AddressSelector
Definition:
dns.hpp:32
ndn::dns::syncResolve
IpAddress syncResolve(const std::string &host, boost::asio::io_service &ioService, const ndn::dns::AddressSelector &addressSelector)
Synchronously resolve host.
Definition:
dns.cpp:137
ndn::dns::SuccessCallback
function< void(const IpAddress &address)> SuccessCallback
Definition:
dns.hpp:71
ndn::dns::AnyAddress::operator()
bool operator()(const boost::asio::ip::address &address)
Definition:
dns.hpp:37
std
STL namespace.
ndn::dns::Ipv6Only::operator()
bool operator()(const boost::asio::ip::address &address)
Definition:
dns.hpp:55
ndn::dns::ErrorCallback
function< void(const std::string &reason)> ErrorCallback
Definition:
dns.hpp:72
ndn::dns::Error
Definition:
dns.hpp:61
ndn::dns::Ipv6Only
Definition:
dns.hpp:52
ndn::dns::IpAddress
boost::asio::ip::address IpAddress
Definition:
dns.hpp:69
ndn::dns::Ipv4Only::operator()
bool operator()(const boost::asio::ip::address &address)
Definition:
dns.hpp:46
ndn::dns::Ipv4Only
Definition:
dns.hpp:43
ndnSIM
ndn-cxx
src
util
dns.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11