publisher: fix encoding bug in routing table publisher
refs: #4453
Change-Id: I03e819e963f0957f3d40ff25e378f2b9b17357b7
diff --git a/src/tlv/destination.cpp b/src/tlv/destination.cpp
index 6f9f918..a1ea06f 100644
--- a/src/tlv/destination.cpp
+++ b/src/tlv/destination.cpp
@@ -54,13 +54,7 @@
return totalLength;
}
-NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Destination);
-
-template size_t
-Destination::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
-
-template size_t
-Destination::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
+NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Destination);
const ndn::Block&
Destination::wireEncode() const
diff --git a/src/tlv/destination.hpp b/src/tlv/destination.hpp
index 7c577e8..859c8a8 100644
--- a/src/tlv/destination.hpp
+++ b/src/tlv/destination.hpp
@@ -91,6 +91,8 @@
mutable ndn::Block m_wire;
};
+NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Destination);
+
std::ostream&
operator<<(std::ostream& os, const Destination& destination);
diff --git a/src/tlv/nexthop.cpp b/src/tlv/nexthop.cpp
index 79b6e97..342a02e 100644
--- a/src/tlv/nexthop.cpp
+++ b/src/tlv/nexthop.cpp
@@ -61,13 +61,7 @@
return totalLength;
}
-NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(NextHop);
-
-template size_t
-NextHop::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
-
-template size_t
-NextHop::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
+NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(NextHop);
const ndn::Block&
NextHop::wireEncode() const
diff --git a/src/tlv/nexthop.hpp b/src/tlv/nexthop.hpp
index 03666cc..9b0f72c 100644
--- a/src/tlv/nexthop.hpp
+++ b/src/tlv/nexthop.hpp
@@ -103,6 +103,8 @@
mutable ndn::Block m_wire;
};
+NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(NextHop);
+
std::ostream&
operator<<(std::ostream& os, const NextHop& nexthop);
diff --git a/src/tlv/routing-table-entry.cpp b/src/tlv/routing-table-entry.cpp
index 39405af..c8e6332 100644
--- a/src/tlv/routing-table-entry.cpp
+++ b/src/tlv/routing-table-entry.cpp
@@ -85,13 +85,7 @@
return totalLength;
}
-NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(RoutingTable);
-
-template size_t
-RoutingTable::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& encoder) const;
-
-template size_t
-RoutingTable::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& encoder) const;
+NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(RoutingTable);
const ndn::Block&
RoutingTable::wireEncode() const
@@ -155,16 +149,14 @@
std::ostream&
operator<<(std::ostream& os, const RoutingTable& routingtable)
{
- os << "Routing Table: " << std::endl;
os << routingtable.getDestination() << std::endl;
- os << "Nexthops: NexthopList(" << std::endl;
+ os << "NexthopList(" << std::endl;
for (const auto& rtentry : routingtable) {
- os << rtentry << std::endl;
+ os << rtentry;
}
os << ")";
-
return os;
}
diff --git a/src/tlv/routing-table-entry.hpp b/src/tlv/routing-table-entry.hpp
index 176becb..167f63a 100644
--- a/src/tlv/routing-table-entry.hpp
+++ b/src/tlv/routing-table-entry.hpp
@@ -133,6 +133,8 @@
mutable ndn::Block m_wire;
};
+NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(RoutingTable);
+
inline RoutingTable::const_iterator
RoutingTable::begin() const
{
diff --git a/src/tlv/routing-table-status.cpp b/src/tlv/routing-table-status.cpp
index d2c8a55..6f4bb24 100644
--- a/src/tlv/routing-table-status.cpp
+++ b/src/tlv/routing-table-status.cpp
@@ -31,7 +31,7 @@
BOOST_CONCEPT_ASSERT((ndn::WireEncodable<RoutingTableStatus>));
BOOST_CONCEPT_ASSERT((ndn::WireDecodable<RoutingTableStatus>));
static_assert(std::is_base_of<ndn::tlv::Error, RoutingTableStatus::Error>::value,
- "RTStatus::Error must inherit from tlv::Error");
+ "RoutingTableStatus::Error must inherit from tlv::Error");
RoutingTableStatus::RoutingTableStatus()
: m_hasRoutingtable(false)
@@ -83,13 +83,7 @@
return totalLength;
}
-NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(RoutingTableStatus);
-
-template size_t
-RoutingTableStatus::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
-
-template size_t
-RoutingTableStatus::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
+NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(RoutingTableStatus);
const ndn::Block&
RoutingTableStatus::wireEncode() const
diff --git a/src/tlv/routing-table-status.hpp b/src/tlv/routing-table-status.hpp
index 1ce3497..97d083f 100644
--- a/src/tlv/routing-table-status.hpp
+++ b/src/tlv/routing-table-status.hpp
@@ -95,6 +95,8 @@
mutable ndn::Block m_wire;
};
+NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(RoutingTableStatus);
+
std::ostream&
operator<<(std::ostream& os, const RoutingTableStatus& rtStatus);