Loading...
Searching...
No Matches
adjacency-list.hpp
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014-2024, The University of Memphis,
4 * Regents of the University of California,
5 * Arizona Board of Regents.
6 *
7 * This file is part of NLSR (Named-data Link State Routing).
8 * See AUTHORS.md for complete list of NLSR authors and contributors.
9 *
10 * NLSR is free software: you can redistribute it and/or modify it under the terms
11 * of the GNU General Public License as published by the Free Software Foundation,
12 * either version 3 of the License, or (at your option) any later version.
13 *
14 * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
20 **/
21
22#ifndef NLSR_ADJACENCY_LIST_HPP
23#define NLSR_ADJACENCY_LIST_HPP
24
25#include "adjacent.hpp"
26#include "common.hpp"
27
28#include <list>
29
30namespace nlsr {
31
33{
34public:
35 using const_iterator = std::list<Adjacent>::const_iterator;
36 using iterator = std::list<Adjacent>::iterator;
37
38 bool
39 insert(const Adjacent& adjacent);
40
41 std::list<Adjacent>&
42 getAdjList();
43
44 const std::list<Adjacent>&
45 getAdjList() const;
46
47 bool
48 isNeighbor(const ndn::Name& adjName) const;
49
50 void
51 incrementTimedOutInterestCount(const ndn::Name& neighbor);
52
53 int32_t
54 getTimedOutInterestCount(const ndn::Name& neighbor) const;
55
57 getStatusOfNeighbor(const ndn::Name& neighbor) const;
58
59 void
60 setStatusOfNeighbor(const ndn::Name& neighbor, Adjacent::Status status);
61
62 void
63 setTimedOutInterestCount(const ndn::Name& neighbor, uint32_t count);
64
80 bool
81 isAdjLsaBuildable(const uint32_t interestRetryNo) const;
82
83 int32_t
85
87 getAdjacent(const ndn::Name& adjName) const;
88
89 bool
90 operator==(const AdjacencyList& adl) const;
91
92 size_t
93 size() const
94 {
95 return m_adjList.size();
96 }
97
98 void
100 {
101 m_adjList.clear();
102 }
103
105 findAdjacent(const ndn::Name& adjName);
106
108 findAdjacent(uint64_t faceId);
109
111 findAdjacent(const ndn::FaceUri& faceUri);
112
113 uint64_t
114 getFaceId(const ndn::FaceUri& faceUri);
115
116 void
117 writeLog();
118
119public:
121 begin() const
122 {
123 return m_adjList.begin();
124 }
125
127 end() const
128 {
129 return m_adjList.end();
130 }
131
132private:
134 find(const ndn::Name& adjName);
135
137 find(const ndn::Name& adjName) const;
138
139private:
140 std::list<Adjacent> m_adjList;
141};
142
143} // namespace nlsr
144#endif // NLSR_ADJACENCY_LIST_HPP
int32_t getNumOfActiveNeighbor() const
int32_t getTimedOutInterestCount(const ndn::Name &neighbor) const
void incrementTimedOutInterestCount(const ndn::Name &neighbor)
void setTimedOutInterestCount(const ndn::Name &neighbor, uint32_t count)
bool operator==(const AdjacencyList &adl) const
std::list< Adjacent >::iterator iterator
std::list< Adjacent >::const_iterator const_iterator
const_iterator begin() const
uint64_t getFaceId(const ndn::FaceUri &faceUri)
bool isAdjLsaBuildable(const uint32_t interestRetryNo) const
Determines whether this list can be used to build an adj. LSA.
bool insert(const Adjacent &adjacent)
std::list< Adjacent > & getAdjList()
const_iterator end() const
Adjacent::Status getStatusOfNeighbor(const ndn::Name &neighbor) const
bool isNeighbor(const ndn::Name &adjName) const
Adjacent getAdjacent(const ndn::Name &adjName) const
void setStatusOfNeighbor(const ndn::Name &neighbor, Adjacent::Status status)
AdjacencyList::iterator findAdjacent(const ndn::Name &adjName)
A neighbor reachable over a Face.
Definition adjacent.hpp:47
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.