Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "types.hpp" |
| 4 | |
| 5 | #include "xyz/openbmc_project/Object/Delete/server.hpp" |
| 6 | #include "xyz/openbmc_project/Network/VLAN/server.hpp" |
| 7 | |
| 8 | #include <sdbusplus/bus.hpp> |
| 9 | #include <sdbusplus/server/object.hpp> |
| 10 | |
| 11 | #include <string> |
| 12 | #include "ethernet_interface.hpp" |
| 13 | |
| 14 | namespace phosphor |
| 15 | { |
| 16 | namespace network |
| 17 | { |
| 18 | |
| 19 | class EthernetInterface; |
| 20 | class Manager; |
| 21 | |
| 22 | |
| 23 | using VlanIface = sdbusplus::xyz::openbmc_project::Network::server::VLAN; |
| 24 | using VlanIntfObject = sdbusplus::server::object::object<VlanIface>; |
| 25 | |
| 26 | /** @class VlanInterface |
| 27 | * @brief OpenBMC vlan Interface implementation. |
| 28 | * @details A concrete implementation for the vlan interface |
| 29 | */ |
| 30 | class VlanInterface : public VlanIntfObject, public EthernetInterface |
| 31 | { |
| 32 | public: |
| 33 | VlanInterface() = delete; |
| 34 | VlanInterface(const VlanInterface&) = delete; |
| 35 | VlanInterface& operator=(const VlanInterface&) = delete; |
| 36 | VlanInterface(VlanInterface&&) = delete; |
| 37 | VlanInterface& operator=(VlanInterface&&) = delete; |
| 38 | virtual ~VlanInterface() = default; |
| 39 | |
| 40 | /** @brief Constructor to put object onto bus at a dbus path. |
| 41 | * @param[in] bus - Bus to attach to. |
| 42 | * @param[in] objPath - Path to attach at. |
| 43 | * @param[in] dhcpEnabled - DHCP enable value. |
| 44 | * @param[in] vlanID - vlan identifier. |
| 45 | * @param[in] intf - ethernet interface object. |
| 46 | * @param[in] manager - network manager object. |
| 47 | */ |
| 48 | VlanInterface(sdbusplus::bus::bus& bus, |
| 49 | const std::string& objPath, |
| 50 | bool dhcpEnabled, |
| 51 | uint32_t vlanID, |
| 52 | EthernetInterface& intf, |
| 53 | Manager& manager); |
| 54 | |
| 55 | /** @brief writes the device configuration. |
| 56 | systemd reads this configuration file |
| 57 | and creates the vlan interface.*/ |
| 58 | void writeDeviceFile(); |
| 59 | |
| 60 | private: |
| 61 | |
| 62 | /** @brief VLAN Identifier. */ |
| 63 | using VlanIface::id; |
| 64 | |
| 65 | EthernetInterface& parentInterface; |
| 66 | |
| 67 | friend class TestVlanInterface; |
| 68 | }; |
| 69 | |
| 70 | } // namespace network |
| 71 | } // namespace phosphor |