network_manager: Add reload hooking

This changes no functionality currently, but it makes it possible to
defer actions until just before the systemd reload would occur.

Change-Id: I434b83fe5ad8b2596de162b6a74eefcba4ecc71a
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/network_manager.hpp b/src/network_manager.hpp
index fb3cc32..332971b 100644
--- a/src/network_manager.hpp
+++ b/src/network_manager.hpp
@@ -8,10 +8,11 @@
 #include "xyz/openbmc_project/Network/VLAN/Create/server.hpp"
 
 #include <filesystem>
-#include <list>
+#include <function2/function2.hpp>
 #include <memory>
 #include <sdbusplus/bus.hpp>
 #include <string>
+#include <utility>
 #include <vector>
 #include <xyz/openbmc_project/Common/FactoryReset/server.hpp>
 
@@ -156,6 +157,15 @@
         return routeTable;
     }
 
+    /** @brief Adds a hook that runs immediately prior to reloading
+     *
+     *  @param[in] hook - The hook to execute before reloading
+     */
+    inline void addReloadPreHook(fu2::unique_function<void()>&& hook)
+    {
+        reloadPreHooks.push_back(std::move(hook));
+    }
+
   protected:
     /** @brief Persistent sdbusplus DBus bus connection. */
     sdbusplus::bus::bus& bus;
@@ -181,6 +191,9 @@
 
     /** @brief The routing table */
     route::Table routeTable;
+
+    /** @brief List of hooks to execute during the next reload */
+    std::vector<fu2::unique_function<void()>> reloadPreHooks;
 };
 
 } // namespace network