28 #ifndef NDN_NET_FACE_URI_HPP 29 #define NDN_NET_FACE_URI_HPP 35 #include <boost/asio/ip/tcp.hpp> 36 #include <boost/asio/ip/udp.hpp> 37 #include <boost/asio/local/stream_protocol.hpp> 47 class Error :
public std::invalid_argument
50 using std::invalid_argument::invalid_argument;
61 FaceUri(
const std::string& uri);
70 parse(
const std::string& uri);
75 FaceUri(
const boost::asio::ip::udp::endpoint& endpoint);
79 FaceUri(
const boost::asio::ip::tcp::endpoint& endpoint);
82 FaceUri(
const boost::asio::ip::tcp::endpoint& endpoint,
const std::string& scheme);
84 #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS 87 FaceUri(
const boost::asio::local::stream_protocol::endpoint& endpoint);
88 #endif // BOOST_ASIO_HAS_LOCAL_SOCKETS 100 fromDev(
const std::string& ifname);
104 fromUdpDev(
const boost::asio::ip::udp::endpoint& endpoint,
const std::string& ifname);
166 canonize(
const CanonizeSuccessCallback& onSuccess,
167 const CanonizeFailureCallback& onFailure,
168 boost::asio::io_service& io,
169 time::nanoseconds timeout)
const;
178 return !(lhs != rhs);
184 return lhs.m_isV6 != rhs.m_isV6 ||
185 lhs.m_scheme != rhs.m_scheme ||
186 lhs.m_host != rhs.m_host ||
187 lhs.m_port != rhs.m_port ||
188 lhs.m_path != rhs.m_path;
192 std::string m_scheme;
207 #endif // NDN_NET_FACE_URI_HPP
function< void(const std::string &reason)> CanonizeFailureCallback
static FaceUri fromFd(int fd)
create fd FaceUri from file descriptor
const std::string & getHost() const
get host (domain)
function< void(const FaceUri &)> CanonizeSuccessCallback
static bool canCanonize(const std::string &scheme)
std::string toString() const
write as a string
const std::string & getPort() const
get port
friend bool operator==(const FaceUri &lhs, const FaceUri &rhs)
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 parse(const std::string &uri)
exception-safe parsing
friend bool operator!=(const FaceUri &lhs, const FaceUri &rhs)
#define NDN_CXX_NODISCARD
void canonize(const CanonizeSuccessCallback &onSuccess, const CanonizeFailureCallback &onFailure, boost::asio::io_service &io, time::nanoseconds timeout) const
asynchronously convert this FaceUri to canonical form
represents the underlying protocol and address used by a Face
represents an Ethernet hardware address
const std::string & getScheme() const
get scheme (protocol)
bool isCanonical() const
determine whether this FaceUri is in canonical form
const std::string & getPath() const
get path
static FaceUri fromDev(const std::string &ifname)
create dev FaceUri from network device name
friend std::ostream & operator<<(std::ostream &os, const FaceUri &uri)