Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include <sdbusplus/server/object.hpp> |
Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 5 | #include <string> |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame] | 6 | #include <xyz/openbmc_project/Network/IP/server.hpp> |
| 7 | #include <xyz/openbmc_project/Object/Delete/server.hpp> |
Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 8 | |
| 9 | namespace phosphor |
| 10 | { |
| 11 | namespace network |
| 12 | { |
| 13 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 14 | using IPIfaces = sdbusplus::server::object::object< |
| 15 | sdbusplus::xyz::openbmc_project::Network::server::IP, |
| 16 | sdbusplus::xyz::openbmc_project::Object::server::Delete>; |
Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 17 | |
| 18 | using IP = sdbusplus::xyz::openbmc_project::Network::server::IP; |
| 19 | |
| 20 | class EthernetInterface; |
| 21 | |
| 22 | /** @class IPAddress |
| 23 | * @brief OpenBMC IPAddress implementation. |
| 24 | * @details A concrete implementation for the |
| 25 | * xyz.openbmc_project.Network.IPProtocol |
| 26 | * xyz.openbmc_project.Network.IP Dbus interfaces. |
| 27 | */ |
| 28 | class IPAddress : public IPIfaces |
| 29 | { |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 30 | public: |
| 31 | IPAddress() = delete; |
| 32 | IPAddress(const IPAddress&) = delete; |
| 33 | IPAddress& operator=(const IPAddress&) = delete; |
| 34 | IPAddress(IPAddress&&) = delete; |
| 35 | IPAddress& operator=(IPAddress&&) = delete; |
| 36 | virtual ~IPAddress() = default; |
Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 37 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 38 | /** @brief Constructor to put object onto bus at a dbus path. |
| 39 | * @param[in] bus - Bus to attach to. |
| 40 | * @param[in] objPath - Path to attach at. |
| 41 | * @param[in] parent - Parent object. |
| 42 | * @param[in] type - ipaddress type(v4/v6). |
| 43 | * @param[in] ipAddress - ipadress. |
| 44 | * @param[in] origin - origin of ipaddress(dhcp/static/SLAAC/LinkLocal). |
| 45 | * @param[in] prefixLength - Length of prefix. |
| 46 | * @param[in] gateway - gateway address. |
| 47 | */ |
| 48 | IPAddress(sdbusplus::bus::bus& bus, const char* objPath, |
| 49 | EthernetInterface& parent, IP::Protocol type, |
| 50 | const std::string& ipAddress, IP::AddressOrigin origin, |
| 51 | uint8_t prefixLength, const std::string& gateway); |
Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 52 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 53 | /** @brief Delete this d-bus object. |
| 54 | */ |
| 55 | void delete_() override; |
Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 56 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 57 | private: |
| 58 | /** @brief Parent Object. */ |
| 59 | EthernetInterface& parent; |
Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | } // namespace network |
| 63 | } // namespace phosphor |