encoding+mgmt: move FaceEventKind to nfd-constants

Change-Id: Iab98f9077d557027255434208f084c10ab96b1ef
diff --git a/src/encoding/nfd-constants.cpp b/src/encoding/nfd-constants.cpp
index 2b18d4d..ac34588 100644
--- a/src/encoding/nfd-constants.cpp
+++ b/src/encoding/nfd-constants.cpp
@@ -36,9 +36,8 @@
       return os << "non-local";
     case FACE_SCOPE_LOCAL:
       return os << "local";
-    default:
-      return os << static_cast<unsigned>(faceScope);
   }
+  return os << static_cast<unsigned>(faceScope);
 }
 
 std::ostream&
@@ -53,9 +52,8 @@
       return os << "on-demand";
     case FACE_PERSISTENCY_PERMANENT:
       return os << "permanent";
-    default:
-      return os << static_cast<unsigned>(facePersistency);
   }
+  return os << static_cast<unsigned>(facePersistency);
 }
 
 std::ostream&
@@ -68,9 +66,26 @@
       return os << "point-to-point";
     case LINK_TYPE_MULTI_ACCESS:
       return os << "multi-access";
-    default:
-      return os << static_cast<unsigned>(linkType);
   }
+  return os << static_cast<unsigned>(linkType);
+}
+
+std::ostream&
+operator<<(std::ostream& os, FaceEventKind faceEventKind)
+{
+  switch (faceEventKind) {
+    case FACE_EVENT_NONE:
+      return os << "none";
+    case FACE_EVENT_CREATED:
+      return os << "created";
+    case FACE_EVENT_DESTROYED:
+      return os << "destroyed";
+    case FACE_EVENT_UP:
+      return os << "up";
+    case FACE_EVENT_DOWN:
+      return os << "down";
+  }
+  return os << static_cast<unsigned>(faceEventKind);
 }
 
 std::ostream&
@@ -91,9 +106,8 @@
       return os << "nlsr";
     case ROUTE_ORIGIN_STATIC:
       return os << "static";
-    default:
-      return os << static_cast<unsigned>(routeOrigin);
   }
+  return os << static_cast<unsigned>(routeOrigin);
 }
 
 std::ostream&
diff --git a/src/encoding/nfd-constants.hpp b/src/encoding/nfd-constants.hpp
index 688ea74..7026898 100644
--- a/src/encoding/nfd-constants.hpp
+++ b/src/encoding/nfd-constants.hpp
@@ -32,13 +32,9 @@
 /** \ingroup management
  */
 enum FaceScope : uint8_t {
-  FACE_SCOPE_NONE = std::numeric_limits<uint8_t>::max(),
-  /** \brief face is non-local
-   */
-  FACE_SCOPE_NON_LOCAL = 0,
-  /** \brief face is local
-   */
-  FACE_SCOPE_LOCAL = 1
+  FACE_SCOPE_NONE      = std::numeric_limits<uint8_t>::max(),
+  FACE_SCOPE_NON_LOCAL = 0, ///< face is non-local
+  FACE_SCOPE_LOCAL     = 1, ///< face is local
 };
 
 std::ostream&
@@ -47,16 +43,10 @@
 /** \ingroup management
  */
 enum FacePersistency : uint8_t {
-  FACE_PERSISTENCY_NONE = std::numeric_limits<uint8_t>::max(),
-  /** \brief face is persistent
-   */
-  FACE_PERSISTENCY_PERSISTENT = 0,
-  /** \brief face is on-demand
-   */
-  FACE_PERSISTENCY_ON_DEMAND = 1,
-  /** \brief face is permanent
-   */
-  FACE_PERSISTENCY_PERMANENT = 2
+  FACE_PERSISTENCY_NONE       = std::numeric_limits<uint8_t>::max(),
+  FACE_PERSISTENCY_PERSISTENT = 0, ///< face is persistent
+  FACE_PERSISTENCY_ON_DEMAND  = 1, ///< face is on-demand
+  FACE_PERSISTENCY_PERMANENT  = 2, ///< face is permanent
 };
 
 std::ostream&
@@ -64,22 +54,10 @@
 
 /** \ingroup management
  */
-enum FaceFlagBit {
-  /** \brief bit that controls whether local fields are enabled on a face
-   */
-  BIT_LOCAL_FIELDS_ENABLED = 0
-};
-
-/** \ingroup management
- */
 enum LinkType : uint8_t {
-  LINK_TYPE_NONE = std::numeric_limits<uint8_t>::max(),
-  /** \brief link is point-to-point
-   */
-  LINK_TYPE_POINT_TO_POINT = 0,
-  /** \brief link is multi-access
-   */
-  LINK_TYPE_MULTI_ACCESS = 1
+  LINK_TYPE_NONE           = std::numeric_limits<uint8_t>::max(),
+  LINK_TYPE_POINT_TO_POINT = 0, ///< link is point-to-point
+  LINK_TYPE_MULTI_ACCESS   = 1, ///< link is multi-access
 };
 
 std::ostream&
@@ -87,6 +65,25 @@
 
 /** \ingroup management
  */
+enum FaceFlagBit {
+  BIT_LOCAL_FIELDS_ENABLED = 0, ///< controls whether local fields are enabled on a face
+};
+
+/** \ingroup management
+ */
+enum FaceEventKind : uint8_t {
+  FACE_EVENT_NONE      = 0,
+  FACE_EVENT_CREATED   = 1, ///< face was created
+  FACE_EVENT_DESTROYED = 2, ///< face was destroyed
+  FACE_EVENT_UP        = 3, ///< face went UP (from DOWN state)
+  FACE_EVENT_DOWN      = 4, ///< face went DOWN (from UP state)
+};
+
+std::ostream&
+operator<<(std::ostream& os, FaceEventKind faceEventKind);
+
+/** \ingroup management
+ */
 enum RouteOrigin : uint16_t {
   ROUTE_ORIGIN_NONE     = std::numeric_limits<uint16_t>::max(),
   ROUTE_ORIGIN_APP      = 0,
@@ -94,7 +91,7 @@
   ROUTE_ORIGIN_CLIENT   = 65,
   ROUTE_ORIGIN_AUTOCONF = 66,
   ROUTE_ORIGIN_NLSR     = 128,
-  ROUTE_ORIGIN_STATIC   = 255
+  ROUTE_ORIGIN_STATIC   = 255,
 };
 
 std::ostream&
@@ -105,7 +102,7 @@
 enum RouteFlags {
   ROUTE_FLAGS_NONE         = 0,
   ROUTE_FLAG_CHILD_INHERIT = 1,
-  ROUTE_FLAG_CAPTURE       = 2
+  ROUTE_FLAG_CAPTURE       = 2,
 };
 
 std::ostream&