NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
face-uri.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2021 Regents of the University of California,
4  * Arizona Board of Regents,
5  * Colorado State University,
6  * University Pierre & Marie Curie, Sorbonne University,
7  * Washington University in St. Louis,
8  * Beijing Institute of Technology,
9  * The University of Memphis.
10  *
11  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
12  *
13  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
14  * terms of the GNU Lesser General Public License as published by the Free Software
15  * Foundation, either version 3 of the License, or (at your option) any later version.
16  *
17  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
18  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
20  *
21  * You should have received copies of the GNU General Public License and GNU Lesser
22  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
23  * <http://www.gnu.org/licenses/>.
24  *
25  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
26  */
27 
28 #include "ndn-cxx/net/face-uri.hpp"
29 // #include "ndn-cxx/net/dns.hpp"
31 
32 #include <boost/algorithm/string/classification.hpp>
33 #include <boost/algorithm/string/split.hpp>
34 #include <boost/lexical_cast.hpp>
35 #include <boost/mpl/for_each.hpp>
36 #include <boost/mpl/vector.hpp>
37 
38 #include <regex>
39 #include <set>
40 #include <sstream>
41 
42 namespace ndn {
43 
44 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
45 
47  : m_isV6(false)
48 {
49 }
50 
51 FaceUri::FaceUri(const std::string& uri)
52 {
53  if (!parse(uri)) {
54  NDN_THROW(Error("Malformed URI: " + uri));
55  }
56 }
57 
58 FaceUri::FaceUri(const char* uri)
59  : FaceUri(std::string(uri))
60 {
61 }
62 
63 bool
64 FaceUri::parse(const std::string& uri)
65 {
66  m_scheme.clear();
67  m_host.clear();
68  m_port.clear();
69  m_path.clear();
70  m_isV6 = false;
71 
72  static const std::regex protocolExp("(\\w+\\d?(\\+\\w+)?)://([^/]*)(\\/[^?]*)?");
73  std::smatch protocolMatch;
74  if (!std::regex_match(uri, protocolMatch, protocolExp)) {
75  return false;
76  }
77  m_scheme = protocolMatch[1];
78  std::string authority = protocolMatch[3];
79  m_path = protocolMatch[4];
80 
81  // pattern for IPv6 link local address enclosed in [ ], with optional port number
82  static const std::regex v6LinkLocalExp("^\\[([a-fA-F0-9:]+)%([^\\s/:]+)\\](?:\\:(\\d+))?$");
83  // pattern for IPv6 address enclosed in [ ], with optional port number
84  static const std::regex v6Exp("^\\[([a-fA-F0-9:]+)\\](?:\\:(\\d+))?$");
85  // pattern for Ethernet address in standard hex-digits-and-colons notation
86  static const std::regex etherExp("^\\[((?:[a-fA-F0-9]{1,2}\\:){5}(?:[a-fA-F0-9]{1,2}))\\]$");
87  // pattern for IPv4-mapped IPv6 address, with optional port number
88  static const std::regex v4MappedV6Exp("^\\[::ffff:(\\d+(?:\\.\\d+){3})\\](?:\\:(\\d+))?$");
89  // pattern for IPv4/hostname/fd/ifname, with optional port number
90  static const std::regex v4HostExp("^([^:]+)(?:\\:(\\d+))?$");
91 
92  if (authority.empty()) {
93  // UNIX, internal
94  }
95  else {
96  std::smatch match;
97  if (std::regex_match(authority, match, v6LinkLocalExp)) {
98  m_isV6 = true;
99  m_host = match[1].str() + "%" + match[2].str();
100  m_port = match[3];
101  return true;
102  }
103 
104  m_isV6 = std::regex_match(authority, match, v6Exp);
105  if (m_isV6 ||
106  std::regex_match(authority, match, etherExp) ||
107  std::regex_match(authority, match, v4MappedV6Exp) ||
108  std::regex_match(authority, match, v4HostExp)) {
109  m_host = match[1];
110  m_port = match[2];
111  }
112  else {
113  return false;
114  }
115  }
116 
117  return true;
118 }
119 
120 FaceUri::FaceUri(const boost::asio::ip::udp::endpoint& endpoint)
121 {
122  m_isV6 = endpoint.address().is_v6();
123  m_scheme = m_isV6 ? "udp6" : "udp4";
124  m_host = endpoint.address().to_string();
125  m_port = to_string(endpoint.port());
126 }
127 
128 FaceUri::FaceUri(const boost::asio::ip::tcp::endpoint& endpoint)
129 {
130  m_isV6 = endpoint.address().is_v6();
131  m_scheme = m_isV6 ? "tcp6" : "tcp4";
132  m_host = endpoint.address().to_string();
133  m_port = to_string(endpoint.port());
134 }
135 
136 FaceUri::FaceUri(const boost::asio::ip::tcp::endpoint& endpoint, const std::string& scheme)
137 {
138  m_isV6 = endpoint.address().is_v6();
139  m_scheme = scheme;
140  m_host = endpoint.address().to_string();
141  m_port = to_string(endpoint.port());
142 }
143 
144 #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
145 FaceUri::FaceUri(const boost::asio::local::stream_protocol::endpoint& endpoint)
146  : m_scheme("unix")
147  , m_path(endpoint.path())
148  , m_isV6(false)
149 {
150 }
151 #endif // BOOST_ASIO_HAS_LOCAL_SOCKETS
152 
153 FaceUri
155 {
156  FaceUri uri;
157  uri.m_scheme = "fd";
158  uri.m_host = to_string(fd);
159  return uri;
160 }
161 
163  : m_scheme("ether")
164  , m_host(address.toString())
165  , m_isV6(true)
166 {
167 }
168 
169 FaceUri
170 FaceUri::fromDev(const std::string& ifname)
171 {
172  FaceUri uri;
173  uri.m_scheme = "dev";
174  uri.m_host = ifname;
175  return uri;
176 }
177 
178 FaceUri
179 FaceUri::fromUdpDev(const boost::asio::ip::udp::endpoint& endpoint, const std::string& ifname)
180 {
181  FaceUri uri;
182  uri.m_scheme = endpoint.address().is_v6() ? "udp6+dev" : "udp4+dev";
183  uri.m_host = ifname;
184  uri.m_port = to_string(endpoint.port());
185  return uri;
186 }
187 
188 std::string
190 {
191  std::ostringstream os;
192  os << *this;
193  return os.str();
194 }
195 
196 std::ostream&
197 operator<<(std::ostream& os, const FaceUri& uri)
198 {
199  os << uri.m_scheme << "://";
200  if (uri.m_isV6) {
201  os << "[" << uri.m_host << "]";
202  }
203  else {
204  os << uri.m_host;
205  }
206  if (!uri.m_port.empty()) {
207  os << ":" << uri.m_port;
208  }
209  os << uri.m_path;
210  return os;
211 }
212 
213 
216 class CanonizeProvider : noncopyable
217 {
218 public:
219  virtual
220  ~CanonizeProvider() = default;
221 
222  virtual std::set<std::string>
223  getSchemes() const = 0;
224 
225  virtual bool
226  isCanonical(const FaceUri& faceUri) const = 0;
227 
228  virtual void
229  canonize(const FaceUri& faceUri,
230  const FaceUri::CanonizeSuccessCallback& onSuccess,
231  const FaceUri::CanonizeFailureCallback& onFailure,
232  time::nanoseconds timeout) const = 0;
233 };
234 
235 template<typename Protocol>
237 {
238 public:
239  std::set<std::string>
240  getSchemes() const override
241  {
242  return {m_baseScheme, m_v4Scheme, m_v6Scheme};
243  }
244 
245  bool
246  isCanonical(const FaceUri& faceUri) const override
247  {
248  BOOST_THROW_EXCEPTION(std::runtime_error("IP host canonization not supported"));
249  // if (faceUri.getPort().empty()) {
250  // return false;
251  // }
252  // if (!faceUri.getPath().empty()) {
253  // return false;
254  // }
255 
256  // boost::system::error_code ec;
257  // auto addr = ip::addressFromString(unescapeHost(faceUri.getHost()), ec);
258  // if (ec) {
259  // return false;
260  // }
261 
262  // bool hasCorrectScheme = (faceUri.getScheme() == m_v4Scheme && addr.is_v4()) ||
263  // (faceUri.getScheme() == m_v6Scheme && addr.is_v6());
264  // if (!hasCorrectScheme) {
265  // return false;
266  // }
267 
268  // auto checkAddressWithUri = [] (const boost::asio::ip::address& addr,
269  // const FaceUri& faceUri) -> bool {
270  // if (addr.is_v4() || !addr.to_v6().is_link_local()) {
271  // return addr.to_string() == faceUri.getHost();
272  // }
273 
274  // std::vector<std::string> addrFields, faceUriFields;
275  // std::string addrString = addr.to_string();
276  // std::string faceUriString = faceUri.getHost();
277 
278  // boost::algorithm::split(addrFields, addrString, boost::is_any_of("%"));
279  // boost::algorithm::split(faceUriFields, faceUriString, boost::is_any_of("%"));
280  // if (addrFields.size() != 2 || faceUriFields.size() != 2) {
281  // return false;
282  // }
283 
284  // if (faceUriFields[1].size() > 2 && faceUriFields[1].compare(0, 2, "25") == 0) {
285  // // %25... is accepted, but not a canonical form
286  // return false;
287  // }
288 
289  // return addrFields[0] == faceUriFields[0] &&
290  // addrFields[1] == faceUriFields[1];
291  // };
292 
293  // return checkAddressWithUri(addr, faceUri) && checkAddress(addr).first;
294  }
295 
296  void
297  canonize(const FaceUri& faceUri,
298  const FaceUri::CanonizeSuccessCallback& onSuccess,
299  const FaceUri::CanonizeFailureCallback& onFailure,
300  time::nanoseconds timeout) const override
301  {
302  BOOST_THROW_EXCEPTION(std::runtime_error("IP host canonization not supported"));
303  // if (this->isCanonical(faceUri)) {
304  // onSuccess(faceUri);
305  // return;
306  // }
307 
308  // // make a copy because caller may modify faceUri
309  // auto uri = make_shared<FaceUri>(faceUri);
310  // boost::system::error_code ec;
311  // auto ipAddress = ip::addressFromString(unescapeHost(faceUri.getHost()), ec);
312  // if (!ec) {
313  // // No need to resolve IP address if host is already an IP
314  // if ((faceUri.getScheme() == m_v4Scheme && !ipAddress.is_v4()) ||
315  // (faceUri.getScheme() == m_v6Scheme && !ipAddress.is_v6())) {
316  // return onFailure("IPv4/v6 mismatch");
317  // }
318 
319  // onDnsSuccess(uri, onSuccess, onFailure, ipAddress);
320  // }
321  // else {
322  // dns::AddressSelector addressSelector;
323  // if (faceUri.getScheme() == m_v4Scheme) {
324  // addressSelector = dns::Ipv4Only();
325  // }
326  // else if (faceUri.getScheme() == m_v6Scheme) {
327  // addressSelector = dns::Ipv6Only();
328  // }
329  // else {
330  // BOOST_ASSERT(faceUri.getScheme() == m_baseScheme);
331  // addressSelector = dns::AnyAddress();
332  // }
333 
334  // dns::asyncResolve(unescapeHost(faceUri.getHost()),
335  // bind(&IpHostCanonizeProvider<Protocol>::onDnsSuccess, this, uri, onSuccess, onFailure, _1),
336  // bind(&IpHostCanonizeProvider<Protocol>::onDnsFailure, this, uri, onFailure, _1),
337  // io, addressSelector, timeout);
338  // }
339  }
340 
341 protected:
342  explicit
343  IpHostCanonizeProvider(const std::string& baseScheme,
344  uint16_t defaultUnicastPort = 6363,
345  uint16_t defaultMulticastPort = 56363)
346  : m_baseScheme(baseScheme)
347  , m_v4Scheme(baseScheme + '4')
348  , m_v6Scheme(baseScheme + '6')
349  , m_defaultUnicastPort(defaultUnicastPort)
350  , m_defaultMulticastPort(defaultMulticastPort)
351  {
352  }
353 
354 private:
355  // void
356  // onDnsSuccess(const shared_ptr<FaceUri>& faceUri,
357  // const FaceUri::CanonizeSuccessCallback& onSuccess,
358  // const FaceUri::CanonizeFailureCallback& onFailure,
359  // const dns::IpAddress& ipAddress) const
360  // {
361  // bool isOk = false;
362  // std::string reason;
363  // std::tie(isOk, reason) = this->checkAddress(ipAddress);
364  // if (!isOk) {
365  // return onFailure(reason);
366  // }
367 
368  // uint16_t port = 0;
369  // if (faceUri->getPort().empty()) {
370  // port = ipAddress.is_multicast() ? m_defaultMulticastPort : m_defaultUnicastPort;
371  // }
372  // else {
373  // try {
374  // port = boost::lexical_cast<uint16_t>(faceUri->getPort());
375  // }
376  // catch (const boost::bad_lexical_cast&) {
377  // return onFailure("invalid port number '" + faceUri->getPort() + "'");
378  // }
379  // }
380 
381  // FaceUri canonicalUri(typename Protocol::endpoint(ipAddress, port));
382  // BOOST_ASSERT(canonicalUri.isCanonical());
383  // onSuccess(canonicalUri);
384  // }
385 
386  // void
387  // onDnsFailure(const shared_ptr<FaceUri>& faceUri,
388  // const FaceUri::CanonizeFailureCallback& onFailure,
389  // const std::string& reason) const
390  // {
391  // onFailure(reason);
392  // }
393 
398  // virtual std::pair<bool, std::string>
399  // checkAddress(const dns::IpAddress& ipAddress) const
400  // {
401  // return {true, ""};
402  // }
403 
404  static std::string
405  unescapeHost(std::string host)
406  {
407  auto escapePos = host.find("%25");
408  if (escapePos != std::string::npos && escapePos < host.size() - 3) {
409  host = unescape(host);
410  }
411  return host;
412  }
413 
414 private:
415  std::string m_baseScheme;
416  std::string m_v4Scheme;
417  std::string m_v6Scheme;
418  uint16_t m_defaultUnicastPort;
419  uint16_t m_defaultMulticastPort;
420 };
421 
422 class UdpCanonizeProvider : public IpHostCanonizeProvider<boost::asio::ip::udp>
423 {
424 public:
426  : IpHostCanonizeProvider("udp")
427  {
428  }
429 };
430 
431 class TcpCanonizeProvider : public IpHostCanonizeProvider<boost::asio::ip::tcp>
432 {
433 public:
435  : IpHostCanonizeProvider("tcp")
436  {
437  }
438 
439 protected:
440  // std::pair<bool, std::string>
441  // checkAddress(const dns::IpAddress& ipAddress) const override
442  // {
443  // if (ipAddress.is_multicast()) {
444  // return {false, "cannot use multicast address"};
445  // }
446  // return {true, ""};
447  // }
448 };
449 
451 {
452 public:
453  std::set<std::string>
454  getSchemes() const override
455  {
456  return {"ether"};
457  }
458 
459  bool
460  isCanonical(const FaceUri& faceUri) const override
461  {
462  if (!faceUri.getPort().empty()) {
463  return false;
464  }
465  if (!faceUri.getPath().empty()) {
466  return false;
467  }
468 
469  auto addr = ethernet::Address::fromString(faceUri.getHost());
470  return addr.toString() == faceUri.getHost();
471  }
472 
473  void
474  canonize(const FaceUri& faceUri,
475  const FaceUri::CanonizeSuccessCallback& onSuccess,
476  const FaceUri::CanonizeFailureCallback& onFailure,
477  time::nanoseconds timeout) const override
478  {
479  auto addr = ethernet::Address::fromString(faceUri.getHost());
480  if (addr.isNull()) {
481  return onFailure("invalid ethernet address '" + faceUri.getHost() + "'");
482  }
483 
484  FaceUri canonicalUri(addr);
485  BOOST_ASSERT(canonicalUri.isCanonical());
486  onSuccess(canonicalUri);
487  }
488 };
489 
491 {
492 public:
493  std::set<std::string>
494  getSchemes() const override
495  {
496  return {"dev"};
497  }
498 
499  bool
500  isCanonical(const FaceUri& faceUri) const override
501  {
502  return !faceUri.getHost().empty() && faceUri.getPort().empty() && faceUri.getPath().empty();
503  }
504 
505  void
506  canonize(const FaceUri& faceUri,
507  const FaceUri::CanonizeSuccessCallback& onSuccess,
508  const FaceUri::CanonizeFailureCallback& onFailure,
509  time::nanoseconds timeout) const override
510  {
511  if (faceUri.getHost().empty()) {
512  onFailure("network interface name is missing");
513  return;
514  }
515  if (!faceUri.getPort().empty()) {
516  onFailure("port number is not allowed");
517  return;
518  }
519  if (!faceUri.getPath().empty() && faceUri.getPath() != "/") { // permit trailing slash only
520  onFailure("path is not allowed");
521  return;
522  }
523 
524  FaceUri canonicalUri = FaceUri::fromDev(faceUri.getHost());
525  BOOST_ASSERT(canonicalUri.isCanonical());
526  onSuccess(canonicalUri);
527  }
528 };
529 
531 {
532 public:
533  std::set<std::string>
534  getSchemes() const override
535  {
536  return {"udp4+dev", "udp6+dev"};
537  }
538 
539  bool
540  isCanonical(const FaceUri& faceUri) const override
541  {
542  if (faceUri.getPort().empty()) {
543  return false;
544  }
545  if (!faceUri.getPath().empty()) {
546  return false;
547  }
548  return true;
549  }
550 
551  void
552  canonize(const FaceUri& faceUri,
553  const FaceUri::CanonizeSuccessCallback& onSuccess,
554  const FaceUri::CanonizeFailureCallback& onFailure,
555  time::nanoseconds timeout) const override
556  {
557  if (this->isCanonical(faceUri)) {
558  onSuccess(faceUri);
559  }
560  else {
561  onFailure("cannot canonize " + faceUri.toString());
562  }
563  }
564 };
565 
566 using CanonizeProviders = boost::mpl::vector<UdpCanonizeProvider*,
571 using CanonizeProviderTable = std::map<std::string, shared_ptr<CanonizeProvider>>;
572 
574 {
575 public:
576  explicit
578  : m_providerTable(providerTable)
579  {
580  }
581 
582  template<typename CP>
583  void
585  {
586  shared_ptr<CanonizeProvider> cp = make_shared<CP>();
587  auto schemes = cp->getSchemes();
588  BOOST_ASSERT(!schemes.empty());
589 
590  for (const auto& scheme : schemes) {
591  BOOST_ASSERT(m_providerTable.count(scheme) == 0);
592  m_providerTable[scheme] = cp;
593  }
594  }
595 
596 private:
597  CanonizeProviderTable& m_providerTable;
598 };
599 
600 static const CanonizeProvider*
601 getCanonizeProvider(const std::string& scheme)
602 {
603  static CanonizeProviderTable providerTable;
604  if (providerTable.empty()) {
605  boost::mpl::for_each<CanonizeProviders>(CanonizeProviderTableInitializer(providerTable));
606  BOOST_ASSERT(!providerTable.empty());
607  }
608 
609  auto it = providerTable.find(scheme);
610  return it == providerTable.end() ? nullptr : it->second.get();
611 }
612 
613 
614 bool
615 FaceUri::canCanonize(const std::string& scheme)
616 {
617  return getCanonizeProvider(scheme) != nullptr;
618 }
619 
620 bool
622 {
623  const CanonizeProvider* cp = getCanonizeProvider(this->getScheme());
624  if (cp == nullptr) {
625  return false;
626  }
627 
628  return cp->isCanonical(*this);
629 }
630 
631 void
633  const CanonizeFailureCallback& onFailure,
635 {
636  const CanonizeProvider* cp = getCanonizeProvider(this->getScheme());
637  if (cp == nullptr) {
638  if (onFailure) {
639  onFailure("scheme not supported");
640  }
641  return;
642  }
643 
644  cp->canonize(*this,
645  onSuccess ? onSuccess : [] (auto&&) {},
646  onFailure ? onFailure : [] (auto&&) {},
647  timeout);
648 }
649 
650 } // namespace ndn
IpHostCanonizeProvider(const std::string &baseScheme, uint16_t defaultUnicastPort=6363, uint16_t defaultMulticastPort=56363)
Definition: face-uri.cpp:343
std::set< std::string > getSchemes() const override
Definition: face-uri.cpp:494
static Address fromString(const std::string &str)
Creates an Address from a string containing an Ethernet address in hexadecimal notation, with colons or hyphens as separators.
Definition: ethernet.cpp:90
Copyright (c) 2011-2015 Regents of the University of California.
function< void(const std::string &reason)> CanonizeFailureCallback
Definition: face-uri.hpp:154
static FaceUri fromFd(int fd)
create fd FaceUri from file descriptor
Definition: face-uri.cpp:154
bool isCanonical(const FaceUri &faceUri) const override
Definition: face-uri.cpp:540
const std::string & getHost() const
get host (domain)
Definition: face-uri.hpp:116
bool isCanonical(const FaceUri &faceUri) const override
Definition: face-uri.cpp:460
std::string to_string(const T &val)
Definition: backports.hpp:86
void canonize(const FaceUri &faceUri, const FaceUri::CanonizeSuccessCallback &onSuccess, const FaceUri::CanonizeFailureCallback &onFailure, time::nanoseconds timeout) const override
Definition: face-uri.cpp:474
function< void(const FaceUri &)> CanonizeSuccessCallback
Definition: face-uri.hpp:153
static bool canCanonize(const std::string &scheme)
Definition: face-uri.cpp:615
std::string toString() const
write as a string
Definition: face-uri.cpp:189
virtual bool isCanonical(const FaceUri &faceUri) const =0
bool isCanonical(const FaceUri &faceUri) const override
Definition: face-uri.cpp:246
static const CanonizeProvider * getCanonizeProvider(const std::string &scheme)
Definition: face-uri.cpp:601
void canonize(const CanonizeSuccessCallback &onSuccess, const CanonizeFailureCallback &onFailure, time::nanoseconds timeout) const
asynchronously convert this FaceUri to canonical form
Definition: face-uri.cpp:632
const std::string & getPort() const
get port
Definition: face-uri.hpp:123
STL namespace.
void canonize(const FaceUri &faceUri, const FaceUri::CanonizeSuccessCallback &onSuccess, const FaceUri::CanonizeFailureCallback &onFailure, time::nanoseconds timeout) const override
Definition: face-uri.cpp:552
std::string toString(char sep=':') const
Converts the address to a human-readable string.
Definition: ethernet.cpp:78
void canonize(const FaceUri &faceUri, const FaceUri::CanonizeSuccessCallback &onSuccess, const FaceUri::CanonizeFailureCallback &onFailure, time::nanoseconds timeout) const override
Definition: face-uri.cpp:506
bool isCanonical(const FaceUri &faceUri) const override
Definition: face-uri.cpp:500
std::set< std::string > getSchemes() const override
Definition: face-uri.cpp:534
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
Definition: face-uri.cpp:179
#define NDN_THROW(e)
Definition: exception.hpp:61
a CanonizeProvider provides FaceUri canonization functionality for a group of schemes ...
Definition: face-uri.cpp:216
NDN_CXX_NODISCARD bool parse(const std::string &uri)
exception-safe parsing
Definition: face-uri.cpp:64
std::set< std::string > getSchemes() const override
Definition: face-uri.cpp:454
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
void canonize(const FaceUri &faceUri, const FaceUri::CanonizeSuccessCallback &onSuccess, const FaceUri::CanonizeFailureCallback &onFailure, time::nanoseconds timeout) const override
Definition: face-uri.cpp:297
represents an Ethernet hardware address
Definition: ethernet.hpp:52
const std::string & getScheme() const
get scheme (protocol)
Definition: face-uri.hpp:109
virtual void canonize(const FaceUri &faceUri, const FaceUri::CanonizeSuccessCallback &onSuccess, const FaceUri::CanonizeFailureCallback &onFailure, time::nanoseconds timeout) const =0
CanonizeProviderTableInitializer(CanonizeProviderTable &providerTable)
Definition: face-uri.cpp:577
std::set< std::string > getSchemes() const override
Definition: face-uri.cpp:240
bool isCanonical() const
determine whether this FaceUri is in canonical form
Definition: face-uri.cpp:621
std::map< std::string, shared_ptr< CanonizeProvider > > CanonizeProviderTable
Definition: face-uri.cpp:571
const std::string & getPath() const
get path
Definition: face-uri.hpp:130
boost::mpl::vector< UdpCanonizeProvider *, TcpCanonizeProvider *, EtherCanonizeProvider *, DevCanonizeProvider *, UdpDevCanonizeProvider * > CanonizeProviders
Definition: face-uri.cpp:570
static FaceUri fromDev(const std::string &ifname)
create dev FaceUri from network device name
Definition: face-uri.cpp:170
boost::chrono::nanoseconds nanoseconds
Definition: time.hpp:50
std::string unescape(const std::string &str)
Decode a percent-encoded string.
friend std::ostream & operator<<(std::ostream &os, const FaceUri &uri)
Definition: face-uri.cpp:197