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