blob: b0e77fb936e85fb0d7c0f1cd271c9ffbca3b1542 [file] [log] [blame]
Ratan Gupta4af36762017-04-20 19:12:29 +05301#pragma once
2
Ratan Gupta4af36762017-04-20 19:12:29 +05303#include <sdbusplus/bus.hpp>
4#include <sdbusplus/server/object.hpp>
Ratan Gupta4af36762017-04-20 19:12:29 +05305#include <string>
Patrick Venture189d44e2018-07-09 12:30:59 -07006#include <xyz/openbmc_project/Network/IP/server.hpp>
7#include <xyz/openbmc_project/Object/Delete/server.hpp>
Ratan Gupta4af36762017-04-20 19:12:29 +05308
9namespace phosphor
10{
11namespace network
12{
13
Gunnar Mills57d9c502018-09-14 14:42:34 -050014using IPIfaces = sdbusplus::server::object::object<
15 sdbusplus::xyz::openbmc_project::Network::server::IP,
16 sdbusplus::xyz::openbmc_project::Object::server::Delete>;
Ratan Gupta4af36762017-04-20 19:12:29 +053017
18using IP = sdbusplus::xyz::openbmc_project::Network::server::IP;
19
20class 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 */
28class IPAddress : public IPIfaces
29{
Gunnar Mills57d9c502018-09-14 14:42:34 -050030 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 Gupta4af36762017-04-20 19:12:29 +053037
Gunnar Mills57d9c502018-09-14 14:42:34 -050038 /** @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 Gupta4af36762017-04-20 19:12:29 +053052
Gunnar Mills57d9c502018-09-14 14:42:34 -050053 /** @brief Delete this d-bus object.
54 */
55 void delete_() override;
Ratan Gupta4af36762017-04-20 19:12:29 +053056
Gunnar Mills57d9c502018-09-14 14:42:34 -050057 private:
58 /** @brief Parent Object. */
59 EthernetInterface& parent;
Ratan Gupta4af36762017-04-20 19:12:29 +053060};
61
62} // namespace network
63} // namespace phosphor