face: Implementation of encode/decode of LocalControlHeader

LocalControlHeader can only be used on faces that are derived from
LocalFace.  UnixStreamFace is directly inherited from LocalFace,
TCP face has two specializations: generic TcpFace (strictly not local),
and LocalTcpFace.

refs #1213

Change-Id: I8a158c3bc4bb929eedd15757cfddecc0d1049f9f
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index 924b4fa..f3c5d40 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -22,21 +22,6 @@
 const std::size_t MAX_NDN_PACKET_SIZE = 8800;
 
 
-/* \brief indicates a feature in LocalControlHeader
- */
-enum LocalControlHeaderFeature
-{
-  /// any feature
-  LOCAL_CONTROL_HEADER_FEATURE_ANY,
-  /// in-faceid
-  LOCAL_CONTROL_HEADER_FEATURE_IN_FACEID,
-  /// out-faceid
-  LOCAL_CONTROL_HEADER_FEATURE_NEXTHOP_FACEID,
-  /// upper bound of enum
-  LOCAL_CONTROL_HEADER_FEATURE_MAX
-};
-
-
 /** \brief represents a face
  */
 class Face : noncopyable, public enable_shared_from_this<Face>
@@ -75,22 +60,14 @@
   virtual void
   sendData(const Data& data) = 0;
 
-  /**
-   * \brief Close the face
+  /** \brief Close the face
    *
-   * This terminates all communication on the face and cause
-   * onFail() method event to be invoked
+   *  This terminates all communication on the face and cause
+   *  onFail() method event to be invoked
    */
   virtual void
   close() = 0;
 
-  /** \brief Get whether face is connected to a local app
-   *
-   *  In this base class this property is always false.
-   */
-  virtual bool
-  isLocal() const = 0;
-  
   /** \brief Get whether underlying communication is up
    *
    *  In this base class this property is always true.
@@ -98,6 +75,14 @@
   virtual bool
   isUp() const;
 
+  /** \brief Get whether face is connected to a local app
+   *
+   *  False by default and can become true if a derived class, implementing
+   *  one of the local face types, explicitly calls Face::setLocal(true)
+   */
+  bool
+  isLocal() const;
+  
   /** \brief Set the description
    *
    *  This is typically invoked by mgmt on set description command
@@ -116,22 +101,13 @@
   virtual bool
   isMultiAccess() const;
 
-  /** \brief get whether a LocalControlHeader feature is enabled
-   *
-   *  \param feature The feature. Cannot be LOCAL_CONTROL_HEADER_FEATURE_MAX
-   *  LOCAL_CONTROL_HEADER_FEATURE_ANY returns true if any feature is enabled.
-   */
-  bool
-  isLocalControlHeaderEnabled(LocalControlHeaderFeature feature =
-                              LOCAL_CONTROL_HEADER_FEATURE_ANY) const;
-
-  /** \brief enable or disable a LocalControlHeader feature
-   *
-   *  \param feature The feature. Cannot be LOCAL_CONTROL_HEADER_FEATURE_ANY
-   *                                     or LOCAL_CONTROL_HEADER_FEATURE_MAX
-   */
+protected:
   void
-  setLocalControlHeaderFeature(LocalControlHeaderFeature feature, bool enabled);
+  setLocal(bool isLocal);
+
+  // this is a non-virtual method
+  bool
+  decodeAndDispatchInput(const Block& element);
 
 private:
   void
@@ -140,19 +116,12 @@
 private:
   FaceId m_id;
   std::string m_description;
-  std::vector<bool> m_localControlHeaderFeatures;
-
+  bool m_isLocal; // for scoping purposes
+  
   // allow setting FaceId
   friend class Forwarder;
 };
 
-inline bool
-Face::isLocalControlHeaderEnabled(LocalControlHeaderFeature feature) const
-{
-  BOOST_ASSERT(feature < m_localControlHeaderFeatures.size());
-  return m_localControlHeaderFeatures[feature];
-}
-
 } // namespace nfd
 
 #endif // NFD_FACE_FACE_HPP