akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Davide Pesavento | af7a211 | 2019-03-19 14:55:20 -0400 | [diff] [blame] | 2 | /* |
Ashlesh Gawande | 0db4d4d | 2020-02-05 20:30:02 -0800 | [diff] [blame^] | 3 | * Copyright (c) 2014-2020, The University of Memphis, |
Nick Gordon | f8b5bcd | 2016-08-11 15:06:50 -0500 | [diff] [blame] | 4 | * Regents of the University of California |
akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 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/>. | ||||
akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 19 | **/ |
Muktadir Chowdhury | 3be6466 | 2015-05-01 14:50:53 -0500 | [diff] [blame] | 20 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 21 | #ifndef NLSR_FIB_ENTRY_HPP |
22 | #define NLSR_FIB_ENTRY_HPP | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 23 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 24 | #include "nexthop-list.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 25 | |
Ashlesh Gawande | e5002b3 | 2018-12-20 21:07:31 -0600 | [diff] [blame] | 26 | #include <ndn-cxx/util/scheduler.hpp> |
27 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 28 | namespace nlsr { |
29 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 30 | class FibEntry |
31 | { | ||||
32 | public: | ||||
Davide Pesavento | af7a211 | 2019-03-19 14:55:20 -0400 | [diff] [blame] | 33 | FibEntry() = default; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 34 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 35 | FibEntry(const ndn::Name& name) |
Davide Pesavento | af7a211 | 2019-03-19 14:55:20 -0400 | [diff] [blame] | 36 | : m_name(name) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 37 | { |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 38 | } |
39 | |||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 40 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 41 | getName() const |
42 | { | ||||
43 | return m_name; | ||||
44 | } | ||||
45 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 46 | NexthopList& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 47 | getNexthopList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 48 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 49 | return m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 50 | } |
51 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 52 | void |
Davide Pesavento | af7a211 | 2019-03-19 14:55:20 -0400 | [diff] [blame] | 53 | setRefreshEventId(ndn::scheduler::EventId id) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 54 | { |
Davide Pesavento | af7a211 | 2019-03-19 14:55:20 -0400 | [diff] [blame] | 55 | m_refreshEventId = std::move(id); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 56 | } |
57 | |||||
Davide Pesavento | af7a211 | 2019-03-19 14:55:20 -0400 | [diff] [blame] | 58 | ndn::scheduler::EventId |
Muktadir Chowdhury | 3be6466 | 2015-05-01 14:50:53 -0500 | [diff] [blame] | 59 | getRefreshEventId() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 60 | { |
Muktadir Chowdhury | 3be6466 | 2015-05-01 14:50:53 -0500 | [diff] [blame] | 61 | return m_refreshEventId; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 62 | } |
63 | |||||
64 | void | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 65 | setSeqNo(int32_t fsn) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 66 | { |
67 | m_seqNo = fsn; | ||||
68 | } | ||||
69 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 70 | int32_t |
Muktadir Chowdhury | 3be6466 | 2015-05-01 14:50:53 -0500 | [diff] [blame] | 71 | getSeqNo() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 72 | { |
73 | return m_seqNo; | ||||
74 | } | ||||
75 | |||||
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 76 | void |
Ashlesh Gawande | e5002b3 | 2018-12-20 21:07:31 -0600 | [diff] [blame] | 77 | writeLog() const; |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 78 | |
Muktadir Chowdhury | 3be6466 | 2015-05-01 14:50:53 -0500 | [diff] [blame] | 79 | typedef NexthopList::const_iterator const_iterator; |
80 | |||||
81 | const_iterator | ||||
82 | begin() const; | ||||
83 | |||||
84 | const_iterator | ||||
85 | end() const; | ||||
86 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 87 | private: |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 88 | ndn::Name m_name; |
Davide Pesavento | af7a211 | 2019-03-19 14:55:20 -0400 | [diff] [blame] | 89 | ndn::scheduler::EventId m_refreshEventId; |
90 | int32_t m_seqNo = 1; | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 91 | NexthopList m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 92 | }; |
93 | |||||
Muktadir Chowdhury | 3be6466 | 2015-05-01 14:50:53 -0500 | [diff] [blame] | 94 | inline FibEntry::const_iterator |
95 | FibEntry::begin() const | ||||
96 | { | ||||
97 | return m_nexthopList.cbegin(); | ||||
98 | } | ||||
99 | |||||
100 | inline FibEntry::const_iterator | ||||
101 | FibEntry::end() const | ||||
102 | { | ||||
103 | return m_nexthopList.cend(); | ||||
104 | } | ||||
105 | |||||
Nick Gordon | fad8e25 | 2016-08-11 14:21:38 -0500 | [diff] [blame] | 106 | } // namespace nlsr |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 107 | |
Muktadir Chowdhury | 3be6466 | 2015-05-01 14:50:53 -0500 | [diff] [blame] | 108 | #endif // NLSR_FIB_ENTRY_HPP |