management: Finalizing LocalControlHeader implementation
IncomingFaceId and NextHopFaceId are now fully supported for specifying
to be efficiently sent towards the forwarding daemon, and to be
automatically decoded from incoming packet from the forwarding daemon.
The current implementation limits exactly one LocalControlHeader for
Interest/Data packet instance. This is not exactly correct (especially
inside NFD), where the same Interest is expected to have multiple
LocalControlHeader (for each individual local face). The following
commits will fix this problem.
Change-Id: Ia6b124ed12271136d071f4822f13634897ce3228
refs: #1170
diff --git a/src/name.hpp b/src/name.hpp
index 1f52868..96d43c0 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -64,6 +64,7 @@
* name.wireDecode(wire);
* @endcode
*/
+ explicit
Name(const Block &wire)
{
m_nameBlock = wire;
@@ -100,7 +101,13 @@
void
wireDecode(const Block &wire);
-
+
+ /**
+ * @brief Check if already has wire
+ */
+ bool
+ hasWire() const;
+
/**
* Parse the uri according to the NDN URI Scheme and set the name with the components.
* @param uri The null-terminated URI string.
@@ -482,6 +489,24 @@
return os.str();
}
+template<bool T>
+inline size_t
+Name::wireEncode(EncodingImpl<T>& blk) const
+{
+ size_t total_len = 0;
+
+ for (const_reverse_iterator i = rbegin ();
+ i != rend ();
+ ++i)
+ {
+ total_len += i->wireEncode (blk);
+ }
+
+ total_len += blk.prependVarNumber (total_len);
+ total_len += blk.prependVarNumber (Tlv::Name);
+ return total_len;
+}
+
inline const Block &
Name::wireEncode() const
{
@@ -510,22 +535,10 @@
m_nameBlock.parse();
}
-template<bool T>
-inline size_t
-Name::wireEncode(EncodingImpl<T>& blk) const
+inline bool
+Name::hasWire() const
{
- size_t total_len = 0;
-
- for (const_reverse_iterator i = rbegin ();
- i != rend ();
- ++i)
- {
- total_len += i->wireEncode (blk);
- }
-
- total_len += blk.prependVarNumber (total_len);
- total_len += blk.prependVarNumber (Tlv::Name);
- return total_len;
+ return m_nameBlock.hasWire();
}
} // namespace ndn