28 #ifndef NDN_CXX_NET_FACE_URI_HPP
29 #define NDN_CXX_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>
48 class Error :
public std::invalid_argument
51 using std::invalid_argument::invalid_argument;
62 FaceUri(
const std::string& uri);
71 parse(
const std::string& uri);
76 FaceUri(
const boost::asio::ip::udp::endpoint& endpoint);
80 FaceUri(
const boost::asio::ip::tcp::endpoint& endpoint);
83 FaceUri(
const boost::asio::ip::tcp::endpoint& endpoint,
const std::string& scheme);
85 #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
88 FaceUri(
const boost::asio::local::stream_protocol::endpoint& endpoint);
101 fromDev(
const std::string& ifname);
105 fromUdpDev(
const boost::asio::ip::udp::endpoint& endpoint,
const std::string& ifname);
170 boost::asio::io_service& io,
180 return !(lhs != rhs);
186 return lhs.m_isV6 != rhs.m_isV6 ||
187 lhs.m_scheme != rhs.m_scheme ||
188 lhs.m_host != rhs.m_host ||
189 lhs.m_port != rhs.m_port ||
190 lhs.m_path != rhs.m_path;
194 std::string m_scheme;
205 operator<<(std::ostream& os,
const FaceUri& uri);
#define NDN_CXX_NODISCARD
The underlying protocol and address used by a Face.
std::string toString() const
Serialize as a string.
friend bool operator!=(const FaceUri &lhs, const FaceUri &rhs)
function< void(const FaceUri &)> CanonizeSuccessCallback
friend std::ostream & operator<<(std::ostream &os, const FaceUri &uri)
const std::string & getScheme() const
Get scheme (protocol)
bool parse(const std::string &uri)
Exception-safe parsing.
static bool canCanonize(const std::string &scheme)
Return whether a FaceUri of the specified scheme can be canonized.
bool isCanonical() const
Determine whether this FaceUri is in canonical form.
const std::string & getHost() const
Get host (domain)
const std::string & getPath() const
Get path.
friend bool operator==(const FaceUri &lhs, const FaceUri &rhs)
static FaceUri fromDev(const std::string &ifname)
Construct a dev FaceUri from a network device name.
static FaceUri fromUdpDev(const boost::asio::ip::udp::endpoint &endpoint, const std::string &ifname)
Construct a udp4 or udp6 NIC-associated FaceUri from endpoint and network device name.
void canonize(const CanonizeSuccessCallback &onSuccess, const CanonizeFailureCallback &onFailure, boost::asio::io_service &io, time::nanoseconds timeout) const
Asynchronously convert this FaceUri to canonical form.
const std::string & getPort() const
Get port.
function< void(const std::string &reason)> CanonizeFailureCallback
static FaceUri fromFd(int fd)
Construct an fd FaceUri from a file descriptor.
Represents an Ethernet hardware address.
boost::chrono::nanoseconds nanoseconds
std::ostream & operator<<(std::ostream &os, const Data &data)