28 #include <ndn-cxx/util/string-helper.hpp>
36 static time::steady_clock::time_point
39 auto validityEnd = time::steady_clock::duration::max();
40 if (ann.getValidityPeriod()) {
41 auto now = time::system_clock::now();
42 if (!ann.getValidityPeriod()->isValid(now)) {
43 validityEnd = time::steady_clock::duration::zero();
46 validityEnd = ann.getValidityPeriod()->getPeriod().second - now;
49 return time::steady_clock::now() +
50 std::min(validityEnd, time::duration_cast<time::steady_clock::duration>(ann.getExpiration()));
55 , origin(
ndn::
nfd::ROUTE_ORIGIN_PREFIXANN)
57 , flags(
ndn::
nfd::ROUTE_FLAG_CHILD_INHERIT)
60 , annExpires(*expires)
68 <<
"faceid: " << route.
faceId
69 <<
", origin: " << route.
origin
70 <<
", cost: " << route.
cost
71 <<
", flags: " << ndn::AsHex{route.
flags};
74 os <<
", expires in: " << time::duration_cast<time::milliseconds>(*route.
expires - time::steady_clock::now());
77 os <<
", never expires";
Represents a route for a name prefix.
ndn::nfd::RouteOrigin origin
Route()
Default constructor.
std::underlying_type_t< ndn::nfd::RouteFlags > flags
std::optional< time::steady_clock::time_point > expires
std::optional< ndn::PrefixAnnouncement > announcement
The prefix announcement that caused the creation of this route.
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
constexpr uint64_t PA_ROUTE_COST
static time::steady_clock::time_point computeExpiration(const ndn::PrefixAnnouncement &ann)