28 const ndn::time::system_clock::TimePoint& timepoint,
30 :
Lsa(originRouter, seqNo, timepoint)
32 for (
const auto& name : npl.
getNames()) {
42 template<ndn::encoding::Tag TAG>
46 size_t totalLength = 0;
50 for (
auto it = names.rbegin(); it != names.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) {
105 if (val->type() == ndn::tlv::Name) {
106 npl.
insert(ndn::Name(*val));
109 NDN_THROW(
Error(
"Name", val->type()));
118 return m_npl == other.
getNpl();
124 std::ostringstream os;
128 for (
const auto& name : m_npl.
getNames()) {
129 os <<
" Name " << i++ <<
": " << name <<
"\n";
Data abstraction for Lsa Lsa := LSA-TYPE TLV-LENGTH Name SequenceNumber ExpirationTimePoint.
virtual const ndn::Block & wireEncode() const =0
virtual std::string toString() const
void wireDecode(const ndn::Block &wire)
Data abstraction for NameLsa NameLsa := NAME-LSA-TYPE TLV-LENGTH Lsa Name+.
NamePrefixList & getNpl()
std::string toString() const override
void addName(const ndn::Name &name)
void wireDecode(const ndn::Block &wire)
const ndn::Block & wireEncode() const override
bool isEqualContent(const NameLsa &other) const
bool insert(const ndn::Name &name, const std::string &source="")
inserts name into NamePrefixList
std::list< ndn::Name > getNames() const
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California,...
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Adjacent)