interest: recognize Interest in Packet Format v0.3
Interest::wireDecode accepts both v0.2 and v0.3 formats,
but Interest::wireEncode only encodes into v0.2 format.
refs #4527
Change-Id: I784b6f1d5c0d93db33155efddc0180359d8cab74
diff --git a/src/interest.hpp b/src/interest.hpp
index d547daa..5fc1c42 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -73,12 +73,16 @@
size_t
wireEncode(EncodingImpl<TAG>& encoder) const;
- /** @brief Encode to a @c Block in NDN Packet Format v0.2.
+ /** @brief Encode to a @c Block.
+ *
+ * Normally, this function encodes to NDN Packet Format v0.2. However, if this instance has
+ * cached wire encoding (@c hasWire() is true), the cached encoding is returned and it might
+ * be in v0.3 format.
*/
const Block&
wireEncode() const;
- /** @brief Decode from @p wire in NDN Packet Format v0.2.
+ /** @brief Decode from @p wire in NDN Packet Format v0.2 or v0.3.
*/
void
wireDecode(const Block& wire);
@@ -372,6 +376,21 @@
}
private:
+ /** @brief Decode @c m_wire as NDN Packet Format v0.2.
+ * @retval true decoding successful.
+ * @retval false decoding failed due to structural error.
+ * @throw tlv::Error decoding error within a sub-element.
+ */
+ bool
+ decode02();
+
+ /** @brief Decode @c m_wire as NDN Packet Format v0.3.
+ * @throw tlv::Error decoding error.
+ */
+ void
+ decode03();
+
+private:
Name m_name;
Selectors m_selectors;
mutable optional<uint32_t> m_nonce;