NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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; -*- */
2 /*
3  * Copyright (c) 2014-2018, 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 NFD (Named Data Networking Forwarding Daemon).
12  * See AUTHORS.md for complete list of NFD authors and contributors.
13  *
14  * NFD is free software: you can redistribute it and/or modify it under the terms
15  * of the GNU General Public License as published by the Free Software Foundation,
16  * either version 3 of the License, or (at your option) any later version.
17  *
18  * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20  * PURPOSE. See the GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along with
23  * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef NFD_RIB_ROUTE_HPP
27 #define NFD_RIB_ROUTE_HPP
28 
29 #include "core/scheduler.hpp"
30 
31 #include <ndn-cxx/encoding/nfd-constants.hpp>
32 #include <ndn-cxx/mgmt/nfd/route-flags-traits.hpp>
33 
34 #include <type_traits>
35 
36 namespace nfd {
37 namespace rib {
38 
41 class Route : public ndn::nfd::RouteFlagsTraits<Route>
42 {
43 public:
44  Route();
45 
46  void
48  {
49  m_expirationEvent = eid;
50  }
51 
52  const scheduler::EventId&
54  {
55  return m_expirationEvent;
56  }
57 
58  std::underlying_type<ndn::nfd::RouteFlags>::type
59  getFlags() const
60  {
61  return flags;
62  }
63 
64 public:
65  uint64_t faceId;
67  uint64_t cost;
68  std::underlying_type<ndn::nfd::RouteFlags>::type flags;
70 
71 private:
72  scheduler::EventId m_expirationEvent;
73 };
74 
75 bool
76 operator==(const Route& lhs, const Route& rhs);
77 
78 inline bool
79 operator!=(const Route& lhs, const Route& rhs)
80 {
81  return !(lhs == rhs);
82 }
83 
84 inline bool
85 compareFaceIdAndOrigin(const Route& lhs, const Route& rhs)
86 {
87  return (lhs.faceId == rhs.faceId && lhs.origin == rhs.origin);
88 }
89 
90 inline bool
91 compareFaceId(const Route& route, const uint64_t faceId)
92 {
93  return (route.faceId == faceId);
94 }
95 
96 std::ostream&
97 operator<<(std::ostream& os, const Route& route);
98 
99 } // namespace rib
100 } // namespace nfd
101 
102 #endif // NFD_RIB_ROUTE_HPP
Opaque handle for a scheduled event.
const scheduler::EventId & getExpirationEvent() const
Definition: route.hpp:53
void setExpirationEvent(const scheduler::EventId eid)
Definition: route.hpp:47
bool operator==(const Route &lhs, const Route &rhs)
Definition: route.cpp:41
defines getters for each route inheritance flag
std::underlying_type< ndn::nfd::RouteFlags >::type getFlags() const
Definition: route.hpp:59
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:68
uint64_t cost
Definition: route.hpp:67
uint64_t faceId
Definition: route.hpp:65
bool compareFaceIdAndOrigin(const Route &lhs, const Route &rhs)
Definition: route.hpp:85
optional< time::steady_clock::TimePoint > expires
Definition: route.hpp:69
bool operator!=(const Route &lhs, const Route &rhs)
Definition: route.hpp:79
ndn::nfd::RouteOrigin origin
Definition: route.hpp:66
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:41
bool compareFaceId(const Route &route, const uint64_t faceId)
Definition: route.hpp:91