NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fib-entry.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_TABLE_FIB_ENTRY_HPP
27 #define NFD_DAEMON_TABLE_FIB_ENTRY_HPP
28 
29 #include "fib-nexthop.hpp"
30 
31 namespace nfd {
32 
33 class NameTree;
34 namespace name_tree {
35 class Entry;
36 }
37 
38 namespace fib {
39 
48 typedef std::vector<fib::NextHop> NextHopList;
49 
53 class Entry : noncopyable
54 {
55 public:
56  explicit
57  Entry(const Name& prefix);
58 
59  const Name&
60  getPrefix() const;
61 
62  const NextHopList&
63  getNextHops() const;
64 
67  bool
68  hasNextHops() const;
69 
74  bool
75  hasNextHop(shared_ptr<Face> face) const;
76 
82  void
83  addNextHop(shared_ptr<Face> face, uint64_t cost);
84 
91  void
92  removeNextHop(shared_ptr<Face> face);
93 
94 private:
97  NextHopList::iterator
98  findNextHop(Face& face);
99 
101  void
102  sortNextHops();
103 
104 private:
105  Name m_prefix;
106  NextHopList m_nextHops;
107 
108  shared_ptr<name_tree::Entry> m_nameTreeEntry;
109  friend class nfd::NameTree;
110  friend class nfd::name_tree::Entry;
111 };
112 
113 
114 inline const Name&
116 {
117  return m_prefix;
118 }
119 
120 inline const NextHopList&
122 {
123  return m_nextHops;
124 }
125 
126 inline bool
128 {
129  return !m_nextHops.empty();
130 }
131 
132 } // namespace fib
133 } // namespace nfd
134 
135 #endif // NFD_DAEMON_TABLE_FIB_ENTRY_HPP
const NextHopList & getNextHops() const
Definition: fib-entry.hpp:121
void addNextHop(shared_ptr< Face > face, uint64_t cost)
adds a NextHop record
Definition: fib-entry.cpp:52
void removeNextHop(shared_ptr< Face > face)
removes a NextHop record
Definition: fib-entry.cpp:68
represents a FIB entry
Definition: fib-entry.hpp:53
const Name & getPrefix() const
Definition: fib-entry.hpp:115
bool hasNextHop(shared_ptr< Face > face) const
Definition: fib-entry.cpp:46
represents a face
Definition: face.hpp:59
Entry(const Name &prefix)
Definition: fib-entry.cpp:31
Class Name Tree.
Definition: name-tree.hpp:79
std::vector< fib::NextHop > NextHopList
Definition: fib-entry.hpp:48
bool hasNextHops() const
Definition: fib-entry.hpp:127
NameTree
Definition: name-tree.cpp:36
Name Tree Entry Class.