interest: encode and decode ForwardingHint field

refs #4055

Change-Id: I1e62b160af9fa0e1a94b996cbcf2e9f5c387cb97
diff --git a/src/interest.cpp b/src/interest.cpp
index 34ebd4a..2f54dcb 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -63,6 +63,7 @@
   //                Selectors?
   //                Nonce
   //                InterestLifetime?
+  //                ForwardingHint?
   //                Link?
   //                SelectedDelegation?
 
@@ -81,6 +82,11 @@
     BOOST_ASSERT(!hasSelectedDelegation());
   }
 
+  // ForwardingHint
+  if (m_forwardingHint.size() > 0) {
+    totalLength += m_forwardingHint.wireEncode(encoder);
+  }
+
   // InterestLifetime
   if (getInterestLifetime() != DEFAULT_INTEREST_LIFETIME) {
     totalLength += prependNonNegativeIntegerBlock(encoder,
@@ -161,6 +167,15 @@
     m_interestLifetime = DEFAULT_INTEREST_LIFETIME;
   }
 
+  // ForwardingHint
+  val = m_wire.find(tlv::ForwardingHint);
+  if (val != m_wire.elements_end()) {
+    m_forwardingHint.wireDecode(*val, false);
+  }
+  else {
+    m_forwardingHint = DelegationList();
+  }
+
   // Link
   m_linkCached.reset();
   val = m_wire.find(tlv::Data);
@@ -367,6 +382,14 @@
   return *this;
 }
 
+Interest&
+Interest::setForwardingHint(const DelegationList& value)
+{
+  m_forwardingHint = value;
+  m_wire.reset();
+  return *this;
+}
+
 bool
 Interest::hasLink() const
 {
diff --git a/src/interest.hpp b/src/interest.hpp
index 1ec414b..f772def 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -22,6 +22,7 @@
 #ifndef NDN_INTEREST_HPP
 #define NDN_INTEREST_HPP
 
+#include "delegation-list.hpp"
 #include "link.hpp"
 #include "name.hpp"
 #include "selectors.hpp"
@@ -195,6 +196,15 @@
   Interest&
   setInterestLifetime(time::milliseconds interestLifetime);
 
+  const DelegationList&
+  getForwardingHint() const
+  {
+    return m_forwardingHint;
+  }
+
+  Interest&
+  setForwardingHint(const DelegationList& value);
+
 public: // Selectors
   /**
    * @return true if Interest has any selector present
@@ -379,6 +389,7 @@
   Selectors m_selectors;
   mutable Block m_nonce;
   time::milliseconds m_interestLifetime;
+  DelegationList m_forwardingHint;
 
   mutable Block m_link;
   mutable shared_ptr<Link> m_linkCached;