NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
route.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_RIB_ROUTE_HPP
27 #define NFD_RIB_ROUTE_HPP
28 
29 #include "core/scheduler.hpp"
30 #include <ndn-cxx/encoding/nfd-constants.hpp>
31 #include <ndn-cxx/mgmt/nfd/route-flags-traits.hpp>
32 #include <type_traits>
33 
34 namespace nfd {
35 namespace rib {
36 
39 class Route : public ndn::nfd::RouteFlagsTraits<Route>
40 {
41 public:
42  Route();
43 
44  void
46  {
47  m_expirationEvent = eid;
48  }
49 
50  const scheduler::EventId&
52  {
53  return m_expirationEvent;
54  }
55 
56  std::underlying_type<ndn::nfd::RouteFlags>::type
57  getFlags() const
58  {
59  return flags;
60  }
61 
62 public:
63  uint64_t faceId;
65  uint64_t cost;
66  std::underlying_type<ndn::nfd::RouteFlags>::type flags;
68 
69 private:
70  scheduler::EventId m_expirationEvent;
71 };
72 
73 bool
74 operator==(const Route& lhs, const Route& rhs);
75 
76 inline bool
77 operator!=(const Route& lhs, const Route& rhs)
78 {
79  return !(lhs == rhs);
80 }
81 
82 inline bool
83 compareFaceIdAndOrigin(const Route& lhs, const Route& rhs)
84 {
85  return (lhs.faceId == rhs.faceId && lhs.origin == rhs.origin);
86 }
87 
88 inline bool
89 compareFaceId(const Route& route, const uint64_t faceId)
90 {
91  return (route.faceId == faceId);
92 }
93 
94 std::ostream&
95 operator<<(std::ostream& os, const Route& route);
96 
97 } // namespace rib
98 } // namespace nfd
99 
100 #endif // NFD_RIB_ROUTE_HPP
void setExpirationEvent(const scheduler::EventId eid)
Definition: route.hpp:45
bool operator==(const Route &lhs, const Route &rhs)
Definition: route.cpp:41
defines getters for each route inheritance flag
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
Definition: fib-update.hpp:74
std::underlying_type< ndn::nfd::RouteFlags >::type flags
Definition: route.hpp:66
std::underlying_type< ndn::nfd::RouteFlags >::type getFlags() const
Definition: route.hpp:57
uint64_t cost
Definition: route.hpp:65
uint64_t faceId
Definition: route.hpp:63
bool compareFaceIdAndOrigin(const Route &lhs, const Route &rhs)
Definition: route.hpp:83
bool operator!=(const Route &lhs, const Route &rhs)
Definition: route.hpp:77
ndn::optional< time::steady_clock::TimePoint > expires
Definition: route.hpp:67
std::shared_ptr< ns3::EventId > EventId
Definition: scheduler.hpp:48
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
bool compareFaceId(const Route &route, const uint64_t faceId)
Definition: route.hpp:89
const scheduler::EventId & getExpirationEvent() const
Definition: route.hpp:51