represents the underlying protocol and address used by a Face More...
#include <face-uri.hpp>
Classes | |
class | Error |
Public Types | |
typedef function< void(const FaceUri &)> | CanonizeSuccessCallback |
typedef function< void(const std::string &reason)> | CanonizeFailureCallback |
Public Member Functions | |
FaceUri () | |
FaceUri (const std::string &uri) | |
construct by parsing More... | |
FaceUri (const char *uri) | |
NDN_CXX_NODISCARD bool | parse (const std::string &uri) |
exception-safe parsing More... | |
FaceUri (const boost::asio::ip::udp::endpoint &endpoint) | |
construct udp4 or udp6 canonical FaceUri More... | |
FaceUri (const boost::asio::ip::tcp::endpoint &endpoint) | |
construct tcp4 or tcp6 canonical FaceUri More... | |
FaceUri (const boost::asio::ip::tcp::endpoint &endpoint, const std::string &scheme) | |
construct tcp canonical FaceUri with custom scheme More... | |
FaceUri (const ethernet::Address &address) | |
construct ether canonical FaceUri More... | |
const std::string & | getScheme () const |
get scheme (protocol) More... | |
const std::string & | getHost () const |
get host (domain) More... | |
const std::string & | getPort () const |
get port More... | |
const std::string & | getPath () const |
get path More... | |
std::string | toString () const |
write as a string More... | |
bool | isCanonical () const |
determine whether this FaceUri is in canonical form More... | |
void | canonize (const CanonizeSuccessCallback &onSuccess, const CanonizeFailureCallback &onFailure, time::nanoseconds timeout) const |
asynchronously convert this FaceUri to canonical form More... | |
Static Public Member Functions | |
static FaceUri | fromFd (int fd) |
create fd FaceUri from file descriptor More... | |
static FaceUri | fromDev (const std::string &ifname) |
create dev FaceUri from network device name More... | |
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 More... | |
static bool | canCanonize (const std::string &scheme) |
Friends | |
bool | operator== (const FaceUri &lhs, const FaceUri &rhs) |
bool | operator!= (const FaceUri &lhs, const FaceUri &rhs) |
std::ostream & | operator<< (std::ostream &os, const FaceUri &uri) |
represents the underlying protocol and address used by a Face
Definition at line 44 of file face-uri.hpp.
typedef function<void(const FaceUri&)> ndn::FaceUri::CanonizeSuccessCallback |
Definition at line 153 of file face-uri.hpp.
typedef function<void(const std::string& reason)> ndn::FaceUri::CanonizeFailureCallback |
Definition at line 154 of file face-uri.hpp.
ndn::FaceUri::FaceUri | ( | ) |
Definition at line 46 of file face-uri.cpp.
Referenced by FaceUri().
|
explicit |
construct by parsing
uri | scheme://host[:port]/path |
FaceUri::Error | if URI cannot be parsed |
Definition at line 51 of file face-uri.cpp.
|
explicit |
Definition at line 58 of file face-uri.cpp.
|
explicit |
construct udp4 or udp6 canonical FaceUri
Definition at line 120 of file face-uri.cpp.
References ndn::to_string().
|
explicit |
construct tcp4 or tcp6 canonical FaceUri
Definition at line 128 of file face-uri.cpp.
References ndn::to_string().
ndn::FaceUri::FaceUri | ( | const boost::asio::ip::tcp::endpoint & | endpoint, |
const std::string & | scheme | ||
) |
construct tcp canonical FaceUri with custom scheme
Definition at line 136 of file face-uri.cpp.
References FaceUri(), and ndn::to_string().
|
explicit |
construct ether canonical FaceUri
Definition at line 162 of file face-uri.cpp.
bool ndn::FaceUri::parse | ( | const std::string & | uri | ) |
exception-safe parsing
Definition at line 64 of file face-uri.cpp.
Referenced by nfd::FaceManager::FaceManager(), and FaceUri().
|
static |
create fd FaceUri from file descriptor
Definition at line 154 of file face-uri.cpp.
References ndn::to_string().
Referenced by nfd::face::UnixStreamTransport::UnixStreamTransport().
|
static |
create dev FaceUri from network device name
Definition at line 170 of file face-uri.cpp.
Referenced by ndn::DevCanonizeProvider::canonize(), nfd::face::EthernetChannel::EthernetChannel(), nfd::face::MulticastEthernetTransport::MulticastEthernetTransport(), and nfd::face::UnicastEthernetTransport::UnicastEthernetTransport().
|
static |
create udp4 or udp6 NIC-associated FaceUri from endpoint and network device name
Definition at line 179 of file face-uri.cpp.
References ndn::to_string().
|
inline |
get scheme (protocol)
Definition at line 109 of file face-uri.hpp.
Referenced by canonize(), nfd::face::ProtocolFactory::createFace(), nfd::FaceManager::FaceManager(), isCanonical(), and nfd::face::NetdevBound::processConfig().
|
inline |
get host (domain)
Definition at line 116 of file face-uri.hpp.
Referenced by ndn::EtherCanonizeProvider::canonize(), ndn::DevCanonizeProvider::canonize(), nfd::face::EthernetFactory::EthernetFactory(), nfd::face::TcpFactory::getId(), ndn::EtherCanonizeProvider::isCanonical(), ndn::DevCanonizeProvider::isCanonical(), and nfd::face::UdpFactory::UdpFactory().
|
inline |
get port
Definition at line 123 of file face-uri.hpp.
Referenced by ndn::DevCanonizeProvider::canonize(), nfd::face::TcpFactory::getId(), ndn::EtherCanonizeProvider::isCanonical(), ndn::DevCanonizeProvider::isCanonical(), ndn::UdpDevCanonizeProvider::isCanonical(), and nfd::face::UdpFactory::UdpFactory().
|
inline |
get path
Definition at line 130 of file face-uri.hpp.
References canCanonize(), isCanonical(), and toString().
Referenced by ndn::DevCanonizeProvider::canonize(), ndn::EtherCanonizeProvider::isCanonical(), ndn::DevCanonizeProvider::isCanonical(), and ndn::UdpDevCanonizeProvider::isCanonical().
std::string ndn::FaceUri::toString | ( | ) | const |
write as a string
Definition at line 189 of file face-uri.cpp.
Referenced by ndn::UdpDevCanonizeProvider::canonize(), nfd::FaceManager::FaceManager(), getPath(), and nfd::face::NetdevBound::processConfig().
|
static |
Definition at line 615 of file face-uri.cpp.
References ndn::getCanonizeProvider().
Referenced by nfd::face::ProtocolFactory::createFace(), and getPath().
bool ndn::FaceUri::isCanonical | ( | ) | const |
determine whether this FaceUri is in canonical form
Definition at line 621 of file face-uri.cpp.
References ndn::getCanonizeProvider(), getScheme(), and ndn::CanonizeProvider::isCanonical().
Referenced by ndn::DevCanonizeProvider::canonize(), ndn::UdpDevCanonizeProvider::canonize(), nfd::face::ProtocolFactory::createFace(), nfd::face::ProtocolFactory::createNetdevBoundFace(), nfd::FaceManager::FaceManager(), and getPath().
void ndn::FaceUri::canonize | ( | const CanonizeSuccessCallback & | onSuccess, |
const CanonizeFailureCallback & | onFailure, | ||
time::nanoseconds | timeout | ||
) | const |
asynchronously convert this FaceUri to canonical form
onSuccess | function to call after this FaceUri is converted to canonical form |
onFailure | function to call if this FaceUri cannot be converted to canonical form |
timeout | maximum allowable duration of the operations. It's intentional not to provide a default value: the caller should set a reasonable value in balance between network delay and user experience. |
Definition at line 632 of file face-uri.cpp.
References ndn::CanonizeProvider::canonize(), ndn::getCanonizeProvider(), getScheme(), and websocketpp::transport::error::timeout.
Definition at line 174 of file face-uri.hpp.
Definition at line 180 of file face-uri.hpp.
|
friend |
Definition at line 197 of file face-uri.cpp.