Ratan Gupta | 4af3676 | 2017-04-20 19:12:29 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "xyz/openbmc_project/Network/IP/server.hpp" |
| 4 | #include "xyz/openbmc_project/Object/Delete/server.hpp" |
| 5 | |
| 6 | #include <sdbusplus/bus.hpp> |
| 7 | #include <sdbusplus/server/object.hpp> |
| 8 | |
| 9 | #include <string> |
| 10 | |
| 11 | namespace phosphor |
| 12 | { |
| 13 | namespace network |
| 14 | { |
| 15 | |
| 16 | using IPIfaces = |
| 17 | sdbusplus::server::object::object< |
| 18 | sdbusplus::xyz::openbmc_project::Network::server::IP, |
| 19 | sdbusplus::xyz::openbmc_project::Object::server::Delete>; |
| 20 | |
| 21 | using IP = sdbusplus::xyz::openbmc_project::Network::server::IP; |
| 22 | |
| 23 | class EthernetInterface; |
| 24 | |
| 25 | /** @class IPAddress |
| 26 | * @brief OpenBMC IPAddress implementation. |
| 27 | * @details A concrete implementation for the |
| 28 | * xyz.openbmc_project.Network.IPProtocol |
| 29 | * xyz.openbmc_project.Network.IP Dbus interfaces. |
| 30 | */ |
| 31 | class IPAddress : public IPIfaces |
| 32 | { |
| 33 | public: |
| 34 | IPAddress() = delete; |
| 35 | IPAddress(const IPAddress&) = delete; |
| 36 | IPAddress& operator=(const IPAddress&) = delete; |
| 37 | IPAddress(IPAddress&&) = delete; |
| 38 | IPAddress& operator=(IPAddress &&) = delete; |
| 39 | virtual ~IPAddress() = default; |
| 40 | |
| 41 | /** @brief Constructor to put object onto bus at a dbus path. |
| 42 | * @param[in] bus - Bus to attach to. |
| 43 | * @param[in] objPath - Path to attach at. |
| 44 | * @param[in] parent - Parent object. |
| 45 | * @param[in] type - ipaddress type(v4/v6). |
| 46 | * @param[in] ipAddress - ipadress. |
| 47 | * @param[in] prefixLength - Length of prefix. |
| 48 | * @param[in] gateway - gateway address. |
| 49 | */ |
| 50 | IPAddress(sdbusplus::bus::bus& bus, |
| 51 | const char* objPath, |
| 52 | EthernetInterface& parent, |
| 53 | IP::Protocol type, |
| 54 | const std::string& ipAddress, |
| 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 |