28 const ndn::time::system_clock::time_point& timepoint,
AdjacencyList& adl)
29 :
Lsa(originRouter, seqNo, timepoint)
31 for (
const auto& adjacent : adl.
getAdjList()) {
43template<ndn::encoding::Tag TAG>
47 size_t totalLength = 0;
50 for (
auto it = list.rbegin(); it != list.rend(); ++it) {
51 totalLength += it->wireEncode(block);
56 totalLength += block.prependVarNumber(totalLength);
71 ndn::EncodingEstimator estimator;
74 ndn::EncodingBuffer buffer(estimatedSize, 0);
93 auto val =
m_wire.elements_begin();
100 NDN_THROW(
Error(
"Missing required Lsa field"));
104 for (; val !=
m_wire.elements_end(); ++val) {
109 NDN_THROW(
Error(
"Adjacency", val->type()));
116AdjLsa::print(std::ostream& os)
const
118 os <<
" Adjacent(s):\n";
120 int adjacencyIndex = 0;
121 for (
const auto& adjacency : m_adl) {
122 os <<
" Adjacent " << adjacencyIndex++
123 <<
": (name=" << adjacency.getName()
124 <<
", uri=" << adjacency.getFaceUri()
125 <<
", cost=" << adjacency.getLinkCost() <<
")\n";
129std::tuple<bool, std::list<PrefixInfo>, std::list<PrefixInfo>>
132 auto alsa = std::static_pointer_cast<AdjLsa>(lsa);
133 if (*
this != *alsa) {
135 for (
const auto& adjacent : alsa->getAdl()) {
138 return {
true, std::list<PrefixInfo>{}, std::list<PrefixInfo>{}};
140 return {
false, std::list<PrefixInfo>{}, std::list<PrefixInfo>{}};
Represents an LSA of adjacencies of the origin router in link-state mode.
const ndn::Block & wireEncode() const override
void wireDecode(const ndn::Block &wire)
std::tuple< bool, std::list< PrefixInfo >, std::list< PrefixInfo > > update(const std::shared_ptr< Lsa > &lsa) override
void addAdjacent(const Adjacent &adj)
bool insert(const Adjacent &adjacent)
std::list< Adjacent > & getAdjList()
A neighbor reachable over a Face.
Represents a Link State Announcement (LSA).
void wireDecode(const ndn::Block &wire)
virtual const ndn::Block & wireEncode() const =0
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Adjacent)