27 Lsa::Lsa(
const ndn::Name& originRouter, uint64_t seqNo,
28 ndn::time::system_clock::time_point expirationTimePoint)
29 : m_originRouter(originRouter)
31 , m_expirationTimePoint(expirationTimePoint)
36 : m_originRouter(lsa.getOriginRouter())
37 , m_seqNo(lsa.getSeqNo())
38 , m_expirationTimePoint(lsa.getExpirationTimePoint())
42 template<ndn::encoding::Tag TAG>
46 size_t totalLength = 0;
48 totalLength += prependStringBlock(encoder,
56 totalLength += encoder.prependVarNumber(totalLength);
70 ndn::Block baseWire = wire;
73 auto val = baseWire.elements_begin();
75 if (val != baseWire.elements_end() && val->type() == ndn::tlv::Name) {
79 NDN_THROW(
Error(
"OriginRouter: Missing required Name field"));
85 m_seqNo = ndn::readNonNegativeInteger(*val);
89 NDN_THROW(
Error(
"Missing required SequenceNumber field"));
96 NDN_THROW(
Error(
"Missing required ExpirationTime field"));
104 os <<
" " << lsa.
getType() <<
" LSA:\n"
106 <<
" Sequence Number : " << lsa.
m_seqNo <<
"\n"
107 <<
" Expires in : " << ndn::time::duration_cast<ndn::time::milliseconds>(duration)
136 std::string typeString;
138 if (typeString ==
"ADJACENCY") {
141 else if (typeString ==
"COORDINATE") {
144 else if (typeString ==
"NAME") {
Represents a Link State Announcement (LSA).
virtual const ndn::Block & wireEncode() const =0
virtual Type getType() const =0
ndn::time::system_clock::time_point m_expirationTimePoint
void wireDecode(const ndn::Block &wire)
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
std::istream & operator>>(std::istream &is, Lsa::Type &type)
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Adjacent)