summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--network_manager.hpp72
2 files changed, 74 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 9c341d8..6f95786 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,8 @@ netman_watch_dns_LDFLAGS = $(SYSTEMD_LIBS)
netman_watch_dns_CFLAGS = $(SYSTEMD_CFLAGS)
noinst_HEADERS = \
- ethernet_interface.hpp
+ ethernet_interface.hpp \
+ network_manager.hpp
phosphor_network_manager_SOURCES = \
ethernet_interface.cpp \
diff --git a/network_manager.hpp b/network_manager.hpp
new file mode 100644
index 0000000..51e9d2c
--- /dev/null
+++ b/network_manager.hpp
@@ -0,0 +1,72 @@
+#pragma once
+
+#include "ethernet_interface.hpp"
+#include "xyz/openbmc_project/Network/VLAN/Create/server.hpp"
+
+#include <sdbusplus/bus.hpp>
+
+#include <list>
+#include <string>
+#include <vector>
+
+namespace phosphor
+{
+namespace network
+{
+
+namespace details
+{
+
+template <typename T>
+using ServerObject = typename sdbusplus::server::object::object<T>;
+
+using VLANCreateIface =
+ details::ServerObject<sdbusplus::xyz::openbmc_project::
+ Network::VLAN::server::Create>;
+
+using IntfName = std::string;
+
+struct AddrInfo {
+ short addrType;
+ std::string ipaddress;
+};
+
+using AddrList = std::list<AddrInfo>;
+using IntfAddrMap = std::map<IntfName, AddrList>;
+
+} // namespace details
+
+/** @class Manager
+ * @brief OpenBMC network manager implementation.
+ */
+class Manager : public details::VLANCreateIface
+{
+ public:
+ Manager() = delete;
+ Manager(const Manager&) = delete;
+ Manager& operator=(const Manager&) = delete;
+ Manager(Manager&&) = delete;
+ Manager& operator=(Manager&&) = delete;
+ virtual ~Manager() = default;
+
+ /** @brief Constructor to put object onto bus at a dbus path.
+ * @param[in] bus - Bus to attach to.
+ * @param[in] objPath - Path to attach at.
+ */
+ Manager(sdbusplus::bus::bus& bus, const char* objPath);
+
+ void vLAN(details::IntfName interfaceName, uint16_t id) override;
+
+ private:
+ /** @brief Get all the interfaces from the system.
+ * @returns list of interface names.
+ */
+ details::IntfAddrMap getInterfaceAndaddrs() const;
+
+ /** @brief Persistent map of EthernetInterface dbus objects and their names */
+ std::map<details::IntfName, std::unique_ptr<EthernetInterface>> interfaces;
+
+};
+
+} // namespace network
+} // namespace phosphor
OpenPOWER on IntegriCloud