fib-entry.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2019, The University of Memphis,
4  * Regents of the University of California
5  *
6  * This file is part of NLSR (Named-data Link State Routing).
7  * See AUTHORS.md for complete list of NLSR authors and contributors.
8  *
9  * NLSR is free software: you can redistribute it and/or modify it under the terms
10  * of the GNU General Public License as published by the Free Software Foundation,
11  * either version 3 of the License, or (at your option) any later version.
12  *
13  * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
19  **/
20 
21 #ifndef NLSR_FIB_ENTRY_HPP
22 #define NLSR_FIB_ENTRY_HPP
23 
24 #include "nexthop-list.hpp"
25 
26 #include <ndn-cxx/util/scheduler.hpp>
27 
28 namespace nlsr {
29 
30 class FibEntry
31 {
32 public:
33  FibEntry() = default;
34 
35  FibEntry(const ndn::Name& name)
36  : m_name(name)
37  {
38  }
39 
40  const ndn::Name&
41  getName() const
42  {
43  return m_name;
44  }
45 
48  {
49  return m_nexthopList;
50  }
51 
52  void
53  setRefreshEventId(ndn::scheduler::EventId id)
54  {
55  m_refreshEventId = std::move(id);
56  }
57 
58  ndn::scheduler::EventId
60  {
61  return m_refreshEventId;
62  }
63 
64  void
65  setSeqNo(int32_t fsn)
66  {
67  m_seqNo = fsn;
68  }
69 
70  int32_t
71  getSeqNo() const
72  {
73  return m_seqNo;
74  }
75 
76  void
77  writeLog() const;
78 
80 
81  const_iterator
82  begin() const;
83 
84  const_iterator
85  end() const;
86 
87 private:
88  ndn::Name m_name;
89  ndn::scheduler::EventId m_refreshEventId;
90  int32_t m_seqNo = 1;
91  NexthopList m_nexthopList;
92 };
93 
96 {
97  return m_nexthopList.cbegin();
98 }
99 
102 {
103  return m_nexthopList.cend();
104 }
105 
106 } // namespace nlsr
107 
108 #endif // NLSR_FIB_ENTRY_HPP
void setRefreshEventId(ndn::scheduler::EventId id)
Definition: fib-entry.hpp:53
const_iterator cend() const
const_iterator cbegin() const
const_iterator begin() const
Definition: fib-entry.hpp:95
NexthopList & getNexthopList()
Definition: fib-entry.hpp:47
void setSeqNo(int32_t fsn)
Definition: fib-entry.hpp:65
ndn::scheduler::EventId getRefreshEventId() const
Definition: fib-entry.hpp:59
int32_t getSeqNo() const
Definition: fib-entry.hpp:71
NexthopList::const_iterator const_iterator
Definition: fib-entry.hpp:79
void writeLog() const
Definition: fib-entry.cpp:29
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
const ndn::Name & getName() const
Definition: fib-entry.hpp:41
FibEntry(const ndn::Name &name)
Definition: fib-entry.hpp:35
std::set< NextHop, NextHopComparator >::const_iterator const_iterator
FibEntry()=default
const_iterator end() const
Definition: fib-entry.hpp:101