28 #ifndef NDN_NET_FACE_URI_HPP 29 #define NDN_NET_FACE_URI_HPP 32 #include "../util/time.hpp" 34 #include <boost/asio/ip/tcp.hpp> 35 #include <boost/asio/ip/udp.hpp> 36 #include <boost/asio/local/stream_protocol.hpp> 46 class Error :
public std::invalid_argument
51 :
std::invalid_argument(what)
64 FaceUri(
const std::string& uri);
73 parse(
const std::string& uri);
78 FaceUri(
const boost::asio::ip::udp::endpoint& endpoint);
82 FaceUri(
const boost::asio::ip::tcp::endpoint& endpoint);
85 FaceUri(
const boost::asio::ip::tcp::endpoint& endpoint,
const std::string& scheme);
87 #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS 90 FaceUri(
const boost::asio::local::stream_protocol::endpoint& endpoint);
91 #endif // BOOST_ASIO_HAS_LOCAL_SOCKETS 103 fromDev(
const std::string& ifname);
107 fromUdpDev(
const boost::asio::ip::udp::endpoint& endpoint,
const std::string& ifname);
176 canonize(
const CanonizeSuccessCallback& onSuccess,
177 const CanonizeFailureCallback& onFailure,
178 boost::asio::io_service& io,
179 time::nanoseconds
timeout)
const;
182 std::string m_scheme;
197 #endif // NDN_NET_FACE_URI_HPP Copyright (c) 2011-2015 Regents of the University of California.
function< void(const std::string &reason)> CanonizeFailureCallback
static FaceUri fromFd(int fd)
create fd FaceUri from file descriptor
function< void(const FaceUri &)> CanonizeSuccessCallback
static bool canCanonize(const std::string &scheme)
Error(const std::string &what)
static FaceUri fromUdpDev(const boost::asio::ip::udp::endpoint &endpoint, const std::string &ifname)
create udp4 or udp6 NIC-associated FaceUri from endpoint and network device name
bool operator!=(const FaceUri &rhs) const
void canonize(const CanonizeSuccessCallback &onSuccess, const CanonizeFailureCallback &onFailure, boost::asio::io_service &io, time::nanoseconds timeout) const
asynchronously convert this FaceUri to canonical form
bool parse(const std::string &uri)
exception-safe parsing
std::string toString() const
write as a string
represents the underlying protocol and address used by a Face
represents an Ethernet hardware address
bool isCanonical() const
determine whether this FaceUri is in canonical form
bool operator==(const FaceUri &rhs) const
const std::string & getScheme() const
get scheme (protocol)
const std::string & getHost() const
get host (domain)
const std::string & getPort() const
get port
static FaceUri fromDev(const std::string &ifname)
create dev FaceUri from network device name
const std::string & getPath() const
get path
friend std::ostream & operator<<(std::ostream &os, const FaceUri &uri)