network_manager: Async query all interface states
This only queries the state during startup and relies on matches to keep
up with changes from the systemd-networkd daemon.
Change-Id: I30776d443c39a52a91826ad1b515da60c7ecf641
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/network_manager.hpp b/src/network_manager.hpp
index f265439..f7eb6bd 100644
--- a/src/network_manager.hpp
+++ b/src/network_manager.hpp
@@ -10,6 +10,7 @@
#include <function2/function2.hpp>
#include <memory>
#include <sdbusplus/bus.hpp>
+#include <sdbusplus/bus/match.hpp>
#include <string>
#include <string_view>
#include <vector>
@@ -42,7 +43,6 @@
class Manager : public details::VLANCreateIface
{
public:
- Manager() = delete;
Manager(const Manager&) = delete;
Manager& operator=(const Manager&) = delete;
Manager(Manager&&) = delete;
@@ -63,6 +63,9 @@
*/
void writeToConfigurationFile();
+ /** @brief Adds a single interface to the interface map */
+ void addInterface(InterfaceInfo& info, bool enabled);
+
/** @brief Fetch the interface and the ipaddress details
* from the system and create the ethernet interraces
* dbus object.
@@ -170,8 +173,18 @@
/** @brief The routing table */
route::Table routeTable;
+ /** @brief Map of interface info for undiscovered interfaces */
+ std::unordered_map<unsigned, InterfaceInfo> undiscoveredIntfInfo;
+
+ /** @brief Map of enabled interfaces */
+ std::unordered_map<unsigned, bool> systemdNetworkdEnabled;
+ sdbusplus::bus::match_t systemdNetworkdEnabledMatch;
+
/** @brief List of hooks to execute during the next reload */
std::vector<fu2::unique_function<void()>> reloadPreHooks;
+
+ /** @brief Handles the recipt of an adminstrative state string */
+ void handleAdminState(std::string_view state, unsigned ifidx);
};
} // namespace network