interest: Add Link and SelectedDelegation fields

Change-Id: I1e4bafe8559ef87135de6cb6f209fc94dfa231b0
Refs: #2587
diff --git a/src/interest.hpp b/src/interest.hpp
index 48f34f7..1e064fb 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -29,6 +29,7 @@
 #include "util/time.hpp"
 #include "management/nfd-local-control-header.hpp"
 #include "tag-host.hpp"
+#include "link.hpp"
 
 namespace ndn {
 
@@ -130,6 +131,76 @@
   std::string
   toUri() const;
 
+public: // Link and forwarding hint
+
+   /**
+   * @brief Check whether the Interest contains a Link object
+   * @return True if there is a link object, otherwise false
+   */
+  bool
+  hasLink() const;
+
+  /**
+   * @brief Get the link object for this interest
+   * @return The link object if there is one contained in this interest
+   * @throws Interest::Error if there is no link object contained in the interest
+   */
+  Link
+  getLink() const;
+
+  /**
+   * @brief Set the link object for this interest
+   * @param link The link object that will be included in this interest (in wire format)
+   * @post !hasSelectedDelegation()
+   */
+  void
+  setLink(const Block& link);
+
+  /**
+   *@brief Reset the wire format of the given interest and the contained link
+   */
+  void
+  unsetLink();
+
+  /**
+   * @brief Check whether the Interest includes a selected delegation
+   * @return True if there is a selected delegation, otherwise false
+   */
+  bool
+  hasSelectedDelegation() const;
+
+  /**
+   * @brief Get the name of the selected delegation
+   * @return The name of the selected delegation
+   * @throw Error SelectedDelegation is not set.
+   */
+  Name
+  getSelectedDelegation() const;
+
+  /**
+   * @brief Set the selected delegation
+   * @param delegationName The name of the selected delegation
+   * @throw Error Link is not set.
+   * @throw std::invalid_argument @p delegationName does not exist in Link.
+   */
+  void
+  setSelectedDelegation(const Name& delegationName);
+
+  /**
+   * @brief Set the selected delegation
+   * @param delegation The index of the selected delegation
+   * @throw Error Link is not set.
+   * @throw std::out_of_range @p delegationIndex is out of bound in Link.
+   */
+  void
+  setSelectedDelegation(size_t delegationIndex);
+
+   /**
+   * @brief Unset the selected delegation
+   */
+  void
+  unsetSelectedDelegation();
+
 public: // matching
   /** @brief Check if Interest, including selectors, matches the given @p name
    *  @param name The name to be matched. If this is a Data name, it shall contain the
@@ -395,6 +466,8 @@
   int m_scope;
   time::milliseconds m_interestLifetime;
 
+  mutable Block m_link;
+  size_t m_selectedDelegationIndex;
   mutable Block m_wire;
 
   nfd::LocalControlHeader m_localControlHeader;