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) | |
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 customized 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 | operator== (const FaceUri &rhs) const |
bool | operator!= (const FaceUri &rhs) const |
bool | isCanonical () const |
determine whether this FaceUri is in canonical form More... | |
void | canonize (const CanonizeSuccessCallback &onSuccess, const CanonizeFailureCallback &onFailure, boost::asio::io_service &io, const 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 bool | canCanonize (const std::string &scheme) |
Friends | |
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::util::FaceUri::CanonizeSuccessCallback |
Definition at line 160 of file face-uri.hpp.
typedef function<void(const std::string& reason)> ndn::util::FaceUri::CanonizeFailureCallback |
Definition at line 161 of file face-uri.hpp.
ndn::util::FaceUri::FaceUri | ( | ) |
Definition at line 43 of file face-uri.cpp.
Referenced by ndn::util::FaceUri::Error::Error(), and FaceUri().
|
explicit |
construct by parsing
uri | scheme://host[:port]/path |
FaceUri::Error | if URI cannot be parsed |
Definition at line 48 of file face-uri.cpp.
References parse().
|
explicit |
Definition at line 55 of file face-uri.cpp.
References parse().
|
explicit |
construct udp4 or udp6 canonical FaceUri
Definition at line 110 of file face-uri.cpp.
|
explicit |
construct tcp4 or tcp6 canonical FaceUri
Definition at line 118 of file face-uri.cpp.
ndn::util::FaceUri::FaceUri | ( | const boost::asio::ip::tcp::endpoint & | endpoint, |
const std::string & | scheme | ||
) |
construct tcp canonical FaceUri with customized scheme
Definition at line 126 of file face-uri.cpp.
References FaceUri().
|
explicit |
construct ether canonical FaceUri
Definition at line 152 of file face-uri.cpp.
References ndn::util::ethernet::Address::toString().
bool ndn::util::FaceUri::parse | ( | const std::string & | uri | ) |
exception-safe parsing
Definition at line 63 of file face-uri.cpp.
Referenced by ndn::util::FaceUri::Error::Error(), FaceUri(), and nfd::FaceManager::setConfigFile().
|
static |
create fd FaceUri from file descriptor
Definition at line 144 of file face-uri.cpp.
Referenced by ndn::util::FaceUri::Error::Error().
|
static |
create dev FaceUri from network device name
Definition at line 160 of file face-uri.cpp.
Referenced by ndn::util::FaceUri::Error::Error().
|
inline |
get scheme (protocol)
Definition at line 109 of file face-uri.hpp.
Referenced by canonize(), ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::canonize(), ndn::TcpTransport::getDefaultSocketHostAndPort(), isCanonical(), ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::isCanonical(), nfd::FaceManager::setConfigFile(), and ndn::UnixTransport::~UnixTransport().
|
inline |
get host (domain)
Definition at line 116 of file face-uri.hpp.
Referenced by ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::canonize(), ndn::util::EtherCanonizeProvider::canonize(), nfd::TcpFactory::createFace(), nfd::UdpFactory::createFace(), ndn::TcpTransport::getDefaultSocketHostAndPort(), ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::isCanonical(), and ndn::util::EtherCanonizeProvider::isCanonical().
|
inline |
get port
Definition at line 123 of file face-uri.hpp.
Referenced by nfd::TcpFactory::createFace(), nfd::UdpFactory::createFace(), ndn::TcpTransport::getDefaultSocketHostAndPort(), ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::isCanonical(), and ndn::util::EtherCanonizeProvider::isCanonical().
|
inline |
get path
Definition at line 130 of file face-uri.hpp.
References canCanonize(), isCanonical(), operator!=(), operator==(), and toString().
Referenced by ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::isCanonical(), ndn::util::EtherCanonizeProvider::isCanonical(), and ndn::UnixTransport::~UnixTransport().
std::string ndn::util::FaceUri::toString | ( | ) | const |
bool ndn::util::FaceUri::operator== | ( | const FaceUri & | rhs | ) | const |
Definition at line 169 of file face-uri.cpp.
Referenced by getPath().
bool ndn::util::FaceUri::operator!= | ( | const FaceUri & | rhs | ) | const |
Definition at line 179 of file face-uri.cpp.
Referenced by getPath().
|
static |
Definition at line 501 of file face-uri.cpp.
References ndn::util::getCanonizeProvider().
Referenced by getPath().
bool ndn::util::FaceUri::isCanonical | ( | ) | const |
determine whether this FaceUri is in canonical form
Definition at line 507 of file face-uri.cpp.
References ndn::util::getCanonizeProvider(), getScheme(), and ndn::util::CanonizeProvider::isCanonical().
Referenced by ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::canonize(), ndn::util::EtherCanonizeProvider::canonize(), nfd::TcpFactory::createFace(), nfd::UdpFactory::createFace(), getPath(), ndn::util::IpHostCanonizeProvider< boost::asio::ip::udp >::IpHostCanonizeProvider(), nfd::FaceManager::setConfigFile(), and ndn::util::CanonizeProvider::~CanonizeProvider().
void ndn::util::FaceUri::canonize | ( | const CanonizeSuccessCallback & | onSuccess, |
const CanonizeFailureCallback & | onFailure, | ||
boost::asio::io_service & | io, | ||
const 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 |
io | reference to boost::asio::io_service instance |
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 523 of file face-uri.cpp.
References ndn::util::CanonizeProvider::canonize(), ndn::util::getCanonizeProvider(), getScheme(), and ndn::util::nop().
Referenced by ndn::util::CanonizeProvider::~CanonizeProvider().
|
friend |
Definition at line 193 of file face-uri.cpp.