neighbor: Rework getCurrentNeighbors

Now allows filtering out undesirable neighbors before passing them in
them back.

Change-Id: I7f6484586ffbc8a875c7e4342d3180746f2e55e5
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/neighbor.hpp b/neighbor.hpp
index ce1d34b..cca9c11 100644
--- a/neighbor.hpp
+++ b/neighbor.hpp
@@ -1,11 +1,11 @@
 #pragma once
 
 #include "types.hpp"
-#include "util.hpp"
 
 #include <linux/netlink.h>
 #include <net/ethernet.h>
 
+#include <cstdint>
 #include <optional>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/object.hpp>
@@ -27,20 +27,33 @@
 
 class EthernetInterface;
 
+/* @class NeighborFilter
+ */
+struct NeighborFilter
+{
+    unsigned interface;
+    uint16_t state;
+
+    /* @brief Creates an empty filter */
+    NeighborFilter() : interface(0), state(~UINT16_C(0))
+    {
+    }
+};
+
 /** @class NeighborInfo
  *  @brief Information about a neighbor from the kernel
  */
 struct NeighborInfo
 {
-    std::string interface;
+    unsigned interface;
     InAddrAny address;
     std::optional<ether_addr> mac;
-    bool permanent;
+    uint16_t state;
 };
 
 /** @brief Returns a list of the current system neighbor table
  */
-std::vector<NeighborInfo> getCurrentNeighbors();
+std::vector<NeighborInfo> getCurrentNeighbors(const NeighborFilter& filter);
 
 /** @class Neighbor
  *  @brief OpenBMC network neighbor implementation.
@@ -83,8 +96,8 @@
 namespace detail
 {
 
-void parseNeighbor(const nlmsghdr& hdr, std::string_view msg,
-                   std::vector<NeighborInfo>& neighbors);
+void parseNeighbor(const NeighborFilter& filter, const nlmsghdr& hdr,
+                   std::string_view msg, std::vector<NeighborInfo>& neighbors);
 
 } // namespace detail