NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
route.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #include "route.hpp"
27 #include <ndn-cxx/util/string-helper.hpp>
28 
29 namespace nfd {
30 namespace rib {
31 
33  : faceId(0)
34  , origin(ndn::nfd::ROUTE_ORIGIN_APP)
35  , cost(0)
36  , flags(ndn::nfd::ROUTE_FLAGS_NONE)
37 {
38 }
39 
40 bool
41 operator==(const Route& lhs, const Route& rhs)
42 {
43  return lhs.faceId == rhs.faceId &&
44  lhs.origin == rhs.origin &&
45  lhs.flags == rhs.flags &&
46  lhs.cost == rhs.cost &&
47  lhs.expires == rhs.expires;
48 }
49 
50 std::ostream&
51 operator<<(std::ostream& os, const Route& route)
52 {
53  os << "Route("
54  << "faceid: " << route.faceId
55  << ", origin: " << route.origin
56  << ", cost: " << route.cost
57  << ", flags: " << ndn::AsHex{route.flags};
58  if (route.expires) {
59  os << ", expires in: " << time::duration_cast<time::milliseconds>(*route.expires - time::steady_clock::now());
60  }
61  else {
62  os << ", never expires";
63  }
64  os << ")";
65 
66  return os;
67 }
68 
69 } // namespace rib
70 } // namespace nfd
Copyright (c) 2011-2015 Regents of the University of California.
bool operator==(const Route &lhs, const Route &rhs)
Definition: route.cpp:41
static time_point now() noexcept
Definition: time.cpp:80
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
Definition: fib-update.hpp:74
boost::posix_time::time_duration milliseconds(long duration)
Definition: asio.hpp:117
std::underlying_type< ndn::nfd::RouteFlags >::type flags
Definition: route.hpp:66
Helper class to convert a number to hexadecimal format, for use with stream insertion operators...
uint64_t cost
Definition: route.hpp:65
uint64_t faceId
Definition: route.hpp:63
ndn::optional< time::steady_clock::TimePoint > expires
Definition: route.hpp:67
ndn::nfd::RouteOrigin origin
Definition: route.hpp:64
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
represents a route for a name prefix
Definition: route.hpp:39