27 #include <ndn-cxx/util/string-helper.hpp> 34 static time::steady_clock::TimePoint
37 time::steady_clock::Duration validityEnd = time::steady_clock::Duration::max();
38 if (ann.getValidityPeriod()) {
39 auto now = time::system_clock::now();
40 if (!ann.getValidityPeriod()->isValid(now)) {
41 validityEnd = time::steady_clock::Duration::zero();
44 validityEnd = ann.getValidityPeriod()->getPeriod().second - now;
47 return time::steady_clock::now() +
48 std::min(validityEnd, time::duration_cast<time::steady_clock::Duration>(ann.getExpiration()));
53 , origin(
ndn::
nfd::ROUTE_ORIGIN_PREFIXANN)
55 , flags(
ndn::
nfd::ROUTE_FLAG_CHILD_INHERIT)
58 , annExpires(*expires)
77 <<
"faceid: " << route.
faceId 78 <<
", origin: " << route.
origin 79 <<
", cost: " << route.
cost 80 <<
", flags: " << ndn::AsHex{route.
flags};
82 os <<
", expires in: " << time::duration_cast<time::milliseconds>(*route.
expires - time::steady_clock::now());
85 os <<
", never expires";
Copyright (c) 2014-2017, Regents of the University of California, Arizona Board of Regents...
bool operator==(const Route &lhs, const Route &rhs)
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
optional< ndn::PrefixAnnouncement > announcement
The prefix announcement that caused the creation of this route.
optional< time::steady_clock::TimePoint > expires
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
ndn::nfd::RouteOrigin origin
represents a route for a name prefix
Route()=default
default constructor
const uint64_t PA_ROUTE_COST
cost of route created by prefix announcement
static time::steady_clock::TimePoint computeExpiration(const ndn::PrefixAnnouncement &ann)
std::underlying_type_t< ndn::nfd::RouteFlags > flags