prefix-ann: provide ==, !=, << operators
Also, ensure toData() adds correct ContentType.
refs #4650
Change-Id: I60956948766190cd713b58c85ba30b3701180b25
diff --git a/src/prefix-announcement.hpp b/src/prefix-announcement.hpp
index d811230..6c48015 100644
--- a/src/prefix-announcement.hpp
+++ b/src/prefix-announcement.hpp
@@ -119,10 +119,29 @@
private:
mutable optional<Data> m_data;
Name m_announcedName;
- time::milliseconds m_expiration;
+ time::milliseconds m_expiration = 0_ms;
optional<security::ValidityPeriod> m_validity;
};
+/** \brief Test whether two prefix announcements has the same name, expiration period,
+ * and validity period.
+ */
+bool
+operator==(const PrefixAnnouncement& lhs, const PrefixAnnouncement& rhs);
+
+inline bool
+operator!=(const PrefixAnnouncement& lhs, const PrefixAnnouncement& rhs)
+{
+ return !(lhs == rhs);
+}
+
+/** \brief Print prefix announcement to a stream.
+ *
+ * This string is for debugging purpose. Its syntax is not public API.
+ */
+std::ostream&
+operator<<(std::ostream& os, const PrefixAnnouncement& pa);
+
} // namespace ndn
#endif // NDN_CXX_PREFIX_ANNOUNCEMENT_HPP