diff options
Diffstat (limited to 'vlan_interface.hpp')
-rw-r--r-- | vlan_interface.hpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/vlan_interface.hpp b/vlan_interface.hpp new file mode 100644 index 0000000..7f8d043 --- /dev/null +++ b/vlan_interface.hpp @@ -0,0 +1,71 @@ +#pragma once + +#include "types.hpp" + +#include "xyz/openbmc_project/Object/Delete/server.hpp" +#include "xyz/openbmc_project/Network/VLAN/server.hpp" + +#include <sdbusplus/bus.hpp> +#include <sdbusplus/server/object.hpp> + +#include <string> +#include "ethernet_interface.hpp" + +namespace phosphor +{ +namespace network +{ + +class EthernetInterface; +class Manager; + + +using VlanIface = sdbusplus::xyz::openbmc_project::Network::server::VLAN; +using VlanIntfObject = sdbusplus::server::object::object<VlanIface>; + +/** @class VlanInterface + * @brief OpenBMC vlan Interface implementation. + * @details A concrete implementation for the vlan interface + */ +class VlanInterface : public VlanIntfObject, public EthernetInterface +{ + public: + VlanInterface() = delete; + VlanInterface(const VlanInterface&) = delete; + VlanInterface& operator=(const VlanInterface&) = delete; + VlanInterface(VlanInterface&&) = delete; + VlanInterface& operator=(VlanInterface&&) = delete; + virtual ~VlanInterface() = 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. + * @param[in] dhcpEnabled - DHCP enable value. + * @param[in] vlanID - vlan identifier. + * @param[in] intf - ethernet interface object. + * @param[in] manager - network manager object. + */ + VlanInterface(sdbusplus::bus::bus& bus, + const std::string& objPath, + bool dhcpEnabled, + uint32_t vlanID, + EthernetInterface& intf, + Manager& manager); + + /** @brief writes the device configuration. + systemd reads this configuration file + and creates the vlan interface.*/ + void writeDeviceFile(); + + private: + + /** @brief VLAN Identifier. */ + using VlanIface::id; + + EthernetInterface& parentInterface; + + friend class TestVlanInterface; +}; + +} // namespace network +} // namespace phosphor |